/** * Checks if the parameter is null or empty * * @param parameter * parameter to be tested * @param parameterName * name of the parameter * @throws IllegalArgumentException * if parameter is null */ public static void isNullOrEmptyParameter(String parameter, String parameterName) { isEmptyParameter(parameter, parameterName); isNullParameter(parameter, parameterName); }
/** * Checks if the parameter is null or empty and log in error if it is null * * @param parameter * parameter to be tested * @param parameterName * name of the parameter * @param log * logger to use * @throws IllegalArgumentException * if parameter is null */ public static void isNullOrEmptyParameterWithLog(String parameter, String parameterName, LoggingUtil log) { isEmptyParameterWithLog(parameter, parameterName, log); isNullParameterWithLog(parameter, parameterName, log); }
public boolean isBinding(String componentName) { ParameterCheckHelper.isNullOrEmptyParameterWithLog(componentName, "componentName must not be null", this.log); return this.bindingLifeCyclesByName.containsKey(componentName); }
public void registerExternalEndpoint(ServiceEndpoint externalEndpoint) throws JBIException { this.logger.start(); ParameterCheckHelper.isNullParameter(externalEndpoint, "externalEndpoint"); // switch the classloader to the container one ClassLoader componentClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); try { this.componentContextCommunication.getEndpointRegistry().registerExternalEndpoint( externalEndpoint); } finally { Thread.currentThread().setContextClassLoader(componentClassLoader); } this.externalEndpoints.add(externalEndpoint); this.logger.end(); }
/** * {@inheritDoc} */ public boolean isExchangeWithConsumerOkayForComponent( org.ow2.petals.jbi.messaging.endpoint.ServiceEndpoint internalEndpoint, MessageExchange exchange) { this.log.start(); ParameterCheckHelper.isNullParameterWithLog(internalEndpoint, "Endpoint", this.log); boolean test = true; try { // Retrieve a connection to the JMX server of the container were the // component is deployed final RemoteJMXServer server = this.jmxService.getRemoteJMXServer(internalEndpoint .getLocation().getContainerName()); // Ask the component if it is ok to accept the exchange final Boolean bool = (Boolean) server.invoke(server.getAdminServiceMBeanName(), RemoteJMXServer.IS_OK_WITH_CONS, new Object[] { internalEndpoint.getLocation().getComponentName(), internalEndpoint, exchange }, new String[] { String.class.getName(), ServiceEndpoint.class.getName(), MessageExchange.class.getName() }); test = bool.booleanValue(); } catch (final Exception e) { this.log.error("Problem in isExchangeWithConsumerOkayForComponent", e); } this.log.end(); return test; }
public ServiceEndpoint getEndpoint(QName service, String name) { this.logger.start(); ParameterCheckHelper.isNullParameter(service, "service"); ParameterCheckHelper.isNullParameter(name, "name"); // switch the classloader to the container one ClassLoader componentClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); ServiceEndpoint result = null; try { result = this.componentContextCommunication.getEndpointRegistry().getEndpoint(service, name); } catch (Exception e) { this.logger.warning(e.getMessage()); } finally { Thread.currentThread().setContextClassLoader(componentClassLoader); } this.logger.end(); return result; }
public String deploy(String serviceAssemblyZipUrl) throws Exception { this.log.start(); ParameterCheckHelper.isNullParameterWithLog(serviceAssemblyZipUrl, "serviceAssemblyZipUrl", this.log);
public boolean isEngine(String componentName) { ParameterCheckHelper.isNullOrEmptyParameterWithLog(componentName, "componentName must not be null", this.log); return this.engineLifeCyclesByName.containsKey(componentName); }
public void deactivateEndpoint(javax.jbi.servicedesc.ServiceEndpoint endpoint) throws JBIException { this.logger.start(); ParameterCheckHelper.isNullParameter(endpoint, "endpoint"); // switch the classloader to the container one ClassLoader componentClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); try { this.componentContextCommunication.getEndpointRegistry().deactivateEndpoint( endpoint.getEndpointName(), endpoint.getServiceName()); } finally { Thread.currentThread().setContextClassLoader(componentClassLoader); } this.internalEndpoints.remove(endpoint); this.logger.end(); }
public String undeploy(String serviceAssemblyName) throws Exception { this.log.start(); ParameterCheckHelper.isNullParameterWithLog(serviceAssemblyName, "serviceAssemblyZipUrl", this.log);
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 ServiceEndpoint[] getExternalEndpoints(QName interfaceName) { this.logger.start(); ParameterCheckHelper.isNullParameter(interfaceName, "interfaceName"); // switch the classloader to the container one ClassLoader componentClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); ServiceEndpoint[] result = null; try { result = this.componentContextCommunication.getEndpointRegistry() .getExternalEndpointsForInterface(interfaceName); } catch (RegistryException e) { this.logger.warning(e.getMessage()); } finally { Thread.currentThread().setContextClassLoader(componentClassLoader); } this.logger.end(); return result; }
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 ServiceEndpoint[] getEndpointsForService(QName serviceName) { this.logger.start(); ParameterCheckHelper.isNullParameter(serviceName, "serviceName"); // switch the classloader to the container one ClassLoader componentClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); ServiceEndpoint[] result = null; try { result = this.componentContextCommunication.getEndpointRegistry() .getInternalEndpointsForService(serviceName, LinkType.STANDARD); } catch (RegistryException e) { this.logger.warning(e.getMessage()); } finally { Thread.currentThread().setContextClassLoader(componentClassLoader); } this.logger.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 ServiceEndpoint[] getExternalEndpointsForService(QName serviceName) { this.logger.start(); ParameterCheckHelper.isNullParameter(serviceName, "serviceName"); // switch the classloader to the container one ClassLoader componentClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); ServiceEndpoint[] result = null; try { result = this.componentContextCommunication.getEndpointRegistry() .getExternalEndpointsForService(serviceName); } catch (RegistryException e) { this.logger.warning(e.getMessage()); } finally { Thread.currentThread().setContextClassLoader(componentClassLoader); } this.logger.end(); 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 ServiceEndpoint resolveEndpointReference(DocumentFragment epr) { this.logger.start(); ParameterCheckHelper.isNullParameter(epr, "epr"); javax.jbi.servicedesc.ServiceEndpoint result = null; // switch the classloader to the container one ClassLoader componentClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); try { for (Installer installer : this.componentContextCommunication.getAdminService() .getInstallers()) { result = installer.getComponent().resolveEndpointReference(epr); if (result != null) { break; } } } finally { Thread.currentThread().setContextClassLoader(componentClassLoader); } this.logger.end(); 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 Document getEndpointDescriptor(ServiceEndpoint endpoint) throws JBIException { this.logger.start(); Document result = null; ParameterCheckHelper.isNullParameter(endpoint, "endpoint"); if (endpoint instanceof org.ow2.petals.jbi.messaging.endpoint.ServiceEndpoint) { this.logger.debug("Just get the description from the service endpoint"); // FIXME = Do not get it but just check if it exists... if (this.getEndpoint(endpoint.getServiceName(), endpoint.getEndpointName()) != null) { // switch the classloader to the container one ClassLoader componentClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); try { result = ((org.ow2.petals.jbi.messaging.endpoint.ServiceEndpoint) endpoint) .getDescription(); } finally { Thread.currentThread().setContextClassLoader(componentClassLoader); } if (result == null) { this.logger .debug("Can not find the service description in the service endpoint"); } } } else { this.logger.debug("the Endpoint type must be " + org.ow2.petals.jbi.messaging.endpoint.ServiceEndpoint.class.getName()); } this.logger.end(); return result; }