Examples of XClassLoaderConfiguration


Examples of org.openbp.common.classloader.XClassLoaderConfiguration

  private ClassLoader obtainPluginClassLoader(Resource r, String pluginName)
  {
    ClassLoader cl = getClassLoader();
    if (r instanceof FileSystemResource)
    {
      XClassLoaderConfiguration config = new XClassLoaderConfiguration();
      config.setName("Plugin '" + pluginName + "' class loader");
      config.setParentClassLoader(cl);
      config.setLoggingEnabled(false);

      FilenameFilter fnf = new FilenameFilter()
      {
        public boolean accept(File dir, String name)
        {
          return name.endsWith(".jar");
        }
      };
      File pluginDir = null;
      try
      {
        pluginDir = r.getFile().getParentFile();
        File [] jars = pluginDir.listFiles(fnf);
        for (int i = 0; i < jars.length; ++i)
        {
          config.addRepository(jars[i].getAbsolutePath());
          LogUtil.info(getClass(), "Loading repository for plugin $0: $1.", pluginName, jars[i]);
        }

        cl = new XClassLoader(config);
      }
View Full Code Here

Examples of org.openbp.common.classloader.XClassLoaderConfiguration

    ClassLoader classLoader = getClass().getClassLoader();
    String classesDir = Application.getRootDir() + StringUtil.FOLDER_SEP + CockpitConstants.GENERATOR + StringUtil.FOLDER_SEP + "classes";
    if (new File(classesDir).isDirectory())
    {
      // Generator classes directory exists, set up class loader
      XClassLoaderConfiguration config = new XClassLoaderConfiguration();
      config.setName("Generator template class loader");
      config.setParentClassLoader(getClass().getClassLoader());
      config.addRepository(classesDir);
      try
      {
        classLoader = new XClassLoader(config);
      }
      catch (Exception e)
View Full Code Here

Examples of org.openbp.common.classloader.XClassLoaderConfiguration

    throws Exception
  {
    // Use the class load that loaded the ModelImpl class as parent class loader of the model.
    ClassLoader parentClassLoader = model.getClass().getClassLoader();

    XClassLoaderConfiguration config = new XClassLoaderConfiguration();

    addClassesDir(config, model, ModelLocationUtil.DIR_CLASSES);
    addLibDir(config, model, ModelLocationUtil.DIR_LIB);
    addLibDir(config, model, ModelLocationUtil.DIR_EXTLIB);

    if (config.getRepositories().size() == 0)
    {
      // Nothing in repository, so use regular CL
      return parentClassLoader;
    }

    // Set the name of the class loader.
    String qualifier = model.getQualifier().toString();
    qualifier = qualifier.replace(ModelQualifier.PATH_DELIMITER_CHAR, '.');
    config.setName("Model" + qualifier);
    config.setParentClassLoader(parentClassLoader);

    // Create a class loader for this model
    return new ModelClassLoader(config, model);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.