incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1183125 [1/2] - in /incubator/isis/trunk/framework/viewer/json: json-applib/src/main/java/org/apache/isis/viewer/json/applib/ json-applib/src/main/java/org/apache/isis/viewer/json/applib/homepage/ json-applib/src/test/java/org/apache/isis/...
Date Thu, 13 Oct 2011 21:57:17 GMT
Author: danhaywood
Date: Thu Oct 13 21:57:15 2011
New Revision: 1183125

URL: http://svn.apache.org/viewvc?rev=1183125&view=rev
Log:
ISIS-109: x-ro-follow-links now has support for criteria syntax

Added:
    incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest_accept.java
    incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest_representationAndHeaders.java
      - copied, changed from r1182130, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest.java
    incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/
    incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_accept.java
    incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_notFound.java
    incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_representationAndHeaders.java
      - copied, changed from r1182130, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_service_serviceId.java
    incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_xrofollowlinks.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/ListUtil.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/Node.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectLinkTo.java
      - copied, changed from r1182130, incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectLinkToBuilder.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceLinkTo.java
      - copied, changed from r1182130, incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceLinkToBuilder.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectAdapterLinkTo.java
      - copied, changed from r1182130, incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectAdapterLinkToBuilder.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/test/java/org/apache/isis/viewer/json/viewer/representations/LinkFollowerTest_follow.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/test/java/org/apache/isis/viewer/json/viewer/representations/ListUtilTest_asGraph.java
      - copied, changed from r1182226, incubator/isis/trunk/framework/viewer/json/json-viewer/src/test/java/org/apache/isis/viewer/json/viewer/representations/PathFollowerTest_asGraph.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/test/java/org/apache/isis/viewer/json/viewer/representations/NodeTest_equalsHashcode.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/test/java/org/apache/isis/viewer/json/viewer/representations/NodeTest_parse.java
Removed:
    incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest.java
    incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_service_serviceId.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectLinkToBuilder.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceLinkToBuilder.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectAdapterLinkToBuilder.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/test/java/org/apache/isis/viewer/json/viewer/representations/PathFollowerTest_asGraph.java
Modified:
    incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/JsonRepresentation.java
    incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/RestfulClient.java
    incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/RestfulRequest.java
    incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/homepage/HomePageResource.java
    incubator/isis/trunk/framework/viewer/json/json-applib/src/test/java/org/apache/isis/viewer/json/applib/JsonRepresentationTest_xpath.java
    incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_representationAndHeaders.java
    incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_xrofollowlinks.java
    incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java
    incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/services/DomainServiceResourceTest_services_representationAndHeaders.java
    incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/services/DomainServiceResourceTest_services_xrofollowlinks.java
    incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/stories/UserStoryTest.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/LinkBuilder.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/LinkFollower.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/ReprRendererAbstract.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/AbstractObjectMemberReprRenderer.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectReprRenderer.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceResourceServerside.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ListReprRenderer.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/home/HomePageReprRenderer.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/home/HomePageResourceServerside.java

Modified: incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/JsonRepresentation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/JsonRepresentation.java?rev=1183125&r1=1183124&r2=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/JsonRepresentation.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/JsonRepresentation.java Thu Oct 13 21:57:15 2011
@@ -96,8 +96,21 @@ public class JsonRepresentation {
     }
     
 
-    public static JsonRepresentation newMap() {
-        return new JsonRepresentation(new ObjectNode(JsonNodeFactory.instance));
+    public static JsonRepresentation newMap(String... keyValuePairs) {
+        final JsonRepresentation repr = new JsonRepresentation(new ObjectNode(JsonNodeFactory.instance));
+        String key = null;
+        for(String keyOrValue: keyValuePairs) {
+            if(key != null) {
+                repr.mapPut(key, keyOrValue);
+                key = null;
+            } else {
+                key = keyOrValue;
+            }
+        }
+        if(key != null) {
+            throw new IllegalArgumentException("must provide an even number of keys and values");
+        }
+        return repr;
     }
 
     public static JsonRepresentation newArray() {
@@ -616,11 +629,12 @@ public class JsonRepresentation {
     /////////////////////////////////////////////////////////////////////////
     // xpath support
     /////////////////////////////////////////////////////////////////////////
-    
+
     /**
      * Requires xom:xom:1.1 (LGPL) to be added as a dependency.
      */
-    public JsonRepresentation xpath(String xpathExpression) {
+    public JsonRepresentation xpath(String xpathExpressionFormat, Object... args) {
+        String xpathExpression = String.format(xpathExpressionFormat,  args);
         try {
             // puts object structure under a <o>
             org.jdom.Document jdomDoc = new SAXBuilder().build(new StringReader(toXml()));

Modified: incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/RestfulClient.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/RestfulClient.java?rev=1183125&r1=1183124&r2=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/RestfulClient.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/RestfulClient.java Thu Oct 13 21:57:15 2011
@@ -119,12 +119,21 @@ public class RestfulClient {
 
     public RestfulRequest createRequest(HttpMethod httpMethod, String uriTemplate) {
         
-        ClientRequest clientRequest = clientRequestFactory.createRelativeRequest(uriTemplate);
+        ClientRequest clientRequest = createRequest(uriTemplate);
         clientRequest.accept(MediaType.APPLICATION_JSON_TYPE);
         clientRequest.setHttpMethod(httpMethod.getJavaxRsMethod());
         
         return new RestfulRequest(clientRequest, httpMethod);
     }
+
+    private ClientRequest createRequest(String uriTemplate) {
+        boolean includesScheme = uriTemplate.startsWith("http:") || uriTemplate.startsWith("https:");
+        if(includesScheme) {
+            return clientRequestFactory.createRequest(uriTemplate);
+        } else {
+            return clientRequestFactory.createRelativeRequest(uriTemplate);
+        }
+    }
     
     /**
      * exposed for testing purposes only.

Modified: incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/RestfulRequest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/RestfulRequest.java?rev=1183125&r1=1183124&r2=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/RestfulRequest.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/RestfulRequest.java Thu Oct 13 21:57:15 2011
@@ -153,8 +153,9 @@ public final class RestfulRequest {
         return this;
     }
 
-    public <Q> RestfulRequest withArg(RestfulRequest.QueryParameter<Q> queryParam, String argStr) {
-        final Q arg = queryParam.getParser().valueOf(argStr);
+    public <Q> RestfulRequest withArg(RestfulRequest.QueryParameter<Q> queryParam, String argStrFormat, Object... args) {
+        String argStr = String.format(argStrFormat, args);
+        final Q arg = queryParam.getParser().valueOf(argStr );
         return withArg(queryParam, arg);
     }
 

Modified: incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/homepage/HomePageResource.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/homepage/HomePageResource.java?rev=1183125&r1=1183124&r2=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/homepage/HomePageResource.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/homepage/HomePageResource.java Thu Oct 13 21:57:15 2011
@@ -33,6 +33,6 @@ public interface HomePageResource {
     @GET
     @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_HOME_PAGE })
     @ClientResponseType(entityType=String.class)
-    public Response resources();
+    public Response homePage();
 
 }
\ No newline at end of file

Modified: incubator/isis/trunk/framework/viewer/json/json-applib/src/test/java/org/apache/isis/viewer/json/applib/JsonRepresentationTest_xpath.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-applib/src/test/java/org/apache/isis/viewer/json/applib/JsonRepresentationTest_xpath.java?rev=1183125&r1=1183124&r2=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-applib/src/test/java/org/apache/isis/viewer/json/applib/JsonRepresentationTest_xpath.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-applib/src/test/java/org/apache/isis/viewer/json/applib/JsonRepresentationTest_xpath.java Thu Oct 13 21:57:15 2011
@@ -48,7 +48,7 @@ public class JsonRepresentationTest_xpat
     }
     
     @Test
-    public void mapXpath_matchingSingleElement() throws JsonParseException, JsonMappingException, IOException, ValidityException, ParsingException {
+    public void xpath_matchingSingleElement() throws JsonParseException, JsonMappingException, IOException, ValidityException, ParsingException {
         JsonRepresentation matching = mapRepresentation.xpath("//*[rel='someRel']");
         assertThat(matching, is(not(nullValue())));
         assertThat(matching.isArray(), is(false));
@@ -56,7 +56,7 @@ public class JsonRepresentationTest_xpat
     }
 
     @Test
-    public void mapXpath_matchingMultipleElementsInMap() throws JsonParseException, JsonMappingException, IOException, ValidityException, ParsingException {
+    public void xpath_matchingMultipleElementsInMap() throws JsonParseException, JsonMappingException, IOException, ValidityException, ParsingException {
         JsonRepresentation matching = mapRepresentation.xpath("/*");
         assertThat(matching, is(not(nullValue())));
         assertThat(matching.isArray(), is(false));

Added: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest_accept.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest_accept.java?rev=1183125&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest_accept.java (added)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest_accept.java Thu Oct 13 21:57:15 2011
@@ -0,0 +1,64 @@
+package org.apache.isis.viewer.json.tck.resources.capabilities;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.MediaType;
+
+import org.apache.isis.runtimes.dflt.webserver.WebServer;
+import org.apache.isis.viewer.json.applib.HttpMethod;
+import org.apache.isis.viewer.json.applib.RepresentationType;
+import org.apache.isis.viewer.json.applib.RestfulClient;
+import org.apache.isis.viewer.json.applib.RestfulRequest;
+import org.apache.isis.viewer.json.applib.RestfulResponse;
+import org.apache.isis.viewer.json.applib.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.json.applib.capabilities.CapabilitiesRepresentation;
+import org.apache.isis.viewer.json.applib.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.json.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class CapabilitiesResourceTest_accept {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+
+    @Before
+    public void setUp() throws Exception {
+        WebServer webServer = webServerRule.getWebServer();
+        client = new RestfulClient(webServer.getBase());
+    }
+
+    @Test
+    public void applicationJson() throws Exception {
+
+        final RestfulRequest request = 
+                client.createRequest(HttpMethod.GET, "capabilities").withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
+        final RestfulResponse<CapabilitiesRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+    }
+
+    @Test
+    public void applicationJson_profileCapabilities() throws Exception {
+
+        final RestfulRequest request = 
+                client.createRequest(HttpMethod.GET, "capabilities").withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.CAPABILITIES.getMediaType());
+        final RestfulResponse<CapabilitiesRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+    }
+
+    @Test
+    public void applicationJson_invalid() throws Exception {
+
+        final RestfulRequest request = client.createRequest(HttpMethod.GET, "/").withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.USER.getMediaType());
+        final RestfulResponse<CapabilitiesRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+    }
+
+}

Copied: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest_representationAndHeaders.java (from r1182130, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest_representationAndHeaders.java?p2=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest_representationAndHeaders.java&p1=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest.java&r1=1182130&r2=1183125&rev=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/capabilities/CapabilitiesResourceTest_representationAndHeaders.java Thu Oct 13 21:57:15 2011
@@ -1,6 +1,11 @@
 package org.apache.isis.viewer.json.tck.resources.capabilities;
 
 import static org.apache.isis.viewer.json.tck.RepresentationMatchers.assertThat;
+import static org.apache.isis.viewer.json.tck.RepresentationMatchers.hasMaxAge;
+import static org.apache.isis.viewer.json.tck.RepresentationMatchers.hasParameter;
+import static org.apache.isis.viewer.json.tck.RepresentationMatchers.hasSubType;
+import static org.apache.isis.viewer.json.tck.RepresentationMatchers.hasType;
+import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isArray;
 import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isFollowableLinkToSelf;
 import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isLink;
 import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isMap;
@@ -11,18 +16,22 @@ import static org.junit.Assert.assertTha
 
 import java.io.IOException;
 
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.Status.Family;
 
 import org.apache.isis.runtimes.dflt.webserver.WebServer;
 import org.apache.isis.viewer.json.applib.JsonRepresentation;
+import org.apache.isis.viewer.json.applib.RepresentationType;
 import org.apache.isis.viewer.json.applib.RestfulClient;
 import org.apache.isis.viewer.json.applib.RestfulResponse;
+import org.apache.isis.viewer.json.applib.RestfulResponse.Header;
+import org.apache.isis.viewer.json.applib.RestfulResponse.HttpStatusCode;
 import org.apache.isis.viewer.json.applib.blocks.Method;
 import org.apache.isis.viewer.json.applib.capabilities.CapabilitiesRepresentation;
 import org.apache.isis.viewer.json.applib.capabilities.CapabilitiesResource;
 import org.apache.isis.viewer.json.tck.IsisWebServerRule;
-import org.apache.isis.viewer.json.tck.RepresentationMatchers;
 import org.codehaus.jackson.JsonParseException;
 import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
@@ -30,7 +39,7 @@ import org.junit.Rule;
 import org.junit.Test;
 
 
-public class CapabilitiesResourceTest {
+public class CapabilitiesResourceTest_representationAndHeaders {
 
     @Rule
     public IsisWebServerRule webServerRule = new IsisWebServerRule();
@@ -46,17 +55,21 @@ public class CapabilitiesResourceTest {
         resource = client.getCapabilitiesResource();
     }
 
-
     @Test
     public void representation() throws Exception {
         
-        // when
+        // given
         Response servicesResp = resource.capabilities();
-        RestfulResponse<CapabilitiesRepresentation> jsonResp = RestfulResponse.ofT(servicesResp);
-        assertThat(jsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
+        
+        // when
+        RestfulResponse<CapabilitiesRepresentation> restfulResponse = RestfulResponse.ofT(servicesResp);
+        assertThat(restfulResponse.getStatus().getFamily(), is(Family.SUCCESSFUL));
         
         // then
-        CapabilitiesRepresentation repr = jsonResp.getEntity();
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+        
+        CapabilitiesRepresentation repr = restfulResponse.getEntity();
+        assertThat(repr, is(not(nullValue())));
         assertThat(repr, isMap());
 
         assertThat(repr.getSelf(), isLink().method(Method.GET));
@@ -75,10 +88,31 @@ public class CapabilitiesResourceTest {
         assertThat(capabilities.getString("sorting"), is("no"));
         assertThat(capabilities.getString("domainModel"), is("rich"));
         
-        assertThat(repr.getLinks(), is(not(nullValue())));
+        assertThat(repr.getLinks(), isArray());
         assertThat(repr.getExtensions(), is(not(nullValue())));
     }
 
+    @Test
+    public void headers() throws Exception {
+        // given
+        Response resp = resource.capabilities();
+        
+        // when
+        RestfulResponse<CapabilitiesRepresentation> restfulResponse = RestfulResponse.ofT(resp);
+        
+        // then
+        final MediaType contentType = restfulResponse.getHeader(Header.CONTENT_TYPE);
+        assertThat(contentType, hasType("application"));
+        assertThat(contentType, hasSubType("json"));
+        assertThat(contentType, hasParameter("profile", "http://restfulobjects.org/profiles/capabilities"));
+        assertThat(contentType, is(RepresentationType.CAPABILITIES.getMediaType()));
+        
+        // then
+        final CacheControl cacheControl = restfulResponse.getHeader(Header.CACHE_CONTROL);
+        assertThat(cacheControl, hasMaxAge(24*60*60));
+        assertThat(cacheControl.getMaxAge(), is(24*60*60));
+    }
+
 
     @Test
     public void selfIsFollowable() throws Exception {

Modified: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_representationAndHeaders.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_representationAndHeaders.java?rev=1183125&r1=1183124&r2=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_representationAndHeaders.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_representationAndHeaders.java Thu Oct 13 21:57:15 2011
@@ -58,7 +58,7 @@ public class HomePageResourceTest_repres
     public void representation() throws Exception {
 
         // given
-        Response resp = resource.resources();
+        Response resp = resource.homePage();
         
         // when
         RestfulResponse<HomePageRepresentation> restfulResponse = RestfulResponse.ofT(resp);
@@ -69,7 +69,7 @@ public class HomePageResourceTest_repres
         
         HomePageRepresentation repr = restfulResponse.getEntity();
         assertThat(repr, is(not(nullValue())));
-        assertThat(repr.isMap(), is(true));
+        assertThat(repr, isMap());
         
         assertThat(repr.getSelf(), isLink(client).method(Method.GET));
         assertThat(repr.getUser(), isLink(client).method(Method.GET));
@@ -83,7 +83,7 @@ public class HomePageResourceTest_repres
     @Test
     public void headers() throws Exception {
         // given
-        Response resp = resource.resources();
+        Response resp = resource.homePage();
         
         // when
         RestfulResponse<HomePageRepresentation> restfulResponse = RestfulResponse.ofT(resp);
@@ -122,7 +122,7 @@ public class HomePageResourceTest_repres
     }
 
     private HomePageRepresentation givenRepresentation() throws JsonParseException, JsonMappingException, IOException {
-        RestfulResponse<HomePageRepresentation> response = RestfulResponse.ofT(resource.resources());
+        RestfulResponse<HomePageRepresentation> response = RestfulResponse.ofT(resource.homePage());
         return response.getEntity();
     }
 

Modified: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_xrofollowlinks.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_xrofollowlinks.java?rev=1183125&r1=1183124&r2=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_xrofollowlinks.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/home/HomePageResourceTest_xrofollowlinks.java Thu Oct 13 21:57:15 2011
@@ -4,15 +4,21 @@ import static org.hamcrest.CoreMatchers.
 import static org.hamcrest.CoreMatchers.not;
 import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertThat;
+import static org.apache.isis.viewer.json.tck.RepresentationMatchers.*;
+
+import java.io.IOException;
 
 import org.apache.isis.runtimes.dflt.webserver.WebServer;
 import org.apache.isis.viewer.json.applib.HttpMethod;
+import org.apache.isis.viewer.json.applib.JsonRepresentation;
 import org.apache.isis.viewer.json.applib.RestfulClient;
 import org.apache.isis.viewer.json.applib.RestfulRequest;
 import org.apache.isis.viewer.json.applib.RestfulRequest.QueryParameter;
 import org.apache.isis.viewer.json.applib.RestfulResponse;
 import org.apache.isis.viewer.json.applib.homepage.HomePageRepresentation;
 import org.apache.isis.viewer.json.tck.IsisWebServerRule;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -25,35 +31,86 @@ public class HomePageResourceTest_xrofol
     
     private RestfulClient client;
 
+    private RestfulRequest request;
+    private RestfulResponse<HomePageRepresentation> restfulResponse;
+    private HomePageRepresentation repr;
+
     @Before
     public void setUp() throws Exception {
         WebServer webServer = webServerRule.getWebServer();
         client = new RestfulClient(webServer.getBase());
-    }
-
-    @Test
-    public void xrofollowLinks() throws Exception {
 
-        RestfulRequest request;
-        RestfulResponse<HomePageRepresentation> restfulResponse;
-        HomePageRepresentation repr;
-        
         request = client.createRequest(HttpMethod.GET, "/");
         restfulResponse = request.executeT();
         repr = restfulResponse.getEntity();
         
+        // given
         assertThat(repr.getUser().getValue(), is(nullValue()));
         assertThat(repr.getCapabilities().getValue(), is(nullValue()));
         assertThat(repr.getServices().getValue(), is(nullValue()));
+    }
 
-        request = client.createRequest(HttpMethod.GET, "/").withArg(QueryParameter.FOLLOW_LINKS, "user,services,capabilities");
-        restfulResponse = request.executeT();
-        repr = restfulResponse.getEntity();
+    @Test
+    public void all() throws Exception {
+
+        repr = whenExecuteWith("/", "user,services,capabilities");
 
         assertThat(repr.getUser().getValue(), is(not(nullValue())));
         assertThat(repr.getCapabilities().getValue(), is(not(nullValue())));
         assertThat(repr.getServices().getValue(), is(not(nullValue())));
     }
+
+    @Test
+    public void servicesValues() throws Exception {
+
+        repr = whenExecuteWith("/", "services.values");
+
+        JsonRepresentation servicesValue = repr.getServices().getValue();
+        assertThat(servicesValue, is(not(nullValue())));
+        assertThat(servicesValue, isMap());
+        final JsonRepresentation serviceLinkList = servicesValue.getArray("values");
+        assertThat(serviceLinkList, isArray());
+        
+        JsonRepresentation service;
+        
+        service = serviceLinkList.xpath("/e[key='%s']", "simples");
+        assertThat(service.getRepresentation("e"), isMap());
+        assertThat(service.getString("e.key"), is("simples"));
+        assertThat(service.getRepresentation("e.value"), is(not(nullValue())));
+
+        service = serviceLinkList.xpath("/e[key='%s']", "applibValuedEntities");
+        assertThat(service.getRepresentation("e"), isMap());
+        assertThat(service.getString("e.key"), is("applibValuedEntities"));
+        assertThat(service.getRepresentation("e.value"), is(not(nullValue())));
+    }
+
+    @Test
+    public void servicesValuesWithCriteria() throws Exception {
+
+        repr = whenExecuteWith("/", "services.values[key=simples]");
+
+        JsonRepresentation servicesValue = repr.getServices().getValue();
+        assertThat(servicesValue, is(not(nullValue())));
+        assertThat(servicesValue, isMap());
+        final JsonRepresentation serviceLinkList = servicesValue.getArray("values");
+        assertThat(serviceLinkList, isArray());
+        
+        JsonRepresentation service;
+        
+        service = serviceLinkList.xpath("/e[key='%s']", "simples");
+        assertThat(service.getRepresentation("e"), isMap());
+        assertThat(service.getString("e.key"), is("simples"));
+        assertThat(service.getRepresentation("e.value"), is(not(nullValue())));
+
+        service = serviceLinkList.xpath("/e[key='%s']", "applibValuedEntities");
+        assertThat(service.getRepresentation("e.value"), is(nullValue()));
+    }
+
+    private HomePageRepresentation whenExecuteWith(final String uriTemplate, final String followLinks) throws JsonParseException, JsonMappingException, IOException {
+        request = client.createRequest(HttpMethod.GET, uriTemplate).withArg(QueryParameter.FOLLOW_LINKS, followLinks);
+        restfulResponse = request.executeT();
+        return restfulResponse.getEntity();
+    }
     
 
 }

Modified: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java?rev=1183125&r1=1183124&r2=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java Thu Oct 13 21:57:15 2011
@@ -8,7 +8,6 @@ import org.apache.isis.viewer.json.appli
 import org.apache.isis.viewer.json.applib.domainobjects.DomainObjectRepresentation;
 import org.apache.isis.viewer.json.applib.domainobjects.DomainServiceResource;
 import org.apache.isis.viewer.json.tck.IsisWebServerRule;
-import org.apache.isis.viewer.json.tck.RepresentationMatchers;
 import org.codehaus.jackson.JsonParseException;
 import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;

Added: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_accept.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_accept.java?rev=1183125&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_accept.java (added)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_accept.java Thu Oct 13 21:57:15 2011
@@ -0,0 +1,89 @@
+package org.apache.isis.viewer.json.tck.resources.service.serviceId;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.runtimes.dflt.webserver.WebServer;
+import org.apache.isis.viewer.json.applib.HttpMethod;
+import org.apache.isis.viewer.json.applib.RepresentationType;
+import org.apache.isis.viewer.json.applib.RestfulClient;
+import org.apache.isis.viewer.json.applib.RestfulRequest;
+import org.apache.isis.viewer.json.applib.RestfulResponse;
+import org.apache.isis.viewer.json.applib.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.json.applib.domainobjects.DomainObjectRepresentation;
+import org.apache.isis.viewer.json.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.json.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.json.applib.homepage.HomePageRepresentation;
+import org.apache.isis.viewer.json.tck.IsisWebServerRule;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.jboss.resteasy.spi.Link;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_serviceId_accept {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+
+    @Before
+    public void setUp() throws Exception {
+        WebServer webServer = webServerRule.getWebServer();
+        client = new RestfulClient(webServer.getBase());
+    }
+
+    @Test
+    public void applicationJson() throws Exception {
+
+        final String href = givenLinkToService();
+        
+        final RestfulRequest request = 
+                client.createRequest(HttpMethod.GET, href).withHeader(RestfulRequest.Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);
+        final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+    }
+
+    @Test
+    public void applicationJson_profileList() throws Exception {
+
+        final String href = givenLinkToService();
+
+        final RestfulRequest request = 
+                client.createRequest(HttpMethod.GET, href).withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.DOMAIN_OBJECT.getMediaType());
+        final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+    }
+
+    @Test
+    public void applicationJson_invalid() throws Exception {
+
+        final String href = givenLinkToService();
+
+        final RestfulRequest request = 
+                client.createRequest(HttpMethod.GET, href).withHeader(RestfulRequest.Header.ACCEPT, RepresentationType.USER.getMediaType());
+        final RestfulResponse<DomainObjectRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.NOT_ACCEPTABLE));
+    }
+
+    private String givenLinkToService() throws JsonParseException, JsonMappingException, IOException {
+        final DomainServiceResource resource = client.getDomainServiceResource();
+        final Response response = resource.services();
+        final ListRepresentation services = RestfulResponse.<ListRepresentation>ofT(response).getEntity();
+
+        final String href = services.xpath("//*[key='%s']", "simples").getLink("e").getHref();
+        return href;
+    }
+
+
+}

Added: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_notFound.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_notFound.java?rev=1183125&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_notFound.java (added)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_notFound.java Thu Oct 13 21:57:15 2011
@@ -0,0 +1,49 @@
+package org.apache.isis.viewer.json.tck.resources.service.serviceId;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.runtimes.dflt.webserver.WebServer;
+import org.apache.isis.viewer.json.applib.JsonRepresentation;
+import org.apache.isis.viewer.json.applib.RestfulClient;
+import org.apache.isis.viewer.json.applib.RestfulResponse;
+import org.apache.isis.viewer.json.applib.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.json.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.json.tck.IsisWebServerRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+
+public class DomainServiceResourceTest_serviceId_notFound {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+    
+    private RestfulClient client;
+    private DomainServiceResource resource;
+
+    @Before
+    public void setUp() throws Exception {
+        WebServer webServer = webServerRule.getWebServer();
+        client = new RestfulClient(webServer.getBase());
+        
+        resource = client.getDomainServiceResource();
+    }
+
+    @Test
+    public void notFound() throws Exception {
+
+        // when
+        Response resp = resource.service("nonExistentServiceId");
+        RestfulResponse<JsonRepresentation> jsonResp = RestfulResponse.of(resp);
+        
+        // then
+        assertThat(jsonResp.getStatus(), is(HttpStatusCode.NOT_FOUND));
+    }
+
+
+}
+    
\ No newline at end of file

Copied: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_representationAndHeaders.java (from r1182130, incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_service_serviceId.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_representationAndHeaders.java?p2=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_representationAndHeaders.java&p1=incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_service_serviceId.java&r1=1182130&r2=1183125&rev=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/DomainServiceResourceTest_service_serviceId.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_representationAndHeaders.java Thu Oct 13 21:57:15 2011
@@ -1,4 +1,4 @@
-package org.apache.isis.viewer.json.tck.resources.service;
+package org.apache.isis.viewer.json.tck.resources.service.serviceId;
 
 import static org.apache.isis.core.commons.matchers.IsisMatchers.matches;
 import static org.apache.isis.viewer.json.tck.RepresentationMatchers.assertThat;
@@ -7,8 +7,6 @@ import static org.apache.isis.viewer.jso
 import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isLink;
 import static org.apache.isis.viewer.json.tck.RepresentationMatchers.isMap;
 import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertThat;
 
 import java.io.IOException;
@@ -16,28 +14,22 @@ import java.io.IOException;
 import javax.ws.rs.core.Response;
 
 import org.apache.isis.runtimes.dflt.webserver.WebServer;
-import org.apache.isis.viewer.json.applib.JsonRepresentation;
 import org.apache.isis.viewer.json.applib.RepresentationType;
 import org.apache.isis.viewer.json.applib.RestfulClient;
 import org.apache.isis.viewer.json.applib.RestfulResponse;
 import org.apache.isis.viewer.json.applib.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.json.applib.blocks.Link;
 import org.apache.isis.viewer.json.applib.blocks.Method;
 import org.apache.isis.viewer.json.applib.domainobjects.DomainObjectRepresentation;
 import org.apache.isis.viewer.json.applib.domainobjects.DomainServiceResource;
-import org.apache.isis.viewer.json.applib.domainobjects.ObjectActionRepresentation;
 import org.apache.isis.viewer.json.tck.IsisWebServerRule;
-import org.apache.isis.viewer.json.tck.RepresentationMatchers;
-import org.apache.isis.viewer.json.viewer.resources.domainobjects.MemberType;
 import org.codehaus.jackson.JsonParseException;
 import org.codehaus.jackson.map.JsonMappingException;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 
 
-public class DomainServiceResourceTest_service_serviceId {
+public class DomainServiceResourceTest_serviceId_representationAndHeaders {
 
     @Rule
     public IsisWebServerRule webServerRule = new IsisWebServerRule();
@@ -65,8 +57,6 @@ public class DomainServiceResourceTest_s
         
         // then
         assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
-        assertThat(jsonResp.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.DOMAIN_OBJECT.getMediaType()));
-        assertThat(jsonResp.getHeader(RestfulResponse.Header.CACHE_CONTROL).getMaxAge(), is(24*60*60));
 
         DomainObjectRepresentation repr = jsonResp.getEntity();
 
@@ -84,52 +74,29 @@ public class DomainServiceResourceTest_s
 
 
     @Test
-    public void self_isFollowable() throws Exception {
-        // given
-        DomainObjectRepresentation repr = givenRepresentation("simples");
-
-        // when, then
-        assertThat(repr, isFollowableLinkToSelf(client));
-    }
-
-
-    @Ignore("broken - need to duplicate logic in DSRS")
-    @Test
-    public void members_actions() throws Exception {
+    public void headers() throws Exception {
         // given
-        DomainObjectRepresentation repr = givenRepresentation("simples");
-
-        JsonRepresentation actions = repr.xpath("/members/e[memberType='objectAction']");
-        assertThat(actions.arraySize(), is(3));
-        for (ObjectActionRepresentation memberRepr : actions.arrayIterable(ObjectActionRepresentation.class)) {
-            assertThat(memberRepr.getMemberType(), is(not(nullValue())));
-            assertThat(MemberType.lookup(memberRepr.getMemberType()), is(MemberType.OBJECT_ACTION));
-            assertThat(memberRepr.getActionId(), is(not(nullValue())));
-            assertThat(memberRepr.getActionDetails(), isLink());
-            assertThat(memberRepr.getDisabledReason(), is(nullValue()));
-        }
-        
-        JsonRepresentation listActionRepr = repr.xpath("/members/e[memberType='objectAction' and actionId='list']").getRepresentation("e");
-        Link listActionDetailsLink = listActionRepr.getLink("actionDetails");
+        Response resp = resource.service("simples");
         
         // when
-        Response listActionDetailsResp = client.follow(listActionDetailsLink);
+        RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resp);
         
         // then
-        RestfulResponse<ObjectActionRepresentation> listActionDetailsJsonResp = RestfulResponse.ofT(listActionDetailsResp);
-        assertThat(listActionDetailsJsonResp.getStatus(), is(HttpStatusCode.OK));
-
-        ObjectActionRepresentation listActionDetailsRepr = listActionDetailsJsonResp.getEntity();
-        
-        
+        assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
+        assertThat(jsonResp.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.DOMAIN_OBJECT.getMediaType()));
+        assertThat(jsonResp.getHeader(RestfulResponse.Header.CACHE_CONTROL).getMaxAge(), is(24*60*60));
     }
 
-    @Ignore("TODO - need to add fixture data")
     @Test
-    public void members_actions_disabled() throws Exception {
-        
+    public void self_isFollowable() throws Exception {
+        // given
+        DomainObjectRepresentation repr = givenRepresentation("simples");
+
+        // when, then
+        assertThat(repr, isFollowableLinkToSelf(client));
     }
 
+
     @Test
     public void links() throws Exception {
         // given, when
@@ -140,25 +107,6 @@ public class DomainServiceResourceTest_s
     }
     
 
-    @Ignore("TODO - need to add fixture data")
-    @Test
-    public void links_icons() throws Exception {
-        
-    }
-    
-
-    @Test
-    public void notFound() throws Exception {
-
-        // when
-        Response resp = resource.service("nonExistentServiceId");
-        RestfulResponse<JsonRepresentation> jsonResp = RestfulResponse.of(resp);
-        
-        // then
-        assertThat(jsonResp.getStatus(), is(HttpStatusCode.NOT_FOUND));
-    }
-
-
     private DomainObjectRepresentation givenRepresentation(String serviceId) throws JsonParseException, JsonMappingException, IOException {
         RestfulResponse<DomainObjectRepresentation> jsonResp = RestfulResponse.ofT(resource.service(serviceId));
         return jsonResp.getEntity();

Added: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_xrofollowlinks.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_xrofollowlinks.java?rev=1183125&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_xrofollowlinks.java (added)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/serviceId/DomainServiceResourceTest_serviceId_xrofollowlinks.java Thu Oct 13 21:57:15 2011
@@ -0,0 +1,62 @@
+package org.apache.isis.viewer.json.tck.resources.service.serviceId;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.isis.runtimes.dflt.webserver.WebServer;
+import org.apache.isis.viewer.json.applib.HttpMethod;
+import org.apache.isis.viewer.json.applib.RestfulClient;
+import org.apache.isis.viewer.json.applib.RestfulRequest;
+import org.apache.isis.viewer.json.applib.RestfulRequest.QueryParameter;
+import org.apache.isis.viewer.json.applib.RestfulResponse;
+import org.apache.isis.viewer.json.applib.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.json.applib.domainobjects.DomainServiceResource;
+import org.apache.isis.viewer.json.applib.domainobjects.ListRepresentation;
+import org.apache.isis.viewer.json.applib.domainobjects.ObjectActionRepresentation;
+import org.apache.isis.viewer.json.tck.IsisWebServerRule;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class DomainServiceResourceTest_serviceId_xrofollowlinks {
+
+    @Rule
+    public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+    private RestfulClient client;
+
+    @Before
+    public void setUp() throws Exception {
+        WebServer webServer = webServerRule.getWebServer();
+        client = new RestfulClient(webServer.getBase());
+    }
+
+    @Test
+    public void usingXpath() throws Exception {
+
+        final String href = givenLinkToService();
+        
+        final RestfulRequest request = 
+                client.createRequest(HttpMethod.GET, href).withArg(QueryParameter.FOLLOW_LINKS, "members[actionId='%s'].actionDetails", "list");
+        final RestfulResponse<ObjectActionRepresentation> restfulResponse = request.executeT();
+
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+    }
+
+
+    private String givenLinkToService() throws JsonParseException, JsonMappingException, IOException {
+        final DomainServiceResource resource = client.getDomainServiceResource();
+        final Response response = resource.services();
+        final ListRepresentation services = RestfulResponse.<ListRepresentation>ofT(response).getEntity();
+
+        return services.xpath("//*[key='%s']", "simples").getLink("e").getHref();
+    }
+
+
+}

Modified: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/services/DomainServiceResourceTest_services_representationAndHeaders.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/services/DomainServiceResourceTest_services_representationAndHeaders.java?rev=1183125&r1=1183124&r2=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/services/DomainServiceResourceTest_services_representationAndHeaders.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/services/DomainServiceResourceTest_services_representationAndHeaders.java Thu Oct 13 21:57:15 2011
@@ -52,15 +52,15 @@ public class DomainServiceResourceTest_s
     public void representation() throws Exception {
         
         // when
-        Response resp = resource.services();
-        RestfulResponse<ListRepresentation> jsonResp = RestfulResponse.ofT(resp);
+        final Response response = resource.services();
+        final RestfulResponse<ListRepresentation> restfulResponse = RestfulResponse.ofT(response);
         
         // then
-        assertThat(jsonResp.getStatus(), is(HttpStatusCode.OK));
-        assertThat(jsonResp.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.LIST.getMediaType()));
-        assertThat(jsonResp.getHeader(RestfulResponse.Header.CACHE_CONTROL).getMaxAge(), is(24*60*60));
+        assertThat(restfulResponse.getStatus(), is(HttpStatusCode.OK));
+        assertThat(restfulResponse.getHeader(RestfulResponse.Header.CONTENT_TYPE), is(RepresentationType.LIST.getMediaType()));
+        assertThat(restfulResponse.getHeader(RestfulResponse.Header.CACHE_CONTROL).getMaxAge(), is(24*60*60));
 
-        ListRepresentation repr = jsonResp.getEntity();
+        ListRepresentation repr = restfulResponse.getEntity();
 
         assertThat(repr, isMap());
 

Modified: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/services/DomainServiceResourceTest_services_xrofollowlinks.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/services/DomainServiceResourceTest_services_xrofollowlinks.java?rev=1183125&r1=1183124&r2=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/services/DomainServiceResourceTest_services_xrofollowlinks.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/services/DomainServiceResourceTest_services_xrofollowlinks.java Thu Oct 13 21:57:15 2011
@@ -28,7 +28,6 @@ public class DomainServiceResourceTest_s
 
     @Rule
     public IsisWebServerRule webServerRule = new IsisWebServerRule();
-    
     private RestfulClient client;
 
     @Before

Modified: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/stories/UserStoryTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/stories/UserStoryTest.java?rev=1183125&r1=1183124&r2=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/stories/UserStoryTest.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/stories/UserStoryTest.java Thu Oct 13 21:57:15 2011
@@ -37,7 +37,7 @@ public class UserStoryTest {
     
         // given a response for an initial resource
         HomePageResource homePageResource = client.getHomePageResource();
-        Response homePageResp = homePageResource.resources();
+        Response homePageResp = homePageResource.homePage();
         
         // and given a walker starting from this response
         RepresentationWalker walker = client.createWalker(homePageResp);

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/LinkBuilder.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/LinkBuilder.java?rev=1183125&r1=1183124&r2=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/LinkBuilder.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/LinkBuilder.java Thu Oct 13 21:57:15 2011
@@ -43,6 +43,7 @@ public final class LinkBuilder {
     private String title;
     private JsonRepresentation arguments;
     private JsonRepresentation value;
+    private String key;
 
     protected LinkBuilder(ResourceContext resourceContext, String rel, String href, MediaType mediaType) {
         this.resourceContext = resourceContext;
@@ -62,12 +63,17 @@ public final class LinkBuilder {
         this.arguments = arguments;
         return this;
     }
+    public LinkBuilder withKey(String key) {
+        this.key = key;
+        return this;
+    }
     public LinkBuilder withValue(JsonRepresentation value) {
         this.value = value;
         return this;
     }
 
     public JsonRepresentation build() {
+        representation.mapPut("key", key);
         representation.mapPut("rel", rel);
         representation.mapPut("href", resourceContext.urlFor(href));
         representation.mapPut("method", method);

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/LinkFollower.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/LinkFollower.java?rev=1183125&r1=1183124&r2=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/LinkFollower.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/LinkFollower.java Thu Oct 13 21:57:15 2011
@@ -3,87 +3,108 @@ package org.apache.isis.viewer.json.view
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
-import com.google.common.collect.Maps;
+import org.apache.isis.viewer.json.applib.JsonRepresentation;
 
-@SuppressWarnings({"rawtypes","unchecked"})
-public final class LinkFollower {
-
-    public final static Map<String,Map> asGraph(List<List<String>> links) {
-        if(links == null) {
-            return Collections.emptyMap();
-        }
-        final Map<String, Map> map = Maps.newHashMap();
-        for (List<String> link : links) {
-            mergeInto(link, map);
-        }
-        return map;
-    }
+import com.google.common.base.Objects;
 
-    private static void mergeInto(List<String> list, Map<String, Map> map) {
-        if(list.size() == 0) {
-            return;
-        }
-        final String str = list.get(0);
-        Map submap = map.get(str);
-        if(submap == null) {
-            submap = Maps.newHashMap(); 
-            map.put(str, submap);
-        }
-        mergeInto(list.subList(1, list.size()), submap);
-    }
 
-    public final static LinkFollower initial(List<List<String>> links) {
-        final Map<String, Map> graph = asGraph(links);
-        return new LinkFollower(graph, Mode.FOLLOWINGPATH);
-    }
 
-    public final static LinkFollower following(Map<String,Map> graph) {
-        return new LinkFollower(graph, Mode.FOLLOWINGPATH);
-    }
+@SuppressWarnings({"rawtypes","unchecked"})
+public final class LinkFollower {
 
-    private static LinkFollower terminated() {
-        return new LinkFollower(null, Mode.TERMINATED);
+    public final static LinkFollower create(List<List<String>> links) {
+        final Map<Node, Map> graph = ListUtil.asGraph(links);
+        return new LinkFollower(graph, Mode.FOLLOWING, Node.NULL);
     }
 
-
     private enum Mode {
-        FOLLOWINGPATH,
+        FOLLOWING,
         TERMINATED;
     }
 
-    private final Map<String, Map> graph;
+    private final Map<Node, Map> graph;
     private Mode mode;
+    private final Node root;
 
-    private LinkFollower(Map<String, Map> graph, Mode mode) {
+    private LinkFollower(Map<Node, Map> graph, Mode mode, Node root) {
         this.graph = graph;
         this.mode = mode;
+        this.root = root;
     }
 
     /**
      * A little algebra...
      */
     public LinkFollower follow(String path) {
-        if(path == null || mode == Mode.TERMINATED) {
-            return LinkFollower.terminated();
+        if(path == null) {
+            return terminated(Node.NULL);
         }
-        if(mode == Mode.FOLLOWINGPATH) {
-            Map remaining = graph.get(path);
+        if(mode == Mode.TERMINATED) {
+            return terminated(this.root);
+        }
+        Node node = Node.parse(path);
+        if(mode == Mode.FOLLOWING) {
+            Map<Node, Map> remaining = graph.get(node);
             if(remaining != null) {
-                return LinkFollower.following(remaining);
+                Node key = findKey(node);
+                return new LinkFollower(remaining, Mode.FOLLOWING, key);
             } else {
-                return LinkFollower.terminated();
+                return terminated(node);
             }
         }
-        return LinkFollower.terminated();
+        return terminated(node);
+    }
+
+    /**
+     * somewhat bizarre, but we have to find the actual node that is in the graph;
+     * the one we matching on doesn't match on the {@link Node#getCriteria()} map.
+     */
+    private Node findKey(Node node) {
+        final Set<Node> keySet = graph.keySet();
+        for(Node key: keySet) {
+            if(key.equals(node)) {
+                return key;
+            }
+        }
+        // shouldn't happen
+        return node;
+    }
+
+    private static LinkFollower terminated(Node node) {
+        return new LinkFollower(null, Mode.TERMINATED, node);
     }
 
     public boolean isFollowing() {
-        return mode == Mode.FOLLOWINGPATH;
+        return mode == Mode.FOLLOWING;
     }
 
     public boolean isTerminated() {
         return mode == Mode.TERMINATED;
     }
 
+    public Map<String, String> criteria() {
+        return Collections.unmodifiableMap(root.getCriteria());
+    }
+
+    /**
+     * Ensure that every key present in the provided map matches the criterium.
+     * 
+     * <p>
+     * Any keys in the criterium that are not present in the map will be ignored.
+     */
+    public boolean matches(JsonRepresentation map) {
+        if(!isFollowing()) {
+            return false;
+        }
+        for(Map.Entry<String,String> criterium: root.getCriteria().entrySet()) {
+            final String mapValue = map.getString(criterium.getKey());
+            if(mapValue != null && !Objects.equal(mapValue, criterium.getValue())) {
+                return false;
+            }
+        }
+        return true;
+    }
+
 }

Added: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/ListUtil.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/ListUtil.java?rev=1183125&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/ListUtil.java (added)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/ListUtil.java Thu Oct 13 21:57:15 2011
@@ -0,0 +1,39 @@
+package org.apache.isis.viewer.json.viewer.representations;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import com.google.common.collect.Maps;
+
+@SuppressWarnings({"rawtypes","unchecked"})
+public final class ListUtil {
+    
+    private ListUtil(){}
+
+    public final static Map<Node,Map> asGraph(List<List<String>> links) {
+        if(links == null) {
+            return Collections.emptyMap();
+        }
+        final Map<Node, Map> map = Maps.newHashMap();
+        for (List<String> link : links) {
+            ListUtil.mergeInto(link, map);
+        }
+        return map;
+    }
+
+    private static void mergeInto(List<String> list, Map<Node, Map> map) {
+        if(list.size() == 0) {
+            return;
+        }
+        final String str = list.get(0);
+        final Node node = Node.parse(str);
+        Map<Node,Map> submap = map.get(node);
+        if(submap == null) {
+            submap = Maps.newHashMap(); 
+            map.put(node, submap);
+        }
+        mergeInto(list.subList(1, list.size()), submap);
+    }
+
+}

Added: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/Node.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/Node.java?rev=1183125&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/Node.java (added)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/Node.java Thu Oct 13 21:57:15 2011
@@ -0,0 +1,83 @@
+package org.apache.isis.viewer.json.viewer.representations;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.google.common.base.Splitter;
+import com.google.common.collect.Maps;
+
+class Node {
+    private static final Pattern NODE = Pattern.compile("^([^\\[]+)(\\[(.+)\\])?$");
+    private static final Pattern WHITESPACE = Pattern.compile("\\s+");
+    private static final Pattern KEY_VALUE = Pattern.compile("^([^=]+)=(.+)$");
+    
+    public static final Node NULL = new Node("", Collections.<String,String>emptyMap());
+    
+    public static Node parse(String path) {
+        Matcher nodeMatcher = NODE.matcher(path);
+        if(!nodeMatcher.matches()) {
+            return null;
+        } 
+        final int groupCount = nodeMatcher.groupCount();
+        if(groupCount < 1) {
+            return null;
+        }
+        final String key = nodeMatcher.group(1);
+        final Map<String, String> criteria = Maps.newHashMap();
+        final String criteriaStr = nodeMatcher.group(3);
+        if(criteriaStr != null) {
+            for (String criterium : Splitter.on(WHITESPACE).split(criteriaStr)) {
+                final Matcher keyValueMatcher = KEY_VALUE.matcher(criterium);
+                if(keyValueMatcher.matches()) {
+                    criteria.put(keyValueMatcher.group(1), keyValueMatcher.group(2));
+                }
+            }
+        }
+
+        return new Node(key, criteria);
+    }
+    
+    private final String key;
+    private final Map<String,String> criteria;
+    private Node(String key, Map<String, String> criteria) {
+        this.key = key;
+        this.criteria = Collections.unmodifiableMap(criteria);
+    }
+    public String getKey() {
+        return key;
+    }
+    public Map<String, String> getCriteria() {
+        return criteria;
+    }
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((key == null) ? 0 : key.hashCode());
+        return result;
+    }
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        Node other = (Node) obj;
+        if (key == null) {
+            if (other.key != null)
+                return false;
+        } else if (!key.equals(other.key))
+            return false;
+        return true;
+    }
+    
+    @Override
+    public String toString() {
+        return key + (criteria.isEmpty()?"":criteria);
+    }
+    
+}
\ No newline at end of file

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/ReprRendererAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/ReprRendererAbstract.java?rev=1183125&r1=1183124&r2=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/ReprRendererAbstract.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/ReprRendererAbstract.java Thu Oct 13 21:57:15 2011
@@ -30,7 +30,7 @@ public abstract class ReprRendererAbstra
         if(linkFollower != null) {
             return linkFollower;
         }
-        return LinkFollower.initial(resourceContext.getFollowLinks());
+        return LinkFollower.create(resourceContext.getFollowLinks());
     }
 
     public ResourceContext getResourceContext() {

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/AbstractObjectMemberReprRenderer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/AbstractObjectMemberReprRenderer.java?rev=1183125&r1=1183124&r2=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/AbstractObjectMemberReprRenderer.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/AbstractObjectMemberReprRenderer.java Thu Oct 13 21:57:15 2011
@@ -30,7 +30,7 @@ import org.apache.isis.viewer.json.viewe
 public abstract class AbstractObjectMemberReprRenderer<R extends ReprRendererAbstract<R, ObjectAndMember<T>>, T extends ObjectMember> 
         extends ReprRendererAbstract<R, ObjectAndMember<T>> {
 
-    protected ObjectAdapterLinkToBuilder linkToBuilder;
+    protected ObjectAdapterLinkTo linkToBuilder;
     
     protected ObjectAdapter objectAdapter;
     protected MemberType memberType;
@@ -46,14 +46,14 @@ public abstract class AbstractObjectMemb
         this.objectAdapter = objectAndMember.getObjectAdapter();
         this.objectMember = objectAndMember.getMember();
         this.memberType = MemberType.determineFrom(objectMember);
-        usingLinkToBuilder(new DomainObjectLinkToBuilder());
+        usingLinkToBuilder(new DomainObjectLinkTo());
         return cast(this);
     }
 
     /**
      * Must be called after {@link #with(ObjectAndMember)} (which provides the {@link #objectAdapter}).
      */
-    public R usingLinkToBuilder(ObjectAdapterLinkToBuilder linkToBuilder) {
+    public R usingLinkToBuilder(ObjectAdapterLinkTo linkToBuilder) {
         this.linkToBuilder = linkToBuilder.usingResourceContext(resourceContext).with(objectAdapter);
         return cast(this);
     }

Copied: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectLinkTo.java (from r1182130, incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectLinkToBuilder.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectLinkTo.java?p2=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectLinkTo.java&p1=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectLinkToBuilder.java&r1=1182130&r2=1183125&rev=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectLinkToBuilder.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectLinkTo.java Thu Oct 13 21:57:15 2011
@@ -22,33 +22,54 @@ import org.apache.isis.viewer.json.appli
 import org.apache.isis.viewer.json.viewer.ResourceContext;
 import org.apache.isis.viewer.json.viewer.representations.LinkBuilder;
 
-public class DomainObjectLinkToBuilder implements ObjectAdapterLinkToBuilder {
+public class DomainObjectLinkTo implements ObjectAdapterLinkTo {
 
     protected ResourceContext resourceContext;
     protected ObjectAdapter objectAdapter;
 
     @Override
-    public final DomainObjectLinkToBuilder usingResourceContext(ResourceContext resourceContext) {
+    public final DomainObjectLinkTo usingResourceContext(ResourceContext resourceContext) {
         this.resourceContext = resourceContext;
         return this;
     }
 
     @Override
-    public final ObjectAdapterLinkToBuilder with(ObjectAdapter objectAdapter) {
+    public ObjectAdapterLinkTo with(ObjectAdapter objectAdapter) {
         this.objectAdapter = objectAdapter;
         return this;
     }
 
     @Override
-    public final LinkBuilder linkToAdapter() {
-        StringBuilder buf = objectsBuf();
-        return LinkBuilder.newBuilder(resourceContext, "object", RepresentationType.DOMAIN_OBJECT, buf.toString());
+    public LinkBuilder builder() {
+        return LinkBuilder.newBuilder(resourceContext, linkRel(), RepresentationType.DOMAIN_OBJECT, linkRef());
+    }
+
+    /**
+     * hook method
+     */
+    protected String linkRef() {
+        if(resourceContext == null) {
+            throw new IllegalStateException("resourceContext not provided");
+        }
+        if(objectAdapter == null) {
+            throw new IllegalStateException("objectAdapter not provided");
+        }
+        StringBuilder buf = new StringBuilder("objects/");
+        buf.append(resourceContext.getOidStringifier().enString(objectAdapter.getOid()));
+        return buf.toString();
+    }
+
+    /**
+     * hook method
+     */
+    protected String linkRel() {
+        return "object";
     }
 
 
     @Override
     public final LinkBuilder linkToMember(String rel, MemberType memberType, ObjectMember objectMember, String... parts) {
-        StringBuilder buf = objectsBuf();
+        StringBuilder buf = new StringBuilder(linkRef());
         buf.append("/").append(memberType.getUrlPart()).append(objectMember.getId());
         for(String part: parts) {
             if(part == null) {
@@ -60,21 +81,6 @@ public class DomainObjectLinkToBuilder i
         return LinkBuilder.newBuilder(resourceContext, rel, memberType.getRepresentationType(), url);
     }
 
-    /**
-     * hook method
-     * @return
-     */
-    protected StringBuilder objectsBuf() {
-        if(resourceContext == null) {
-            throw new IllegalStateException("resourceContext not provided");
-        }
-        if(objectAdapter == null) {
-            throw new IllegalStateException("objectAdapter not provided");
-        }
-        StringBuilder buf = new StringBuilder("objects/");
-        buf.append(resourceContext.getOidStringifier().enString(objectAdapter.getOid()));
-        return buf;
-    }
     
 
 }
\ No newline at end of file

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectReprRenderer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectReprRenderer.java?rev=1183125&r1=1183124&r2=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectReprRenderer.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectReprRenderer.java Thu Oct 13 21:57:15 2011
@@ -63,19 +63,19 @@ public class DomainObjectReprRenderer ex
         return LinkBuilder.newBuilder(resourceContext, rel, RepresentationType.DOMAIN_OBJECT, url);
     }
 
-    private ObjectAdapterLinkToBuilder linkToBuilder;
+    private ObjectAdapterLinkTo linkToBuilder;
     private ObjectAdapter objectAdapter;
 
     private DomainObjectReprRenderer(ResourceContext resourceContext, LinkFollower linkFollower, RepresentationType representationType, JsonRepresentation representation) {
         super(resourceContext, linkFollower, representationType, representation);
-        usingLinkToBuilder(new DomainObjectLinkToBuilder());
+        usingLinkToBuilder(new DomainObjectLinkTo());
     }
 
     /**
-     * Override the default {@link ObjectAdapterLinkToBuilder} (that is used for generating links in
+     * Override the default {@link ObjectAdapterLinkTo} (that is used for generating links in
      * {@link #linkTo(ObjectAdapter)}).
      */
-    public DomainObjectReprRenderer usingLinkToBuilder(ObjectAdapterLinkToBuilder objectAdapterLinkToBuilder) {
+    public DomainObjectReprRenderer usingLinkToBuilder(ObjectAdapterLinkTo objectAdapterLinkToBuilder) {
         this.linkToBuilder = objectAdapterLinkToBuilder.usingResourceContext(resourceContext);
         return this;
     }
@@ -89,7 +89,7 @@ public class DomainObjectReprRenderer ex
 
         // self
         if(includesSelf) {
-            JsonRepresentation self = linkToBuilder.with(objectAdapter).linkToAdapter().build();
+            JsonRepresentation self = linkToBuilder.with(objectAdapter).builder().build();
             representation.mapPut("self", self);
         }
 
@@ -127,6 +127,8 @@ public class DomainObjectReprRenderer ex
 
     private void addAssociations(ObjectAdapter objectAdapter, JsonRepresentation members, List<ObjectAssociation> associations) {
         for (ObjectAssociation assoc : associations) {
+            final LinkFollower follow = getLinkFollower().follow("members");
+            
             Consent visibility = assoc.isVisible(getSession(), objectAdapter);
             if(!visibility.isAllowed()) {
                 continue;

Copied: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceLinkTo.java (from r1182130, incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceLinkToBuilder.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceLinkTo.java?p2=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceLinkTo.java&p1=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceLinkToBuilder.java&r1=1182130&r2=1183125&rev=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceLinkToBuilder.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceLinkTo.java Thu Oct 13 21:57:15 2011
@@ -16,15 +16,34 @@
  */
 package org.apache.isis.viewer.json.viewer.resources.domainobjects;
 
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.services.ServiceUtil;
+import org.apache.isis.viewer.json.viewer.representations.LinkBuilder;
 
-public class DomainServiceLinkToBuilder extends DomainObjectLinkToBuilder {
+public class DomainServiceLinkTo extends DomainObjectLinkTo {
 
-    protected StringBuilder objectsBuf() {
+    private String serviceId;
+
+    @Override
+    public ObjectAdapterLinkTo with(ObjectAdapter objectAdapter) {
+        serviceId = ServiceUtil.id(objectAdapter.getObject());
+        return super.with(objectAdapter);
+    }
+    
+    protected String linkRef() {
         StringBuilder buf = new StringBuilder("services/");
-        String serviceId = ServiceUtil.id(objectAdapter.getObject());
         buf.append(serviceId);
-        return buf;
+        return buf.toString();
+    }
+    
+    @Override
+    protected String linkRel() {
+        return "service";
+    }
+    
+    @Override
+    public LinkBuilder builder() {
+        return super.builder().withKey(serviceId);
     }
 
 }
\ No newline at end of file

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceResourceServerside.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceResourceServerside.java?rev=1183125&r1=1183124&r2=1183125&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceResourceServerside.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceResourceServerside.java Thu Oct 13 21:57:15 2011
@@ -56,7 +56,7 @@ public class DomainServiceResourceServer
         final RendererFactory factory = RendererFactoryRegistry.instance.find(representationType);
         
         final ListReprRenderer renderer = (ListReprRenderer) factory.newRenderer(getResourceContext(), null, JsonRepresentation.newMap());
-        renderer.usingLinkToBuilder(new DomainServiceLinkToBuilder())
+        renderer.usingLinkToBuilder(new DomainServiceLinkTo())
                 .withSelf("services")
                 .with(serviceAdapters);
         
@@ -81,7 +81,7 @@ public class DomainServiceResourceServer
         final RendererFactory factory = rendererFactoryRegistry.find(representationType);
         final DomainObjectReprRenderer renderer = 
                 (DomainObjectReprRenderer) factory.newRenderer(getResourceContext(), null, JsonRepresentation.newMap());
-        renderer.usingLinkToBuilder(new DomainServiceLinkToBuilder())
+        renderer.usingLinkToBuilder(new DomainServiceLinkTo())
                     .includesSelf()
                     .with(serviceAdapter);
         



Mime
View raw message