|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ceryle.xml.Services
public class Services
A singleton class providing a set of core services to a Ceryle processor or class. This includes (in the order of instantiation):
To obtain the instance of this class:
Services srvs = Services.getInstance();
Constants,
MessageHandler,
PropertyManager,
XMLProcessor,
XNodeStoreImpl| Field Summary | |
|---|---|
static String |
defaultCatalogPath
The default relative pathname for the XML Catalog file. |
static String |
FORM_TEMPLATE_ID
A String constant containing the ID of the default form template for a given Collection. |
File |
homeDirectory
The Ceryle application home directory. |
URL |
homeDirectoryURL
The Ceryle application home directory as a URL. |
protected org.apache.xml.resolver.tools.CatalogResolver |
m_catalogResolver
The CatalogResolver used to resolve XML entity references. |
protected Hashtable |
m_ext2HAPath
The lookup table for file extension to Helper Application path. |
protected Hashtable |
m_mime2HAPath
The lookup table for MIME type (as String) to Helper Application path. |
static File |
resourceDir
The Ceryle resource directory. |
| Method Summary | |
|---|---|
void |
dbAction(XNodeState state)
Uses an XNodeState as a directive to control the database. |
void |
disposeWelcomeWindow(MessageWriter messagewriter)
Closes and disposes of the WelcomeWindow, if it is displayed. |
static String |
error(String id)
A static convenience method that passes the error off to the MessageHandler. |
static String |
error(String id,
String arg)
A static convenience method that passes the error off to the MessageHandler. |
static String |
error(String id,
String arg1,
String arg2)
A static convenience method that passes the error off to the MessageHandler. |
static String |
error(String id,
String arg1,
String arg2,
String arg3)
A static convenience method that passes the error off to the MessageHandler. |
List |
getAvailableFonts()
Returns an unmodifiable List containing the available Fonts. |
String[] |
getBaseOntologies()
Loads the URLs of the three base ontologies: minimal, upper, and middle. |
org.apache.xml.resolver.tools.CatalogResolver |
getCatalogResolver()
This returns the single instance of a CatalogResolver, to be reused by all XMLProcessors. |
SetModel |
getCollectionIndex()
Returns the list of database Collections as a SetModel, an empty SetModel (rather than null) if no database * connection is available. |
int |
getCollectionSize()
Returns the count of database Collections as a int. |
File |
getDefaultDirectory()
Returns the default (user) directory for file operations. |
Font |
getFont(int fontNumber)
Return an existing application font based on index. |
Font |
getFont(String basename)
Return a Font provided its property base name and style. |
GroovyService |
getGroovyService()
Returns a GroovyService object, providing Groovy interpretation and console services. |
String |
getHelperFromExt(String ext)
Returns a path to a Helper Application provided a file extension, null if none has been registered for that extension. |
String |
getHelperFromMIME(String mime)
Returns a path to a Helper Application provided a MIME type, null if none has been registered for that type. |
String |
getHelperFromPath(String systemId)
Returns a path to a Helper Application provided a file extension, null if none has been registered for that extension. |
IDFactory |
getIDFactory()
Returns a reusable IDFactory that produces XML Name-compatible random words. |
String |
getImagePath()
Returns the path to the image directory (used for building a GUI, etc.). |
static Services |
getInstance()
As this is a singleton class, this returns the single instance of this class using the defaults for the properties file and settings (ui,merge,xmlns-aware,validating). |
static Services |
getInstance(MessageHandlerImpl messagehandler,
String propertiesFile,
int settings)
As this is a singleton class, this returns the single instance of this class provided with the optional MessageHandlerImpl, the property file filename and bit-wise application settings. |
MessageHandler |
getMessageHandler()
Returns the current MessageHandler. |
MessageHandlerImpl |
getMessageHandlerImpl()
Returns the current MessageHandler as its implementing class MessageHandlerImpl (which has more features). |
PropertyManager |
getPropertyManager()
Returns the current PropertyManager. |
int |
getSettings()
Returns the current settings as an int. |
ThreadGroup |
getThreadGroup()
Returns the ThreadGroup used with Ceryle (named "Ceryle"). |
TopicMapProcessor |
getTopicMapProcessor()
Returns the TopicMapProcessor providing topic map processing services. |
TopicMapProcessor |
getTopicMapProcessor(boolean create)
Returns the TopicMapProcessor providing topic map processing services. |
String |
getXDatabaseURI(String cid,
String nid)
Returns a URI-like String representing the Collection ID cid and Node ID id using the currently available database (if DB services are unavailable, returns null). |
XMLProcessor |
getXMLProcessor()
Returns the current XMLProcessor, whose validation status is set by the current validation setting. |
XMLProcessor |
getXMLProcessor(boolean validating)
Returns a well-formed or validating XML processor based on the boolean value of validating, creating the processor if it doesn't yet exist. |
XNodeStore |
getXNodeStore()
Returns a lazily-instantiated XNodeStore, providing database services. |
void |
importTinyFont()
Imports the tiny font as a set of resources. |
boolean |
isConnected()
Returns true if a database connection is currently available. |
boolean |
isDeveloper()
Returns true if operating in developer mode. |
boolean |
isVerbose()
Returns the current "verbose" setting. |
static String |
message(String id)
A static convenience method that passes the message off to the MessageHandler. |
protected static void |
postInstantiation(Services srvs)
This starts up any application services that can only be created after the Services object is available. |
static String |
printMemoryUsage()
Returns a string containing the current free memory statistic. |
String |
printStackTrace(Throwable t)
Prints the stack trace from the provided Throwable (usually, an Exception) to the MessageHandler. |
boolean |
ready()
Returns true if the system services are ready. |
void |
resetHelperApplications()
Resets the Helper Application lookup table. |
File |
resolvePath(String filename)
Provided with a filename, returns a File. |
protected void |
setAvailableFonts()
Sets the ArrayList to contain the list of fonts available in the current environment. |
protected void |
setCatalogResolverProperties()
Sets CatalogResolver (System-based) properties. |
void |
setDefaultDirectory(File dir)
Sets the default (user) directory for file operations to the supplied File. |
void |
setDefaultDirectory(String path)
Sets the default (user) directory for file operations based on the supplied path. |
void |
setFont(int fontNumber,
Font font)
Set the application font at index to Font font. |
void |
setProperties()
Sets 'global' system properties based on the properties file, including those for XML processing and the database store. |
boolean |
setThreadPriority(String groupname,
int priority)
Set the priority of all active threads within the ThreadGroup whose name is groupname to priority. |
static String |
warning(String msg)
A static convenience method that passes the warning off to the MessageHandler. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String FORM_TEMPLATE_ID
public final File homeDirectory
public static File resourceDir
public URL homeDirectoryURL
public static String defaultCatalogPath
protected Hashtable m_ext2HAPath
protected Hashtable m_mime2HAPath
protected org.apache.xml.resolver.tools.CatalogResolver m_catalogResolver
| Method Detail |
|---|
public static Services getInstance()
This is not the recommended method for instantiating the class as normally an existing MessageHandler is provided in the constructor; inthis case it will be created using default properties.
public static Services getInstance(MessageHandlerImpl messagehandler,
String propertiesFile,
int settings)
Generally, this is the method used to initially create the
Services instance, as it allows for external settings. This
also calls a protected method postInstantiation(Services)
to start up application services that can only be created
after there is a Services object.
protected static void postInstantiation(Services srvs)
public org.apache.xml.resolver.tools.CatalogResolver getCatalogResolver()
protected void setCatalogResolverProperties()
public boolean ready()
public void disposeWelcomeWindow(MessageWriter messagewriter)
public boolean isDeveloper()
Constants.DEVELOPERpublic List getAvailableFonts()
setAvailableFonts().
If empty, returns an empty List (not null).
protected void setAvailableFonts()
public void importTinyFont()
public void setFont(int fontNumber,
Font font)
getFont(int).
public Font getFont(int fontNumber)
public Font getFont(String basename)
public void setProperties()
public String getImagePath()
public MessageHandler getMessageHandler()
public MessageHandlerImpl getMessageHandlerImpl()
public PropertyManager getPropertyManager()
public int getSettings()
public boolean isVerbose()
public ThreadGroup getThreadGroup()
public boolean setThreadPriority(String groupname,
int priority)
public String[] getBaseOntologies()
public static String message(String id)
MessageHandlerpublic static String error(String id)
MessageHandler
public static String error(String id,
String arg)
MessageHandler
public static String error(String id,
String arg1,
String arg2)
MessageHandler
public static String error(String id,
String arg1,
String arg2,
String arg3)
MessageHandlerpublic static String warning(String msg)
MessageHandler
public XMLProcessor getXMLProcessor()
throws ProcessException
ProcessException
public XMLProcessor getXMLProcessor(boolean validating)
throws ProcessException
ProcessException
public TopicMapProcessor getTopicMapProcessor()
throws TopicMapException
This is a convenience method that passes the message off to the TopicMapManager.
TopicMapException
public TopicMapProcessor getTopicMapProcessor(boolean create)
throws TopicMapException
This is a convenience method that passes the message off to the TopicMapManager.
TopicMapExceptionpublic boolean isConnected()
public XNodeStore getXNodeStore()
public SetModel getCollectionIndex()
XNodeStore.getCollectionIndex()
method from XNodeStore, casts it as a SetModel (its backing
class), and traps any exceptions. For UI purposes, returning
an empty Set under all conditions is better (with the error
handler catching any messages).
XNodeStore,
SetModelpublic int getCollectionSize()
public String getXDatabaseURI(String cid,
String nid)
public void dbAction(XNodeState state)
public void resetHelperApplications()
public String getHelperFromMIME(String mime)
If this is the Helper Application for HTML or XHTML, or for any MIME that uses the same browser, the remote command is appended (if available).
public String getHelperFromPath(String systemId)
If this is the Helper Application for HTML or XHTML, or for any MIME that uses the same browser, the remote command is appended (if available).
public String getHelperFromExt(String ext)
If this is the Helper Application for HTML or XHTML, or for any MIME that uses the same browser, the remote command is appended (if available).
public GroovyService getGroovyService()
public void setDefaultDirectory(String path)
public void setDefaultDirectory(File dir)
public File getDefaultDirectory()
public File resolvePath(String filename)
public String printStackTrace(Throwable t)
public static String printMemoryUsage()
public IDFactory getIDFactory()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||