コード例 #1
0
  protected Map<?, ?> getRenderingConfigurationFor(String catalogId) {
    MutableMap<Object, Object> result = MutableMap.of();
    CatalogItem<?> item = mgmt.getCatalog().getCatalogItem(catalogId);
    if (item == null) return result;

    result.addIfNotNull("iconUrl", item.getIconUrl());
    return result;
  }
コード例 #2
0
  @SuppressWarnings("unchecked")
  public static <T> Maybe<Class<T>> tryLoadFromClasspath(String typeName, ManagementContext mgmt) {
    Class<T> clazz;
    try {
      clazz = (Class<T>) mgmt.getCatalog().getRootClassLoader().loadClass(typeName);
    } catch (ClassNotFoundException e) {
      LOG.debug("Class {} not found on classpath", typeName);
      return Maybe.absent(new Throwable("Could not find " + typeName + " on classpath"));
    }

    return Maybe.<Class<T>>of(clazz);
  }
コード例 #3
0
 @SuppressWarnings("unchecked")
 public static <T extends Entity> Maybe<Class<T>> tryLoadEntityFromCatalogue(
     String entityTypeName, ManagementContext mgmt) {
   try {
     return (Maybe<Class<T>>)
         (Maybe<?>)
             Maybe.<Class<? extends Entity>>of(
                 mgmt.getCatalog().loadClassByType(entityTypeName, Entity.class));
   } catch (NoSuchElementException e) {
     LOG.debug("Class {} not found in catalogue classpath", entityTypeName);
     return Maybe.absent();
   }
 }
コード例 #4
0
 public BrooklynCatalog getCatalog() {
   return mgmt.getCatalog();
 }