You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2011/06/23 00:59:12 UTC
svn commit: r1138673 - in /incubator/isis/trunk/viewer/restful/applib2: ./
src/ src/main/ src/main/java/ src/main/java/META-INF/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/isis/
src/main/java/org/apache/isis/viewer/ src/main/...
Author: danhaywood
Date: Wed Jun 22 22:59:11 2011
New Revision: 1138673
URL: http://svn.apache.org/viewvc?rev=1138673&view=rev
Log:
cloned restful applib to applib2
Added:
incubator/isis/trunk/viewer/restful/applib2/
incubator/isis/trunk/viewer/restful/applib2/pom.xml
incubator/isis/trunk/viewer/restful/applib2/src/
incubator/isis/trunk/viewer/restful/applib2/src/main/
incubator/isis/trunk/viewer/restful/applib2/src/main/java/
incubator/isis/trunk/viewer/restful/applib2/src/main/java/META-INF/
incubator/isis/trunk/viewer/restful/applib2/src/main/java/META-INF/MANIFEST.MF
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/AbstractRestfulClient.java
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/Constants.java
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/RestfulClientException.java
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/StringUtils.java
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/UrlEncodeUtils.java
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/BootstrapResource.java
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/HomePageResource.java
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/ObjectResource.java
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/ServicesResource.java
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/SpecsResource.java
incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/UserResource.java
incubator/isis/trunk/viewer/restful/applib2/src/site/
incubator/isis/trunk/viewer/restful/applib2/src/site/apt/
incubator/isis/trunk/viewer/restful/applib2/src/site/apt/index.apt
incubator/isis/trunk/viewer/restful/applib2/src/site/apt/jottings.apt
incubator/isis/trunk/viewer/restful/applib2/src/site/resources/
incubator/isis/trunk/viewer/restful/applib2/src/site/site.xml
Added: incubator/isis/trunk/viewer/restful/applib2/pom.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/applib2/pom.xml?rev=1138673&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/restful/applib2/pom.xml (added)
+++ incubator/isis/trunk/viewer/restful/applib2/pom.xml Wed Jun 22 22:59:11 2011
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.isis.viewer</groupId>
+ <artifactId>restful</artifactId>
+ <version>0.1.2-incubating-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>restful-applib2</artifactId>
+ <name>Restful Viewer AppLib2</name>
+
+ <properties>
+ <siteBaseDir>../../..</siteBaseDir>
+ <relativeUrl>viewer/restful/applib/</relativeUrl>
+ </properties>
+
+ <!-- used in Site generation for relative references. -->
+ <url>http://incubator.apache.org/isis/${relativeUrl}</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-core-asl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+ </dependencies>
+
+
+ <repositories>
+ <!-- The artifact in the maven repository has been moved and causes a build failure. Using this setting gets the artifact allowing the build to work. This fix should hopefully be temporary -->
+ <repository>
+ <id>java.net</id>
+ <url>http://download.java.net/maven/1</url>
+ </repository>
+ </repositories>
+
+</project>
Added: incubator/isis/trunk/viewer/restful/applib2/src/main/java/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/applib2/src/main/java/META-INF/MANIFEST.MF?rev=1138673&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/restful/applib2/src/main/java/META-INF/MANIFEST.MF (added)
+++ incubator/isis/trunk/viewer/restful/applib2/src/main/java/META-INF/MANIFEST.MF Wed Jun 22 22:59:11 2011
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Added: incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/AbstractRestfulClient.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/AbstractRestfulClient.java?rev=1138673&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/AbstractRestfulClient.java (added)
+++ incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/AbstractRestfulClient.java Wed Jun 22 22:59:11 2011
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restful.applib2;
+
+import org.apache.log4j.Logger;
+
+public abstract class AbstractRestfulClient {
+
+ private static Logger LOG = Logger.getLogger(AbstractRestfulClient.class);
+
+ private final String hostUri;
+
+ public String getHostUri() {
+ return hostUri;
+ }
+
+ public AbstractRestfulClient(final String hostUri) {
+ this.hostUri = hostUri;
+ }
+
+
+ // //////////////////////////////////////////////////////////////////////
+ // Helpers: string
+ // //////////////////////////////////////////////////////////////////////
+
+ protected static String combine(final String... pathParts) {
+ final StringBuilder buf = new StringBuilder();
+ for (final String part : pathParts) {
+ buf.append(part);
+ }
+ return buf.toString();
+ }
+
+}
Added: incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/Constants.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/Constants.java?rev=1138673&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/Constants.java (added)
+++ incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/Constants.java Wed Jun 22 22:59:11 2011
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restful.applib2;
+
+public final class Constants {
+
+ public static final String URL_ENCODING_CHAR_SET = "UTF-8";
+
+ private Constants() {
+ }
+
+}
Added: incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/RestfulClientException.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/RestfulClientException.java?rev=1138673&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/RestfulClientException.java (added)
+++ incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/RestfulClientException.java Wed Jun 22 22:59:11 2011
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restful.applib2;
+
+public class RestfulClientException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public RestfulClientException() {
+ }
+
+ public RestfulClientException(final String message) {
+ super(message);
+ }
+
+ public RestfulClientException(final Throwable cause) {
+ super(cause);
+ }
+
+ public RestfulClientException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+}
Added: incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/StringUtils.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/StringUtils.java?rev=1138673&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/StringUtils.java (added)
+++ incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/StringUtils.java Wed Jun 22 22:59:11 2011
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restful.applib2;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Not API, so intentionally not visible outside this package.
+ */
+final class StringUtils {
+
+ private StringUtils() {
+ }
+
+ /**
+ * Converts a list of objects [a, 1, b, 2] into a map {a -> 1; b -> 2}
+ */
+ static Map<String, String> asMap(final String... paramArgs) {
+ final Map<String, String> map = new LinkedHashMap<String, String>();
+ boolean param = true;
+ String paramStr = null;
+ for (final String paramArg : paramArgs) {
+ if (param) {
+ paramStr = paramArg;
+ } else {
+ final String arg = paramArg;
+ map.put(paramStr, arg);
+ paramStr = null;
+ }
+ param = !param;
+ }
+ if (paramStr != null) {
+ throw new IllegalArgumentException("Must have equal number of parameters and arguments");
+ }
+ return map;
+ }
+
+ static void writeMap(final Map<String, String> formArgumentsByParameter, final Writer writer) {
+ try {
+ final Set<Map.Entry<String, String>> parameterArguments = formArgumentsByParameter.entrySet();
+ for (final Map.Entry<String, String> parameterArgument : parameterArguments) {
+ writer.write(parameterArgument.getKey());
+ writer.write("=");
+ writer.write(parameterArgument.getValue());
+ writer.write("\n");
+ }
+ writer.flush();
+ } catch (final IOException e) {
+ throw new RestfulClientException(e);
+ }
+ }
+
+ static String asString(final Map<String, String> formArgumentsByParameter) {
+ final StringWriter sw = new StringWriter();
+ writeMap(formArgumentsByParameter, sw);
+ return sw.toString();
+ }
+
+}
Added: incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/UrlEncodeUtils.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/UrlEncodeUtils.java?rev=1138673&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/UrlEncodeUtils.java (added)
+++ incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/UrlEncodeUtils.java Wed Jun 22 22:59:11 2011
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restful.applib2;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import javax.ws.rs.WebApplicationException;
+
+/**
+ * Not API, so intentionally not visible outside this package.
+ */
+final class UrlEncodeUtils {
+
+ private UrlEncodeUtils() {
+ }
+
+ static String encode(final String value) {
+ try {
+ return URLEncoder.encode(value, Constants.URL_ENCODING_CHAR_SET);
+ } catch (final UnsupportedEncodingException e) {
+ throw new WebApplicationException(e);
+ }
+ }
+
+ static Map<String, String> urlEncode(final Map<String, String> asMap) {
+ final Map<String, String> encodedMap = new HashMap<String, String>();
+ final Set<Entry<String, String>> entrySet = asMap.entrySet();
+ for (final Entry<String, String> entry : entrySet) {
+ final String value = entry.getValue();
+ encodedMap.put(entry.getKey(), encode(value));
+ }
+ return encodedMap;
+ }
+
+}
Added: incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/BootstrapResource.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/BootstrapResource.java?rev=1138673&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/BootstrapResource.java (added)
+++ incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/BootstrapResource.java Wed Jun 22 22:59:11 2011
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restful.applib2.resources;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+public interface BootstrapResource {
+
+ @GET
+ @Produces({ MediaType.TEXT_HTML })
+ public String bootstrap();
+
+}
\ No newline at end of file
Added: incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/HomePageResource.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/HomePageResource.java?rev=1138673&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/HomePageResource.java (added)
+++ incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/HomePageResource.java Wed Jun 22 22:59:11 2011
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restful.applib2.resources;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+public interface HomePageResource {
+
+ @GET
+ @Produces({ MediaType.APPLICATION_JSON })
+ public String resources();
+
+}
\ No newline at end of file
Added: incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/ObjectResource.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/ObjectResource.java?rev=1138673&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/ObjectResource.java (added)
+++ incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/ObjectResource.java Wed Jun 22 22:59:11 2011
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restful.applib2.resources;
+
+import java.io.InputStream;
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+
+public interface ObjectResource {
+
+ @GET
+ @Path("/{oid}")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public String object(@PathParam("oid") final String oidStr);
+
+ @PUT
+ @Path("/{oid}/property/{propertyId}")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public String modifyProperty(@PathParam("oid") final String oidStr,
+ @PathParam("propertyId") final String propertyId, @QueryParam("proposedValue") final String proposedValue);
+
+ @DELETE
+ @Path("/{oid}/property/{propertyId}")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public String clearProperty(@PathParam("oid") final String oidStr, @PathParam("propertyId") final String propertyId);
+
+ @GET
+ @Path("/{oid}/collection/{collectionId}")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public String accessCollection(@PathParam("oid") final String oidStr,
+ @PathParam("collectionId") final String collectionId);
+
+ @PUT
+ @Path("/{oid}/collection/{collectionId}")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public String addToCollection(@PathParam("oid") final String oidStr,
+ @PathParam("collectionId") final String collectionId,
+ @QueryParam("proposedValue") final String proposedValueOidStr);
+
+ @DELETE
+ @Path("/{oid}/collection/{collectionId}")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public String removeFromCollection(@PathParam("oid") final String oidStr,
+ @PathParam("collectionId") final String collectionId,
+ @QueryParam("proposedValue") final String proposedValueOidStr);
+
+ @POST
+ @Path("/{oid}/action/{actionId}")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public String invokeAction(@PathParam("oid") final String oidStr, @PathParam("actionId") final String actionId,
+ final InputStream body);
+
+}
\ No newline at end of file
Added: incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/ServicesResource.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/ServicesResource.java?rev=1138673&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/ServicesResource.java (added)
+++ incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/ServicesResource.java Wed Jun 22 22:59:11 2011
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restful.applib2.resources;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+public interface ServicesResource {
+
+ @GET
+ @Produces({ MediaType.APPLICATION_JSON })
+ @Path("/")
+ public String services();
+
+}
\ No newline at end of file
Added: incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/SpecsResource.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/SpecsResource.java?rev=1138673&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/SpecsResource.java (added)
+++ incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/SpecsResource.java Wed Jun 22 22:59:11 2011
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restful.applib2.resources;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+public interface SpecsResource {
+
+ @GET
+ @Path("/")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public abstract String specs();
+
+ @GET
+ @Path("/{specFullName}")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public abstract String spec(@PathParam("specFullName") final String specFullName);
+
+ @GET
+ @Path("/{specFullName}/facet/{facetType}")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public abstract String specFacet(@PathParam("specFullName") final String specFullName,
+ @PathParam("facetType") final String facetTypeName);
+
+ @GET
+ @Path("/{specFullName}/property/{propertyName}")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public abstract String specProperty(@PathParam("specFullName") final String specFullName,
+ @PathParam("propertyName") final String propertyName);
+
+ @GET
+ @Path("/{specFullName}/collection/{collectionName}")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public abstract String specCollection(@PathParam("specFullName") final String specFullName,
+ @PathParam("collectionName") final String collectionName);
+
+ @GET
+ @Path("/{specFullName}/action/{actionId}")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public abstract String specAction(@PathParam("specFullName") final String specFullName,
+ @PathParam("actionId") final String actionId);
+
+ @GET
+ @Path("/{specFullName}/property/{propertyName}/facet/{facetType}")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public abstract String specPropertyFacet(@PathParam("specFullName") final String specFullName,
+ @PathParam("propertyName") final String propertyName, @PathParam("facetType") final String facetTypeName);
+
+ @GET
+ @Path("/{specFullName}/collection/{collectionName}/facet/{facetType}")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public abstract String specCollectionFacet(@PathParam("specFullName") final String specFullName,
+ @PathParam("collectionName") final String collectionName, @PathParam("facetType") final String facetTypeName);
+
+ @GET
+ @Path("/{specFullName}/action/{actionId}/facet/{facetType}")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public abstract String specActionFacet(@PathParam("specFullName") final String specFullName,
+ @PathParam("actionId") final String actionId, @PathParam("facetType") final String facetTypeName);
+
+}
\ No newline at end of file
Added: incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/UserResource.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/UserResource.java?rev=1138673&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/UserResource.java (added)
+++ incubator/isis/trunk/viewer/restful/applib2/src/main/java/org/apache/isis/viewer/restful/applib2/resources/UserResource.java Wed Jun 22 22:59:11 2011
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restful.applib2.resources;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+public interface UserResource {
+
+ @GET
+ @Produces({ MediaType.APPLICATION_JSON })
+ public String user();
+
+}
\ No newline at end of file
Added: incubator/isis/trunk/viewer/restful/applib2/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/applib2/src/site/apt/index.apt?rev=1138673&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/restful/applib2/src/site/apt/index.apt (added)
+++ incubator/isis/trunk/viewer/restful/applib2/src/site/apt/index.apt Wed Jun 22 22:59:11 2011
@@ -0,0 +1,28 @@
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License. You may obtain a copy of the License at
+~~
+~~ http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied. See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+
+Restful AppLib
+
+ The restful viewer's <applib> module defines (among other things) the
+ JAX-RS (JSR-311) compliant interfaces which define the URIs exposed by
+ the viewer. These do allow frameworks (such as JBoss' {{{http://jboss.org/resteasy}RestEasy}}
+ framework) to generate client-side bindings.
+
+Further Info
+
+ See this module's {{{./apidocs/index.html}Javadoc}} and the {{{../docbkx/html/guide/isis-restful-viewer.html}user guide}} for more information.
+
\ No newline at end of file
Added: incubator/isis/trunk/viewer/restful/applib2/src/site/apt/jottings.apt
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/applib2/src/site/apt/jottings.apt?rev=1138673&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/restful/applib2/src/site/apt/jottings.apt (added)
+++ incubator/isis/trunk/viewer/restful/applib2/src/site/apt/jottings.apt Wed Jun 22 22:59:11 2011
@@ -0,0 +1,24 @@
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License. You may obtain a copy of the License at
+~~
+~~ http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied. See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+
+
+
+Jottings
+
+ This page is to capture any random jottings relating to this module prior
+ to being moved into formal documentation.
+
Added: incubator/isis/trunk/viewer/restful/applib2/src/site/site.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/applib2/src/site/site.xml?rev=1138673&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/restful/applib2/src/site/site.xml (added)
+++ incubator/isis/trunk/viewer/restful/applib2/src/site/site.xml Wed Jun 22 22:59:11 2011
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project name="${project.name}">
+ <version position="right"/>
+
+ <body>
+ <breadcrumbs>
+ <item name="Applib" href="index.html"/>
+ </breadcrumbs>
+
+ <menu name="Restful Applib">
+ <item name="About" href="index.html" />
+ <item name="Jottings" href="jottings.html" />
+ </menu>
+
+ <menu name="Restful Modules">
+ <item name="Applib" href="./applib/index.html" />
+ <item name="Viewer" href="./viewer/index.html" />
+ </menu>
+
+ <menu name="Maven Reports" ref="reports" />
+ </body>
+</project>