View Javadoc

1   /**
2    *
3    *  Licensed to the Apache Software Foundation (ASF) under one or more
4    *  contributor license agreements.  See the NOTICE file distributed with
5    *  this work for additional information regarding copyright ownership.
6    *  The ASF licenses this file to You under the Apache License, Version 2.0
7    *  (the "License"); you may not use this file except in compliance with
8    *  the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *  Unless required by applicable law or agreed to in writing, software
13   *  distributed under the License is distributed on an "AS IS" BASIS,
14   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   *  See the License for the specific language governing permissions and
16   *  limitations under the License.
17   */
18  package org.apache.geronimo.j2ee.deployment;
19  
20  import java.io.IOException;
21  import java.net.URI;
22  import java.net.URISyntaxException;
23  import java.util.Collection;
24  import java.util.Iterator;
25  import java.util.jar.JarFile;
26  
27  import org.apache.geronimo.deployment.DeploymentContext;
28  import org.apache.geronimo.gbean.AbstractName;
29  import org.apache.geronimo.kernel.config.ConfigurationModuleType;
30  import org.apache.geronimo.kernel.repository.Environment;
31  import org.apache.xmlbeans.XmlObject;
32  
33  /**
34   * @version $Rev: 470597 $ $Date: 2006-11-02 15:30:55 -0800 (Thu, 02 Nov 2006) $
35   */
36  public class AppClientModule extends Module {
37      private final Environment clientEnvironment;
38      private JarFile earFile;
39      private final AbstractName appClientName;
40      private final Collection resourceModules;
41  
42  
43      public AppClientModule(boolean standAlone, AbstractName moduleName, AbstractName appClientName, Environment serverEnvironment, Environment clientEnvironment, JarFile moduleFile, String targetPath, XmlObject specDD, XmlObject vendorDD, String originalSpecDD, Collection resourceModules) {
44          super(standAlone, moduleName, serverEnvironment, moduleFile, targetPath, specDD, vendorDD, originalSpecDD, null);
45          this.clientEnvironment = clientEnvironment;
46          this.appClientName = appClientName;
47          this.resourceModules = resourceModules;
48      }
49  
50      public ConfigurationModuleType getType() {
51          return ConfigurationModuleType.CAR;
52      }
53  
54      public Environment getClientEnvironment() {
55          return clientEnvironment;
56      }
57  
58      public JarFile getEarFile() {
59          return earFile;
60      }
61  
62      public void setEarFile(JarFile earFile) {
63          this.earFile = earFile;
64      }
65  
66      public AbstractName getAppClientName() {
67          return appClientName;
68      }
69  
70      public void addClass(URI location, String fqcn, byte[] bytes, DeploymentContext context) throws IOException, URISyntaxException {
71          context.addClass(location, fqcn, bytes);
72      }
73  
74      public Collection getResourceModules() {
75          return resourceModules;
76      }
77  
78      public void close() {
79          if (resourceModules != null) {
80              for (Iterator iterator = resourceModules.iterator(); iterator.hasNext();) {
81                  ConnectorModule connectorModule = (ConnectorModule) iterator.next();
82                  connectorModule.close();
83              }
84          }
85          super.close();
86      }
87  
88  }
89  
90