org.terracotta.toolkit.api
Interface ToolkitFactoryService


public interface ToolkitFactoryService

Service for creating Toolkit instances. This interface is implemented by toolkit implementations that want to handle specific 'toolkitUrl's and provide their own toolkit implementation.

At runtime, the ToolkitFactory finds all implementations of this interface and chooses the first one that can handle the given toolkitUrl. Implementations should return true for canHandleToolkitType(String, String) given the toolkit type and subName it can handle. Implementors can deploy their implementation by deploying a jar containing the implementation in the classpath. The jar should also contain a file "META-INF/services/org.terracotta.toolkit.api.ToolkitFactoryService" that contains the fully-qualified classname of this service implementation in a single line.

Author:
Abhishek Sanoujam

Method Summary
 boolean canHandleToolkitType(String type, String subName)
          Returns true if this implementation can handle toolkit types specified by 'type' and 'subName'.
 Toolkit createToolkit(String type, String subName, Properties properties)
          Creates a Toolkit instance for the given type, subName and using the properties passed in.
 

Method Detail

canHandleToolkitType

boolean canHandleToolkitType(String type,
                             String subName)
Returns true if this implementation can handle toolkit types specified by 'type' and 'subName'. Otherwise returns false.

Parameters:
type - the type of the toolkit
subName - subName for the toolkit
Returns:
true if implementation can handle the given toolkit 'type' and 'subName', otherwise false
See Also:
ToolkitFactory.createToolkit(String), ToolkitFactory.createToolkit(String, Properties)

createToolkit

Toolkit createToolkit(String type,
                      String subName,
                      Properties properties)
                      throws ToolkitInstantiationException
Creates a Toolkit instance for the given type, subName and using the properties passed in. Implementations should throw ToolkitInstantiationException if it cannot handle the toolkit type or if it cannot create the toolkit due to wrong/invalid configuration.

Parameters:
type - the type of the toolkit
subName - subName for the toolkit
properties - contains user configured properties. Can be null.
Returns:
a toolkit instance
Throws:
ToolkitInstantiationException - if the type cannot be handled or if there is any error
See Also:
ToolkitFactory.createToolkit(String), ToolkitFactory.createToolkit(String, Properties)


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