All Downloads are FREE. Search and download functionalities are using the official Maven repository.

brooklyn.catalog.BrooklynCatalog Maven / Gradle / Ivy

package brooklyn.catalog;

import com.google.common.base.Predicate;

public interface BrooklynCatalog {

    /** finds the item with the given ID, or null if not found */
    CatalogItem getCatalogItem(String id);
    
    /** variant of {@link #getCatalogItem(String)} which checks (and casts) type for convenience
     * (returns null if type does not match) */
     CatalogItem getCatalogItem(Class type, String id);
    
    /** returns all items in the catalog */
     Iterable> getCatalogItems();
    /** convenience for filtering items in the catalog; see CatalogPredicates for useful filters */
     Iterable> getCatalogItems(Predicate> filter);

    /** returns the classloader which should be used to load classes and entities;
     * this includes all the catalog's classloaders in the right order */
    public ClassLoader getRootClassLoader();
    
    /** throws exceptions if any problems */
     Class loadClass(CatalogItem item);
     Class loadClassByType(String typeName, Class typeClass);
    
    /** adds an item to the 'manual' catalog;
     * this does not update the classpath or have a record to the java Class,
     * so callers of this method will typically also need to call 
     * {@link #addToClasspath(String)} or {@link #addToClasspath(ClassLoader)} */
    void addItem(CatalogItem item);
    
    /** creates a catalog item and adds it to the 'manual' catalog,
     * with the corresponding Class definition (loaded by a classloader)
     * registered and available in the classloader.
     * 

* note that the class will be available for this session only, * although the record of the item will appear in the catalog DTO if exported, * so it is recommended to edit the 'manual' catalog DTO if using it to * generate a catalog, either adding the appropriate classpath URL or removing this entry. */ CatalogItem addItem(Class clazz); /** adds a classpath entry which will be used by the 'manual' catalog */ void addToClasspath(ClassLoader loader); /** adds a classpath entry which will be used by the 'manual' catalog */ void addToClasspath(String url); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy