public abstract class AbstractArtifactManager extends Object implements ArtifactManager
ArtifactManager interface.| Modifier and Type | Field and Description | 
|---|---|
protected static String | 
ERROR_ARTIFACT_HANDLER_NULL  | 
EMPTY_GRIFFON_CLASS_LIST| Constructor and Description | 
|---|
AbstractArtifactManager()  | 
| Modifier and Type | Method and Description | 
|---|---|
protected abstract Map<String,List<Class<? extends GriffonArtifact>>> | 
doLoadArtifactMetadata()  | 
<A extends GriffonArtifact> | 
findGriffonClass(A artifact)
Finds an artifact by class. 
 | 
GriffonClass | 
findGriffonClass(Class<? extends GriffonArtifact> clazz)
Finds an artifact by class. 
 | 
GriffonClass | 
findGriffonClass(Class<? extends GriffonArtifact> clazz,
                String type)
Finds an artifact by class and type. 
 | 
GriffonClass | 
findGriffonClass(String fqClassName)
Finds an artifact by name. 
 | 
GriffonClass | 
findGriffonClass(String name,
                String type)
Finds an artifact by name and type. 
 | 
List<GriffonClass> | 
getAllClasses()
Finds all artifact classes. 
 | 
Set<String> | 
getAllTypes()
Finds all supported artifact types. 
 | 
protected Map<String,ArtifactHandler> | 
getArtifactHandlers()  | 
List<GriffonClass> | 
getClassesOfType(String type)
Finds all artifacts of an specific type. 
 | 
protected boolean | 
isArtifactTypeSupported(String type)  | 
protected <A extends GriffonArtifact> | 
isClassOfType(String type,
             Class<A> clazz)  | 
void | 
loadArtifactMetadata()
Reads the artifacts definitions file from the classpath. 
 | 
<A extends GriffonArtifact> | 
newInstance(Class<A> clazz)
Creates a new instance of the specified class and type. 
Triggers the ApplicationEvent.NEW_INSTANCE with the following parameters clazz - the Class of the object instance -> the object that was created  | 
<A extends GriffonArtifact> | 
newInstance(GriffonClass griffonClass)
Creates a new instance of the specified class and type. 
Triggers the ApplicationEvent.NEW_INSTANCE with the following parameters clazz - the Class of the object instance -> the object that was created  | 
void | 
registerArtifactHandler(ArtifactHandler artifactHandler)
Registers an ArtifactHandler by type. 
 | 
void | 
unregisterArtifactHandler(ArtifactHandler artifactHandler)
Removes an ArtifactHandler by type. 
 | 
protected static final String ERROR_ARTIFACT_HANDLER_NULL
@Nonnull protected Map<String,ArtifactHandler> getArtifactHandlers()
public final void loadArtifactMetadata()
ArtifactManagerShould call initialize() on artifact handlers if there are any registered already.
loadArtifactMetadata in interface ArtifactManager@Nonnull public Set<String> getAllTypes()
ArtifactManagergetAllTypes in interface ArtifactManager@Nonnull public <A extends GriffonArtifact> A newInstance(@Nonnull GriffonClass griffonClass)
ArtifactManagernewInstance in interface ArtifactManagergriffonClass - the GriffonClass for which an instance must be created@Nonnull public <A extends GriffonArtifact> A newInstance(@Nonnull Class<A> clazz)
ArtifactManagernewInstance in interface ArtifactManagerclazz - the Class for which an instance must be created@Nonnull protected abstract Map<String,List<Class<? extends GriffonArtifact>>> doLoadArtifactMetadata()
public void registerArtifactHandler(@Nonnull ArtifactHandler artifactHandler)
ArtifactManagerShould call initialize() on the handler.
registerArtifactHandler in interface ArtifactManagerartifactHandler - an ArtifactHandlerpublic void unregisterArtifactHandler(@Nonnull ArtifactHandler artifactHandler)
ArtifactManagerunregisterArtifactHandler in interface ArtifactManagerartifactHandler - an ArtifactHandler@Nullable public GriffonClass findGriffonClass(@Nonnull String name, @Nonnull String type)
ArtifactManagerExample: findGriffonClass("Book", "controller") will return an artifact class that describes BookController.
findGriffonClass in interface ArtifactManagername - the name of the artifact, e.g. 'Book'type - the type of the artifact, e.g. 'controller'@Nullable public GriffonClass findGriffonClass(@Nonnull Class<? extends GriffonArtifact> clazz, @Nonnull String type)
ArtifactManagerExample: findGriffonClass(BookController, "controller") will return an artifact class that describes BookController.
findGriffonClass in interface ArtifactManagerclazz - the name of the artifact, e.g. com.acme.BookControllertype - the type of the artifact, e.g. 'controller'@Nullable public <A extends GriffonArtifact> GriffonClass findGriffonClass(@Nonnull A artifact)
ArtifactManagerExample: findGriffonClass(aBookControllerInstance) will return an artifact class that describes BookController.
findGriffonClass in interface ArtifactManagerartifact - an artifact instance@Nullable public GriffonClass findGriffonClass(@Nonnull Class<? extends GriffonArtifact> clazz)
ArtifactManagerExample: findGriffonClass(BookController) will return an artifact class that describes BookController.
findGriffonClass in interface ArtifactManagerclazz - a Class instance@Nullable public GriffonClass findGriffonClass(@Nonnull String fqClassName)
ArtifactManagerExample: findGriffonClass("BookController") will return an artifact class that describes BookController.
findGriffonClass in interface ArtifactManagerfqClassName - full qualified class name@Nonnull public List<GriffonClass> getClassesOfType(@Nonnull String type)
ArtifactManagerExample: getClassesOfType("controller") will return all artifact classes that describe controllers.
getClassesOfType in interface ArtifactManagertype - an artifact type, e.g. 'controller'@Nonnull public List<GriffonClass> getAllClasses()
ArtifactManagergetAllClasses in interface ArtifactManagerprotected <A extends GriffonArtifact> boolean isClassOfType(@Nonnull String type, @Nonnull Class<A> clazz)