More Jackrabbit repo to client dep. Remove unused and deprecated
authorMathieu Baudier <mbaudier@argeo.org>
Wed, 13 Mar 2019 11:43:48 +0000 (12:43 +0100)
committerMathieu Baudier <mbaudier@argeo.org>
Wed, 13 Mar 2019 11:43:48 +0000 (12:43 +0100)
components.

42 files changed:
dep/org.argeo.dep.cms.client/pom.xml
dep/org.argeo.dep.cms.node/pom.xml
org.argeo.core/.classpath [new file with mode: 0644]
org.argeo.core/.gitignore [new file with mode: 0644]
org.argeo.core/.project [new file with mode: 0644]
org.argeo.core/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
org.argeo.core/META-INF/.gitignore [new file with mode: 0644]
org.argeo.core/bnd.bnd [new file with mode: 0644]
org.argeo.core/build.properties [new file with mode: 0644]
org.argeo.core/lib/.gitignore [new file with mode: 0644]
org.argeo.core/pom.xml [new file with mode: 0644]
org.argeo.core/src/org/argeo/sync/SyncException.java [new file with mode: 0644]
org.argeo.core/src/org/argeo/sync/cli/Sync.java [new file with mode: 0644]
org.argeo.core/src/org/argeo/sync/fs/PathSync.java [new file with mode: 0644]
org.argeo.core/src/org/argeo/sync/fs/SshSync.java [new file with mode: 0644]
org.argeo.core/src/org/argeo/sync/fs/SyncFileVisitor.java [new file with mode: 0644]
org.argeo.enterprise/build.properties
org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifUserAdminTest.java
org.argeo.jcr/ext/test/org/argeo/server/jcr/JcrResourceAdapterTest.java [deleted file]
org.argeo.jcr/ext/test/org/argeo/server/jcr/dummy00.xls [deleted file]
org.argeo.jcr/ext/test/org/argeo/server/jcr/dummy01.xls [deleted file]
org.argeo.jcr/ext/test/org/argeo/server/jcr/dummy02.xls [deleted file]
org.argeo.jcr/ext/test/org/argeo/server/jcr/dummy03.xls [deleted file]
org.argeo.jcr/src/org/argeo/jackrabbit/JackrabbitDataModelMigration.java
org.argeo.jcr/src/org/argeo/jackrabbit/JackrabbitRepositoryFactory.java [deleted file]
org.argeo.jcr/src/org/argeo/jcr/JcrResourceAdapter.java [deleted file]
org.argeo.jcr/src/org/argeo/jcr/spring/ThreadBoundSession.java [deleted file]
org.argeo.sync/.classpath [deleted file]
org.argeo.sync/.gitignore [deleted file]
org.argeo.sync/.project [deleted file]
org.argeo.sync/.settings/org.eclipse.jdt.core.prefs [deleted file]
org.argeo.sync/META-INF/.gitignore [deleted file]
org.argeo.sync/bnd.bnd [deleted file]
org.argeo.sync/build.properties [deleted file]
org.argeo.sync/lib/.gitignore [deleted file]
org.argeo.sync/pom.xml [deleted file]
org.argeo.sync/src/org/argeo/sync/SyncException.java [deleted file]
org.argeo.sync/src/org/argeo/sync/cli/Sync.java [deleted file]
org.argeo.sync/src/org/argeo/sync/fs/PathSync.java [deleted file]
org.argeo.sync/src/org/argeo/sync/fs/SshSync.java [deleted file]
org.argeo.sync/src/org/argeo/sync/fs/SyncFileVisitor.java [deleted file]
pom.xml

index 7605293a366ba7e6b38d8237dd408bbb57ef5764..1df3b1d0bb2e924b593d257f880d4c677543ca8f 100644 (file)
                        <artifactId>org.argeo.util</artifactId>
                        <version>2.1.77-SNAPSHOT</version>
                </dependency>
+               <dependency>
+                       <groupId>org.argeo.commons</groupId>
+                       <artifactId>org.argeo.enterprise</artifactId>
+                       <version>2.1.77-SNAPSHOT</version>
+               </dependency>
                <dependency>
                        <groupId>org.argeo.commons</groupId>
                        <artifactId>org.argeo.jcr</artifactId>
                        <version>2.1.77-SNAPSHOT</version>
                </dependency>
+               <dependency>
+                       <groupId>org.argeo.commons</groupId>
+                       <artifactId>org.argeo.core</artifactId>
+                       <version>2.1.77-SNAPSHOT</version>
+               </dependency>
 
                <!-- Third Parties -->
                <dependency>
                        <groupId>org.argeo.tp.bouncycastle</groupId>
                        <artifactId>bcpkix</artifactId>
                </dependency>
+               <dependency>
+                       <groupId>org.argeo.tp.bouncycastle</groupId>
+                       <artifactId>bcpg</artifactId>
+               </dependency>
                <dependency>
                        <groupId>org.argeo.tp.apache</groupId>
                        <artifactId>org.apache.httpcomponents.httpcore</artifactId>
                        <artifactId>javax.servlet</artifactId>
                </dependency>
 
+               <!-- Database drivers -->
+               <dependency>
+                       <groupId>org.argeo.tp.misc</groupId>
+                       <artifactId>org.h2</artifactId>
+               </dependency>
+
                <!-- Equinox -->
                <dependency>
                        <groupId>org.argeo.tp.equinox</groupId>
                        <artifactId>org.apache.jackrabbit.jcr2spi</artifactId>
                </dependency>
 
+               <!-- Jackrabbit Repository -->
+               <dependency>
+                       <groupId>org.argeo.tp.apache.jackrabbit</groupId>
+                       <artifactId>org.apache.jackrabbit.data</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.tp.apache.jackrabbit</groupId>
+                       <artifactId>org.apache.jackrabbit.core</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.tp.apache.jackrabbit</groupId>
+                       <artifactId>org.apache.jackrabbit.server</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.tp.misc</groupId>
+                       <artifactId>EDU.oswego.cs.dl.util.concurrent</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.tp.apache.commons</groupId>
+                       <artifactId>org.apache.commons.fileupload</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.tp.apache</groupId>
+                       <artifactId>org.apache.tika.core</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.tp.apache</groupId>
+                       <artifactId>org.apache.tika.parsers</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.tp.apache</groupId>
+                       <artifactId>org.apache.lucene</artifactId>
+               </dependency>
+
                <!-- Required by Jackrabbit 2.12 -->
                <dependency>
                        <groupId>org.argeo.tp.misc</groupId>
index 83d83e76d523327db5dcb0da8426aae64fd77b84..8e70bb829132a108e9d0fea8ed2d9c8cf18c9c36 100644 (file)
                        <artifactId>org.argeo.cms</artifactId>
                        <version>2.1.77-SNAPSHOT</version>
                </dependency>
-               <dependency>
-                       <groupId>org.argeo.commons</groupId>
-                       <artifactId>org.argeo.enterprise</artifactId>
-                       <version>2.1.77-SNAPSHOT</version>
-               </dependency>
                <dependency>
                        <groupId>org.argeo.commons</groupId>
                        <artifactId>org.argeo.ext.jackrabbit</artifactId>
                </dependency>
 
                <!-- Database drivers -->
-               <dependency>
-                       <groupId>org.argeo.tp.misc</groupId>
-                       <artifactId>org.h2</artifactId>
-               </dependency>
                <dependency>
                        <groupId>org.argeo.tp.misc</groupId>
                        <artifactId>org.postgresql.jdbc42</artifactId>
                        <artifactId>com.vladsch.flexmark.formatter</artifactId>
                </dependency>
 
-               <!-- Jackrabbit -->
-               <dependency>
-                       <groupId>org.argeo.tp.apache.jackrabbit</groupId>
-                       <artifactId>org.apache.jackrabbit.data</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp.apache.jackrabbit</groupId>
-                       <artifactId>org.apache.jackrabbit.core</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp.apache.jackrabbit</groupId>
-                       <artifactId>org.apache.jackrabbit.server</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp.misc</groupId>
-                       <artifactId>EDU.oswego.cs.dl.util.concurrent</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp.apache.commons</groupId>
-                       <artifactId>org.apache.commons.fileupload</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp.apache</groupId>
-                       <artifactId>org.apache.tika.core</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp.apache</groupId>
-                       <artifactId>org.apache.tika.parsers</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp.apache</groupId>
-                       <artifactId>org.apache.lucene</artifactId>
-               </dependency>
 
                <!-- TODO: remove Spring dependency -->
                <dependency>
diff --git a/org.argeo.core/.classpath b/org.argeo.core/.classpath
new file mode 100644 (file)
index 0000000..a7acb82
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="lib" path="lib/tomcat-jni-9.0.16.jar"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.argeo.core/.gitignore b/org.argeo.core/.gitignore
new file mode 100644 (file)
index 0000000..09e3bc9
--- /dev/null
@@ -0,0 +1,2 @@
+/bin/
+/target/
diff --git a/org.argeo.core/.project b/org.argeo.core/.project
new file mode 100644 (file)
index 0000000..cb3127e
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.argeo.core</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/org.argeo.core/.settings/org.eclipse.jdt.core.prefs b/org.argeo.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..7e2e119
--- /dev/null
@@ -0,0 +1,101 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.problem.APILeak=warning
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
+org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
diff --git a/org.argeo.core/META-INF/.gitignore b/org.argeo.core/META-INF/.gitignore
new file mode 100644 (file)
index 0000000..4854a41
--- /dev/null
@@ -0,0 +1 @@
+/MANIFEST.MF
diff --git a/org.argeo.core/bnd.bnd b/org.argeo.core/bnd.bnd
new file mode 100644 (file)
index 0000000..3ae5c17
--- /dev/null
@@ -0,0 +1 @@
+Main-Class: org.argeo.sync.cli.Sync
diff --git a/org.argeo.core/build.properties b/org.argeo.core/build.properties
new file mode 100644 (file)
index 0000000..f3e2c2c
--- /dev/null
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .
+additional.bundles = org.apache.sshd.common,\
+                     org.slf4j.log4j12,\
+                     org.slf4j.api,\
+                     org.apache.sshd.core
diff --git a/org.argeo.core/lib/.gitignore b/org.argeo.core/lib/.gitignore
new file mode 100644 (file)
index 0000000..2142dc1
--- /dev/null
@@ -0,0 +1 @@
+/tomcat-jni-*.jar
diff --git a/org.argeo.core/pom.xml b/org.argeo.core/pom.xml
new file mode 100644 (file)
index 0000000..1b2ccc6
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.argeo.commons</groupId>
+               <artifactId>argeo-commons</artifactId>
+               <version>2.1.77-SNAPSHOT</version>
+               <relativePath>..</relativePath>
+       </parent>
+       <artifactId>org.argeo.core</artifactId>
+       <name>Commons Third Parties Utilities</name>
+       <dependencies>
+               <dependency>
+                       <groupId>org.argeo.commons</groupId>
+                       <artifactId>org.argeo.util</artifactId>
+                       <version>2.1.77-SNAPSHOT</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.argeo.commons</groupId>
+                       <artifactId>org.argeo.jcr</artifactId>
+                       <version>2.1.77-SNAPSHOT</version>
+               </dependency>
+       </dependencies>
+</project>
\ No newline at end of file
diff --git a/org.argeo.core/src/org/argeo/sync/SyncException.java b/org.argeo.core/src/org/argeo/sync/SyncException.java
new file mode 100644 (file)
index 0000000..89bf869
--- /dev/null
@@ -0,0 +1,18 @@
+package org.argeo.sync;
+
+/** Commons exception for sync */
+public class SyncException extends RuntimeException {
+       private static final long serialVersionUID = -3371314343580218538L;
+
+       public SyncException(String message) {
+               super(message);
+       }
+
+       public SyncException(String message, Throwable cause) {
+               super(message, cause);
+       }
+
+       public SyncException(Object source, Object target, Throwable cause) {
+               super("Cannot sync from " + source + " to " + target, cause);
+       }
+}
diff --git a/org.argeo.core/src/org/argeo/sync/cli/Sync.java b/org.argeo.core/src/org/argeo/sync/cli/Sync.java
new file mode 100644 (file)
index 0000000..6bb098b
--- /dev/null
@@ -0,0 +1,35 @@
+package org.argeo.sync.cli;
+
+import java.net.URI;
+import java.util.List;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.DefaultParser;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.argeo.sync.fs.PathSync;
+
+public class Sync {
+
+       public static void main(String[] args) {
+               Options options = new Options();
+               options.addOption("r", "recursive", false, "recurse into directories");
+               options.addOption(Option.builder().longOpt("progress").hasArg(false).desc("").build());
+
+               CommandLineParser parser = new DefaultParser();
+               try {
+                       CommandLine line = parser.parse(options, args);
+                       List<String> remaining = line.getArgList();
+
+                       URI sourceUri = new URI(remaining.get(0));
+                       URI targetUri = new URI(remaining.get(1));
+                       PathSync pathSync = new PathSync(sourceUri, targetUri);
+                       pathSync.run();
+               } catch (Exception exp) {
+                       exp.printStackTrace();
+
+               }
+       }
+
+}
diff --git a/org.argeo.core/src/org/argeo/sync/fs/PathSync.java b/org.argeo.core/src/org/argeo/sync/fs/PathSync.java
new file mode 100644 (file)
index 0000000..1dc30db
--- /dev/null
@@ -0,0 +1,60 @@
+package org.argeo.sync.fs;
+
+import java.net.URI;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.spi.FileSystemProvider;
+import java.time.ZonedDateTime;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.argeo.jackrabbit.fs.DavexFsProvider;
+import org.argeo.sync.SyncException;
+import org.argeo.util.LangUtils;
+
+public class PathSync implements Runnable {
+       private final static Log log = LogFactory.getLog(PathSync.class);
+
+       private final URI sourceUri, targetUri;
+
+       public PathSync(URI sourceUri, URI targetUri) {
+               this.sourceUri = sourceUri;
+               this.targetUri = targetUri;
+       }
+
+       @Override
+       public void run() {
+               try {
+                       FileSystemProvider sourceFsProvider = createFsProvider(sourceUri);
+                       FileSystemProvider targetFsProvider = createFsProvider(targetUri);
+                       Path sourceBasePath = sourceUri.getScheme() != null ? sourceFsProvider.getPath(sourceUri)
+                                       : Paths.get(sourceUri.getPath());
+                       Path targetBasePath = targetUri.getScheme() != null ? targetFsProvider.getPath(targetUri)
+                                       : Paths.get(targetUri.getPath());
+                       SyncFileVisitor syncFileVisitor = new SyncFileVisitor(sourceBasePath, targetBasePath);
+                       ZonedDateTime begin = ZonedDateTime.now();
+                       Files.walkFileTree(sourceBasePath, syncFileVisitor);
+                       if (log.isDebugEnabled())
+                               log.debug("Sync from " + sourceBasePath + " to " + targetBasePath + " took " + LangUtils.since(begin));
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
+       }
+
+       private static FileSystemProvider createFsProvider(URI uri) {
+               FileSystemProvider fsProvider;
+               if (uri.getScheme() == null || uri.getScheme().equals("file"))
+                       fsProvider = FileSystems.getDefault().provider();
+               else if (uri.getScheme().equals("davex"))
+                       fsProvider = new DavexFsProvider();
+               else
+                       throw new SyncException("URI scheme not supported for " + uri);
+               return fsProvider;
+       }
+
+       static enum Arg {
+               to, from;
+       }
+}
diff --git a/org.argeo.core/src/org/argeo/sync/fs/SshSync.java b/org.argeo.core/src/org/argeo/sync/fs/SshSync.java
new file mode 100644 (file)
index 0000000..43af450
--- /dev/null
@@ -0,0 +1,163 @@
+package org.argeo.sync.fs;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.security.KeyPair;
+import java.security.PublicKey;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Scanner;
+import java.util.Set;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sshd.agent.SshAgent;
+import org.apache.sshd.agent.SshAgentFactory;
+import org.apache.sshd.agent.local.LocalAgentFactory;
+import org.apache.sshd.agent.unix.UnixAgentFactory;
+import org.apache.sshd.client.SshClient;
+import org.apache.sshd.client.channel.ClientChannel;
+import org.apache.sshd.client.channel.ClientChannelEvent;
+import org.apache.sshd.client.config.keys.ClientIdentityLoader;
+import org.apache.sshd.client.future.ConnectFuture;
+import org.apache.sshd.client.session.ClientSession;
+import org.apache.sshd.client.subsystem.sftp.SftpFileSystem;
+import org.apache.sshd.client.subsystem.sftp.SftpFileSystemProvider;
+import org.apache.sshd.common.config.keys.FilePasswordProvider;
+import org.apache.sshd.common.util.io.NoCloseInputStream;
+import org.apache.sshd.common.util.io.NoCloseOutputStream;
+
+public class SshSync {
+       private final static Log log = LogFactory.getLog(SshSync.class);
+
+       public static void main(String[] args) {
+
+               try (SshClient client = SshClient.setUpDefaultClient()) {
+                       client.start();
+                       boolean osAgent = false;
+                       SshAgentFactory agentFactory = osAgent ? new UnixAgentFactory() : new LocalAgentFactory();
+                       // SshAgentFactory agentFactory = new LocalAgentFactory();
+                       client.setAgentFactory(agentFactory);
+                       SshAgent sshAgent = agentFactory.createClient(client);
+
+                       String login = System.getProperty("user.name");
+                       String host = "localhost";
+                       int port = 22;
+
+                       if (!osAgent) {
+                               String keyPath = "/home/" + login + "/.ssh/id_rsa";
+                               System.out.print(keyPath + ": ");
+                               Scanner s = new Scanner(System.in);
+                               String password = s.next();
+                               KeyPair keyPair = ClientIdentityLoader.DEFAULT.loadClientIdentity(keyPath,
+                                               FilePasswordProvider.of(password));
+                               sshAgent.addIdentity(keyPair, "NO COMMENT");
+                       }
+
+                       List<? extends Map.Entry<PublicKey, String>> identities = sshAgent.getIdentities();
+                       for (Map.Entry<PublicKey, String> entry : identities) {
+                               System.out.println(entry.getValue() + " : " + entry.getKey());
+                       }
+
+                       ConnectFuture connectFuture = client.connect(login, host, port);
+                       connectFuture.await();
+                       ClientSession session = connectFuture.getSession();
+
+                       try {
+
+//                             session.addPasswordIdentity(new String(password));
+                               session.auth().verify(1000l);
+
+                               SftpFileSystemProvider fsProvider = new SftpFileSystemProvider(client);
+
+                               SftpFileSystem fs = fsProvider.newFileSystem(session);
+                               Path testPath = fs.getPath("/home/" + login + "/tmp");
+                               Files.list(testPath).forEach(System.out::println);
+                               test(testPath);
+
+                       } finally {
+                               client.stop();
+                       }
+               } catch (Exception e) {
+                       // TODO Auto-generated catch block
+                       e.printStackTrace();
+               }
+       }
+
+       static void test(Path testBase) {
+               try {
+                       Path testPath = testBase.resolve("ssh-test.txt");
+                       Files.createFile(testPath);
+                       log.debug("Created file " + testPath);
+                       Files.delete(testPath);
+                       log.debug("Deleted " + testPath);
+                       String txt = "TEST\nTEST2\n";
+                       byte[] arr = txt.getBytes();
+                       Files.write(testPath, arr);
+                       log.debug("Wrote " + testPath);
+                       byte[] read = Files.readAllBytes(testPath);
+                       log.debug("Read " + testPath);
+                       Path testDir = testBase.resolve("testDir");
+                       log.debug("Resolved " + testDir);
+                       // Copy
+                       Files.createDirectory(testDir);
+                       log.debug("Created directory " + testDir);
+                       Path subsubdir = Files.createDirectories(testDir.resolve("subdir/subsubdir"));
+                       log.debug("Created sub directories " + subsubdir);
+                       Path copiedFile = testDir.resolve("copiedFile.txt");
+                       log.debug("Resolved " + copiedFile);
+                       Path relativeCopiedFile = testDir.relativize(copiedFile);
+                       log.debug("Relative copied file " + relativeCopiedFile);
+                       try (OutputStream out = Files.newOutputStream(copiedFile);
+                                       InputStream in = Files.newInputStream(testPath)) {
+                               IOUtils.copy(in, out);
+                       }
+                       log.debug("Copied " + testPath + " to " + copiedFile);
+                       Files.delete(testPath);
+                       log.debug("Deleted " + testPath);
+                       byte[] copiedRead = Files.readAllBytes(copiedFile);
+                       log.debug("Read " + copiedFile);
+                       // Browse directories
+                       DirectoryStream<Path> files = Files.newDirectoryStream(testDir);
+                       int fileCount = 0;
+                       Path listedFile = null;
+                       for (Path file : files) {
+                               fileCount++;
+                               if (!Files.isDirectory(file))
+                                       listedFile = file;
+                       }
+                       log.debug("Listed " + testDir);
+                       // Generic attributes
+                       Map<String, Object> attrs = Files.readAttributes(copiedFile, "*");
+                       log.debug("Read attributes of " + copiedFile + ": " + attrs.keySet());
+               } catch (IOException e) {
+                       // TODO Auto-generated catch block
+                       e.printStackTrace();
+               }
+
+       }
+
+       static void openShell(ClientSession session) {
+               try (ClientChannel channel = session.createChannel(ClientChannel.CHANNEL_SHELL)) {
+                       channel.setIn(new NoCloseInputStream(System.in));
+                       channel.setOut(new NoCloseOutputStream(System.out));
+                       channel.setErr(new NoCloseOutputStream(System.err));
+                       channel.open();
+
+                       Set<ClientChannelEvent> events = new HashSet<>();
+                       events.add(ClientChannelEvent.CLOSED);
+                       channel.waitFor(events, 0);
+               } catch (IOException e) {
+                       // TODO Auto-generated catch block
+                       e.printStackTrace();
+               } finally {
+                       session.close(false);
+               }
+       }
+}
diff --git a/org.argeo.core/src/org/argeo/sync/fs/SyncFileVisitor.java b/org.argeo.core/src/org/argeo/sync/fs/SyncFileVisitor.java
new file mode 100644 (file)
index 0000000..de80320
--- /dev/null
@@ -0,0 +1,56 @@
+package org.argeo.sync.fs;
+
+import java.io.IOException;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/** Synchronises two directory structures. */
+public class SyncFileVisitor extends SimpleFileVisitor<Path> {
+       private final static Log log = LogFactory.getLog(SyncFileVisitor.class);
+
+       private final Path sourceBasePath;
+       private final Path targetBasePath;
+
+       public SyncFileVisitor(Path sourceBasePath, Path targetBasePath) {
+               this.sourceBasePath = sourceBasePath;
+               this.targetBasePath = targetBasePath;
+       }
+
+       @Override
+       public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
+               Path targetPath = toTargetPath(dir);
+               Files.createDirectories(targetPath);
+               return FileVisitResult.CONTINUE;
+       }
+
+       @Override
+       public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+               Path targetPath = toTargetPath(file);
+               try {
+                       Files.copy(file, targetPath);
+                       if (log.isDebugEnabled())
+                               log.debug("Copied " + targetPath);
+               } catch (Exception e) {
+                       log.error("Cannot copy " + file + " to " + targetPath, e);
+               }
+               return FileVisitResult.CONTINUE;
+       }
+
+       @Override
+       public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
+               log.error("Cannot sync " + file, exc);
+               return FileVisitResult.CONTINUE;
+       }
+
+       private Path toTargetPath(Path sourcePath) {
+               Path relativePath = sourceBasePath.relativize(sourcePath);
+               Path targetPath = targetBasePath.resolve(relativePath.toString());
+               return targetPath;
+       }
+}
index af03ba43ba18f646885f4214a2abdc4b4a1c7bcc..6fa156125f5d6f395cdb3de16ff3f8e355f65664 100644 (file)
@@ -4,5 +4,4 @@ additional.bundles = org.junit,\
                      org.slf4j.commons.logging,\
                      org.slf4j.api,\
                      org.slf4j.log4j12,\
-                     org.apache.log4j,\
-                     bitronix.tm
+                     org.apache.log4j
index 956bb2e23c24b7aa24e84b49df5653492e0c0b04..748abe8353202b499e43ff4f92a142f8ff41b044 100644 (file)
@@ -2,7 +2,6 @@ package org.argeo.osgi.useradmin;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
@@ -16,7 +15,6 @@ import java.util.Base64;
 import java.util.Dictionary;
 import java.util.Hashtable;
 import java.util.List;
-import java.util.UUID;
 
 import javax.transaction.TransactionManager;
 
@@ -27,9 +25,6 @@ import org.osgi.service.useradmin.Group;
 import org.osgi.service.useradmin.Role;
 import org.osgi.service.useradmin.User;
 
-import bitronix.tm.BitronixTransactionManager;
-import bitronix.tm.TransactionManagerServices;
-import bitronix.tm.resource.ehcache.EhCacheXAResourceProducer;
 import junit.framework.TestCase;
 
 public class LdifUserAdminTest extends TestCase implements BasicTestConstants {
@@ -45,7 +40,6 @@ public class LdifUserAdminTest extends TestCase implements BasicTestConstants {
        // public void testConcurrent() throws Exception {
        // }
 
-       @SuppressWarnings("unchecked")
        public void testEdition() throws Exception {
                User demoUser = (User) userAdmin.getRole(DEMO_USER_DN);
                assertNotNull(demoUser);
@@ -160,13 +154,14 @@ public class LdifUserAdminTest extends TestCase implements BasicTestConstants {
                // Init transaction manager
                if (TM_SIMPLE == tmType) {
                        tm = new SimpleTransactionManager();
-               } else if (TM_BITRONIX == tmType) {
-                       bitronix.tm.Configuration tmConf = TransactionManagerServices.getConfiguration();
-                       tmConf.setServerId(UUID.randomUUID().toString());
-                       tmConf.setLogPart1Filename(new File(tempDir.toFile(), "btm1.tlog").getAbsolutePath());
-                       tmConf.setLogPart2Filename(new File(tempDir.toFile(), "btm2.tlog").getAbsolutePath());
-                       tm = TransactionManagerServices.getTransactionManager();
                }
+//             else if (TM_BITRONIX == tmType) {
+//                     bitronix.tm.Configuration tmConf = TransactionManagerServices.getConfiguration();
+//                     tmConf.setServerId(UUID.randomUUID().toString());
+//                     tmConf.setLogPart1Filename(new File(tempDir.toFile(), "btm1.tlog").getAbsolutePath());
+//                     tmConf.setLogPart2Filename(new File(tempDir.toFile(), "btm2.tlog").getAbsolutePath());
+//                     tm = TransactionManagerServices.getTransactionManager();
+//             }
 
                userAdmin = initUserAdmin(uri, tm);
        }
@@ -184,15 +179,15 @@ public class LdifUserAdminTest extends TestCase implements BasicTestConstants {
                        userAdmin = new LdifUserAdmin(props);
                userAdmin.init();
                // JTA
-               if (TM_BITRONIX == tmType)
-                       EhCacheXAResourceProducer.registerXAResource(UserDirectory.class.getName(), userAdmin.getXaResource());
+//             if (TM_BITRONIX == tmType)
+//                     EhCacheXAResourceProducer.registerXAResource(UserDirectory.class.getName(), userAdmin.getXaResource());
                userAdmin.setTransactionManager(tm);
                return userAdmin;
        }
 
        private void persistAndRestart() {
-               if (TM_BITRONIX == tmType)
-                       EhCacheXAResourceProducer.unregisterXAResource(UserDirectory.class.getName(), userAdmin.getXaResource());
+//             if (TM_BITRONIX == tmType)
+//                     EhCacheXAResourceProducer.unregisterXAResource(UserDirectory.class.getName(), userAdmin.getXaResource());
                if (userAdmin instanceof LdifUserAdmin)
                        ((LdifUserAdmin) userAdmin).save();
                userAdmin.destroy();
@@ -201,10 +196,10 @@ public class LdifUserAdminTest extends TestCase implements BasicTestConstants {
 
        @Override
        protected void tearDown() throws Exception {
-               if (TM_BITRONIX == tmType) {
-                       EhCacheXAResourceProducer.unregisterXAResource(UserDirectory.class.getName(), userAdmin.getXaResource());
-                       ((BitronixTransactionManager) tm).shutdown();
-               }
+//             if (TM_BITRONIX == tmType) {
+//                     EhCacheXAResourceProducer.unregisterXAResource(UserDirectory.class.getName(), userAdmin.getXaResource());
+//                     ((BitronixTransactionManager) tm).shutdown();
+//             }
                if (userAdmin != null)
                        userAdmin.destroy();
                if (tempDir != null)
diff --git a/org.argeo.jcr/ext/test/org/argeo/server/jcr/JcrResourceAdapterTest.java b/org.argeo.jcr/ext/test/org/argeo/server/jcr/JcrResourceAdapterTest.java
deleted file mode 100644 (file)
index 11dc4fa..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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.server.jcr;
-
-import java.io.InputStream;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.List;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.jackrabbit.unit.AbstractJackrabbitTestCase;
-import org.argeo.jcr.JcrResourceAdapter;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-
-@Deprecated
-public class JcrResourceAdapterTest extends AbstractJackrabbitTestCase {
-       private static SimpleDateFormat sdf = new SimpleDateFormat(
-                       "yyyyMMdd:hhmmss.SSS");
-
-       private final static Log log = LogFactory
-                       .getLog(JcrResourceAdapterTest.class);
-
-       private JcrResourceAdapter jra;
-
-       public void testCreate() throws Exception {
-               String basePath = "/test/subdir";
-               jra.mkdirs(basePath);
-               Resource res = new ClassPathResource("org/argeo/server/jcr/dummy00.xls");
-               String filePath = basePath + "/dummy.xml";
-               jra.create(filePath, res.getInputStream(), "application/vnd.ms-excel");
-               InputStream in = jra.retrieve(filePath);
-               assertTrue(IOUtils.contentEquals(res.getInputStream(), in));
-       }
-
-       public void testVersioning() throws Exception {
-               String basePath = "/test/versions";
-               jra.mkdirs(basePath);
-               String filePath = basePath + "/dummy.xml";
-               Resource res00 = new ClassPathResource(
-                               "org/argeo/server/jcr/dummy00.xls");
-               jra.create(filePath, res00.getInputStream(), "application/vnd.ms-excel");
-               Resource res01 = new ClassPathResource(
-                               "org/argeo/server/jcr/dummy01.xls");
-               jra.update(filePath, res01.getInputStream());
-               Resource res02 = new ClassPathResource(
-                               "org/argeo/server/jcr/dummy02.xls");
-               jra.update(filePath, res02.getInputStream());
-
-               List<Calendar> versions = jra.listVersions(filePath);
-               log.debug("Versions of " + filePath);
-               int count = 0;
-               for (Calendar version : versions) {
-                       log.debug(" " + (count == 0 ? "base" : count - 1) + "\t"
-                                       + sdf.format(version.getTime()));
-                       count++;
-               }
-
-               assertEquals(4, versions.size());
-
-               InputStream in = jra.retrieve(filePath, 1);
-               assertTrue(IOUtils.contentEquals(res01.getInputStream(), in));
-               in = jra.retrieve(filePath, 0);
-               assertTrue(IOUtils.contentEquals(res00.getInputStream(), in));
-               in = jra.retrieve(filePath, 2);
-               assertTrue(IOUtils.contentEquals(res02.getInputStream(), in));
-               Resource res03 = new ClassPathResource(
-                               "org/argeo/server/jcr/dummy03.xls");
-               jra.update(filePath, res03.getInputStream());
-               in = jra.retrieve(filePath, 1);
-               assertTrue(IOUtils.contentEquals(res01.getInputStream(), in));
-       }
-
-       @Override
-       protected void setUp() throws Exception {
-               log.debug("SET UP");
-               super.setUp();
-               jra = new JcrResourceAdapter();
-               jra.setSession(session());
-       }
-
-       @Override
-       protected void tearDown() throws Exception {
-               log.debug("TEAR DOWN");
-               super.tearDown();
-       }
-}
diff --git a/org.argeo.jcr/ext/test/org/argeo/server/jcr/dummy00.xls b/org.argeo.jcr/ext/test/org/argeo/server/jcr/dummy00.xls
deleted file mode 100644 (file)
index e5846fe..0000000
Binary files a/org.argeo.jcr/ext/test/org/argeo/server/jcr/dummy00.xls and /dev/null differ
diff --git a/org.argeo.jcr/ext/test/org/argeo/server/jcr/dummy01.xls b/org.argeo.jcr/ext/test/org/argeo/server/jcr/dummy01.xls
deleted file mode 100644 (file)
index b5c6b55..0000000
Binary files a/org.argeo.jcr/ext/test/org/argeo/server/jcr/dummy01.xls and /dev/null differ
diff --git a/org.argeo.jcr/ext/test/org/argeo/server/jcr/dummy02.xls b/org.argeo.jcr/ext/test/org/argeo/server/jcr/dummy02.xls
deleted file mode 100644 (file)
index d73bc66..0000000
Binary files a/org.argeo.jcr/ext/test/org/argeo/server/jcr/dummy02.xls and /dev/null differ
diff --git a/org.argeo.jcr/ext/test/org/argeo/server/jcr/dummy03.xls b/org.argeo.jcr/ext/test/org/argeo/server/jcr/dummy03.xls
deleted file mode 100644 (file)
index 0759cb9..0000000
Binary files a/org.argeo.jcr/ext/test/org/argeo/server/jcr/dummy03.xls and /dev/null differ
index 8fedcf5217c886acb09ddbb3c70fc86d92e48ed8..1247950005909c1647b5442d59569baf82e87a00 100644 (file)
@@ -17,6 +17,7 @@ package org.argeo.jackrabbit;
 
 import java.io.InputStreamReader;
 import java.io.Reader;
+import java.net.URL;
 
 import javax.jcr.Session;
 
@@ -28,7 +29,6 @@ import org.apache.jackrabbit.core.config.RepositoryConfig;
 import org.argeo.jcr.ArgeoJcrException;
 import org.argeo.jcr.JcrCallback;
 import org.argeo.jcr.JcrUtils;
-import org.springframework.core.io.Resource;
 
 /** Migrate the data in a Jackrabbit repository. */
 @Deprecated
@@ -39,7 +39,7 @@ public class JackrabbitDataModelMigration implements
 
        private String dataModelNodePath;
        private String targetVersion;
-       private Resource migrationCnd;
+       private URL migrationCnd;
        private JcrCallback dataModification;
 
        /**
@@ -72,7 +72,7 @@ public class JackrabbitDataModelMigration implements
 
                        // 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);
@@ -163,7 +163,7 @@ public class JackrabbitDataModelMigration implements
                this.targetVersion = targetVersion;
        }
 
-       public void setMigrationCnd(Resource migrationCnd) {
+       public void setMigrationCnd(URL migrationCnd) {
                this.migrationCnd = migrationCnd;
        }
 
diff --git a/org.argeo.jcr/src/org/argeo/jackrabbit/JackrabbitRepositoryFactory.java b/org.argeo.jcr/src/org/argeo/jackrabbit/JackrabbitRepositoryFactory.java
deleted file mode 100644 (file)
index f7e882e..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * 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.File;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.RepositoryFactory;
-import javax.jcr.Session;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.commons.JcrUtils;
-import org.apache.jackrabbit.core.RepositoryImpl;
-import org.apache.jackrabbit.core.config.RepositoryConfig;
-import org.apache.jackrabbit.core.config.RepositoryConfigurationParser;
-import org.apache.jackrabbit.jcr2dav.Jcr2davRepositoryFactory;
-import org.argeo.jcr.ArgeoJcrException;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-import org.xml.sax.InputSource;
-
-/**
- * Repository factory which can create new repositories and access remote
- * Jackrabbit repositories
- */
-@Deprecated
-public class JackrabbitRepositoryFactory implements RepositoryFactory {
-       // FIXME factorize with node
-       /** Key for a JCR repository alias */
-       public final static String JCR_REPOSITORY_ALIAS = "argeo.jcr.repository.alias";
-       /** Key for a JCR repository URI */
-       public final static String JCR_REPOSITORY_URI = "argeo.jcr.repository.uri";
-
-       private final static Log log = LogFactory
-                       .getLog(JackrabbitRepositoryFactory.class);
-
-       private Resource fileRepositoryConfiguration = new ClassPathResource(
-                       "/org/argeo/jackrabbit/repository-h2.xml");
-
-       @SuppressWarnings({ "rawtypes" })
-       public Repository getRepository(Map parameters) throws RepositoryException {
-               // // check if can be found by alias
-               // Repository repository = super.getRepository(parameters);
-               // if (repository != null)
-               // return repository;
-
-               // check if remote
-               Repository repository;
-               String uri = null;
-               if (parameters.containsKey(JCR_REPOSITORY_URI))
-                       uri = parameters.get(JCR_REPOSITORY_URI).toString();
-               else if (parameters.containsKey(JcrUtils.REPOSITORY_URI))
-                       uri = parameters.get(JcrUtils.REPOSITORY_URI).toString();
-
-               if (uri != null) {
-                       if (uri.startsWith("http"))// http, https
-                               repository = createRemoteRepository(uri);
-                       else if (uri.startsWith("file"))// http, https
-                               repository = createFileRepository(uri, parameters);
-                       else if (uri.startsWith("vm")) {
-                               log.warn("URI "
-                                               + uri
-                                               + " should have been managed by generic JCR repository factory");
-                               repository = getRepositoryByAlias(getAliasFromURI(uri));
-                       } else
-                               throw new ArgeoJcrException("Unrecognized URI format " + uri);
-
-               }
-
-               else if (parameters.containsKey(JCR_REPOSITORY_ALIAS)) {
-                       // Properties properties = new Properties();
-                       // properties.putAll(parameters);
-                       String alias = parameters.get(JCR_REPOSITORY_ALIAS).toString();
-                       // publish(alias, repository, properties);
-                       // log.info("Registered JCR repository under alias '" + alias + "'
-                       // with properties " + properties);
-                       repository = getRepositoryByAlias(alias);
-               } else
-                       throw new ArgeoJcrException("Not enough information in "
-                                       + parameters);
-
-               if (repository == null)
-                       throw new ArgeoJcrException("Repository not found " + parameters);
-
-               return repository;
-       }
-
-       protected Repository getRepositoryByAlias(String alias) {
-               return null;
-       }
-
-       protected Repository createRemoteRepository(String uri)
-                       throws RepositoryException {
-               Map<String, String> params = new HashMap<String, String>();
-               params.put(JcrUtils.REPOSITORY_URI, uri);
-               Repository repository = new Jcr2davRepositoryFactory()
-                               .getRepository(params);
-               if (repository == null)
-                       throw new ArgeoJcrException("Remote Davex repository " + uri
-                                       + " not found");
-               log.info("Initialized remote Jackrabbit repository from uri " + uri);
-               return repository;
-       }
-
-       @SuppressWarnings({ "rawtypes", "unchecked" })
-       protected Repository createFileRepository(final String uri, Map parameters)
-                       throws RepositoryException {
-               InputStream configurationIn = null;
-               try {
-                       Properties vars = new Properties();
-                       vars.putAll(parameters);
-                       String dirPath = uri.substring("file:".length());
-                       File homeDir = new File(dirPath);
-                       if (homeDir.exists() && !homeDir.isDirectory())
-                               throw new ArgeoJcrException("Repository home " + dirPath
-                                               + " is not a directory");
-                       if (!homeDir.exists())
-                               homeDir.mkdirs();
-                       configurationIn = fileRepositoryConfiguration.getInputStream();
-                       vars.put(RepositoryConfigurationParser.REPOSITORY_HOME_VARIABLE,
-                                       homeDir.getCanonicalPath());
-                       RepositoryConfig repositoryConfig = RepositoryConfig.create(
-                                       new InputSource(configurationIn), vars);
-
-                       // TransientRepository repository = new
-                       // TransientRepository(repositoryConfig);
-                       final RepositoryImpl repository = RepositoryImpl
-                                       .create(repositoryConfig);
-                       Session session = repository.login();
-                       // FIXME make it generic
-                       org.argeo.jcr.JcrUtils.addPrivilege(session, "/", "ROLE_ADMIN",
-                                       "jcr:all");
-                       org.argeo.jcr.JcrUtils.logoutQuietly(session);
-                       Runtime.getRuntime().addShutdownHook(
-                                       new Thread("Clean JCR repository " + uri) {
-                                               public void run() {
-                                                       repository.shutdown();
-                                                       log.info("Destroyed repository " + uri);
-                                               }
-                                       });
-                       log.info("Initialized file Jackrabbit repository from uri " + uri);
-                       return repository;
-               } catch (Exception e) {
-                       throw new ArgeoJcrException("Cannot create repository " + uri, e);
-               } finally {
-                       IOUtils.closeQuietly(configurationIn);
-               }
-       }
-
-       protected String getAliasFromURI(String uri) {
-               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);
-                       return alias;
-               } catch (URISyntaxException e) {
-                       throw new ArgeoJcrException("Cannot interpret URI " + uri, e);
-               }
-       }
-
-       /**
-        * Called after the repository has been initialised. Does nothing by
-        * default.
-        */
-       @SuppressWarnings("rawtypes")
-       protected void postInitialization(Repository repository, Map parameters) {
-
-       }
-
-       public void setFileRepositoryConfiguration(
-                       Resource fileRepositoryConfiguration) {
-               this.fileRepositoryConfiguration = fileRepositoryConfiguration;
-       }
-
-}
diff --git a/org.argeo.jcr/src/org/argeo/jcr/JcrResourceAdapter.java b/org.argeo.jcr/src/org/argeo/jcr/JcrResourceAdapter.java
deleted file mode 100644 (file)
index be7bf49..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * 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.jcr;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-
-import javax.jcr.Binary;
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionHistory;
-import javax.jcr.version.VersionIterator;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Bridge Spring resources and JCR folder / files semantics (nt:folder /
- * nt:file), supporting versioning as well.
- */
-@Deprecated
-public class JcrResourceAdapter {
-       private final static Log log = LogFactory.getLog(JcrResourceAdapter.class);
-
-       private Session session;
-
-       private Boolean versioning = true;
-       private String defaultEncoding = "UTF-8";
-
-       // private String restoreBase = "/.restore";
-
-       public JcrResourceAdapter() {
-       }
-
-       public JcrResourceAdapter(Session session) {
-               this.session = session;
-       }
-
-       public void mkdirs(String path) {
-               JcrUtils.mkdirs(session(), path, NodeType.NT_FOLDER,
-                               NodeType.NT_FOLDER, versioning);
-       }
-
-       public void create(String path, InputStream in, String mimeType) {
-               try {
-                       if (session().itemExists(path)) {
-                               throw new ArgeoJcrException("Node " + path + " already exists.");
-                       }
-
-                       int index = path.lastIndexOf('/');
-                       String parentPath = path.substring(0, index);
-                       if (parentPath.equals(""))
-                               parentPath = "/";
-                       String fileName = path.substring(index + 1);
-                       if (!session().itemExists(parentPath))
-                               throw new ArgeoJcrException("Parent folder of node " + path
-                                               + " does not exist: " + parentPath);
-
-                       Node folderNode = (Node) session().getItem(parentPath);
-                       Node fileNode = folderNode.addNode(fileName, "nt:file");
-
-                       Node contentNode = fileNode.addNode(Property.JCR_CONTENT,
-                                       "nt:resource");
-                       if (mimeType != null)
-                               contentNode.setProperty(Property.JCR_MIMETYPE, mimeType);
-                       contentNode.setProperty(Property.JCR_ENCODING, defaultEncoding);
-                       Binary binary = session().getValueFactory().createBinary(in);
-                       contentNode.setProperty(Property.JCR_DATA, binary);
-                       JcrUtils.closeQuietly(binary);
-                       Calendar lastModified = Calendar.getInstance();
-                       // lastModified.setTimeInMillis(file.lastModified());
-                       contentNode.setProperty(Property.JCR_LAST_MODIFIED, lastModified);
-                       // resNode.addMixin("mix:referenceable");
-
-                       if (versioning)
-                               fileNode.addMixin("mix:versionable");
-
-                       session().save();
-
-                       if (versioning)
-                               session().getWorkspace().getVersionManager()
-                                               .checkin(fileNode.getPath());
-
-                       if (log.isDebugEnabled())
-                               log.debug("Created " + path);
-               } catch (Exception e) {
-                       throw new ArgeoJcrException("Cannot create node for " + path, e);
-               }
-
-       }
-
-       public void update(String path, InputStream in) {
-               try {
-
-                       if (!session().itemExists(path)) {
-                               String type = null;
-                               // FIXME: using javax.activation leads to conflict between Java
-                               // 1.5 and 1.6 (since javax.activation was included in Java 1.6)
-                               // String type = new MimetypesFileTypeMap()
-                               // .getContentType(FilenameUtils.getName(path));
-                               create(path, in, type);
-                               return;
-                       }
-
-                       Node fileNode = (Node) session().getItem(path);
-                       Node contentNode = fileNode.getNode(Property.JCR_CONTENT);
-                       if (versioning)
-                               session().getWorkspace().getVersionManager()
-                                               .checkout(fileNode.getPath());
-                       Binary binary = session().getValueFactory().createBinary(in);
-                       contentNode.setProperty(Property.JCR_DATA, binary);
-                       JcrUtils.closeQuietly(binary);
-                       Calendar lastModified = Calendar.getInstance();
-                       // lastModified.setTimeInMillis(file.lastModified());
-                       contentNode.setProperty(Property.JCR_LAST_MODIFIED, lastModified);
-
-                       session().save();
-                       if (versioning)
-                               session().getWorkspace().getVersionManager()
-                                               .checkin(fileNode.getPath());
-
-                       if (log.isDebugEnabled())
-                               log.debug("Updated " + path);
-               } catch (Exception e) {
-                       throw new ArgeoJcrException("Cannot update node " + path, e);
-               }
-       }
-
-       public List<Calendar> listVersions(String path) {
-               if (!versioning)
-                       throw new ArgeoJcrException("Versioning is not activated");
-
-               try {
-                       List<Calendar> versions = new ArrayList<Calendar>();
-                       Node fileNode = (Node) session().getItem(path);
-                       VersionHistory history = session().getWorkspace()
-                                       .getVersionManager().getVersionHistory(fileNode.getPath());
-                       for (VersionIterator it = history.getAllVersions(); it.hasNext();) {
-                               Version version = (Version) it.next();
-                               versions.add(version.getCreated());
-                               if (log.isTraceEnabled()) {
-                                       log.debug(version);
-                                       // debug(version);
-                               }
-                       }
-                       return versions;
-               } catch (Exception e) {
-                       throw new ArgeoJcrException("Cannot list version of node " + path, e);
-               }
-       }
-
-       public InputStream retrieve(String path) {
-               try {
-                       Node node = (Node) session().getItem(
-                                       path + "/" + Property.JCR_CONTENT);
-                       Property property = node.getProperty(Property.JCR_DATA);
-                       return property.getBinary().getStream();
-               } catch (Exception e) {
-                       throw new ArgeoJcrException("Cannot retrieve " + path, e);
-               }
-       }
-
-       public synchronized InputStream retrieve(String path, Integer revision) {
-               if (!versioning)
-                       throw new ArgeoJcrException("Versioning is not activated");
-
-               try {
-                       Node fileNode = (Node) session().getItem(path);
-                       VersionHistory history = session().getWorkspace()
-                                       .getVersionManager().getVersionHistory(fileNode.getPath());
-                       int count = 0;
-                       Version version = null;
-                       for (VersionIterator it = history.getAllVersions(); it.hasNext();) {
-                               version = (Version) it.next();
-                               if (count == revision + 1) {
-                                       InputStream in = fromVersion(version);
-                                       if (log.isDebugEnabled())
-                                               log.debug("Retrieved " + path + " at revision "
-                                                               + revision);
-                                       return in;
-                               }
-                               count++;
-                       }
-               } catch (Exception e) {
-                       throw new ArgeoJcrException("Cannot retrieve version " + revision
-                                       + " of " + path, e);
-               }
-
-               throw new ArgeoJcrException("Version " + revision
-                               + " does not exist for node " + path);
-       }
-
-       protected InputStream fromVersion(Version version)
-                       throws RepositoryException {
-               Node frozenNode = version.getNode("jcr:frozenNode");
-               InputStream in = frozenNode.getNode(Property.JCR_CONTENT)
-                               .getProperty(Property.JCR_DATA).getBinary().getStream();
-               return in;
-       }
-
-       protected Session session() {
-               return session;
-       }
-
-       public void setVersioning(Boolean versioning) {
-               this.versioning = versioning;
-       }
-
-       public void setDefaultEncoding(String defaultEncoding) {
-               this.defaultEncoding = defaultEncoding;
-       }
-
-       protected String fill(Integer number) {
-               int size = 4;
-               String str = number.toString();
-               for (int i = str.length(); i < size; i++) {
-                       str = "0" + str;
-               }
-               return str;
-       }
-
-       public void setSession(Session session) {
-               this.session = session;
-       }
-
-}
diff --git a/org.argeo.jcr/src/org/argeo/jcr/spring/ThreadBoundSession.java b/org.argeo.jcr/src/org/argeo/jcr/spring/ThreadBoundSession.java
deleted file mode 100644 (file)
index 35f0215..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.jcr.spring;
-
-import org.argeo.jcr.ThreadBoundJcrSessionFactory;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.FactoryBean;
-import org.springframework.beans.factory.InitializingBean;
-
-@SuppressWarnings("rawtypes")
-@Deprecated
-public class ThreadBoundSession extends ThreadBoundJcrSessionFactory implements FactoryBean, InitializingBean, DisposableBean{
-       public void afterPropertiesSet() throws Exception {
-               init();
-       }
-
-       public void destroy() throws Exception {
-               dispose();
-       }
-
-}
diff --git a/org.argeo.sync/.classpath b/org.argeo.sync/.classpath
deleted file mode 100644 (file)
index a7acb82..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
-       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-       <classpathentry kind="src" path="src"/>
-       <classpathentry kind="lib" path="lib/tomcat-jni-9.0.16.jar"/>
-       <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.argeo.sync/.gitignore b/org.argeo.sync/.gitignore
deleted file mode 100644 (file)
index 09e3bc9..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/bin/
-/target/
diff --git a/org.argeo.sync/.project b/org.argeo.sync/.project
deleted file mode 100644 (file)
index 38af869..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>org.argeo.sync</name>
-       <comment></comment>
-       <projects>
-       </projects>
-       <buildSpec>
-               <buildCommand>
-                       <name>org.eclipse.jdt.core.javabuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.pde.ManifestBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.pde.SchemaBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-       </buildSpec>
-       <natures>
-               <nature>org.eclipse.pde.PluginNature</nature>
-               <nature>org.eclipse.jdt.core.javanature</nature>
-       </natures>
-</projectDescription>
diff --git a/org.argeo.sync/.settings/org.eclipse.jdt.core.prefs b/org.argeo.sync/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644 (file)
index 7e2e119..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
-org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
-org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
-org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
-org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
-org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
-org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
-org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
-org.eclipse.jdt.core.compiler.problem.APILeak=warning
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
-org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
-org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
-org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
-org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
diff --git a/org.argeo.sync/META-INF/.gitignore b/org.argeo.sync/META-INF/.gitignore
deleted file mode 100644 (file)
index 4854a41..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/MANIFEST.MF
diff --git a/org.argeo.sync/bnd.bnd b/org.argeo.sync/bnd.bnd
deleted file mode 100644 (file)
index 3ae5c17..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Main-Class: org.argeo.sync.cli.Sync
diff --git a/org.argeo.sync/build.properties b/org.argeo.sync/build.properties
deleted file mode 100644 (file)
index f3e2c2c..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
-               .
-additional.bundles = org.apache.sshd.common,\
-                     org.slf4j.log4j12,\
-                     org.slf4j.api,\
-                     org.apache.sshd.core
diff --git a/org.argeo.sync/lib/.gitignore b/org.argeo.sync/lib/.gitignore
deleted file mode 100644 (file)
index 2142dc1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/tomcat-jni-*.jar
diff --git a/org.argeo.sync/pom.xml b/org.argeo.sync/pom.xml
deleted file mode 100644 (file)
index 4e07d43..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-       <modelVersion>4.0.0</modelVersion>
-       <parent>
-               <groupId>org.argeo.commons</groupId>
-               <artifactId>argeo-commons</artifactId>
-               <version>2.1.77-SNAPSHOT</version>
-               <relativePath>..</relativePath>
-       </parent>
-       <artifactId>org.argeo.sync</artifactId>
-       <name>Commons Sync Utility</name>
-       <dependencies>
-               <dependency>
-                       <groupId>org.argeo.commons</groupId>
-                       <artifactId>org.argeo.util</artifactId>
-                       <version>2.1.77-SNAPSHOT</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.commons</groupId>
-                       <artifactId>org.argeo.jcr</artifactId>
-                       <version>2.1.77-SNAPSHOT</version>
-               </dependency>
-       </dependencies>
-</project>
\ No newline at end of file
diff --git a/org.argeo.sync/src/org/argeo/sync/SyncException.java b/org.argeo.sync/src/org/argeo/sync/SyncException.java
deleted file mode 100644 (file)
index 89bf869..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.argeo.sync;
-
-/** Commons exception for sync */
-public class SyncException extends RuntimeException {
-       private static final long serialVersionUID = -3371314343580218538L;
-
-       public SyncException(String message) {
-               super(message);
-       }
-
-       public SyncException(String message, Throwable cause) {
-               super(message, cause);
-       }
-
-       public SyncException(Object source, Object target, Throwable cause) {
-               super("Cannot sync from " + source + " to " + target, cause);
-       }
-}
diff --git a/org.argeo.sync/src/org/argeo/sync/cli/Sync.java b/org.argeo.sync/src/org/argeo/sync/cli/Sync.java
deleted file mode 100644 (file)
index 6bb098b..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.argeo.sync.cli;
-
-import java.net.URI;
-import java.util.List;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.DefaultParser;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.Options;
-import org.argeo.sync.fs.PathSync;
-
-public class Sync {
-
-       public static void main(String[] args) {
-               Options options = new Options();
-               options.addOption("r", "recursive", false, "recurse into directories");
-               options.addOption(Option.builder().longOpt("progress").hasArg(false).desc("").build());
-
-               CommandLineParser parser = new DefaultParser();
-               try {
-                       CommandLine line = parser.parse(options, args);
-                       List<String> remaining = line.getArgList();
-
-                       URI sourceUri = new URI(remaining.get(0));
-                       URI targetUri = new URI(remaining.get(1));
-                       PathSync pathSync = new PathSync(sourceUri, targetUri);
-                       pathSync.run();
-               } catch (Exception exp) {
-                       exp.printStackTrace();
-
-               }
-       }
-
-}
diff --git a/org.argeo.sync/src/org/argeo/sync/fs/PathSync.java b/org.argeo.sync/src/org/argeo/sync/fs/PathSync.java
deleted file mode 100644 (file)
index 1dc30db..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.argeo.sync.fs;
-
-import java.net.URI;
-import java.nio.file.FileSystems;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.spi.FileSystemProvider;
-import java.time.ZonedDateTime;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.jackrabbit.fs.DavexFsProvider;
-import org.argeo.sync.SyncException;
-import org.argeo.util.LangUtils;
-
-public class PathSync implements Runnable {
-       private final static Log log = LogFactory.getLog(PathSync.class);
-
-       private final URI sourceUri, targetUri;
-
-       public PathSync(URI sourceUri, URI targetUri) {
-               this.sourceUri = sourceUri;
-               this.targetUri = targetUri;
-       }
-
-       @Override
-       public void run() {
-               try {
-                       FileSystemProvider sourceFsProvider = createFsProvider(sourceUri);
-                       FileSystemProvider targetFsProvider = createFsProvider(targetUri);
-                       Path sourceBasePath = sourceUri.getScheme() != null ? sourceFsProvider.getPath(sourceUri)
-                                       : Paths.get(sourceUri.getPath());
-                       Path targetBasePath = targetUri.getScheme() != null ? targetFsProvider.getPath(targetUri)
-                                       : Paths.get(targetUri.getPath());
-                       SyncFileVisitor syncFileVisitor = new SyncFileVisitor(sourceBasePath, targetBasePath);
-                       ZonedDateTime begin = ZonedDateTime.now();
-                       Files.walkFileTree(sourceBasePath, syncFileVisitor);
-                       if (log.isDebugEnabled())
-                               log.debug("Sync from " + sourceBasePath + " to " + targetBasePath + " took " + LangUtils.since(begin));
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }
-       }
-
-       private static FileSystemProvider createFsProvider(URI uri) {
-               FileSystemProvider fsProvider;
-               if (uri.getScheme() == null || uri.getScheme().equals("file"))
-                       fsProvider = FileSystems.getDefault().provider();
-               else if (uri.getScheme().equals("davex"))
-                       fsProvider = new DavexFsProvider();
-               else
-                       throw new SyncException("URI scheme not supported for " + uri);
-               return fsProvider;
-       }
-
-       static enum Arg {
-               to, from;
-       }
-}
diff --git a/org.argeo.sync/src/org/argeo/sync/fs/SshSync.java b/org.argeo.sync/src/org/argeo/sync/fs/SshSync.java
deleted file mode 100644 (file)
index e89ba85..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.argeo.sync.fs;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.file.DirectoryStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.security.PublicKey;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Scanner;
-import java.util.Set;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.sshd.agent.SshAgent;
-import org.apache.sshd.agent.unix.UnixAgentFactory;
-import org.apache.sshd.client.SshClient;
-import org.apache.sshd.client.channel.ClientChannel;
-import org.apache.sshd.client.channel.ClientChannelEvent;
-import org.apache.sshd.client.future.ConnectFuture;
-import org.apache.sshd.client.session.ClientSession;
-import org.apache.sshd.client.subsystem.sftp.SftpFileSystem;
-import org.apache.sshd.client.subsystem.sftp.SftpFileSystemProvider;
-import org.apache.sshd.common.util.io.NoCloseInputStream;
-import org.apache.sshd.common.util.io.NoCloseOutputStream;
-
-public class SshSync {
-       private final static Log log = LogFactory.getLog(SshSync.class);
-
-       public static void main(String[] args) {
-
-
-               try (SshClient client = SshClient.setUpDefaultClient()) {
-                       client.start();
-
-                       UnixAgentFactory agentFactory = new UnixAgentFactory();
-                       client.setAgentFactory(agentFactory);
-//                     SshAgent sshAgent = agentFactory.createClient(client);
-//                     List<? extends Map.Entry<PublicKey, String>> identities = sshAgent.getIdentities();
-//                     for (Map.Entry<PublicKey, String> entry : identities) {
-//                             System.out.println(entry.getValue() + " : " + entry.getKey());
-//                     }
-
-                       
-                       String login = System.getProperty("user.name");
-//                     Scanner s = new Scanner(System.in);
-//                     String password = s.next();
-                       String host = "localhost";
-                       int port = 22;
-
-//                     SimpleClient simpleClient= AbstractSimpleClientSessionCreator.wrap(client, null);
-//                     simpleClient.sessionLogin(host, login, password);
-
-                       ConnectFuture connectFuture = client.connect(login, host, port);
-                       connectFuture.await();
-                       ClientSession session = connectFuture.getSession();
-
-                       try {
-
-//                             session.addPasswordIdentity(new String(password));
-                               session.auth().verify(1000l);
-
-                               SftpFileSystemProvider fsProvider = new SftpFileSystemProvider(client);
-
-                               SftpFileSystem fs = fsProvider.newFileSystem(session);
-                               Path testPath = fs.getPath("/home/" + login + "/tmp");
-                               Files.list(testPath).forEach(System.out::println);
-                               test(testPath);
-
-                       } finally {
-                               client.stop();
-                       }
-               } catch (Exception e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }
-       }
-
-       static void test(Path testBase) {
-               try {
-                       Path testPath = testBase.resolve("ssh-test.txt");
-                       Files.createFile(testPath);
-                       log.debug("Created file " + testPath);
-                       Files.delete(testPath);
-                       log.debug("Deleted " + testPath);
-                       String txt = "TEST\nTEST2\n";
-                       byte[] arr = txt.getBytes();
-                       Files.write(testPath, arr);
-                       log.debug("Wrote " + testPath);
-                       byte[] read = Files.readAllBytes(testPath);
-                       log.debug("Read " + testPath);
-                       Path testDir = testBase.resolve("testDir");
-                       log.debug("Resolved " + testDir);
-                       // Copy
-                       Files.createDirectory(testDir);
-                       log.debug("Created directory " + testDir);
-                       Path subsubdir = Files.createDirectories(testDir.resolve("subdir/subsubdir"));
-                       log.debug("Created sub directories " + subsubdir);
-                       Path copiedFile = testDir.resolve("copiedFile.txt");
-                       log.debug("Resolved " + copiedFile);
-                       Path relativeCopiedFile = testDir.relativize(copiedFile);
-                       log.debug("Relative copied file " + relativeCopiedFile);
-                       try (OutputStream out = Files.newOutputStream(copiedFile);
-                                       InputStream in = Files.newInputStream(testPath)) {
-                               IOUtils.copy(in, out);
-                       }
-                       log.debug("Copied " + testPath + " to " + copiedFile);
-                       Files.delete(testPath);
-                       log.debug("Deleted " + testPath);
-                       byte[] copiedRead = Files.readAllBytes(copiedFile);
-                       log.debug("Read " + copiedFile);
-                       // Browse directories
-                       DirectoryStream<Path> files = Files.newDirectoryStream(testDir);
-                       int fileCount = 0;
-                       Path listedFile = null;
-                       for (Path file : files) {
-                               fileCount++;
-                               if (!Files.isDirectory(file))
-                                       listedFile = file;
-                       }
-                       log.debug("Listed " + testDir);
-                       // Generic attributes
-                       Map<String, Object> attrs = Files.readAttributes(copiedFile, "*");
-                       log.debug("Read attributes of " + copiedFile + ": " + attrs.keySet());
-               } catch (IOException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }
-
-       }
-
-       static void openShell(ClientSession session) {
-               try (ClientChannel channel = session.createChannel(ClientChannel.CHANNEL_SHELL)) {
-                       channel.setIn(new NoCloseInputStream(System.in));
-                       channel.setOut(new NoCloseOutputStream(System.out));
-                       channel.setErr(new NoCloseOutputStream(System.err));
-                       channel.open();
-
-                       Set<ClientChannelEvent> events = new HashSet<>();
-                       events.add(ClientChannelEvent.CLOSED);
-                       channel.waitFor(events, 0);
-               } catch (IOException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               } finally {
-                       session.close(false);
-               }
-       }
-}
diff --git a/org.argeo.sync/src/org/argeo/sync/fs/SyncFileVisitor.java b/org.argeo.sync/src/org/argeo/sync/fs/SyncFileVisitor.java
deleted file mode 100644 (file)
index de80320..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.argeo.sync.fs;
-
-import java.io.IOException;
-import java.nio.file.FileVisitResult;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.SimpleFileVisitor;
-import java.nio.file.attribute.BasicFileAttributes;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/** Synchronises two directory structures. */
-public class SyncFileVisitor extends SimpleFileVisitor<Path> {
-       private final static Log log = LogFactory.getLog(SyncFileVisitor.class);
-
-       private final Path sourceBasePath;
-       private final Path targetBasePath;
-
-       public SyncFileVisitor(Path sourceBasePath, Path targetBasePath) {
-               this.sourceBasePath = sourceBasePath;
-               this.targetBasePath = targetBasePath;
-       }
-
-       @Override
-       public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
-               Path targetPath = toTargetPath(dir);
-               Files.createDirectories(targetPath);
-               return FileVisitResult.CONTINUE;
-       }
-
-       @Override
-       public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
-               Path targetPath = toTargetPath(file);
-               try {
-                       Files.copy(file, targetPath);
-                       if (log.isDebugEnabled())
-                               log.debug("Copied " + targetPath);
-               } catch (Exception e) {
-                       log.error("Cannot copy " + file + " to " + targetPath, e);
-               }
-               return FileVisitResult.CONTINUE;
-       }
-
-       @Override
-       public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
-               log.error("Cannot sync " + file, exc);
-               return FileVisitResult.CONTINUE;
-       }
-
-       private Path toTargetPath(Path sourcePath) {
-               Path relativePath = sourceBasePath.relativize(sourcePath);
-               Path targetPath = targetBasePath.resolve(relativePath.toString());
-               return targetPath;
-       }
-}
diff --git a/pom.xml b/pom.xml
index 4efd8d8fc02c54109a8f5324ef38712b48e7874b..1c9976a63b3642f6303d17cee078716e2b91e821 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -22,8 +22,8 @@
                <module>org.argeo.util</module>
                <module>org.argeo.enterprise</module>
                <module>org.argeo.jcr</module>
-               <module>org.argeo.sync</module>
                <module>org.argeo.osgi.boot</module>
+               <module>org.argeo.core</module>
                <!-- Eclipse -->
                <module>org.argeo.eclipse.ui</module>
                <module>org.argeo.eclipse.ui.rap</module>