Package eu.mosaic.cloud.driver

Source Code of eu.mosaic.cloud.driver.Connection

package eu.mosaic.cloud.driver;

import java.util.ResourceBundle;

import com.amazonaws.auth.BasicAWSCredentials;

import eu.mosaic.cloud.amazon.AmazonConnection;

/**
* This class is used as a factory for Cloud connections.
*
* @author Adrian Copie
*
*/

public class Connection {

  private Connection() {

  }

  /**
   * Factory method (draft)
   *
   * @return the DriverConnection object
   */
  public static DriverConnection getConnection(String storageProvider) {

    DriverConnection conn = null;

    if (storageProvider.equals("AMAZON_S3")) {

      ResourceBundle props = ResourceBundle
          .getBundle("eu.mosaic.cloud.amazon.AwsCredentials");

      String accessKey = props.getString("accessKey");
      String secretKey = props.getString("secretKey");

      conn = new AmazonConnection(new BasicAWSCredentials(accessKey,
          secretKey));
    }

    return conn;
  }
}
TOP

Related Classes of eu.mosaic.cloud.driver.Connection

TOP
Copyright © 2018 www.massapi.com. 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.