Remove old license headers
[lgpl/argeo-commons.git] / org.argeo.jcr / src / org / argeo / jackrabbit / JackrabbitDataModelMigration.java
index 53f0e4457837cf85820d46d4964d3f47ef207ce7..2e87b347d77a3c915c41f035816505bc61c3c6c1 100644 (file)
@@ -1,24 +1,9 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * 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.io.InputStreamReader;
 import java.io.Reader;
+import java.net.URL;
 
-import javax.jcr.Node;
 import javax.jcr.Session;
 
 import org.apache.commons.io.IOUtils;
@@ -27,12 +12,11 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.jackrabbit.commons.cnd.CndImporter;
 import org.apache.jackrabbit.core.config.RepositoryConfig;
 import org.argeo.jcr.ArgeoJcrException;
-import org.argeo.jcr.ArgeoNames;
 import org.argeo.jcr.JcrCallback;
 import org.argeo.jcr.JcrUtils;
-import org.springframework.core.io.Resource;
 
 /** Migrate the data in a Jackrabbit repository. */
+@Deprecated
 public class JackrabbitDataModelMigration implements
                Comparable<JackrabbitDataModelMigration> {
        private final static Log log = LogFactory
@@ -40,7 +24,7 @@ public class JackrabbitDataModelMigration implements
 
        private String dataModelNodePath;
        private String targetVersion;
-       private Resource migrationCnd;
+       private URL migrationCnd;
        private JcrCallback dataModification;
 
        /**
@@ -60,20 +44,20 @@ public class JackrabbitDataModelMigration implements
                                                + " does not exist: nothing to migrate.");
                                return false;
                        }
-                       Node dataModelNode = session.getNode(dataModelNodePath);
-                       if (dataModelNode.hasProperty(ArgeoNames.ARGEO_DATA_MODEL_VERSION)) {
-                               String currentVersion = dataModelNode.getProperty(
-                                               ArgeoNames.ARGEO_DATA_MODEL_VERSION).getString();
-                               if (compareVersions(currentVersion, targetVersion) >= 0) {
-                                       log.info("Data model at version " + currentVersion
-                                                       + ", no need to migrate.");
-                                       return false;
-                               }
-                       }
+//                     Node dataModelNode = session.getNode(dataModelNodePath);
+//                     if (dataModelNode.hasProperty(ArgeoNames.ARGEO_DATA_MODEL_VERSION)) {
+//                             String currentVersion = dataModelNode.getProperty(
+//                                             ArgeoNames.ARGEO_DATA_MODEL_VERSION).getString();
+//                             if (compareVersions(currentVersion, targetVersion) >= 0) {
+//                                     log.info("Data model at version " + currentVersion
+//                                                     + ", no need to migrate.");
+//                                     return false;
+//                             }
+//                     }
 
                        // apply transitional CND
                        if (migrationCnd != null) {
-                               reader = new InputStreamReader(migrationCnd.getInputStream());
+                               reader = new InputStreamReader(migrationCnd.openStream());
                                CndImporter.registerNodeTypes(reader, session, true);
                                session.save();
                                log.info("Registered migration node types from " + migrationCnd);
@@ -164,7 +148,7 @@ public class JackrabbitDataModelMigration implements
                this.targetVersion = targetVersion;
        }
 
-       public void setMigrationCnd(Resource migrationCnd) {
+       public void setMigrationCnd(URL migrationCnd) {
                this.migrationCnd = migrationCnd;
        }