001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.geronimo.j2ee.deployment;
017:
018: import java.io.IOException;
019: import java.net.URI;
020: import java.net.URISyntaxException;
021: import java.util.Collection;
022: import java.util.jar.JarFile;
023:
024: import org.apache.geronimo.deployment.DeploymentContext;
025: import org.apache.geronimo.gbean.AbstractName;
026: import org.apache.geronimo.j2ee.deployment.annotation.AnnotatedApplicationClient;
027: import org.apache.geronimo.kernel.config.ConfigurationModuleType;
028: import org.apache.geronimo.kernel.repository.Environment;
029: import org.apache.xmlbeans.XmlObject;
030:
031: /**
032: * TODO there is almost certainly a problem with the serverEnvironment when deploying a stand alone app client outside an ear.
033: *
034: * @version $Rev: 535939 $ $Date: 2007-05-07 11:03:52 -0700 (Mon, 07 May 2007) $
035: */
036: public class AppClientModule extends Module {
037: private final Environment serverEnvironment;
038: private JarFile earFile;
039: private final AbstractName appClientName;
040: private final String mainClassName;
041: private final Collection<ConnectorModule> resourceModules;
042:
043: public AppClientModule(boolean standAlone, AbstractName moduleName,
044: AbstractName appClientName, Environment serverEnvironment,
045: Environment clientEnvironment, JarFile moduleFile,
046: String targetPath, XmlObject specDD, String mainClassName,
047: XmlObject vendorDD, String originalSpecDD,
048: Collection<ConnectorModule> resourceModules,
049: AnnotatedApplicationClient annotatedAppClient) {
050: super (standAlone, moduleName, clientEnvironment, moduleFile,
051: targetPath, specDD, vendorDD, originalSpecDD, null,
052: annotatedAppClient);
053: this .serverEnvironment = serverEnvironment;
054: this .appClientName = appClientName;
055: this .mainClassName = mainClassName;
056: this .resourceModules = resourceModules;
057: }
058:
059: public ConfigurationModuleType getType() {
060: return ConfigurationModuleType.CAR;
061: }
062:
063: public Environment getServerEnvironment() {
064: return serverEnvironment;
065: }
066:
067: public JarFile getEarFile() {
068: return earFile;
069: }
070:
071: public void setEarFile(JarFile earFile) {
072: this .earFile = earFile;
073: }
074:
075: public AbstractName getAppClientName() {
076: return appClientName;
077: }
078:
079: public String getMainClassName() {
080: return mainClassName;
081: }
082:
083: public void addClass(URI location, String fqcn, byte[] bytes,
084: DeploymentContext context) throws IOException,
085: URISyntaxException {
086: context.addClass(location, fqcn, bytes);
087: }
088:
089: public Collection<ConnectorModule> getResourceModules() {
090: return resourceModules;
091: }
092:
093: public void close() {
094: if (resourceModules != null) {
095: for (ConnectorModule resourceModule : resourceModules) {
096: resourceModule.close();
097: }
098: }
099: super.close();
100: }
101:
102: }
|