org.terracotta.toolkit
Class ToolkitFactory

java.lang.Object
  extended by org.terracotta.toolkit.ToolkitFactory

public final class ToolkitFactory
extends Object

A static factory class used for creating Toolkit instances.

The actual instance of Toolkit created depends on the runtime environment and the configuration. The toolkitURI is used to choose which implementation of Toolkit to instantiate.
For example, for creating Terracotta clustered toolkit, use:

 Toolkit toolkit = ToolkitFactory.createToolkit("toolkit:terracotta://server:tsa-port");
 
where server is the host-name/ip of the Terracotta Server and port is the port number where Terracotta Server Array is running.

Author:
Abhishek Sanoujam

Constructor Summary
ToolkitFactory()
           
 
Method Summary
static Toolkit createToolkit(String toolkitURI)
          Same as calling ToolkitFactory.createToolkit(toolkitURI, null)}.
static Toolkit createToolkit(String toolkitURI, Properties properties)
          Creates an instance of Toolkit depending on the toolkitURI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToolkitFactory

public ToolkitFactory()
Method Detail

createToolkit

public static Toolkit createToolkit(String toolkitURI)
                             throws ToolkitInstantiationException,
                                    InvalidToolkitConfigException,
                                    IllegalArgumentException
Same as calling ToolkitFactory.createToolkit(toolkitURI, null)}.

The created toolkit instance depends on the actual value of the toolkitURI
For example, for creating Terracotta clustered toolkit, use:

 Toolkit toolkit = ToolkitFactory.createToolkit("toolkit:terracotta://server:tsa-port");
 
where server is the host-name/ip of the Terracotta Server and port is the port number where Terracotta Server Array is running.

Parameters:
toolkitURI - the toolkit URI of the form toolkit:type:subname
Returns:
the toolkit instance
Throws:
ToolkitInstantiationException - if unable to create the toolkit instance
InvalidToolkitConfigException - if unable to create the toolkit because of invalid configuration
IllegalArgumentException - if toolkitURI is not of the form toolkit:type:subname
See Also:
createToolkit(String, Properties)

createToolkit

public static Toolkit createToolkit(String toolkitURI,
                                    Properties properties)
                             throws ToolkitInstantiationException,
                                    InvalidToolkitConfigException,
                                    IllegalArgumentException
Creates an instance of Toolkit depending on the toolkitURI.

The toolkitURI is in the form of toolkit:type:subname
The actual values of type:subname depends on the particular implementation of the Toolkit.
For example, for creating Terracotta clustered toolkit, use:

 Toolkit toolkit = ToolkitFactory.createToolkit("toolkit:terracotta://server:tsa-port");
 
where server is the host-name/ip of the Terracotta Server and port is the port number where Terracotta Server Array is running.

Parameters:
toolkitURI - the toolkit URI of the form toolkit:type:subname
properties - Implementation specific properties used for configuring the instantiated Toolkit. Depends on the Toolkit implementation how the properties is used. Can be null.
Returns:
the toolkit instance
Throws:
ToolkitInstantiationException - if unable to create the toolkit instance
InvalidToolkitConfigException - if unable to create the toolkit because of invalid configuration
IllegalArgumentException - if toolkitURI is not of the form toolkit:type:subname


Copyright © 2014 Terracotta, Inc.. All Rights Reserved.