Griffon 0.9.5-rc2

griffon.core
[Java] Interface ArtifactManager

griffon.core.ApplicationHandler
  griffon.core.ArtifactManager
All Superinterfaces:
ApplicationHandler

public interface ArtifactManager
extends ApplicationHandler

Helper class capable of dealing with artifacts and their handlers.

Authors:
Andres Almiray


Field Summary
GriffonClass[] EMPTY_GRIFFON_CLASS_ARRAY

List EMPTY_GRIFFON_CLASS_LIST

 
Method Summary
GriffonClass findGriffonClass(String name, String type)

Finds an artifact by name and type.

GriffonClass findGriffonClass(Class clazz, String type)

Finds an artifact by class and type.

GriffonClass findGriffonClass(Object obj)

Finds an artifact by class.

GriffonClass findGriffonClass(Class clazz)

Finds an artifact by class.

GriffonClass findGriffonClass(String fqnClassName)

Finds an artifact by name.

List getAllClasses()

Finds all artifact classes.

List getClassesOfType(String type)

Finds all artifacts of an specific type.

void loadArtifactMetadata()

Reads the artifacts definitions file from the classpath.

void registerArtifactHandler(ArtifactHandler handler)

Registers an ArtifactHandler by type.

void unregisterArtifactHandler(ArtifactHandler handler)

Removes an ArtifactHandler by type.

 
Methods inherited from interface ApplicationHandler
getApp
 

Field Detail

EMPTY_GRIFFON_CLASS_ARRAY

public GriffonClass[] EMPTY_GRIFFON_CLASS_ARRAY


EMPTY_GRIFFON_CLASS_LIST

public List EMPTY_GRIFFON_CLASS_LIST


 
Method Detail

findGriffonClass

public GriffonClass findGriffonClass(String name, String type)
Finds an artifact by name and type.

Example: findGriffonClass("Book", "controller") will return an artifact class that describes BookController.

Parameters:
name - the name of the artifact, e.g. 'Book'
type - the type of the artifact, e.g. 'controller'
Returns:
the GriffonClass associated with the artifact is there's a match, null otherwise.


findGriffonClass

public GriffonClass findGriffonClass(Class clazz, String type)
Finds an artifact by class and type.

Example: findGriffonClass(BookController, "controller") will return an artifact class that describes BookController.

Parameters:
clazz - the name of the artifact, e.g. com.acme.BookController
type - the type of the artifact, e.g. 'controller'
Returns:
the GriffonClass associated with the artifact is there's a match, null otherwise.


findGriffonClass

public GriffonClass findGriffonClass(Object obj)
Finds an artifact by class.

Example: findGriffonClass(aBookControllerInstance) will return an artifact class that describes BookController.

Parameters:
obj - an artifact instance
Returns:
the GriffonClass associated with the artifact is there's a match, null otherwise.


findGriffonClass

public GriffonClass findGriffonClass(Class clazz)
Finds an artifact by class.

Example: findGriffonClass(BookController) will return an artifact class that describes BookController.

Parameters:
clazz - a Class instance
Returns:
the GriffonClass associated with the artifact is there's a match, null otherwise.


findGriffonClass

public GriffonClass findGriffonClass(String fqnClassName)
Finds an artifact by name.

Example: findGriffonClass("BookController") will return an artifact class that describes BookController.

Parameters:
fqnClassName - full qualified class name
Returns:
the GriffonClass associated with the artifact is there's a match, null otherwise.


getAllClasses

public List getAllClasses()
Finds all artifact classes.

Returns:
a List of all available GriffonClass instances. Never returns null.


getClassesOfType

public List getClassesOfType(String type)
Finds all artifacts of an specific type.

Example: getClassesOfType("controller") will return all artifact classes that describe controllers.

Parameters:
type - an artifact type, e.g. 'controller'
Returns:
a List of matching artifacts or an empty List if no match. Never returns null.


loadArtifactMetadata

public void loadArtifactMetadata()
Reads the artifacts definitions file from the classpath.

Should call initialize() on artifact handlers if there are any registered already.


registerArtifactHandler

public void registerArtifactHandler(ArtifactHandler handler)
Registers an ArtifactHandler by type.

Should call initialize() on the handler.

Parameters:
handler - an ArtifactHandler


unregisterArtifactHandler

public void unregisterArtifactHandler(ArtifactHandler handler)
Removes an ArtifactHandler by type.
Parameters:
handler - an ArtifactHandler


 

Groovy Documentation