Class Cockpit

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ListSelectionListener, RootPaneContainer, org.apache.commons.httpclient.auth.CredentialsProvider, HyperlinkActivatedListener, S3ServiceEventListener

public class Cockpit extends JApplet implements S3ServiceEventListener, ActionListener, ListSelectionListener, HyperlinkActivatedListener, org.apache.commons.httpclient.auth.CredentialsProvider
Cockpit is a graphical Java application for viewing and managing the contents of an Amazon S3 account. For more information and help please see the Cockpit Guide.

This is the Cockpit application class; it may be run as a stand-alone application or as an Applet.

Author:
jmurty
See Also:
  • Field Details

  • Constructor Details

    • Cockpit

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

      public Cockpit(JFrame ownerFrame) 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 Details

    • init

      public void init()
      Prepares application to run as a GUI by finding/creating a root owner JFrame, creating an un-authenticated RestS3Service and loading properties files.
      Overrides:
      init in class Applet
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Event handler for this application, handles all menu items.
      Specified by:
      actionPerformed in interface ActionListener
    • valueChanged

      public void valueChanged(ListSelectionEvent e)
      Handles list selection events for this application.
      Specified by:
      valueChanged in interface ListSelectionListener
    • s3ServiceEventPerformed

      public void s3ServiceEventPerformed(GetObjectsEvent event)
      This method is an S3ServiceEventListener action method that is invoked when this application's S3ServiceMulti triggers a GetObjectsEvent.

      This never happens in this application as downloads are performed by S3ServiceMulti.downloadObjects(S3Bucket, DownloadPackage[]) instead.

      Specified by:
      s3ServiceEventPerformed in interface S3ServiceEventListener
      Parameters:
      event -
    • s3ServiceEventPerformed

      public void s3ServiceEventPerformed(ListObjectsEvent event)
      This method is an S3ServiceEventListener action method that is invoked when this application's S3ServiceMulti triggers a ListObjectsEvent.

      This never happens in this application as it does not perform multi-threaded object listings.

      Specified by:
      s3ServiceEventPerformed in interface S3ServiceEventListener
      Parameters:
      event -
    • s3ServiceEventPerformed

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

      public void s3ServiceEventPerformed(CreateBucketsEvent event)
      This method is an S3ServiceEventListener action method that is invoked when this application's S3ServiceMulti triggers a CreateBucketsEvent.

      When a bucket is successfully created it is added to the listing of buckets.

      Specified by:
      s3ServiceEventPerformed in interface S3ServiceEventListener
      Parameters:
      event -
    • s3ServiceEventPerformed

      public void s3ServiceEventPerformed(LookupACLEvent event)
      This method is an S3ServiceEventListener action method that is invoked when this application's S3ServiceMulti triggers a LookupACLEvent.

      The ACL details are retrieved for the currently selected objects in the gui, then the AccessControlDialog is displayed to allow the user to update the ACL settings for these objects.

      Specified by:
      s3ServiceEventPerformed in interface S3ServiceEventListener
      Parameters:
      event -
    • s3ServiceEventPerformed

      public void s3ServiceEventPerformed(UpdateACLEvent event)
      This method is an S3ServiceEventListener action method that is invoked when this application's S3ServiceMulti triggers a UpdateACLEvent.

      This method merely updates the progress dialog as ACLs are updated.

      Specified by:
      s3ServiceEventPerformed in interface S3ServiceEventListener
      Parameters:
      event -
    • s3ServiceEventPerformed

      public void s3ServiceEventPerformed(DownloadObjectsEvent event)
      This method is an S3ServiceEventListener action method that is invoked when this application's S3ServiceMulti triggers a DownloadObjectsEvent.

      This method merely updates the progress dialog as objects are downloaded.

      Specified by:
      s3ServiceEventPerformed in interface S3ServiceEventListener
      Parameters:
      event -
    • s3ServiceEventPerformed

      public void s3ServiceEventPerformed(CreateObjectsEvent event)
      This method is an S3ServiceEventListener action method that is invoked when this application's S3ServiceMulti triggers a CreateObjectsEvent.

      This method merely updates the progress dialog as files are uploaded.

      Specified by:
      s3ServiceEventPerformed in interface S3ServiceEventListener
      Parameters:
      event -
    • s3ServiceEventPerformed

      public void s3ServiceEventPerformed(CopyObjectsEvent event)
      This method is an S3ServiceEventListener action method that is invoked when this application's S3ServiceMulti triggers a CopyObjectsEvent.

      This method merely updates the progress dialog as objects are copied.

      Specified by:
      s3ServiceEventPerformed in interface S3ServiceEventListener
      Parameters:
      event -
    • s3ServiceEventPerformed

      public void s3ServiceEventPerformed(DeleteObjectsEvent event)
      This method is an S3ServiceEventListener action method that is invoked when this application's S3ServiceMulti triggers a DeleteObjectsEvent.

      This method merely updates the progress dialog as objects are deleted.

      Specified by:
      s3ServiceEventPerformed in interface S3ServiceEventListener
      Parameters:
      event -
    • s3ServiceEventPerformed

      public void s3ServiceEventPerformed(GetObjectHeadsEvent event)
      This method is an S3ServiceEventListener action method that is invoked when this application's S3ServiceMulti triggers a GetObjectHeadsEvent.

      This method merely updates the progress dialog as object details (heads) are retrieved.

      Specified by:
      s3ServiceEventPerformed in interface S3ServiceEventListener
      Parameters:
      event -
    • followHyperlink

      public void followHyperlink(URL url, 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:
      • Application: Detects the default browser application for the user's system (using BareBonesBrowserLaunch) and opens the link as a new window in that browser
      • Applet: Opens the link in the current browser using the applet's context
      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.
    • getCredentials

      public org.apache.commons.httpclient.Credentials getCredentials(org.apache.commons.httpclient.auth.AuthScheme authscheme, String host, int port, boolean proxy) throws org.apache.commons.httpclient.auth.CredentialsNotAvailableException
      Implementation method for the CredentialsProvider interface.

      Based on sample code: InteractiveAuthenticationExample

      Specified by:
      getCredentials in interface org.apache.commons.httpclient.auth.CredentialsProvider
      Throws:
      org.apache.commons.httpclient.auth.CredentialsNotAvailableException
    • main

      public static void main(String[] args) throws Exception
      Runs Cockpit as a stand-alone application.
      Parameters:
      args -
      Throws:
      Exception