Richard S. Hall | 85bafab | 2009-07-13 13:25:46 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | |
| 20 | package org.cauldron.bld.core.internal.model.eclipse; |
| 21 | |
| 22 | import java.util.Collection; |
| 23 | import java.util.HashSet; |
| 24 | import java.util.Set; |
| 25 | |
| 26 | import org.cauldron.sigil.model.AbstractCompoundModelElement; |
| 27 | import org.cauldron.sigil.model.eclipse.ILibrary; |
| 28 | import org.cauldron.sigil.model.osgi.IPackageImport; |
| 29 | import org.cauldron.sigil.model.osgi.IRequiredBundle; |
| 30 | import org.osgi.framework.Version; |
| 31 | |
| 32 | public class Library extends AbstractCompoundModelElement implements ILibrary { |
| 33 | |
| 34 | private static final long serialVersionUID = 1L; |
| 35 | |
| 36 | private String name; |
| 37 | private Version version; |
| 38 | private Set<IRequiredBundle> bundles; |
| 39 | private Set<IPackageImport> imports; |
| 40 | |
| 41 | public Library() { |
| 42 | super("Library"); |
| 43 | bundles = new HashSet<IRequiredBundle>(); |
| 44 | imports = new HashSet<IPackageImport>(); |
| 45 | } |
| 46 | |
| 47 | public void addBundle(IRequiredBundle bundle) { |
| 48 | bundles.add(bundle); |
| 49 | } |
| 50 | |
| 51 | public void addImport(IPackageImport pi) { |
| 52 | imports.add(pi); |
| 53 | } |
| 54 | |
| 55 | public Collection<IRequiredBundle> getBundles() { |
| 56 | return bundles; |
| 57 | } |
| 58 | |
| 59 | public Collection<IPackageImport> getImports() { |
| 60 | return imports; |
| 61 | } |
| 62 | |
| 63 | public String getName() { |
| 64 | return name; |
| 65 | } |
| 66 | |
| 67 | public Version getVersion() { |
| 68 | return version; |
| 69 | } |
| 70 | |
| 71 | public void removeBundle(IRequiredBundle bundle) { |
| 72 | bundles.remove(bundle); |
| 73 | } |
| 74 | |
| 75 | public void removeImport(IPackageImport pi) { |
| 76 | imports.remove(pi); |
| 77 | } |
| 78 | |
| 79 | public void setName(String name) { |
| 80 | this.name = name; |
| 81 | } |
| 82 | |
| 83 | public void setVersion(Version version) { |
| 84 | this.version = version; |
| 85 | } |
| 86 | } |