incubator-ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1154177 - in /incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest: RESTClientServlet.java Workspace.java
Date Fri, 05 Aug 2011 11:46:55 GMT
Author: marrs
Date: Fri Aug  5 11:46:54 2011
New Revision: 1154177

URL: http://svn.apache.org/viewvc?rev=1154177&view=rev
Log:
ACE-164 Caught the special condition that occurred. If a target is not registered, it will
for now simply not show up in the list. As a side effect, unregistered targets that simply
show up because they polled the server for now are invisible in the REST interface.

Modified:
    incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RESTClientServlet.java
    incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/Workspace.java

Modified: incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RESTClientServlet.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RESTClientServlet.java?rev=1154177&r1=1154176&r2=1154177&view=diff
==============================================================================
--- incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RESTClientServlet.java
(original)
+++ incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RESTClientServlet.java
Fri Aug  5 11:46:54 2011
@@ -119,7 +119,9 @@ public class RESTClientServlet extends H
                         JsonArray result = new JsonArray();
                         for (RepositoryObject ro : objects) {
                             String identity = workspace.getRepositoryObjectIdentity(ro);
-                            result.add(new JsonPrimitive(URLEncoder.encode(identity, "UTF-8")));
+                            if (identity != null) {
+                                result.add(new JsonPrimitive(URLEncoder.encode(identity,
"UTF-8")));
+                            }
                         }
                         resp.getWriter().println(m_gson.toJson(result));
                         return;
@@ -203,7 +205,12 @@ public class RESTClientServlet extends H
                             RepositoryValueObject data = m_gson.fromJson(req.getReader(),
RepositoryValueObject.class);
                             RepositoryObject object = workspace.addRepositoryObject(pathElements[2],
data.attributes, data.tags);
                             String identity = workspace.getRepositoryObjectIdentity(object);
-                            resp.sendRedirect(buildPathFromElements(WORK_FOLDER, pathElements[1],
pathElements[2], identity));
+                            if (identity != null) {
+                                resp.sendRedirect(buildPathFromElements(WORK_FOLDER, pathElements[1],
pathElements[2], identity));
+                            }
+                            else {
+                                // TODO decide what to do here, if this can happen at all
+                            }
                             return;
                         }
                         catch (IllegalArgumentException e) {

Modified: incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/Workspace.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/Workspace.java?rev=1154177&r1=1154176&r2=1154177&view=diff
==============================================================================
--- incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/Workspace.java
(original)
+++ incubator/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/Workspace.java
Fri Aug  5 11:46:54 2011
@@ -160,7 +160,15 @@ public class Workspace {
     
     public static String getRepositoryObjectIdentity(RepositoryObject object) {
         if (object instanceof StatefulGatewayObject) {
-            return ((StatefulGatewayObject) object).getGatewayObject().getAssociationFilter(null);
+            StatefulGatewayObject statefulTarget = (StatefulGatewayObject) object;
+            if (statefulTarget.isRegistered()) {
+                return statefulTarget.getGatewayObject().getAssociationFilter(null);
+            }
+            else {
+                // TODO we're out of luck here, we cannot create an identity for the object
+                //      based on the association filter
+                return null;
+            }
         }
         else {
             return object.getAssociationFilter(null);



Mime
View raw message