|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.core.io.AbstractResource org.springframework.osgi.io.OsgiBundleResource
public class OsgiBundleResource
Resource implementation for OSGi environments.
Lazy evaluation of the resource will be used. This implementation allows resource location inside:BUNDLE_URL_PREFIX
prefix is being used or
none is specifiedBUNDLE_JAR_URL_PREFIX
is specifiedResourceLoader.CLASSPATH_URL_PREFIX
is
encounteredOsgiBundleResourcePatternResolver
to retrieve all entries.
Field Summary | |
---|---|
static String |
BUNDLE_JAR_URL_PREFIX
Prefix for searching only the bundle raw jar. |
static String |
BUNDLE_URL_PREFIX
Prefix for searching inside the owning bundle space. |
Constructor Summary | |
---|---|
OsgiBundleResource(Bundle bundle,
String path)
|
Method Summary | |
---|---|
Resource |
createRelative(String relativePath)
This implementation creates a OsgiBundleResource, applying the given path relative to the path of the underlying resource of this descriptor. |
boolean |
equals(Object obj)
This implementation compares the underlying bundle and path locations. |
Bundle |
getBundle()
Return the bundle for this resource. |
String |
getDescription()
This implementation returns a description that includes the bundle location. |
File |
getFile()
|
String |
getFilename()
This implementation returns the name of the file that this bundle path resource refers to. |
InputStream |
getInputStream()
This implementation opens an InputStream for the given URL. |
String |
getPath()
Return the path for this resource. |
protected URL |
getResourceFromBundleClasspath(String bundlePath)
Resolves a resource from the bundle's classpath. |
protected URL |
getResourceFromBundleJar(String bundlePath)
Resolves a resource from the *bundle jar* only. |
protected URL |
getResourceFromBundleSpace(String bundlePath)
Resolves a resource from *the bundle space* only. |
protected URL |
getResourceFromFilesystem(String fileName)
Resolves a resource from the filesystem. |
int |
getSearchType()
|
URL |
getURL()
Locates the resource in the underlying bundle based on the prefix, if it exists. |
int |
hashCode()
This implementation returns the hash code of the underlying class path location. |
protected boolean |
isRelativePath(String locationPath)
Determine if the given path is relative or absolute. |
Methods inherited from class org.springframework.core.io.AbstractResource |
---|
exists, isOpen, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String BUNDLE_URL_PREFIX
public static final String BUNDLE_JAR_URL_PREFIX
Constructor Detail |
---|
public OsgiBundleResource(Bundle bundle, String path)
Method Detail |
---|
public final String getPath()
public final Bundle getBundle()
public InputStream getInputStream() throws IOException
false
, mainly to avoid jar file
locking on Windows.
IOException
URL.openConnection()
,
URLConnection.setUseCaches(boolean)
,
URLConnection.getInputStream()
public URL getURL() throws IOException
getURL
in interface Resource
getURL
in class AbstractResource
IOException
Bundle.getEntry(String)
,
Bundle.getResource(String)
protected URL getResourceFromFilesystem(String fileName)
fileName
-
protected URL getResourceFromBundleSpace(String bundlePath) throws IOException
OsgiBundleResourcePatternResolver
.
bundlePath
- the path to resolve
IOException
org.osgi.framework.Bundle#findEntries(String, String, boolean)}
protected URL getResourceFromBundleJar(String bundlePath) throws IOException
bundlePath
- the path to resolve
IOException
Bundle#getEntry(String)}
protected URL getResourceFromBundleClasspath(String bundlePath)
bundlePath
-
Bundle.getResource(String)
protected boolean isRelativePath(String locationPath)
locationPath
-
public Resource createRelative(String relativePath)
createRelative
in interface Resource
createRelative
in class AbstractResource
StringUtils.applyRelativePath(String,
String)
public String getFilename()
getFilename
in interface Resource
getFilename
in class AbstractResource
StringUtils.getFilename(String)
public File getFile() throws IOException
getFile
in interface Resource
getFile
in class AbstractResource
IOException
public String getDescription()
public boolean equals(Object obj)
equals
in class AbstractResource
public int hashCode()
hashCode
in class AbstractResource
public int getSearchType()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |