org.chromattic.api
Class ChromatticBuilder

java.lang.Object
  extended by org.chromattic.api.ChromatticBuilder

public abstract class ChromatticBuilder
extends java.lang.Object

The builder configures and create a Chromattic runtime.

Version:
$Revision$
Author:
Julien Viet

Nested Class Summary
static class ChromatticBuilder.Option<D>
          A configuration option.
protected static class ChromatticBuilder.Options
           
 
Field Summary
static ChromatticBuilder.Option<java.lang.Boolean> CREATE_ROOT_NODE
          A boolean option that creates the root node designated by the ROOT_NODE_PATH option when it does not exist.
static ChromatticBuilder.Option<java.lang.String> INSTRUMENTOR_CLASSNAME
          The instrumentor class name for Chromattic's objects.
static ChromatticBuilder.Option<java.lang.Boolean> JCR_OPTIMIZE_ENABLED
          Enable / disable all JCR optimizations.
static ChromatticBuilder.Option<java.lang.Boolean> JCR_OPTIMIZE_HAS_NODE_ENABLED
          Enable / disable access to JCR has property.
static ChromatticBuilder.Option<java.lang.Boolean> JCR_OPTIMIZE_HAS_PROPERTY_ENABLED
          Enable / disable access to JCR has property.
static ChromatticBuilder.Option<java.lang.Boolean> LAZY_CREATE_ROOT_NODE
          A boolean option that indicates that the root node should be lazyly created when it is required.
static ChromatticBuilder.Option<java.lang.String> OBJECT_FORMATTER_CLASSNAME
          The object name formatter class name.
static ChromatticBuilder.Option<java.lang.Boolean> PROPERTY_CACHE_ENABLED
          The boolean indicating if caching is performed.
static ChromatticBuilder.Option<java.lang.Boolean> PROPERTY_READ_AHEAD_ENABLED
          Todo.
static ChromatticBuilder.Option<java.lang.String> ROOT_NODE_PATH
          The path of the root node.
static ChromatticBuilder.Option<java.lang.String> SESSION_LIFECYCLE_CLASSNAME
          The JCR session life cycle class name.
static ChromatticBuilder.Option<java.lang.Boolean> USE_SYSTEM_PROPERTIES
          A special option that will lookup system properties when set to true to configure options by default.
 
Constructor Summary
ChromatticBuilder()
           
 
Method Summary
 void add(java.lang.Class<?> clazz)
          Adds a class definition.
protected abstract  Chromattic boot(ChromatticBuilder.Options options, java.util.Set<java.lang.Class> classes)
           
 Chromattic build()
          Builds the runtime and return a configured Chromattic instance.
static ChromatticBuilder create()
          Create and return an instance of the builder.
<D> ChromatticBuilder.Option.Instance<D>
getOptionInstance(ChromatticBuilder.Option<D> option)
          Returns a configured option instance.
 ChromatticBuilder.Option.Instance<?> getOptionInstance(java.lang.String name)
          Returns a configured option instance.
<D> D
getOptionValue(ChromatticBuilder.Option<D> option)
          Returns the option value.
static java.util.Set<ChromatticBuilder.Option> getSystemOptions()
           
<D> void
setOptionStringValue(ChromatticBuilder.Option<D> option, java.lang.String value)
          Set the option value as a string.
<D> void
setOptionValue(ChromatticBuilder.Option<D> option, D value)
          Set the option value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USE_SYSTEM_PROPERTIES

public static final ChromatticBuilder.Option<java.lang.Boolean> USE_SYSTEM_PROPERTIES
A special option that will lookup system properties when set to true to configure options by default.


INSTRUMENTOR_CLASSNAME

public static final ChromatticBuilder.Option<java.lang.String> INSTRUMENTOR_CLASSNAME
The instrumentor class name for Chromattic's objects. The specified class must implement the org.chromattic.spi.instrument.Intrumentor class.


SESSION_LIFECYCLE_CLASSNAME

public static final ChromatticBuilder.Option<java.lang.String> SESSION_LIFECYCLE_CLASSNAME
The JCR session life cycle class name. The specified class must implement the org.chromattic.spi.jcr.SessionLifeCycle class.


OBJECT_FORMATTER_CLASSNAME

public static final ChromatticBuilder.Option<java.lang.String> OBJECT_FORMATTER_CLASSNAME
The object name formatter class name. The specified class must implement the org.chromattic.api.format.ObjectFormatter class.


PROPERTY_CACHE_ENABLED

public static final ChromatticBuilder.Option<java.lang.Boolean> PROPERTY_CACHE_ENABLED
The boolean indicating if caching is performed. When cache is enabled each session maintains a cache that avoids to use the underlying JCR session. As a consequence any change made directly to the JCR session will not be visible in the object domain.


PROPERTY_READ_AHEAD_ENABLED

public static final ChromatticBuilder.Option<java.lang.Boolean> PROPERTY_READ_AHEAD_ENABLED
Todo.


JCR_OPTIMIZE_ENABLED

public static final ChromatticBuilder.Option<java.lang.Boolean> JCR_OPTIMIZE_ENABLED
Enable / disable all JCR optimizations.


JCR_OPTIMIZE_HAS_PROPERTY_ENABLED

public static final ChromatticBuilder.Option<java.lang.Boolean> JCR_OPTIMIZE_HAS_PROPERTY_ENABLED
Enable / disable access to JCR has property.


JCR_OPTIMIZE_HAS_NODE_ENABLED

public static final ChromatticBuilder.Option<java.lang.Boolean> JCR_OPTIMIZE_HAS_NODE_ENABLED
Enable / disable access to JCR has property.


ROOT_NODE_PATH

public static final ChromatticBuilder.Option<java.lang.String> ROOT_NODE_PATH
The path of the root node. The default value is the path of the JCR workspace root node.


CREATE_ROOT_NODE

public static final ChromatticBuilder.Option<java.lang.Boolean> CREATE_ROOT_NODE
A boolean option that creates the root node designated by the ROOT_NODE_PATH option when it does not exist.


LAZY_CREATE_ROOT_NODE

public static final ChromatticBuilder.Option<java.lang.Boolean> LAZY_CREATE_ROOT_NODE
A boolean option that indicates that the root node should be lazyly created when it is required.

Constructor Detail

ChromatticBuilder

public ChromatticBuilder()
Method Detail

getSystemOptions

public static java.util.Set<ChromatticBuilder.Option> getSystemOptions()

create

public static ChromatticBuilder create()
Create and return an instance of the builder.

Returns:
the chromattic builder instance

getOptionInstance

public ChromatticBuilder.Option.Instance<?> getOptionInstance(java.lang.String name)
                                                       throws java.lang.NullPointerException
Returns a configured option instance.

Parameters:
name - the option name
Returns:
the corresponding option instance or null
Throws:
java.lang.NullPointerException - if the name is null

getOptionInstance

public <D> ChromatticBuilder.Option.Instance<D> getOptionInstance(ChromatticBuilder.Option<D> option)
                                                       throws java.lang.NullPointerException
Returns a configured option instance.

Type Parameters:
D - the option data type
Parameters:
option - the option to return
Returns:
the option instance or null
Throws:
java.lang.NullPointerException - if the option is null

setOptionStringValue

public <D> void setOptionStringValue(ChromatticBuilder.Option<D> option,
                                     java.lang.String value)
                          throws java.lang.NullPointerException
Set the option value as a string.

Type Parameters:
D - the option data type
Parameters:
option - the option to set
value - the option value
Throws:
java.lang.NullPointerException - if any argument is null

setOptionValue

public <D> void setOptionValue(ChromatticBuilder.Option<D> option,
                               D value)
                    throws java.lang.NullPointerException
Set the option value.

Type Parameters:
D - the option data type
Parameters:
option - the option to set
value - the option value
Throws:
java.lang.NullPointerException - if any argument is null

getOptionValue

public <D> D getOptionValue(ChromatticBuilder.Option<D> option)
                 throws java.lang.NullPointerException
Returns the option value.

Type Parameters:
D - the option data type
Parameters:
option - the option
Returns:
the option value
Throws:
java.lang.NullPointerException - if the option parameter is null

add

public void add(java.lang.Class<?> clazz)
         throws java.lang.NullPointerException
Adds a class definition.

Parameters:
clazz - the class to add
Throws:
java.lang.NullPointerException - if the provided class is null

build

public Chromattic build()
                 throws BuilderException
Builds the runtime and return a configured Chromattic instance.

Returns:
the chromattic instance
Throws:
BuilderException - any builder exception

boot

protected abstract Chromattic boot(ChromatticBuilder.Options options,
                                   java.util.Set<java.lang.Class> classes)
                            throws BuilderException
Throws:
BuilderException


Copyright © 2011 eXo Platform SAS. All Rights Reserved.