import org.apache.axis2.engine.ServiceLifeCycle; public class LifeCycleImpl implements ServiceLifeCycle { public void startUp(ConfigurationContext configctx, AxisService service) { InputStream in = service.getClassLoader().getResourceAsStream("config-file.xml"); //Extract your database config from the input stream //Create database connection //Store the connection as a service parameter using service.AddParameter }
public Object run() { Thread.currentThread().setContextClassLoader( service.getClassLoader()); return null; } });
public Object run() { Thread.currentThread() .setContextClassLoader(service.getClassLoader()); return null; } }
public Object run() { Thread.currentThread().setContextClassLoader(service.getClassLoader()); return null; } });
public Object run() { Thread.currentThread().setContextClassLoader(service.getClassLoader()); return null; } });
public Object run() { Thread.currentThread() .setContextClassLoader(service.getClassLoader()); return null; } }
public Object run() { Thread.currentThread().setContextClassLoader( service.getClassLoader()); return null; } });
public Object run() { return new MultiParentClassLoader(new URL[] {}, new ClassLoader[] { service.getClassLoader(), contextClassLoader }); } });
public Object run() { return new MultiParentClassLoader(new URL[] {}, new ClassLoader[] { service.getClassLoader(), contextClassLoader }); } });
static InputStream getMetaInfResourceAsStream(AxisService service, String name) { ClassLoader classLoader = service.getClassLoader(); if (classLoader instanceof URLClassLoader) { // Only search the service class loader and skip searching the ancestors to // avoid local file inclusion vulnerabilities such as AXIS2-5846. URL url = ((URLClassLoader)classLoader).findResource("META-INF/" + name); try { return url == null ? null : url.openStream(); } catch (IOException ex) { return null; } } else { return null; } } }
static InputStream getMetaInfResourceAsStream(AxisService service, String name) { ClassLoader classLoader = service.getClassLoader(); if (classLoader instanceof URLClassLoader) { // Only search the service class loader and skip searching the ancestors to // avoid local file inclusion vulnerabilities such as AXIS2-5846. URL url = ((URLClassLoader)classLoader).findResource("META-INF/" + name); try { return url == null ? null : url.openStream(); } catch (IOException ex) { return null; } } else { return null; } } }
private void loadObjectSupplierClass(String objectSupplierValue) throws AxisFault { try { ClassLoader loader = service.getClassLoader(); Class objectSupplierImpl = Loader.loadClass(loader, objectSupplierValue.trim()); ObjectSupplier objectSupplier = (ObjectSupplier) objectSupplierImpl .newInstance(); service.setObjectSupplier(objectSupplier); } catch (Exception e) { throw AxisFault.makeFault(e); } }
private void loadObjectSupplierClass(String objectSupplierValue) throws AxisFault { try { ClassLoader loader = service.getClassLoader(); Class objectSupplierImpl = Loader.loadClass(loader, objectSupplierValue.trim()); ObjectSupplier objectSupplier = (ObjectSupplier) objectSupplierImpl .newInstance(); service.setObjectSupplier(objectSupplier); } catch (Exception e) { throw AxisFault.makeFault(e); } }
private void loadServiceLifeCycleClass(String className) throws DeploymentException { if (className != null) { try { ClassLoader loader = service.getClassLoader(); Class serviceLifeCycleClassImpl = Loader.loadClass(loader, className); ServiceLifeCycle serviceLifeCycle = (ServiceLifeCycle) serviceLifeCycleClassImpl.newInstance(); service.setServiceLifeCycle(serviceLifeCycle); } catch (Exception e) { throw new DeploymentException(e.getMessage(), e); } } }
protected Data[] outputInlineForm(MessageContext msgContext, ServiceData[] serviceData) throws DataRetrievalException { assert(msgContext != null); if (serviceData == null || serviceData.length == 0) { return new Data[0]; } final ArrayList<Data> result = new ArrayList<Data>(); for(final ServiceData sd: serviceData) { final OMElement metaElement = sd.getFileContent(msgContext.getAxisService().getClassLoader()); if (metaElement != null) { result.add(new Data(metaElement, sd.getIdentifier())); } } return (Data[]) result.toArray(new Data[result.size()]); }
private void loadServiceLifeCycleClass(String className) throws DeploymentException { if (className != null) { try { ClassLoader loader = service.getClassLoader(); Class serviceLifeCycleClassImpl = Loader.loadClass(loader, className); ServiceLifeCycle serviceLifeCycle = (ServiceLifeCycle) serviceLifeCycleClassImpl.newInstance(); service.setServiceLifeCycle(serviceLifeCycle); } catch (Exception e) { throw new DeploymentException(e.getMessage(), e); } } }
protected Data[] outputInlineForm(MessageContext msgContext, ServiceData[] serviceData) throws DataRetrievalException { assert(msgContext != null); if (serviceData == null || serviceData.length == 0) { return new Data[0]; } final ArrayList<Data> result = new ArrayList<Data>(); for(final ServiceData sd: serviceData) { final OMElement metaElement = sd.getFileContent(msgContext.getAxisService().getClassLoader()); if (metaElement != null) { result.add(new Data(metaElement, sd.getIdentifier())); } } return (Data[]) result.toArray(new Data[result.size()]); }
public void engageNotify(AxisDescription axisDescription) throws AxisFault { if (axisDescription instanceof AxisService) { try { AxisService axisService = (AxisService) axisDescription; String implClassName = (String) axisService .getParameterValue(WSTransferModule.ATTR_SERVICE_CLASS); if (implClassName == null || (implClassName = implClassName.trim()).length() == 0) { if (LOG.isDebugEnabled()) { LOG .debug("WSTransferModule is not to engaged to service " + axisService.getName() + " because it doesn't contain an implementation class."); } return; } ClassLoader classLoader = axisService.getClassLoader(); Class implClass = classLoader.loadClass(implClassName); processAxisService(axisService, implClass); } catch (Exception ex) { throw AxisFault.makeFault(ex); } } }
public void loadServiceData() { DataRetrievalUtil util = DataRetrievalUtil.getInstance(); OMElement serviceData = null; String file = "META-INF/" + DRConstants.SERVICE_DATA.FILE_NAME; try { serviceData = util.buildOM(axisService.getClassLoader(), "META-INF/" + DRConstants.SERVICE_DATA.FILE_NAME); } catch (DataRetrievalException e) { // It is not required to define ServiceData for a Service, just log a warning message String message = "Check loading failure for file, " + file; log.debug(message + ".Message = " + e.getMessage()); log.debug(message, e); } if (serviceData != null) { cachingServiceData(serviceData); } }
public void loadServiceData() { DataRetrievalUtil util = DataRetrievalUtil.getInstance(); OMElement serviceData = null; String file = "META-INF/" + DRConstants.SERVICE_DATA.FILE_NAME; try { serviceData = util.buildOM(axisService.getClassLoader(), "META-INF/" + DRConstants.SERVICE_DATA.FILE_NAME); } catch (DataRetrievalException e) { // It is not required to define ServiceData for a Service, just log a warning message String message = "Check loading failure for file, " + file; log.debug(message + ".Message = " + e.getMessage()); log.debug(message, e); } if (serviceData != null) { cachingServiceData(serviceData); } }