Delete projects
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 17 Jul 2012 12:51:39 +0000 (12:51 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 17 Jul 2012 12:51:39 +0000 (12:51 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@5486 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

43 files changed:
base/dep/org.argeo.basic.dep.log4j/pom.xml [deleted file]
base/dep/org.argeo.osgi.dep.jackrabbit/pom.xml [deleted file]
base/runtime/org.argeo.basic.nodeps/.classpath [deleted file]
base/runtime/org.argeo.basic.nodeps/.project [deleted file]
base/runtime/org.argeo.basic.nodeps/.settings/org.eclipse.core.resources.prefs [deleted file]
base/runtime/org.argeo.basic.nodeps/.settings/org.eclipse.jdt.core.prefs [deleted file]
base/runtime/org.argeo.basic.nodeps/.settings/org.maven.ide.eclipse.prefs [deleted file]
base/runtime/org.argeo.basic.nodeps/build.properties [deleted file]
base/runtime/org.argeo.basic.nodeps/pom.xml [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/ArgeoException.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/ArgeoLogListener.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/ArgeoLogger.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/OperatingSystem.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/StreamUtils.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/CsvParser.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/CsvParserWithLinesAsMap.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/CsvWriter.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/Throughput.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/ThroughputEditor.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/crypto/AbstractKeyring.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/crypto/Keyring.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/crypto/KeyringLoginModule.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/crypto/PBEKeySpecCallback.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/crypto/PasswordBasedEncryption.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/security/DigestUtils.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/security/SimplePrincipal.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/ArrayTabularRow.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/CsvTabularWriter.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/TabularColumn.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/TabularContent.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/TabularRow.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/TabularRowIterator.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/TabularWriter.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/CsvParserEncodingTestCase.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/CsvParserParseFileTest.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/CsvParserTestCase.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/CsvParserWithQuotedSeparatorTest.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/CsvWriterTestCase.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/ThroughputTest.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/crypto/PasswordBasedEncryptionTest.java [deleted file]
base/runtime/org.argeo.basic.nodeps/src/test/resources/org/argeo/util/ReferenceFile.csv [deleted file]
base/runtime/org.argeo.basic.nodeps/src/test/resources/org/argeo/util/TestParse-ISO.csv [deleted file]
base/runtime/org.argeo.basic.nodeps/src/test/resources/org/argeo/util/TestParse-UTF-8.csv [deleted file]

diff --git a/base/dep/org.argeo.basic.dep.log4j/pom.xml b/base/dep/org.argeo.basic.dep.log4j/pom.xml
deleted file mode 100644 (file)
index ab7f5db..0000000
+++ /dev/null
@@ -1,55 +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.base</groupId>
-               <version>1.1.4-SNAPSHOT</version>
-               <artifactId>dep</artifactId>
-               <relativePath>..</relativePath>
-       </parent>
-       <artifactId>org.argeo.basic.dep.log4j</artifactId>
-       <packaging>pom</packaging>
-       <name>Commons Apache Log4j (SLF4J) Dependencies</name>
-       <dependencies>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>slf4j.org.apache.commons.logging</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.log4j</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>slf4j.log4j</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>slf4j.api</artifactId>
-               </dependency>
-               <!-- JEE dependencies (for 1.2.16 in SpringSOurce repo)
-               <dependency>
-                       <groupId>org.apache.geronimo.specs</groupId>
-                       <artifactId>com.springsource.javax.management.j2ee</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>javax.ejb</groupId>
-                       <artifactId>com.springsource.javax.ejb</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>javax.transaction</groupId>
-                       <artifactId>com.springsource.javax.transaction</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>javax.xml.rpc</groupId>
-                       <artifactId>com.springsource.javax.xml.rpc</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>javax.xml.soap</groupId>
-                       <artifactId>com.springsource.javax.xml.soap</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>javax.activation</groupId>
-                       <artifactId>com.springsource.javax.activation</artifactId>
-               </dependency> -->
-       </dependencies>
-</project>
\ No newline at end of file
diff --git a/base/dep/org.argeo.osgi.dep.jackrabbit/pom.xml b/base/dep/org.argeo.osgi.dep.jackrabbit/pom.xml
deleted file mode 100644 (file)
index 01c60f9..0000000
+++ /dev/null
@@ -1,117 +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.base</groupId>
-               <version>1.1.4-SNAPSHOT</version>
-               <artifactId>dep</artifactId>
-               <relativePath>..</relativePath>
-       </parent>
-       <artifactId>org.argeo.osgi.dep.jackrabbit</artifactId>
-       <packaging>pom</packaging>
-       <name>Commons OSGi Minimal Jackrabbit</name>
-       <dependencies>
-               <dependency>
-                       <groupId>org.argeo.commons.osgi</groupId>
-                       <artifactId>org.argeo.osgi.dep.stdruntime</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
-                       <type>pom</type>
-               </dependency>
-
-               <!-- Jackrabbit -->
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.jackrabbit</artifactId>
-               </dependency>
-
-               <!-- Database -->
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.h2</artifactId>
-               </dependency>
-
-               <!-- Transitive dependencies -->
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>javax.jcr</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.lucene</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.commons.basic</groupId>
-                       <artifactId>org.argeo.basic.dep.log4j</artifactId>
-                       <version>1.1.4-SNAPSHOT</version>
-                       <type>pom</type>
-               </dependency>
-
-               <!-- Commons -->
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.commons.collections</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.commons.io</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.commons.httpclient</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.commons.fileupload</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.commons.compress</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.commons.pool</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.commons.dbcp</artifactId>
-               </dependency>
-
-               <!-- Misc -->
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>edu.oswego.cs.dl.util.concurrent</artifactId>
-               </dependency>
-
-               <!-- For webdav -->
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>javax.servlet</artifactId>
-               </dependency>
-
-               <!-- Tika -->
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.apache.tika</artifactId>
-               </dependency>
-               <!-- Required for OSGi completion -->
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.dom4j</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.jdom</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.objectweb.asm</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.jaxen</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>org.xmlpull</artifactId>
-               </dependency>
-       </dependencies>
-</project>
\ No newline at end of file
diff --git a/base/runtime/org.argeo.basic.nodeps/.classpath b/base/runtime/org.argeo.basic.nodeps/.classpath
deleted file mode 100644 (file)
index 8499fd0..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-       <classpathentry kind="src" output="target/classes" path="src/main/java"/>
-       <classpathentry kind="src" path="src/test/java"/>
-       <classpathentry kind="src" path="src/test/resources"/>
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
-       <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
-       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-       <classpathentry kind="output" path="target/classes"/>
-</classpath>
diff --git a/base/runtime/org.argeo.basic.nodeps/.project b/base/runtime/org.argeo.basic.nodeps/.project
deleted file mode 100644 (file)
index e03b503..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>org.argeo.basic.nodeps</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.jdt.core.javanature</nature>
-               <nature>org.eclipse.pde.PluginNature</nature>
-       </natures>
-</projectDescription>
diff --git a/base/runtime/org.argeo.basic.nodeps/.settings/org.eclipse.core.resources.prefs b/base/runtime/org.argeo.basic.nodeps/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644 (file)
index aabe426..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue Nov 01 16:23:51 CET 2011
-eclipse.preferences.version=1
-encoding//src/test/resources/org/argeo/util/TestParse-ISO.csv=ISO-8859-1
diff --git a/base/runtime/org.argeo.basic.nodeps/.settings/org.eclipse.jdt.core.prefs b/base/runtime/org.argeo.basic.nodeps/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644 (file)
index 6faceb2..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#Wed Nov 25 13:22:42 CET 2009
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/base/runtime/org.argeo.basic.nodeps/.settings/org.maven.ide.eclipse.prefs b/base/runtime/org.argeo.basic.nodeps/.settings/org.maven.ide.eclipse.prefs
deleted file mode 100644 (file)
index 0899280..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#Wed Nov 25 13:22:42 CET 2009
-activeProfiles=
-eclipse.preferences.version=1
-fullBuildGoals=process-test-resources
-includeModules=false
-resolveWorkspaceProjects=true
-resourceFilterGoals=process-resources resources\:testResources
-skipCompilerPlugin=true
-version=1
diff --git a/base/runtime/org.argeo.basic.nodeps/build.properties b/base/runtime/org.argeo.basic.nodeps/build.properties
deleted file mode 100644 (file)
index fcffb0f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-source.. = src/main/java/,\
-           src/test/resources/,\
-           src/test/java/
-bin.includes = META-INF/,\
-               .
-additional.bundles = junit
diff --git a/base/runtime/org.argeo.basic.nodeps/pom.xml b/base/runtime/org.argeo.basic.nodeps/pom.xml
deleted file mode 100644 (file)
index cdfdef8..0000000
+++ /dev/null
@@ -1,33 +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.base</groupId>
-               <artifactId>runtime</artifactId>
-               <version>1.1.4-SNAPSHOT</version>
-               <relativePath>..</relativePath>
-       </parent>
-       <artifactId>org.argeo.basic.nodeps</artifactId>
-       <name>Commons Basic No Deps</name>
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.felix</groupId>
-                               <artifactId>maven-bundle-plugin</artifactId>
-                               <configuration>
-                                       <instructions>
-                                               <Export-Package>
-                                                       org.argeo.*
-                                               </Export-Package>
-                                       </instructions>
-                               </configuration>
-                       </plugin>
-               </plugins>
-       </build>
-       <dependencies>
-               <dependency>
-                       <groupId>org.argeo.tp</groupId>
-                       <artifactId>junit</artifactId>
-                       <scope>test</scope>
-               </dependency>
-       </dependencies>
-</project>
\ No newline at end of file
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/ArgeoException.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/ArgeoException.java
deleted file mode 100644 (file)
index 343b6c9..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo;
-
-/** Argeo Commons specific exception. */
-public class ArgeoException extends RuntimeException {
-       private static final long serialVersionUID = 1L;
-
-       /** Creates an exception with a message. */
-       public ArgeoException(String message) {
-               super(message);
-       }
-
-       /** Creates an exception with a message and a root cause. */
-       public ArgeoException(String message, Throwable e) {
-               super(message, e);
-       }
-
-       /** @deprecated use {@link #ArgeoException(String, Throwable)} instead. */
-       @Deprecated
-       public ArgeoException(Throwable cause) {
-               super(cause);
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/ArgeoLogListener.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/ArgeoLogListener.java
deleted file mode 100644 (file)
index 8f2b222..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo;
-
-/** Framework agnostic interface for log notifications */
-public interface ArgeoLogListener {
-       /**
-        * Appends a log
-        * 
-        * @param username
-        *            authentified user, null for anonymous
-        * @param level
-        *            INFO, DEBUG, WARN, etc. (logging framework specific)
-        * @param category
-        *            hierarchy (logging framework specific)
-        * @param thread
-        *            name of the thread which logged this message
-        * @param msg
-        *            any object as long as its toString() method returns the
-        *            message
-        * @param the
-        *            exception in log4j ThrowableStrRep format
-        */
-       public void appendLog(String username, Long timestamp, String level,
-                       String category, String thread, Object msg, String[] exception);
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/ArgeoLogger.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/ArgeoLogger.java
deleted file mode 100644 (file)
index 13cd6d3..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo;
-
-/**
- * Logging framework agnostic identifying a logging service, to which one can
- * register
- */
-public interface ArgeoLogger {
-       /**
-        * Register for events by threads with the same authentication (or all
-        * threads if admin)
-        */
-       public void register(ArgeoLogListener listener,
-                       Integer numberOfPreviousEvents);
-
-       /**
-        * For admin use only: register for all users
-        * 
-        * @param listener
-        *            the log listener
-        * @param numberOfPreviousEvents
-        *            the number of previous events to notify
-        * @param everything
-        *            if true even anonymous is logged
-        */
-       public void registerForAll(ArgeoLogListener listener,
-                       Integer numberOfPreviousEvents, boolean everything);
-
-       public void unregister(ArgeoLogListener listener);
-
-       public void unregisterForAll(ArgeoLogListener listener);
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/OperatingSystem.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/OperatingSystem.java
deleted file mode 100644 (file)
index dcf5bca..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo;
-
-/** The current operating system. */
-public class OperatingSystem {
-       public final static int NIX = 1;
-       public final static int WINDOWS = 2;
-       public final static int SOLARIS = 3;
-
-       public final static int os;
-       static {
-               String osName = System.getProperty("os.name");
-               if (osName.startsWith("Win"))
-                       os = WINDOWS;
-               else if (osName.startsWith("Solaris"))
-                       os = SOLARIS;
-               else
-                       os = NIX;
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/StreamUtils.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/StreamUtils.java
deleted file mode 100644 (file)
index 86c53cc..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.io.Writer;
-
-/** Utilities to be used when APache COmmons IO is not available. */
-public class StreamUtils {
-       private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
-
-       /*
-        * APACHE COMMONS IO (inspired)
-        */
-
-       /** @return the number of bytes */
-       public static Long copy(InputStream in, OutputStream out)
-                       throws IOException {
-               Long count = 0l;
-               byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
-               while (true) {
-                       int length = in.read(buf);
-                       if (length < 0)
-                               break;
-                       out.write(buf, 0, length);
-                       count = count + length;
-               }
-               return count;
-       }
-
-       /** @return the number of chars */
-       public static Long copy(Reader in, Writer out) throws IOException {
-               Long count = 0l;
-               char[] buf = new char[DEFAULT_BUFFER_SIZE];
-               while (true) {
-                       int length = in.read(buf);
-                       if (length < 0)
-                               break;
-                       out.write(buf, 0, length);
-                       count = count + length;
-               }
-               return count;
-       }
-
-       public static void closeQuietly(InputStream in) {
-               if (in != null)
-                       try {
-                               in.close();
-                       } catch (Exception e) {
-                               //
-                       }
-       }
-
-       public static void closeQuietly(OutputStream out) {
-               if (out != null)
-                       try {
-                               out.close();
-                       } catch (Exception e) {
-                               //
-                       }
-       }
-
-       public static void closeQuietly(Reader in) {
-               if (in != null)
-                       try {
-                               in.close();
-                       } catch (Exception e) {
-                               //
-                       }
-       }
-
-       public static void closeQuietly(Writer out) {
-               if (out != null)
-                       try {
-                               out.close();
-                       } catch (Exception e) {
-                               //
-                       }
-       }
-
-       /*
-        * APACHE COMMONS CODEC (forked)
-        */
-       /**
-        * Used to build output as Hex
-        */
-       private static final char[] DIGITS_LOWER = { '0', '1', '2', '3', '4', '5',
-                       '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
-
-       /**
-        * Used to build output as Hex
-        */
-       private static final char[] DIGITS_UPPER = { '0', '1', '2', '3', '4', '5',
-                       '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
-
-       /**
-        * Converts an array of bytes into a String representing the hexadecimal
-        * values of each byte in order. The returned String will be double the
-        * length of the passed array, as it takes two characters to represent any
-        * given byte.
-        * 
-        * @param data
-        *            a byte[] to convert to Hex characters
-        * @return A String containing hexadecimal characters
-        * @since 1.4
-        */
-       public static String encodeHexString(byte[] data) {
-               return new String(encodeHex(data));
-       }
-
-       /**
-        * Converts an array of bytes into an array of characters representing the
-        * hexadecimal values of each byte in order. The returned array will be
-        * double the length of the passed array, as it takes two characters to
-        * represent any given byte.
-        * 
-        * @param data
-        *            a byte[] to convert to Hex characters
-        * @return A char[] containing hexadecimal characters
-        */
-       public static char[] encodeHex(byte[] data) {
-               return encodeHex(data, true);
-       }
-
-       /**
-        * Converts an array of bytes into an array of characters representing the
-        * hexadecimal values of each byte in order. The returned array will be
-        * double the length of the passed array, as it takes two characters to
-        * represent any given byte.
-        * 
-        * @param data
-        *            a byte[] to convert to Hex characters
-        * @param toLowerCase
-        *            <code>true</code> converts to lowercase, <code>false</code> to
-        *            uppercase
-        * @return A char[] containing hexadecimal characters
-        * @since 1.4
-        */
-       public static char[] encodeHex(byte[] data, boolean toLowerCase) {
-               return encodeHex(data, toLowerCase ? DIGITS_LOWER : DIGITS_UPPER);
-       }
-
-       /**
-        * Converts an array of bytes into an array of characters representing the
-        * hexadecimal values of each byte in order. The returned array will be
-        * double the length of the passed array, as it takes two characters to
-        * represent any given byte.
-        * 
-        * @param data
-        *            a byte[] to convert to Hex characters
-        * @param toDigits
-        *            the output alphabet
-        * @return A char[] containing hexadecimal characters
-        * @since 1.4
-        */
-       protected static char[] encodeHex(byte[] data, char[] toDigits) {
-               int l = data.length;
-               char[] out = new char[l << 1];
-               // two characters form the hex value.
-               for (int i = 0, j = 0; i < l; i++) {
-                       out[j++] = toDigits[(0xF0 & data[i]) >>> 4];
-                       out[j++] = toDigits[0x0F & data[i]];
-               }
-               return out;
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/CsvParser.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/CsvParser.java
deleted file mode 100644 (file)
index 127d0f5..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.argeo.ArgeoException;
-
-/**
- * Parses a CSV file interpreting the first line as a header. The
- * {@link #parse(InputStream)} method and the setters are synchronized so that
- * the object cannot be modified when parsing.
- */
-public abstract class CsvParser {
-       private char separator = ',';
-       private char quote = '\"';
-
-       private Boolean noHeader = false;
-       private Boolean strictLineAsLongAsHeader = true;
-
-       /**
-        * Actually process a parsed line. If
-        * {@link #setStrictLineAsLongAsHeader(Boolean)} is true (default) the
-        * header and the tokens are guaranteed to have the same size.
-        * 
-        * @param lineNumber
-        *            the current line number, starts at 1 (the header, if header
-        *            processing is enabled, the first line otherwise)
-        * @param header
-        *            the read-only header or null if {@link #setNoHeader(Boolean)}
-        *            is true (default is false)
-        * @param tokens
-        *            the parsed tokens
-        */
-       protected abstract void processLine(Integer lineNumber,
-                       List<String> header, List<String> tokens);
-
-       public synchronized void parse(InputStream in) {
-               parse(in, null);
-       }
-
-       public synchronized void parse(InputStream in, String encoding) {
-               BufferedReader reader = null;
-               Integer lineCount = 0;
-               try {
-                       if (encoding == null)
-                               reader = new BufferedReader(new InputStreamReader(in));
-                       else
-                               reader = new BufferedReader(new InputStreamReader(in, encoding));
-                       List<String> header = null;
-                       if (!noHeader) {
-                               String headerStr = reader.readLine();
-                               if (headerStr == null)// empty file
-                                       return;
-                               lineCount++;
-                               header = new ArrayList<String>();
-                               StringBuffer currStr = new StringBuffer("");
-                               Boolean wasInquote = false;
-                               while (parseLine(headerStr, header, currStr, wasInquote)) {
-                                       headerStr = reader.readLine();
-                                       if (headerStr == null)
-                                               break;
-                                       wasInquote = true;
-                               }
-                               header = Collections.unmodifiableList(header);
-                       }
-
-                       String line = null;
-                       lines: while ((line = reader.readLine()) != null) {
-                               line = preProcessLine(line);
-                               if (line == null) {
-                                       // skip line
-                                       continue lines;
-                               }
-                               lineCount++;
-                               List<String> tokens = new ArrayList<String>();
-                               StringBuffer currStr = new StringBuffer("");
-                               Boolean wasInquote = false;
-                               sublines: while (parseLine(line, tokens, currStr, wasInquote)) {
-                                       line = reader.readLine();
-                                       if (line == null)
-                                               break sublines;
-                                       wasInquote = true;
-                               }
-                               if (!noHeader && strictLineAsLongAsHeader) {
-                                       int headerSize = header.size();
-                                       int tokenSize = tokens.size();
-                                       if (tokenSize == 1 && line.trim().equals(""))
-                                               continue lines;// empty line
-                                       if (headerSize != tokenSize) {
-                                               throw new ArgeoException("Token size " + tokenSize
-                                                               + " is different from header size "
-                                                               + headerSize + " at line " + lineCount
-                                                               + ", line: " + line + ", header: " + header
-                                                               + ", tokens: " + tokens);
-                                       }
-                               }
-                               processLine(lineCount, header, tokens);
-                       }
-               } catch (ArgeoException e) {
-                       throw e;
-               } catch (IOException e) {
-                       throw new ArgeoException("Cannot parse CSV file (line: "
-                                       + lineCount + ")", e);
-               } finally {
-                       if (reader != null)
-                               try {
-                                       reader.close();
-                               } catch (Exception e2) {
-                                       // silent
-                               }
-               }
-       }
-
-       /**
-        * Called before each (logical) line is processed, giving a change to modify
-        * it (typically for cleaning dirty files). To be overridden, return the
-        * line unchanged by default. Skip the line if 'null' is returned.
-        */
-       protected String preProcessLine(String line) {
-               return line;
-       }
-
-       /**
-        * Parses a line character by character for performance purpose
-        * 
-        * @return whether to continue parsing this line
-        */
-       protected Boolean parseLine(String str, List<String> tokens,
-                       StringBuffer currStr, Boolean wasInquote) {
-               // List<String> tokens = new ArrayList<String>();
-
-               // System.out.println("#LINE: " + str);
-
-               if (wasInquote)
-                       currStr.append('\n');
-
-               char[] arr = str.toCharArray();
-               boolean inQuote = wasInquote;
-               // StringBuffer currStr = new StringBuffer("");
-               for (int i = 0; i < arr.length; i++) {
-                       char c = arr[i];
-                       if (c == separator) {
-                               if (!inQuote) {
-                                       tokens.add(currStr.toString());
-                                       // System.out.println("# TOKEN: " + currStr);
-                                       currStr.delete(0, currStr.length());
-                               } else {
-                                       // we don't remove separator that are in a quoted substring
-                                       // System.out
-                                       // .println("IN QUOTE, got a separator: [" + c + "]");
-                                       currStr.append(c);
-                               }
-                       } else if (c == quote) {
-                               if (inQuote && (i + 1) < arr.length && arr[i + 1] == quote) {
-                                       // case of double quote
-                                       currStr.append(quote);
-                                       i++;
-                               } else {// standard
-                                       inQuote = inQuote ? false : true;
-                               }
-                       } else {
-                               currStr.append(c);
-                       }
-               }
-
-               if (!inQuote) {
-                       tokens.add(currStr.toString());
-                       // System.out.println("# TOKEN: " + currStr);
-               }
-               // if (inQuote)
-               // throw new ArgeoException("Missing quote at the end of the line "
-               // + str + " (parsed: " + tokens + ")");
-               if (inQuote)
-                       return true;
-               else
-                       return false;
-               // return tokens;
-       }
-
-       public char getSeparator() {
-               return separator;
-       }
-
-       public synchronized void setSeparator(char separator) {
-               this.separator = separator;
-       }
-
-       public char getQuote() {
-               return quote;
-       }
-
-       public synchronized void setQuote(char quote) {
-               this.quote = quote;
-       }
-
-       public Boolean getNoHeader() {
-               return noHeader;
-       }
-
-       public synchronized void setNoHeader(Boolean noHeader) {
-               this.noHeader = noHeader;
-       }
-
-       public Boolean getStrictLineAsLongAsHeader() {
-               return strictLineAsLongAsHeader;
-       }
-
-       public synchronized void setStrictLineAsLongAsHeader(
-                       Boolean strictLineAsLongAsHeader) {
-               this.strictLineAsLongAsHeader = strictLineAsLongAsHeader;
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/CsvParserWithLinesAsMap.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/CsvParserWithLinesAsMap.java
deleted file mode 100644 (file)
index e6afb7b..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.argeo.ArgeoException;
-
-/**
- * CSV parser allowing to process lines as maps whose keys are the header
- * fields.
- */
-public abstract class CsvParserWithLinesAsMap extends CsvParser {
-
-       /**
-        * Actually processes a line.
-        * 
-        * @param lineNumber
-        *            the current line number, starts at 1 (the header, if header
-        *            processing is enabled, the first lien otherwise)
-        * @param line
-        *            the parsed tokens as a map whose keys are the header fields
-        */
-       protected abstract void processLine(Integer lineNumber,
-                       Map<String, String> line);
-
-       protected final void processLine(Integer lineNumber, List<String> header,
-                       List<String> tokens) {
-               if (header == null)
-                       throw new ArgeoException("Only CSV with header is supported");
-               Map<String, String> line = new HashMap<String, String>();
-               for (int i = 0; i < header.size(); i++) {
-                       String key = header.get(i);
-                       String value = null;
-                       if (i < tokens.size())
-                               value = tokens.get(i);
-                       line.put(key, value);
-               }
-               processLine(lineNumber, line);
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/CsvWriter.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/CsvWriter.java
deleted file mode 100644 (file)
index b3f3838..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.util.Iterator;
-import java.util.List;
-
-import org.argeo.ArgeoException;
-
-/** Write in CSV format. */
-public class CsvWriter {
-       private final Writer out;
-
-       private char separator = ',';
-       private char quote = '\"';
-
-       /**
-        * Creates a CSV writer.
-        * 
-        * @param out
-        *            the stream to write to. Caller is responsible for closing it.
-        */
-       public CsvWriter(OutputStream out) {
-               this.out = new OutputStreamWriter(out);
-       }
-
-       /**
-        * Creates a CSV writer.
-        * 
-        * @param out
-        *            the stream to write to. Caller is responsible for closing it.
-        */
-       public CsvWriter(OutputStream out, String encoding) {
-               try {
-                       this.out = new OutputStreamWriter(out, encoding);
-               } catch (UnsupportedEncodingException e) {
-                       throw new ArgeoException("Cannot initialize CSV writer", e);
-               }
-       }
-
-       /**
-        * Write a CSV line. Also used to write a header if needed (this is
-        * transparent for the CSV writer): simply call it first, before writing the
-        * lines.
-        */
-       public void writeLine(List<?> tokens) {
-               try {
-                       Iterator<?> it = tokens.iterator();
-                       while (it.hasNext()) {
-                               writeToken(it.next().toString());
-                               if (it.hasNext())
-                                       out.write(separator);
-                       }
-                       out.write('\n');
-                       out.flush();
-               } catch (IOException e) {
-                       throw new ArgeoException("Could not write " + tokens, e);
-               }
-       }
-
-       /**
-        * Write a CSV line. Also used to write a header if needed (this is
-        * transparent for the CSV writer): simply call it first, before writing the
-        * lines.
-        */
-       public void writeLine(Object[] tokens) {
-               try {
-                       for (int i = 0; i < tokens.length; i++) {
-                               if (tokens[i] == null) {
-                                       // TODO configure how to deal with null
-                                       writeToken("");
-                               } else {
-                                       writeToken(tokens[i].toString());
-                               }
-                               if (i != (tokens.length - 1))
-                                       out.write(separator);
-                       }
-                       out.write('\n');
-                       out.flush();
-               } catch (IOException e) {
-                       throw new ArgeoException("Could not write " + tokens, e);
-               }
-       }
-
-       protected void writeToken(String token) throws IOException {
-               // +2 for possible quotes, another +2 assuming there would be an already
-               // quoted string where quotes needs to be duplicated
-               // another +2 for safety
-               // we don't want to increase buffer size while writing
-               StringBuffer buf = new StringBuffer(token.length() + 6);
-               char[] arr = token.toCharArray();
-               boolean shouldQuote = false;
-               for (char c : arr) {
-                       if (!shouldQuote) {
-                               if (c == separator)
-                                       shouldQuote = true;
-                               if (c == '\n')
-                                       shouldQuote = true;
-                       }
-
-                       if (c == quote) {
-                               shouldQuote = true;
-                               // duplicate quote
-                               buf.append(quote);
-                       }
-
-                       // generic case
-                       buf.append(c);
-               }
-
-               if (shouldQuote == true)
-                       out.write(quote);
-               out.write(buf.toString());
-               if (shouldQuote == true)
-                       out.write(quote);
-       }
-
-       public void setSeparator(char separator) {
-               this.separator = separator;
-       }
-
-       public void setQuote(char quote) {
-               this.quote = quote;
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/Throughput.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/Throughput.java
deleted file mode 100644 (file)
index b03e4c9..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util;
-
-import java.text.NumberFormat;
-import java.text.ParseException;
-import java.util.Locale;
-
-import org.argeo.ArgeoException;
-
-public class Throughput {
-       private final static NumberFormat usNumberFormat = NumberFormat
-                       .getInstance(Locale.US);
-
-       public enum Unit {
-               s, m, h, d
-       }
-
-       private final Double value;
-       private final Unit unit;
-
-       public Throughput(Double value, Unit unit) {
-               this.value = value;
-               this.unit = unit;
-       }
-
-       public Throughput(Long periodMs, Long count, Unit unit) {
-               if (unit.equals(Unit.s))
-                       value = ((double) count * 1000d) / periodMs;
-               else if (unit.equals(Unit.m))
-                       value = ((double) count * 60d * 1000d) / periodMs;
-               else if (unit.equals(Unit.h))
-                       value = ((double) count * 60d * 60d * 1000d) / periodMs;
-               else if (unit.equals(Unit.d))
-                       value = ((double) count * 24d * 60d * 60d * 1000d) / periodMs;
-               else
-                       throw new ArgeoException("Unsupported unit " + unit);
-               this.unit = unit;
-       }
-
-       public Throughput(Double value, String unitStr) {
-               this(value, Unit.valueOf(unitStr));
-       }
-
-       public Throughput(String def) {
-               int index = def.indexOf('/');
-               if (def.length() < 3 || index <= 0 || index != def.length() - 2)
-                       throw new ArgeoException(def + " no a proper throughput definition"
-                                       + " (should be <value>/<unit>, e.g. 3.54/s or 1500/h");
-               String valueStr = def.substring(0, index);
-               String unitStr = def.substring(index + 1);
-               try {
-                       this.value = usNumberFormat.parse(valueStr).doubleValue();
-               } catch (ParseException e) {
-                       throw new ArgeoException("Cannot parse " + valueStr
-                                       + " as a number.", e);
-               }
-               this.unit = Unit.valueOf(unitStr);
-       }
-
-       public Long asMsPeriod() {
-               if (unit.equals(Unit.s))
-                       return Math.round(1000d / value);
-               else if (unit.equals(Unit.m))
-                       return Math.round((60d * 1000d) / value);
-               else if (unit.equals(Unit.h))
-                       return Math.round((60d * 60d * 1000d) / value);
-               else if (unit.equals(Unit.d))
-                       return Math.round((24d * 60d * 60d * 1000d) / value);
-               else
-                       throw new ArgeoException("Unsupported unit " + unit);
-       }
-
-       @Override
-       public String toString() {
-               return usNumberFormat.format(value) + '/' + unit;
-       }
-
-       public Double getValue() {
-               return value;
-       }
-
-       public Unit getUnit() {
-               return unit;
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/ThroughputEditor.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/ThroughputEditor.java
deleted file mode 100644 (file)
index 2747a34..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util;
-
-import java.beans.PropertyEditorSupport;
-
-public class ThroughputEditor extends PropertyEditorSupport {
-
-       @Override
-       public String getAsText() {
-               return getValue().toString();
-       }
-
-       @Override
-       public void setAsText(String text) throws IllegalArgumentException {
-               setValue(new Throughput(text));
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/crypto/AbstractKeyring.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/crypto/AbstractKeyring.java
deleted file mode 100644 (file)
index e424513..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util.crypto;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.CharArrayWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.Reader;
-import java.io.Writer;
-import java.security.AccessController;
-import java.security.MessageDigest;
-import java.util.Arrays;
-import java.util.Iterator;
-
-import javax.crypto.SecretKey;
-import javax.security.auth.Subject;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.TextOutputCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.security.auth.login.LoginContext;
-import javax.security.auth.login.LoginException;
-
-import org.argeo.ArgeoException;
-import org.argeo.StreamUtils;
-
-/** username / password based keyring. TODO internationalize */
-public abstract class AbstractKeyring implements Keyring {
-       public final static String DEFAULT_KEYRING_LOGIN_CONTEXT = "KEYRING";
-
-       private String loginContextName = DEFAULT_KEYRING_LOGIN_CONTEXT;
-       private CallbackHandler defaultCallbackHandler;
-
-       private String charset = "UTF-8";
-
-       /**
-        * Whether the keyring has already been created in the past with a master
-        * password
-        */
-       protected abstract Boolean isSetup();
-
-       /**
-        * Setup the keyring persistently, {@link #isSetup()} must return true
-        * afterwards
-        */
-       protected abstract void setup(char[] password);
-
-       /** Populates the key spec callback */
-       protected abstract void handleKeySpecCallback(PBEKeySpecCallback pbeCallback);
-
-       protected abstract void encrypt(String path, InputStream unencrypted);
-
-       protected abstract InputStream decrypt(String path);
-
-       /** Triggers lazy initialization */
-       protected SecretKey getSecretKey() {
-               Subject subject = Subject.getSubject(AccessController.getContext());
-               // we assume only one secrete key is available
-               Iterator<SecretKey> iterator = subject.getPrivateCredentials(
-                               SecretKey.class).iterator();
-               if (!iterator.hasNext()) {// not initialized
-                       CallbackHandler callbackHandler = new KeyringCallbackHandler();
-                       try {
-                               LoginContext loginContext = new LoginContext(loginContextName,
-                                               subject, callbackHandler);
-                               loginContext.login();
-                               // FIXME will login even if password is wrong
-                               iterator = subject.getPrivateCredentials(SecretKey.class)
-                                               .iterator();
-                               return iterator.next();
-                       } catch (LoginException e) {
-                               throw new ArgeoException("Keyring login failed", e);
-                       }
-
-               } else {
-                       SecretKey secretKey = iterator.next();
-                       if (iterator.hasNext())
-                               throw new ArgeoException(
-                                               "More than one secret key in private credentials");
-                       return secretKey;
-               }
-       }
-
-       public InputStream getAsStream(String path) {
-               return decrypt(path);
-       }
-
-       public void set(String path, InputStream in) {
-               encrypt(path, in);
-       }
-
-       public char[] getAsChars(String path) {
-               InputStream in = getAsStream(path);
-               CharArrayWriter writer = null;
-               Reader reader = null;
-               try {
-                       writer = new CharArrayWriter();
-                       reader = new InputStreamReader(in, charset);
-                       StreamUtils.copy(reader, writer);
-                       return writer.toCharArray();
-               } catch (IOException e) {
-                       throw new ArgeoException("Cannot decrypt to char array", e);
-               } finally {
-                       StreamUtils.closeQuietly(reader);
-                       StreamUtils.closeQuietly(in);
-                       StreamUtils.closeQuietly(writer);
-               }
-       }
-
-       public void set(String path, char[] arr) {
-               ByteArrayOutputStream out = new ByteArrayOutputStream();
-               ByteArrayInputStream in = null;
-               Writer writer = null;
-               try {
-                       writer = new OutputStreamWriter(out, charset);
-                       writer.write(arr);
-                       writer.flush();
-                       in = new ByteArrayInputStream(out.toByteArray());
-                       set(path, in);
-               } catch (IOException e) {
-                       throw new ArgeoException("Cannot encrypt to char array", e);
-               } finally {
-                       StreamUtils.closeQuietly(writer);
-                       StreamUtils.closeQuietly(out);
-                       StreamUtils.closeQuietly(in);
-               }
-       }
-
-       public void setLoginContextName(String loginContextName) {
-               this.loginContextName = loginContextName;
-       }
-
-       public void setDefaultCallbackHandler(CallbackHandler defaultCallbackHandler) {
-               this.defaultCallbackHandler = defaultCallbackHandler;
-       }
-
-       public void setCharset(String charset) {
-               this.charset = charset;
-       }
-
-       protected static byte[] hash(char[] password, byte[] salt,
-                       Integer iterationCount) {
-               ByteArrayOutputStream out = null;
-               OutputStreamWriter writer = null;
-               try {
-                       out = new ByteArrayOutputStream();
-                       writer = new OutputStreamWriter(out, "UTF-8");
-                       writer.write(password);
-                       MessageDigest pwDigest = MessageDigest.getInstance("SHA-256");
-                       pwDigest.reset();
-                       pwDigest.update(salt);
-                       byte[] btPass = pwDigest.digest(out.toByteArray());
-                       for (int i = 0; i < iterationCount; i++) {
-                               pwDigest.reset();
-                               btPass = pwDigest.digest(btPass);
-                       }
-                       return btPass;
-               } catch (Exception e) {
-                       throw new ArgeoException("Cannot hash", e);
-               } finally {
-                       StreamUtils.closeQuietly(out);
-                       StreamUtils.closeQuietly(writer);
-               }
-
-       }
-
-       class KeyringCallbackHandler implements CallbackHandler {
-               public void handle(Callback[] callbacks) throws IOException,
-                               UnsupportedCallbackException {
-                       // checks
-                       if (callbacks.length != 2)
-                               throw new IllegalArgumentException(
-                                               "Keyring required 2 and only 2 callbacks: {PasswordCallback,PBEKeySpecCallback}");
-                       if (!(callbacks[0] instanceof PasswordCallback))
-                               throw new UnsupportedCallbackException(callbacks[0]);
-                       if (!(callbacks[1] instanceof PBEKeySpecCallback))
-                               throw new UnsupportedCallbackException(callbacks[0]);
-
-                       PasswordCallback passwordCb = (PasswordCallback) callbacks[0];
-                       PBEKeySpecCallback pbeCb = (PBEKeySpecCallback) callbacks[1];
-
-                       if (isSetup()) {
-                               Callback[] dialogCbs = new Callback[] { passwordCb };
-                               defaultCallbackHandler.handle(dialogCbs);
-                       } else {// setup keyring
-                               TextOutputCallback textCb1 = new TextOutputCallback(
-                                               TextOutputCallback.INFORMATION,
-                                               "Enter a master password which will protect your private data");
-                               TextOutputCallback textCb2 = new TextOutputCallback(
-                                               TextOutputCallback.INFORMATION,
-                                               "(for example your credentials to third-party services)");
-                               TextOutputCallback textCb3 = new TextOutputCallback(
-                                               TextOutputCallback.INFORMATION,
-                                               "Don't forget this password since the data cannot be read without it");
-                               PasswordCallback confirmPasswordCb = new PasswordCallback(
-                                               "Confirm password", false);
-                               // first try
-                               Callback[] dialogCbs = new Callback[] { textCb1, textCb2,
-                                               textCb3, passwordCb, confirmPasswordCb };
-                               defaultCallbackHandler.handle(dialogCbs);
-
-                               // if passwords different, retry (except if cancelled)
-                               while (passwordCb.getPassword() != null
-                                               && !Arrays.equals(passwordCb.getPassword(),
-                                                               confirmPasswordCb.getPassword())) {
-                                       TextOutputCallback textCb = new TextOutputCallback(
-                                                       TextOutputCallback.ERROR,
-                                                       "The passwords do not match");
-                                       dialogCbs = new Callback[] { textCb, passwordCb,
-                                                       confirmPasswordCb };
-                                       defaultCallbackHandler.handle(dialogCbs);
-                               }
-
-                               if (passwordCb.getPassword() != null) {// not cancelled
-                                       setup(passwordCb.getPassword());
-                               }
-                       }
-
-                       if (passwordCb.getPassword() != null)
-                               handleKeySpecCallback(pbeCb);
-               }
-
-       }
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/crypto/Keyring.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/crypto/Keyring.java
deleted file mode 100644 (file)
index eb876df..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util.crypto;
-
-import java.io.InputStream;
-
-/**
- * Access to private (typically encrypted) data. The keyring is responsible for
- * retrieving the necessary credentials.
- */
-public interface Keyring {
-       public void changePassword(char[] oldPassword, char[] newPassword);
-
-       public char[] getAsChars(String path);
-
-       public InputStream getAsStream(String path);
-
-       public void set(String path, char[] arr);
-
-       public void set(String path, InputStream in);
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/crypto/KeyringLoginModule.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/crypto/KeyringLoginModule.java
deleted file mode 100644 (file)
index e8b6928..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util.crypto;
-
-import java.security.AccessController;
-import java.util.Map;
-import java.util.Set;
-
-import javax.crypto.SecretKey;
-import javax.crypto.SecretKeyFactory;
-import javax.crypto.spec.PBEKeySpec;
-import javax.crypto.spec.SecretKeySpec;
-import javax.security.auth.Subject;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.login.LoginException;
-import javax.security.auth.spi.LoginModule;
-
-/** Adds a secret key to the private credentials */
-public class KeyringLoginModule implements LoginModule {
-       private Subject subject;
-       private CallbackHandler callbackHandler;
-       private SecretKey secretKey;
-
-       public void initialize(Subject subject, CallbackHandler callbackHandler,
-                       Map<String, ?> sharedState, Map<String, ?> options) {
-               this.subject = subject;
-               if (subject == null) {
-                       subject = Subject.getSubject(AccessController.getContext());
-               }
-               this.callbackHandler = callbackHandler;
-       }
-
-       public boolean login() throws LoginException {
-               Set<SecretKey> pbes = subject.getPrivateCredentials(SecretKey.class);
-               if (pbes.size() > 0)
-                       return true;
-               PasswordCallback pc = new PasswordCallback("Master password", false);
-               PBEKeySpecCallback pbeCb = new PBEKeySpecCallback();
-               Callback[] callbacks = { pc, pbeCb };
-               try {
-                       callbackHandler.handle(callbacks);
-                       char[] password = pc.getPassword();
-
-                       SecretKeyFactory keyFac = SecretKeyFactory.getInstance(pbeCb
-                                       .getSecretKeyFactory());
-                       PBEKeySpec keySpec;
-                       if (pbeCb.getKeyLength() != null)
-                               keySpec = new PBEKeySpec(password, pbeCb.getSalt(),
-                                               pbeCb.getIterationCount(), pbeCb.getKeyLength());
-                       else
-                               keySpec = new PBEKeySpec(password, pbeCb.getSalt(),
-                                               pbeCb.getIterationCount());
-
-                       String secKeyEncryption = pbeCb.getSecretKeyEncryption();
-                       if (secKeyEncryption != null) {
-                               SecretKey tmp = keyFac.generateSecret(keySpec);
-                               secretKey = new SecretKeySpec(tmp.getEncoded(),
-                                               secKeyEncryption);
-                       } else {
-                               secretKey = keyFac.generateSecret(keySpec);
-                       }
-               } catch (Exception e) {
-                       LoginException le = new LoginException("Cannot login keyring");
-                       le.initCause(e);
-                       throw le;
-               }
-               return true;
-       }
-
-       public boolean commit() throws LoginException {
-               if (secretKey != null)
-                       subject.getPrivateCredentials().add(secretKey);
-               return true;
-       }
-
-       public boolean abort() throws LoginException {
-               return true;
-       }
-
-       public boolean logout() throws LoginException {
-               Set<PasswordBasedEncryption> pbes = subject
-                               .getPrivateCredentials(PasswordBasedEncryption.class);
-               pbes.clear();
-               return true;
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/crypto/PBEKeySpecCallback.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/crypto/PBEKeySpecCallback.java
deleted file mode 100644 (file)
index 676b970..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util.crypto;
-
-import javax.crypto.spec.PBEKeySpec;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.PasswordCallback;
-
-/**
- * All information required to set up a {@link PBEKeySpec} bar the password
- * itself (use a {@link PasswordCallback})
- */
-public class PBEKeySpecCallback implements Callback {
-       private String secretKeyFactory;
-       private byte[] salt;
-       private Integer iterationCount;
-       /** Can be null for some algorithms */
-       private Integer keyLength;
-       /** Can be null, will trigger secret key encryption if not */
-       private String secretKeyEncryption;
-
-       private String encryptedPasswordHashCipher;
-       private byte[] encryptedPasswordHash;
-
-       public void set(String secretKeyFactory, byte[] salt,
-                       Integer iterationCount, Integer keyLength,
-                       String secretKeyEncryption) {
-               this.secretKeyFactory = secretKeyFactory;
-               this.salt = salt;
-               this.iterationCount = iterationCount;
-               this.keyLength = keyLength;
-               this.secretKeyEncryption = secretKeyEncryption;
-//             this.encryptedPasswordHashCipher = encryptedPasswordHashCipher;
-//             this.encryptedPasswordHash = encryptedPasswordHash;
-       }
-
-       public String getSecretKeyFactory() {
-               return secretKeyFactory;
-       }
-
-       public byte[] getSalt() {
-               return salt;
-       }
-
-       public Integer getIterationCount() {
-               return iterationCount;
-       }
-
-       public Integer getKeyLength() {
-               return keyLength;
-       }
-
-       public String getSecretKeyEncryption() {
-               return secretKeyEncryption;
-       }
-
-       public String getEncryptedPasswordHashCipher() {
-               return encryptedPasswordHashCipher;
-       }
-
-       public byte[] getEncryptedPasswordHash() {
-               return encryptedPasswordHash;
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/crypto/PasswordBasedEncryption.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/crypto/PasswordBasedEncryption.java
deleted file mode 100644 (file)
index 62cc240..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util.crypto;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.security.Key;
-
-import javax.crypto.Cipher;
-import javax.crypto.CipherInputStream;
-import javax.crypto.CipherOutputStream;
-import javax.crypto.SecretKey;
-import javax.crypto.SecretKeyFactory;
-import javax.crypto.spec.IvParameterSpec;
-import javax.crypto.spec.PBEKeySpec;
-import javax.crypto.spec.SecretKeySpec;
-
-import org.argeo.ArgeoException;
-import org.argeo.StreamUtils;
-
-/** Simple password based encryption / decryption */
-public class PasswordBasedEncryption {
-       public final static Integer DEFAULT_ITERATION_COUNT = 1024;
-       public final static Integer DEFAULT_KEY_LENGTH = 256;
-       public final static String DEFAULT_SECRETE_KEY_FACTORY = "PBKDF2WithHmacSHA1";
-       public final static String DEFAULT_SECRETE_KEY_ENCRYPTION = "AES";
-       public final static String DEFAULT_CIPHER = "AES/CBC/PKCS5Padding";
-       public final static String DEFAULT_CHARSET = "UTF-8";
-
-       private static byte[] DEFAULT_SALT_8 = { (byte) 0xA9, (byte) 0x9B,
-                       (byte) 0xC8, (byte) 0x32, (byte) 0x56, (byte) 0x35, (byte) 0xE3,
-                       (byte) 0x03 };
-       private static byte[] DEFAULT_IV_16 = { (byte) 0xA9, (byte) 0x9B,
-                       (byte) 0xC8, (byte) 0x32, (byte) 0x56, (byte) 0x35, (byte) 0xE3,
-                       (byte) 0x03, (byte) 0xA9, (byte) 0x9B, (byte) 0xC8, (byte) 0x32,
-                       (byte) 0x56, (byte) 0x35, (byte) 0xE3, (byte) 0x03 };
-
-       private final Key key;
-       private final Cipher ecipher;
-       private final Cipher dcipher;
-
-       /**
-        * This is up to the caller to clear the passed array. Neither copy of nor
-        * reference to the passed array is kept
-        */
-       public PasswordBasedEncryption(char[] password) {
-               this(password, DEFAULT_SALT_8, DEFAULT_IV_16);
-       }
-
-       /**
-        * This is up to the caller to clear the passed array. Neither copies of nor
-        * references to the passed arrays are kept
-        */
-       public PasswordBasedEncryption(char[] password, byte[] passwordSalt,
-                       byte[] initializationVector) {
-               try {
-                       byte[] salt = new byte[8];
-                       System.arraycopy(passwordSalt, 0, salt, 0, salt.length);
-                       // for (int i = 0; i < password.length && i < salt.length; i++)
-                       // salt[i] = (byte) password[i];
-                       byte[] iv = new byte[16];
-                       System.arraycopy(initializationVector, 0, iv, 0, iv.length);
-                       // for (int i = 0; i < password.length && i < iv.length; i++)
-                       // iv[i] = (byte) password[i];
-
-                       SecretKeyFactory keyFac = SecretKeyFactory
-                                       .getInstance(getSecretKeyFactoryName());
-                       PBEKeySpec keySpec = new PBEKeySpec(password, salt,
-                                       getIterationCount(), getKeyLength());
-                       String secKeyEncryption = getSecretKeyEncryption();
-                       if (secKeyEncryption != null) {
-                               SecretKey tmp = keyFac.generateSecret(keySpec);
-                               key = new SecretKeySpec(tmp.getEncoded(),
-                                               getSecretKeyEncryption());
-                       } else {
-                               key = keyFac.generateSecret(keySpec);
-                       }
-                       ecipher = Cipher.getInstance(getCipherName());
-                       ecipher.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(iv));
-                       // AlgorithmParameters params = ecipher.getParameters();
-                       // byte[] iv =
-                       // params.getParameterSpec(IvParameterSpec.class).getIV();
-                       dcipher = Cipher.getInstance(getCipherName());
-                       dcipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(iv));
-               } catch (Exception e) {
-                       throw new ArgeoException("Cannot get secret key", e);
-               }
-       }
-
-       public void encrypt(InputStream decryptedIn, OutputStream encryptedOut)
-                       throws IOException {
-               try {
-                       CipherOutputStream out = new CipherOutputStream(encryptedOut,
-                                       ecipher);
-                       StreamUtils.copy(decryptedIn, out);
-                       StreamUtils.closeQuietly(out);
-               } catch (IOException e) {
-                       throw e;
-               } catch (Exception e) {
-                       throw new ArgeoException("Cannot encrypt", e);
-               } finally {
-                       StreamUtils.closeQuietly(decryptedIn);
-               }
-       }
-
-       public void decrypt(InputStream encryptedIn, OutputStream decryptedOut)
-                       throws IOException {
-               try {
-                       CipherInputStream decryptedIn = new CipherInputStream(encryptedIn,
-                                       dcipher);
-                       StreamUtils.copy(decryptedIn, decryptedOut);
-               } catch (IOException e) {
-                       throw e;
-               } catch (Exception e) {
-                       throw new ArgeoException("Cannot decrypt", e);
-               } finally {
-                       StreamUtils.closeQuietly(encryptedIn);
-               }
-       }
-
-       public byte[] encryptString(String str) {
-               ByteArrayOutputStream out = null;
-               ByteArrayInputStream in = null;
-               try {
-                       out = new ByteArrayOutputStream();
-                       in = new ByteArrayInputStream(str.getBytes(DEFAULT_CHARSET));
-                       encrypt(in, out);
-                       return out.toByteArray();
-               } catch (Exception e) {
-                       throw new ArgeoException("Cannot encrypt", e);
-               } finally {
-                       StreamUtils.closeQuietly(out);
-               }
-       }
-
-       /** Closes the input stream */
-       public String decryptAsString(InputStream in) {
-               ByteArrayOutputStream out = null;
-               try {
-                       out = new ByteArrayOutputStream();
-                       decrypt(in, out);
-                       return new String(out.toByteArray(), DEFAULT_CHARSET);
-               } catch (Exception e) {
-                       throw new ArgeoException("Cannot decrypt", e);
-               } finally {
-                       StreamUtils.closeQuietly(out);
-               }
-       }
-
-       protected Key getKey() {
-               return key;
-       }
-
-       protected Cipher getEcipher() {
-               return ecipher;
-       }
-
-       protected Cipher getDcipher() {
-               return dcipher;
-       }
-
-       protected Integer getIterationCount() {
-               return DEFAULT_ITERATION_COUNT;
-       }
-
-       protected Integer getKeyLength() {
-               return DEFAULT_KEY_LENGTH;
-       }
-
-       protected String getSecretKeyFactoryName() {
-               return DEFAULT_SECRETE_KEY_FACTORY;
-       }
-
-       protected String getSecretKeyEncryption() {
-               return DEFAULT_SECRETE_KEY_ENCRYPTION;
-       }
-
-       protected String getCipherName() {
-               return DEFAULT_CIPHER;
-       }
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/security/DigestUtils.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/security/DigestUtils.java
deleted file mode 100644 (file)
index 0d8956d..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util.security;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-import org.argeo.ArgeoException;
-import org.argeo.StreamUtils;
-
-/** Utilities around cryptographic digests */
-public class DigestUtils {
-       private static Boolean debug = true;
-       // TODO: make it writable
-       private final static Integer byteBufferCapacity = 100 * 1024;// 100 KB
-
-       public static String digest(String algorithm, InputStream in) {
-               try {
-                       MessageDigest digest = MessageDigest.getInstance(algorithm);
-                       // ReadableByteChannel channel = Channels.newChannel(in);
-                       // ByteBuffer bb = ByteBuffer.allocateDirect(byteBufferCapacity);
-                       // while (channel.read(bb) > 0)
-                       // digest.update(bb);
-                       byte[] buffer = new byte[byteBufferCapacity];
-                       int read = 0;
-                       while ((read = in.read(buffer)) > 0) {
-                               digest.update(buffer, 0, read);
-                       }
-
-                       byte[] checksum = digest.digest();
-                       String res = StreamUtils.encodeHexString(checksum);
-                       return res;
-               } catch (Exception e) {
-                       throw new ArgeoException("Cannot digest with algorithm "
-                                       + algorithm, e);
-               } finally {
-                       StreamUtils.closeQuietly(in);
-               }
-       }
-
-       public static String digest(String algorithm, File file) {
-               FileInputStream fis = null;
-               FileChannel fc = null;
-               try {
-                       fis = new FileInputStream(file);
-                       fc = fis.getChannel();
-
-                       // Get the file's size and then map it into memory
-                       int sz = (int) fc.size();
-                       ByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
-                       return digest(algorithm, bb);
-               } catch (IOException e) {
-                       throw new ArgeoException("Cannot digest " + file
-                                       + " with algorithm " + algorithm, e);
-               } finally {
-                       StreamUtils.closeQuietly(fis);
-                       if (fc.isOpen())
-                               try {
-                                       fc.close();
-                               } catch (IOException e) {
-                                       // silent
-                               }
-               }
-       }
-
-       protected static String digest(String algorithm, ByteBuffer bb) {
-               long begin = System.currentTimeMillis();
-               try {
-                       MessageDigest digest = MessageDigest.getInstance(algorithm);
-                       digest.update(bb);
-                       byte[] checksum = digest.digest();
-                       String res = StreamUtils.encodeHexString(checksum);
-                       long end = System.currentTimeMillis();
-                       if (debug)
-                               System.out.println((end - begin) + " ms / "
-                                               + ((end - begin) / 1000) + " s");
-                       return res;
-               } catch (NoSuchAlgorithmException e) {
-                       throw new ArgeoException("Cannot digest with algorithm "
-                                       + algorithm, e);
-               }
-       }
-
-       public static void main(String[] args) {
-               File file;
-               if (args.length > 0)
-                       file = new File(args[0]);
-               else {
-                       System.err.println("Usage: <file> [<algorithm>]"
-                                       + " (see http://java.sun.com/j2se/1.5.0/"
-                                       + "docs/guide/security/CryptoSpec.html#AppA)");
-                       return;
-               }
-
-               if (args.length > 1) {
-                       String algorithm = args[1];
-                       System.out.println(digest(algorithm, file));
-               } else {
-                       String algorithm = "MD5";
-                       System.out.println(algorithm + ": " + digest(algorithm, file));
-                       algorithm = "SHA";
-                       System.out.println(algorithm + ": " + digest(algorithm, file));
-                       algorithm = "SHA-256";
-                       System.out.println(algorithm + ": " + digest(algorithm, file));
-                       algorithm = "SHA-512";
-                       System.out.println(algorithm + ": " + digest(algorithm, file));
-               }
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/security/SimplePrincipal.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/security/SimplePrincipal.java
deleted file mode 100644 (file)
index 0618e98..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util.security;
-
-import java.security.Principal;
-
-import org.argeo.ArgeoException;
-
-/** Canonical implementation of a {@link Principal} */
-public class SimplePrincipal implements Principal {
-       private final String name;
-
-       public SimplePrincipal(String name) {
-               if (name == null)
-                       throw new ArgeoException("Principal name cannot be null");
-               this.name = name;
-       }
-
-       public String getName() {
-               return name;
-       }
-
-       @Override
-       public int hashCode() {
-               return name.hashCode();
-       }
-
-       @Override
-       public boolean equals(Object obj) {
-               if (obj == null)
-                       return false;
-               return name.equals(obj.toString());
-       }
-
-       @Override
-       protected Object clone() throws CloneNotSupportedException {
-               return new SimplePrincipal(name);
-       }
-
-       @Override
-       public String toString() {
-               return name;
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/ArrayTabularRow.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/ArrayTabularRow.java
deleted file mode 100644 (file)
index ad3ddc7..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util.tabular;
-
-import java.util.List;
-
-/** Minimal tabular row wrapping an {@link Object} array */
-public class ArrayTabularRow implements TabularRow {
-       private final Object[] arr;
-
-       public ArrayTabularRow(List<?> objs) {
-               this.arr = objs.toArray();
-       }
-
-       public Object get(Integer col) {
-               return arr[col];
-       }
-
-       public int size() {
-               return arr.length;
-       }
-
-       public Object[] toArray() {
-               return arr;
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/CsvTabularWriter.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/CsvTabularWriter.java
deleted file mode 100644 (file)
index e992ec4..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util.tabular;
-
-import java.io.OutputStream;
-
-import org.argeo.util.CsvWriter;
-
-/** Write tabular content in a stream as CSV. Wraps a {@link CsvWriter}. */
-public class CsvTabularWriter implements TabularWriter {
-       private CsvWriter csvWriter;
-
-       public CsvTabularWriter(OutputStream out) {
-               this.csvWriter = new CsvWriter(out);
-       }
-
-       public void appendRow(Object[] row) {
-               csvWriter.writeLine(row);
-       }
-
-       public void close() {
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/TabularColumn.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/TabularColumn.java
deleted file mode 100644 (file)
index 19f1f3b..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util.tabular;
-
-/** The column in a tabular content */
-public class TabularColumn {
-       private String name;
-       /**
-        * JCR types, see
-        * http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/index.html
-        * ?javax/jcr/PropertyType.html
-        */
-       private Integer type;
-
-       /** column with default type */
-       public TabularColumn(String name) {
-               super();
-               this.name = name;
-       }
-
-       public TabularColumn(String name, Integer type) {
-               super();
-               this.name = name;
-               this.type = type;
-       }
-
-       public String getName() {
-               return name;
-       }
-
-       public void setName(String name) {
-               this.name = name;
-       }
-
-       public Integer getType() {
-               return type;
-       }
-
-       public void setType(Integer type) {
-               this.type = type;
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/TabularContent.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/TabularContent.java
deleted file mode 100644 (file)
index b1d8cda..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util.tabular;
-
-import java.util.List;
-
-/**
- * Content organized as a table, possibly with headers. Only JCR types are
- * supported even though there is not direct dependency on JCR.
- */
-public interface TabularContent {
-       /** The headers of this table or <code>null</code> is none available. */
-       public List<TabularColumn> getColumns();
-
-       public TabularRowIterator read();
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/TabularRow.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/TabularRow.java
deleted file mode 100644 (file)
index 98451fd..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util.tabular;
-
-/** A row of tabular data */
-public interface TabularRow {
-       /** The value at this column index */
-       public Object get(Integer col);
-
-       /** The raw objects (direct references) */
-       public Object[] toArray();
-
-       /** Number of columns */
-       public int size();
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/TabularRowIterator.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/TabularRowIterator.java
deleted file mode 100644 (file)
index 137c520..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util.tabular;
-
-import java.util.Iterator;
-
-/** Navigation of rows */
-public interface TabularRowIterator extends Iterator<TabularRow> {
-       /**
-        * Current row number, has to be incremented by each call to next() ; starts at 0, will
-        * therefore be 1 for the first row returned.
-        */
-       public Long getCurrentRowNumber();
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/TabularWriter.java b/base/runtime/org.argeo.basic.nodeps/src/main/java/org/argeo/util/tabular/TabularWriter.java
deleted file mode 100644 (file)
index 5375c12..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util.tabular;
-
-
-/** Write to a tabular content */
-public interface TabularWriter {
-       /** Append a new row of data */
-       public void appendRow(Object[] row);
-
-       /** Finish persisting data and release resources */
-       public void close();
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/CsvParserEncodingTestCase.java b/base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/CsvParserEncodingTestCase.java
deleted file mode 100644 (file)
index f525108..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-public class CsvParserEncodingTestCase extends TestCase {
-
-       private String iso = "ISO-8859-1";
-       private String utf8 = "UTF-8";
-
-       public void testParse() throws Exception {
-
-               String xml = new String("áéíóúñ,éééé");
-               byte[] utfBytes = xml.getBytes(utf8);
-               byte[] isoBytes = xml.getBytes(iso);
-
-               InputStream inUtf = new ByteArrayInputStream(utfBytes);
-               InputStream inIso = new ByteArrayInputStream(isoBytes);
-
-               CsvParser csvParser = new CsvParser() {
-                       protected void processLine(Integer lineNumber, List<String> header,
-                                       List<String> tokens) {
-                               assertEquals(header.size(), tokens.size());
-                               assertEquals(2, tokens.size());
-                               assertEquals("áéíóúñ", tokens.get(0));
-                               assertEquals("éééé", tokens.get(1));
-                       }
-               };
-
-               csvParser.parse(inUtf, utf8);
-               inUtf.close();
-               csvParser.parse(inIso, iso);
-               inIso.close();
-       }
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/CsvParserParseFileTest.java b/base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/CsvParserParseFileTest.java
deleted file mode 100644 (file)
index 1b99368..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util;
-
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-public class CsvParserParseFileTest extends TestCase {
-       public void testParse() throws Exception {
-
-               final Map<Integer, Map<String, String>> lines = new HashMap<Integer, Map<String, String>>();
-               InputStream in = getClass().getResourceAsStream(
-                               "/org/argeo/util/ReferenceFile.csv");
-               CsvParserWithLinesAsMap parser = new CsvParserWithLinesAsMap() {
-                       protected void processLine(Integer lineNumber,
-                                       Map<String, String> line) {
-                               lines.put(lineNumber, line);
-                       }
-               };
-
-               parser.parse(in);
-               in.close();
-
-               assertEquals(5, lines.size());
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/CsvParserTestCase.java b/base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/CsvParserTestCase.java
deleted file mode 100644 (file)
index 5285e6f..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-public class CsvParserTestCase extends TestCase {
-       public void testParse() throws Exception {
-               String toParse = "Header1,\"Header\n2\",Header3,\"Header4\"\n"
-                               + "Col1,\"Col\n2\",Col3,\"\"\"Col4\"\"\"\n"
-                               + "Col1,\"Col\n2\",Col3,\"\"\"Col4\"\"\"\n"
-                               + "Col1,\"Col\n2\",Col3,\"\"\"Col4\"\"\"\n";
-
-               InputStream in = new ByteArrayInputStream(toParse.getBytes());
-
-               CsvParser csvParser = new CsvParser() {
-                       protected void processLine(Integer lineNumber, List<String> header,
-                                       List<String> tokens) {
-                               assertEquals(header.size(), tokens.size());
-                               assertEquals(4, tokens.size());
-                               assertEquals("Col1", tokens.get(0));
-                               assertEquals("Col\n2", tokens.get(1));
-                               assertEquals("Col3", tokens.get(2));
-                               assertEquals("\"Col4\"", tokens.get(3));
-                       }
-               };
-
-               csvParser.parse(in);
-               in.close();
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/CsvParserWithQuotedSeparatorTest.java b/base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/CsvParserWithQuotedSeparatorTest.java
deleted file mode 100644 (file)
index 9398f47..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-public class CsvParserWithQuotedSeparatorTest extends TestCase {
-       public void testSimpleParse() throws Exception {
-               String toParse = "Header1,\"Header2\",Header3,\"Header4\"\n"
-                               + "\"Col1, Col2\",\"Col\n2\",Col3,\"\"\"Col4\"\"\"\n";
-
-               InputStream in = new ByteArrayInputStream(toParse.getBytes());
-
-               CsvParser csvParser = new CsvParser() {
-                       protected void processLine(Integer lineNumber, List<String> header,
-                                       List<String> tokens) {
-                               assertEquals(header.size(), tokens.size());
-                               assertEquals(4, tokens.size());
-                               assertEquals("Col1, Col2", tokens.get(0));
-                       }
-               };
-               // System.out.println(toParse);
-               csvParser.parse(in);
-               in.close();
-
-       }
-
-       public void testParseFile() throws Exception {
-
-               final Map<Integer, Map<String, String>> lines = new HashMap<Integer, Map<String, String>>();
-               InputStream in = getClass().getResourceAsStream(
-                               "/org/argeo/util/ReferenceFile.csv");
-
-               CsvParserWithLinesAsMap parser = new CsvParserWithLinesAsMap() {
-                       protected void processLine(Integer lineNumber,
-                                       Map<String, String> line) {
-                               // System.out.println("processing line #" + lineNumber);
-                               lines.put(lineNumber, line);
-                       }
-               };
-
-               parser.parse(in);
-               in.close();
-
-               Map<String, String> line = lines.get(2);
-               assertEquals(",,,,", line.get("Coma testing"));
-               line = lines.get(3);
-               assertEquals(",, ,,", line.get("Coma testing"));
-               line = lines.get(4);
-               assertEquals("module1, module2", line.get("Coma testing"));
-               line = lines.get(5);
-               assertEquals("module1,module2", line.get("Coma testing"));
-               line = lines.get(6);
-               assertEquals(",module1,module2, \nmodule3, module4",
-                               line.get("Coma testing"));
-               assertEquals(5, lines.size());
-
-       }
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/CsvWriterTestCase.java b/base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/CsvWriterTestCase.java
deleted file mode 100644 (file)
index 55b7191..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-public class CsvWriterTestCase extends TestCase {
-       public void testWrite() throws Exception {
-               ByteArrayOutputStream out = new ByteArrayOutputStream();
-               final CsvWriter csvWriter = new CsvWriter(out);
-
-               String[] header = { "Header1", "Header 2", "Header,3", "Header\n4",
-                               "Header\"5\"" };
-               String[] line1 = { "Value1", "Value 2", "Value,3", "Value\n4",
-                               "Value\"5\"" };
-               csvWriter.writeLine(Arrays.asList(header));
-               csvWriter.writeLine(Arrays.asList(line1));
-
-               String reference = "Header1,Header 2,\"Header,3\",\"Header\n4\",\"Header\"\"5\"\"\"\n"
-                               + "Value1,Value 2,\"Value,3\",\"Value\n4\",\"Value\"\"5\"\"\"\n";
-               String written = new String(out.toByteArray());
-               assertEquals(reference, written);
-               out.close();
-               System.out.println(written);
-
-               final List<String> allTokens = new ArrayList<String>();
-               CsvParser csvParser = new CsvParser() {
-                       protected void processLine(Integer lineNumber, List<String> header,
-                                       List<String> tokens) {
-                               if (lineNumber == 2)
-                                       allTokens.addAll(header);
-                               allTokens.addAll(tokens);
-                       }
-               };
-               ByteArrayInputStream in = new ByteArrayInputStream(written.getBytes());
-               csvParser.parse(in);
-               in.close();
-               List<String> allTokensRef = new ArrayList<String>();
-               allTokensRef.addAll(Arrays.asList(header));
-               allTokensRef.addAll(Arrays.asList(line1));
-
-               assertEquals(allTokensRef.size(), allTokens.size());
-               for (int i = 0; i < allTokensRef.size(); i++)
-                       assertEquals(allTokensRef.get(i), allTokens.get(i));
-       }
-
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/ThroughputTest.java b/base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/ThroughputTest.java
deleted file mode 100644 (file)
index 76da9ad..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util;
-
-import junit.framework.TestCase;
-
-public class ThroughputTest extends TestCase {
-       public void testParse() {
-               Throughput t;
-               t = new Throughput("3.54/s");
-               assertEquals(3.54d, t.getValue());
-               assertEquals(Throughput.Unit.s, t.getUnit());
-               assertEquals(282l, (long) t.asMsPeriod());
-
-               t = new Throughput("35698.2569/h");
-               assertEquals(Throughput.Unit.h, t.getUnit());
-               assertEquals(101l, (long) t.asMsPeriod());
-       }
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/crypto/PasswordBasedEncryptionTest.java b/base/runtime/org.argeo.basic.nodeps/src/test/java/org/argeo/util/crypto/PasswordBasedEncryptionTest.java
deleted file mode 100644 (file)
index c560088..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.util.crypto;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.security.AlgorithmParameters;
-
-import javax.crypto.Cipher;
-import javax.crypto.CipherInputStream;
-import javax.crypto.CipherOutputStream;
-import javax.crypto.SecretKey;
-import javax.crypto.SecretKeyFactory;
-import javax.crypto.spec.IvParameterSpec;
-import javax.crypto.spec.PBEKeySpec;
-import javax.crypto.spec.PBEParameterSpec;
-import javax.crypto.spec.SecretKeySpec;
-
-import junit.framework.TestCase;
-
-import org.argeo.StreamUtils;
-import org.argeo.util.crypto.PasswordBasedEncryption;
-
-public class PasswordBasedEncryptionTest{// extends TestCase {
-//     public void testEncryptDecrypt() {
-//             final String password = "test long password since they are more powerful";
-//             PasswordBasedEncryption pbeEnc = new PasswordBasedEncryption(
-//                             password.toCharArray());
-//             String message = "Hello World!";
-//             byte[] encrypted = pbeEnc.encryptString(message);
-//             // System.out.println("Encrypted: '" + new String(encrypted) + "'");
-//             PasswordBasedEncryption pbeDec = new PasswordBasedEncryption(
-//                             password.toCharArray());
-//             InputStream in = null;
-//             in = new ByteArrayInputStream(encrypted);
-//             String decrypted = pbeDec.decryptAsString(in);
-//             // System.out.println("Decrypted: '" + decrypted + "'");
-//             StreamUtils.closeQuietly(in);
-//             assertEquals(message, decrypted);
-//     }
-//
-//     public void testPBEWithMD5AndDES() throws Exception {
-//             String password = "test";
-//             String message = "Hello World!";
-//
-//             byte[] salt = { (byte) 0xc7, (byte) 0x73, (byte) 0x21, (byte) 0x8c,
-//                             (byte) 0x7e, (byte) 0xc8, (byte) 0xee, (byte) 0x99 };
-//
-//             int count = 1024;
-//
-//             String cipherAlgorithm = "PBEWithMD5AndDES";
-//             String secretKeyAlgorithm = "PBEWithMD5AndDES";
-//             SecretKeyFactory keyFac = SecretKeyFactory
-//                             .getInstance(secretKeyAlgorithm);
-//             PBEKeySpec pbeKeySpec = new PBEKeySpec(password.toCharArray());
-//             PBEParameterSpec pbeParamSpec = new PBEParameterSpec(salt, count);
-//             SecretKey pbeKey = keyFac.generateSecret(pbeKeySpec);
-//             Cipher ecipher = Cipher.getInstance(cipherAlgorithm);
-//             ecipher.init(Cipher.ENCRYPT_MODE, pbeKey, pbeParamSpec);
-//             Cipher dcipher = Cipher.getInstance(cipherAlgorithm);
-//             dcipher.init(Cipher.DECRYPT_MODE, pbeKey, pbeParamSpec);
-//
-//             byte[] encrypted = ecipher.doFinal(message.getBytes());
-//             byte[] decrypted = dcipher.doFinal(encrypted);
-//             assertEquals(message, new String(decrypted));
-//
-//     }
-//
-//     public void testPBEWithSHA1AndAES() throws Exception {
-//             String password = "test";
-//             String message = "Hello World!";
-//
-//             byte[] salt = { (byte) 0xc7, (byte) 0x73, (byte) 0x21, (byte) 0x8c,
-//                             (byte) 0x7e, (byte) 0xc8, (byte) 0xee, (byte) 0x99 };
-//             byte[] iv = { (byte) 0xc7, (byte) 0x73, (byte) 0x21, (byte) 0x8c,
-//                             (byte) 0x7e, (byte) 0xc8, (byte) 0xee, (byte) 0x99,
-//                             (byte) 0xc7, (byte) 0x73, (byte) 0x21, (byte) 0x8c,
-//                             (byte) 0x7e, (byte) 0xc8, (byte) 0xee, (byte) 0x99 };
-//
-//             int count = 1024;
-//             // int keyLength = 256;
-//             int keyLength = 128;
-//
-//             String cipherAlgorithm = "AES/CBC/PKCS5Padding";
-//             String secretKeyAlgorithm = "PBKDF2WithHmacSHA1";
-//             SecretKeyFactory keyFac = SecretKeyFactory
-//                             .getInstance(secretKeyAlgorithm);
-//             PBEKeySpec pbeKeySpec = new PBEKeySpec(password.toCharArray(), salt,
-//                             count, keyLength);
-//             SecretKey tmp = keyFac.generateSecret(pbeKeySpec);
-//             SecretKey secret = new SecretKeySpec(tmp.getEncoded(), "AES");
-//             Cipher ecipher = Cipher.getInstance(cipherAlgorithm);
-//             ecipher.init(Cipher.ENCRYPT_MODE, secret, new IvParameterSpec(iv));
-//
-//             // decrypt
-//             keyFac = SecretKeyFactory.getInstance(secretKeyAlgorithm);
-//             pbeKeySpec = new PBEKeySpec(password.toCharArray(), salt, count,
-//                             keyLength);
-//             tmp = keyFac.generateSecret(pbeKeySpec);
-//             secret = new SecretKeySpec(tmp.getEncoded(), "AES");
-//             // AlgorithmParameters params = ecipher.getParameters();
-//             // byte[] iv = params.getParameterSpec(IvParameterSpec.class).getIV();
-//             Cipher dcipher = Cipher.getInstance(cipherAlgorithm);
-//             dcipher.init(Cipher.DECRYPT_MODE, secret, new IvParameterSpec(iv));
-//
-//             byte[] encrypted = ecipher.doFinal(message.getBytes());
-//             byte[] decrypted = dcipher.doFinal(encrypted);
-//             assertEquals(message, new String(decrypted));
-//
-//             ByteArrayOutputStream out = new ByteArrayOutputStream();
-//             CipherOutputStream cipherOut = new CipherOutputStream(out, ecipher);
-//             cipherOut.write(message.getBytes());
-//             StreamUtils.closeQuietly(cipherOut);
-//             byte[] enc = out.toByteArray();
-//
-//             ByteArrayInputStream in = new ByteArrayInputStream(enc);
-//             CipherInputStream cipherIn = new CipherInputStream(in, dcipher);
-//             ByteArrayOutputStream dec = new ByteArrayOutputStream();
-//             StreamUtils.copy(cipherIn, dec);
-//             assertEquals(message, new String(dec.toByteArray()));
-//     }
-}
diff --git a/base/runtime/org.argeo.basic.nodeps/src/test/resources/org/argeo/util/ReferenceFile.csv b/base/runtime/org.argeo.basic.nodeps/src/test/resources/org/argeo/util/ReferenceFile.csv
deleted file mode 100644 (file)
index 351453d..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-"ID","A long Text","Name","Other","Number","Reference","Target","Date","Update","Language","ID Ref","Weird chars","line feeds","after line feed","Empty column","Status comment","Comments","Empty","Coma testing"
-"AK251","Everything & with some line feed 
- more “some” quote","Marge S.",,78.6,"A1155222221111268515131",,12/12/12,03/12/08,,9821308500721,"%%%ùù","ao","Nothing special",,,"Some very usefull comment",,",,,,"
-"AG254","same","Roger “wallace” Big","15 – JI",78.5,"A1155222221111268515131","next milestone",12/12/12,03/12/08,"_fr (French - France)",9812309500953,"***µ”","a
-
-
-
-
-o","after line feed",,"Do the job",,,",, ,,"
-"FG211","Very long text with some bullets.
-1 first
-2 second
-3. some more very very very long. some more very very very long. some more very very very long. some more very very very long. some more very very very long. some more very very very long. some more very very very long. some more very very very long. some more very very very long. some more very very very long. some more very very very long. some more very very very long","Father & Son","15 – JI",15.4,"A1155222221111268515131","next milestone",12/12/12,03/12/08,"_fr (French - France)",9812309500952,"///","a
-
-
-
-
-
-
-o","module1,module2",,"Be fast",,,"module1, module2"
-"RRT152","Very long text with some bullets.
-1 first
-2 second
-3. some more very very very long. some more very very very long. some more very very very long. some more very very very long. some more very very very long. some more very very very long. some more very very very long. some more very very very long. some more very very very long. some more very very very long. some more very very very long. some more very very very long","Another $$","15 – JI",12.3,"A1155222221111268515131","next milestone",12/12/12,03/12/08,"_fr (French - France)",9812309500950,"---","a
-
-o
-
-
-","module1,module2",,,,,"module1,module2"
-"YU121","Another use case : “blank line”
-
-After the blank.","nothing with brackets( )","15 – JI",15.2,"A1155222221111268515131",,12/12/12,03/12/08,"_fr (French - France)",9812309500925,",;:?./","ao","
-
-
-
-After line feed again",,,,,",module1,module2, 
-module3, module4"
diff --git a/base/runtime/org.argeo.basic.nodeps/src/test/resources/org/argeo/util/TestParse-ISO.csv b/base/runtime/org.argeo.basic.nodeps/src/test/resources/org/argeo/util/TestParse-ISO.csv
deleted file mode 100644 (file)
index 0bec611..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-"Date d'imputation","N° de compte","Code journal","Pièce interne","Pièce externe","Libellé d'écriture","Débit","Crédit","Lettrage","Quantité","Code analytique","Date d'échéance","Date d'imputation origine","Code journal origine","Mode de règlement","Date début de période","Date fin de période"
-26.01.2010,"101300","BQ","BQ01.10",,"Depot société en formation",,"3.000,00",,,,"          ",26.01.2010,"BQ","    ","          ","          "
-26.01.2010,"101300","BQ","BQ01.10",,"Depot société en formation",,"7.000,00",,,,"          ",26.01.2010,"BQ","    ","          ","          "
-26.01.2010,"411OPEN","BQ","BQ01.10",,"Vir Client ",,"2.508,00","A",,,"          ",26.01.2010,"BQ","    ","          ","          "
-26.01.2010,"455100","BQ","BQ01.10",,"Bankomat Raiffeise","250,00",,,,,"          ",26.01.2010,"BQ","    ","          ","          "
-26.01.2010,"512101","BQ","BQ01.10",,"Extrait bancaire 01.10","12.250,55",,,,,"          ",26.01.2010,"BQ","    ","          ","          "
-26.01.2010,"627800","BQ","BQ01.10",,"Envoi de chequier","2,30",,,,,"          ",26.01.2010,"BQ","    ","          ","          "
-26.01.2010,"627800","BQ","BQ01.10",,"Frais d'expedition","5,15",,,,,"          ",26.01.2010,"BQ","    ","          ","          "
diff --git a/base/runtime/org.argeo.basic.nodeps/src/test/resources/org/argeo/util/TestParse-UTF-8.csv b/base/runtime/org.argeo.basic.nodeps/src/test/resources/org/argeo/util/TestParse-UTF-8.csv
deleted file mode 100644 (file)
index 0bec611..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-"Date d'imputation","N° de compte","Code journal","Pièce interne","Pièce externe","Libellé d'écriture","Débit","Crédit","Lettrage","Quantité","Code analytique","Date d'échéance","Date d'imputation origine","Code journal origine","Mode de règlement","Date début de période","Date fin de période"
-26.01.2010,"101300","BQ","BQ01.10",,"Depot société en formation",,"3.000,00",,,,"          ",26.01.2010,"BQ","    ","          ","          "
-26.01.2010,"101300","BQ","BQ01.10",,"Depot société en formation",,"7.000,00",,,,"          ",26.01.2010,"BQ","    ","          ","          "
-26.01.2010,"411OPEN","BQ","BQ01.10",,"Vir Client ",,"2.508,00","A",,,"          ",26.01.2010,"BQ","    ","          ","          "
-26.01.2010,"455100","BQ","BQ01.10",,"Bankomat Raiffeise","250,00",,,,,"          ",26.01.2010,"BQ","    ","          ","          "
-26.01.2010,"512101","BQ","BQ01.10",,"Extrait bancaire 01.10","12.250,55",,,,,"          ",26.01.2010,"BQ","    ","          ","          "
-26.01.2010,"627800","BQ","BQ01.10",,"Envoi de chequier","2,30",,,,,"          ",26.01.2010,"BQ","    ","          ","          "
-26.01.2010,"627800","BQ","BQ01.10",,"Frais d'expedition","5,15",,,,,"          ",26.01.2010,"BQ","    ","          ","          "