+/*
+ * 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.net.URI;
+import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
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")) {
+ try {
+ URI uriObj = new URI(uri);
+ String alias = uriObj.getPath();
+ if (alias.charAt(0) == '/')
+ alias = alias.substring(1);
+ if (alias.charAt(alias.length() - 1) == '/')
+ alias = alias.substring(0, alias.length() - 1);
+ repository = getRepositoryByAlias(alias);
+ } catch (URISyntaxException e) {
+ throw new ArgeoException("Cannot interpret URI " + uri, e);
+ }
+ }
+ }
+ // publish under alias
if (parameters.containsKey(JCR_REPOSITORY_ALIAS)) {
Properties properties = new Properties();
properties.putAll(parameters);
}
/**
- * Called after the repository has been initialized. Does nothing by
+ * Called after the repository has been initialised. Does nothing by
* default.
*/
@SuppressWarnings("rawtypes")