public boolean isBinding(String componentName) { ParameterCheckHelper.isNullOrEmptyParameterWithLog(componentName, "componentName must not be null", this.log); return this.bindingLifeCyclesByName.containsKey(componentName); }
public boolean isEngine(String componentName) { ParameterCheckHelper.isNullOrEmptyParameterWithLog(componentName, "componentName must not be null", this.log); return this.engineLifeCyclesByName.containsKey(componentName); }
public ComponentLifeCycleMBean getBindingComponentLifeCycleByName(String name) { ParameterCheckHelper.isNullOrEmptyParameterWithLog(name, "name must not be null or empty", this.log); this.log.call(); return this.bindingLifeCyclesByName.get(name); }
public String getServiceAssemblyDescriptor(String serviceAssemblyName) throws Exception { this.log.start(); ParameterCheckHelper.isNullOrEmptyParameterWithLog(serviceAssemblyName, "serviceAssemblyName", this.log); String result = "Service Assembly doesn't exist :" + serviceAssemblyName; File serviceAssemblyInstallFile = this.repositoryService .getServiceAssemblyInstallDirectory(serviceAssemblyName); if (serviceAssemblyInstallFile != null) { File jbiFile = new File(serviceAssemblyInstallFile, JBI_DESCRIPTOR_RESOURCE); result = IOUtils.toString(new FileInputStream(jbiFile)); } this.log.end(); return result; }
public ObjectName getSystemService(String serviceName) { this.log.call(); ParameterCheckHelper.isNullOrEmptyParameterWithLog(serviceName, "serviceName must not be null", this.log); ObjectName result = null; ObjectName[] systemServices = this.getSystemServices(); for (ObjectName objectName : systemServices) { if (objectName.getCanonicalName().equals(serviceName)) { result = objectName; break; } } return result; }
public ObjectName getComponentByName(String name) { this.log.call(); ParameterCheckHelper.isNullOrEmptyParameterWithLog(name, "name must not be null", this.log); ObjectName result = null; for (ObjectName mbeanName : this.bindingLifeCyclesByMBeanName.keySet()) { if (name.equals(this.mBeanNamesImpl.getNameFromMBeanName(mbeanName))) { result = mbeanName; break; } } if (result == null) { for (ObjectName mbeanName : this.engineLifeCyclesByMBeanName.keySet()) { if (name.equals(this.mBeanNamesImpl.getNameFromMBeanName(mbeanName))) { result = mbeanName; break; } } } return result; }
public boolean isDeployedServiceUnit(String componentName, String serviceUnitName) { this.log.start(); ParameterCheckHelper.isNullOrEmptyParameterWithLog(serviceUnitName, "serviceUnitName", this.log); ParameterCheckHelper .isNullOrEmptyParameterWithLog(componentName, "componentName", this.log); boolean result = false; List<ServiceUnitLifeCycle> suLifeCycles = this.adminService .getServiceUnitsLifeCyclesForComponent(componentName); for (ServiceUnitLifeCycle suLifeCycle : suLifeCycles) { if (suLifeCycle.getSuName().equals(serviceUnitName)) { result = true; break; } } this.log.end(); return result; }
public String getState(String serviceAssemblyName) throws Exception { this.log.start(); ParameterCheckHelper.isNullOrEmptyParameterWithLog(serviceAssemblyName, "serviceAssemblyName", this.log); String result = null; String msg; ServiceAssemblyLifeCycle saLifeCycle = this.adminService .getServiceAssemblyByName(serviceAssemblyName); if (saLifeCycle != null) { result = saLifeCycle.getCurrentState(); } else { msg = "Cannot retrieve service assembly with the specified name : " + serviceAssemblyName; this.log.error(msg); throw new Exception(msg); } if (!(LifeCycleMBean.SHUTDOWN.equals(result) || LifeCycleMBean.STARTED.equals(result) || LifeCycleMBean.STOPPED.equals(result) || LifeCycleMBean.UNKNOWN.equals(result))) { msg = "Service Assembly state isn't correctly defined"; this.log.error(msg); throw new Exception(msg); } this.log.end(); return result; }
ParameterCheckHelper.isNullOrEmptyParameterWithLog(componentName, "componentName", this.log);
public String[] getServiceUnitForServiceAssembly(String saName) throws Exception { this.log.start(); ParameterCheckHelper.isNullOrEmptyParameterWithLog(saName, "saName", this.log); List<String> result = new ArrayList<String>(); ServiceAssemblyLifeCycle saLifeCycle = this.adminService.getServiceAssemblyByName(saName); if (saLifeCycle != null) { List<ServiceUnit> serviceUnits = saLifeCycle.getServiceAssembly().getServiceUnit(); for (ServiceUnit serviceUnit : serviceUnits) { result.add(serviceUnit.getIdentification().getName()); } } else { String msg = "Cannot retrieve service assembly with the name '" + saName + '"'; this.log.error(msg); throw new Exception(msg); } this.log.end(); return result.toArray(new String[result.size()]); }
public String[] getDeployedServiceAssembliesForComponent(String componentName) throws Exception { this.log.start(); ParameterCheckHelper .isNullOrEmptyParameterWithLog(componentName, "componentName", this.log); Set<String> result = new HashSet<String>(); Map<String, ServiceAssemblyLifeCycle> saLifeCycles = this.adminService .getServiceAssemblies(); for (ServiceAssemblyLifeCycle salc : saLifeCycles.values()) { List<ServiceUnit> sus = salc.getServiceAssembly().getServiceUnit(); for (ServiceUnit unit : sus) { if (componentName.equals(unit.getTarget().getComponentName())) { result.add(salc.getServiceAssembly().getIdentification().getName()); } } } this.log.end(); return result.toArray(new String[result.size()]); }
public String[] getDeployedServiceUnitList(String componentName) throws Exception { this.log.start(); ParameterCheckHelper .isNullOrEmptyParameterWithLog(componentName, "componentName", this.log); Set<String> result = new HashSet<String>(); Map<String, ServiceAssemblyLifeCycle> saLifeCycles = this.adminService .getServiceAssemblies(); for (ServiceAssemblyLifeCycle salc : saLifeCycles.values()) { List<ServiceUnit> sus = salc.getServiceAssembly().getServiceUnit(); for (ServiceUnit unit : sus) { if (componentName.equals(unit.getTarget().getComponentName())) { result.add(unit.getIdentification().getName()); } } } this.log.end(); return result.toArray(new String[result.size()]); }
public String[] getComponentsForDeployedServiceAssembly(String serviceAssemblyName) throws Exception { this.log.start(); ParameterCheckHelper.isNullOrEmptyParameterWithLog(serviceAssemblyName, "serviceAssemblyName", this.log); List<String> result = new ArrayList<String>(); ServiceAssemblyLifeCycle saLifeCycle = this.adminService .getServiceAssemblyByName(serviceAssemblyName); if (saLifeCycle != null) { List<ServiceUnit> sus = saLifeCycle.getServiceAssembly().getServiceUnit(); for (ServiceUnit unit : sus) { result.add(unit.getTarget().getComponentName()); } } else { throw new Exception("Cannot retrieve service assembly with the specified name: " + serviceAssemblyName); } this.log.end(); return result.toArray(new String[result.size()]); }
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; }
.isNullOrEmptyParameterWithLog(componentName, "componentName", this.log);
public boolean uninstallComponent(String componentName) throws JBIException { this.log.start("Component Name : " + componentName); ParameterCheckHelper .isNullOrEmptyParameterWithLog(componentName, "componentName", this.log); if (!this.systemStateService.isComponentInstalled(componentName)) { throw new JBIException("The component '" + componentName + "' is not installed"); } try { this.loadInstaller(componentName); } catch (final RuntimeException e) { throw new JBIException(e.getMessage()); } final Installer installer = this.adminService.getInstallerByName(componentName); try { if (installer != null) { installer.uninstall(); } else { throw new JBIException("The installer of the component '" + componentName + "' is not loaded"); } } catch (final JBIException e) { this.log.error("Unable to uninstall the component '" + componentName + "'", e); throw e; } this.log.info("Component '" + componentName + "' uninstalled"); this.log.end(); return true; }
public String start(String serviceAssemblyName) throws Exception { this.log.start(); ParameterCheckHelper.isNullOrEmptyParameterWithLog(serviceAssemblyName, "serviceAssemblyName", this.log); String output = null; try { XMLResult xmlResult = new XMLResult("start"); ServiceAssemblyLifeCycle saLifeCycle = this.adminService .getServiceAssemblyByName(serviceAssemblyName); if (saLifeCycle != null) { saLifeCycle.start(); } else { throw new DeploymentException("The service assembly '" + serviceAssemblyName + "' is not deployed"); } xmlResult.addFrameworkTaskResult(TaskResult.SUCCESS, MessageType.INFO, "Successfully started service assembly : {1}", new String[] { serviceAssemblyName }, null); output = xmlResult.getString(); } catch (Exception e) { this.log.error("Unable to start the service assembly '" + serviceAssemblyName + "'", e); // Redefine the exception to prevent exotic exception cause type, // and then unserialization problem for external class-loaders (JMX // client) throw new Exception(ExceptionUtil.getExtendedMessage(e)); } this.log.info("Service Assembly '" + serviceAssemblyName + "' started"); this.log.end(); return output; }
private String stop(String serviceAssemblyName, boolean force) throws Exception { this.log.start(); ParameterCheckHelper.isNullOrEmptyParameterWithLog(serviceAssemblyName, "serviceAssemblyName", this.log);
public boolean startComponent(final String componentName) throws JBIException { this.log.start("Component Name : " + componentName); ParameterCheckHelper .isNullOrEmptyParameterWithLog(componentName, "componentName", this.log); ComponentLifeCycleMBean componentLifeCycle = null; if (this.adminService.isEngine(componentName)) { componentLifeCycle = this.adminService.getEngineComponentLifeCycleByName(componentName); } else { componentLifeCycle = this.adminService .getBindingComponentLifeCycleByName(componentName); } try { if (componentLifeCycle != null) { componentLifeCycle.start(); } else { throw new JBIException("The component '" + componentName + "' is not installed"); } } catch (final JBIException e) { this.log.error("Unable to start the component '" + componentName + "'", e); throw e; } this.log.info("Component '" + componentName + "' started"); this.log.end(); return true; }
private boolean stopComponent(final String componentName, boolean force) throws JBIException { this.log.start("Component Name : " + componentName); ParameterCheckHelper .isNullOrEmptyParameterWithLog(componentName, "componentName", this.log);