ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1301465 - in /ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest: RESTClientServlet.java Workspace.java
Date Fri, 16 Mar 2012 12:36:43 GMT
Author: marrs
Date: Fri Mar 16 12:36:43 2012
New Revision: 1301465

URL: http://svn.apache.org/viewvc?rev=1301465&view=rev
Log:
ACE-63 updated client REST api project.

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

Modified: ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RESTClientServlet.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RESTClientServlet.java?rev=1301465&r1=1301464&r2=1301465&view=diff
==============================================================================
--- ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RESTClientServlet.java
(original)
+++ ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RESTClientServlet.java
Fri Mar 16 12:36:43 2012
@@ -23,11 +23,9 @@ import java.io.UnsupportedEncodingExcept
 import java.net.URLDecoder;
 import java.net.URLEncoder;
 import java.util.Dictionary;
-import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
@@ -36,7 +34,6 @@ import javax.servlet.http.HttpServletRes
 
 import org.apache.ace.client.repository.RepositoryObject;
 import org.apache.ace.client.repository.SessionFactory;
-import org.apache.ace.client.repository.stateful.StatefulTargetObject;
 import org.apache.felix.dm.Component;
 import org.apache.felix.dm.DependencyManager;
 import org.osgi.service.cm.ConfigurationException;
@@ -64,8 +61,8 @@ public class RESTClientServlet extends H
     private static final String KEY_CUSTOMER_NAME = "customer.name";
     /** Name of the store repository. */
     private static final String KEY_STORE_REPOSITORY_NAME = "store.repository.name";
-    /** Name of the license repository. */
-    private static final String KEY_LICENSE_REPOSITORY_NAME = "license.repository.name";
+    /** Name of the distribution repository. */
+    private static final String KEY_DISTRIBUTION_REPOSITORY_NAME = "distribution.repository.name";
     /** Name of the deployment repository. */
     private static final String KEY_DEPLOYMENT_REPOSITORY_NAME = "deployment.repository.name";
     /** Name of the user to log in as. */
@@ -83,7 +80,7 @@ public class RESTClientServlet extends H
     private String m_obrURL;
     private String m_customerName;
     private String m_storeRepositoryName;
-    private String m_licenseRepositoryName;
+    private String m_distributionRepositoryName;
     private String m_deploymentRepositoryName;
     private String m_serverUser;
     
@@ -118,7 +115,7 @@ public class RESTClientServlet extends H
                         List<RepositoryObject> objects = workspace.getRepositoryObjects(pathElements[2]);
                         JsonArray result = new JsonArray();
                         for (RepositoryObject ro : objects) {
-                            String identity = workspace.getRepositoryObjectIdentity(ro);
+                            String identity = Workspace.getRepositoryObjectIdentity(ro);
                             if (identity != null) {
                                 result.add(new JsonPrimitive(URLEncoder.encode(identity,
"UTF-8")));
                             }
@@ -166,7 +163,7 @@ public class RESTClientServlet extends H
                     Component component;
                     synchronized (m_workspaces) {
                         sessionID = "rest-" + m_sessionID++;
-                        workspace = new Workspace(sessionID, m_repositoryURL, m_obrURL, m_customerName,
m_storeRepositoryName, m_licenseRepositoryName, m_deploymentRepositoryName, m_serverUser);
+                        workspace = new Workspace(sessionID, m_repositoryURL, m_obrURL, m_customerName,
m_storeRepositoryName, m_distributionRepositoryName, m_deploymentRepositoryName, m_serverUser);
                         m_workspaces.put(sessionID, workspace);
                         component = m_dm.createComponent().setImplementation(workspace);
                         m_workspaceComponents.put(sessionID, component);
@@ -204,7 +201,7 @@ public class RESTClientServlet extends H
                         try {
                             RepositoryValueObject data = m_gson.fromJson(req.getReader(),
RepositoryValueObject.class);
                             RepositoryObject object = workspace.addRepositoryObject(pathElements[2],
data.attributes, data.tags);
-                            String identity = workspace.getRepositoryObjectIdentity(object);
+                            String identity = Workspace.getRepositoryObjectIdentity(object);
                             if (identity != null) {
                                 resp.sendRedirect(buildPathFromElements(WORK_FOLDER, pathElements[1],
pathElements[2], identity));
                             }
@@ -236,7 +233,6 @@ public class RESTClientServlet extends H
                     if (workspace != null) {
                         try {
                             RepositoryValueObject data = m_gson.fromJson(req.getReader(),
RepositoryValueObject.class);
-                            RepositoryObject object = workspace.getRepositoryObject(pathElements[2],
pathElements[3]);
                             workspace.updateObjectWithData(pathElements[2], pathElements[2],
data);
                             resp.sendRedirect(buildPathFromElements(WORK_FOLDER, pathElements[1],
pathElements[2], pathElements[3]));
                             return;
@@ -286,7 +282,6 @@ public class RESTClientServlet extends H
                     String entityId = pathElements[3];
                     
                     Workspace workspace;
-                    Component component;
                     synchronized (m_workspaces) {
                         workspace = m_workspaces.get(id);
                     }
@@ -368,7 +363,7 @@ public class RESTClientServlet extends H
         m_obrURL = getProperty(properties, KEY_OBR_URL, "http://localhost:8080/obr");
         m_customerName = getProperty(properties, KEY_CUSTOMER_NAME, "apache");
         m_storeRepositoryName = getProperty(properties, KEY_STORE_REPOSITORY_NAME, "shop");
-        m_licenseRepositoryName = getProperty(properties, KEY_LICENSE_REPOSITORY_NAME, "gateway");
+        m_distributionRepositoryName = getProperty(properties, KEY_DISTRIBUTION_REPOSITORY_NAME,
"target"); // TODO default was: gateway, shouldn't this be distribution?
         m_deploymentRepositoryName = getProperty(properties, KEY_DEPLOYMENT_REPOSITORY_NAME,
"deployment");
         m_serverUser = getProperty(properties, KEY_USER_NAME, "d");
     }

Modified: ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/Workspace.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/Workspace.java?rev=1301465&r1=1301464&r2=1301465&view=diff
==============================================================================
--- ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/Workspace.java (original)
+++ ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/Workspace.java Fri
Mar 16 12:36:43 2012
@@ -33,18 +33,15 @@ import org.apache.ace.client.repository.
 import org.apache.ace.client.repository.SessionFactory;
 import org.apache.ace.client.repository.repository.Artifact2FeatureAssociationRepository;
 import org.apache.ace.client.repository.repository.ArtifactRepository;
-import org.apache.ace.client.repository.repository.TargetRepository;
-import org.apache.ace.client.repository.repository.Feature2DistributionAssociationRepository;
-import org.apache.ace.client.repository.repository.FeatureRepository;
 import org.apache.ace.client.repository.repository.Distribution2TargetAssociationRepository;
 import org.apache.ace.client.repository.repository.DistributionRepository;
+import org.apache.ace.client.repository.repository.Feature2DistributionAssociationRepository;
+import org.apache.ace.client.repository.repository.FeatureRepository;
+import org.apache.ace.client.repository.repository.TargetRepository;
 import org.apache.ace.client.repository.stateful.StatefulTargetObject;
 import org.apache.ace.client.repository.stateful.StatefulTargetRepository;
 import org.apache.felix.dm.Component;
 import org.apache.felix.dm.DependencyManager;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.service.log.LogService;
 import org.osgi.service.useradmin.User;
 import org.osgi.service.useradmin.UserAdmin;
@@ -62,7 +59,7 @@ public class Workspace {
     private final String m_obrURL;
     private final String m_customerName;
     private final String m_storeRepositoryName;
-    private final String m_licenseRepositoryName;
+    private final String m_distributionRepositoryName;
     private final String m_deploymentRepositoryName;
     private final String m_serverUser;
     private volatile DependencyManager m_manager;
@@ -71,20 +68,19 @@ public class Workspace {
     private volatile FeatureRepository m_featureRepository;
     private volatile DistributionRepository m_distributionRepository;
     private volatile StatefulTargetRepository m_statefulTargetRepository;
-    private volatile TargetRepository m_targetRepository;
     private volatile Artifact2FeatureAssociationRepository m_artifact2FeatureAssociationRepository;
     private volatile Feature2DistributionAssociationRepository m_feature2DistributionAssociationRepository;
     private volatile Distribution2TargetAssociationRepository m_distribution2TargetAssociationRepository;
     private volatile UserAdmin m_userAdmin;
     private volatile LogService m_log;
 
-    public Workspace(String sessionID, String repositoryURL, String obrURL, String customerName,
String storeRepositoryName, String licenseRepositoryName, String deploymentRepositoryName,
String serverUser) {
+    public Workspace(String sessionID, String repositoryURL, String obrURL, String customerName,
String storeRepositoryName, String distributionRepositoryName, String deploymentRepositoryName,
String serverUser) {
         m_sessionID = sessionID;
         m_repositoryURL = repositoryURL;
         m_obrURL = obrURL;
         m_customerName = customerName;
         m_storeRepositoryName = storeRepositoryName;
-        m_licenseRepositoryName = licenseRepositoryName;
+        m_distributionRepositoryName = distributionRepositoryName;
         m_deploymentRepositoryName = deploymentRepositoryName;
         m_serverUser = serverUser;
     }
@@ -125,7 +121,7 @@ public class Workspace {
             m_repositoryAdmin.login(m_repositoryAdmin.createLoginContext(user)
                 .setObrBase(new URL(m_obrURL))
                 .addShopRepository(new URL(m_repositoryURL), m_customerName, m_storeRepositoryName,
true)
-                .addTargetRepository(new URL(m_repositoryURL), m_customerName, m_licenseRepositoryName,
true)
+                .addTargetRepository(new URL(m_repositoryURL), m_customerName, m_distributionRepositoryName,
true)
                 .addDeploymentRepository(new URL(m_repositoryURL), m_customerName, m_deploymentRepositoryName,
true)
                 );
             m_repositoryAdmin.checkout();



Mime
View raw message