+ // apply new CND files after migration
+ if (cndFiles != null && cndFiles.size() > 0)
+ prepareDataModel();
+ }
+
+ /** Actually creates the new repository. */
+ protected void createJackrabbitRepository() {
+ long begin = System.currentTimeMillis();
+ InputStream configurationIn = null;
+ try {
+ if (uri != null && !uri.trim().equals("")) {// remote
+ Map<String, String> params = new HashMap<String, String>();
+ params.put(
+ org.apache.jackrabbit.commons.JcrUtils.REPOSITORY_URI,
+ uri);
+ repository = new Jcr2davRepositoryFactory()
+ .getRepository(params);
+ if (repository == null)
+ throw new ArgeoException("Remote Davex repository " + uri
+ + " not found");
+ log.info("Initialized Jackrabbit repository " + repository
+ + " from URI " + uri);
+ // we assume that the remote repository has been properly
+ // configured
+ } else {// local
+ // reset uri to null in order to optimize isRemote()
+ uri = null;
+
+ // temporary
+ if (inMemory && getHomeDirectory().exists()) {
+ FileUtils.deleteDirectory(getHomeDirectory());
+ log.warn("Deleted Jackrabbit home directory "
+ + getHomeDirectory());
+ }
+
+ // process configuration file
+ Properties vars = getConfigurationProperties();
+ configurationIn = configuration.getInputStream();
+ vars.put(
+ RepositoryConfigurationParser.REPOSITORY_HOME_VARIABLE,
+ getHomeDirectory().getCanonicalPath());
+ repositoryConfig = RepositoryConfig.create(new InputSource(
+ configurationIn), vars);
+
+ //
+ // Actual repository creation
+ //
+ repository = RepositoryImpl.create(repositoryConfig);
+
+ double duration = ((double) (System.currentTimeMillis() - begin)) / 1000;
+ log.info("Initialized Jackrabbit repository in " + duration
+ + " s, home: " + getHomeDirectory() + ", config: "
+ + configuration);
+ }
+ } catch (Exception e) {
+ throw new ArgeoException("Cannot create Jackrabbit repository "
+ + getHomeDirectory(), e);
+ } finally {
+ IOUtils.closeQuietly(configurationIn);