blob: ee92561fff6a119b93e4c9da3578f211dc71f5a1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/***************************************************************************
* Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
package org.eclipse.internal.net4j.bundle;
import org.eclipse.net4j.util.IOUtil;
import org.eclipse.core.runtime.FileLocator;
import org.osgi.framework.BundleContext;
import java.io.IOException;
import java.net.URL;
/**
* @author Eike Stepper
*/
public class OSGiBundle extends AbstractOMBundle
{
public OSGiBundle(AbstractOMPlatform platform, String bundleID, Class accessor)
{
super(platform, bundleID, accessor);
}
@Override
public BundleContext getBundleContext()
{
return (BundleContext)super.getBundleContext();
}
public URL getBaseURL()
{
try
{
URL entry = getBundleContext().getBundle().getEntry("."); //$NON-NLS-1$
return FileLocator.resolve(entry);
}
catch (IOException ex)
{
IOUtil.print(ex);
return null;
}
}
}
|