]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - server/runtime/org.argeo.server.jackrabbit/src/main/java/org/argeo/jackrabbit/JackrabbitRepositoryFactory.java
Improve remoting
[lgpl/argeo-commons.git] / server / runtime / org.argeo.server.jackrabbit / src / main / java / org / argeo / jackrabbit / JackrabbitRepositoryFactory.java
index d98448c7c266e3955e2da93f5729c7e5875bff53..13ca680fa2a042cf96bbc0bfe11361a71de40188 100644 (file)
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2007-2012 Mathieu Baudier
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.argeo.jackrabbit;
 
 import java.util.HashMap;
@@ -39,9 +54,18 @@ public class JackrabbitRepositoryFactory extends DefaultRepositoryFactory
                else if (parameters.containsKey(JcrUtils.REPOSITORY_URI))
                        uri = parameters.get(JcrUtils.REPOSITORY_URI).toString();
 
-               if (uri != null)
-                       repository = createRemoteRepository(uri);
+               if (uri != null) {
+                       if (uri.startsWith("http"))// http, https
+                               repository = createRemoteRepository(uri);
+                       else if (uri.startsWith("vm")) {
+                               log.warn("URI "
+                                               + uri
+                                               + " should have been managed by generic JCR repository factory");
+                               repository = getRepositoryByAlias(getAliasFromURI(uri));
+                       }
+               }
 
+               // publish under alias
                if (parameters.containsKey(JCR_REPOSITORY_ALIAS)) {
                        Properties properties = new Properties();
                        properties.putAll(parameters);
@@ -68,7 +92,7 @@ public class JackrabbitRepositoryFactory extends DefaultRepositoryFactory
        }
 
        /**
-        * Called after the repository has been initialized. Does nothing by
+        * Called after the repository has been initialised. Does nothing by
         * default.
         */
        @SuppressWarnings("rawtypes")