Rename utility
authorMathieu Baudier <mbaudier@argeo.org>
Fri, 16 Sep 2016 12:10:26 +0000 (12:10 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Fri, 16 Sep 2016 12:10:26 +0000 (12:10 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@9183 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

org.argeo.cms.ui/src/org/argeo/cms/ui/internal/Activator.java
org.argeo.cms/src/org/argeo/cms/internal/kernel/Activator.java
org.argeo.cms/src/org/argeo/cms/internal/kernel/CmsDeployment.java
org.argeo.cms/src/org/argeo/cms/internal/kernel/CmsState.java
org.argeo.cms/src/org/argeo/cms/internal/kernel/RepositoryServiceFactory.java
org.argeo.util/src/org/argeo/util/LangUtils.java

index 410498725a2a78ac304abba03412543b752eb9ff..475a95122457a89097d98acfa726ede35793eec7 100644 (file)
@@ -20,8 +20,8 @@ public class Activator implements BundleActivator {
        public void start(BundleContext bc) throws Exception {
                // UI
                bc.registerService(ApplicationConfiguration.class, new MaintenanceUi(),
-                               LangUtils.init(CONTEXT_NAME_PROP, "system"));
-               bc.registerService(ApplicationConfiguration.class, new UserUi(), LangUtils.init(CONTEXT_NAME_PROP, "user"));
+                               LangUtils.dico(CONTEXT_NAME_PROP, "system"));
+               bc.registerService(ApplicationConfiguration.class, new UserUi(), LangUtils.dico(CONTEXT_NAME_PROP, "user"));
 
                nodeState = new ServiceTracker<>(bc, NodeState.class, null);
                nodeState.open();
index 99d5dbb3e73294bb14c824f75a92dc2c76ab56f7..7dd668c3829a0c71a3b991b0316de8713e660bcc 100644 (file)
@@ -77,7 +77,7 @@ public class Activator implements BundleActivator {
                        Files.write(stateUuidPath, stateUuid.getBytes());
                }
                nodeState = new CmsState(stateUuid);
-               Dictionary<String, Object> regProps = LangUtils.init(
+               Dictionary<String, Object> regProps = LangUtils.dico(
                                Constants.SERVICE_PID, NodeConstants.NODE_STATE_PID);
                regProps.put(NodeConstants.CN, stateUuid);
                bc.registerService(NodeState.class, nodeState, regProps);
index 20a899eca2a8a2fb7f6e3e82ca4bf529008f7c12..d2d89522fec99aff5a642a7b5191f00a4df98494 100644 (file)
@@ -148,7 +148,7 @@ public class CmsDeployment implements NodeDeployment {
                                CallbackHandler callbackHandler = bc.getService(reference);
                                nodeKeyring.setDefaultCallbackHandler(callbackHandler);
                                bc.registerService(LangUtils.names(CryptoKeyring.class, ManagedService.class), nodeKeyring,
-                                               LangUtils.init(Constants.SERVICE_PID, NodeConstants.NODE_KEYRING_PID));
+                                               LangUtils.dico(Constants.SERVICE_PID, NodeConstants.NODE_KEYRING_PID));
                                return callbackHandler;
                        }
 
index 9ff1540a7bf3f1d6d9eb498279f57697e15aef63..7ed19d20cfee8193cfc82a9bf8634ec58b55ffa0 100644 (file)
@@ -92,7 +92,7 @@ public class CmsState implements NodeState {
                RepositoryServiceFactory repositoryServiceFactory = new RepositoryServiceFactory();
                shutdownHooks.add(() -> repositoryServiceFactory.shutdown());
                bc.registerService(ManagedServiceFactory.class, repositoryServiceFactory,
-                               LangUtils.init(Constants.SERVICE_PID, NodeConstants.NODE_REPOS_FACTORY_PID));
+                               LangUtils.dico(Constants.SERVICE_PID, NodeConstants.NODE_REPOS_FACTORY_PID));
 
                NodeRepositoryFactory repositoryFactory = new NodeRepositoryFactory();
                bc.registerService(RepositoryFactory.class, repositoryFactory, null);
@@ -101,7 +101,7 @@ public class CmsState implements NodeState {
                NodeUserAdmin userAdmin = new NodeUserAdmin(AuthConstants.ROLES_BASEDN);
                shutdownHooks.add(() -> userAdmin.destroy());
                bc.registerService(ManagedServiceFactory.class, userAdmin,
-                               LangUtils.init(Constants.SERVICE_PID, NodeConstants.NODE_USER_ADMIN_PID));
+                               LangUtils.dico(Constants.SERVICE_PID, NodeConstants.NODE_USER_ADMIN_PID));
        }
 
        private void initTransactionManager() {
index f69c498e3f30dbe221d11ae019a1170034db725b..e6efa1e79bbe29fb08b009dfcff6924249b8e760 100644 (file)
@@ -45,7 +45,7 @@ class RepositoryServiceFactory implements ManagedServiceFactory {
                        RepositoryBuilder repositoryBuilder = new RepositoryBuilder();
                        RepositoryContext repositoryContext = repositoryBuilder.createRepositoryContext(properties);
                        repositories.put(pid, repositoryContext);
-                       Dictionary<String, Object> props = LangUtils.init(Constants.SERVICE_PID, pid);
+                       Dictionary<String, Object> props = LangUtils.dico(Constants.SERVICE_PID, pid);
                        // props.put(ArgeoJcrConstants.JCR_REPOSITORY_URI,
                        // properties.get(RepoConf.labeledUri.name()));
                        Object cn = properties.get(NodeConstants.CN);
index 8810d646335056a604791cec8a545b27931be1b9..fae6312343d0b99c267298bbecdf8567c6228fc8 100644 (file)
@@ -38,7 +38,7 @@ public class LangUtils {
         * Creates a new {@link Dictionary} with one key-value pair (neither key not
         * value should be null)
         */
-       public static Dictionary<String, Object> init(String key, Object value) {
+       public static Dictionary<String, Object> dico(String key, Object value) {
                assert key != null;
                assert value != null;
                Hashtable<String, Object> props = new Hashtable<>();
@@ -54,11 +54,11 @@ public class LangUtils {
                return new DictionaryKeys(props);
        }
 
-       public static String toJson(Dictionary<String, ?> props) {
+       static String toJson(Dictionary<String, ?> props) {
                return toJson(props, false);
        }
 
-       public static String toJson(Dictionary<String, ?> props, boolean pretty) {
+       static String toJson(Dictionary<String, ?> props, boolean pretty) {
                StringBuilder sb = new StringBuilder();
                sb.append('{');
                if (pretty)
@@ -83,7 +83,7 @@ public class LangUtils {
                return sb.toString();
        }
 
-       public static void storeAsProperties(Dictionary<String, Object> props, Path path) throws IOException {
+       static void storeAsProperties(Dictionary<String, Object> props, Path path) throws IOException {
                if (props == null)
                        throw new IllegalArgumentException("Props cannot be null");
                Properties toStore = new Properties();
@@ -96,7 +96,7 @@ public class LangUtils {
                }
        }
 
-       public static void appendAsLdif(String dnBase, String dnKey, Dictionary<String, Object> props, Path path)
+       static void appendAsLdif(String dnBase, String dnKey, Dictionary<String, Object> props, Path path)
                        throws IOException {
                if (props == null)
                        throw new IllegalArgumentException("Props cannot be null");
@@ -126,7 +126,7 @@ public class LangUtils {
                }
        }
 
-       public static Dictionary<String, Object> loadFromProperties(Path path) throws IOException {
+       static Dictionary<String, Object> loadFromProperties(Path path) throws IOException {
                Properties toLoad = new Properties();
                try (InputStream in = Files.newInputStream(path)) {
                        toLoad.load(in);
@@ -136,7 +136,7 @@ public class LangUtils {
                        res.put(key.toString(), toLoad.get(key));
                return res;
        }
-       
+
        /*
         * EXCEPTIONS
         */
@@ -152,8 +152,7 @@ public class LangUtils {
 
        /** Recursive chaining of messages */
        private static void chainCauseMessage(StringBuffer buf, Throwable t) {
-               buf.append('\n').append(' ').append(t.getClass().getCanonicalName())
-                               .append(": ").append(t.getMessage());
+               buf.append('\n').append(' ').append(t.getClass().getCanonicalName()).append(": ").append(t.getMessage());
                if (t.getCause() != null)
                        chainCauseMessage(buf, t.getCause());
        }