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     */
017    package org.apache.servicemix.jbi.deployment;
018    
019    /**
020     * @version $Revision: 426415 $
021     */
022    public class Component {
023        private String type;
024        private String componentClassLoaderDelegation = "parent-first";
025        private String bootstrapClassLoaderDelegation = "parent-first";
026        private Identification identification;
027        private String componentClassName;
028        private String description;
029        private ClassPath componentClassPath;
030        private String bootstrapClassName;
031        private ClassPath bootstrapClassPath;
032        private SharedLibraryList[] sharedLibraries;
033        private InstallationDescriptorExtension descriptorExtension;
034    
035        public boolean isServiceEngine() {
036            return type != null && type.equals("service-engine");
037        }
038    
039        public boolean isBindingComponent() {
040            return type != null && type.equals("binding-component");
041        }
042    
043        public boolean isComponentClassLoaderDelegationParentFirst() {
044            return isParentFirst(componentClassLoaderDelegation);
045        }
046    
047        public boolean isComponentClassLoaderDelegationSelfFirst() {
048            return isSelfFirst(componentClassLoaderDelegation);
049        }
050    
051        public boolean isBootstrapClassLoaderDelegationParentFirst() {
052            return isParentFirst(bootstrapClassLoaderDelegation);
053        }
054    
055        public boolean isBootstrapClassLoaderDelegationSelfFirst() {
056            return isSelfFirst(bootstrapClassLoaderDelegation);
057        }
058    
059    
060        // Properties
061        //-------------------------------------------------------------------------
062        public String getType() {
063            return type;
064        }
065    
066        public void setType(String type) {
067            this.type = type;
068        }
069    
070        public String getComponentClassLoaderDelegation() {
071            return componentClassLoaderDelegation;
072        }
073    
074        public void setComponentClassLoaderDelegation(String componentClassLoaderDelegation) {
075            this.componentClassLoaderDelegation = componentClassLoaderDelegation;
076        }
077    
078        public String getBootstrapClassLoaderDelegation() {
079            return bootstrapClassLoaderDelegation;
080        }
081    
082        public void setBootstrapClassLoaderDelegation(String bootstrapClassLoaderDelegation) {
083            this.bootstrapClassLoaderDelegation = bootstrapClassLoaderDelegation;
084        }
085    
086        public Identification getIdentification() {
087            return identification;
088        }
089    
090        public void setIdentification(Identification identification) {
091            this.identification = identification;
092        }
093    
094        public String getComponentClassName() {
095            return componentClassName;
096        }
097    
098        public void setComponentClassName(String componentClassName) {
099            this.componentClassName = componentClassName;
100        }
101    
102        public String getDescription() {
103            return description;
104        }
105    
106        public void setDescription(String description) {
107            this.description = description;
108        }
109    
110        public ClassPath getComponentClassPath() {
111            return componentClassPath;
112        }
113    
114        public void setComponentClassPath(ClassPath componentClassPath) {
115            this.componentClassPath = componentClassPath;
116        }
117    
118        public String getBootstrapClassName() {
119            return bootstrapClassName;
120        }
121    
122        public void setBootstrapClassName(String bootstrapClassName) {
123            this.bootstrapClassName = bootstrapClassName;
124        }
125    
126        public ClassPath getBootstrapClassPath() {
127            return bootstrapClassPath;
128        }
129    
130        public void setBootstrapClassPath(ClassPath bootstrapClassPath) {
131            this.bootstrapClassPath = bootstrapClassPath;
132        }
133    
134        public SharedLibraryList[] getSharedLibraries() {
135            return sharedLibraries;
136        }
137    
138        public void setSharedLibraries(SharedLibraryList[] sharedLibraries) {
139            this.sharedLibraries = sharedLibraries;
140        }
141    
142        public InstallationDescriptorExtension getDescriptorExtension() {
143            return descriptorExtension;
144        }
145    
146        public void setDescriptorExtension(InstallationDescriptorExtension descriptorExtension) {
147            this.descriptorExtension = descriptorExtension;
148        }
149    
150        // Implementation methods
151        //-------------------------------------------------------------------------
152        protected boolean isParentFirst(String text) {
153            return text != null && text.equalsIgnoreCase("parent-first");
154        }
155    
156        protected boolean isSelfFirst(String text) {
157            return text != null && text.equalsIgnoreCase("self-first");
158        }
159        
160        
161    }