From 77a5498dd5d10d2442127022efd6501a7dbddbae Mon Sep 17 00:00:00 2001 From: Bruno Sinou Date: Thu, 15 Sep 2016 14:56:20 +0000 Subject: [PATCH] Remove APIs from utils git-svn-id: https://svn.argeo.org/commons/trunk@9165 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../META-INF/spring/keyring.xml | 2 +- .../META-INF/spring/osgi.xml | 4 +- .../commands/AddRemoteRepository.java | 2 +- .../internal/jcr/NodeContentProvider.java | 2 +- .../jcr/model/RemoteRepositoryElem.java | 2 +- .../internal/jcr/model/RepositoriesElem.java | 2 +- .../ui/workbench/jcr/JcrBrowserView.java | 2 +- .../internal/parts/UserBatchUpdateWizard.java | 2 +- .../maintenance/AbstractOsgiComposite.java | 1 - .../org/argeo/cms/ui/internal/Activator.java | 1 - .../src/org/argeo/cms/util/CmsLink.java | 1 - .../argeo/cms/widgets/auth/CmsLoginShell.java | 2 - .../security/PasswordBasedEncryptionTest.java | 12 +- .../org/argeo/cms/tabular/JcrTabularTest.java | 10 +- .../argeo/cms/auth}/KeyringLoginModule.java | 5 +- .../argeo/cms/internal/kernel/Activator.java | 34 +----- .../cms/internal/kernel/DeployConfig.java | 1 - .../cms/internal/kernel/KernelUtils.java | 3 - .../argeo/cms}/security/AbstractKeyring.java | 39 ++++--- .../argeo/cms}/security/ChecksumFactory.java | 10 +- .../kernel => security}/JcrKeyring.java | 5 +- .../security/PasswordBasedEncryption.java | 32 +++--- .../argeo/cms}/tabular/CsvTabularWriter.java | 3 +- .../cms/tabular/JcrTabularRowIterator.java | 8 +- .../argeo/cms/tabular/JcrTabularWriter.java | 4 +- org.argeo.eclipse.ui/bnd.bnd | 1 - .../argeo/osgi/useradmin/LdifParserTest.java | 4 +- .../osgi/useradmin/LdifUserAdminTest.java | 3 +- .../JackrabbitDataModelMigration.java | 3 +- .../src/org/argeo/jcr/JcrMonitor.java | 4 +- org.argeo.jcr/src/org/argeo/jcr/JcrUtils.java | 7 +- .../src/org/argeo/jcr}/SimplePrincipal.java | 6 +- .../argeo/jcr/security/JcrAuthorizations.java | 2 +- .../src/org/argeo/node/EnumOCD.java | 4 + .../argeo/node}/security/CryptoKeyring.java | 3 +- .../src/org/argeo/node}/security/Keyring.java | 2 +- .../node}/security/PBEKeySpecCallback.java | 2 +- .../argeo/node}/tabular/ArrayTabularRow.java | 2 +- .../argeo/node}/tabular/TabularColumn.java | 2 +- .../argeo/node}/tabular/TabularContent.java | 2 +- .../org/argeo/node}/tabular/TabularRow.java | 2 +- .../node}/tabular/TabularRowIterator.java | 2 +- .../argeo/node}/tabular/TabularWriter.java | 2 +- .../argeo/osgi/boot/OsgiBootRuntimeTest.java | 4 - .../src/org/argeo/ArgeoException.java | 41 ------- .../src/org/argeo/ArgeoMonitor.java | 104 ------------------ .../src/org/argeo/OperatingSystem.java | 35 ------ .../src/org/argeo/util/CsvParser.java | 3 - .../argeo/util/CsvParserWithLinesAsMap.java | 2 - .../src/org/argeo/util/CsvWriter.java | 2 - .../util/{security => }/DigestUtils.java | 5 +- .../util/{internal => }/StreamUtils.java | 4 +- .../src/org/argeo/util/Throughput.java | 2 - .../src/org/argeo/util/ThroughputEditor.java | 32 ------ .../util/{internal => }/UtilsException.java | 4 +- 55 files changed, 111 insertions(+), 369 deletions(-) rename {org.argeo.util/ext/test/org/argeo/util => org.argeo.cms/ext/test/org/argeo/cms}/security/PasswordBasedEncryptionTest.java (95%) rename {org.argeo.util/src/org/argeo/util/security => org.argeo.cms/src/org/argeo/cms/auth}/KeyringLoginModule.java (96%) rename {org.argeo.util/src/org/argeo/util => org.argeo.cms/src/org/argeo/cms}/security/AbstractKeyring.java (90%) rename {org.argeo.util/src/org/argeo/util => org.argeo.cms/src/org/argeo/cms}/security/ChecksumFactory.java (94%) rename org.argeo.cms/src/org/argeo/cms/{internal/kernel => security}/JcrKeyring.java (98%) rename {org.argeo.util/src/org/argeo/util => org.argeo.cms/src/org/argeo/cms}/security/PasswordBasedEncryption.java (91%) rename {org.argeo.util/src/org/argeo/util => org.argeo.cms/src/org/argeo/cms}/tabular/CsvTabularWriter.java (93%) rename {org.argeo.util/src/org/argeo/util/security => org.argeo.jcr/src/org/argeo/jcr}/SimplePrincipal.java (90%) rename {org.argeo.util/src/org/argeo/util => org.argeo.node.api/src/org/argeo/node}/security/CryptoKeyring.java (96%) rename {org.argeo.util/src/org/argeo/util => org.argeo.node.api/src/org/argeo/node}/security/Keyring.java (97%) rename {org.argeo.util/src/org/argeo/util => org.argeo.node.api/src/org/argeo/node}/security/PBEKeySpecCallback.java (98%) rename {org.argeo.util/src/org/argeo/util => org.argeo.node.api/src/org/argeo/node}/tabular/ArrayTabularRow.java (96%) rename {org.argeo.util/src/org/argeo/util => org.argeo.node.api/src/org/argeo/node}/tabular/TabularColumn.java (97%) rename {org.argeo.util/src/org/argeo/util => org.argeo.node.api/src/org/argeo/node}/tabular/TabularContent.java (96%) rename {org.argeo.util/src/org/argeo/util => org.argeo.node.api/src/org/argeo/node}/tabular/TabularRow.java (96%) rename {org.argeo.util/src/org/argeo/util => org.argeo.node.api/src/org/argeo/node}/tabular/TabularRowIterator.java (96%) rename {org.argeo.util/src/org/argeo/util => org.argeo.node.api/src/org/argeo/node}/tabular/TabularWriter.java (96%) delete mode 100644 org.argeo.util/src/org/argeo/ArgeoException.java delete mode 100644 org.argeo.util/src/org/argeo/ArgeoMonitor.java delete mode 100644 org.argeo.util/src/org/argeo/OperatingSystem.java rename org.argeo.util/src/org/argeo/util/{security => }/DigestUtils.java (97%) rename org.argeo.util/src/org/argeo/util/{internal => }/StreamUtils.java (97%) delete mode 100644 org.argeo.util/src/org/argeo/util/ThroughputEditor.java rename org.argeo.util/src/org/argeo/util/{internal => }/UtilsException.java (91%) diff --git a/org.argeo.cms.ui.workbench/META-INF/spring/keyring.xml b/org.argeo.cms.ui.workbench/META-INF/spring/keyring.xml index 74c4ad6cf..59c7c544b 100644 --- a/org.argeo.cms.ui.workbench/META-INF/spring/keyring.xml +++ b/org.argeo.cms.ui.workbench/META-INF/spring/keyring.xml @@ -18,7 +18,7 @@ - + diff --git a/org.argeo.cms.ui.workbench/META-INF/spring/osgi.xml b/org.argeo.cms.ui.workbench/META-INF/spring/osgi.xml index df3322635..dc6e2707f 100644 --- a/org.argeo.cms.ui.workbench/META-INF/spring/osgi.xml +++ b/org.argeo.cms.ui.workbench/META-INF/spring/osgi.xml @@ -15,7 +15,7 @@ unbind-method="unregister" /> - + @@ -37,5 +37,5 @@ - + \ No newline at end of file diff --git a/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/commands/AddRemoteRepository.java b/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/commands/AddRemoteRepository.java index cf6a5b0f0..06b6fe4a8 100644 --- a/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/commands/AddRemoteRepository.java +++ b/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/commands/AddRemoteRepository.java @@ -33,7 +33,7 @@ import org.argeo.node.ArgeoNames; import org.argeo.node.ArgeoTypes; import org.argeo.node.NodeConstants; import org.argeo.node.NodeUtils; -import org.argeo.util.security.Keyring; +import org.argeo.node.security.Keyring; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; diff --git a/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/internal/jcr/NodeContentProvider.java b/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/internal/jcr/NodeContentProvider.java index 243d93265..be623871e 100644 --- a/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/internal/jcr/NodeContentProvider.java +++ b/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/internal/jcr/NodeContentProvider.java @@ -32,7 +32,7 @@ import org.argeo.eclipse.ui.workbench.internal.jcr.model.SingleJcrNodeElem; import org.argeo.jcr.RepositoryRegister; import org.argeo.node.NodeConstants; import org.argeo.node.NodeUtils; -import org.argeo.util.security.Keyring; +import org.argeo.node.security.Keyring; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.Viewer; diff --git a/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/internal/jcr/model/RemoteRepositoryElem.java b/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/internal/jcr/model/RemoteRepositoryElem.java index 90acc034e..edaf2396f 100644 --- a/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/internal/jcr/model/RemoteRepositoryElem.java +++ b/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/internal/jcr/model/RemoteRepositoryElem.java @@ -28,7 +28,7 @@ import org.argeo.eclipse.ui.EclipseUiException; import org.argeo.eclipse.ui.TreeParent; import org.argeo.node.ArgeoNames; import org.argeo.node.NodeUtils; -import org.argeo.util.security.Keyring; +import org.argeo.node.security.Keyring; /** Root of a remote repository */ public class RemoteRepositoryElem extends RepositoryElem { diff --git a/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/internal/jcr/model/RepositoriesElem.java b/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/internal/jcr/model/RepositoriesElem.java index 864048a76..294757acd 100644 --- a/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/internal/jcr/model/RepositoriesElem.java +++ b/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/internal/jcr/model/RepositoriesElem.java @@ -30,7 +30,7 @@ import org.argeo.eclipse.ui.dialogs.ErrorFeedback; import org.argeo.jcr.RepositoryRegister; import org.argeo.node.ArgeoNames; import org.argeo.node.NodeUtils; -import org.argeo.util.security.Keyring; +import org.argeo.node.security.Keyring; /** * UI Tree component that implements the Argeo abstraction of a diff --git a/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/jcr/JcrBrowserView.java b/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/jcr/JcrBrowserView.java index 92deb71a1..c30082765 100644 --- a/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/jcr/JcrBrowserView.java +++ b/org.argeo.cms.ui.workbench/src/org/argeo/eclipse/ui/workbench/jcr/JcrBrowserView.java @@ -40,7 +40,7 @@ import org.argeo.eclipse.ui.workbench.internal.jcr.NodeLabelProvider; import org.argeo.eclipse.ui.workbench.internal.jcr.PropertiesContentProvider; import org.argeo.eclipse.ui.workbench.internal.jcr.model.SingleJcrNodeElem; import org.argeo.jcr.RepositoryRegister; -import org.argeo.util.security.Keyring; +import org.argeo.node.security.Keyring; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.viewers.ColumnLabelProvider; import org.eclipse.jface.viewers.ISelectionChangedListener; diff --git a/org.argeo.cms.ui.workbench/src/org/argeo/security/ui/admin/internal/parts/UserBatchUpdateWizard.java b/org.argeo.cms.ui.workbench/src/org/argeo/security/ui/admin/internal/parts/UserBatchUpdateWizard.java index b3bff5943..b532ddef5 100644 --- a/org.argeo.cms.ui.workbench/src/org/argeo/security/ui/admin/internal/parts/UserBatchUpdateWizard.java +++ b/org.argeo.cms.ui.workbench/src/org/argeo/security/ui/admin/internal/parts/UserBatchUpdateWizard.java @@ -210,7 +210,7 @@ public class UserBatchUpdateWizard extends Wizard { // @Override // protected IStatus doRun(IProgressMonitor progressMonitor) { // try { - // ArgeoMonitor monitor = new EclipseArgeoMonitor(progressMonitor); + // JcrMonitor monitor = new EclipseJcrMonitor(progressMonitor); // int total = usersToUpdate.size(); // monitor.beginTask("Performing change", total); // userAdminWrapper.beginTransactionIfNeeded(); diff --git a/org.argeo.cms.ui/src/org/argeo/cms/maintenance/AbstractOsgiComposite.java b/org.argeo.cms.ui/src/org/argeo/cms/maintenance/AbstractOsgiComposite.java index 2494d90c3..8c893f2f3 100644 --- a/org.argeo.cms.ui/src/org/argeo/cms/maintenance/AbstractOsgiComposite.java +++ b/org.argeo.cms.ui/src/org/argeo/cms/maintenance/AbstractOsgiComposite.java @@ -7,7 +7,6 @@ import org.apache.commons.logging.LogFactory; import org.argeo.cms.util.CmsUtils; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; diff --git a/org.argeo.cms.ui/src/org/argeo/cms/ui/internal/Activator.java b/org.argeo.cms.ui/src/org/argeo/cms/ui/internal/Activator.java index 052762ec0..410498725 100644 --- a/org.argeo.cms.ui/src/org/argeo/cms/ui/internal/Activator.java +++ b/org.argeo.cms.ui/src/org/argeo/cms/ui/internal/Activator.java @@ -1,7 +1,6 @@ package org.argeo.cms.ui.internal; import org.argeo.cms.maintenance.MaintenanceUi; -import org.argeo.cms.ui.CmsStyles; import org.argeo.cms.ui.internal.rwt.UserUi; import org.argeo.node.NodeState; import org.argeo.util.LangUtils; diff --git a/org.argeo.cms.ui/src/org/argeo/cms/util/CmsLink.java b/org.argeo.cms.ui/src/org/argeo/cms/util/CmsLink.java index 3778515dc..865824c1a 100644 --- a/org.argeo.cms.ui/src/org/argeo/cms/util/CmsLink.java +++ b/org.argeo.cms.ui/src/org/argeo/cms/util/CmsLink.java @@ -22,7 +22,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; /** A link to an internal or external location. */ public class CmsLink implements CmsUiProvider { diff --git a/org.argeo.cms.ui/src/org/argeo/cms/widgets/auth/CmsLoginShell.java b/org.argeo.cms.ui/src/org/argeo/cms/widgets/auth/CmsLoginShell.java index 6afaa767c..c31ad9657 100644 --- a/org.argeo.cms.ui/src/org/argeo/cms/widgets/auth/CmsLoginShell.java +++ b/org.argeo.cms.ui/src/org/argeo/cms/widgets/auth/CmsLoginShell.java @@ -1,13 +1,11 @@ package org.argeo.cms.widgets.auth; import org.argeo.cms.ui.CmsView; -import org.argeo.eclipse.ui.dialogs.ErrorFeedback; import org.eclipse.rap.rwt.RWT; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Widget; /** The site-related user menu */ public class CmsLoginShell extends CmsLogin { diff --git a/org.argeo.util/ext/test/org/argeo/util/security/PasswordBasedEncryptionTest.java b/org.argeo.cms/ext/test/org/argeo/cms/security/PasswordBasedEncryptionTest.java similarity index 95% rename from org.argeo.util/ext/test/org/argeo/util/security/PasswordBasedEncryptionTest.java rename to org.argeo.cms/ext/test/org/argeo/cms/security/PasswordBasedEncryptionTest.java index 0895c6bbe..49319f15a 100644 --- a/org.argeo.util/ext/test/org/argeo/util/security/PasswordBasedEncryptionTest.java +++ b/org.argeo.cms/ext/test/org/argeo/cms/security/PasswordBasedEncryptionTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.security; +package org.argeo.cms.security; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -32,10 +32,10 @@ import javax.xml.bind.DatatypeConverter; import junit.framework.TestCase; +import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.argeo.util.internal.StreamUtils; -import org.argeo.util.security.PasswordBasedEncryption; +import org.argeo.cms.security.PasswordBasedEncryption; public class PasswordBasedEncryptionTest extends TestCase { private final static Log log = LogFactory @@ -57,7 +57,7 @@ public class PasswordBasedEncryptionTest extends TestCase { in = new ByteArrayInputStream(encrypted); String decrypted = pbeDec.decryptAsString(in); log.info("Decrypted:\t'" + decrypted + "'"); - StreamUtils.closeQuietly(in); + IOUtils.closeQuietly(in); assertEquals(message, decrypted); } @@ -132,13 +132,13 @@ public class PasswordBasedEncryptionTest extends TestCase { ByteArrayOutputStream out = new ByteArrayOutputStream(); CipherOutputStream cipherOut = new CipherOutputStream(out, ecipher); cipherOut.write(message.getBytes()); - StreamUtils.closeQuietly(cipherOut); + IOUtils.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); + IOUtils.copy(cipherIn, dec); assertEquals(message, new String(dec.toByteArray())); } } diff --git a/org.argeo.cms/ext/test/org/argeo/cms/tabular/JcrTabularTest.java b/org.argeo.cms/ext/test/org/argeo/cms/tabular/JcrTabularTest.java index 0d8a8ce5f..b52ffe3c1 100644 --- a/org.argeo.cms/ext/test/org/argeo/cms/tabular/JcrTabularTest.java +++ b/org.argeo.cms/ext/test/org/argeo/cms/tabular/JcrTabularTest.java @@ -25,15 +25,13 @@ import javax.jcr.PropertyType; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.jackrabbit.commons.cnd.CndImporter; -import org.argeo.cms.tabular.JcrTabularRowIterator; -import org.argeo.cms.tabular.JcrTabularWriter; import org.argeo.jackrabbit.unit.AbstractJackrabbitTestCase; import org.argeo.node.ArgeoNames; import org.argeo.node.ArgeoTypes; -import org.argeo.util.tabular.TabularColumn; -import org.argeo.util.tabular.TabularRow; -import org.argeo.util.tabular.TabularRowIterator; -import org.argeo.util.tabular.TabularWriter; +import org.argeo.node.tabular.TabularColumn; +import org.argeo.node.tabular.TabularRow; +import org.argeo.node.tabular.TabularRowIterator; +import org.argeo.node.tabular.TabularWriter; public class JcrTabularTest extends AbstractJackrabbitTestCase { private final static Log log = LogFactory.getLog(JcrTabularTest.class); diff --git a/org.argeo.util/src/org/argeo/util/security/KeyringLoginModule.java b/org.argeo.cms/src/org/argeo/cms/auth/KeyringLoginModule.java similarity index 96% rename from org.argeo.util/src/org/argeo/util/security/KeyringLoginModule.java rename to org.argeo.cms/src/org/argeo/cms/auth/KeyringLoginModule.java index 11a834c25..2c4958254 100644 --- a/org.argeo.util/src/org/argeo/util/security/KeyringLoginModule.java +++ b/org.argeo.cms/src/org/argeo/cms/auth/KeyringLoginModule.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.security; +package org.argeo.cms.auth; import java.security.AccessController; import java.util.Map; @@ -30,6 +30,9 @@ import javax.security.auth.callback.PasswordCallback; import javax.security.auth.login.LoginException; import javax.security.auth.spi.LoginModule; +import org.argeo.cms.security.PasswordBasedEncryption; +import org.argeo.node.security.PBEKeySpecCallback; + /** Adds a secret key to the private credentials */ public class KeyringLoginModule implements LoginModule { private Subject subject; diff --git a/org.argeo.cms/src/org/argeo/cms/internal/kernel/Activator.java b/org.argeo.cms/src/org/argeo/cms/internal/kernel/Activator.java index ecd36476f..99d5dbb3e 100644 --- a/org.argeo.cms/src/org/argeo/cms/internal/kernel/Activator.java +++ b/org.argeo.cms/src/org/argeo/cms/internal/kernel/Activator.java @@ -8,8 +8,6 @@ import java.util.Dictionary; import java.util.List; import java.util.Locale; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.argeo.cms.CmsException; import org.argeo.node.ArgeoLogger; import org.argeo.node.NodeConstants; @@ -21,7 +19,6 @@ import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; import org.osgi.framework.ServiceReference; -import org.osgi.service.condpermadmin.ConditionalPermissionAdmin; import org.osgi.service.log.LogReaderService; /** @@ -29,12 +26,9 @@ import org.osgi.service.log.LogReaderService; * access to kernel information for the rest of the bundle (and only it) */ public class Activator implements BundleActivator { - private final Log log = LogFactory.getLog(Activator.class); - private static Activator instance; private BundleContext bc; - private ConditionalPermissionAdmin permissionAdmin; private LogReaderService logReaderService; // private ConfigurationAdmin configurationAdmin; @@ -47,7 +41,6 @@ public class Activator implements BundleActivator { public void start(BundleContext bundleContext) throws Exception { instance = this; this.bc = bundleContext; - this.permissionAdmin = getService(ConditionalPermissionAdmin.class); this.logReaderService = getService(LogReaderService.class); // this.configurationAdmin = getService(ConfigurationAdmin.class); @@ -62,8 +55,10 @@ public class Activator implements BundleActivator { } private void initSecurity() { - URL url = getClass().getClassLoader().getResource(KernelConstants.JAAS_CONFIG); - System.setProperty("java.security.auth.login.config", url.toExternalForm()); + URL url = getClass().getClassLoader().getResource( + KernelConstants.JAAS_CONFIG); + System.setProperty("java.security.auth.login.config", + url.toExternalForm()); } private void initArgeoLogger() { @@ -82,24 +77,8 @@ public class Activator implements BundleActivator { Files.write(stateUuidPath, stateUuid.getBytes()); } nodeState = new CmsState(stateUuid); - // Object cn; - // Configuration nodeConf = - // configurationAdmin.getConfiguration(NodeConstants.NODE_STATE_PID); - // Dictionary props = nodeConf.getProperties(); - // if (props == null) { - // if (log.isDebugEnabled()) - // log.debug("Clean node state"); - // Dictionary envProps = new Hashtable<>(); - // // Use the UUID of the first framework run as state UUID - // cn = bc.getProperty(Constants.FRAMEWORK_UUID); - // envProps.put(NodeConstants.CN, cn); - // nodeConf.update(envProps); - // } else { - // cn = props.get(NodeConstants.CN); - // if (cn == null) - // throw new CmsException("No state UUID available"); - // } - Dictionary regProps = LangUtils.init(Constants.SERVICE_PID, NodeConstants.NODE_STATE_PID); + Dictionary regProps = LangUtils.init( + Constants.SERVICE_PID, NodeConstants.NODE_STATE_PID); regProps.put(NodeConstants.CN, stateUuid); bc.registerService(NodeState.class, nodeState, regProps); @@ -120,7 +99,6 @@ public class Activator implements BundleActivator { instance = null; this.bc = null; - this.permissionAdmin = null; this.logReaderService = null; // this.configurationAdmin = null; } diff --git a/org.argeo.cms/src/org/argeo/cms/internal/kernel/DeployConfig.java b/org.argeo.cms/src/org/argeo/cms/internal/kernel/DeployConfig.java index 042d1f634..9908e9772 100644 --- a/org.argeo.cms/src/org/argeo/cms/internal/kernel/DeployConfig.java +++ b/org.argeo.cms/src/org/argeo/cms/internal/kernel/DeployConfig.java @@ -20,7 +20,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.argeo.cms.CmsException; import org.argeo.node.NodeConstants; -import org.argeo.osgi.useradmin.UserAdminConf; import org.argeo.util.naming.AttributesDictionary; import org.argeo.util.naming.LdifParser; import org.argeo.util.naming.LdifWriter; diff --git a/org.argeo.cms/src/org/argeo/cms/internal/kernel/KernelUtils.java b/org.argeo.cms/src/org/argeo/cms/internal/kernel/KernelUtils.java index 37c25d007..9c480647d 100644 --- a/org.argeo.cms/src/org/argeo/cms/internal/kernel/KernelUtils.java +++ b/org.argeo.cms/src/org/argeo/cms/internal/kernel/KernelUtils.java @@ -1,8 +1,5 @@ package org.argeo.cms.internal.kernel; -import static org.argeo.cms.internal.kernel.KernelConstants.WEBDAV_PRIVATE; -import static org.argeo.cms.internal.kernel.KernelConstants.WEBDAV_PUBLIC; - import java.io.File; import java.io.IOException; import java.net.MalformedURLException; diff --git a/org.argeo.util/src/org/argeo/util/security/AbstractKeyring.java b/org.argeo.cms/src/org/argeo/cms/security/AbstractKeyring.java similarity index 90% rename from org.argeo.util/src/org/argeo/util/security/AbstractKeyring.java rename to org.argeo.cms/src/org/argeo/cms/security/AbstractKeyring.java index 68ae1a20e..091de9e63 100644 --- a/org.argeo.util/src/org/argeo/util/security/AbstractKeyring.java +++ b/org.argeo.cms/src/org/argeo/cms/security/AbstractKeyring.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.security; +package org.argeo.cms.security; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -41,8 +41,11 @@ import javax.security.auth.callback.UnsupportedCallbackException; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; -import org.argeo.util.internal.UtilsException; -import org.argeo.util.internal.StreamUtils; +import org.apache.commons.io.IOUtils; +import org.argeo.cms.CmsException; +import org.argeo.node.security.CryptoKeyring; +import org.argeo.node.security.Keyring; +import org.argeo.node.security.PBEKeySpecCallback; /** username / password based keyring. TODO internationalize */ public abstract class AbstractKeyring implements Keyring, CryptoKeyring { @@ -95,13 +98,13 @@ public abstract class AbstractKeyring implements Keyring, CryptoKeyring { .iterator(); return iterator.next(); } catch (LoginException e) { - throw new UtilsException("Keyring login failed", e); + throw new CmsException("Keyring login failed", e); } } else { SecretKey secretKey = iterator.next(); if (iterator.hasNext()) - throw new UtilsException( + throw new CmsException( "More than one secret key in private credentials"); return secretKey; } @@ -122,14 +125,14 @@ public abstract class AbstractKeyring implements Keyring, CryptoKeyring { try { writer = new CharArrayWriter(); reader = new InputStreamReader(in, charset); - StreamUtils.copy(reader, writer); + IOUtils.copy(reader, writer); return writer.toCharArray(); } catch (IOException e) { - throw new UtilsException("Cannot decrypt to char array", e); + throw new CmsException("Cannot decrypt to char array", e); } finally { - StreamUtils.closeQuietly(reader); - StreamUtils.closeQuietly(in); - StreamUtils.closeQuietly(writer); + IOUtils.closeQuietly(reader); + IOUtils.closeQuietly(in); + IOUtils.closeQuietly(writer); } } @@ -144,11 +147,11 @@ public abstract class AbstractKeyring implements Keyring, CryptoKeyring { in = new ByteArrayInputStream(out.toByteArray()); set(path, in); } catch (IOException e) { - throw new UtilsException("Cannot encrypt to char array", e); + throw new CmsException("Cannot encrypt to char array", e); } finally { - StreamUtils.closeQuietly(writer); - StreamUtils.closeQuietly(out); - StreamUtils.closeQuietly(in); + IOUtils.closeQuietly(writer); + IOUtils.closeQuietly(out); + IOUtils.closeQuietly(in); } } @@ -191,10 +194,10 @@ public abstract class AbstractKeyring implements Keyring, CryptoKeyring { } return btPass; } catch (Exception e) { - throw new UtilsException("Cannot hash", e); + throw new CmsException("Cannot hash", e); } finally { - StreamUtils.closeQuietly(out); - StreamUtils.closeQuietly(writer); + IOUtils.closeQuietly(out); + IOUtils.closeQuietly(writer); } } @@ -211,7 +214,7 @@ public abstract class AbstractKeyring implements Keyring, CryptoKeyring { char[] password = passwordCb.getPassword(); return password; } catch (Exception e) { - throw new UtilsException("Cannot ask for a password", e); + throw new CmsException("Cannot ask for a password", e); } } diff --git a/org.argeo.util/src/org/argeo/util/security/ChecksumFactory.java b/org.argeo.cms/src/org/argeo/cms/security/ChecksumFactory.java similarity index 94% rename from org.argeo.util/src/org/argeo/util/security/ChecksumFactory.java rename to org.argeo.cms/src/org/argeo/cms/security/ChecksumFactory.java index b57db2c98..c5b4e9ecc 100644 --- a/org.argeo.util/src/org/argeo/util/security/ChecksumFactory.java +++ b/org.argeo.cms/src/org/argeo/cms/security/ChecksumFactory.java @@ -1,4 +1,4 @@ -package org.argeo.util.security; +package org.argeo.cms.security; import static javax.xml.bind.DatatypeConverter.printBase64Binary; @@ -15,7 +15,7 @@ import java.nio.file.attribute.BasicFileAttributes; import java.security.MessageDigest; import java.util.zip.Checksum; -import org.argeo.util.internal.UtilsException; +import org.argeo.cms.CmsException; /** Allows to fine tune how files are read. */ public class ChecksumFactory { @@ -71,7 +71,7 @@ public class ChecksumFactory { // subMd.update(mb); // byte[] subDigest = subMd.digest(); // System.out.println(" -> " + cursor); - // System.out.println(StreamUtils.encodeHexString(subDigest)); + // System.out.println(IOUtils.encodeHexString(subDigest)); // System.out.println(new BigInteger(1, // subDigest).toString(16)); // System.out.println(new BigInteger(1, subDigest) @@ -91,7 +91,7 @@ public class ChecksumFactory { } } } catch (Exception e) { - throw new UtilsException("Cannot digest " + path, e); + throw new CmsException("Cannot digest " + path, e); } } @@ -124,7 +124,7 @@ public class ChecksumFactory { } return crc.getValue(); } catch (Exception e) { - throw new UtilsException("Cannot checksum " + path, e); + throw new CmsException("Cannot checksum " + path, e); } finally { long duration = System.currentTimeMillis() - begin; System.out.println(duration / 1000 + "s"); diff --git a/org.argeo.cms/src/org/argeo/cms/internal/kernel/JcrKeyring.java b/org.argeo.cms/src/org/argeo/cms/security/JcrKeyring.java similarity index 98% rename from org.argeo.cms/src/org/argeo/cms/internal/kernel/JcrKeyring.java rename to org.argeo.cms/src/org/argeo/cms/security/JcrKeyring.java index 396093ff7..1ccb81731 100644 --- a/org.argeo.cms/src/org/argeo/cms/internal/kernel/JcrKeyring.java +++ b/org.argeo.cms/src/org/argeo/cms/security/JcrKeyring.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.cms.internal.kernel; +package org.argeo.cms.security; import java.io.ByteArrayInputStream; import java.io.CharArrayReader; @@ -38,8 +38,7 @@ import org.argeo.jcr.JcrUtils; import org.argeo.node.ArgeoNames; import org.argeo.node.ArgeoTypes; import org.argeo.node.NodeUtils; -import org.argeo.util.security.AbstractKeyring; -import org.argeo.util.security.PBEKeySpecCallback; +import org.argeo.node.security.PBEKeySpecCallback; /** JCR based implementation of a keyring */ public class JcrKeyring extends AbstractKeyring implements ArgeoNames { diff --git a/org.argeo.util/src/org/argeo/util/security/PasswordBasedEncryption.java b/org.argeo.cms/src/org/argeo/cms/security/PasswordBasedEncryption.java similarity index 91% rename from org.argeo.util/src/org/argeo/util/security/PasswordBasedEncryption.java rename to org.argeo.cms/src/org/argeo/cms/security/PasswordBasedEncryption.java index fcc5f8319..a74cb592e 100644 --- a/org.argeo.util/src/org/argeo/util/security/PasswordBasedEncryption.java +++ b/org.argeo.cms/src/org/argeo/cms/security/PasswordBasedEncryption.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.security; +package org.argeo.cms.security; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -33,8 +33,8 @@ import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.PBEKeySpec; import javax.crypto.spec.SecretKeySpec; -import org.argeo.util.internal.UtilsException; -import org.argeo.util.internal.StreamUtils; +import org.apache.commons.io.IOUtils; +import org.argeo.cms.CmsException; /** Simple password based encryption / decryption */ public class PasswordBasedEncryption { @@ -92,11 +92,11 @@ public class PasswordBasedEncryption { try { initKeyAndCiphers(password, passwordSalt, initializationVector); } catch (Exception e1) { - throw new UtilsException( + throw new CmsException( "Cannot get secret key (with restricted length)", e1); } } catch (Exception e) { - throw new UtilsException("Cannot get secret key", e); + throw new CmsException("Cannot get secret key", e); } } @@ -134,14 +134,14 @@ public class PasswordBasedEncryption { try { CipherOutputStream out = new CipherOutputStream(encryptedOut, ecipher); - StreamUtils.copy(decryptedIn, out); - StreamUtils.closeQuietly(out); + IOUtils.copy(decryptedIn, out); + IOUtils.closeQuietly(out); } catch (IOException e) { throw e; } catch (Exception e) { - throw new UtilsException("Cannot encrypt", e); + throw new CmsException("Cannot encrypt", e); } finally { - StreamUtils.closeQuietly(decryptedIn); + IOUtils.closeQuietly(decryptedIn); } } @@ -150,13 +150,13 @@ public class PasswordBasedEncryption { try { CipherInputStream decryptedIn = new CipherInputStream(encryptedIn, dcipher); - StreamUtils.copy(decryptedIn, decryptedOut); + IOUtils.copy(decryptedIn, decryptedOut); } catch (IOException e) { throw e; } catch (Exception e) { - throw new UtilsException("Cannot decrypt", e); + throw new CmsException("Cannot decrypt", e); } finally { - StreamUtils.closeQuietly(encryptedIn); + IOUtils.closeQuietly(encryptedIn); } } @@ -169,9 +169,9 @@ public class PasswordBasedEncryption { encrypt(in, out); return out.toByteArray(); } catch (Exception e) { - throw new UtilsException("Cannot encrypt", e); + throw new CmsException("Cannot encrypt", e); } finally { - StreamUtils.closeQuietly(out); + IOUtils.closeQuietly(out); } } @@ -183,9 +183,9 @@ public class PasswordBasedEncryption { decrypt(in, out); return new String(out.toByteArray(), DEFAULT_CHARSET); } catch (Exception e) { - throw new UtilsException("Cannot decrypt", e); + throw new CmsException("Cannot decrypt", e); } finally { - StreamUtils.closeQuietly(out); + IOUtils.closeQuietly(out); } } diff --git a/org.argeo.util/src/org/argeo/util/tabular/CsvTabularWriter.java b/org.argeo.cms/src/org/argeo/cms/tabular/CsvTabularWriter.java similarity index 93% rename from org.argeo.util/src/org/argeo/util/tabular/CsvTabularWriter.java rename to org.argeo.cms/src/org/argeo/cms/tabular/CsvTabularWriter.java index 8f5c52dca..d22f44e73 100644 --- a/org.argeo.util/src/org/argeo/util/tabular/CsvTabularWriter.java +++ b/org.argeo.cms/src/org/argeo/cms/tabular/CsvTabularWriter.java @@ -13,10 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.tabular; +package org.argeo.cms.tabular; import java.io.OutputStream; +import org.argeo.node.tabular.TabularWriter; import org.argeo.util.CsvWriter; /** Write tabular content in a stream as CSV. Wraps a {@link CsvWriter}. */ diff --git a/org.argeo.cms/src/org/argeo/cms/tabular/JcrTabularRowIterator.java b/org.argeo.cms/src/org/argeo/cms/tabular/JcrTabularRowIterator.java index 931a2b565..5d380cfa5 100644 --- a/org.argeo.cms/src/org/argeo/cms/tabular/JcrTabularRowIterator.java +++ b/org.argeo.cms/src/org/argeo/cms/tabular/JcrTabularRowIterator.java @@ -30,11 +30,11 @@ import javax.jcr.RepositoryException; import org.apache.commons.io.IOUtils; import org.argeo.jcr.ArgeoJcrException; import org.argeo.node.ArgeoTypes; +import org.argeo.node.tabular.ArrayTabularRow; +import org.argeo.node.tabular.TabularColumn; +import org.argeo.node.tabular.TabularRow; +import org.argeo.node.tabular.TabularRowIterator; import org.argeo.util.CsvParser; -import org.argeo.util.tabular.ArrayTabularRow; -import org.argeo.util.tabular.TabularColumn; -import org.argeo.util.tabular.TabularRow; -import org.argeo.util.tabular.TabularRowIterator; /** Iterates over the rows of a {@link ArgeoTypes#ARGEO_TABLE} node. */ public class JcrTabularRowIterator implements TabularRowIterator { diff --git a/org.argeo.cms/src/org/argeo/cms/tabular/JcrTabularWriter.java b/org.argeo.cms/src/org/argeo/cms/tabular/JcrTabularWriter.java index 7249fd509..ac57d2ab7 100644 --- a/org.argeo.cms/src/org/argeo/cms/tabular/JcrTabularWriter.java +++ b/org.argeo.cms/src/org/argeo/cms/tabular/JcrTabularWriter.java @@ -30,9 +30,9 @@ import org.apache.commons.io.IOUtils; import org.argeo.jcr.ArgeoJcrException; import org.argeo.jcr.JcrUtils; import org.argeo.node.ArgeoTypes; +import org.argeo.node.tabular.TabularColumn; +import org.argeo.node.tabular.TabularWriter; import org.argeo.util.CsvWriter; -import org.argeo.util.tabular.TabularColumn; -import org.argeo.util.tabular.TabularWriter; /** Write / reference tabular content in a JCR repository. */ public class JcrTabularWriter implements TabularWriter { diff --git a/org.argeo.eclipse.ui/bnd.bnd b/org.argeo.eclipse.ui/bnd.bnd index 65e408ddf..b836fc0e9 100644 --- a/org.argeo.eclipse.ui/bnd.bnd +++ b/org.argeo.eclipse.ui/bnd.bnd @@ -2,5 +2,4 @@ Import-Package: javax.jcr.nodetype,\ org.eclipse.swt,\ org.eclipse.jface.window,\ org.eclipse.core.commands.common,\ - org.argeo,\ * diff --git a/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifParserTest.java b/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifParserTest.java index fecf5dd5a..e7c94609f 100644 --- a/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifParserTest.java +++ b/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifParserTest.java @@ -10,10 +10,10 @@ import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import javax.naming.ldap.LdapName; -import org.argeo.util.naming.LdifParser; - import junit.framework.TestCase; +import org.argeo.util.naming.LdifParser; + public class LdifParserTest extends TestCase implements BasicTestConstants { public void testBasicLdif() throws Exception { LdifParser ldifParser = new LdifParser(); diff --git a/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifUserAdminTest.java b/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifUserAdminTest.java index a8a7d226a..06f1e6d2e 100644 --- a/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifUserAdminTest.java +++ b/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifUserAdminTest.java @@ -16,6 +16,8 @@ import java.util.UUID; import javax.transaction.TransactionManager; +import junit.framework.TestCase; + import org.osgi.service.useradmin.Authorization; import org.osgi.service.useradmin.Group; import org.osgi.service.useradmin.Role; @@ -24,7 +26,6 @@ import org.osgi.service.useradmin.User; import bitronix.tm.BitronixTransactionManager; import bitronix.tm.TransactionManagerServices; import bitronix.tm.resource.ehcache.EhCacheXAResourceProducer; -import junit.framework.TestCase; public class LdifUserAdminTest extends TestCase implements BasicTestConstants { private BitronixTransactionManager tm; diff --git a/org.argeo.jcr/src/org/argeo/jackrabbit/JackrabbitDataModelMigration.java b/org.argeo.jcr/src/org/argeo/jackrabbit/JackrabbitDataModelMigration.java index e53ed5577..8fedcf521 100644 --- a/org.argeo.jcr/src/org/argeo/jackrabbit/JackrabbitDataModelMigration.java +++ b/org.argeo.jcr/src/org/argeo/jackrabbit/JackrabbitDataModelMigration.java @@ -18,7 +18,6 @@ package org.argeo.jackrabbit; import java.io.InputStreamReader; import java.io.Reader; -import javax.jcr.Node; import javax.jcr.Session; import org.apache.commons.io.IOUtils; @@ -60,7 +59,7 @@ public class JackrabbitDataModelMigration implements + " does not exist: nothing to migrate."); return false; } - Node dataModelNode = session.getNode(dataModelNodePath); +// Node dataModelNode = session.getNode(dataModelNodePath); // if (dataModelNode.hasProperty(ArgeoNames.ARGEO_DATA_MODEL_VERSION)) { // String currentVersion = dataModelNode.getProperty( // ArgeoNames.ARGEO_DATA_MODEL_VERSION).getString(); diff --git a/org.argeo.jcr/src/org/argeo/jcr/JcrMonitor.java b/org.argeo.jcr/src/org/argeo/jcr/JcrMonitor.java index f04be9aa5..71cf961e0 100644 --- a/org.argeo.jcr/src/org/argeo/jcr/JcrMonitor.java +++ b/org.argeo.jcr/src/org/argeo/jcr/JcrMonitor.java @@ -1,13 +1,11 @@ package org.argeo.jcr; -import org.argeo.ArgeoMonitor; /** * Simple monitor abstraction. Inspired by Eclipse IProgressMOnitor, but without * dependency to it. */ -@SuppressWarnings("deprecation") -public interface JcrMonitor extends ArgeoMonitor { +public interface JcrMonitor { /** * Constant indicating an unknown amount of work. */ diff --git a/org.argeo.jcr/src/org/argeo/jcr/JcrUtils.java b/org.argeo.jcr/src/org/argeo/jcr/JcrUtils.java index 313554041..8ccdfc73d 100644 --- a/org.argeo.jcr/src/org/argeo/jcr/JcrUtils.java +++ b/org.argeo.jcr/src/org/argeo/jcr/JcrUtils.java @@ -63,9 +63,7 @@ import javax.jcr.security.Privilege; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.argeo.ArgeoMonitor; -import org.argeo.util.security.DigestUtils; -import org.argeo.util.security.SimplePrincipal; +import org.argeo.util.DigestUtils; /** Utility methods to simplify common JCR operations. */ public class JcrUtils { @@ -1417,9 +1415,8 @@ public class JcrUtils { * files * @return how many files were copied */ - @SuppressWarnings("deprecation") public static Long copyFiles(Node fromNode, Node toNode, Boolean recursive, - ArgeoMonitor monitor) { + JcrMonitor monitor) { long count = 0l; Binary binary = null; diff --git a/org.argeo.util/src/org/argeo/util/security/SimplePrincipal.java b/org.argeo.jcr/src/org/argeo/jcr/SimplePrincipal.java similarity index 90% rename from org.argeo.util/src/org/argeo/util/security/SimplePrincipal.java rename to org.argeo.jcr/src/org/argeo/jcr/SimplePrincipal.java index 29b8626e1..804ce0725 100644 --- a/org.argeo.util/src/org/argeo/util/security/SimplePrincipal.java +++ b/org.argeo.jcr/src/org/argeo/jcr/SimplePrincipal.java @@ -13,19 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.security; +package org.argeo.jcr; import java.security.Principal; -import org.argeo.util.internal.UtilsException; - /** Canonical implementation of a {@link Principal} */ public class SimplePrincipal implements Principal { private final String name; public SimplePrincipal(String name) { if (name == null) - throw new UtilsException("Principal name cannot be null"); + throw new IllegalArgumentException("Principal name cannot be null"); this.name = name; } diff --git a/org.argeo.jcr/src/org/argeo/jcr/security/JcrAuthorizations.java b/org.argeo.jcr/src/org/argeo/jcr/security/JcrAuthorizations.java index 9ad249252..3e8e3a2ff 100644 --- a/org.argeo.jcr/src/org/argeo/jcr/security/JcrAuthorizations.java +++ b/org.argeo.jcr/src/org/argeo/jcr/security/JcrAuthorizations.java @@ -29,7 +29,7 @@ import javax.jcr.security.Privilege; import org.argeo.jcr.ArgeoJcrException; import org.argeo.jcr.JcrUtils; -import org.argeo.util.security.SimplePrincipal; +import org.argeo.jcr.SimplePrincipal; /** Apply authorizations to a JCR repository. */ public class JcrAuthorizations implements Runnable { diff --git a/org.argeo.node.api/src/org/argeo/node/EnumOCD.java b/org.argeo.node.api/src/org/argeo/node/EnumOCD.java index daa2f540d..c5a191ee9 100644 --- a/org.argeo.node.api/src/org/argeo/node/EnumOCD.java +++ b/org.argeo.node.api/src/org/argeo/node/EnumOCD.java @@ -23,6 +23,10 @@ class EnumOCD> implements ObjectClassDefinition { return null; } + public String getLocale() { + return locale; + } + @Override public String getID() { return enumClass.getName(); diff --git a/org.argeo.util/src/org/argeo/util/security/CryptoKeyring.java b/org.argeo.node.api/src/org/argeo/node/security/CryptoKeyring.java similarity index 96% rename from org.argeo.util/src/org/argeo/util/security/CryptoKeyring.java rename to org.argeo.node.api/src/org/argeo/node/security/CryptoKeyring.java index 53ce862f0..72f9ff7a7 100644 --- a/org.argeo.util/src/org/argeo/util/security/CryptoKeyring.java +++ b/org.argeo.node.api/src/org/argeo/node/security/CryptoKeyring.java @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.security; +package org.argeo.node.security; + /** diff --git a/org.argeo.util/src/org/argeo/util/security/Keyring.java b/org.argeo.node.api/src/org/argeo/node/security/Keyring.java similarity index 97% rename from org.argeo.util/src/org/argeo/util/security/Keyring.java rename to org.argeo.node.api/src/org/argeo/node/security/Keyring.java index 10dbabd49..467d9a8aa 100644 --- a/org.argeo.util/src/org/argeo/util/security/Keyring.java +++ b/org.argeo.node.api/src/org/argeo/node/security/Keyring.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.security; +package org.argeo.node.security; import java.io.InputStream; diff --git a/org.argeo.util/src/org/argeo/util/security/PBEKeySpecCallback.java b/org.argeo.node.api/src/org/argeo/node/security/PBEKeySpecCallback.java similarity index 98% rename from org.argeo.util/src/org/argeo/util/security/PBEKeySpecCallback.java rename to org.argeo.node.api/src/org/argeo/node/security/PBEKeySpecCallback.java index 7b3a673bb..f03ba9ddf 100644 --- a/org.argeo.util/src/org/argeo/util/security/PBEKeySpecCallback.java +++ b/org.argeo.node.api/src/org/argeo/node/security/PBEKeySpecCallback.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.security; +package org.argeo.node.security; import javax.crypto.spec.PBEKeySpec; import javax.security.auth.callback.Callback; diff --git a/org.argeo.util/src/org/argeo/util/tabular/ArrayTabularRow.java b/org.argeo.node.api/src/org/argeo/node/tabular/ArrayTabularRow.java similarity index 96% rename from org.argeo.util/src/org/argeo/util/tabular/ArrayTabularRow.java rename to org.argeo.node.api/src/org/argeo/node/tabular/ArrayTabularRow.java index b1672e94c..97bf025dc 100644 --- a/org.argeo.util/src/org/argeo/util/tabular/ArrayTabularRow.java +++ b/org.argeo.node.api/src/org/argeo/node/tabular/ArrayTabularRow.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.tabular; +package org.argeo.node.tabular; import java.util.List; diff --git a/org.argeo.util/src/org/argeo/util/tabular/TabularColumn.java b/org.argeo.node.api/src/org/argeo/node/tabular/TabularColumn.java similarity index 97% rename from org.argeo.util/src/org/argeo/util/tabular/TabularColumn.java rename to org.argeo.node.api/src/org/argeo/node/tabular/TabularColumn.java index a5ee32f27..5cd11d198 100644 --- a/org.argeo.util/src/org/argeo/util/tabular/TabularColumn.java +++ b/org.argeo.node.api/src/org/argeo/node/tabular/TabularColumn.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.tabular; +package org.argeo.node.tabular; /** The column in a tabular content */ public class TabularColumn { diff --git a/org.argeo.util/src/org/argeo/util/tabular/TabularContent.java b/org.argeo.node.api/src/org/argeo/node/tabular/TabularContent.java similarity index 96% rename from org.argeo.util/src/org/argeo/util/tabular/TabularContent.java rename to org.argeo.node.api/src/org/argeo/node/tabular/TabularContent.java index a2da86668..a5aa9f678 100644 --- a/org.argeo.util/src/org/argeo/util/tabular/TabularContent.java +++ b/org.argeo.node.api/src/org/argeo/node/tabular/TabularContent.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.tabular; +package org.argeo.node.tabular; import java.util.List; diff --git a/org.argeo.util/src/org/argeo/util/tabular/TabularRow.java b/org.argeo.node.api/src/org/argeo/node/tabular/TabularRow.java similarity index 96% rename from org.argeo.util/src/org/argeo/util/tabular/TabularRow.java rename to org.argeo.node.api/src/org/argeo/node/tabular/TabularRow.java index 05b8a40a9..f652df947 100644 --- a/org.argeo.util/src/org/argeo/util/tabular/TabularRow.java +++ b/org.argeo.node.api/src/org/argeo/node/tabular/TabularRow.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.tabular; +package org.argeo.node.tabular; /** A row of tabular data */ public interface TabularRow { diff --git a/org.argeo.util/src/org/argeo/util/tabular/TabularRowIterator.java b/org.argeo.node.api/src/org/argeo/node/tabular/TabularRowIterator.java similarity index 96% rename from org.argeo.util/src/org/argeo/util/tabular/TabularRowIterator.java rename to org.argeo.node.api/src/org/argeo/node/tabular/TabularRowIterator.java index 043463dd7..98a04a65c 100644 --- a/org.argeo.util/src/org/argeo/util/tabular/TabularRowIterator.java +++ b/org.argeo.node.api/src/org/argeo/node/tabular/TabularRowIterator.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.tabular; +package org.argeo.node.tabular; import java.util.Iterator; diff --git a/org.argeo.util/src/org/argeo/util/tabular/TabularWriter.java b/org.argeo.node.api/src/org/argeo/node/tabular/TabularWriter.java similarity index 96% rename from org.argeo.util/src/org/argeo/util/tabular/TabularWriter.java rename to org.argeo.node.api/src/org/argeo/node/tabular/TabularWriter.java index 20d6519fa..b7febee65 100644 --- a/org.argeo.util/src/org/argeo/util/tabular/TabularWriter.java +++ b/org.argeo.node.api/src/org/argeo/node/tabular/TabularWriter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.tabular; +package org.argeo.node.tabular; /** Write to a tabular content */ diff --git a/org.argeo.osgi.boot/ext/test/org/argeo/osgi/boot/OsgiBootRuntimeTest.java b/org.argeo.osgi.boot/ext/test/org/argeo/osgi/boot/OsgiBootRuntimeTest.java index a165c4ee5..b396c451a 100644 --- a/org.argeo.osgi.boot/ext/test/org/argeo/osgi/boot/OsgiBootRuntimeTest.java +++ b/org.argeo.osgi.boot/ext/test/org/argeo/osgi/boot/OsgiBootRuntimeTest.java @@ -15,10 +15,8 @@ */ package org.argeo.osgi.boot; -import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import java.util.ServiceLoader; import java.util.TreeMap; import junit.framework.TestCase; @@ -26,8 +24,6 @@ import junit.framework.TestCase; import org.eclipse.core.runtime.adaptor.EclipseStarter; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; -import org.osgi.framework.launch.Framework; -import org.osgi.framework.launch.FrameworkFactory; /** Starts an Equinox runtime and provision it with OSGi boot. */ public class OsgiBootRuntimeTest extends TestCase { diff --git a/org.argeo.util/src/org/argeo/ArgeoException.java b/org.argeo.util/src/org/argeo/ArgeoException.java deleted file mode 100644 index 4fa296afa..000000000 --- a/org.argeo.util/src/org/argeo/ArgeoException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo; - -import javax.naming.OperationNotSupportedException; - -/** - * Argeo Commons specific exception. - * - * @deprecated Use project specific exceptions or standard ones like - * {@link OperationNotSupportedException}, - * {@link IllegalArgumentException}, etc. - */ -@Deprecated -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); - } - -} diff --git a/org.argeo.util/src/org/argeo/ArgeoMonitor.java b/org.argeo.util/src/org/argeo/ArgeoMonitor.java deleted file mode 100644 index 307581ea7..000000000 --- a/org.argeo.util/src/org/argeo/ArgeoMonitor.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo; - -/** - * Simple monitor abstraction. Inspired by Eclipse IProgressMOnitor, but without - * dependency to it. - * - * @deprecated use org.argeo.jcr.JcrMonitor instead - */ -@Deprecated -public interface ArgeoMonitor { - /** - * Constant indicating an unknown amount of work. - */ - public final static int UNKNOWN = -1; - - /** - * Notifies that the main task is beginning. This must only be called once - * on a given progress monitor instance. - * - * @param name - * the name (or description) of the main task - * @param totalWork - * the total number of work units into which the main task is - * been subdivided. If the value is UNKNOWN the - * implementation is free to indicate progress in a way which - * doesn't require the total number of work units in advance. - */ - public void beginTask(String name, int totalWork); - - /** - * Notifies that the work is done; that is, either the main task is - * completed or the user canceled it. This method may be called more than - * once (implementations should be prepared to handle this case). - */ - public void done(); - - /** - * Returns whether cancelation of current operation has been requested. - * Long-running operations should poll to see if cancelation has been - * requested. - * - * @return true if cancellation has been requested, and - * false otherwise - * @see #setCanceled(boolean) - */ - public boolean isCanceled(); - - /** - * Sets the cancel state to the given value. - * - * @param value - * true indicates that cancelation has been - * requested (but not necessarily acknowledged); - * false clears this flag - * @see #isCanceled() - */ - public void setCanceled(boolean value); - - /** - * Sets the task name to the given value. This method is used to restore the - * task label after a nested operation was executed. Normally there is no - * need for clients to call this method. - * - * @param name - * the name (or description) of the main task - * @see #beginTask(java.lang.String, int) - */ - public void setTaskName(String name); - - /** - * Notifies that a subtask of the main task is beginning. Subtasks are - * optional; the main task might not have subtasks. - * - * @param name - * the name (or description) of the subtask - */ - public void subTask(String name); - - /** - * Notifies that a given number of work unit of the main task has been - * completed. Note that this amount represents an installment, as opposed to - * a cumulative amount of work done to date. - * - * @param work - * a non-negative number of work units just completed - */ - public void worked(int work); - -} diff --git a/org.argeo.util/src/org/argeo/OperatingSystem.java b/org.argeo.util/src/org/argeo/OperatingSystem.java deleted file mode 100644 index 697c86c51..000000000 --- a/org.argeo.util/src/org/argeo/OperatingSystem.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo; - -/** 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/org.argeo.util/src/org/argeo/util/CsvParser.java b/org.argeo.util/src/org/argeo/util/CsvParser.java index 569f08c73..d133afdbc 100644 --- a/org.argeo.util/src/org/argeo/util/CsvParser.java +++ b/org.argeo.util/src/org/argeo/util/CsvParser.java @@ -23,9 +23,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.argeo.util.internal.StreamUtils; -import org.argeo.util.internal.UtilsException; - /** * Parses a CSV file interpreting the first line as a header. The * {@link #parse(InputStream)} method and the setters are synchronized so that diff --git a/org.argeo.util/src/org/argeo/util/CsvParserWithLinesAsMap.java b/org.argeo.util/src/org/argeo/util/CsvParserWithLinesAsMap.java index fe1750a23..c84d994c2 100644 --- a/org.argeo.util/src/org/argeo/util/CsvParserWithLinesAsMap.java +++ b/org.argeo.util/src/org/argeo/util/CsvParserWithLinesAsMap.java @@ -19,8 +19,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.argeo.util.internal.UtilsException; - /** * CSV parser allowing to process lines as maps whose keys are the header * fields. diff --git a/org.argeo.util/src/org/argeo/util/CsvWriter.java b/org.argeo.util/src/org/argeo/util/CsvWriter.java index 1ebe1022d..4b9fea3fa 100644 --- a/org.argeo.util/src/org/argeo/util/CsvWriter.java +++ b/org.argeo.util/src/org/argeo/util/CsvWriter.java @@ -23,8 +23,6 @@ import java.io.Writer; import java.util.Iterator; import java.util.List; -import org.argeo.util.internal.UtilsException; - /** Write in CSV format. */ public class CsvWriter { private final Writer out; diff --git a/org.argeo.util/src/org/argeo/util/security/DigestUtils.java b/org.argeo.util/src/org/argeo/util/DigestUtils.java similarity index 97% rename from org.argeo.util/src/org/argeo/util/security/DigestUtils.java rename to org.argeo.util/src/org/argeo/util/DigestUtils.java index 6d46c288f..52cbc5d21 100644 --- a/org.argeo.util/src/org/argeo/util/security/DigestUtils.java +++ b/org.argeo.util/src/org/argeo/util/DigestUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.security; +package org.argeo.util; import java.io.File; import java.io.FileInputStream; @@ -24,9 +24,6 @@ import java.nio.channels.FileChannel; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import org.argeo.util.internal.UtilsException; -import org.argeo.util.internal.StreamUtils; - /** Utilities around cryptographic digests */ public class DigestUtils { private static Boolean debug = true; diff --git a/org.argeo.util/src/org/argeo/util/internal/StreamUtils.java b/org.argeo.util/src/org/argeo/util/StreamUtils.java similarity index 97% rename from org.argeo.util/src/org/argeo/util/internal/StreamUtils.java rename to org.argeo.util/src/org/argeo/util/StreamUtils.java index cf6fc0c0e..1cfa5b220 100644 --- a/org.argeo.util/src/org/argeo/util/internal/StreamUtils.java +++ b/org.argeo.util/src/org/argeo/util/StreamUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.internal; +package org.argeo.util; import java.io.IOException; import java.io.InputStream; @@ -22,7 +22,7 @@ import java.io.Reader; import java.io.Writer; /** Utilities to be used when APache COmmons IO is not available. */ -public class StreamUtils { +class StreamUtils { private static final int DEFAULT_BUFFER_SIZE = 1024 * 4; /* diff --git a/org.argeo.util/src/org/argeo/util/Throughput.java b/org.argeo.util/src/org/argeo/util/Throughput.java index fb928002e..e5bc96101 100644 --- a/org.argeo.util/src/org/argeo/util/Throughput.java +++ b/org.argeo.util/src/org/argeo/util/Throughput.java @@ -19,8 +19,6 @@ import java.text.NumberFormat; import java.text.ParseException; import java.util.Locale; -import org.argeo.util.internal.UtilsException; - public class Throughput { private final static NumberFormat usNumberFormat = NumberFormat .getInstance(Locale.US); diff --git a/org.argeo.util/src/org/argeo/util/ThroughputEditor.java b/org.argeo.util/src/org/argeo/util/ThroughputEditor.java deleted file mode 100644 index 4ebf26b81..000000000 --- a/org.argeo.util/src/org/argeo/util/ThroughputEditor.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.argeo.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/org.argeo.util/src/org/argeo/util/internal/UtilsException.java b/org.argeo.util/src/org/argeo/util/UtilsException.java similarity index 91% rename from org.argeo.util/src/org/argeo/util/internal/UtilsException.java rename to org.argeo.util/src/org/argeo/util/UtilsException.java index d93851cdb..b93233a76 100644 --- a/org.argeo.util/src/org/argeo/util/internal/UtilsException.java +++ b/org.argeo.util/src/org/argeo/util/UtilsException.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.argeo.util.internal; +package org.argeo.util; /** Utils specific exception. */ -public class UtilsException extends RuntimeException { +class UtilsException extends RuntimeException { private static final long serialVersionUID = 1L; /** Creates an exception with a message. */ -- 2.30.2