JPF 1.5.1

org.java.plugin.standard
Class StandardPathResolver

java.lang.Object
  extended by org.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$

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)
           
protected  java.net.URL maybeJarUrl(java.net.URL url)
           
 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.
 
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

maybeJarUrl

protected java.net.URL maybeJarUrl(java.net.URL url)
                            throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException

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)

JPF 1.5.1

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