net.sf.fmj.registry
Class Registry

java.lang.Object
  extended by net.sf.fmj.registry.Registry

public class Registry
extends java.lang.Object

This is a registry of Plugins, Protocol prefixes, Content prefixes, and MIME types. The registry may be serialized to an XML. The XML file is nominally located in ${user.home}/.fmj.registry.xml This object is used by the PackageManager and the PluginManager for persisting data across sessions. Currently the Registry does not store the supported input and output formats for Plugins. This may be supported by adding CDATA sections that are serialized Format objects. However, it would be good to be able to clear the stored formats, and refresh the supported formats by introspecting the Plugins. Sometimes the installed plugins may be updated, and the list of supported formats may change for the same plugin class. Nevertheless, the present situation is that the PluginManager will need to determine supported formats upon loading informatin from this Registry. TODO separate the persistence mechanism from this object, so that it may be updated/plugged-in. TODO perhaps remove reliance on JDOM. Although JDOM makes it easy to program, it is another jar to ship.

Author:
Warren Bloomer, Ken Larson

Field Summary
static int NUM_PLUGIN_TYPES
           
 
Method Summary
 boolean addDevice(CaptureDeviceInfo newDevice)
           
 void addMimeType(java.lang.String extension, java.lang.String type)
           
 void commit()
          Write the registry to file.
 java.util.Vector<java.lang.String> getContentPrefixList()
           
 java.lang.String getDefaultExtension(java.lang.String mimeType)
           
 java.util.Vector<CaptureDeviceInfo> getDeviceList()
           
 java.util.List getExtensions(java.lang.String mimeType)
           
static Registry getInstance()
          Get the singleton.
 java.util.Hashtable getMimeTable()
           
 java.lang.String getMimeType(java.lang.String extension)
           
 java.util.List<java.lang.String> getPluginList(int pluginType)
          pluginType = [1..NUM_PLUGIN_TYPES]
 java.util.Vector<java.lang.String> getProtocolPrefixList()
           
 boolean removeDevice(CaptureDeviceInfo device)
           
 boolean removeMimeType(java.lang.String fileExtension)
           
 void setContentPrefixList(java.util.List<java.lang.String> list)
          Prefices for determining Handlers for content of particular MIME types.
 void setPluginList(int pluginType, java.util.List<java.lang.String> plugins)
          Plugin list of PluginInfo objects = { classname, inputFormats, outputFormats, pluginType};
 void setProtocolPrefixList(java.util.List<java.lang.String> list)
          Prefices for determining URL Handlers for content delivered via particular protocol.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUM_PLUGIN_TYPES

public static final int NUM_PLUGIN_TYPES
See Also:
Constant Field Values
Method Detail

getInstance

public static Registry getInstance()
Get the singleton.

Returns:
The singleton JmfRegistry object.

commit

public void commit()
            throws java.io.IOException
Write the registry to file.

Throws:
java.io.IOException

getPluginList

public java.util.List<java.lang.String> getPluginList(int pluginType)
pluginType = [1..NUM_PLUGIN_TYPES]


setPluginList

public void setPluginList(int pluginType,
                          java.util.List<java.lang.String> plugins)
Plugin list of PluginInfo objects = { classname, inputFormats, outputFormats, pluginType};

Parameters:
pluginType - range of [1..NUM_PLUGIN_TYPES]
plugins -

setProtocolPrefixList

public void setProtocolPrefixList(java.util.List<java.lang.String> list)
Prefices for determining URL Handlers for content delivered via particular protocol. Protocols are converted to package names, e.g. "http" -> "http" These package names are added to the prefices in this list to determine Handlers for them. i.e. "prefix.media.protocol.http.Handler" TODO perhaps use URLStreamHandlers


getProtocolPrefixList

public java.util.Vector<java.lang.String> getProtocolPrefixList()

setContentPrefixList

public void setContentPrefixList(java.util.List<java.lang.String> list)
Prefices for determining Handlers for content of particular MIME types. MIME types are converted to package names, e.g. text/html -> text.html These package names are added to the prefices in this list to determine Handlers for them. i.e. "prefix.media.content.text.html.Handler"


getContentPrefixList

public java.util.Vector<java.lang.String> getContentPrefixList()

addMimeType

public void addMimeType(java.lang.String extension,
                        java.lang.String type)

getMimeType

public java.lang.String getMimeType(java.lang.String extension)

getDefaultExtension

public java.lang.String getDefaultExtension(java.lang.String mimeType)

getMimeTable

public java.util.Hashtable getMimeTable()

removeMimeType

public boolean removeMimeType(java.lang.String fileExtension)

getExtensions

public java.util.List getExtensions(java.lang.String mimeType)

getDeviceList

public java.util.Vector<CaptureDeviceInfo> getDeviceList()

addDevice

public boolean addDevice(CaptureDeviceInfo newDevice)

removeDevice

public boolean removeDevice(CaptureDeviceInfo device)