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();
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);
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;
}
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);
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() {
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);
* 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<>();
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)
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();
}
}
- 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");
}
}
- 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);
res.put(key.toString(), toLoad.get(key));
return res;
}
-
+
/*
* EXCEPTIONS
*/
/** 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());
}