View Javadoc
1   /*
2    * $Id$
3    */
4   
5   package com.javaforge.bobber.archetype.model;
6   
7     //---------------------------------/
8    //- Imported classes and packages -/
9   //---------------------------------/
10  
11  import java.util.Date;
12  
13  /**
14   * Describes the assembly layout and packaging.
15   * 
16   * @version $Revision$ $Date$
17   */
18  public class BobberArchetype implements java.io.Serializable {
19  
20  
21        //--------------------------/
22       //- Class/Member Variables -/
23      //--------------------------/
24  
25      /**
26       * Field id.
27       */
28      private String id;
29  
30      /**
31       * Field allowPartial.
32       */
33      private boolean allowPartial = false;
34  
35      /**
36       * Field variables.
37       */
38      private java.util.List variables;
39  
40      /**
41       * Field templates.
42       */
43      private java.util.List templates;
44  
45  
46        //-----------/
47       //- Methods -/
48      //-----------/
49  
50      /**
51       * Method addTemplate.
52       * 
53       * @param template
54       */
55      public void addTemplate(Template template)
56      {
57          if ( !(template instanceof Template) )
58          {
59              throw new ClassCastException( "BobberArchetype.addTemplates(template) parameter must be instanceof " + Template.class.getName() );
60          }
61          getTemplates().add( template );
62      } //-- void addTemplate(Template) 
63  
64      /**
65       * Method addVariable.
66       * 
67       * @param variable
68       */
69      public void addVariable(Variable variable)
70      {
71          if ( !(variable instanceof Variable) )
72          {
73              throw new ClassCastException( "BobberArchetype.addVariables(variable) parameter must be instanceof " + Variable.class.getName() );
74          }
75          getVariables().add( variable );
76      } //-- void addVariable(Variable) 
77  
78      /**
79       * Get the id field.
80       * 
81       * @return String
82       */
83      public String getId()
84      {
85          return this.id;
86      } //-- String getId() 
87  
88      /**
89       * Method getTemplates.
90       * 
91       * @return java.util.List
92       */
93      public java.util.List getTemplates()
94      {
95          if ( this.templates == null )
96          {
97              this.templates = new java.util.ArrayList();
98          }
99          
100         return this.templates;
101     } //-- java.util.List getTemplates() 
102 
103     /**
104      * Method getVariables.
105      * 
106      * @return java.util.List
107      */
108     public java.util.List getVariables()
109     {
110         if ( this.variables == null )
111         {
112             this.variables = new java.util.ArrayList();
113         }
114         
115         return this.variables;
116     } //-- java.util.List getVariables() 
117 
118     /**
119      * Get the allowPartial field.
120      * 
121      * @return boolean
122      */
123     public boolean isAllowPartial()
124     {
125         return this.allowPartial;
126     } //-- boolean isAllowPartial() 
127 
128     /**
129      * Method removeTemplate.
130      * 
131      * @param template
132      */
133     public void removeTemplate(Template template)
134     {
135         if ( !(template instanceof Template) )
136         {
137             throw new ClassCastException( "BobberArchetype.removeTemplates(template) parameter must be instanceof " + Template.class.getName() );
138         }
139         getTemplates().remove( template );
140     } //-- void removeTemplate(Template) 
141 
142     /**
143      * Method removeVariable.
144      * 
145      * @param variable
146      */
147     public void removeVariable(Variable variable)
148     {
149         if ( !(variable instanceof Variable) )
150         {
151             throw new ClassCastException( "BobberArchetype.removeVariables(variable) parameter must be instanceof " + Variable.class.getName() );
152         }
153         getVariables().remove( variable );
154     } //-- void removeVariable(Variable) 
155 
156     /**
157      * Set the allowPartial field.
158      * 
159      * @param allowPartial
160      */
161     public void setAllowPartial(boolean allowPartial)
162     {
163         this.allowPartial = allowPartial;
164     } //-- void setAllowPartial(boolean) 
165 
166     /**
167      * Set the id field.
168      * 
169      * @param id
170      */
171     public void setId(String id)
172     {
173         this.id = id;
174     } //-- void setId(String) 
175 
176     /**
177      * Set 
178      *             list of all the templates in the archetype that
179      * need to 
180      *           .
181      * 
182      * @param templates
183      */
184     public void setTemplates(java.util.List templates)
185     {
186         this.templates = templates;
187     } //-- void setTemplates(java.util.List) 
188 
189     /**
190      * Set 
191      *              variable expressions that will use the
192      * System.properties values to be used as input into the
193      * velocity template engine
194      *           .
195      * 
196      * @param variables
197      */
198     public void setVariables(java.util.List variables)
199     {
200         this.variables = variables;
201     } //-- void setVariables(java.util.List) 
202 
203 
204     private String modelEncoding = "UTF-8";
205 
206     /**
207      * Set an encoding used for reading/writing the model.
208      *
209      * @param modelEncoding the encoding used when reading/writing the model.
210      */
211     public void setModelEncoding( String modelEncoding )
212     {
213         this.modelEncoding = modelEncoding;
214     }
215 
216     /**
217      * @return the current encoding used when reading/writing this model.
218      */
219     public String getModelEncoding()
220     {
221         return modelEncoding;
222     }
223 }