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


Java Utils类代码示例

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


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

示例1: undeploy

import org.apache.axis2.deployment.util.Utils; //导入依赖的package包/类
public void undeploy(String fileName) {
    //find the hierarchical part of the service group name
    String serviceHierarchy = Utils.getServiceHierarchy(fileName, this.directory);
    fileName = serviceHierarchy + Utils.getShortFileName(fileName);
    try {
        AxisServiceGroup serviceGroup =
                axisConfig.removeServiceGroup(fileName);
        if(configCtx != null) {
            configCtx.removeServiceGroupContext(serviceGroup);
        }
        super.undeploy(fileName);
        log.info(Messages.getMessage(DeploymentErrorMsgs.SERVICE_REMOVED,
                fileName));
    } catch (AxisFault axisFault) {
        //May be a faulty service
        log.debug(Messages.getMessage(DeploymentErrorMsgs.FAULTY_SERVICE_REMOVAL,
                axisFault.getMessage()), axisFault);
        axisConfig.removeFaultyService(fileName);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:21,代码来源:JAXWSDeployer.java

示例2: loadRepository

import org.apache.axis2.deployment.util.Utils; //导入依赖的package包/类
public void loadRepository(String repoDir) throws DeploymentException {
    File axisRepo = new File(repoDir);
    if (!axisRepo.exists()) {
        throw new DeploymentException(
                Messages.getMessage("cannotfindrepo", repoDir));
    }
    setDeploymentFeatures();
    prepareRepository(repoDir);
    // setting the CLs
    setClassLoaders(repoDir);
    repoListener = new RepositoryListener(this, false);
    org.apache.axis2.util.Utils
            .calculateDefaultModuleVersion(axisConfig.getModules(), axisConfig);
    try {
        try {
            axisConfig.setRepository(axisRepo.toURL());
        } catch (MalformedURLException e) {
            log.info(e.getMessage());
        }
        axisConfig.validateSystemPredefinedPhases();
    } catch (AxisFault axisFault) {
        throw new DeploymentException(axisFault);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:25,代码来源:DeploymentEngine.java

示例3: setClassLoaders

import org.apache.axis2.deployment.util.Utils; //导入依赖的package包/类
/**
 * To set the all the classLoader hierarchy this method can be used , the top most parent is
 * CCL then SCL(system Class Loader)
 * CCL
 * :
 * SCL
 * :  :
 * MCCL  SCCL
 * :      :
 * MCL    SCL
 * <p/>
 * <p/>
 * MCCL :  module common class loader
 * SCCL : Service common class loader
 * MCL : module class loader
 * SCL  : Service class loader
 *
 * @param axis2repoURI : The repository folder of Axis2
 * @throws DeploymentException if there's a problem
 */
protected void setClassLoaders(String axis2repoURI) throws DeploymentException {
    ClassLoader sysClassLoader =
            Utils.getClassLoader(Thread.currentThread().getContextClassLoader(), axis2repoURI,
                    axisConfig.isChildFirstClassLoading());

    axisConfig.setSystemClassLoader(sysClassLoader);
    if (servicesDir.exists()) {
        axisConfig.setServiceClassLoader(
                Utils.getClassLoader(axisConfig.getSystemClassLoader(), servicesDir,
                        axisConfig.isChildFirstClassLoading()));
    } else {
        axisConfig.setServiceClassLoader(axisConfig.getSystemClassLoader());
    }

    if (modulesDir.exists()) {
        axisConfig.setModuleClassLoader(Utils.getClassLoader(axisConfig.getSystemClassLoader(),
                modulesDir,
                axisConfig.isChildFirstClassLoading()));
    } else {
        axisConfig.setModuleClassLoader(axisConfig.getSystemClassLoader());
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:43,代码来源:DeploymentEngine.java

示例4: getLocation

import org.apache.axis2.deployment.util.Utils; //导入依赖的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

示例5: setClassLoader

import org.apache.axis2.deployment.util.Utils; //导入依赖的package包/类
public void setClassLoader(boolean isDirectory, ClassLoader parent, File file, boolean isChildFirstClassLoading) throws AxisFault {
    if (!isDirectory) {
        if (this.file != null) {
            URL[] urlsToLoadFrom;
            try {
                if (!this.file.exists()) {
                    throw new AxisFault(Messages.getMessage(DeploymentErrorMsgs.FILE_NOT_FOUND,
                                                            this.file.getAbsolutePath()));
                }
                urlsToLoadFrom = new URL[]{this.file.toURL()};
                classLoader = Utils.createClassLoader(urlsToLoadFrom, parent, true, file, isChildFirstClassLoading);
            } catch (Exception e) {
                throw AxisFault.makeFault(e);
            }
        }
    } else {
        if (this.file != null) {
            classLoader = Utils.getClassLoader(parent, this.file, isChildFirstClassLoading);
        }
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:22,代码来源:DeploymentFileData.java

示例6: getLocationURI

import org.apache.axis2.deployment.util.Utils; //导入依赖的package包/类
/**
 * this method returns the new IP address corresponding to the already
 * existing ip
 * 
 * @param eprs
 * @param epr
 * @return corresponding Ip address
 */
private String getLocationURI(String[] eprs, String epr) throws AxisFault {
	String returnIP = null;
	if (epr != null) {
	    String existingProtocol = org.apache.axis2.util.Utils.getURIScheme(epr);
		if (existingProtocol != null) {
			for (int i = 0; i < eprs.length; i++) {
				if (existingProtocol.equals(org.apache.axis2.util.Utils.getURIScheme(eprs[i]))) {
					returnIP = eprs[i];
					break;
				}
			}
			if (returnIP != null) {
				return returnIP;
			} else {
				throw new AxisFault(
						"Server does not have an epr for the wsdl epr==>"
								+ epr);
			}
		} else {
			throw new AxisFault("invalid epr is given epr ==> " + epr);
		}
	} else {
		throw new AxisFault("No epr is given in the wsdl port");
	}
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:34,代码来源:AxisService.java

示例7: deployClassAsService

import org.apache.axis2.deployment.util.Utils; //导入依赖的package包/类
/**
 * Deploy a class as a service.
 *
 * @param name the service name
 * @param myClass the Java class to deploy (all methods exposed by default)
 * @return a fully configured AxisService, already deployed into the server
 * @throws Exception in case of problems
 */
protected AxisService deployClassAsService(String name, Class myClass) throws Exception {
    AxisService service = new AxisService(name);
    service.addParameter(Constants.SERVICE_CLASS,
                          myClass.getName());

    Utils.fillAxisService(service, serverConfig, null, null);

    serverConfig.addService(service);
    return service;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:19,代码来源:LocalTestCase.java

示例8: undeploy

import org.apache.axis2.deployment.util.Utils; //导入依赖的package包/类
public void undeploy(String fileName) throws DeploymentException {
    try {
        super.undeploy(fileName);
        fileName = Utils.getShortFileName(fileName);
        axisConfig.removeServiceGroup(fileName);
        log.info(Messages.getMessage(DeploymentErrorMsgs.SERVICE_REMOVED, fileName));
    } catch (AxisFault axisFault) {
        axisConfig.removeFaultyService(fileName);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:11,代码来源:CorbaDeployer.java

示例9: setServiceEPR

import org.apache.axis2.deployment.util.Utils; //导入依赖的package包/类
private void setServiceEPR(AxisService axisService, String urlString)
		throws Exception {
	Utils.addSoap11Endpoint(axisService, urlString);
	Utils.addSoap12Endpoint(axisService, urlString);
	
	if ("http".equals(org.apache.axis2.util.Utils.getURIScheme(urlString))) {
		Utils.addHttpEndpoint(axisService, urlString);
	}
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:10,代码来源:Java2WSDLBuilder.java

示例10: unDeploy

import org.apache.axis2.deployment.util.Utils; //导入依赖的package包/类
public void unDeploy() {
        String serviceName = null;
        List undeployed = new ArrayList();
        for (int i = 0; i < wsToUnDeploy.size(); i++) {
            try {
                WSInfo wsInfo = (WSInfo)wsToUnDeploy.get(i);
                String fileName = Utils.getShortFileName(wsInfo.getFileName());
//                if (wsInfo.getType() == TYPE_SERVICE) {
                    if (isHotUpdate()) {
                        try {
                            serviceName = getAxisServiceName(fileName);
                            if (!undeployed.contains(serviceName)) {
                                realAxisConfig.removeServiceGroup(serviceName);
                                undeployed.add(serviceName);
                                // TODO: need a way to also remove the ServiceGroup from the ConfigContext.applicationSessionServiceGroupContextTable
                                log.info(Messages.getMessage(DeploymentErrorMsgs.SERVICE_REMOVED, serviceName));
                            }
                        } catch (AxisFault axisFault) {
                            // May be a faulty service
                            realAxisConfig.removeFaultyService(serviceName);
                            log.debug("removeFaultyService: " + fileName);
                        }
                    } else {
                        realAxisConfig.removeFaultyService(serviceName);
                        log.debug("not hotUpdate, removeFaultyService: " + fileName);
                    }
//                }
            } catch (Exception e) {
                log.warn(e);
            }
        }
        wsToUnDeploy.clear();
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:34,代码来源:ScriptDeploymentEngine.java

示例11: test1

import org.apache.axis2.deployment.util.Utils; //导入依赖的package包/类
public void test1() throws URISyntaxException, InterruptedException, MalformedURLException, AxisFault, UnsupportedEncodingException {
    AxisConfiguration axisConfig = new AxisConfiguration();
    ScriptDeploymentEngine sde = new ScriptDeploymentEngine(axisConfig);
    URL testScript = getClass().getClassLoader().getResource("org/apache/axis2/scripting/testrepo/test.js");
    File scriptsDir = Utils.toFile(testScript).getParentFile();
    sde.loadRepository(scriptsDir);
    sde.loadServices();
    assertNotNull(axisConfig.getService("test"));
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:10,代码来源:ScriptDeploymentEngineTest.java

示例12: testGetScriptServicesDirectory

import org.apache.axis2.deployment.util.Utils; //导入依赖的package包/类
public void testGetScriptServicesDirectory() throws AxisFault, MalformedURLException, URISyntaxException, UnsupportedEncodingException {
    ScriptModule module = new ScriptModule();
    AxisConfiguration axisConfig = new AxisConfiguration();
    URL url = getClass().getClassLoader().getResource("org/apache/axis2/scripting/testrepo/test.js");
    File dir = Utils.toFile(url).getParentFile();
    axisConfig.setRepository(dir.getParentFile().toURL());
    axisConfig.addParameter(new Parameter("scriptServicesDir", dir.getName()));
    assertEquals(dir.toURL(), module.getScriptServicesDirectory(axisConfig).toURL());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:10,代码来源:ScriptModuleTest.java

示例13: testInit

import org.apache.axis2.deployment.util.Utils; //导入依赖的package包/类
public void testInit() throws AxisFault, MalformedURLException, URISyntaxException, InterruptedException, UnsupportedEncodingException {
    ScriptModule module = new ScriptModule();
    AxisConfiguration axisConfig = new AxisConfiguration();
    URL url = getClass().getClassLoader().getResource("org/apache/axis2/scripting/testrepo/test.js");
    File dir = Utils.toFile(url).getParentFile();
    axisConfig.setRepository(dir.getParentFile().toURL());
    axisConfig.addParameter(new Parameter("scriptServicesDir", dir.getName()));
    ConfigurationContext configContext = new ConfigurationContext(axisConfig);

    module.init(configContext, null);
    
    Thread.sleep(500);
    
    assertNotNull(axisConfig.getService("test"));
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:16,代码来源:ScriptModuleTest.java

示例14: loadFromClassPath

import org.apache.axis2.deployment.util.Utils; //导入依赖的package包/类
public void loadFromClassPath() throws DeploymentException {
    //loading modules from the classpath
    new RepositoryListener(this, true);
    org.apache.axis2.util.Utils.calculateDefaultModuleVersion(
            axisConfig.getModules(), axisConfig);
    axisConfig.validateSystemPredefinedPhases();
    try {
        engageModules();
    } catch (AxisFault axisFault) {
        log.info(Messages.getMessage(DeploymentErrorMsgs.MODULE_VALIDATION_FAILED,
                axisFault.getMessage()));
        throw new DeploymentException(axisFault);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:15,代码来源:DeploymentEngine.java

示例15: loadServiceGroup

import org.apache.axis2.deployment.util.Utils; //导入依赖的package包/类
public static AxisServiceGroup loadServiceGroup(File serviceFile,
                                                ConfigurationContext configCtx)
        throws AxisFault {
    try {
        DeploymentFileData currentDeploymentFile = new DeploymentFileData(serviceFile, null);
        DeploymentClassLoader classLoader = Utils.createClassLoader(serviceFile,
                configCtx.getAxisConfiguration().isChildFirstClassLoading());
        currentDeploymentFile.setClassLoader(classLoader);
        AxisServiceGroup serviceGroup = new AxisServiceGroup();
        serviceGroup.setServiceGroupClassLoader(classLoader);

        // Drop the extension and take the name
        String fileName = serviceFile.getName();
        String serviceGroupName = fileName.substring(0, fileName.lastIndexOf("."));
        serviceGroup.setServiceGroupName(serviceGroupName);
        AxisConfiguration axisConfig = configCtx.getAxisConfiguration();

        ArchiveReader archiveReader = new ArchiveReader();
        HashMap wsdlServices = archiveReader.processWSDLs(currentDeploymentFile);
        InputStream serviceXml = classLoader.getResourceAsStream("META-INF/services.xml");
        ArrayList serviceList = archiveReader.buildServiceGroup(serviceXml,
                currentDeploymentFile,
                serviceGroup,
                wsdlServices, configCtx);
        fillServiceGroup(serviceGroup, serviceList, null, axisConfig);
        return serviceGroup;
    } catch (Exception e) {
        throw new DeploymentException(e);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:31,代码来源:DeploymentEngine.java


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