- private Dictionary<String, Object> getNodeConfig(Dictionary<String, ?> properties) {
- // Object repoType = properties.get(NodeConstants.NODE_REPO_PROP_PREFIX
- // + RepoConf.type.name());
- // if (repoType == null)
- // return null;
-
- Hashtable<String, Object> props = new Hashtable<String, Object>();
- for (RepoConf repoConf : RepoConf.values()) {
- Object value = properties.get(NodeConstants.NODE_REPO_PROP_PREFIX + repoConf.name());
- if (value != null)
- props.put(repoConf.name(), value);
- }
- return props;
- }
-
- private class RepositoryContextStc implements ServiceTrackerCustomizer<RepositoryContext, RepositoryContext> {
-
- @Override
- public RepositoryContext addingService(ServiceReference<RepositoryContext> reference) {
- RepositoryContext nodeRepo = bc.getService(reference);
- Object repoUri = reference.getProperty(ArgeoJcrConstants.JCR_REPOSITORY_URI);
- if (repoUri != null && repoUri.equals(nodeRepoUri.toString())) {
- nodeDeployment.setDeployedNodeRepository(nodeRepo.getRepository());
- Dictionary<String, Object> props = LangUtils.init(Constants.SERVICE_PID,
- NodeConstants.NODE_DEPLOYMENT_PID);
- props.put(NodeConstants.CN, nodeRepo.getRootNodeId().toString());
- // register
- bc.registerService(LangUtils.names(NodeDeployment.class, ManagedService.class), nodeDeployment, props);
- }
-
- return nodeRepo;
- }
-
- @Override
- public void modifiedService(ServiceReference<RepositoryContext> reference, RepositoryContext service) {
- }
-
- @Override
- public void removedService(ServiceReference<RepositoryContext> reference, RepositoryContext service) {
- }
-
- }
-
- private class PrepareHttpStc implements ServiceTrackerCustomizer<HttpService, HttpService> {
- private DataHttp dataHttp;
- private NodeHttp nodeHttp;
-
- @Override
- public HttpService addingService(ServiceReference<HttpService> reference) {
- HttpService httpService = addHttpService(reference);
- return httpService;
- }
-
- @Override
- public void modifiedService(ServiceReference<HttpService> reference, HttpService service) {
- }
-
- @Override
- public void removedService(ServiceReference<HttpService> reference, HttpService service) {
- if (dataHttp != null)
- dataHttp.destroy();
- dataHttp = null;
- if (nodeHttp != null)
- nodeHttp.destroy();
- nodeHttp = null;
- }
-
- private HttpService addHttpService(ServiceReference<HttpService> sr) {
- HttpService httpService = bc.getService(sr);
- // TODO find constants
- Object httpPort = sr.getProperty("http.port");
- Object httpsPort = sr.getProperty("https.port");
- dataHttp = new DataHttp(httpService);
- nodeHttp = new NodeHttp(httpService, bc);
- if (log.isDebugEnabled())
- log.debug(httpPortsMsg(httpPort, httpsPort));
- return httpService;
- }