KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > j2ee > deployment > AppClientModule


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.geronimo.j2ee.deployment;
18
19 import java.io.IOException JavaDoc;
20 import java.net.URI JavaDoc;
21 import java.net.URISyntaxException JavaDoc;
22 import java.util.Collection JavaDoc;
23 import java.util.Iterator JavaDoc;
24 import java.util.jar.JarFile JavaDoc;
25
26 import org.apache.geronimo.deployment.DeploymentContext;
27 import org.apache.geronimo.gbean.AbstractName;
28 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
29 import org.apache.geronimo.kernel.repository.Environment;
30 import org.apache.xmlbeans.XmlObject;
31
32 /**
33  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
34  */

35 public class AppClientModule extends Module {
36     private final Environment clientEnvironment;
37     private JarFile JavaDoc earFile;
38     private final AbstractName appClientName;
39     private final Collection JavaDoc resourceModules;
40
41
42     public AppClientModule(boolean standAlone, AbstractName moduleName, AbstractName appClientName, Environment serverEnvironment, Environment clientEnvironment, JarFile JavaDoc moduleFile, String JavaDoc targetPath, XmlObject specDD, XmlObject vendorDD, String JavaDoc originalSpecDD, Collection JavaDoc resourceModules) {
43         super(standAlone, moduleName, serverEnvironment, moduleFile, targetPath, specDD, vendorDD, originalSpecDD, null);
44         this.clientEnvironment = clientEnvironment;
45         this.appClientName = appClientName;
46         this.resourceModules = resourceModules;
47     }
48
49     public ConfigurationModuleType getType() {
50         return ConfigurationModuleType.CAR;
51     }
52
53     public Environment getClientEnvironment() {
54         return clientEnvironment;
55     }
56
57     public JarFile JavaDoc getEarFile() {
58         return earFile;
59     }
60
61     public void setEarFile(JarFile JavaDoc earFile) {
62         this.earFile = earFile;
63     }
64
65     public AbstractName getAppClientName() {
66         return appClientName;
67     }
68
69     public void addClass(URI JavaDoc location, String JavaDoc fqcn, byte[] bytes, DeploymentContext context) throws IOException JavaDoc, URISyntaxException JavaDoc {
70         context.addClass(location, fqcn, bytes);
71     }
72
73     public Collection JavaDoc getResourceModules() {
74         return resourceModules;
75     }
76
77     public void close() {
78         if (resourceModules != null) {
79             for (Iterator JavaDoc iterator = resourceModules.iterator(); iterator.hasNext();) {
80                 ConnectorModule connectorModule = (ConnectorModule) iterator.next();
81                 connectorModule.close();
82             }
83         }
84         super.close();
85     }
86
87 }
88
89
90
Popular Tags