KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > osgi > baseadaptor > loader > FragmentClasspath


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.osgi.baseadaptor.loader;
13
14 import java.io.IOException JavaDoc;
15 import java.security.ProtectionDomain JavaDoc;
16 import org.eclipse.osgi.baseadaptor.BaseData;
17 import org.osgi.framework.FrameworkEvent;
18
19 /**
20  * A FragmentClasspath contains all the <code>ClasspathEntry</code> objects for a fragment
21  * <code>BaseData</code>.
22  * @since 3.2
23  */

24 public class FragmentClasspath {
25     private BaseData bundledata;
26     private ClasspathEntry[] entries;
27     private ProtectionDomain JavaDoc domain;
28
29     public FragmentClasspath(BaseData bundledata, ClasspathEntry[] entries, ProtectionDomain JavaDoc domain) {
30         this.bundledata = bundledata;
31         this.entries = entries;
32         this.domain = domain;
33     }
34
35     /**
36      * Returns the fragment BaseData for this FragmentClasspath
37      * @return the fragment BaseData for this FragmentClasspath
38      */

39     public BaseData getBundleData() {
40         return bundledata;
41     }
42
43     /**
44      * Returns the fragment domain for this FragmentClasspath
45      * @return the fragment domain for this FragmentClasspath
46      */

47     public ProtectionDomain JavaDoc getDomain() {
48         return domain;
49     }
50
51     /**
52      * Returns the fragment classpath entries for this FragmentClasspath
53      * @return the fragment classpath entries for this FragmentClasspath
54      */

55     public ClasspathEntry[] getEntries() {
56         return entries;
57     }
58
59     /**
60      * Closes all the classpath entry resources for this FragmentClasspath.
61      *
62      */

63     public void close() {
64         for (int i = 0; i < entries.length; i++) {
65             try {
66                 entries[i].getBundleFile().close();
67             } catch (IOException JavaDoc e) {
68                 bundledata.getAdaptor().getEventPublisher().publishFrameworkEvent(FrameworkEvent.ERROR, bundledata.getBundle(), e);
69             }
70         }
71     }
72
73 }
74
Popular Tags