org.jets3t.apps.uploader
Class Uploader

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by javax.swing.JApplet
                      extended by org.jets3t.apps.uploader.Uploader
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.event.ListSelectionListener, javax.swing.RootPaneContainer, org.apache.http.client.CredentialsProvider, HyperlinkActivatedListener, S3ServiceEventListener

public class Uploader
extends javax.swing.JApplet
implements S3ServiceEventListener, java.awt.event.ActionListener, javax.swing.event.ListSelectionListener, HyperlinkActivatedListener, org.apache.http.client.CredentialsProvider

Dual application and applet for uploading files and XML metadata information to the Amazon S3 service.

For more information and help please see the Uploader Guide.

The Uploader is highly configurable through properties specified in a file uploader.properties. This file must be available at the root of the classpath.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JApplet
javax.swing.JApplet.AccessibleJApplet
 
Nested classes/interfaces inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String APPLICATION_DESCRIPTION
           
static java.lang.String ERROR_CODE__MISSING_REQUIRED_PARAM
           
static java.lang.String ERROR_CODE__S3_UPLOAD_FAILED
           
static java.lang.String ERROR_CODE__TRANSACTION_ID_REQUIRED_TO_CREATE_XML_SUMMARY
           
static java.lang.String ERROR_CODE__UPLOAD_REQUEST_DECLINED
           
static int HTTP_CONNECTION_TIMEOUT
           
static int MAX_CONNECTION_RETRIES
           
static int SOCKET_CONNECTION_TIMEOUT
           
static java.lang.String UPLOADER_PROPERTIES_FILENAME
           
static int WIZARD_SCREEN_1
           
static int WIZARD_SCREEN_2
           
static int WIZARD_SCREEN_3
           
static int WIZARD_SCREEN_4
           
static int WIZARD_SCREEN_5
           
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
 
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
Uploader()
          Constructor to run this application as an Applet.
Uploader(javax.swing.JFrame ownerFrame, java.util.Properties standAloneArgumentProperties)
          Constructor to run this application in a stand-alone window.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent actionEvent)
          Handles GUI actions.
 void clear()
          Clear credentials.
 void followHyperlink(java.net.URL url, java.lang.String target)
          Follows hyperlinks clicked on by a user.
 org.apache.http.auth.Credentials getCredentials(org.apache.http.auth.AuthScope scope)
          Implementation method for the CredentialsProvider interface.
 void init()
          Prepares application to run as a GUI by finding/creating a root owner JFrame, and (if necessary) creating a directory for storing remembered logins.
static void main(java.lang.String[] args)
          Run the Uploader as a stand-alone application.
 void s3ServiceEventPerformed(CopyObjectsEvent event)
           
 void s3ServiceEventPerformed(CreateBucketsEvent event)
           
 void s3ServiceEventPerformed(CreateObjectsEvent event)
          Listener method that responds to events from the jets3t toolkit when objects are created in S3 - ie when files are uploaded.
 void s3ServiceEventPerformed(DeleteObjectsEvent event)
           
 void s3ServiceEventPerformed(DeleteVersionedObjectsEvent event)
           
 void s3ServiceEventPerformed(DownloadObjectsEvent event)
           
 void s3ServiceEventPerformed(GetObjectHeadsEvent event)
           
 void s3ServiceEventPerformed(GetObjectsEvent event)
           
 void s3ServiceEventPerformed(ListObjectsEvent event)
           
 void s3ServiceEventPerformed(LookupACLEvent event)
           
 void s3ServiceEventPerformed(UpdateACLEvent event)
           
 void setCredentials(org.apache.http.auth.AuthScope authscope, org.apache.http.auth.Credentials credentials)
           
 void valueChanged(javax.swing.event.ListSelectionEvent arg0)
           
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, 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

APPLICATION_DESCRIPTION

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

UPLOADER_PROPERTIES_FILENAME

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

WIZARD_SCREEN_1

public static final int WIZARD_SCREEN_1
See Also:
Constant Field Values

WIZARD_SCREEN_2

public static final int WIZARD_SCREEN_2
See Also:
Constant Field Values

WIZARD_SCREEN_3

public static final int WIZARD_SCREEN_3
See Also:
Constant Field Values

WIZARD_SCREEN_4

public static final int WIZARD_SCREEN_4
See Also:
Constant Field Values

WIZARD_SCREEN_5

public static final int WIZARD_SCREEN_5
See Also:
Constant Field Values

ERROR_CODE__MISSING_REQUIRED_PARAM

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

ERROR_CODE__S3_UPLOAD_FAILED

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

ERROR_CODE__UPLOAD_REQUEST_DECLINED

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

ERROR_CODE__TRANSACTION_ID_REQUIRED_TO_CREATE_XML_SUMMARY

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

HTTP_CONNECTION_TIMEOUT

public static final int HTTP_CONNECTION_TIMEOUT
See Also:
Constant Field Values

SOCKET_CONNECTION_TIMEOUT

public static final int SOCKET_CONNECTION_TIMEOUT
See Also:
Constant Field Values

MAX_CONNECTION_RETRIES

public static final int MAX_CONNECTION_RETRIES
See Also:
Constant Field Values
Constructor Detail

Uploader

public Uploader()
Constructor to run this application as an Applet.


Uploader

public Uploader(javax.swing.JFrame ownerFrame,
                java.util.Properties standAloneArgumentProperties)
         throws S3ServiceException
Constructor to run this application in a stand-alone window.

Parameters:
ownerFrame - the frame the application will be displayed in
Throws:
S3ServiceException
Method Detail

init

public void init()
Prepares application to run as a GUI by finding/creating a root owner JFrame, and (if necessary) creating a directory for storing remembered logins.

Overrides:
init in class java.applet.Applet

s3ServiceEventPerformed

public void s3ServiceEventPerformed(CreateObjectsEvent event)
Listener method that responds to events from the jets3t toolkit when objects are created in S3 - ie when files are uploaded.

Specified by:
s3ServiceEventPerformed in interface S3ServiceEventListener

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent actionEvent)
Handles GUI actions.

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

followHyperlink

public void followHyperlink(java.net.URL url,
                            java.lang.String target)
Follows hyperlinks clicked on by a user. This is achieved differently depending on whether Cockpit is running as an applet or as a stand-alone application:

Specified by:
followHyperlink in interface HyperlinkActivatedListener
Parameters:
url - the url to open
target - the target pane to open the url in, eg "_blank". This may be null.

setCredentials

public void setCredentials(org.apache.http.auth.AuthScope authscope,
                           org.apache.http.auth.Credentials credentials)
Specified by:
setCredentials in interface org.apache.http.client.CredentialsProvider

clear

public void clear()
Clear credentials.

Specified by:
clear in interface org.apache.http.client.CredentialsProvider

getCredentials

public org.apache.http.auth.Credentials getCredentials(org.apache.http.auth.AuthScope scope)
Implementation method for the CredentialsProvider interface.

Based on sample code: InteractiveAuthenticationExample

Specified by:
getCredentials in interface org.apache.http.client.CredentialsProvider

s3ServiceEventPerformed

public void s3ServiceEventPerformed(ListObjectsEvent event)
Specified by:
s3ServiceEventPerformed in interface S3ServiceEventListener

s3ServiceEventPerformed

public void s3ServiceEventPerformed(CreateBucketsEvent event)
Specified by:
s3ServiceEventPerformed in interface S3ServiceEventListener

s3ServiceEventPerformed

public void s3ServiceEventPerformed(DeleteObjectsEvent event)
Specified by:
s3ServiceEventPerformed in interface S3ServiceEventListener

s3ServiceEventPerformed

public void s3ServiceEventPerformed(GetObjectsEvent event)
Specified by:
s3ServiceEventPerformed in interface S3ServiceEventListener

s3ServiceEventPerformed

public void s3ServiceEventPerformed(GetObjectHeadsEvent event)
Specified by:
s3ServiceEventPerformed in interface S3ServiceEventListener

s3ServiceEventPerformed

public void s3ServiceEventPerformed(LookupACLEvent event)
Specified by:
s3ServiceEventPerformed in interface S3ServiceEventListener

s3ServiceEventPerformed

public void s3ServiceEventPerformed(UpdateACLEvent event)
Specified by:
s3ServiceEventPerformed in interface S3ServiceEventListener

s3ServiceEventPerformed

public void s3ServiceEventPerformed(DownloadObjectsEvent event)
Specified by:
s3ServiceEventPerformed in interface S3ServiceEventListener

s3ServiceEventPerformed

public void s3ServiceEventPerformed(CopyObjectsEvent event)
Specified by:
s3ServiceEventPerformed in interface S3ServiceEventListener

s3ServiceEventPerformed

public void s3ServiceEventPerformed(DeleteVersionedObjectsEvent event)
Specified by:
s3ServiceEventPerformed in interface S3ServiceEventListener

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent arg0)
Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Run the Uploader as a stand-alone application.

Parameters:
args -
Throws:
java.lang.Exception