1 17 18 package org.apache.geronimo.kernel.repository; 19 20 import java.io.Serializable ; 21 import java.util.Collection ; 22 import java.util.HashSet ; 23 import java.util.LinkedHashSet ; 24 import java.util.Set ; 25 import java.util.List ; 26 import java.util.Collections ; 27 import java.util.ArrayList ; 28 import java.util.Iterator ; 29 30 35 public class Environment implements Serializable { 36 private static final long serialVersionUID = 7075760873629376317L; 37 38 private Artifact configId; 39 40 private final LinkedHashSet dependencies = new LinkedHashSet (); 41 42 private final Set hiddenClasses = new HashSet (); 43 private final Set nonOverrideableClasses = new HashSet (); 44 45 private boolean inverseClassLoading; 46 private boolean suppressDefaultEnvironment; 47 48 public Environment() { 49 } 50 51 public Environment(Artifact configId) { 52 this.configId = configId; 53 } 54 55 public Environment(Environment environment) { 56 this.configId = environment.getConfigId(); 57 this.dependencies.addAll(environment.dependencies); 58 this.hiddenClasses.addAll(environment.getHiddenClasses()); 59 this.nonOverrideableClasses.addAll(environment.getNonOverrideableClasses()); 60 this.inverseClassLoading = environment.isInverseClassLoading(); 61 this.suppressDefaultEnvironment = environment.isSuppressDefaultEnvironment(); 62 } 63 64 public Artifact getConfigId() { 65 return configId; 66 } 67 68 public void setConfigId(Artifact configId) { 69 this.configId = configId; 70 } 71 72 78 public List getDependencies() { 79 return Collections.unmodifiableList(new ArrayList (dependencies)); 80 } 81 82 public void addDependency(Artifact artifact, ImportType importType) { 83 this.dependencies.add(new Dependency(artifact, importType)); 84 } 85 86 public void addDependency(Dependency dependency) { 87 this.dependencies.add(dependency); 88 } 89 90 public void addDependencies(Collection dependencies) { 91 for (Iterator iterator = dependencies.iterator(); iterator.hasNext();) { 92 Dependency dependency = (Dependency) iterator.next(); 94 addDependency(dependency); 95 } 96 } 97 98 public void setDependencies(Collection dependencies) { 99 this.dependencies.clear(); 100 addDependencies(dependencies); 101 } 102 103 107 public Set getHiddenClasses() { 108 return hiddenClasses; 109 } 110 111 public void addHiddenClasses(Collection hiddenClasses) { 112 this.hiddenClasses.addAll(hiddenClasses); 113 } 114 115 public void setHiddenClasses(Collection hiddenClasses) { 116 this.hiddenClasses.clear(); 117 addHiddenClasses(hiddenClasses); 118 } 119 120 124 public Set getNonOverrideableClasses() { 125 return nonOverrideableClasses; 126 } 127 128 public void addNonOverrideableClasses(Collection nonOverrideableClasses) { 129 this.nonOverrideableClasses.addAll(nonOverrideableClasses); 130 } 131 132 public void setNonOverrideableClasses(Collection nonOverrideableClasses) { 133 this.nonOverrideableClasses.clear(); 134 addNonOverrideableClasses(nonOverrideableClasses); 135 } 136 137 public boolean isInverseClassLoading() { 138 return inverseClassLoading; 139 } 140 141 public void setInverseClassLoading(boolean inverseClassLoading) { 142 this.inverseClassLoading = inverseClassLoading; 143 } 144 145 public boolean isSuppressDefaultEnvironment() { 146 return suppressDefaultEnvironment; 147 } 148 149 public void setSuppressDefaultEnvironment(boolean suppressDefaultEnvironment) { 150 this.suppressDefaultEnvironment = suppressDefaultEnvironment; 151 } 152 153 } 154 | Popular Tags |