+ private void initUi() {
+ bc.registerService(ApplicationConfiguration.class, new MaintenanceUi(),
+ LangUtils.init(PROPERTY_CONTEXT_NAME, "system"));
+ bc.registerService(ApplicationConfiguration.class, new UserUi(), LangUtils.init(PROPERTY_CONTEXT_NAME, "user"));
+ }
+
+ private void initDeployConfigs(Dictionary<String, ?> stateProps) throws IOException {
+ Path deployPath = KernelUtils.getOsgiInstancePath(KernelConstants.DIR_NODE + '/' + KernelConstants.DIR_DEPLOY);
+ Files.createDirectories(deployPath);
+
+ Path nodeConfigPath = deployPath.resolve(NodeConstants.NODE_REPO_PID + ".properties");
+ if (!Files.exists(nodeConfigPath)) {
+ Dictionary<String, Object> nodeConfig = getNodeConfig(stateProps);
+ nodeConfig.put(ArgeoJcrConstants.JCR_REPOSITORY_ALIAS, ArgeoJcrConstants.ALIAS_NODE);
+ nodeConfig.put(RepoConf.labeledUri.name(), nodeRepoUri.toString());
+ LangUtils.storeAsProperties(nodeConfig, nodeConfigPath);
+ }
+
+ if (cleanState) {
+ try (DirectoryStream<Path> ds = Files.newDirectoryStream(deployPath)) {
+ for (Path path : ds) {
+ if (Files.isDirectory(path)) {// managed factories
+ try (DirectoryStream<Path> factoryDs = Files.newDirectoryStream(path)) {
+ for (Path confPath : factoryDs) {
+ Configuration conf = configurationAdmin
+ .createFactoryConfiguration(path.getFileName().toString());
+ Dictionary<String, Object> props = LangUtils.loadFromProperties(confPath);
+ conf.update(props);
+ }
+ }
+ } else {// managed services
+ String pid = path.getFileName().toString();
+ pid = pid.substring(0, pid.length() - ".properties".length());
+ Configuration conf = configurationAdmin.getConfiguration(pid);
+ Dictionary<String, Object> props = LangUtils.loadFromProperties(path);
+ conf.update(props);
+ }
+ }
+ }
+ }
+ }
+