Package org.jets3t.service.model

Examples of org.jets3t.service.model.S3BucketLoggingStatus


            } else {

                final String bucketName = (String) loggedBucketComboBox.getSelectedItem();
               
                if (loggingStatusMap.containsKey(bucketName)) {
                    S3BucketLoggingStatus loggingStatus =
                        (S3BucketLoggingStatus) loggingStatusMap.get(bucketName);
                    displayBucketLoggingStatus(loggingStatus);
                } else {
                    (new Thread() {
                        public void run() {
                            final ProgressDialog progressDialog =
                                new ProgressDialog(ownerFrame, "Bucket Logging", null);
                           
                            SwingUtilities.invokeLater(new Runnable() {
                                public void run() {
                                    progressDialog.startDialog("Retrieving bucket logging status",
                                        null, 0, 0, null, null);                              
                                }
                             });

                            try {
                                S3BucketLoggingStatus loggingStatus =
                                    s3Service.getBucketLoggingStatus(bucketName);                                   
                                loggingStatusMap.put(bucketName, loggingStatus);
                                displayBucketLoggingStatus(loggingStatus);
                            } catch (Exception e) {
                                SwingUtilities.invokeLater(new Runnable() {
                                    public void run() {
                                        progressDialog.stopDialog();                   
                                    }
                                 });

                                ErrorDialog.showDialog(ownerFrame, null,
                                    "Unable to retrieve bucket logging status for " + bucketName, e);
                            }
                            SwingUtilities.invokeLater(new Runnable() {
                                public void run() {
                                    progressDialog.stopDialog();                   
                                }
                             });
                        }
                    }).start();
                }                                                           
            }
        } else if (event.getSource().equals(loggedToBucketComboBox)) {
            if (!loggedToBucketComboBox.isEnabled()) {
                // Ignore this event, it is internally generated.
                return;
            }

            final String loggedBucketName = (String) loggedBucketComboBox.getSelectedItem();
            final String[] loggedToBucketName = new String[1];
            final String[] loggingFilePrefix = new String[1];
           
            if (loggedToBucketComboBox.getSelectedIndex() == 0) {
                // Logging is being disabled, leave values as null.
            } else {
                if (prefixTextField.getText().length() == 0) {
                    ErrorDialog.showDialog(ownerFrame, null,
                        "A log file name prefix must be provided to log buckets", null);
                    loggedToBucketComboBox.setSelectedIndex(0);
                    return;
                }
               
                loggedToBucketName[0] = (String) loggedToBucketComboBox.getSelectedItem();
                loggingFilePrefix[0] = prefixTextField.getText();
            }
           
            (new Thread(new Runnable() {
                public void run() {
                    final ProgressDialog progressDialog =
                        new ProgressDialog(ownerFrame, "Bucket Logging", null);
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            progressDialog.startDialog("Setting bucket logging status",
                                null, 0, 0, null, null);
                        }
                     });
                   
                    try {
                        S3BucketLoggingStatus loggingStatus =
                            new S3BucketLoggingStatus(loggedToBucketName[0], loggingFilePrefix[0]);
                        s3Service.setBucketLoggingStatus(loggedBucketName, loggingStatus, true);
                       
                        loggingStatusMap.put(loggedBucketName, loggingStatus);
                    } catch (Exception e) {
                        SwingUtilities.invokeLater(new Runnable() {
View Full Code Here


           
            BucketLoggingStatus loggingStatus = s3SoapBinding.getBucketLoggingStatus(               
                bucketName, getAWSAccessKey(), timestamp, signature, null);           
            LoggingSettings loggingSettings = loggingStatus.getLoggingEnabled();
            if (loggingSettings != null) {
                return new S3BucketLoggingStatus(loggingSettings.getTargetBucket(), loggingSettings.getTargetPrefix());               
            } else {
                return new S3BucketLoggingStatus();
            }
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new S3ServiceException("Unable to Get Bucket logging status for " + bucketName, e);  
View Full Code Here

        public void endDocument() {
        }

        public void startElement(String uri, String name, String qName, Attributes attrs) {
            if (name.equals("BucketLoggingStatus")) {
                bucketLoggingStatus = new S3BucketLoggingStatus();
            }
        }
View Full Code Here

        if (event.getSource().equals(finishedButton)) {
            // Hack to update the logging status of a bucket before exiting the dialog
            // if the prefix string has changed           
            String bucketName = (String) loggedBucketComboBox.getSelectedItem();           
            if (loggingStatusMap.containsKey(bucketName)) {
                S3BucketLoggingStatus loggingStatus =
                    (S3BucketLoggingStatus) loggingStatusMap.get(bucketName);
                if (!prefixTextField.getText().equals(loggingStatus.getLogfilePrefix())
                    && loggedToBucketComboBox.getSelectedIndex() != 0)
                {
                    loggedToBucketComboBox.setSelectedIndex(loggedToBucketComboBox.getSelectedIndex());
                }
            }  
           
            this.setVisible(false);
        } else if (event.getSource().equals(loggedBucketComboBox)) {
            prefixTextField.setEnabled(false);
            loggedToBucketComboBox.setEnabled(false);

            if (loggedBucketComboBox.getSelectedIndex() == 0) {
                prefixTextField.setText("");               
                loggedToBucketComboBox.setSelectedIndex(0);
            } else {

                final String bucketName = (String) loggedBucketComboBox.getSelectedItem();
               
                if (loggingStatusMap.containsKey(bucketName)) {
                    S3BucketLoggingStatus loggingStatus =
                        (S3BucketLoggingStatus) loggingStatusMap.get(bucketName);
                    displayBucketLoggingStatus(loggingStatus);
                } else {
                    (new Thread() {
                        public void run() {
                            final ProgressDialog progressDialog =
                                new ProgressDialog(ownerFrame, "Bucket Logging", null);
                           
                            SwingUtilities.invokeLater(new Runnable() {
                                public void run() {
                                    progressDialog.startDialog("Retrieving bucket logging status",
                                        null, 0, 0, null, null);                              
                                }
                             });

                            try {
                                S3BucketLoggingStatus loggingStatus =
                                    s3Service.getBucketLoggingStatus(bucketName);                                   
                                loggingStatusMap.put(bucketName, loggingStatus);
                                displayBucketLoggingStatus(loggingStatus);
                            } catch (Exception e) {
                                SwingUtilities.invokeLater(new Runnable() {
                                    public void run() {
                                        progressDialog.stopDialog();                   
                                    }
                                 });

                                ErrorDialog.showDialog(ownerFrame, null,
                                    "Unable to retrieve bucket logging status for " + bucketName, e);
                            }
                            SwingUtilities.invokeLater(new Runnable() {
                                public void run() {
                                    progressDialog.stopDialog();                   
                                }
                             });
                        }
                    }).start();
                }                                                           
            }
        } else if (event.getSource().equals(loggedToBucketComboBox)) {
            if (!loggedToBucketComboBox.isEnabled()) {
                // Ignore this event, it is internally generated.
                return;
            }

            final String loggedBucketName = (String) loggedBucketComboBox.getSelectedItem();
            final String[] loggedToBucketName = new String[1];
            final String[] loggingFilePrefix = new String[1];
           
            if (loggedToBucketComboBox.getSelectedIndex() == 0) {
                // Logging is being disabled, leave values as null.
            } else {
                if (prefixTextField.getText().length() == 0) {
                    ErrorDialog.showDialog(ownerFrame, null,
                        "A log file name prefix must be provided to log buckets", null);
                    loggedToBucketComboBox.setSelectedIndex(0);
                    return;
                }
               
                loggedToBucketName[0] = (String) loggedToBucketComboBox.getSelectedItem();
                loggingFilePrefix[0] = prefixTextField.getText();
            }
           
            (new Thread(new Runnable() {
                public void run() {
                    final ProgressDialog progressDialog =
                        new ProgressDialog(ownerFrame, "Bucket Logging", null);
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            progressDialog.startDialog("Setting bucket logging status",
                                null, 0, 0, null, null);
                        }
                     });
                   
                    try {
                        S3BucketLoggingStatus loggingStatus =
                            new S3BucketLoggingStatus(loggedToBucketName[0], loggingFilePrefix[0]);
                        s3Service.setBucketLoggingStatus(loggedBucketName, loggingStatus, true);
                       
                        loggingStatusMap.put(loggedBucketName, loggingStatus);
                    } catch (Exception e) {
                        SwingUtilities.invokeLater(new Runnable() {
View Full Code Here

        public void endDocument() {
        }

        public void startElement(String uri, String name, String qName, Attributes attrs) {
            if (name.equals("BucketLoggingStatus")) {
                bucketLoggingStatus = new S3BucketLoggingStatus();
            }
        }
View Full Code Here

           
            BucketLoggingStatus loggingStatus = s3SoapBinding.getBucketLoggingStatus(               
                bucketName, getAWSAccessKey(), timestamp, signature, null);           
            LoggingSettings loggingSettings = loggingStatus.getLoggingEnabled();
            if (loggingSettings != null) {
                return new S3BucketLoggingStatus(loggingSettings.getTargetBucket(), loggingSettings.getTargetPrefix());               
            } else {
                return new S3BucketLoggingStatus();
            }
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new S3ServiceException("Unable to Get Bucket logging status for " + bucketName, e);  
View Full Code Here

        String bucketName = awsCredentials.getAccessKey() + ".jets3t_TestCases";

        S3Bucket bucket = s3Service.createBucket(bucketName);
       
        // Check logging status is false
        S3BucketLoggingStatus loggingStatus = s3Service.getBucketLoggingStatus(bucket.getName());
        assertFalse("Expected logging to be disabled for bucket " + bucketName,
            loggingStatus.isLoggingEnabled());
       
        // Enable logging (non-existent target bucket)
        try {
            S3BucketLoggingStatus newLoggingStatus = new S3BucketLoggingStatus(
                awsCredentials.getAccessKey() + ".NonExistentBucketName", "access-log-");
            s3Service.setBucketLoggingStatus(bucket.getName(), newLoggingStatus, true);
            fail("Using non-existent target bucket should have caused an exception");           
        } catch (Exception e) {           
        }
       
        // Enable logging (in same bucket)
        S3BucketLoggingStatus newLoggingStatus = new S3BucketLoggingStatus(bucketName, "access-log-");
        s3Service.setBucketLoggingStatus(bucket.getName(), newLoggingStatus, true);
        loggingStatus = s3Service.getBucketLoggingStatus(bucket.getName());
        assertTrue("Expected logging to be enabled for bucket " + bucketName,
            loggingStatus.isLoggingEnabled());
        assertEquals("Target bucket", bucketName, loggingStatus.getTargetBucketName());
        assertEquals("Log file prefix", "access-log-", loggingStatus.getLogfilePrefix());
       
        // Disable logging
        newLoggingStatus = new S3BucketLoggingStatus();
        s3Service.setBucketLoggingStatus(bucket.getName(), newLoggingStatus, true);
        loggingStatus = s3Service.getBucketLoggingStatus(bucket.getName());
        assertFalse("Expected logging to be disabled for bucket " + bucketName,
            loggingStatus.isLoggingEnabled());
View Full Code Here

        public void endDocument() {
        }

        public void startElement(String uri, String name, String qName, Attributes attrs) {
            if (name.equals("BucketLoggingStatus")) {
                bucketLoggingStatus = new S3BucketLoggingStatus();
            }
        }
View Full Code Here

           
            BucketLoggingStatus loggingStatus = s3SoapBinding.getBucketLoggingStatus(               
                bucketName, getAWSAccessKey(), timestamp, signature, null);           
            LoggingSettings loggingSettings = loggingStatus.getLoggingEnabled();
            if (loggingSettings != null) {
                return new S3BucketLoggingStatus(loggingSettings.getTargetBucket(), loggingSettings.getTargetPrefix());               
            } else {
                return new S3BucketLoggingStatus();
            }
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new S3ServiceException("Unable to Get Bucket logging status for " + bucketName, e);  
View Full Code Here

        if (event.getSource().equals(finishedButton)) {
            // Hack to update the logging status of a bucket before exiting the dialog
            // if the prefix string has changed
            String bucketName = (String) loggedBucketComboBox.getSelectedItem();
            if (loggingStatusMap.containsKey(bucketName)) {
                S3BucketLoggingStatus loggingStatus =
                    (S3BucketLoggingStatus) loggingStatusMap.get(bucketName);
                if (!prefixTextField.getText().equals(loggingStatus.getLogfilePrefix())
                    && loggedToBucketComboBox.getSelectedIndex() != 0)
                {
                    loggedToBucketComboBox.setSelectedIndex(loggedToBucketComboBox.getSelectedIndex());
                }
            }

            this.setVisible(false);
        } else if (event.getSource().equals(loggedBucketComboBox)) {
            prefixTextField.setEnabled(false);
            loggedToBucketComboBox.setEnabled(false);

            if (loggedBucketComboBox.getSelectedIndex() == 0) {
                prefixTextField.setText("");
                loggedToBucketComboBox.setSelectedIndex(0);
            } else {

                final String bucketName = (String) loggedBucketComboBox.getSelectedItem();

                if (loggingStatusMap.containsKey(bucketName)) {
                    S3BucketLoggingStatus loggingStatus =
                        (S3BucketLoggingStatus) loggingStatusMap.get(bucketName);
                    displayBucketLoggingStatus(loggingStatus);
                } else {
                    (new Thread() {
                        public void run() {
                            final ProgressDialog progressDialog =
                                new ProgressDialog(ownerFrame, "Bucket Logging", null);

                            SwingUtilities.invokeLater(new Runnable() {
                                public void run() {
                                    progressDialog.startDialog("Retrieving bucket logging status",
                                        null, 0, 0, null, null);
                                }
                             });

                            try {
                                S3BucketLoggingStatus loggingStatus =
                                    s3Service.getBucketLoggingStatus(bucketName);
                                loggingStatusMap.put(bucketName, loggingStatus);
                                displayBucketLoggingStatus(loggingStatus);
                            } catch (Exception e) {
                                SwingUtilities.invokeLater(new Runnable() {
                                    public void run() {
                                        progressDialog.stopDialog();
                                    }
                                 });

                                ErrorDialog.showDialog(ownerFrame, null,
                                    "Unable to retrieve bucket logging status for " + bucketName, e);
                            }
                            SwingUtilities.invokeLater(new Runnable() {
                                public void run() {
                                    progressDialog.stopDialog();
                                }
                             });
                        }
                    }).start();
                }
            }
        } else if (event.getSource().equals(loggedToBucketComboBox)) {
            if (!loggedToBucketComboBox.isEnabled()) {
                // Ignore this event, it is internally generated.
                return;
            }

            final String loggedBucketName = (String) loggedBucketComboBox.getSelectedItem();
            final String[] loggedToBucketName = new String[1];
            final String[] loggingFilePrefix = new String[1];

            if (loggedToBucketComboBox.getSelectedIndex() == 0) {
                // Logging is being disabled, leave values as null.
            } else {
                if (prefixTextField.getText().length() == 0) {
                    ErrorDialog.showDialog(ownerFrame, null,
                        "A log file name prefix must be provided to log buckets", null);
                    loggedToBucketComboBox.setSelectedIndex(0);
                    return;
                }

                loggedToBucketName[0] = (String) loggedToBucketComboBox.getSelectedItem();
                loggingFilePrefix[0] = prefixTextField.getText();
            }

            (new Thread(new Runnable() {
                public void run() {
                    final ProgressDialog progressDialog =
                        new ProgressDialog(ownerFrame, "Bucket Logging", null);
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            progressDialog.startDialog("Setting bucket logging status",
                                null, 0, 0, null, null);
                        }
                     });

                    try {
                        S3BucketLoggingStatus loggingStatus =
                            new S3BucketLoggingStatus(loggedToBucketName[0], loggingFilePrefix[0]);
                        s3Service.setBucketLoggingStatus(loggedBucketName, loggingStatus, true);

                        loggingStatusMap.put(loggedBucketName, loggingStatus);
                    } catch (Exception e) {
                        SwingUtilities.invokeLater(new Runnable() {
View Full Code Here

TOP

Related Classes of org.jets3t.service.model.S3BucketLoggingStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.