@Override public void install(File artifact) throws Exception { LOGGER.debug("ConnectorDeployer.install(\"{}\")", artifact.getAbsolutePath()); ConnectorFile configFile = oldConfigs.get(artifact); Map<String, Object> properties = new Hashtable<String, Object>(configFile.getProperties()); if (properties.get(Constants.SERVICE_RANKING) == null && ConnectorFile.isRootService(artifact)) { properties.put(Constants.SERVICE_RANKING, -1); } LOGGER.info("Loading instance {}", configFile.getConnectorId()); login(); try { serviceManager.create(configFile.getConnectorId(), new ConnectorDescription(new HashMap<String, String>(configFile.getAttributes()), properties)); } finally { logout(); } }
private ConnectorDescription applyChanges(ConnectorDescription persistenceContent, ChangeSet changes) throws MergeException { MapDifference<String, String> changedAttributes = changes.getChangedAttributes(); Map<String, String> attributes = persistenceContent.getAttributes(); Map<String, String> newAttributes = ConfigUtils.updateMap(attributes, changedAttributes); Map<String, Object> newProperties = ConfigUtils.updateMap(persistenceContent.getProperties(), changes.getChangedProperties()); return new ConnectorDescription(newAttributes, new Hashtable<String, Object>(newProperties)); }