KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > jbi > component > context > InstallationContextImpl


1 /**
2  * PETALS: PETALS Services Platform
3  * Copyright (C) 2005 EBM WebSourcing
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA.
19  *
20  * Initial developer(s): Adrien LOUIS
21  * --------------------------------------------------------------------------
22  * $Id: InstallationContextImpl.java,v 1.3 2005/07/22 10:24:27 alouis Exp $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.petals.jbi.component.context;
26
27 import java.util.List JavaDoc;
28
29 import javax.jbi.component.ComponentContext;
30 import javax.jbi.component.InstallationContext;
31
32 import org.objectweb.petals.tools.jbicommon.descriptor.ComponentDescription;
33 import org.w3c.dom.DocumentFragment JavaDoc;
34
35 /**
36  * @version $Rev: 250 $ $Date: 2006-04-21 14:20:57 +0200 (ven, 21 avr 2006) $
37  * @since Petals 1.0
38  * @author wjoseph - EBM Webousourcing
39  *
40  */

41 public class InstallationContextImpl implements InstallationContext {
42
43     private List JavaDoc classPathElements;
44
45     private String JavaDoc componentClassName;
46
47     private String JavaDoc componentName;
48
49     private ComponentContext context;
50
51     private boolean install;
52
53     private DocumentFragment JavaDoc installationDescriptorExtension;
54
55     private String JavaDoc installRoot;
56
57     public InstallationContextImpl(ComponentDescription component,
58             ComponentContext context, boolean install) {
59         super();
60
61         this.context = new ComponentContextForInstallation(context);
62         this.componentClassName = component.getComponentClassName();
63         this.componentName = component.getIdentification().getName();
64         this.install = install;
65         this.classPathElements = component.getComponentClassPath();
66         this.installRoot = context.getInstallRoot();
67         this.installationDescriptorExtension = component.getExtensions()
68                 .getDocumentFragment();
69     }
70
71     /*
72      * (non-Javadoc)
73      *
74      * @see javax.jbi.component.InstallationContext#getClassPathElements()
75      */

76     public List JavaDoc getClassPathElements() {
77         return classPathElements;
78     }
79
80     /*
81      * (non-Javadoc)
82      *
83      * @see javax.jbi.component.InstallationContext#getComponentClassName()
84      */

85     public String JavaDoc getComponentClassName() {
86         return componentClassName;
87     }
88
89     /*
90      * (non-Javadoc)
91      *
92      * @see javax.jbi.component.InstallationContext#getComponentName()
93      */

94     public String JavaDoc getComponentName() {
95         return componentName;
96     }
97
98     /*
99      * Return a <code>ComponentContextForInstallation</code> wrapper of the
100      * Componentcontext (non-Javadoc)
101      *
102      * @see javax.jbi.component.InstallationContext#getContext()
103      */

104     public ComponentContext getContext() {
105         return context;
106     }
107
108     /*
109      * (non-Javadoc)
110      *
111      * @see javax.jbi.component.InstallationContext#getInstallationDescriptorExtension()
112      */

113     public DocumentFragment JavaDoc getInstallationDescriptorExtension() {
114         return installationDescriptorExtension;
115     }
116
117     /*
118      * (non-Javadoc)
119      *
120      * @see javax.jbi.component.InstallationContext#getInstallRoot()
121      */

122     public String JavaDoc getInstallRoot() {
123         return installRoot;
124     }
125
126     /*
127      * (non-Javadoc)
128      *
129      * @see javax.jbi.component.InstallationContext#isInstall()
130      */

131     public boolean isInstall() {
132         return install;
133     }
134
135     /*
136      * TODO must redefine the classpath at the execution time
137      *
138      * (non-Javadoc)
139      *
140      * @see javax.jbi.component.InstallationContext#setClassPathElements(java.util.List)
141      */

142     public void setClassPathElements(List JavaDoc classPathElements) {
143         if (classPathElements == null) {
144             throw new IllegalArgumentException JavaDoc(
145                     "classPathElements must not be null");
146         }
147         if (classPathElements.isEmpty()) {
148             throw new IllegalArgumentException JavaDoc(
149                     "classPathElements must not be empty");
150         }
151         this.classPathElements = classPathElements;
152     }
153
154 }
155
Popular Tags