edu.ucsb.nceas.morpho
Class Morpho

java.lang.Object
  |
  +--edu.ucsb.nceas.morpho.Morpho

public class Morpho
extends java.lang.Object

Morpho is the main entry point for the Morpho application. It creates the main application state and sets up the menus and toolbars for the application. The framework also provides a mechanism for "plugins" to add menus, toolbars, and services to the application. These plugins are dynamically loaded at runtime. Plugins are classes that implement the "PluginInterface" interface.

Author:
jones

Field Summary
static java.lang.String INITIALFRAMENAME
          Constant of initial morpho frame name
static java.lang.String SEPARATOR_FOLLOWING
          Constant to indicate a separator should follow an action
static java.lang.String SEPARATOR_PRECEDING
          Constant to indicate a separator should precede an action
static java.lang.String VERSION
          The version of this release of Morpho
 
Constructor Summary
Morpho(ConfigXML config)
          Creates a new instance of Morpho
 
Method Summary
 void addConnectionListener(ConnectionListener listener)
          This method is called by plugins to register a listener for changes in the Connection status.
 void checkJavaVersion()
          Description of the Method
static javax.xml.parsers.DocumentBuilder createDomParser()
          Set up a DOM parser for reading an XML document
static org.xml.sax.XMLReader createSaxParser(org.xml.sax.ContentHandler contentHandler, org.xml.sax.ErrorHandler errorHandler)
          Set up a SAX parser for reading an XML document
 void exitApplication()
          Exit the application, asking the user if they are sure
static ConfigXML getConfiguration()
          Get the configuration object associated with the framework.
 boolean getJavaVersionFlag()
          returns true if the JVM version is 1.3 or greater
 java.io.InputStream getMetacatInputStream(java.util.Properties prop)
          Send a request to Metacat
 java.io.InputStream getMetacatInputStream(java.util.Properties prop, boolean requiresLogin)
          Send a request to Metacat
 java.lang.String getMetacatString(java.util.Properties prop)
          Send a request to Metacat
 java.lang.String getMetacatString(java.util.Properties prop, boolean requiresLogin)
          Send a request to Metacat
 boolean getNetworkStatus()
          Determine whether a network connection is available before trying to open a socket, since this would cause an error
 java.lang.String getPassword()
          get password associated with this framework
 ConfigXML getProfile()
          Get the profile for the currently logged in user.
 java.lang.String getSessionCookie()
          Gets the SessionCookie attribute of the Morpho object
 boolean getSslStatus()
          Determines if the framework is using an ssl connection
 java.util.Vector getTaxonSynonyms(java.lang.String taxonName)
          Look up the synonyms of a taxon from ITIS, and return the list of names
 java.lang.String getUserName()
          Get the username associated with this framework
 boolean isConnected()
          Determines if the framework has a valid login
 boolean logIn()
          Log into metacat.
 void logOut()
          Log out of metacat
 void logOutExit()
          Log out of metacat when exiting.
static void main(java.lang.String[] args)
          The entry point for this application.
 java.io.InputStream sendDataFile(java.lang.String id, java.io.File file)
          sends a data file to the metacat using "multipart/form-data" encoding
 void setPassword(java.lang.String pword)
          Set the password associated with this framework
 void setProfile(ConfigXML newProfile)
          Set the profile for the currently logged in user (on startup, or when switching profiles).
 void setProfile(java.lang.String newProfileName)
          Set the profile associated with this framework based on its name
 void setUserName(java.lang.String uname)
          Set the username associated with this framework
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static java.lang.String VERSION
The version of this release of Morpho

SEPARATOR_PRECEDING

public static java.lang.String SEPARATOR_PRECEDING
Constant to indicate a separator should precede an action

SEPARATOR_FOLLOWING

public static java.lang.String SEPARATOR_FOLLOWING
Constant to indicate a separator should follow an action

INITIALFRAMENAME

public static final java.lang.String INITIALFRAMENAME
Constant of initial morpho frame name
Constructor Detail

Morpho

public Morpho(ConfigXML config)
Creates a new instance of Morpho
Parameters:
config - the configuration object for the application
Method Detail

setUserName

public void setUserName(java.lang.String uname)
Set the username associated with this framework
Parameters:
uname - The new UserName value

setPassword

public void setPassword(java.lang.String pword)
Set the password associated with this framework
Parameters:
pword - The new Password value

setProfile

public void setProfile(ConfigXML newProfile)
Set the profile for the currently logged in user (on startup, or when switching profiles).
Parameters:
newProfile - the profile object

setProfile

public void setProfile(java.lang.String newProfileName)
Set the profile associated with this framework based on its name
Parameters:
newProfileName - the name of the new profile for the framework

getMetacatInputStream

public java.io.InputStream getMetacatInputStream(java.util.Properties prop,
                                                 boolean requiresLogin)
Send a request to Metacat
Parameters:
prop - the properties to be sent to Metacat
requiresLogin - indicates whether a valid connection is required for the operation
Returns:
InputStream as returned by Metacat

getSessionCookie

public java.lang.String getSessionCookie()
Gets the SessionCookie attribute of the Morpho object
Returns:
The SessionCookie value

getMetacatInputStream

public java.io.InputStream getMetacatInputStream(java.util.Properties prop)
Send a request to Metacat
Parameters:
prop - the properties to be sent to Metacat
Returns:
InputStream as returned by Metacat

getMetacatString

public java.lang.String getMetacatString(java.util.Properties prop,
                                         boolean requiresLogin)
Send a request to Metacat
Parameters:
prop - the properties to be sent to Metacat
requiresLogin - indicates whether a valid connection is required for the operation
Returns:
a string as returned by Metacat

getMetacatString

public java.lang.String getMetacatString(java.util.Properties prop)
Send a request to Metacat
Parameters:
prop - the properties to be sent to Metacat
Returns:
a string as returned by Metacat

getUserName

public java.lang.String getUserName()
Get the username associated with this framework
Returns:
The UserName value

getPassword

public java.lang.String getPassword()
get password associated with this framework
Returns:
The Password value

isConnected

public boolean isConnected()
Determines if the framework has a valid login
Returns:
boolean true if connected to Metacat, false otherwise

getSslStatus

public boolean getSslStatus()
Determines if the framework is using an ssl connection
Returns:
boolean true if using SSL, false otherwise

getNetworkStatus

public boolean getNetworkStatus()
Determine whether a network connection is available before trying to open a socket, since this would cause an error
Returns:
boolean true if the network is reachable

getConfiguration

public static ConfigXML getConfiguration()
Get the configuration object associated with the framework. Plugins use this object to get and set persistent configuration parameters.
Returns:
ConfigXML the configuration object

getProfile

public ConfigXML getProfile()
Get the profile for the currently logged in user.

getTaxonSynonyms

public java.util.Vector getTaxonSynonyms(java.lang.String taxonName)
Look up the synonyms of a taxon from ITIS, and return the list of names
Parameters:
taxonName -  
Returns:
vector of the names of synonym taxa

getJavaVersionFlag

public boolean getJavaVersionFlag()
returns true if the JVM version is 1.3 or greater
Returns:
The JavaVersionFlag value

exitApplication

public void exitApplication()
Exit the application, asking the user if they are sure

sendDataFile

public java.io.InputStream sendDataFile(java.lang.String id,
                                        java.io.File file)
sends a data file to the metacat using "multipart/form-data" encoding
Parameters:
id - the id to assign to the file on metacat (e.g., knb.1.1)
file - the file to send
Returns:
the response stream from metacat

logIn

public boolean logIn()
Log into metacat.
Returns:
boolean true if the attempt to log in succeeded

logOut

public void logOut()
Log out of metacat

logOutExit

public void logOutExit()
Log out of metacat when exiting.

addConnectionListener

public void addConnectionListener(ConnectionListener listener)
This method is called by plugins to register a listener for changes in the Connection status. Any change in the username, password, or other connect change will trigger notification.
Parameters:
listener - a reference to the object to be notified of changes
Throws:
ServiceExistsException -  

checkJavaVersion

public void checkJavaVersion()
Description of the Method

main

public static void main(java.lang.String[] args)
The entry point for this application. Sets the Look and Feel to the System Look and Feel. Creates a new JFrame1 and makes it visible.
Parameters:
args - Description of Parameter

createSaxParser

public static org.xml.sax.XMLReader createSaxParser(org.xml.sax.ContentHandler contentHandler,
                                                    org.xml.sax.ErrorHandler errorHandler)
Set up a SAX parser for reading an XML document
Parameters:
contentHandler - object to be used for parsing the content
errorHandler - object to be used for handling errors
Returns:
a SAX XMLReader object for parsing

createDomParser

public static javax.xml.parsers.DocumentBuilder createDomParser()
Set up a DOM parser for reading an XML document
Returns:
a DOM parser object for parsing


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.