当前位置: 首页>>代码示例>>Java>>正文


Java Loader类代码示例

本文整理汇总了Java中org.apache.axis2.util.Loader的典型用法代码示例。如果您正苦于以下问题:Java Loader类的具体用法?Java Loader怎么用?Java Loader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Loader类属于org.apache.axis2.util包,在下文中一共展示了Loader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processTargetResolvers

import org.apache.axis2.util.Loader; //导入依赖的package包/类
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());
                }
            }
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:23,代码来源:AxisConfigBuilder.java

示例2: getLocation

import org.apache.axis2.util.Loader; //导入依赖的package包/类
/**
 * 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;
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:25,代码来源:RepositoryListener.java

示例3: findAndValidateSelectorClass

import org.apache.axis2.util.Loader; //导入依赖的package包/类
protected Class findAndValidateSelectorClass(final String className, final String errorMsg)
        throws PrivilegedActionException {
    return (Class) org.apache.axis2.java.security.AccessController
            .doPrivileged(new PrivilegedExceptionAction() {
                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;
                }
            });
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:26,代码来源:DescriptionBuilder.java

示例4: initService

import org.apache.axis2.util.Loader; //导入依赖的package包/类
/**
 * To init all the services in application scope
 *
 * @param serviceGroupContext the ServiceGroupContext from which to extract all the services
 * @throws AxisFault if there's a problem initializing
 */
public static void initService(ServiceGroupContext serviceGroupContext) throws AxisFault {
    AxisServiceGroup serviceGroup = serviceGroupContext.getDescription();
    Iterator<AxisService> serviceItr = serviceGroup.getServices();
    while (serviceItr.hasNext()) {
        AxisService axisService = (AxisService) serviceItr.next();
        ServiceContext serviceContext = serviceGroupContext.getServiceContext(axisService);
        AxisService service = serviceContext.getAxisService();
        ClassLoader classLoader = service.getClassLoader();
        Parameter implInfoParam = service.getParameter(Constants.SERVICE_CLASS);
        if (implInfoParam != null) {
            try {
            	ThreadContextDescriptor tc = setThreadContext(axisService);
                Class implClass = Loader.loadClass(
                        classLoader,
                        ((String) implInfoParam.getValue()).trim());
                Object serviceImpl = makeNewServiceObject(service);
                serviceContext.setProperty(ServiceContext.SERVICE_OBJECT, serviceImpl);
                initServiceObject(serviceImpl, serviceContext);
                restoreThreadContext(tc);
            } catch (Exception e) {
                throw AxisFault.makeFault(e);
            }
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:32,代码来源:DependencyManager.java

示例5: createBasicConfigurationContext

import org.apache.axis2.util.Loader; //导入依赖的package包/类
/**
 * Creates configuration context using resource file found in the classpath.
 *
 * @return Returns ConfigurationContext.
 */
public static ConfigurationContext createBasicConfigurationContext(String resourceName) throws Exception {
    InputStream in = Loader.getResourceAsStream(resourceName);

    AxisConfiguration axisConfig = new AxisConfiguration();
    AxisConfigBuilder builder = new AxisConfigBuilder(in, axisConfig, null);
    builder.populateConfig();
    axisConfig.validateSystemPredefinedPhases();
    ConfigurationContext configContext = new ConfigurationContext(axisConfig);

    if (axisConfig.getClusteringAgent() != null) {
        configContext.initCluster();
    }

    setContextPaths(axisConfig, configContext);
    return configContext;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:22,代码来源:ConfigurationContextFactory.java

示例6: getTracePersister

import org.apache.axis2.util.Loader; //导入依赖的package包/类
private TracePersister getTracePersister(Parameter tracePersisterParam) throws AxisFault {
    TracePersister tracePersister = null;
    if (tracePersisterParam != null) {
        Object tracePersisterImplObj = tracePersisterParam.getValue();
        if (tracePersisterImplObj instanceof TracePersister) {
            tracePersister = (TracePersister) tracePersisterImplObj;
        } else if (tracePersisterImplObj instanceof String) {
            //This will need in TestSuite
            try {
                tracePersister =
                        (TracePersister) Loader
                                .loadClass(((String) tracePersisterImplObj).trim())
                                .newInstance();
            } catch (Exception e) {
                String message = "Cannot instatiate TracePersister ";
                log.error(message, e);
                throw new RuntimeException(message, e);
            }
        }
    } else {
        return new MemoryBasedTracePersister(); // The default is the MemoryBasedTRacePersister
    }
    return tracePersister;
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:25,代码来源:TracerAdmin.java

示例7: createAxisService

import org.apache.axis2.util.Loader; //导入依赖的package包/类
protected AxisService createAxisService(ClassLoader classLoader,
                                      String className,
                                      URL serviceLocation) throws ClassNotFoundException,
        InstantiationException,
        IllegalAccessException,
        AxisFault {
    Class<?> pojoClass = Loader.loadClass(classLoader, className);
    AxisService axisService;
    try {
        axisService = DescriptionFactory.createAxisService(pojoClass, configCtx);
    } catch (Throwable t) {
        log.info("Exception creating Axis Service : " + t.getCause(), t);
        return null;
    }
    if (axisService != null) {
        Iterator<AxisOperation> operations = axisService.getOperations();
        while (operations.hasNext()) {
            AxisOperation axisOperation = operations.next();
            if (axisOperation.getMessageReceiver() == null) {
                axisOperation.setMessageReceiver(new JAXWSMessageReceiver());
            }
        }
        axisService.addParameter("serviceType", "jaxws");
        axisService.setElementFormDefault(false);
        axisService.setFileName(serviceLocation);
        axisService.setClassLoader(classLoader);
        axisService.addParameter(new Parameter(org.apache.axis2.jaxws.spi.Constants.CACHE_CLASSLOADER, classLoader));
        axisService.addParameter(new Parameter("modifyUserWSDLPortAddress", "true"));
    }
    return axisService;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:32,代码来源:JAXWSDeployer.java

示例8: createAxisServiceUsingAnnogen

import org.apache.axis2.util.Loader; //导入依赖的package包/类
private AxisService createAxisServiceUsingAnnogen(String className,
                                                  ClassLoader classLoader,
                                                  URL serviceLocation)
        throws ClassNotFoundException,
        InstantiationException,
        IllegalAccessException,
        AxisFault {
    HashMap<String,MessageReceiver> messageReciverMap = new HashMap<String,MessageReceiver>();
    Class<?> inOnlyMessageReceiver = Loader.loadClass(
            "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver");
    MessageReceiver messageReceiver =
            (MessageReceiver) inOnlyMessageReceiver.newInstance();
    messageReciverMap.put(WSDL2Constants.MEP_URI_IN_ONLY,
            messageReceiver);
    Class<?> inoutMessageReceiver = Loader.loadClass(
            "org.apache.axis2.rpc.receivers.RPCMessageReceiver");
    MessageReceiver inOutmessageReceiver =
            (MessageReceiver) inoutMessageReceiver.newInstance();
    messageReciverMap.put(WSDL2Constants.MEP_URI_IN_OUT,
            inOutmessageReceiver);
    messageReciverMap.put(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY,
            inOutmessageReceiver);
    AxisService axisService =
            AxisService.createService(className,
                    configCtx.getAxisConfiguration(),
                    messageReciverMap,
                    null, null,
                    classLoader);
    axisService.setFileName(serviceLocation);
    return axisService;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:32,代码来源:POJODeployer.java

示例9: processAttachmentsLifecycleManager

import org.apache.axis2.util.Loader; //导入依赖的package包/类
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());
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:15,代码来源:AxisConfigBuilder.java

示例10: getPhase

import org.apache.axis2.util.Loader; //导入依赖的package包/类
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();
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:9,代码来源:AxisConfigBuilder.java

示例11: getAxisConfiguration

import org.apache.axis2.util.Loader; //导入依赖的package包/类
public AxisConfiguration getAxisConfiguration() throws AxisFault {
    InputStream axis2xmlStream;
    try {
        if (axis2xml == null) {
            axis2xmlStream =
                    Loader.getResourceAsStream(DeploymentConstants.AXIS2_CONFIGURATION_RESOURCE);
        } else {
            axis2xmlStream = axis2xml.openStream();
        }
        axisConfig = populateAxisConfiguration(axis2xmlStream);
        if (repository == null) {
            Parameter axis2repoPara = axisConfig.getParameter(DeploymentConstants.AXIS2_REPO);
            if (axis2repoPara != null) {
                String repoValue = (String) axis2repoPara.getValue();
                if (repoValue != null && !"".equals(repoValue.trim())) {
                    if (repoValue.startsWith("file:/")) {
                        // we treat this case specially , by assuming file is
                        // located in the local machine
                        loadRepository(repoValue);
                    } else {
                        loadRepositoryFromURL(new URL(repoValue));
                    }
                }
            } else {
                log.info("No repository found , module will be loaded from classpath");
                loadFromClassPath();
            }
        } else {
            loadRepositoryFromURL(repository);
        }

    } catch (IOException e) {
        throw new AxisFault(e.getMessage());
    }
    axisConfig.setConfigurator(this);
    return axisConfig;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:38,代码来源:URLBasedAxisConfigurator.java

示例12: loadObjectSupplierClass

import org.apache.axis2.util.Loader; //导入依赖的package包/类
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);
	}
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:14,代码来源:ServiceBuilder.java

示例13: loadServiceLifeCycleClass

import org.apache.axis2.util.Loader; //导入依赖的package包/类
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);
		}
	}
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:16,代码来源:ServiceBuilder.java

示例14: getHandlerClass

import org.apache.axis2.util.Loader; //导入依赖的package包/类
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;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:13,代码来源:Utils.java

示例15: createService

import org.apache.axis2.util.Loader; //导入依赖的package包/类
/**
 * To create an AxisService using given service impl class name first
 * generate schema corresponding to the given java class , next for each
 * methods AxisOperation will be created. If the method is in-out it will
 * uses RPCMessageReceiver else RPCInOnlyMessageReceiver <p/> Note : Inorder
 * to work this properly RPCMessageReceiver should be available in the class
 * path otherewise operation can not continue
 * 
 * @param implClass
 *            Service implementation class
 * @param axisConfig
 *            Current AxisConfiguration
 * @return return created AxisSrevice the creted service , it can either be
 *         null or valid service
 */
public static AxisService createService(String implClass,
		AxisConfiguration axisConfig) throws AxisFault {

	try {
		HashMap<String, MessageReceiver> messageReciverMap = new HashMap<String, MessageReceiver>();
		Class inOnlyMessageReceiver = Loader
				.loadClass("org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver");
		MessageReceiver messageReceiver = (MessageReceiver) inOnlyMessageReceiver
				.newInstance();
		messageReciverMap.put(WSDL2Constants.MEP_URI_IN_ONLY,
				messageReceiver);
		Class inoutMessageReceiver = Loader
				.loadClass("org.apache.axis2.rpc.receivers.RPCMessageReceiver");
		MessageReceiver inOutmessageReceiver = (MessageReceiver) inoutMessageReceiver
				.newInstance();
		messageReciverMap.put(WSDL2Constants.MEP_URI_IN_OUT,
				inOutmessageReceiver);
		messageReciverMap.put(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY,
				inOutmessageReceiver);

		return createService(implClass, axisConfig, messageReciverMap,
				null, null, axisConfig.getSystemClassLoader());
	} catch (Exception e) {
		throw AxisFault.makeFault(e);
	}
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:42,代码来源:AxisService.java


注:本文中的org.apache.axis2.util.Loader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。