public Object run() throws ClassNotFoundException { return Loader.loadClass(clasName); } });
public Object run() throws ClassNotFoundException { return Loader.loadClass(clasName); } });
private static Class getHandlerClass(String className, ClassLoader loader1) throws AxisFault { Class handlerClass; try { handlerClass = Loader.loadClass(loader1, className); } catch (ClassNotFoundException e) { throw AxisFault.makeFault(e); } return handlerClass; }
private static Class getHandlerClass(String className, ClassLoader loader1) throws AxisFault { Class handlerClass; try { handlerClass = Loader.loadClass(loader1, className); } catch (ClassNotFoundException e) { throw AxisFault.makeFault(e); } return handlerClass; }
/** * Loads the specified classloader and then falls back to the loadClass. * * @param loader * @param clazz * @return Returns Class. * @throws ClassNotFoundException */ static public Class loadClass(ClassLoader loader, String clazz) throws ClassNotFoundException { try { if (loader != null) { Class c = loader.loadClass(clazz); if (c != null) { return c; } } } catch (UnsupportedClassVersionError e) { log.debug(e); throw e; } catch (Throwable e) { log.debug(e); } return loadClass(clazz); }
private void processAttachmentsLifecycleManager(AxisConfiguration axisConfig, OMElement element) { String className = element.getAttributeValue(new QName(TAG_CLASS_NAME)); try { Class classInstance = Loader.loadClass(className); LifecycleManager manager = (LifecycleManager) classInstance.newInstance(); axisConfig.addParameter(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER, manager); } catch (Exception e) { if (log.isTraceEnabled()) { log.trace( "processAttachmentsLifecycleManager: Exception thrown initialising LifecycleManager: " + e.getMessage()); } } }
private void processAttachmentsLifecycleManager(AxisConfiguration axisConfig, OMElement element) { String className = element.getAttributeValue(new QName(TAG_CLASS_NAME)); try { Class classInstance = Loader.loadClass(className); LifecycleManager manager = (LifecycleManager) classInstance.newInstance(); axisConfig.addParameter(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER, manager); } catch (Exception e) { if (log.isTraceEnabled()) { log.trace( "processAttachmentsLifecycleManager: Exception thrown initialising LifecycleManager: " + e.getMessage()); } } }
private Phase getPhase(String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException { if (className == null) { return new Phase(); } Class phaseClass = Loader.loadClass(axisConfig.getSystemClassLoader(), className); return (Phase) phaseClass.newInstance(); } }
/** * To get the location of the Axis2.jar from that I can drive the location of class path * * @return String (location of the axis2 jar) */ protected String getLocation() { try { Class clazz = Loader.loadClass("org.apache.axis2.engine.AxisEngine"); java.net.URL url = clazz.getProtectionDomain().getCodeSource().getLocation(); String location = url.toString(); if (location.startsWith("jar")) { url = ((java.net.JarURLConnection)url.openConnection()).getJarFileURL(); location = url.toString(); } if (location.startsWith("file")) { File file = Utils.toFile(url); return file.getAbsolutePath(); } else { return url.toString(); } } catch (Throwable t) { return null; } }
private Phase getPhase(String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException { if (className == null) { return new Phase(); } Class phaseClass = Loader.loadClass(axisConfig.getSystemClassLoader(), className); return (Phase) phaseClass.newInstance(); } }
/** * To get the location of the Axis2.jar from that I can drive the location of class path * * @return String (location of the axis2 jar) */ protected String getLocation() { try { Class clazz = Loader.loadClass("org.apache.axis2.engine.AxisEngine"); java.net.URL url = clazz.getProtectionDomain().getCodeSource().getLocation(); String location = url.toString(); if (location.startsWith("jar")) { url = ((java.net.JarURLConnection)url.openConnection()).getJarFileURL(); location = url.toString(); } if (location.startsWith("file")) { File file = Utils.toFile(url); return file.getAbsolutePath(); } else { return url.toString(); } } catch (Throwable t) { 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 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); } } }
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); } } }
private void processTargetResolvers(AxisConfiguration axisConfig, OMElement targetResolvers) { if (targetResolvers != null) { Iterator iterator = targetResolvers.getChildrenWithName(new QName(TAG_TARGET_RESOLVER)); while (iterator.hasNext()) { OMElement targetResolver = (OMElement) iterator.next(); OMAttribute classNameAttribute = targetResolver.getAttribute(new QName(TAG_CLASS_NAME)); String className = classNameAttribute.getAttributeValue(); try { Class classInstance = Loader.loadClass(className); TargetResolver tr = (TargetResolver) classInstance.newInstance(); axisConfig.addTargetResolver(tr); } catch (Exception e) { if (log.isTraceEnabled()) { log.trace( "processTargetResolvers: Exception thrown initialising TargetResolver: " + e.getMessage()); } } } } }
private void processTargetResolvers(AxisConfiguration axisConfig, OMElement targetResolvers) { if (targetResolvers != null) { Iterator<OMElement> iterator = targetResolvers.getChildrenWithName(new QName(TAG_TARGET_RESOLVER)); while (iterator.hasNext()) { OMElement targetResolver = iterator.next(); OMAttribute classNameAttribute = targetResolver.getAttribute(new QName(TAG_CLASS_NAME)); String className = classNameAttribute.getAttributeValue(); try { Class classInstance = Loader.loadClass(className); TargetResolver tr = (TargetResolver) classInstance.newInstance(); axisConfig.addTargetResolver(tr); } catch (Exception e) { if (log.isTraceEnabled()) { log.trace( "processTargetResolvers: Exception thrown initialising TargetResolver: " + e.getMessage()); } } } } }
@SuppressWarnings("unchecked") private void loadModuleClass(AxisModule module, String moduleClassName) throws DeploymentException { Class<?> moduleClass; try { if ((moduleClassName != null) && !"".equals(moduleClassName)) { moduleClass = Loader.loadClass(module.getModuleClassLoader(), moduleClassName); final Class<?> fmoduleClass = moduleClass; final AxisModule fmodule = module; try { AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws IllegalAccessException, InstantiationException { Module new_module = (Module) fmoduleClass.newInstance(); fmodule.setModule(new_module); return null; } }); } catch (PrivilegedActionException e) { throw e.getException(); } } } catch (Exception e) { throw new DeploymentException(e.getMessage(), e); } }
public Object run() throws org.apache.axis2.deployment.DeploymentException { Class selectorClass; try { if ((className != null) && !"".equals(className)) { selectorClass = Loader.loadClass(Thread.currentThread() .getContextClassLoader(), className); } else { throw new DeploymentException(Messages.getMessage(errorMsg, "Invalid Class Name", className)); } } catch (ClassNotFoundException e) { throw new DeploymentException(Messages.getMessage(errorMsg, "ClassNotFoundException", className), e); } return selectorClass; } });
public Object run() throws org.apache.axis2.deployment.DeploymentException { Class selectorClass; try { if ((className != null) && !"".equals(className)) { selectorClass = Loader.loadClass(Thread.currentThread() .getContextClassLoader(), className); } else { throw new DeploymentException(Messages.getMessage(errorMsg, "Invalid Class Name", className)); } } catch (ClassNotFoundException e) { throw new DeploymentException(Messages.getMessage(errorMsg, "ClassNotFoundException", className), e); } return selectorClass; } });