コード例 #1
1
ファイル: SystemUtil.java プロジェクト: adamcameron/Lucee4
  /** @return returns a string list of all pathes */
  public static Resource[] getClassPathes() {

    if (classPathes != null) return classPathes;

    ArrayList pathes = new ArrayList();
    String pathSeperator = System.getProperty("path.separator");
    if (pathSeperator == null) pathSeperator = ";";

    // java.ext.dirs
    ResourceProvider frp = ResourcesImpl.getFileResourceProvider();

    // pathes from system properties
    String strPathes = System.getProperty("java.class.path");
    if (strPathes != null) {
      Array arr = ListUtil.listToArrayRemoveEmpty(strPathes, pathSeperator);
      int len = arr.size();
      for (int i = 1; i <= len; i++) {
        Resource file = frp.getResource(Caster.toString(arr.get(i, ""), "").trim());
        if (file.exists()) pathes.add(ResourceUtil.getCanonicalResourceEL(file));
      }
    }

    // pathes from url class Loader (dynamic loaded classes)
    ClassLoader cl = new Info().getClass().getClassLoader();
    if (cl instanceof URLClassLoader) getClassPathesFromClassLoader((URLClassLoader) cl, pathes);

    return classPathes = (Resource[]) pathes.toArray(new Resource[pathes.size()]);
  }
コード例 #2
0
ファイル: Search.java プロジェクト: dajester2013/Lucee
 /**
  * set the value collection The logical collection name that is the target of the search operation
  * or an external collection with fully qualified path.
  *
  * @param collection value to set
  * @throws PageException
  */
 public void setCollection(String collection) throws PageException {
   String[] collNames =
       ListUtil.toStringArrayTrim(ListUtil.listToArrayRemoveEmpty(collection, ','));
   collections = new SearchCollection[collNames.length];
   SearchEngine se = pageContext.getConfig().getSearchEngine(pageContext);
   try {
     for (int i = 0; i < collections.length; i++) {
       collections[i] = se.getCollectionByName(collNames[i]);
     }
   } catch (SearchException e) {
     collections = null;
     throw Caster.toPageException(e);
   }
 }