Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.gemini.blueprint.io
Class OsgiBundleResourcePatternResolver

    java.lang.Object
      org.springframework.core.io.support.PathMatchingResourcePatternResolver
          org.eclipse.gemini.blueprint.io.OsgiBundleResourcePatternResolver

All Implemented Interfaces:
  org.springframework.core.io.ResourceLoader, org.springframework.core.io.support.ResourcePatternResolver

    public class OsgiBundleResourcePatternResolver

extends org.springframework.core.io.support.PathMatchingResourcePatternResolver

OSGi-aware `ResourcePatternResolver`. Can find resources in the bundle jar and bundle space. See `OsgiBundleResource` for more information.

ClassPath support

As mentioned by `PathMatchingResourcePatternResolver`, class-path pattern matching needs to resolve the class-path structure to a file-system location (be it an actual folder or a jar). Inside the OSGi environment this is problematic as the bundles can be loaded in memory directly from input streams. To avoid relying on each platform bundle storage structure, this implementation tries to determine the bundles that assemble the given bundle class-path and analyze each of them individually. This involves the bundle archive (including special handling of the `Bundle-Classpath` as it is computed at runtime), the bundle required packages and its attached fragments. Depending on the configuration of running environment, this might cause significant IO activity which can affect performance.

Note: Currently, static imports as well as `Bundle-Classpath` and `Required-Bundle` entries are supported. Support for `DynamicPackage-Import` depends on how/when the underlying platform does the wiring between the dynamically imported bundle and the given bundle.

Portability Note: Since it relies only on the OSGi API, this implementation depends heavily on how closely the platform implements the OSGi spec. While significant tests have been made to ensure compatibility, one might experience different behaviour especially when dealing with jars with missing folder entries or boot-path delegation. It is strongly recommended that wildcard resolution be thoroughly tested before switching to a different platform before you rely on it.

Author:
  Costin Leau
See Also:
  `Bundle`, `OsgiBundleResource`, `PathMatchingResourcePatternResolver`

Field Summary

Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver
`CLASSPATH_ALL_URL_PREFIX`

Fields inherited from interface org.springframework.core.io.ResourceLoader
`CLASSPATH_URL_PREFIX`

Constructor Summary
`OsgiBundleResourcePatternResolver(org.osgi.framework.Bundle bundle)`
`OsgiBundleResourcePatternResolver(org.springframework.core.io.ResourceLoader resourceLoader)`

Method Summary
`protected org.springframework.core.io.Resource[]` | `findResources(String locationPattern)` Finds existing resources.
`org.springframework.core.io.Resource[]` | `getResources(String locationPattern)`
`protected boolean` | `isJarResource(org.springframework.core.io.Resource resource)` Overrides the default check up since computing the URL can be fairly expensive operation as there is no caching (due to the framework dynamic nature).

Methods inherited from class org.springframework.core.io.support.PathMatchingResourcePatternResolver
`convertClassLoaderURL, determineRootDir, doFindMatchingFileSystemResources, doFindPathMatchingFileResources, doFindPathMatchingJarResources, doRetrieveMatchingFiles, findAllClassPathResources, findPathMatchingResources, getClassLoader, getJarFile, getPathMatcher, getResource, getResourceLoader, resolveRootDirResource, retrieveMatchingFiles, setPathMatcher`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### OsgiBundleResourcePatternResolver

    public OsgiBundleResourcePatternResolver(org.osgi.framework.Bundle bundle)

### OsgiBundleResourcePatternResolver

    public OsgiBundleResourcePatternResolver(org.springframework.core.io.ResourceLoader resourceLoader)

Method Detail

### findResources

    protected org.springframework.core.io.Resource[] findResources(String locationPattern)
                                                            throws IOException

  Finds existing resources. This method returns the actual resources found w/o adding any extra decoration (such as non-existing resources).

  Parameters:
    `locationPattern` - location pattern
  Returns:
    found resources (w/o any decoration)
  Throws:
    `IOException` - in case of I/O errors

### getResources

    public org.springframework.core.io.Resource[] getResources(String locationPattern)
                                                        throws IOException

  Specified by:
    `getResources` in interface `org.springframework.core.io.support.ResourcePatternResolver`
  Overrides:
    `getResources` in class `org.springframework.core.io.support.PathMatchingResourcePatternResolver`
  Throws:
    `IOException`

### isJarResource

    protected boolean isJarResource(org.springframework.core.io.Resource resource)
                             throws IOException

  Overrides the default check up since computing the URL can be fairly expensive operation as there is no caching (due to the framework dynamic nature).

  Overrides:
    `isJarResource` in class `org.springframework.core.io.support.PathMatchingResourcePatternResolver`
  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2012. All Rights Reserved.