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.xbean.osgi;
018    
019    import java.util.HashSet;
020    import java.util.Iterator;
021    import java.util.Set;
022    import java.util.Collections;
023    
024    /**
025     * @author Dain Sundstrom
026     * @version $Id$
027     * @since 2.0
028     */
029    public class Project implements Artifact {
030        private final String groupId;
031        private final String artifactId;
032        private final String version;
033        private final String type;
034        private final String jar;
035        private final Set dependencies;
036    
037        public Project(String groupId, String artifactId, String version, String type, Set dependencies) {
038            this(groupId, artifactId, version, type, artifactId + "-" + version + "." + type, dependencies);
039        }
040    
041        public Project(String groupId, String artifactId, String version, String type, String jar, Set dependencies) {
042            this.groupId = groupId;
043            this.artifactId = artifactId;
044            this.version = version;
045            this.type = type;
046            this.jar = jar;
047    
048            Set deps = new HashSet();
049            for (Iterator iterator = dependencies.iterator(); iterator.hasNext();) {
050                Artifact dependency = (Artifact) iterator.next();
051                deps.add(dependency);
052            }
053            this.dependencies = Collections.unmodifiableSet(deps);
054        }
055    
056        public String getGroupId() {
057            return groupId;
058        }
059    
060        public String getArtifactId() {
061            return artifactId;
062        }
063    
064        public String getVersion() {
065            return version;
066        }
067    
068        public String getType() {
069            return type;
070        }
071    
072        public String getJar() {
073            return jar;
074        }
075    
076        public Set getDependencies() {
077            return dependencies;
078        }
079    }