public abstract class AbstractArtifactManager extends java.lang.Object implements ArtifactManager
ArtifactManager interface.| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
ERROR_ARTIFACT_HANDLER_NULL |
EMPTY_GRIFFON_CLASS_LIST| Constructor and Description |
|---|
AbstractArtifactManager() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract java.util.Map<java.lang.String,java.util.List<java.lang.Class<? extends GriffonArtifact>>> |
doLoadArtifactMetadata() |
<A extends GriffonArtifact> |
findGriffonClass(A artifact)
Finds an artifact by class.
|
GriffonClass |
findGriffonClass(java.lang.Class<? extends GriffonArtifact> clazz)
Finds an artifact by class.
|
GriffonClass |
findGriffonClass(java.lang.Class<? extends GriffonArtifact> clazz,
java.lang.String type)
Finds an artifact by class and type.
|
GriffonClass |
findGriffonClass(java.lang.String fqClassName)
Finds an artifact by name.
|
GriffonClass |
findGriffonClass(java.lang.String name,
java.lang.String type)
Finds an artifact by name and type.
|
java.util.List<GriffonClass> |
getAllClasses()
Finds all artifact classes.
|
java.util.Set<java.lang.String> |
getAllTypes()
Finds all supported artifact types.
|
protected java.util.Map<java.lang.String,ArtifactHandler> |
getArtifactHandlers() |
java.util.List<GriffonClass> |
getClassesOfType(java.lang.String type)
Finds all artifacts of an specific type.
|
protected boolean |
isArtifactTypeSupported(java.lang.String type) |
protected <A extends GriffonArtifact> |
isClassOfType(java.lang.String type,
java.lang.Class<A> clazz) |
void |
loadArtifactMetadata()
Reads the artifacts definitions file from the classpath.
|
<A extends GriffonArtifact> |
newInstance(java.lang.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 java.lang.String ERROR_ARTIFACT_HANDLER_NULL
@Nonnull protected java.util.Map<java.lang.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 java.util.Set<java.lang.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 java.lang.Class<A> clazz)
ArtifactManagernewInstance in interface ArtifactManagerclazz - the Class for which an instance must be created@Nonnull protected abstract java.util.Map<java.lang.String,java.util.List<java.lang.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 ArtifactHandlerprotected boolean isArtifactTypeSupported(@Nonnull
java.lang.String type)
@Nullable public GriffonClass findGriffonClass(@Nonnull java.lang.String name, @Nonnull java.lang.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 java.lang.Class<? extends GriffonArtifact> clazz, @Nonnull java.lang.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 java.lang.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 java.lang.String fqClassName)
ArtifactManagerExample: findGriffonClass("BookController") will return an artifact class that describes BookController.
findGriffonClass in interface ArtifactManagerfqClassName - full qualified class name@Nonnull public java.util.List<GriffonClass> getClassesOfType(@Nonnull java.lang.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 java.util.List<GriffonClass> getAllClasses()
ArtifactManagergetAllClasses in interface ArtifactManagerprotected <A extends GriffonArtifact> boolean isClassOfType(@Nonnull java.lang.String type, @Nonnull java.lang.Class<A> clazz)