Package org.jets3t.service.model

Examples of org.jets3t.service.model.S3Bucket


            throw new SynchronizeException("Action string must be 'UP' or 'DOWN'");
        }       
       
        this.cryptoPassword = cryptoPassword;
               
        S3Bucket bucket = null;
        try {
            if (!s3Service.isBucketAccessible(bucketName)) {
                // Create/connect to the S3 bucket.
                bucket = s3Service.createBucket(bucketName);
            } else {
                bucket = new S3Bucket(bucketName);
            }
        } catch (Exception e) {
            throw new SynchronizeException("Unable to create/connect to S3 bucket: " + bucketName, e);
        }
       
View Full Code Here


   
    /**
     * Displays the currently selected bucket's properties in the dialog {@link ItemPropertiesDialog}.
     */
    private void listBucketProperties() {
        final S3Bucket selectedBucket = getCurrentSelectedBucket();
       
        if (selectedBucket.getAcl() == null || !selectedBucket.isLocationKnown()) {
            // Retrieve all a bucket's details before displaying the summary.
            new Thread(new Runnable() {
                public void run() {               
                    startProgressDialog("Retrieving details for bucket " + selectedBucket.getName());
                    try {                   
                        if (selectedBucket.getAcl() == null) {
                            selectedBucket.setAcl(
                                s3ServiceMulti.getS3Service().getBucketAcl(
                                    selectedBucket));
                        }
                        if (!selectedBucket.isLocationKnown()) {
                            selectedBucket.setLocation(
                                s3ServiceMulti.getS3Service().getBucketLocation(
                                    selectedBucket.getName()));
                        }
                       
                        SwingUtilities.invokeLater(new Runnable() {
                            public void run() {                               
                                ItemPropertiesDialog.showDialog(ownerFrame, selectedBucket, null);                                                               
View Full Code Here

           
    /**
     * Actions performed when a bucket is selected in the bucket list table.
     */
    private void bucketSelectedAction() {
        S3Bucket newlySelectedBucket = getCurrentSelectedBucket();
        if (newlySelectedBucket == null) {
            viewBucketPropertiesMenuItem.setEnabled(false);
            refreshBucketMenuItem.setEnabled(true);
            updateBucketACLMenuItem.setEnabled(false);
            deleteBucketMenuItem.setEnabled(false);
           
            refreshObjectMenuItem.setEnabled(false);
            uploadFilesMenuItem.setEnabled(false);
           
            objectTableModel.removeAllObjects();
           
            objectsTable.getDropTarget().setActive(false);
            objectsTableSP.getDropTarget().setActive(false);
           
            return;
        }
       
        viewBucketPropertiesMenuItem.setEnabled(true);
        refreshBucketMenuItem.setEnabled(true);
        updateBucketACLMenuItem.setEnabled(true);
        deleteBucketMenuItem.setEnabled(true);
       
        refreshObjectMenuItem.setEnabled(true);
        uploadFilesMenuItem.setEnabled(true);
       
        objectsTable.getDropTarget().setActive(true);
        objectsTableSP.getDropTarget().setActive(true);
       
        if (cachedBuckets.containsKey(newlySelectedBucket.getName())) {
            S3Object[] objects = (S3Object[]) cachedBuckets.get(newlySelectedBucket.getName());
           
            objectTableModel.removeAllObjects();                   
            objectTableModel.addObjects(objects);
            updateObjectsSummary(false);
        } else {       
View Full Code Here

       
        CreateBucketDialog dialog = new CreateBucketDialog(proposedNewName, ownerFrame, this);
        dialog.setVisible(true);
       
        if (dialog.getOkClicked()) {
            final S3Bucket newBucket = new S3Bucket(dialog.getBucketName(),
                dialog.getBucketLocation());
           
            new Thread() {
                public void run() {
                    s3ServiceMulti.createBuckets(new S3Bucket[] { newBucket });
View Full Code Here

    /**
     * Deletes the bucket currently selected in the gui.
     *
     */
    private void deleteSelectedBucket() {
        S3Bucket currentBucket = getCurrentSelectedBucket();
        if (currentBucket == null) {
            log.warn("Ignoring delete bucket command, no currently selected bucket");
            return;
        }
       
        int response = JOptionPane.showConfirmDialog(ownerFrame,
            "Are you sure you want to delete '" + currentBucket.getName() + "'?"
            "Delete Bucket?", JOptionPane.YES_NO_OPTION);
       
        if (response == JOptionPane.NO_OPTION) {
            return;
        }
       
        try {
            s3ServiceMulti.getS3Service().deleteBucket(currentBucket.getName());
            bucketTableModel.removeBucket(currentBucket);
        } catch (Exception e) {
            String message = "Unable to delete bucket";
            log.error(message, e);
            ErrorDialog.showDialog(ownerFrame, this, message, e);
View Full Code Here

                "Name for third-party bucket:",
                "Add a third-party bucket", JOptionPane.QUESTION_MESSAGE);

            if (bucketName != null) {
                if (s3ServiceMulti.getS3Service().isBucketAccessible(bucketName)) {
                    S3Bucket thirdPartyBucket = new S3Bucket(bucketName);
                    bucketTableModel.addBucket(thirdPartyBucket);
                } else {
                    String message = "Unable to access third-party bucket: " + bucketName;
                    log.error(message);
                    ErrorDialog.showDialog(ownerFrame, this, message, null);
View Full Code Here

    /**
     * Updates the ACL settings for the currently selected bucket.
     */
    private void updateBucketAccessControlList() {
        try {
            S3Bucket currentBucket = getCurrentSelectedBucket();
            AccessControlList bucketACL = s3ServiceMulti.getS3Service().getBucketAcl(currentBucket);
           
            AccessControlList updatedBucketACL = AccessControlDialog.showDialog(
                ownerFrame, new S3Bucket[] {currentBucket}, bucketACL, this);
            if (updatedBucketACL != null) {
                currentBucket.setAcl(updatedBucketACL);
                s3ServiceMulti.getS3Service().putBucketAcl(currentBucket);
            }
        } catch (Exception e) {
            String message = "Unable to update bucket's Access Control List";
            log.error(message, e);
View Full Code Here

        // perform operations in S3 using signed URLs (no AWS Credentials required).
        // The RestS3Service provides an implementation of this interface in JetS3t.
        SignedUrlHandler signedUrlHandler = new RestS3Service(null);

        // Create a bucket to test reading and writing to       
        S3Bucket bucket = new S3Bucket(myBucketName);
       
        // Create an object to use for testing.
        S3Object object = new S3Object(bucket, "urlSigningTestObject.txt", "Hello World!");
       
        // Determine what the time will be in 5 minutes - our signed URLs will be valid for 5 minutes only.
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.MINUTE, 5);
        Date expiryDate = cal.getTime();

        /*
         * Generate the signed URL strings for PUT, GET, HEAD and DELETE operations, using the
         * AWS Credentials in the samples.properties file.
         */
        AWSCredentials awsCredentials = SamplesUtils.loadAWSCredentials();
       
        // Create a signed HTTP PUT URL valid for 5 minutes.       
        String putUrl = S3Service.createSignedPutUrl(bucket.getName(), object.getKey(),
            object.getMetadataMap(), awsCredentials, expiryDate, false);
       
        // Create a signed HTTP GET URL valid for 5 minutes.
        String getUrl = S3Service.createSignedGetUrl(bucket.getName(), object.getKey()
            awsCredentials, expiryDate, false);

        // Create a signed HTTP HEAD URL valid for 5 minutes.
        String headUrl = S3Service.createSignedHeadUrl(bucket.getName(), object.getKey(),
            awsCredentials, expiryDate, false);

        // Create a signed HTTP DELETE URL valid for 5 minutes.
        String deleteUrl = S3Service.createSignedDeleteUrl(bucket.getName(), object.getKey(),
            awsCredentials, expiryDate, false);
       
        System.out.println("Signed PUT URL: " + putUrl);
        System.out.println("Signed GET URL: " + getUrl);
        System.out.println("Signed HEAD URL: " + headUrl);
View Full Code Here

    public S3Bucket createBucket(String bucketName, String location) throws S3ServiceException {
        assertAuthenticatedConnection("createBucket");

        if (isBucketAccessible(bucketName)) {
            log.debug("Bucket with name '" + bucketName + "' already exists, it will not be created");
            return new S3Bucket(bucketName);
        }
       
        S3Bucket bucket = new S3Bucket(bucketName, location);
        return createBucket(bucket);
    }
View Full Code Here

        // Generate the S3 object name based on the combined passphrase & password hash.
        String credentialObjectName = ServiceUtils.toHex(
            ServiceUtils.computeMD5Hash(combinedPassphraseAndPassword.getBytes(Constants.DEFAULT_ENCODING)))
            + "/jets3t.credentials";
               
        S3Bucket bucket = new S3Bucket(bucketName);
        System.out.println("bucketName=" + bucketName);
        System.out.println("credentialObjectName=" + credentialObjectName);
       
        /*
         * Store credentials.
View Full Code Here

TOP

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

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.