예제 #1
0
  @Override
  public void init() throws Exception {
    if (username == null) {
      throw new IllegalArgumentException("Rackspace 'username' must not be null");
    }
    if (apiKey == null) {
      throw new IllegalArgumentException("Rackspace 'apiKey' must not be null");
    }
    if (region == null || (!region.equals("UK") && !region.equals("US"))) {
      throw new IllegalArgumentException("Invalid 'region', must be UK or US");
    }

    URL authURL = new URL(region.equals("UK") ? UKService : USService);
    rackspaceClient = new RackspaceClient(authURL, username, apiKey);

    super.init();
  }
예제 #2
0
  @Override
  public void init() throws Exception {
    Utils.validateNotEmpty(auth_url, "auth_url");
    Utils.validateNotEmpty(auth_type, "auth_type");
    Utils.validateNotEmpty(username, "username");
    Utils.validateNotEmpty(password, "password");
    Utils.validateNotEmpty(container, "container");

    Authenticator authenticator = createAuthenticator();
    authenticator.validateParams();

    swiftClient = new SwiftClient(authenticator);
    // Authenticate now to record credential
    swiftClient.authenticate();

    super.init();
  }