KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xdoclet > modules > oracle > oc4j > ejb > OC4JSubTask


1 /*
2  * Copyright (c) 2001, 2002 The XDoclet team
3  * All rights reserved.
4  */

5 package xdoclet.modules.oracle.oc4j.ejb;
6
7 import xdoclet.XDocletException;
8 import xdoclet.XDocletMessages;
9 import xdoclet.modules.ejb.dd.AbstractEjbDeploymentDescriptorSubTask;
10 import xdoclet.util.Translator;
11
12 /**
13  * Generates OC4J specific deployment descriptor (orion-ejb-jar.xml).
14  *
15  * @author <a HREF="mailto:elango@users.sourceforge.net">Elango</a>
16  * @created April 6, 2003
17  * @ant.element display-name="OC4J" name="oc4j" parent="xdoclet.modules.ejb.EjbDocletTask"
18  * @version $Revision: 1.2 $
19  * @xdoclet.merge-file file="oc4j-{0}.xml" relates-to="orion-ejb-jar.xml" description="An XML document containing the
20  * session-deployment, entity-deployment or message-driven-deployment element for a bean, instead of generating it
21  * from tags."
22  * @xdoclet.merge-file file="oc4j-beans.ent" relates-to="orion-ejb-jar.xml" description="An XML unparsed entity
23  * containing the session-deployment, entity-deployment or message-driven-deployment elements for beans you wish to
24  * include which aren't processed by XDoclet."
25  * @xdoclet.merge-file file="oc4j-{0}-attributes.xml" relates-to="orion-ejb-jar.xml" description="A text file
26  * containing any attributes for a bean's session-deployment, entity-deployment or message-driven-deployment
27  * element not specified using oc4j.bean tag parameters."
28  * @xdoclet.merge-file file="oc4j-{0}-settings.xml" relates-to="orion-ejb-jar.xml" description="An XML unparsed entity
29  * containing the (env-entry-mapping*, ejb-ref-mapping*, resource-ref-mapping*, resource-env-ref-mapping*) elements
30  * for a bean."
31  * @xdoclet.merge-file file="oc4j-assembly-descriptor.xml" relates-to="orion-ejb-jar.xml" description="An XML document
32  * containing the assembly-descriptor element for orion-ejb-jar.xml."
33  */

34 public class OC4JSubTask extends AbstractEjbDeploymentDescriptorSubTask
35 {
36     private final static String JavaDoc OC4J_DD_FILE_NAME = "orion-ejb-jar.xml";
37
38     private final static String JavaDoc OC4J_DD_PUBLICID = "-//Evermind//DTD Enterprise JavaBeans 1.1 runtime//EN";
39
40     private final static String JavaDoc OC4J_DD_SYSTEMID = "http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd";
41
42     private final static String JavaDoc OC4J_DTD_FILE_NAME = "resources/orion-ejb-jar.dtd";
43
44     private static String JavaDoc DEFAULT_TEMPLATE_FILE = "resources/oc4j.xdt";
45
46     private String JavaDoc deploymentVersion = OC4JVersionTypes.VERSION_9_0_3;
47
48     /**
49      * Default Constructor.
50      */

51     public OC4JSubTask()
52     {
53         setTemplateURL(getClass().getResource(DEFAULT_TEMPLATE_FILE));
54         setDestinationFile(OC4J_DD_FILE_NAME);
55         setPublicId(OC4J_DD_PUBLICID);
56         setSystemId(OC4J_DD_SYSTEMID);
57         setDtdURL(getClass().getResource(OC4J_DTD_FILE_NAME));
58     }
59
60     /**
61      * Gets the Version attribute of the OC4JSubTask object
62      *
63      * @return The Version value
64      */

65     public String JavaDoc getVersion()
66     {
67         return this.deploymentVersion;
68     }
69
70     /**
71      * Sets the Version attribute of the OC4JSubTask object
72      *
73      * @param deploymentVersion The new Version value
74      */

75     public void setVersion(OC4JVersionTypes deploymentVersion)
76     {
77         this.deploymentVersion = deploymentVersion.getValue();
78     }
79
80     /**
81      * Output the processing file name.
82      *
83      * @exception XDocletException
84      */

85     protected void engineStarted() throws XDocletException
86     {
87
88         if (getDestinationFile().equals(OC4J_DD_FILE_NAME)) {
89             System.out.println(Translator.getString(XDocletMessages.class, XDocletMessages.GENERATING_SOMETHING, new String JavaDoc[]{OC4J_DD_FILE_NAME}));
90         }
91
92     }
93
94     /**
95      * @author <a HREF="mailto:itselango@yahoo.com">Elango</a>
96      * @created April 6, 2003
97      */

98     public static class OC4JVersionTypes extends org.apache.tools.ant.types.EnumeratedAttribute
99     {
100         public final static String JavaDoc VERSION_9_0_3 = "9.0.3.0.0";
101         public final static String JavaDoc VERSION_9_0_4 = "9.0.4.0.0";
102
103         /**
104          * Gets the Values attribute of the OC4JVersionTypes object
105          *
106          * @return The Values value
107          */

108         public String JavaDoc[] getValues()
109         {
110             return (new String JavaDoc[]{VERSION_9_0_3, VERSION_9_0_4});
111         }
112     }
113 }
114
Popular Tags