public ServiceUnitManager getServiceUnitManager() { if (suManager == null) { suManager = component.getServiceUnitManager(); } return suManager; }
public ServiceUnitManager getServiceUnitManager() { return component.getServiceUnitManager(); }
/** * Get the ServiceUnitManager instance for this component, if one is * available. * @return the Service Unit Manager or null if there is none. */ public javax.jbi.component.ServiceUnitManager getServiceUnitManager() { if ( null == mSUManagerInstance ) { if ( null != mComponentInstance ) { mSUManagerInstance = mComponentInstance.getServiceUnitManager(); } } return mSUManagerInstance; }
public void start() throws JBIException { checkComponentStarted("start"); ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(component.getComponentClassLoader()); component.getComponent().getServiceUnitManager().start(getName()); } finally { Thread.currentThread().setContextClassLoader(oldCl); } }
public void stop() throws JBIException { checkComponentStarted("stop"); ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(component.getComponentClassLoader()); component.getComponent().getServiceUnitManager().stop(getName()); } finally { Thread.currentThread().setContextClassLoader(oldCl); } }
public void shutdown() throws JBIException { checkComponentStartedOrStopped("shutDown"); ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(component.getComponentClassLoader()); component.getComponent().getServiceUnitManager().shutDown(getName()); } finally { Thread.currentThread().setContextClassLoader(oldCl); } }
public void init() throws JBIException { ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(component.getComponentClassLoader()); component.getComponent().getServiceUnitManager().init(getName(), getRootDir() != null ? getRootDir().getAbsolutePath() : null); } finally { Thread.currentThread().setContextClassLoader(oldCl); } component.addServiceUnit(this); }
public boolean canDeployToComponent(String componentName) { Component component = deployer.getComponent(componentName); return component != null && LifeCycleMBean.STARTED.equals(component.getCurrentState()) && component.getComponent().getServiceUnitManager() != null; }
void doStop() throws Exception { LOG.info("Stopping ODE service unit: " + getName()); this.shutdown(this.bundle, this.odeRegistrationService.getOdeComponent().getServiceUnitManager()); }
void doUninstall() throws Exception { LOG.info("Uninstalling ODE service unit: " + getName()); this.undeploy(this.bundle, this.odeRegistrationService.getOdeComponent().getServiceUnitManager()); }
public void undeploy() throws JBIException { ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(component.getComponentClassLoader()); String resultMsg = component.getComponent().getServiceUnitManager().undeploy(getName(), getRootDir() != null ? getRootDir().getAbsolutePath() : null); List<Element> results = new ArrayList<Element>(); if (!ManagementSupport.getComponentTaskResult(resultMsg, getComponentName(), results)) { throw ManagementSupport.failure("undeploy", results); } } finally { Thread.currentThread().setContextClassLoader(oldCl); } component.removeServiceUnit(this); }
void doStart() throws Exception { // If we are already started, don't bother starting again. LOG.info("Starting ODE service unit: " + getName()); // Wait until ODE is available before starting. waitAvailable(); // Do we need to undeploy first? boolean needUpdate = updated; boolean forceDeploy = needUpdate; this.updated = false; // Do deploy. this.deploy(this.bundle, this.odeRegistrationService.getOdeComponent().getServiceUnitManager(), forceDeploy, needUpdate); }
public void deploy() throws JBIException { ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(component.getComponentClassLoader()); String resultMsg = component.getComponent().getServiceUnitManager().deploy(getName(), getRootDir() != null ? getRootDir().getAbsolutePath() : null); List<Element> results = new ArrayList<Element>(); if (!ManagementSupport.getComponentTaskResult(resultMsg, getComponentName(), results)) { throw ManagementSupport.failure("deploy", results); } } finally { Thread.currentThread().setContextClassLoader(oldCl); } component.addServiceUnit(this); }
private void waitAvailable() throws InterruptedException { /** * We need to wait until the service unit manager is available before * proceeding. Also, since the ode component itself does an asynchronous * start with respect to this bundle, we need to wait until it is done * initializing. This would be much cleaner if we could simply * call "isStarted" on OdeLifeCycle, which maintains a started state. * * If we do not wait until the ode component is started, deployments * will fail sporadically because of asynchronous start race conditions. */ boolean showedWait = false; while (this.odeRegistrationService.getOdeComponent().getServiceUnitManager() == null || !isStarted(this.odeRegistrationService.getOdeComponent())) { // Do a wait. if (!showedWait) { LOG.info("Waiting for ODE to arrive (" + getName() + ")..."); showedWait = true; } Thread.sleep(500L); } }
/** * Returns the ServiceUnitManager associated with the service unit's * targeted component * * @return null if there's no Service Unit Manager */ public ServiceUnitManager getServiceUnitManager() { ServiceUnitManager result = null; ComponentLifeCycle clc = managerService .getComponentLifeCycleByName(serviceUnit .getTargetComponentName()); if (clc != null) { result = clc.getComponent().getServiceUnitManager(); } return result; }
public boolean canDeployToComponent(String componentName) { ParameterCheckHelper.isNullParameterWithLog(componentName, "componentName", log); ParameterCheckHelper.isEmptyParameterWithLog(componentName, "componentName", log); boolean result = false; ComponentLifeCycle clc = adminService .getComponentLifeCycleByName(componentName); result = clc != null && LifeCycleMBean.STARTED.equals(clc.getCurrentState()) && clc.getComponent().getServiceUnitManager() != null; return result; }
/** * Returns the ServiceUnitManager associated with the service unit's target * component * * @return null if there's no Service Unit Manager */ public ServiceUnitManager getServiceUnitManager() { if (this.serviceUnitManager == null) { Installer installer = adminService.getInstallerByName(serviceUnit.getTarget() .getComponentName()); if (installer != null) { this.serviceUnitManager = installer.getComponent().getServiceUnitManager(); } } return this.serviceUnitManager; }
public boolean canDeployToComponent(String componentName) { this.log.call(); ParameterCheckHelper .isNullOrEmptyParameterWithLog(componentName, "componentName", this.log); boolean result = false; Installer installer = this.adminService.getInstallerByName(componentName); if (installer.isInstalled() && (installer.getComponent().getServiceUnitManager() != null)) { result = true; } return result; }
private void undeploy(ServiceUnitReference reference) { try { Component componentGBean = getComponentGBean( reference.getAssocialtedServiceUnitName().getArtifactId(), reference.getAssocialtedServiceUnitName()); ServiceUnitManager serviceUnitManager = componentGBean.getComponent().getServiceUnitManager(); serviceUnitManager.undeploy(reference.getServiceUnitName(), reference.getServiceUnitPath()); } catch (Exception e) { throw new RuntimeException(e); } }
private void checkSus(ServiceUnitDesc[] sus) throws Exception { if (sus != null) { for (int i = 0; i < sus.length; i++) { String suName = sus[i].getIdentification().getName(); String componentName = sus[i].getTarget().getComponentName(); Component component = deployer.getComponent(componentName); if (component == null) { throw ManagementSupport.failure("deploy", "Target component " + componentName + " for service unit " + suName + " is not installed"); } if (!component.getCurrentState().equals(LifeCycleMBean.STARTED)) { throw ManagementSupport.failure("deploy", "Target component " + componentName + " for service unit " + suName + " is not started"); } if (component.getComponent().getServiceUnitManager() == null) { throw ManagementSupport.failure("deploy", "Target component " + componentName + " for service unit " + suName + " does not accept deployments"); } if (isDeployedServiceUnit(componentName, suName)) { throw ManagementSupport.failure("deploy", "Service unit " + suName + " is already deployed on component " + componentName); } } } }