Mercurial > dive4elements > framework
diff artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactFactory.java @ 90:68285f7bc476
More javadoc.
artifacts/trunk@846 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 26 Mar 2010 17:59:50 +0000 |
parents | b2e0cb83631c |
children | 730ff077a58c |
line wrap: on
line diff
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactFactory.java Fri Mar 26 16:16:32 2010 +0000 +++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/DefaultArtifactFactory.java Fri Mar 26 17:59:50 2010 +0000 @@ -9,6 +9,12 @@ import de.intevation.artifacts.ArtifactSerializer; /** + * Trivial implementation of the ArtifactFactory interface. + * Time to live (ttl), name and description are configured + * via the Node given to #setup(Document, Node) with attributes + * of same name. The class name of the artifacts to be build by this + * factory is configures with the attribute 'artifact'. + * * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> */ public class DefaultArtifactFactory @@ -17,25 +23,60 @@ private static Logger logger = Logger.getLogger(DefaultArtifactFactory.class); + /** + * XPath to access the TTL of this artifact. + */ public static final String XPATH_TTL = "@ttl"; + /** + * XPath to access the name of this factory. + */ public static final String XPATH_NAME = "@name"; + /** + * XPath to access the description of this artifact factory. + */ public static final String XPATH_DESCRIPTION = "@description"; + /** + * XPath to access the class name of the artifacts to be build + * by this factory. + */ public static final String XPATH_ARTIFACT = "@artifact"; + /** + * Default description of this factory if none is given by the + * configuration. + */ public static final String DEFAULT_DESCRIPTION = "No description available"; + /** + * Class to load if no artifact class is given in the configuration. + */ public static final String DEFAULT_ARTIFACT = "de.intevation.artifactdatabase.DefaultArtifact"; + /** + * The Time to live of the artifacts build by this factory. + */ protected Long ttl; + /** + * The name of this factory. + */ protected String name; + /** + * The description of this factory. + */ protected String description; + /** + * The class of the artifacts to be build by this factory. + */ protected Class artifactClass; + /** + * Default constructor. + */ public DefaultArtifactFactory() { } @@ -47,10 +88,11 @@ return description; } - public Artifact createArtifact(String identifier, - Object context, - Document data) { - + public Artifact createArtifact( + String identifier, + Object context, + Document data + ) { try { Artifact artifact = (Artifact)artifactClass.newInstance();