View Javadoc

1   package org.andromda.cartridges.interfaces;
2   
3   import java.net.URL;
4   import java.util.ArrayList;
5   import java.util.HashMap;
6   import java.util.List;
7   import java.util.Map;
8   
9   /***
10   * A default implementation of the ICartridgeDescriptor interface.
11   * 
12   * @see org.andromda.cartridges.interfaces.ICartridgeDescriptor
13   * @see org.andromda.cartridges.interfaces.CartridgeXmlParser
14   * @author <a href="http://www.mbohlen.de">Matthias Bohlen</a>
15   */
16  public class DefaultCartridgeDescriptor implements ICartridgeDescriptor
17  {
18      private String cartridgeName;
19      private HashMap properties = new HashMap();
20      private ArrayList supportedStereotypes = new ArrayList();
21      private ArrayList outlets = new ArrayList();
22      private ArrayList templates = new ArrayList();
23      private URL definitionURL;
24      private String cartridgeClassName = null;
25  
26      /***
27       * @see org.andromda.cartridges.interfaces.ICartridgeDescriptor#getCartridgeName()
28       * @return String
29       */
30      public String getCartridgeName()
31      {
32          return cartridgeName;
33      }
34  
35      /***
36       * @see org.andromda.cartridges.interfaces.ICartridgeDescriptor#getProperties()
37       */
38      public Map getProperties()
39      {
40          return properties;
41      }
42  
43      /***
44       * @see org.andromda.cartridges.interfaces.ICartridgeDescriptor#getSupportedStereotypes()
45       */
46      public List getSupportedStereotypes()
47      {
48          return supportedStereotypes;
49      }
50  
51      /***
52       * @see org.andromda.cartridges.interfaces.ICartridgeDescriptor#getOutlets()
53       */
54      public List getOutlets()
55      {
56          return outlets;
57      }
58  
59      /***
60       * @see org.andromda.cartridges.interfaces.ICartridgeDescriptor#getTemplateConfigurations()
61       */
62      public List getTemplateConfigurations()
63      {
64          return templates;
65      }
66  
67      /***
68       * Adds a property to the list of properties of this cartridge. Properties
69       * may be used to designate implementations for architectural aspects.
70       * 
71       * @param propertyName the name of the property
72       * @param propertyValue the value of the property
73       */
74      public void addProperty(String propertyName, String propertyValue)
75      {
76          properties.put(propertyName, propertyValue);
77      }
78  
79      /***
80       * Adds a stereotype to the list of supported stereotypes of this cartridge.
81       * 
82       * @param stereotypeName the name of the stereotype
83       */
84      public void addSupportedStereotype(String stereotypeName)
85      {
86          supportedStereotypes.add(stereotypeName);
87      }
88      
89      /***
90       * Sets the name of the cartridge.
91       * @param cartridgeName The cartridgeName to set
92       */
93      public void setCartridgeName(String cartridgeName)
94      {
95          this.cartridgeName = cartridgeName;
96      }
97      
98      /***
99       * Adds an outlet to the list of defined outlets. An outlet is a short name
100      * for a path where output files will be written. A later step associates
101      * this name with a concrete physical directory name.
102      * 
103      * @param string the outlet identifier
104      */
105     public void addOutlet(String outletname)
106     {
107         outlets.add(outletname);
108     }
109     
110     /***
111      * Adds an item to the list of defined template configurations.
112      * 
113      * @param templateConfiguration the new configuration to add
114      */
115     public void addTemplateConfiguration(TemplateConfiguration templateConfiguration)
116     {
117         templates.add(templateConfiguration);
118     }
119     
120     /***
121      * @see org.andromda.cartridges.interfaces.ICartridgeDescriptor#getDefinitionURL()
122      */
123     public URL getDefinitionURL()
124     {
125         return this.definitionURL;
126     }
127     /***
128      * @see org.andromda.cartridges.interfaces.ICartridgeDescriptor#setDefinitionURL(java.net.URL)
129      */
130     public void setDefinitionURL(URL url)
131     {
132         this.definitionURL = url;
133     }
134 
135     /***
136      * Returns the cartridgeClassName.
137      * @return String
138      */
139     public String getCartridgeClassName()
140     {
141         return cartridgeClassName;
142     }
143 
144     /***
145      * Sets the cartridgeClassName.
146      * @param cartridgeClassName The cartridgeClassName to set
147      */
148     public void setCartridgeClassName(String cartridgeClassName)
149     {
150         this.cartridgeClassName = cartridgeClassName;
151     }
152 
153 }