org.greenstone.gs3client
Class GS3JavaClient

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by org.greenstone.gs3client.GS3JavaClient
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class GS3JavaClient
extends javax.swing.JFrame
implements java.awt.event.ActionListener

The main Javaclient class. Creates the main window containing: - the radio button group for making either Greenstone 3 or Fedora the active DL. - the comboboxes for selecting the collection and the service therein - three panes - for executing queries, viewing search results and browsing.

Author:
ak19
See Also:
Serialized Form

Nested Class Summary
(package private) static class GS3JavaClient.PasswordAuthenticator
          Inner class that handles authentication for any sites (urls, etc.) that require it.
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  int activity
          To keep track of whether we are searching or browsing.
protected  BrowseDisplay browsePanel
           
protected  BrowseResponseData browseResponseObject
          Object that stores the data of a browse response XML message (response for classification hierarchies)
static int BROWSING
          The value of the BROWSING activity
protected  javax.swing.JComboBox collBox
           
protected  javax.swing.JTextField collectionNameField
           
protected  javax.swing.JButton collInfoButton
           
protected  java.lang.String colName
          The currently selected collection
protected  DigitalLibraryServicesAPIA dlAPIA
          Reference to a digital library instance (Greenstone 3 or Fedora) that allows this client to execute services offered by the digital library
protected  javax.swing.JComboBox dlChooser
           
protected static java.lang.String[] dlOptions
           
protected static boolean executableServicesOnly
          we want to display a drop-down box for the services available, but only Services that can be executed (searching and browsing)
protected static int FEDORA
           
protected  FedoraServicesAPIA fedoraDL
          Reference to the object that interacts with the FedoraGS3.jar component
protected static int GREENSTONE
           
protected  GS3ServicesAPIA greenstoneDL
          Reference to the object that interacts with Greenstone3's web services
protected  java.lang.String lang
          Preferred language of display items in responses.
(package private) static org.apache.log4j.Logger LOG
          The Logger for this class
protected  javax.swing.JTextField nonProxyHostNamesField
           
protected  javax.swing.JTextField proxyhostField
           
protected  javax.swing.JTextField proxyportField
           
protected  QueryForm queryPanel
           
protected  QueryResponseData queryResponseObj
          Object that stores the data of a query response XML message
protected  javax.swing.JButton searchButton
           
static int SEARCHING
          The value of the SEARCHING activity
protected  javax.swing.JPanel searchPanel
           
protected  SearchResultsDisplay searchResultsDisplay
           
protected  javax.swing.JTextArea searchSummary
           
protected static int SELECT
           
protected  javax.swing.JComboBox serviceBox
           
protected  java.lang.String serviceName
          The currently selected service
protected  javax.swing.JButton setProxySettings
           
protected  javax.swing.JTabbedPane tabbedPane
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GS3JavaClient()
          Default constructor that creates and initialises this main window and its internal GUI components
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Event handler for actionEvents such as a change in the active digital library, a collection being selected in the dropdown box or the collection -Info button being pressed, or a service being selected in the service dropdown box (browsing or searching).
protected  void changeDL(DigitalLibraryServicesAPIA dl)
          Method that is called when the user chooses to change the active digital library (between Greenstone3 and Fedora).
 void changeUIColour(int DL)
          Changes the background colours of the client's user interface based on what the active digital library is.
protected  boolean createFedoraDLConnection()
          Attempts to establish a connection to FedoraGS3.jar and instantiate a FedoraServicesAPIA object and store it in the member variable fedoraDL.
protected  boolean createGreenstoneDLConnection()
          Attempts to establish a connection to GS3 Web services and instantiate a GS3ServicesAPIA object and store it in the member variable greenstoneDL.
 void doBrowse(BrowseDisplay.ClassifierData classifier)
          Given a ClassifierData object indicating what browsing category was chosen, this method will retrieve all its descendants in the hierarchy.
 java.lang.String getBaseURL()
           
 java.lang.String getFilePath(DocumentNodeData docNode)
           
 java.lang.String getLanguage()
           
protected  org.w3c.dom.Element getResponseAsDOM(java.lang.String debugPrefix, java.lang.String response)
          Given an XML response string, returns the root document (element) representing its DOM form.
static void main(java.lang.String[] args)
          The main method of the GS3 java-client application.
 void performSearch(java.util.HashMap nameValParamsMap)
          Called by the instance of the QueryForm class when the user has pressed the queryPanel's search button to execute a query.
 void retrieveAllMetadataFor(DocumentNodeData docNode)
          Performs a docMetadataRetrieve message request for the docNode iff the metadata for that docNode is not already set.
 void retrieveContentFor(DocumentNodeData docNode)
          Performs a docMetadataRetrieve message request for the docNode iff the nodeContent for that docNode is not already set.
 void retrieveTitledStructureFor(ClassifierNodeData classNode)
          Given a ClassifierNodeData object for browsing, this method will set the classNode's children (previously retrieved) and retrieve all the children's metadata including the title.
 void retrieveTitledStructureFor(DocumentNodeData docNode)
          Performs a structureRetrieve and title metadata retrieve message- request for the docNode, but only iff the structure and title for that docNode is not already set.
 void setLanguage(java.lang.String lang)
          Set the preferred language of the display items
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

LOG

static org.apache.log4j.Logger LOG
The Logger for this class


SEARCHING

public static int SEARCHING
The value of the SEARCHING activity


BROWSING

public static int BROWSING
The value of the BROWSING activity


executableServicesOnly

protected static final boolean executableServicesOnly
we want to display a drop-down box for the services available, but only Services that can be executed (searching and browsing)

See Also:
Constant Field Values

activity

protected int activity
To keep track of whether we are searching or browsing. Value of activity can be SEARCHING OR BROWSING


dlAPIA

protected DigitalLibraryServicesAPIA dlAPIA
Reference to a digital library instance (Greenstone 3 or Fedora) that allows this client to execute services offered by the digital library


greenstoneDL

protected GS3ServicesAPIA greenstoneDL
Reference to the object that interacts with Greenstone3's web services


fedoraDL

protected FedoraServicesAPIA fedoraDL
Reference to the object that interacts with the FedoraGS3.jar component


queryResponseObj

protected QueryResponseData queryResponseObj
Object that stores the data of a query response XML message


browseResponseObject

protected BrowseResponseData browseResponseObject
Object that stores the data of a browse response XML message (response for classification hierarchies)


lang

protected java.lang.String lang
Preferred language of display items in responses. "" or "en" for English


colName

protected java.lang.String colName
The currently selected collection


serviceName

protected java.lang.String serviceName
The currently selected service


dlChooser

protected javax.swing.JComboBox dlChooser

proxyhostField

protected javax.swing.JTextField proxyhostField

proxyportField

protected javax.swing.JTextField proxyportField

nonProxyHostNamesField

protected javax.swing.JTextField nonProxyHostNamesField

setProxySettings

protected javax.swing.JButton setProxySettings

serviceBox

protected javax.swing.JComboBox serviceBox

collBox

protected javax.swing.JComboBox collBox

collInfoButton

protected javax.swing.JButton collInfoButton

searchButton

protected javax.swing.JButton searchButton

tabbedPane

protected javax.swing.JTabbedPane tabbedPane

SELECT

protected static final int SELECT
See Also:
Constant Field Values

GREENSTONE

protected static final int GREENSTONE
See Also:
Constant Field Values

FEDORA

protected static final int FEDORA
See Also:
Constant Field Values

dlOptions

protected static final java.lang.String[] dlOptions

queryPanel

protected QueryForm queryPanel

collectionNameField

protected javax.swing.JTextField collectionNameField

searchResultsDisplay

protected SearchResultsDisplay searchResultsDisplay

searchPanel

protected javax.swing.JPanel searchPanel

searchSummary

protected javax.swing.JTextArea searchSummary

browsePanel

protected BrowseDisplay browsePanel
Constructor Detail

GS3JavaClient

public GS3JavaClient()
Default constructor that creates and initialises this main window and its internal GUI components

Method Detail

getLanguage

public java.lang.String getLanguage()
Returns:
the language of the display items

setLanguage

public void setLanguage(java.lang.String lang)
Set the preferred language of the display items

Parameters:
lang - - the preferred language for display values

createGreenstoneDLConnection

protected boolean createGreenstoneDLConnection()
Attempts to establish a connection to GS3 Web services and instantiate a GS3ServicesAPIA object and store it in the member variable greenstoneDL. If it was unsuccessful, then this variable remains at null and an error message is displayed.


createFedoraDLConnection

protected boolean createFedoraDLConnection()
Attempts to establish a connection to FedoraGS3.jar and instantiate a FedoraServicesAPIA object and store it in the member variable fedoraDL. If it was unsuccessful, then this variable remains at null and an error message is displayed.


changeDL

protected void changeDL(DigitalLibraryServicesAPIA dl)
Method that is called when the user chooses to change the active digital library (between Greenstone3 and Fedora).

Parameters:
dl - is the new active digital library (the DigitalLibraryServicesAPIA object to change to).

getResponseAsDOM

protected org.w3c.dom.Element getResponseAsDOM(java.lang.String debugPrefix,
                                               java.lang.String response)
Given an XML response string, returns the root document (element) representing its DOM form.

Parameters:
response - - the XML response string to be converted into its DOM form
Returns:
the response as an XML DOM Element

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Event handler for actionEvents such as a change in the active digital library, a collection being selected in the dropdown box or the collection -Info button being pressed, or a service being selected in the service dropdown box (browsing or searching).

Specified by:
actionPerformed in interface java.awt.event.ActionListener

performSearch

public void performSearch(java.util.HashMap nameValParamsMap)
Called by the instance of the QueryForm class when the user has pressed the queryPanel's search button to execute a query. Based on the user-entered values (stored in the parameter HashMap) this method will call Greenstone to process the query.

Parameters:
nameValParamsMap - - the query form control names with the values the user has entered for them. Example, the pair (fqv, the query string), where fqv is the form control name for the query term.

retrieveAllMetadataFor

public void retrieveAllMetadataFor(DocumentNodeData docNode)
Performs a docMetadataRetrieve message request for the docNode iff the metadata for that docNode is not already set.

Parameters:
docNode - is the DocumentNodeData object for which all the metadata is to be retrieved.

retrieveContentFor

public void retrieveContentFor(DocumentNodeData docNode)
Performs a docMetadataRetrieve message request for the docNode iff the nodeContent for that docNode is not already set.

Parameters:
docNode - is the DocumentNodeData object for which the content is to be retrieved.

retrieveTitledStructureFor

public void retrieveTitledStructureFor(DocumentNodeData docNode)
Performs a structureRetrieve and title metadata retrieve message- request for the docNode, but only iff the structure and title for that docNode is not already set.

Parameters:
docNode - is the DocumentNodeData object for which the title is to be retrieved along with the titles of all its descendants.

doBrowse

public void doBrowse(BrowseDisplay.ClassifierData classifier)
Given a ClassifierData object indicating what browsing category was chosen, this method will retrieve all its descendants in the hierarchy. Only the top-level descendents (children) of the classification will be set initially.

Parameters:
classifier - is the ClassifierData object whose children are to be retrieved.

retrieveTitledStructureFor

public void retrieveTitledStructureFor(ClassifierNodeData classNode)
Given a ClassifierNodeData object for browsing, this method will set the classNode's children (previously retrieved) and retrieve all the children's metadata including the title.

Parameters:
classNode - is the ClassifierNodeData object whose title is to be retrieved along with the titles for its children.

getBaseURL

public java.lang.String getBaseURL()
Returns:
the baseURL of the active digital library interface object

getFilePath

public java.lang.String getFilePath(DocumentNodeData docNode)
Returns:
the filepath of the documentNode in the active digital library

changeUIColour

public void changeUIColour(int DL)
Changes the background colours of the client's user interface based on what the active digital library is. See files greenstone3/gli/classes/xml/config.xml and greenstone3/gli/src/org/greenstone/gatherer/Configuration.java

Parameters:
DL - indicates whether the active digital library is Greenstone or Fedora (or neither, in which case the GUI defaults to the usual grey).
See Also:
Java UIManager tutorial

main

public static void main(java.lang.String[] args)
The main method of the GS3 java-client application. It instantiates an instance of the GS3JavaClient main window and makes it visible.