KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > osgi > framework > internal > protocol > bundleentry > Handler


1 /*******************************************************************************
2  * Copyright (c) 2004, 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.framework.internal.protocol.bundleentry;
13
14 import java.io.FileNotFoundException JavaDoc;
15 import java.io.IOException JavaDoc;
16 import java.net.URL JavaDoc;
17 import org.eclipse.osgi.baseadaptor.BaseData;
18 import org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry;
19 import org.eclipse.osgi.framework.internal.core.*;
20
21 /**
22  * URLStreamHandler the bundleentry protocol.
23  */

24
25 public class Handler extends BundleResourceHandler {
26
27     /**
28      * Constructor for a bundle protocol resource URLStreamHandler.
29      */

30     public Handler() {
31         super();
32     }
33
34     public Handler(BundleEntry bundleEntry) {
35         super(bundleEntry);
36     }
37
38     protected BundleEntry findBundleEntry(URL JavaDoc url, AbstractBundle bundle) throws IOException JavaDoc {
39         BaseData bundleData = (BaseData) bundle.getBundleData();
40         BundleEntry entry = bundleData.getBundleFile().getEntry(url.getPath());
41         if (entry == null)
42             throw new FileNotFoundException JavaDoc(url.getPath());
43         return entry;
44
45     }
46
47 }
48
Popular Tags