org.ungoverned.oscar
Class OSGiURLPolicy

java.lang.Object
  extended byorg.ungoverned.oscar.OSGiURLPolicy
All Implemented Interfaces:
URLPolicy

public class OSGiURLPolicy
extends java.lang.Object
implements URLPolicy


Constructor Summary
OSGiURLPolicy(Oscar oscar)
           
 
Method Summary
 java.net.URL createCodeSourceURL(ModuleManager mgr, Module module)
           This method should return a URL that represents the location from which the module originated.
 java.net.URL createResourceURL(ModuleManager mgr, Module module, int rsIdx, java.lang.String name)
           This method should return a URL that is suitable for accessing the bytes of the specified resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OSGiURLPolicy

public OSGiURLPolicy(Oscar oscar)
Method Detail

createCodeSourceURL

public java.net.URL createCodeSourceURL(ModuleManager mgr,
                                        Module module)
Description copied from interface: URLPolicy

This method should return a URL that represents the location from which the module originated. This URL can be used when assigning permissions to the module, such as is done in the Java permissions policy file.

Specified by:
createCodeSourceURL in interface URLPolicy
Parameters:
mgr - the ModuleManager of the module.
module - the module for which the URL is to be created.
Returns:
an URL to associate with the module.

createResourceURL

public java.net.URL createResourceURL(ModuleManager mgr,
                                      Module module,
                                      int rsIdx,
                                      java.lang.String name)
Description copied from interface: URLPolicy

This method should return a URL that is suitable for accessing the bytes of the specified resource. It must be possible open a connection to this URL, which may require that the implementer of this method also introduce a custom java.net.URLStreamHander when creating the URL.

Specified by:
createResourceURL in interface URLPolicy
Parameters:
mgr - the ModuleManager of the module.
module - the module for which the resource is being loaded.
rsIdx - the index of the ResourceSource containing the resource.
name - the name of the resource being loaded.
Returns:
an URL for retrieving the resource.