in core/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java [305:354]
protected void install(File tmpDir, Properties props, Descriptor root, boolean autoStart) throws DeploymentException {
LOGGER.debug("Going to install component from {}", tmpDir.getPath());
if (root.getComponent() != null) {
String componentName = root.getComponent().getIdentification().getName();
if (installers.containsKey(componentName)) {
throw new DeploymentException("Component " + componentName + " is already installed");
}
InstallerMBeanImpl installer = doInstallArchive(tmpDir, root);
if (installer != null) {
try {
if (props != null && props.size() > 0) {
ObjectName on = installer.getInstallerConfigurationMBean();
if (on == null) {
LOGGER.warn("Could not find installation configuration MBean. Installation properties will be ignored.");
} else {
MBeanServer mbs = managementContext.getMBeanServer();
for (Iterator it = props.keySet().iterator(); it.hasNext();) {
String key = (String) it.next();
String val = props.getProperty(key);
try {
mbs.setAttribute(on, new Attribute(key, val));
} catch (JMException e) {
throw new DeploymentException("Could not set installation property: (" + key + " = " + val, e);
}
}
}
}
installer.install();
} catch (JBIException e) {
throw new DeploymentException(e);
}
if (autoStart) {
try {
ComponentMBeanImpl lcc = container.getComponent(componentName);
if (lcc != null) {
lcc.start();
} else {
LOGGER.warn("No ComponentConnector found for Component {}", componentName);
}
} catch (JBIException e) {
String errStr = "Failed to start Component: " + componentName;
LOGGER.error(errStr, e);
throw new DeploymentException(e);
}
}
LOGGER.debug("Registering installer as loaded for component {}", componentName);
installers.put(componentName, installer);
}
}
}