KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ve > luz > ica > jackass > component > AbstractJackassContext


1 /*
2  * Copyright (c) 2003 by The Jackass Team
3  * Licensed under the Open Software License version 2.0
4  */

5 package ve.luz.ica.jackass.component;
6
7 import java.util.Hashtable JavaDoc;
8
9 import org.omg.CosNaming.NamingContextExt JavaDoc;
10 import ve.luz.ica.jackass.deploy.descriptor.standard.Property;
11
12 /**
13  * Abstract class iplementing jackass::component::JackassContext
14  * @author carevalo
15  */

16 public abstract class AbstractJackassContext implements JackassContextOperations
17 {
18     private Hashtable JavaDoc properties;
19     private NamingContextExt JavaDoc rootNamingContext;
20     private ve.luz.ica.jackass.component.Property[] propertyArray;
21
22     /**
23      * Constructor for AbstractJackassContext
24      * @param rootContext the root of the system wide Name Service
25      * @param props deployment descriptor parsed properties
26      */

27     protected AbstractJackassContext(NamingContextExt JavaDoc rootContext, Property[] props)
28     {
29         this.rootNamingContext = rootContext;
30         this.properties = new Hashtable JavaDoc();
31
32         if (props == null)
33         {
34             this.propertyArray = new ve.luz.ica.jackass.component.Property[0];
35             return;
36         }
37
38         this.propertyArray = new ve.luz.ica.jackass.component.Property[props.length];
39
40         for (int i = 0; i < props.length; i++)
41         {
42             String JavaDoc name = props[i].getName();
43             String JavaDoc value = props[i].getValue();
44
45             this.properties.put(name, value);
46             this.propertyArray[i] = new ve.luz.ica.jackass.component.Property(name, value);
47         }
48     }
49
50     /**
51      * Get the naming service root context
52      * @return the naming service root context
53      * @see ve.luz.ica.jackass.component.JackassContextOperations#getRootNamingContext()
54      */

55     public NamingContextExt JavaDoc getRootNamingContext()
56     {
57         return rootNamingContext;
58     }
59
60     /**
61      * Get the value of a property given its name
62      * @param name the name of the property
63      * @return the value associated to the given name
64      * @see ve.luz.ica.jackass.component.JackassContextOperations#getProperty(java.lang.String)
65      */

66     public String JavaDoc getProperty(String JavaDoc name)
67     {
68         return (String JavaDoc) properties.get(name);
69     }
70
71     /**
72      * Returns the array of properties
73      * @return the array containing the properties
74      */

75     public ve.luz.ica.jackass.component.Property[] getProperties()
76     {
77         return propertyArray;
78     }
79 }
80
Popular Tags