| Commit in servicemix/base/src/main/java/org/servicemix/jbi/framework on MAIN | |||
| FrameworkInstallationService.java | +10 | -1 | 1.1 -> 1.2 |
| DeploymentService.java | +16 | -8 | 1.7 -> 1.8 |
| ClassLoaderService.java | +9 | -3 | 1.4 -> 1.5 |
| InstallationService.java | +18 | -5 | 1.15 -> 1.16 |
| ComponentContextImpl.java | +4 | -4 | 1.2 -> 1.3 |
| +57 | -21 | ||
tidied installation
servicemix/base/src/main/java/org/servicemix/jbi/framework
diff -u -r1.1 -r1.2 --- FrameworkInstallationService.java 12 Jul 2005 23:26:03 -0000 1.1 +++ FrameworkInstallationService.java 1 Aug 2005 00:04:41 -0000 1.2 @@ -24,7 +24,7 @@
/** * Installation Service - installs/uninstalls archives *
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public interface FrameworkInstallationService extends InstallationServiceMBean {
/**
@@ -34,4 +34,13 @@
* @throws DeploymentException
*/
public void install(String location) throws DeploymentException;
+ + /** + * Install an archive + * + * @param location + * @param autostart + * @throws DeploymentException + */ + public void install(String location,boolean autostart) throws DeploymentException;
}
servicemix/base/src/main/java/org/servicemix/jbi/framework
diff -u -r1.7 -r1.8 --- DeploymentService.java 29 Jul 2005 00:04:21 -0000 1.7 +++ DeploymentService.java 1 Aug 2005 00:04:41 -0000 1.8 @@ -54,7 +54,7 @@
/** * The deployment service MBean allows administrative tools to manage service assembly deployments. *
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
public class DeploymentService extends BaseLifeCycle implements DeploymentServiceMBean {
private static final Log log = LogFactory.getLog(DeploymentService.class);
@@ -114,7 +114,7 @@
* @throws Exception
*/
protected String deploy(File tmpDir, ServiceAssembly sa) throws Exception {
- String result = null;
+ String result = "";
String assemblyName = sa.getIdentification().getName();
File saDirectory = environmentContext.createSALibDirectory(assemblyName);
log.info(assemblyName + " Moving " + tmpDir.getAbsolutePath() + " to " + saDirectory.getAbsolutePath());
@@ -123,7 +123,10 @@
ServiceUnit[] sus = sa.getServiceUnits();
if (sus != null) {
for (int i = 0;i < sus.length;i++) {
- deployServiceUnit(saDirectory, sus[i]);
+ if (i > 0) {
+ result += " ; ";
+ }
+ result += deployServiceUnit(saDirectory, sus[i]);
}
}
buildConnections(sa);
@@ -211,13 +214,14 @@
}
return result;
}
-
+
/**
* See if an Sa is already deployed
+ *
* @param saName
* @return true if already deployed
*/
- protected boolean isSaDeployed(String saName){
+ protected boolean isSaDeployed(String saName) {
return serviceAssembilies.containsKey(saName);
}
@@ -425,7 +429,8 @@
return result;
}
- protected void deployServiceUnit(File location, ServiceUnit su) throws DeploymentException {
+ protected String deployServiceUnit(File location, ServiceUnit su) throws DeploymentException {
+ String result = null;
String name = su.getIdentification().getName();
Target target = su.getTarget();
String componentName = target.getComponentName();
@@ -443,8 +448,9 @@
if (component != null) {
ServiceUnitManager sum = component.getServiceUnitManager();
if (sum != null) {
- sum.deploy(name, targetDir.getAbsolutePath());
+ result = sum.deploy(name, targetDir.getAbsolutePath());
sum.init(name, targetDir.getAbsolutePath());
+ // register active endpoints
}
else {
FileUtil.deleteFile(targetDir);
@@ -466,6 +472,7 @@
throw new DeploymentException(e);
}
log.info("Deployed ServiceUnit " + name + " to Component: " + componentName);
+ return result;
}
protected void undeployServiceUnit(ServiceUnit su) throws DeploymentException {
@@ -547,7 +554,7 @@
ServiceAssembly sa = root.getServiceAssembly();
if (sa != null) {
initSA(sa);
- sa.setState(DeploymentServiceMBean.STOPPED);
+ sa.setState(DeploymentServiceMBean.STARTED);
serviceAssembilies.put(sa.getIdentification().getName(), sa);
}
buildConnections(sa);
@@ -576,6 +583,7 @@
if (sum != null) {
sum.deploy(name, targetDir.getAbsolutePath());
sum.init(name, targetDir.getAbsolutePath());
+ sum.start(name);
}
else {
FileUtil.deleteFile(targetDir);
servicemix/base/src/main/java/org/servicemix/jbi/framework
diff -u -r1.4 -r1.5 --- ClassLoaderService.java 18 Jul 2005 09:51:59 -0000 1.4 +++ ClassLoaderService.java 1 Aug 2005 00:04:41 -0000 1.5 @@ -22,6 +22,7 @@
import java.net.MalformedURLException; import java.net.URL; import java.util.Map;
+import javax.jbi.management.DeploymentException;
import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.servicemix.jbi.deployment.ClassPath;
@@ -32,7 +33,7 @@
/** * Build custom class loader *
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class ClassLoaderService {
private static final Log log = LogFactory.getLog(ClassLoaderService.class);
@@ -47,9 +48,10 @@
* @return ClassLoader
* @throws MalformedURLException
* @throws MalformedURLException
+ * @throws DeploymentException
*/
public InstallationClassLoader buildClassLoader(File dir, String[] classPathNames, boolean parentFirst)
- throws MalformedURLException {
+ throws MalformedURLException, DeploymentException {
return buildClassLoader(dir, classPathNames, parentFirst, null);
}
@@ -63,9 +65,10 @@
* @return ClassLoader
* @throws MalformedURLException
* @throws MalformedURLException
+ * @throws DeploymentException
*/
public InstallationClassLoader buildClassLoader(File dir, String[] classPathNames, boolean parentFirst, SharedLibraryList[] list)
- throws MalformedURLException {
+ throws MalformedURLException, DeploymentException {
InstallationClassLoader result = null;
ClassLoader parent = getClass().getClassLoader().getParent();
parent = parent != null ? parent.getParent() : ClassLoader.getSystemClassLoader();
@@ -73,6 +76,9 @@
URL[] urls = new URL[classPathNames.length];
for (int i = 0;i < classPathNames.length;i++) {
File file = new File(dir, classPathNames[i]);
+ if (!file.exists()){
+ throw new DeploymentException("Unable to add File " + file + " to class path as it doesn't exist: " + file.getAbsolutePath());
+ }
urls[i] = file.toURL();
}
if (parentFirst) {
servicemix/base/src/main/java/org/servicemix/jbi/framework
diff -u -r1.15 -r1.16 --- InstallationService.java 29 Jul 2005 00:04:21 -0000 1.15 +++ InstallationService.java 1 Aug 2005 00:04:41 -0000 1.16 @@ -60,7 +60,7 @@
/** * Installation Service - installs/uninstalls archives *
- * @version $Revision: 1.15 $
+ * @version $Revision: 1.16 $
*/
public class InstallationService extends BaseLifeCycle implements FrameworkInstallationService {
private static final Log log = LogFactory.getLog(InstallationService.class);
@@ -385,7 +385,7 @@
* @param autoStart
*/
protected void autoDeploySA(File tmpDir, ServiceAssembly sa, boolean autoStart) {
- if (deploymentService.isSaDeployed(sa.getIdentification().getName())) {
+ if (!deploymentService.isSaDeployed(sa.getIdentification().getName())) {
String componentName = deploymentService.getComponentName(sa);
// is the component deployed yet ?
if (installers.containsKey(componentName)) {
@@ -404,6 +404,8 @@
pendingSAs.put(componentName, tmpDir);
}
}
+ else {
+ }
}
/**
@@ -417,7 +419,7 @@
try {
Descriptor root = buildDescriptor(tmpDir);
ServiceAssembly sa = root.getServiceAssembly();
- if (deploymentService.isSaDeployed(sa.getIdentification().getName())) {
+ if (!deploymentService.isSaDeployed(sa.getIdentification().getName())) {
autoDeploySA(tmpDir, sa, true);
}
}
@@ -579,6 +581,11 @@
ph.setDescription(0, "sharedLibURI", "URI for the jar to be installed");
ph = helper.addOperation(getObjectToManage(), "uninstallSharedLibrary", 1, "Uninstall a shared library jar");
ph.setDescription(0, "sharedLibName", "name of the shared library");
+ ph = helper.addOperation(getObjectToManage(), "install", 1, "install and deplot an archive"); + ph.setDescription(0, "location", "location of archive"); + ph = helper.addOperation(getObjectToManage(), "install", 2, "install and deplot an archive"); + ph.setDescription(0, "location", "location of archive"); + ph.setDescription(1, "autostart", "automatically start the Component");
return OperationInfoHelper.join(super.getOperationInfos(), helper.getOperationInfos());
}
@@ -597,11 +604,17 @@
try {
result = descriptor.getIdentification().getName();
File installationDir = environmentContext.createSharedLibraryDirectory(result);
- tmpDirectory.renameTo(installationDir);
+ if (installationDir.exists()){
+ FileUtil.deleteFile(installationDir);
+
+ }
+ if (!tmpDirectory.renameTo(installationDir)){
+ throw new DeploymentException("Unable to rename " + tmpDirectory + " to " + installationDir);
+ }
log.info("moved " + tmpDirectory + " to " + installationDir);
classLoaderService.addSharedLibrary(installationDir, descriptor);
}
- catch (Throwable e) {
+ catch (IOException e) {
log.error("Deployment of Shared Library failed", e);
// remove any files created for installation
environmentContext.removeComponentRootDirectory(descriptor.getIdentification().getName());
servicemix/base/src/main/java/org/servicemix/jbi/framework
diff -u -r1.2 -r1.3 --- ComponentContextImpl.java 28 Jul 2005 07:02:42 -0000 1.2 +++ ComponentContextImpl.java 1 Aug 2005 00:04:41 -0000 1.3 @@ -44,7 +44,7 @@
/** * This context provides access to data needed by all JBI components running in the JBI environment. *
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class ComponentContextImpl implements ComponentContext, MBeanNames{
private ComponentNameSpace componentName;
@@ -117,14 +117,14 @@
}
/**
- * @param interfaceName
+ * @param serviceName
* @param endpointName
* @return EndPointReference
* @throws JBIException
*/
- public ServiceEndpoint activateEndpoint(QName interfaceName, String endpointName) throws JBIException {
+ public ServiceEndpoint activateEndpoint(QName serviceName, String endpointName) throws JBIException {
checkActivated();
- return container.activateEndpoint(this, interfaceName, endpointName);
+ return container.activateEndpoint(this, serviceName, endpointName);
}
/**
