org.ofbiz.base.location
Class FlexibleLocation

java.lang.Object
  extended by org.ofbiz.base.location.FlexibleLocation

public class FlexibleLocation
extends java.lang.Object

A special location resolver that uses Strings like URLs, but with more options


Field Summary
protected static java.lang.String classpathResolverName
           
protected static java.lang.String componentResolverName
           
protected static java.util.Map<java.lang.String,java.lang.String> defaultResolvers
           
protected static java.util.Map<java.lang.String,LocationResolver> locationResolvers
           
protected static java.lang.String ofbizHomeResolverName
           
protected static java.lang.String standardUrlResolverName
           
 
Constructor Summary
FlexibleLocation()
           
 
Method Summary
static java.lang.String getLocationType(java.lang.String location)
          Find the location type descriptor for the passed location String; generally is all text before the first ":" character.
static java.net.URL resolveLocation(java.lang.String location)
          Resolves the gives location into a URL object for use in various ways.
static java.net.URL resolveLocation(java.lang.String location, java.lang.ClassLoader loader)
           
static java.lang.String stripLocationType(java.lang.String location)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

locationResolvers

protected static java.util.Map<java.lang.String,LocationResolver> locationResolvers

defaultResolvers

protected static java.util.Map<java.lang.String,java.lang.String> defaultResolvers

standardUrlResolverName

protected static java.lang.String standardUrlResolverName

classpathResolverName

protected static java.lang.String classpathResolverName

ofbizHomeResolverName

protected static java.lang.String ofbizHomeResolverName

componentResolverName

protected static java.lang.String componentResolverName
Constructor Detail

FlexibleLocation

public FlexibleLocation()
Method Detail

resolveLocation

public static java.net.URL resolveLocation(java.lang.String location)
                                    throws java.net.MalformedURLException
Resolves the gives location into a URL object for use in various ways. The general format of the location is like a URL: {locationType}://location/path/file.ext Supports standard locationTypes like http, https, ftp, jar, & file Supports a classpath location type for when desired to be used like any other URL Supports OFBiz specific location types like ofbizhome and component Supports additional locationTypes specified in the locationresolvers.properties file

Parameters:
location - The location String to parse and create a URL from
Returns:
URL object corresponding to the location String passed in
Throws:
java.net.MalformedURLException

resolveLocation

public static java.net.URL resolveLocation(java.lang.String location,
                                           java.lang.ClassLoader loader)
                                    throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException

getLocationType

public static java.lang.String getLocationType(java.lang.String location)
Find the location type descriptor for the passed location String; generally is all text before the first ":" character. If no type descriptor is found, defaults to "classpath".


stripLocationType

public static java.lang.String stripLocationType(java.lang.String location)