|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
org.ceryle.util.ResourceOpener
public class ResourceOpener
ResourceOpener extends java.lang.Thread to open files or documents via file or URL connections, provided a File, a URL object, or a command line with parameters. This is designed to resolve and open all URIs encountered within the application.
These are processed and fed into new or existing ViewFrames in the Ceryle Desktop, depending on the type of new content and the current front view type. In the case of content types that require external applications, these are opened when their content type is known (currently, only PDF is supported on unix/linux).
Note: Handling of MIME types not supported natively by Ceryle is done by external "Helper Applications" whose MIME types and application paths must be registered under Preferences.
Copyright 2001-2007 Murray Altheim. All Rights Reserved.
See LICENSE included with distribution.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
Thread.State, Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
static int |
PROTOCOL_FILE
A int indicating the HTTP protocol for files, "file". |
static String |
PROTOCOL_FILE_STR
|
static int |
PROTOCOL_FRAGID
A int indicating a relative URL reference (eg., "#id"; not strictly a protocol). |
static int |
PROTOCOL_HTTP
A int indicating the HTTP protocol for HTTP, "http". |
static String |
PROTOCOL_HTTP_STR
|
static int |
PROTOCOL_UNKNOWN
A int indicating an unknown protocol (-1). |
static int |
PROTOCOL_URN
A int indicating the HTTP protocol for URNs, "urn" (not strictly a protocol). |
static String |
PROTOCOL_URN_STR
|
static int |
PROTOCOL_XNODE
A int indicating the HTTP protocol for XNode, "xnode". |
static String |
PROTOCOL_XNODE_STR
|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
ResourceOpener(File file,
ViewFrame vf)
Constructor provided a File. |
|
ResourceOpener(String[] ids,
ViewFrame vf)
Constructor provided an array of Strings containing the Collection ID, Node ID, and fragment ID (resp.). |
|
ResourceOpener(URL url,
ViewFrame vf)
Constructor provided a URL. |
|
ResourceOpener(XNodeID xid,
ViewFrame vf)
Constructor provided an XNodeID indicating the Collection ID and Node ID. |
|
| Method Summary | |
|---|---|
PlainDocument |
getDocument()
Returns the PlainDocument opened, null if unavailable. |
MIME |
getMIMEtype()
Returns the MIME type of the last document opened (or if this has been set), null if unavailable. |
static String |
getProlog(XNode xnode,
int method)
Provided an XNode xnode with a content type of XML or XHTML, checks for DOCTYPE or other prolog stored properties, and returns a reconstruction to the document prolog. |
static int |
getProtocol(String uriRef)
A static method that returns the URL protocol as an int. |
String |
getResponse()
Returns the http response of the last document opened, null if unavailable. |
static int |
getScheme(URI uri)
A static method that returns the URI scheme as an int. |
String |
getSystemId()
Returns the system identifier of the last document opened, null if unavailable. |
XNode |
getXNode()
Returns the XNode opened, null if unavailable. |
protected void |
initialize()
Initialization upon construction of common member variables. |
PlainDocument |
openXNode(XNodeID xid,
PlainDocument pdoc)
Open the XNode indicated by the XNodeID xid. |
boolean |
processRequest(MIME mime,
String systemId,
File file)
Processes the file request if a Helper Application for the system identifier and/or MIME type is available, returning true if it was handled. |
boolean |
processRequest(MIME mime,
String systemId,
URL url)
Processes the URL request if a Helper Application for the system identifier and/or MIME type, returning true if it was handled. |
void |
run()
Starts the thread by calling start(). |
void |
setActionListener(ActionListener listener)
Sets an ActionListener to listen for successful loading of the PlainDocument. |
void |
setActiveBrowser(boolean active)
When set true, requests to load documents with recognized MIME types that have been registered for support by helper applications are sent off to load via those applications. |
void |
setDocument(PlainDocument doc)
Returns the PlainDocument opened, null if unavailable. |
void |
setMIMEType(MIME type)
Presets the MIME type in preparation for the document to be opened. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int PROTOCOL_UNKNOWN
public static final int PROTOCOL_HTTP
public static final int PROTOCOL_FILE
public static final int PROTOCOL_XNODE
public static final int PROTOCOL_URN
public static final int PROTOCOL_FRAGID
public static final String PROTOCOL_HTTP_STR
public static final String PROTOCOL_FILE_STR
public static final String PROTOCOL_XNODE_STR
public static final String PROTOCOL_URN_STR
| Constructor Detail |
|---|
public ResourceOpener(URL url,
ViewFrame vf)
public ResourceOpener(File file,
ViewFrame vf)
throws MalformedURLException
MalformedURLException
public ResourceOpener(XNodeID xid,
ViewFrame vf)
throws ProcessException
ProcessException
public ResourceOpener(String[] ids,
ViewFrame vf)
throws ProcessException
ProcessException| Method Detail |
|---|
protected void initialize()
public void setActiveBrowser(boolean active)
public void run()
run in interface Runnablerun in class Threadpublic void setMIMEType(MIME type)
public MIME getMIMEtype()
public String getSystemId()
public String getResponse()
public void setActionListener(ActionListener listener)
public XNode getXNode()
public PlainDocument getDocument()
public void setDocument(PlainDocument doc)
public PlainDocument openXNode(XNodeID xid,
PlainDocument pdoc)
throws XNodeException,
ProcessException
XNodeException
ProcessException
public boolean processRequest(MIME mime,
String systemId,
File file)
public boolean processRequest(MIME mime,
String systemId,
URL url)
If the provided helper application String includes "$FILE", assume that there are command line parameters and substitute the URL for "%1", otherwise append it to the end of the path.
E.g., a helper path of /usr/bin/acroread will create a command line of (where "file:/boo.pdf" is the provided URL):
/usr/bin/acroread file:/boo.pdf
whereas a helper path of /usr/bin/mozilla -remote "openURL(%1)"
will create a command line of:
/usr/bin/mozilla -remote "openURL(file:/boo.pdf)"
public static String getProlog(XNode xnode,
int method)
public static int getProtocol(String uriRef)
public static int getScheme(URI uri)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||