Package org.gitana.platform.client

# Class Gitana

java.lang.Object
org.gitana.platform.client.Gitana

public class Gitana extends Object

Author:
  uzi

## Constructor Summary

Constructors
Constructor
Description
`Gitana()`
Creates a Gitana instance that loads all of its settings from a properties bundle.
`Gitana(String clientKey, String clientSecret)`
Creates a Gitana instance bound to a Gitana API client.
`Gitana(String environmentId, String clientKey, String clientSecret)`
Creates a Gitana instance bound to a given client on an environment.
`Gitana(String environmentId, String clientKey, String clientSecret, String baseURL)`

## Method Summary

Modifier and Type
Method
Description
`Platform`
`authenticate()`
Authenticates using the user credentials stored in the Gitana resource bundle.
`Platform`
`authenticate(String username, String password)`
Authenticates to Gitana using the given credentials.
`Platform`
`authenticate(String username, String password, ConnectOptions connectOptions)`
`Platform`
`authenticate(ConnectOptions connectOptions)`
`Platform`
`authenticate(DomainUser user, String password)`
Authenticates as the given domain user.
`Platform`
`authenticate(DomainUser user, String password, ConnectOptions connectOptions)`
`Platform`
`authenticateAsGuest()`
Authenticates as the guest user.
`Platform`
`authenticateOnTenant(Identity identity, String password, String tenantId)`
Authenticates as the given identity using a domain user that belongs to a domain on the given tenant.
`Platform`
`authenticateOnTenant(DomainUser user, String password, String tenantId)`
Authenticates the user's identity using a domain user that belongs to a domain on the given tenant.
`Platform`
`authenticateOnTenant(DomainUser user, String password, Tenant tenant)`
Authenticates the user's identity using a domain user that belongs to a domain on the given tenant.
`Platform`
`authenticateWithCode(String code, String redirectUri)`
Authenticates with the code supplied by the Authorization Flow authorization server call.
`static Platform`
`connect()`
`static Platform`
`connect(com.fasterxml.jackson.databind.node.ObjectNode config)`
`static Platform`
`connect(com.fasterxml.jackson.databind.node.ObjectNode config, ConnectOptions connectOptions)`
`static Platform`
`connect(String clientKey, String clientSecret, String username, String password, String baseURL)`
`static Platform`
`connect(String clientKey, String clientSecret, String username, String password, String baseURL, ConnectOptions connectOptions)`
`static Platform`
`connect(Map<String,String> properties)`
`static Platform`
`connect(Map<String,String> properties, ConnectOptions connectOptions)`
`static Platform`
`connect(ResourceBundle bundle)`
`static Platform`
`connect(ResourceBundle bundle, ConnectOptions connectOptions)`
`static Platform`
`connect(ConnectOptions connectOptions)`
`protected RemoteImpl`
`createRemote()`
Creates an anonymous remote that can be used to access any resources on the Gitana server that are not protected behind oauth.
`protected RemoteImpl`
`createRemote(org.gitana.http.HttpClientConfiguration clientConfiguration)`
Creates an anonymous remote that can be used to access any resources on the Gitana server that are not protected behind oauth.
`String`
`getBaseURL()`
`protected Platform`
`loadPlatform(Driver driver)`
`long`
`ping()`
Pings the server and returns the number of milliseconds for pong to return.
`protected void`
`populateAuthenticationInformation(Driver driver)`
`static ResourceBundle`
`readBundle(String bundleId)`
`void`
`setStatePersister(org.gitana.http.OAuth2StatePersister statePersister)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### Gitana

public Gitana()
Creates a Gitana instance that loads all of its settings from a properties bundle.

### Gitana

public Gitana(String clientKey, String clientSecret)
Creates a Gitana instance bound to a Gitana API client.

### Gitana

public Gitana(String environmentId, String clientKey, String clientSecret)
Creates a Gitana instance bound to a given client on an environment.

Parameters:
  `environmentId` -
  `clientKey` -
  `clientSecret` -

### Gitana

public Gitana(String environmentId, String clientKey, String clientSecret, String baseURL)

## Method Details

### setStatePersister

public void setStatePersister(org.gitana.http.OAuth2StatePersister statePersister)

### getBaseURL

public String getBaseURL()

### connect

public static Platform connect(ResourceBundle bundle)

### connect

public static Platform connect(ResourceBundle bundle, ConnectOptions connectOptions)

### connect

public static Platform connect(com.fasterxml.jackson.databind.node.ObjectNode config)

### connect

public static Platform connect(com.fasterxml.jackson.databind.node.ObjectNode config, ConnectOptions connectOptions)

### connect

public static Platform connect(Map<String,String> properties)

### connect

public static Platform connect(Map<String,String> properties, ConnectOptions connectOptions)

### connect

public static Platform connect()

### connect

public static Platform connect(ConnectOptions connectOptions)

### connect

public static Platform connect(String clientKey, String clientSecret, String username, String password, String baseURL)

### connect

public static Platform connect(String clientKey, String clientSecret, String username, String password, String baseURL, ConnectOptions connectOptions)

### createRemote

protected RemoteImpl createRemote()
Creates an anonymous remote that can be used to access any resources on the Gitana server that are not protected behind oauth.

Returns:
  remote

### createRemote

protected RemoteImpl createRemote(org.gitana.http.HttpClientConfiguration clientConfiguration)
Creates an anonymous remote that can be used to access any resources on the Gitana server that are not protected behind oauth.

Parameters:
  `clientConfiguration` -
Returns:
  remote

### populateAuthenticationInformation

protected void populateAuthenticationInformation(Driver driver)

### loadPlatform

protected Platform loadPlatform(Driver driver)

### authenticate

public Platform authenticate()
Authenticates using the user credentials stored in the Gitana resource bundle.

Returns:
  platform

### authenticate

public Platform authenticate(ConnectOptions connectOptions)

### authenticateAsGuest

public Platform authenticateAsGuest()
Authenticates as the guest user.

Returns:
  platformw

### authenticate

public Platform authenticate(DomainUser user, String password)
Authenticates as the given domain user.

Parameters:
  `user` -
  `password` -
Returns:

### authenticate

public Platform authenticate(DomainUser user, String password, ConnectOptions connectOptions)

### authenticateOnTenant

public Platform authenticateOnTenant(Identity identity, String password, String tenantId)
Authenticates as the given identity using a domain user that belongs to a domain on the given tenant. If multiple users are found, the first one is picked.

Parameters:
  `identity` -
  `password` -
  `tenantId` -
Returns:

### authenticateOnTenant

public Platform authenticateOnTenant(DomainUser user, String password, String tenantId)
Authenticates the user's identity using a domain user that belongs to a domain on the given tenant. If multiple users are found, the first one is picked.

Parameters:
  `user` -
  `password` -
  `tenantId` -
Returns:

### authenticateOnTenant

public Platform authenticateOnTenant(DomainUser user, String password, Tenant tenant)
Authenticates the user's identity using a domain user that belongs to a domain on the given tenant. If multiple users are found, the first one is picked.

Parameters:
  `user` -
  `password` -
  `tenant` -
Returns:

### authenticate

public Platform authenticate(String username, String password)
Authenticates to Gitana using the given credentials. These credentials can be any of the following: username/password (assumes the default domain of the platform) user id/password (assumes the default domain of the platform) domain qualified username / password domain qualified id / password credential key / credential secret This utilizes the OAuth2 resource owner username/password flow.

Parameters:
  `username` -
  `password` -

### authenticate

public Platform authenticate(String username, String password, ConnectOptions connectOptions)

### authenticateWithCode

public Platform authenticateWithCode(String code, String redirectUri)
Authenticates with the code supplied by the Authorization Flow authorization server call.

Parameters:
  `code` -
  `redirectUri` -
Returns:
  platform

### ping

public long ping()
Pings the server and returns the number of milliseconds for pong to return. If the ping fails, an exception is thrown.

Returns:
  milliseconds

### readBundle

public static ResourceBundle readBundle(String bundleId)