Example #1
0
 /*
  * (non-Javadoc)
  * @see org.xmeta.ThingManager#getThings()
  */
 public List<Thing> getThings(String categoryName) {
   Category category = getCategory(categoryName);
   if (category != null) {
     return category.getThings();
   } else {
     return null;
   }
 }
Example #2
0
 @Override
 public List<Thing> getThings(String categoryName, String descriptorPath) {
   Category category = getCategory(categoryName);
   if (category != null) {
     return category.getThings(descriptorPath);
   } else {
     return null;
   }
 }
Example #3
0
  /**
   * 刷新父目录,在创建或删除目录时使用。
   *
   * @param categoryName
   */
  public void refreshParentCategory(String categoryName) {
    if (categoryName == null || "".equals(categoryName)) {
      rootCategory.refresh();
    }

    int index = categoryName.lastIndexOf(".");
    if (index != -1) {
      String name = categoryName.substring(0, index);
      Category category = this.getCategory(name);
      if (category != null) {
        category.refresh();
      } else {
        refreshParentCategory(name);

        category = this.getCategory(name);
        if (category != null) {
          category.refresh();
        }
      }
    }
  }
Example #4
0
  /*
   * (non-Javadoc)
   * @see org.xmeta.ThingFactory#getCategory(java.lang.String)
   */
  public Category getCategory(String categoryName) {
    if (categoryName == null || "".equals(categoryName)) {
      return rootCategory;
    }

    Category pkg = rootCategory;

    for (String pkName : categoryName.split("[.]")) {
      Category childPkg = pkg.getCategory(pkName);
      if (childPkg == null) {
        // pkg.refresh();
        pkg = pkg.getCategory(pkName);
      } else {
        pkg = childPkg;
      }
      if (pkg == null) {
        return null;
      }
    }

    return pkg;
  }
Example #5
0
 /*
  * (non-Javadoc)
  * @see org.xmeta.ThingManager#refresh(java.lang.String)
  */
 public void refresh(String categoryName, boolean includeChildCategory) {
   Category category = getCategory(categoryName);
   if (category != null) {
     category.refresh(includeChildCategory);
   }
 }
Example #6
0
 /*
  * (non-Javadoc)
  * @see org.xmeta.ThingManager#iterator(java.lang.String, java.lang.String, boolean)
  */
 public Iterator<Thing> iterator(
     final String categoryName, final String descriptorPath, final boolean includeChildCategory) {
   Category category = getCategory(categoryName);
   return category.iterator(descriptorPath, includeChildCategory);
 }
Example #7
0
 /*
  * (non-Javadoc)
  * @see org.xmeta.ThingFactory#getCategorys()
  */
 public List<Category> getCategorys() {
   return rootCategory.getCategorys();
 }