issrg.utils.gui.repository
Class WebDAV_DIT

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by issrg.utils.gui.repository.WebDAV_DIT
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.TreeSelectionListener, javax.swing.event.TreeWillExpandListener

public class WebDAV_DIT
extends javax.swing.JPanel
implements javax.swing.event.TreeSelectionListener, javax.swing.event.TreeWillExpandListener

The WebDAV_DIT class is a JPanel which has a single JTree in its Content Pane , which will display the Directory Information Tree for the WebDAV server. Construct it with the host (IP address or FQDN) and port number to your WebDAV server. Handle the fireWebDAV_DIT_valueChanged() event, to get the DN selected on the JTree and any ACs and AC file names under the DN.

Version:
19/03/2007
Author:
Sean Antony
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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
static java.lang.String ace
           
protected  javax.swing.event.EventListenerList listenerList
          Create the listener list
 
Fields inherited from class javax.swing.JComponent
accessibleContext, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
WebDAV_DIT(WebDAVSocket socket, java.lang.String host, int port)
           
WebDAV_DIT(WebDAVSocket socket, java.lang.String host, int port, boolean collectionsOnly)
           
 
Method Summary
 void addMyEventListener(WebDAV_DIT_Listener listener)
          This methods allows classes to register for WebDAV_DIT_Events
 void clearCollections()
          Method to clear the collections in the tree.
 void convertDN2URI(java.lang.String dn)
          Utility method to convert a DN to a URI.
 java.lang.String[] get$ACNames()
           
 byte[] getAC(java.lang.String[] acsName, int i)
          Gets an AC under the current DN.
 AttributeCertificate[] getACs()
           
 java.lang.String getDn()
           
 java.lang.String getDnToURI()
           
 java.lang.String getErrorMessage()
           
 java.lang.String getHost()
           
 int getPort()
           
 java.lang.String[] getSplitDN()
           
 void removeMyEventListener(WebDAV_DIT_Listener listener)
          This methods allows classes to unregister for WebDAV_DIT_Events
 void setDn(java.lang.String dn)
           
 void setEnabled(boolean enabled)
          Method that overrides the WebDAV_DIT setEnabled.
 void setHost(java.lang.String host)
           
 void setPort(int port)
           
 void setResources(java.lang.String dir)
          Sets the resources found under the collection specified.
 void setRoot(java.lang.Object o)
           
 void setSelectionListener(javax.swing.event.TreeSelectionEvent tse)
          update java doc
 void setSocket(WebDAVSocket socket)
           
 void testConnection(java.lang.String uri)
          Utility method to test the connection to the host:port.
 void treeWillCollapse(javax.swing.event.TreeExpansionEvent event)
          Not implemented.
 void treeWillExpand(javax.swing.event.TreeExpansionEvent event)
          Updates the tree structure when the tree is about to expand, i.e.
 void updateCollections()
          Method to update the collections in the tree.
 void valueChanged(javax.swing.event.TreeSelectionEvent tse)
          WebDAV_DIT internally handles the JTree valueChanged() event and fires its own custom event, so classes which implement this class can be notified of the event.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ace

public static final java.lang.String ace
See Also:
Constant Field Values

listenerList

protected javax.swing.event.EventListenerList listenerList
Create the listener list

Constructor Detail

WebDAV_DIT

public WebDAV_DIT(WebDAVSocket socket,
                  java.lang.String host,
                  int port)
Parameters:
socket - any class that implements the WebDAVSocket interface
host - e.g. the IP address (127.0.0.1) or FQDN (mysite.org)
port - e.g. 80 for HTTP and 443 for HTTPS

WebDAV_DIT

public WebDAV_DIT(WebDAVSocket socket,
                  java.lang.String host,
                  int port,
                  boolean collectionsOnly)
Parameters:
socket - any class that implements the WebDAVSocket interface
host - e.g. the IP address (127.0.0.1) or FQDN (mysite.org)
port - e.g. 80 for HTTP and 443 for HTTPS
collectionsOnly - true if you do not want to retrieve resources
Method Detail

convertDN2URI

public void convertDN2URI(java.lang.String dn)
Utility method to convert a DN to a URI.

Parameters:
dn -

testConnection

public void testConnection(java.lang.String uri)
                    throws HTTPMessageException
Utility method to test the connection to the host:port.

Parameters:
uri -
Throws:
HTTPMessageException - - if conneection fails.

clearCollections

public void clearCollections()
Method to clear the collections in the tree.


updateCollections

public void updateCollections()
                       throws HTTPMessageException
Method to update the collections in the tree.

Throws:
HTTPMessageException - on error

setRoot

public void setRoot(java.lang.Object o)

setResources

public void setResources(java.lang.String dir)
                  throws HTTPMessageException
Sets the resources found under the collection specified.

Parameters:
dir - the name of the collection
Throws:
HTTPMessageException - on error

treeWillCollapse

public void treeWillCollapse(javax.swing.event.TreeExpansionEvent event)
                      throws javax.swing.tree.ExpandVetoException
Not implemented.

Specified by:
treeWillCollapse in interface javax.swing.event.TreeWillExpandListener
Throws:
javax.swing.tree.ExpandVetoException

treeWillExpand

public void treeWillExpand(javax.swing.event.TreeExpansionEvent event)
                    throws javax.swing.tree.ExpandVetoException
Updates the tree structure when the tree is about to expand, i.e. when a user double clicks a node or clicks its root handler.

Specified by:
treeWillExpand in interface javax.swing.event.TreeWillExpandListener
Throws:
javax.swing.tree.ExpandVetoException

valueChanged

public void valueChanged(javax.swing.event.TreeSelectionEvent tse)
WebDAV_DIT internally handles the JTree valueChanged() event and fires its own custom event, so classes which implement this class can be notified of the event.

Gets the currently selected node in the tree and generates the URI. Calls the setResources method to find any resources under the collection. If there is none sets $ACs to null, otherwise retrieves every AC and updates the $ACNames with each ACs file name, and $ACs with each byte[] representation of the AC. Fire fireWebDAV_DIT_valueChanged to notify that DN, $ACs, and $ACNames have been updated.

Specified by:
valueChanged in interface javax.swing.event.TreeSelectionListener

setSelectionListener

public void setSelectionListener(javax.swing.event.TreeSelectionEvent tse)
update java doc


getAC

public byte[] getAC(java.lang.String[] acsName,
                    int i)
             throws HTTPMessageException,
                    java.io.IOException
Gets an AC under the current DN.

Parameters:
acsName - - array of AC names found under the current DN.
i - - the index of the AC name we want to retrieve (GET).
Returns:
byte[] representation of the AC.
Throws:
HTTPMessageException - - if connection to host:port fails.
java.io.IOException - - if base64 decoder fails.

getACs

public AttributeCertificate[] getACs()

get$ACNames

public java.lang.String[] get$ACNames()

getSplitDN

public java.lang.String[] getSplitDN()

getDnToURI

public java.lang.String getDnToURI()

getDn

public java.lang.String getDn()

setDn

public void setDn(java.lang.String dn)

getErrorMessage

public java.lang.String getErrorMessage()

getHost

public java.lang.String getHost()

setHost

public void setHost(java.lang.String host)

getPort

public int getPort()

setPort

public void setPort(int port)

setSocket

public void setSocket(WebDAVSocket socket)

setEnabled

public void setEnabled(boolean enabled)
Method that overrides the WebDAV_DIT setEnabled. When disabling this class, each component that makes it up, must be disabled as well.

Overrides:
setEnabled in class javax.swing.JComponent

addMyEventListener

public void addMyEventListener(WebDAV_DIT_Listener listener)
This methods allows classes to register for WebDAV_DIT_Events

Parameters:
listener -

removeMyEventListener

public void removeMyEventListener(WebDAV_DIT_Listener listener)
This methods allows classes to unregister for WebDAV_DIT_Events

Parameters:
listener -