Revision: 3539
Author: [email protected]
Date: Mon May 17 08:22:11 2010
Log: Moved all of the enterprise URLs from /architect-enterprise/... to /architect-enterprise/rest/... to give us the ability to
add a welcome jsp instead of using a resource.
http://code.google.com/p/power-architect/source/detail?r=3539

Modified:
 /trunk/src/main/java/ca/sqlpower/architect/ArchitectSessionContextImpl.java
/trunk/src/main/java/ca/sqlpower/architect/enterprise/ArchitectClientSideSession.java /trunk/src/main/java/ca/sqlpower/architect/enterprise/NetworkConflictResolver.java /trunk/src/main/java/ca/sqlpower/architect/enterprise/ServerInfoProvider.java

=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/ArchitectSessionContextImpl.java Thu Feb 25 09:46:15 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/ArchitectSessionContextImpl.java Mon May 17 08:22:11 2010
@@ -44,6 +44,8 @@
public class ArchitectSessionContextImpl implements ArchitectSessionContext {

private static final Logger logger = Logger.getLogger(ArchitectSessionContextImpl.class);
+
+    private static final String DEFAULT_PATH = "/architect-enterprise/";

     /**
      * The preferences node that user-specific preferences are stored in.
@@ -68,7 +70,7 @@
     private final Collection<ArchitectSession> sessions;

     private final SPServerInfoManager serverManager;
-
+
     /**
* Creates a new session context. You will normally only need one of these * per JVM, but there is no technical barrier to creating multiple contexts.
@@ -118,7 +120,7 @@
setPlDotIniPath(ArchitectUtils.checkForValidPlDotIni(PlDotIniPath, "Architect"));
         }

- SPServerInfo defaultSettings = new SPServerInfo("", "", 8080, "/architect-enterprise/", "", ""); + SPServerInfo defaultSettings = new SPServerInfo("", "", 8080, DEFAULT_PATH, "", ""); serverManager = new SPServerInfoManager(getPrefs().node("servers"), new Version( ArchitectVersion.APP_FULL_VERSION.toString()), defaultSettings);
     }
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/enterprise/ArchitectClientSideSession.java Fri May 14 11:58:04 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/enterprise/ArchitectClientSideSession.java Mon May 17 08:22:11 2010
@@ -86,6 +86,12 @@
        private static CookieStore cookieStore = new BasicCookieStore();

        public static final String MONDRIAN_SCHEMA_REL_PATH = "/mondrian";
+
+    /**
+ * All requests to the server will contain this tag after the enterprise
+     * server name (which is normally architect-enterprise).
+     */
+       static final String REST_TAG = "rest";

        /**
* The prefs node that will store information about the current settings of
@@ -250,7 +256,7 @@

                 PlDotIni plIni;
                 try {
- plIni = new PlDotIni(getServerURI(projectLocation.getServiceInfo(), "/jdbc/"), + plIni = new PlDotIni(getServerURI(projectLocation.getServiceInfo(), "/" + REST_TAG +"/jdbc/"), getServerURI(projectLocation.getServiceInfo(), MONDRIAN_SCHEMA_REL_PATH)) {

                                            @Override
@@ -284,7 +290,8 @@
         };

         try {
- dataSourceCollection = executeServerRequest(outboundHttpClient, projectLocation.getServiceInfo(), "/data-sources/", plIniHandler); + dataSourceCollection = executeServerRequest(outboundHttpClient, projectLocation.getServiceInfo(),
+                    "/" + REST_TAG + "/data-sources/", plIniHandler);
         } catch (AccessDeniedException e) {
             throw e;
         } catch (Exception ex) {
@@ -374,7 +381,7 @@
        throws IOException, URISyntaxException, JSONException {
        HttpClient httpClient = createHttpClient(serviceInfo);
        try {
- HttpUriRequest request = new HttpGet(getServerURI(serviceInfo, "/jcr/projects")); + HttpUriRequest request = new HttpGet(getServerURI(serviceInfo, "/" + REST_TAG + "/jcr/projects")); JSONMessage message = httpClient.execute(request, new JSONResponseHandler());
                List<ProjectLocation> workspaces = new 
ArrayList<ProjectLocation>();
                JSONArray response = new JSONArray(message.getBody());
@@ -403,7 +410,7 @@

logger.info("Getting transactions between " + fromVersion + " and " + toVersion); JSONMessage message = executeServerRequest(httpClient, projectLocation.getServiceInfo(), - "/project/" + projectLocation.getUUID() + "/revision_list", + "/" + REST_TAG + "/project/" + projectLocation.getUUID() + "/revision_list",
                     "versions=" + fromVersion + ":" + toVersion,
                     new JSONResponseHandler());

@@ -420,7 +427,7 @@

        HttpClient httpClient = createHttpClient(serviceInfo);
        try {
- HttpUriRequest request = new HttpGet(getServerURI(serviceInfo, "/jcr/projects/new", "name=" + name)); + HttpUriRequest request = new HttpGet(getServerURI(serviceInfo, "/" + REST_TAG + "/jcr/projects/new", "name=" + name)); JSONMessage message = httpClient.execute(request, new JSONResponseHandler());
                JSONObject response = new JSONObject(message.getBody());
                return new ProjectLocation(
@@ -461,7 +468,7 @@

         try {
JSONMessage message = executeServerRequest(httpClient, projectLocation.getServiceInfo(),
-                    "/project/" + projectLocation.getUUID() + "/revert",
+ "/" + REST_TAG + "/project/" + projectLocation.getUUID() + "/revert",
                     "revisionNo=" + revisionNo,
                     new JSONResponseHandler());
             if (message.isSuccessful()) {
@@ -501,7 +508,7 @@

         try {
JSONMessage response = executeServerRequest(httpClient, serviceInfo, - "/project/" + projectLocation.getUUID() + "/" + revisionNo, + "/" + REST_TAG + "/project/" + projectLocation.getUUID() + "/" + revisionNo,
                     new JSONResponseHandler());

             if (response.isSuccessful()) {
@@ -527,7 +534,7 @@

         try {
JSONMessage response = executeServerRequest(httpClient, projectLocation.getServiceInfo(),
-                    "/project/" + projectLocation.getUUID() + "/compare",
+ "/" + REST_TAG + "/project/" + projectLocation.getUUID() + "/compare",
                     "versions=" + oldRevisionNo + ":" + newRevisionNo,
                     new JSONResponseHandler());

@@ -566,7 +573,7 @@

        try {
                executeServerRequest(httpClient, 
projectLocation.getServiceInfo(),
-                               "/jcr/" + projectLocation.getUUID() + "/delete",
+ "/" + REST_TAG + "/jcr/" + projectLocation.getUUID() + "/delete",
                                new JSONResponseHandler());
        } catch (AccessDeniedException e) {
session.createUserPrompter("You do not have sufficient privileges to delete the selected workspace.",
@@ -856,19 +863,19 @@
if (!(jds instanceof JDBCDataSource)) throw new IllegalStateException("DataSource must be an instance of JDBCDataSource");

             return getServerURI(projectLocation.getServiceInfo(),
-                    "/data-sources/JDBCDataSource/" + jds.getName());
+ "/" + REST_TAG + "/data-sources/JDBCDataSource/" + jds.getName());
         }

private URI olapDataSourceURI(SPDataSource jds) throws URISyntaxException { if (!(jds instanceof Olap4jDataSource)) throw new IllegalStateException("DataSource must be an instance of JDBCDataSource");

             return getServerURI(projectLocation.getServiceInfo(),
-                    "/data-sources/Olap4jDataSource/" + jds.getName());
+ "/" + REST_TAG + "/data-sources/Olap4jDataSource/" + jds.getName());
         }

private URI jdbcDataSourceTypeURI(JDBCDataSourceType jdst) throws URISyntaxException {
             return getServerURI(projectLocation.getServiceInfo(),
-                    "/data-sources/type/" + jdst.getName());
+ "/" + REST_TAG + "/data-sources/type/" + jdst.getName());
         }

         public void undoableEditHappened(UndoableEditEvent e) {
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/enterprise/NetworkConflictResolver.java Mon May 10 22:46:35 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/enterprise/NetworkConflictResolver.java Mon May 17 08:22:11 2010
@@ -117,7 +117,7 @@
         this.outboundHttpClient = outboundHttpClient;
         this.session = session;

-        contextRelativePath = "/project/" + projectLocation.getUUID();
+ contextRelativePath = "/" + ArchitectClientSideSession.REST_TAG + "/project/" + projectLocation.getUUID();
     }

     public void setPromptSession(ArchitectSession promptSession) {
@@ -918,7 +918,8 @@
             URI serverURI = new URI("http", null,
                     projectLocation.getServiceInfo().getServerAddress(),
                     projectLocation.getServiceInfo().getPort(),
- projectLocation.getServiceInfo().getPath() + "/project/" + projectLocation.getUUID(),
+                    projectLocation.getServiceInfo().getPath() +
+ "/" + ArchitectClientSideSession.REST_TAG + "/project/" + projectLocation.getUUID(),
                     "currentRevision=" + currentRevision, null);
             HttpPost postRequest = new HttpPost(serverURI);
             postRequest.setEntity(new StringEntity(jsonArray));
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/enterprise/ServerInfoProvider.java Fri May 7 07:59:18 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/enterprise/ServerInfoProvider.java Mon May 17 08:22:11 2010
@@ -100,7 +100,9 @@
                sb.append(":");
                sb.append(port);
                sb.append(path);
-               sb.append(path.endsWith("/")?"serverinfo":"/serverinfo");
+               sb.append(path.endsWith("/")?"":"/");
+               sb.append(ArchitectClientSideSession.REST_TAG);
+               sb.append("/serverinfo");

                // Spawn a connection object
                return new URL(sb.toString());

Reply via email to