JPF 0.10

org.java.plugin.standard
Class StandardPathResolver

java.lang.Object
  extended byorg.java.plugin.standard.StandardPathResolver
All Implemented Interfaces:
PathResolver
Direct Known Subclasses:
ShadingPathResolver

public class StandardPathResolver
extends java.lang.Object
implements PathResolver

Standard simple implementation of path resolver. For resolving it uses plug-in element registration (see registerContext(Identity, URL)) procedure.

Version:
$Id: StandardPathResolver.java,v 1.11 2006/04/08 15:44:34 ddimon Exp $

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
StandardPathResolver()
           
 
Method Summary
 void configure(ExtendedProperties config)
          No configuration parameters expected in this implementation.
 java.net.URL getRegisteredContext(java.lang.String id)
          Returns URL of registered plug-in element context.
 boolean isContextRegistered(java.lang.String id)
           
 boolean isResourceExists(java.net.URL url)
          Should check if resource exists and can be opened.
 void registerContext(Identity idt, java.net.URL url)
          This implementation accepts PluginDescriptor or PluginFragment as valid plug-in elements.
 java.net.URL resolvePath(Identity identity, java.lang.String path)
          Should resolve given path to URL for a given identity.
protected  java.net.URL resolvePath(java.net.URL baseUrl, java.lang.String path)
          Resolves given path against given base URL.
 void unregisterContext(java.lang.String id)
          Unregisters plug-in element from this path resolver.
 java.io.File url2file(java.net.URL url)
          Utility method to convert local URL to a File object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.apache.commons.logging.Log log
Constructor Detail

StandardPathResolver

public StandardPathResolver()
Method Detail

registerContext

public void registerContext(Identity idt,
                            java.net.URL url)
This implementation accepts PluginDescriptor or PluginFragment as valid plug-in elements.

Specified by:
registerContext in interface PathResolver
Parameters:
idt - plug-in element
url - "home" URL for a given plug-in element
See Also:
PathResolver.registerContext( org.java.plugin.registry.Identity, java.net.URL)

unregisterContext

public void unregisterContext(java.lang.String id)
Description copied from interface: PathResolver
Unregisters plug-in element from this path resolver.

Specified by:
unregisterContext in interface PathResolver
Parameters:
id - plug-in element identifier
See Also:
PathResolver.unregisterContext(java.lang.String)

resolvePath

public java.net.URL resolvePath(Identity identity,
                                java.lang.String path)
Description copied from interface: PathResolver
Should resolve given path to URL for a given identity.

Specified by:
resolvePath in interface PathResolver
Parameters:
identity - plug-in element for which to resolve path
path - path to be resolved
Returns:
resolved absolute URL
See Also:
PathResolver.resolvePath( org.java.plugin.registry.Identity, java.lang.String)

getRegisteredContext

public java.net.URL getRegisteredContext(java.lang.String id)
Description copied from interface: PathResolver
Returns URL of registered plug-in element context. If context for plug-in element with given ID not registered, this method should throw an IllegalArgumentException. In other words, this method shouldn't return null.

Specified by:
getRegisteredContext in interface PathResolver
Parameters:
id - plug-in element identifier
Returns:
registered context "home" location
See Also:
PathResolver.getRegisteredContext(java.lang.String)

isContextRegistered

public boolean isContextRegistered(java.lang.String id)
Specified by:
isContextRegistered in interface PathResolver
Parameters:
id - plug-in element identifier
Returns:
true if context for plug-in element with given ID registered
See Also:
PathResolver.isContextRegistered(java.lang.String)

resolvePath

protected java.net.URL resolvePath(java.net.URL baseUrl,
                                   java.lang.String path)
Resolves given path against given base URL.

Parameters:
baseUrl - base URL to resolve given path
path - path to be resolved
Returns:
resolved URL

configure

public void configure(ExtendedProperties config)
               throws java.lang.Exception
No configuration parameters expected in this implementation.

Specified by:
configure in interface PathResolver
Parameters:
config - path resolver configuration data
Throws:
java.lang.Exception - if any error has occurred
See Also:
PathResolver.configure(ExtendedProperties)

isResourceExists

public boolean isResourceExists(java.net.URL url)
Description copied from interface: PathResolver
Should check if resource exists and can be opened.

Specified by:
isResourceExists in interface PathResolver
Parameters:
url - absolute URL which points to a resource to be checked
Returns:
true if given URL points to an existing resource

url2file

public java.io.File url2file(java.net.URL url)
Description copied from interface: PathResolver
Utility method to convert local URL to a File object.

Specified by:
url2file in interface PathResolver
Parameters:
url - an URL
Returns:
file object for given URL or null if URL is not local

JPF 0.10

Copyright © 2004-2005 Dmitry Olshansky. All Rights Reserved.