Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

RQMLSecondClassFactoryFacade.java

Go to the documentation of this file.
00001 
00065 package com.arcle.rmt.j2se.model.domimpl.rqml;
00066 
00067 import java.lang.ref.SoftReference;
00068 import java.util.Map;
00069 import java.util.Hashtable;
00070 import org.w3c.dom.Element;
00071 import com.arcle.rmt.rqml.RQMLSecondClass;
00072 import com.arcle.rmt.j2se.model.domimpl.RQMLSecondClassFactory;
00073 
00082 public class RQMLSecondClassFactoryFacade {
00083 
00090     public RQMLSecondClassFactoryFacade(RQMLSecondClassFactory childFactory) {
00091         factory = childFactory;
00092     }
00093 
00101     public RQMLSecondClassFactory getFactory(String name) {
00102         return (RQMLSecondClassFactory) getFactories().get(name);
00103     }
00104 
00105 
00124     protected Map createElementFactories() {
00125         // set capacity to 39 elements, no rehash
00126         Map factories = new Hashtable(39, 1);
00127 
00128         //-- First-class elements
00129         factories.put("requirement", new RQMLSecondClassFactory() {
00130             public RQMLSecondClass createRQMLSecondClass(Element e) {
00131                 return new RequirementImpl(e, factory);
00132             }
00133         });
00134 
00135         factories.put("stakeholder", new RQMLSecondClassFactory() {
00136             public RQMLSecondClass createRQMLSecondClass(Element e) {
00137                 return new StakeholderImpl(e, factory);
00138             }
00139         });
00140 
00141         factories.put("assumption", new RQMLSecondClassFactory() {
00142             public RQMLSecondClass createRQMLSecondClass(Element e) {
00143                 return new AssumptionImpl(e, factory);
00144             }
00145         });
00146 
00147         factories.put("issue", new RQMLSecondClassFactory() {
00148             public RQMLSecondClass createRQMLSecondClass(Element e) {
00149                 return new IssueImpl(e, factory);
00150             }
00151         });
00152 
00153         factories.put("taxonomy", new RQMLSecondClassFactory() {
00154             public RQMLSecondClass createRQMLSecondClass(Element e) {
00155                 return new TaxonomyImpl(e, factory);
00156             }
00157         });
00158 
00159         factories.put("context", new RQMLSecondClassFactory() {
00160             public RQMLSecondClass createRQMLSecondClass(Element e) {
00161                 return new ContextImpl(e, factory);
00162             }
00163         });
00164 
00165         factories.put("lexicon", new RQMLSecondClassFactory() {
00166             public RQMLSecondClass createRQMLSecondClass(Element e) {
00167                 return new LexiconImpl(e, factory);
00168             }
00169         });
00170 
00171 
00172         factories.put("project", new RQMLSecondClassFactory() {
00173             public RQMLSecondClass createRQMLSecondClass(Element e) {
00174                 return new ProjectImpl(e, factory);
00175             }
00176         });
00177 
00178         factories.put("use-case", new RQMLSecondClassFactory() {
00179             public RQMLSecondClass createRQMLSecondClass(Element e) {
00180                 return new UsecaseImpl(e, factory);
00181             }
00182         });
00183 
00184         //-- Second-class elements
00185         factories.put("name", new RQMLSecondClassFactory() {
00186             public RQMLSecondClass createRQMLSecondClass(Element e) {
00187                 return new NameImpl(e, factory);
00188             }
00189         });
00190 
00191         factories.put("description", new RQMLSecondClassFactory() {
00192             public RQMLSecondClass createRQMLSecondClass(Element e) {
00193                 return new DescriptionImpl(e, factory);
00194             }
00195         });
00196 
00197         factories.put("rationale", new RQMLSecondClassFactory() {
00198             public RQMLSecondClass createRQMLSecondClass(Element e) {
00199                 return new RationaleImpl(e, factory);
00200             }
00201         });
00202 
00203         factories.put("type-element", new RQMLSecondClassFactory() {
00204             public RQMLSecondClass createRQMLSecondClass(Element e) {
00205                 return new RationaleImpl(e, factory);
00206             }
00207         });
00208         factories.put("origin", new RQMLSecondClassFactory() {
00209             public RQMLSecondClass createRQMLSecondClass(Element e) {
00210                 return new OriginImpl(e, factory);
00211             }
00212         });
00213 
00214         factories.put("textual-data", new RQMLSecondClassFactory() {
00215             public RQMLSecondClass createRQMLSecondClass(Element e) {
00216                 return new TextualDataImpl(e, factory);
00217             }
00218         });
00219 
00220         factories.put("definition", new RQMLSecondClassFactory() {
00221             public RQMLSecondClass createRQMLSecondClass(Element e) {
00222                 return new DefinitionImpl(e, factory);
00223             }
00224         });
00225 
00226         factories.put("product", new RQMLSecondClassFactory() {
00227             public RQMLSecondClass createRQMLSecondClass(Element e) {
00228                 return new ProductImpl(e, factory);
00229             }
00230         });
00231 
00232         factories.put("problem", new RQMLSecondClassFactory() {
00233             public RQMLSecondClass createRQMLSecondClass(Element e) {
00234                 return new ProblemImpl(e, factory);
00235             }
00236         });
00237 
00238         factories.put("scope", new RQMLSecondClassFactory() {
00239             public RQMLSecondClass createRQMLSecondClass(Element e) {
00240                 return new ScopeImpl(e, factory);
00241             }
00242         });
00243 
00244         factories.put("vision", new RQMLSecondClassFactory() {
00245             public RQMLSecondClass createRQMLSecondClass(Element e) {
00246                 return new VisionImpl(e, factory);
00247             }
00248         });
00249 
00250         factories.put("actor", new RQMLSecondClassFactory() {
00251             public RQMLSecondClass createRQMLSecondClass(Element e) {
00252                 return new ActorImpl(e, factory);
00253             }
00254         });
00255 
00256         factories.put("precondition", new RQMLSecondClassFactory() {
00257             public RQMLSecondClass createRQMLSecondClass(Element e) {
00258                 return new PreconditionImpl(e, factory);
00259             }
00260         });
00261 
00262         factories.put("postcondition", new RQMLSecondClassFactory() {
00263             public RQMLSecondClass createRQMLSecondClass(Element e) {
00264                 return new PostconditionImpl(e, factory);
00265             }
00266         });
00267 
00268         factories.put("normal-course", new RQMLSecondClassFactory() {
00269             public RQMLSecondClass createRQMLSecondClass(Element e) {
00270                 return new NormalCourseImpl(e, factory);
00271             }
00272         });
00273 
00274         factories.put("alternative-course", new RQMLSecondClassFactory() {
00275             public RQMLSecondClass createRQMLSecondClass(Element e) {
00276                 return new AlternativeCourseImpl(e, factory);
00277             }
00278         });
00279 
00280         factories.put("exception", new RQMLSecondClassFactory() {
00281             public RQMLSecondClass createRQMLSecondClass(Element e) {
00282                 return new ExceptionImpl(e, factory);
00283             }
00284         });
00285 
00286         factories.put("actoraction", new RQMLSecondClassFactory() {
00287             public RQMLSecondClass createRQMLSecondClass(Element e) {
00288                 return new ActorActionImpl(e, factory);
00289             }
00290         });
00291 
00292         factories.put("systemresponse", new RQMLSecondClassFactory() {
00293             public RQMLSecondClass createRQMLSecondClass(Element e) {
00294                 return new SystemResponseImpl(e, factory);
00295             }
00296         });
00297 
00298         factories.put("comment", new RQMLSecondClassFactory() {
00299             public RQMLSecondClass createRQMLSecondClass(Element e) {
00300                 return new CommentImpl(e, factory);
00301             }
00302         });
00303 
00304         // done
00305         return factories;
00306     }
00307 
00312     protected Map getFactories() {
00313         Map fac = (Map) _factories.get();
00314         if (fac == null) {
00315             fac = createElementFactories();
00316             _factories = new SoftReference(fac);
00317         }
00318         return fac;
00319     }
00320 
00325     protected SoftReference _factories = new SoftReference(null);
00326 
00331     protected RQMLSecondClassFactory factory;
00332 }

Generated on Fri Jun 18 19:51:25 2004 for Arcle Rambutan by doxygen 1.3.5