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.openejb.config;
017:
018: import org.apache.openejb.jee.ApplicationClient;
019:
020: import java.util.Map;
021: import java.util.HashMap;
022: import java.util.Set;
023: import java.util.TreeSet;
024: import java.io.File;
025:
026: /**
027: * @version $Rev: 602704 $ $Date: 2007-12-09 09:58:22 -0800 $
028: */
029: public class ClientModule implements DeploymentModule {
030: private final ValidationContext validation;
031: private ApplicationClient applicationClient;
032: private String jarLocation;
033: private ClassLoader classLoader;
034: private String mainClass;
035: private final Map<String, Object> altDDs = new HashMap<String, Object>();
036: private final String moduleId;
037: private final Set<String> watchedResources = new TreeSet<String>();
038:
039: public ClientModule(ApplicationClient applicationClient,
040: ClassLoader classLoader, String jarLocation,
041: String mainClass, String moduleId) {
042: this .applicationClient = applicationClient;
043: this .classLoader = classLoader;
044: this .jarLocation = jarLocation;
045: this .mainClass = mainClass;
046:
047: if (moduleId == null) {
048: if (applicationClient != null
049: && applicationClient.getId() != null) {
050: moduleId = applicationClient.getId();
051: } else {
052: File file = new File(jarLocation);
053: moduleId = file.getName();
054: }
055: }
056:
057: this .moduleId = moduleId;
058: validation = new ValidationContext(ClientModule.class,
059: jarLocation);
060: }
061:
062: public ValidationContext getValidation() {
063: return validation;
064: }
065:
066: public String getModuleId() {
067: return moduleId;
068: }
069:
070: public Map<String, Object> getAltDDs() {
071: return altDDs;
072: }
073:
074: public ApplicationClient getApplicationClient() {
075: return applicationClient;
076: }
077:
078: public void setApplicationClient(ApplicationClient applicationClient) {
079: this .applicationClient = applicationClient;
080: }
081:
082: public ClassLoader getClassLoader() {
083: return classLoader;
084: }
085:
086: public void setClassLoader(ClassLoader classLoader) {
087: this .classLoader = classLoader;
088: }
089:
090: public String getJarLocation() {
091: return jarLocation;
092: }
093:
094: public void setJarLocation(String jarLocation) {
095: this .jarLocation = jarLocation;
096: }
097:
098: public String getMainClass() {
099: return mainClass;
100: }
101:
102: public void setMainClass(String mainClass) {
103: this .mainClass = mainClass;
104: }
105:
106: public Set<String> getWatchedResources() {
107: return watchedResources;
108: }
109: }
|