Class CockpitLite

  • All Implemented Interfaces:
    ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ListSelectionListener, RootPaneContainer, org.apache.http.client.CredentialsProvider, org.jets3t.gui.HyperlinkActivatedListener, org.jets3t.service.multithread.S3ServiceEventListener

    public class CockpitLite
    extends JApplet
    implements org.jets3t.service.multithread.S3ServiceEventListener, ActionListener, ListSelectionListener, org.jets3t.gui.HyperlinkActivatedListener, org.apache.http.client.CredentialsProvider
    CockpitLite is a graphical Java application for viewing and managing the contents of an Amazon S3 account, where the S3 account is not owned by the application's user directly but is made available by a service provider. The service provider uses the Gatekeeper application to mediate the user's access to the S3 account, authorizing each of the user's interactions before it can be executed.

    CockpitLite Guide.

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

    Author:
    jmurty
    See Also:
    Serialized Form
    • Constructor Detail

      • CockpitLite

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

        public CockpitLite​(JFrame ownerFrame,
                           Properties standAloneArgumentProperties)
                    throws org.jets3t.service.S3ServiceException
        Constructor to run this application in a stand-alone window.
        Parameters:
        ownerFrame - the frame the application will be displayed in
        Throws:
        org.jets3t.service.S3ServiceException
    • Method Detail

      • 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
      • startProgressPanel

        protected void startProgressPanel​(Object operationId,
                                          String statusMessage,
                                          int maxCount,
                                          org.jets3t.service.multithread.CancelEventTrigger cancelEventTrigger)
      • updateProgressPanel

        protected void updateProgressPanel​(Object operationId,
                                           String statusMessage,
                                           int currentCount)
      • stopProgressPanel

        protected void stopProgressPanel​(Object operationId)
      • s3ServiceEventPerformed

        public void s3ServiceEventPerformed​(org.jets3t.service.multithread.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 org.jets3t.service.multithread.S3ServiceEventListener
        Parameters:
        event -
      • s3ServiceEventPerformed

        public void s3ServiceEventPerformed​(org.jets3t.service.multithread.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 org.jets3t.service.multithread.S3ServiceEventListener
        Parameters:
        event -
      • s3ServiceEventPerformed

        public void s3ServiceEventPerformed​(org.jets3t.service.multithread.DeleteVersionedObjectsEvent event)
        Specified by:
        s3ServiceEventPerformed in interface org.jets3t.service.multithread.S3ServiceEventListener
      • s3ServiceEventPerformed

        public void s3ServiceEventPerformed​(org.jets3t.service.multithread.LookupACLEvent event)
        This method is an S3ServiceEventListener action method that is invoked when this application's S3ServiceMulti triggers a LookupACLEvent.
        Specified by:
        s3ServiceEventPerformed in interface org.jets3t.service.multithread.S3ServiceEventListener
        Parameters:
        event -
      • s3ServiceEventPerformed

        public void s3ServiceEventPerformed​(org.jets3t.service.multithread.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 org.jets3t.service.multithread.S3ServiceEventListener
        Parameters:
        event -
      • s3ServiceEventPerformed

        public void s3ServiceEventPerformed​(org.jets3t.service.multithread.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 org.jets3t.service.multithread.S3ServiceEventListener
        Parameters:
        event -
      • s3ServiceEventPerformed

        public void s3ServiceEventPerformed​(org.jets3t.service.multithread.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 org.jets3t.service.multithread.S3ServiceEventListener
        Parameters:
        event -
      • s3ServiceEventPerformed

        public void s3ServiceEventPerformed​(org.jets3t.service.multithread.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 org.jets3t.service.multithread.S3ServiceEventListener
        Parameters:
        event -
      • s3ServiceEventPerformed

        public void s3ServiceEventPerformed​(org.jets3t.service.multithread.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 org.jets3t.service.multithread.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 org.jets3t.gui.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​(org.jets3t.service.multithread.CreateBucketsEvent event)
        Specified by:
        s3ServiceEventPerformed in interface org.jets3t.service.multithread.S3ServiceEventListener
      • s3ServiceEventPerformed

        public void s3ServiceEventPerformed​(org.jets3t.service.multithread.CopyObjectsEvent event)
        Specified by:
        s3ServiceEventPerformed in interface org.jets3t.service.multithread.S3ServiceEventListener
      • getAclDescription

        public static String getAclDescription​(org.jets3t.service.acl.AccessControlList acl)
      • main

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