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 java.util.Vector;
019:
020: import org.apache.openejb.jee.EjbJar;
021:
022: public class EjbSet implements ValidationResults {
023:
024: private final Vector failures = new Vector();
025: private final Vector warnings = new Vector();
026: private final Vector errors = new Vector();
027:
028: private final String jarPath;
029: private final EjbJar jar;
030: private final String moduleType = EjbModule.class.getSimpleName();
031: private final ClassLoader classLoader;
032:
033: public EjbSet(String jarPath, EjbJar jar, ClassLoader classLoader) {
034: this .jarPath = jarPath;
035: this .jar = jar;
036: this .classLoader = classLoader;
037: }
038:
039: public ClassLoader getClassLoader() {
040: return classLoader;
041: }
042:
043: public EjbJar getJar() {
044: return jar;
045: }
046:
047: public String getModuleType() {
048: return moduleType;
049: }
050:
051: public void addWarning(ValidationWarning warning) {
052: warnings.addElement(warning);
053: }
054:
055: public void addFailure(ValidationFailure failure) {
056: failures.addElement(failure);
057: }
058:
059: public void addError(ValidationError error) {
060: errors.addElement(error);
061: }
062:
063: public ValidationFailure[] getFailures() {
064: ValidationFailure[] tmp = new ValidationFailure[failures.size()];
065: failures.copyInto(tmp);
066: return tmp;
067: }
068:
069: public ValidationWarning[] getWarnings() {
070: ValidationWarning[] tmp = new ValidationWarning[warnings.size()];
071: warnings.copyInto(tmp);
072: return tmp;
073: }
074:
075: public ValidationError[] getErrors() {
076: ValidationError[] tmp = new ValidationError[errors.size()];
077: errors.copyInto(tmp);
078: return tmp;
079: }
080:
081: public boolean hasWarnings() {
082: return warnings.size() > 0;
083: }
084:
085: public boolean hasFailures() {
086: return failures.size() > 0;
087: }
088:
089: public boolean hasErrors() {
090: return errors.size() > 0;
091: }
092:
093: public EjbJar getEjbJar() {
094: return jar;
095: }
096:
097: public String getJarPath() {
098: return jarPath;
099: }
100: }
|