org.apache.axis2.deployment.util.Utils.getClassLoader()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中org.apache.axis2.deployment.util.Utils.getClassLoader()方法的一些代码示例,展示了Utils.getClassLoader()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.getClassLoader()方法的具体详情如下:
包路径:org.apache.axis2.deployment.util.Utils
类名称:Utils
方法名:getClassLoader

Utils.getClassLoader介绍

[英]Get a ClassLoader which contains a classpath of a) the passed directory and b) any jar files inside the "lib/" or "Lib/" subdirectory of the passed directory.
[中]获取一个类加载器,其中包含a)传递的目录的类路径和b)传递的目录的“lib/”或“lib/”子目录中的任何jar文件。

代码示例

代码示例来源:origin: apache/axis2-java

public static ClassLoader getClassLoader(ClassLoader parent, String path, boolean isChildFirstClassLoading)
    throws DeploymentException {
  return getClassLoader(parent, new File(path), isChildFirstClassLoading);
}

代码示例来源:origin: org.apache.axis2/axis2-kernel

public static ClassLoader getClassLoader(ClassLoader parent, String path, boolean isChildFirstClassLoading)
    throws DeploymentException {
  return getClassLoader(parent, new File(path), isChildFirstClassLoading);
}

代码示例来源:origin: apache/axis2-java

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()));
        }
        classLoader = Utils.createClassLoader(this.file.toURI().toURL(), null, parent, file, isChildFirstClassLoading);
      } catch (Exception e) {
        throw AxisFault.makeFault(e);
      }
    }
  } else {
    if (this.file != null) {
      classLoader = Utils.getClassLoader(parent, this.file, isChildFirstClassLoading);
    }
  }
}

代码示例来源:origin: org.apache.axis2/axis2-kernel

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.toURI().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);
    }
  }
}

代码示例来源:origin: wso2/wso2-synapse

/**
 * This will be called when there is a change in the specified deployment
 * folder (in the axis2.xml) and this will register class loader into the deployement store
 *
 * @param deploymentFileData - describes the updated file
 * @throws DeploymentException - in case an error on the deployment
 */
public void deploy(DeploymentFileData deploymentFileData) throws DeploymentException {
  String mediatorPath = FilenameUtils.normalize(deploymentFileData.getAbsolutePath());
  log.info("Deploying Class mediators from file : " + mediatorPath);
  ClassLoader mediatorLoader = Utils.getClassLoader(ClassMediatorDeployer.class.getClassLoader(),
                           mediatorPath, false);
  getDeploymentStore().addClassMediatorClassLoader(mediatorPath, mediatorLoader);
}

代码示例来源:origin: org.apache.axis2/axis2-kernel

if (axisConfig.getSystemClassLoader() == null) {
  ClassLoader sysClassLoader =
      Utils.getClassLoader(Thread.currentThread().getContextClassLoader(), axis2repoURI,
          axisConfig.isChildFirstClassLoading());
      Utils.getClassLoader(axisConfig.getSystemClassLoader(), servicesDir,
          axisConfig.isChildFirstClassLoading()));
} else {
  axisConfig.setModuleClassLoader(Utils.getClassLoader(axisConfig.getSystemClassLoader(),
      modulesDir,
      axisConfig.isChildFirstClassLoading()));

代码示例来源:origin: apache/axis2-java

if (axisConfig.getSystemClassLoader() == null) {
  ClassLoader sysClassLoader =
      Utils.getClassLoader(Thread.currentThread().getContextClassLoader(), axis2repoURI,
          axisConfig.isChildFirstClassLoading());
      Utils.getClassLoader(axisConfig.getSystemClassLoader(), servicesDir,
          axisConfig.isChildFirstClassLoading()));
} else {
  axisConfig.setModuleClassLoader(Utils.getClassLoader(axisConfig.getSystemClassLoader(),
      modulesDir,
      axisConfig.isChildFirstClassLoading()));

代码示例来源:origin: org.apache.synapse/synapse-core

public static Library createSynapseLibrary(String libPath) {
  createDir(APP_UNZIP_DIR);
  String libFilePath = LibDeployerUtils.formatPath(libPath);
  //extract
  String extractPath = LibDeployerUtils.extractSynapseLib(libFilePath);
  //create synapse lib metadata
  SynapseLibrary synapseLib = LibDeployerUtils.populateDependencies(extractPath +
                                   LibDeployerConstants.ARTIFACTS_XML);
  //create a ClassLoader for loading this synapse lib classes/resources
  try {
    ClassLoader libLoader = Utils.getClassLoader(LibDeployerUtils.class.getClassLoader(),
                           extractPath, false);
    synapseLib.setLibClassLoader(libLoader);
  } catch (DeploymentException e) {
    throw new SynapseArtifactDeploymentException("Error setting up lib classpath for Synapse" +
                           " Library  : " + libFilePath, e);
  }
  //resolve synapse lib artifacts
  LibDeployerUtils.searchAndResolveDependencies(extractPath, synapseLib);
  return synapseLib;
}

代码示例来源:origin: wso2/wso2-synapse

public static Library createSynapseLibrary(String libPath) {
  String libFilePath = LibDeployerUtils.formatPath(libPath);
  //extract
  String extractPath = LibDeployerUtils.extractSynapseLib(libFilePath);
  //create synapse lib metadata
  SynapseLibrary synapseLib = LibDeployerUtils.populateDependencies(extractPath +
                                   LibDeployerConstants.ARTIFACTS_XML);
  //create a ClassLoader for loading this synapse lib classes/resources
  try {
    ClassLoader libLoader = Utils.getClassLoader(LibDeployerUtils.class.getClassLoader(),
                           extractPath, false);
    synapseLib.setLibClassLoader(libLoader);
  } catch (DeploymentException e) {
    throw new SynapseArtifactDeploymentException("Error setting up lib classpath for Synapse" +
                           " Library  : " + libFilePath, e);
  }
  //resolve synapse lib artifacts
  LibDeployerUtils.searchAndResolveDependencies(extractPath, synapseLib);
  
  //TODO:reslove local-entry references
  LibDeployerUtils.populateLocalEnties(synapseLib,extractPath+LibDeployerConstants.LOCAL_ENTRIES);
  
  synapseLib.setFileName(libFilePath);
  return synapseLib;
}

代码示例来源:origin: org.apache.axis2/axis2-kernel

File parentFile = file.getParentFile();
ClassLoader classLoader =
    Utils.getClassLoader(configCtx.getAxisConfiguration().
        getSystemClassLoader(), parentFile,
        configCtx.getAxisConfiguration().isChildFirstClassLoading());

代码示例来源:origin: apache/axis2-java

File parentFile = file.getParentFile();
ClassLoader classLoader =
    Utils.getClassLoader(configCtx.getAxisConfiguration().
        getSystemClassLoader(), parentFile,
        configCtx.getAxisConfiguration().isChildFirstClassLoading());

相关文章