org.springframework.extensions.config.source
Class UrlConfigSource

java.lang.Object
  extended by org.springframework.extensions.config.source.BaseConfigSource
      extended by org.springframework.extensions.config.source.UrlConfigSource
All Implemented Interfaces:
ConfigSource, org.springframework.web.context.ServletContextAware

public class UrlConfigSource
extends BaseConfigSource
implements org.springframework.web.context.ServletContextAware

ConfigSource that looks for a prefix to determine where to look for the config.
Valid prefixes are:

The default, if none of the above is detected, is classpath. An example of a URL is file:/home/root/settings/config.xml.

Author:
Derek Hulley, gavinc

Field Summary
static String PREFIX_CLASSPATH
           
static String PREFIX_FILE
           
static String PREFIX_HTTP
           
static String PREFIX_JAR
           
static String PREFIX_WEBAPP
           
 
Constructor Summary
UrlConfigSource(List<String> sourceLocations)
          Constructs a config location that figures out where to look for the config
UrlConfigSource(String sourceLocation)
          Constructs a config location that figures out where to look for the config
 
Method Summary
 InputStream getInputStream(String sourceUrl)
          Retrieves an InputStream to the source represented by the given source location.
protected  void processSourceString(String sourceString)
          Processes the given source string and adds the resulting config source files to the list to be parsed.
protected  void processWildcardJarSource(String sourcePattern)
          Processes the given JAR file pattern source.
 void setServletContext(javax.servlet.ServletContext servletContext)
           
 
Methods inherited from class org.springframework.extensions.config.source.BaseConfigSource
addSourceString, getConfigDeployments
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFIX_JAR

public static final String PREFIX_JAR
See Also:
Constant Field Values

PREFIX_FILE

public static final String PREFIX_FILE
See Also:
Constant Field Values

PREFIX_HTTP

public static final String PREFIX_HTTP
See Also:
Constant Field Values

PREFIX_CLASSPATH

public static final String PREFIX_CLASSPATH
See Also:
Constant Field Values

PREFIX_WEBAPP

public static final String PREFIX_WEBAPP
See Also:
Constant Field Values
Constructor Detail

UrlConfigSource

public UrlConfigSource(String sourceLocation)
Constructs a config location that figures out where to look for the config

Parameters:
sourceLocation - The location from which to get config
See Also:
ClassPathConfigSource.ClassPathConfigSource(java.util.List)

UrlConfigSource

public UrlConfigSource(List<String> sourceLocations)
Constructs a config location that figures out where to look for the config

Parameters:
sourceLocations - List of locations from which to get the config
Method Detail

setServletContext

public void setServletContext(javax.servlet.ServletContext servletContext)
Specified by:
setServletContext in interface org.springframework.web.context.ServletContextAware

getInputStream

public InputStream getInputStream(String sourceUrl)
Description copied from class: BaseConfigSource
Retrieves an InputStream to the source represented by the given source location. The meaning of the source location will depend on the implementation.

Specified by:
getInputStream in class BaseConfigSource
Parameters:
sourceUrl - the source location
Returns:
Returns an InputStream to the named source location

processSourceString

protected void processSourceString(String sourceString)
Processes the given source string and adds the resulting config source files to the list to be parsed.

If the sourceString contains a wildcard the appropriate resolution processing is performed to obtain a list of physical locations.

Parameters:
sourceString -

processWildcardJarSource

protected void processWildcardJarSource(String sourcePattern)
Processes the given JAR file pattern source. The classpath will be searched for JAR files that contain files that match the given pattern. NOTE: Currently only files within the META-INF folder are supported i.e. patterns that look like "jar:*!/META-INF/[filename]"

Parameters:
sourcePattern - The wildcard pattern for files to find within JARs


Copyright © 2009 SpringSource, Inc. All Rights Reserved.