JPF 1.5.1

org.java.plugin.standard
Class StandardPluginLocation

java.lang.Object
  extended by org.java.plugin.standard.StandardPluginLocation
All Implemented Interfaces:
PluginManager.PluginLocation

public class StandardPluginLocation
extends java.lang.Object
implements PluginManager.PluginLocation

A standard implementation of plug-in location interface. It may be used to create plug-in locations from JAR or ZIP files of plug-in folders, or from any URL pointers.

Inspired by Per Cederberg.

Version:
$Id$

Constructor Summary
StandardPluginLocation(java.io.File file, java.lang.String manifestPath)
          Creates a new plug-in location from a jar or a zip file or a folder.
StandardPluginLocation(java.net.URL aContext, java.net.URL aManifest)
          Creates a new plug-in location from a given context an manifest URL's.
 
Method Summary
static PluginManager.PluginLocation create(java.io.File file)
          Creates plug-in location from a given file and checks that all required resources are available.
 java.net.URL getContextLocation()
           
 java.net.URL getManifestLocation()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StandardPluginLocation

public StandardPluginLocation(java.net.URL aContext,
                              java.net.URL aManifest)
Creates a new plug-in location from a given context an manifest URL's.

Parameters:
aContext - plug-in context URL
aManifest - plug-in manifest URL

StandardPluginLocation

public StandardPluginLocation(java.io.File file,
                              java.lang.String manifestPath)
                       throws java.net.MalformedURLException
Creates a new plug-in location from a jar or a zip file or a folder. This plug-in manifest file path specified is relative to the root directory of the jar or zip file or given folder.

Parameters:
file - the plug-in zip file or plug-in folder
manifestPath - the relative manifest path
Throws:
java.net.MalformedURLException - if the plug-in URL's couldn't be created
Method Detail

create

public static PluginManager.PluginLocation create(java.io.File file)
                                           throws java.net.MalformedURLException
Creates plug-in location from a given file and checks that all required resources are available. Before creating location object, this method probes given ZIP file of folder for presence of any of the following files: If any of those files present, a new plug-in location object created and returned.

Parameters:
file - plug-in JAR or ZIP file or plug-in folder
Returns:
created new plug-in location or null if given file doesn't points to a valid plug-in file or folder
Throws:
java.net.MalformedURLException - if the plug-in URL's couldn't be created

getManifestLocation

public java.net.URL getManifestLocation()
Specified by:
getManifestLocation in interface PluginManager.PluginLocation
Returns:
location of plug-in manifest
See Also:
PluginManager.PluginLocation.getManifestLocation()

getContextLocation

public java.net.URL getContextLocation()
Specified by:
getContextLocation in interface PluginManager.PluginLocation
Returns:
location of plug-in context ("home")
See Also:
PluginManager.PluginLocation.getContextLocation()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

JPF 1.5.1

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