|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gentics.api.portalnode.connector.PortalConnectorFactory
public final class PortalConnectorFactory
PortalConnectorFactory can be used to create instances for datasources, RuleTrees and Resolvables.
Method Summary | ||
---|---|---|
static
|
createDatasource(java.lang.Class<T> clazz,
java.lang.String id)
Create a datasource instance of the given class with given id |
|
static Datasource |
createDatasource(java.util.Map handleprops)
Creates a new datasource handle with the specified properties as well as a new Datasource (with default properties). |
|
static Datasource |
createDatasource(java.util.Map handleprops,
java.util.Map dsprops)
Creates a new Datasource connection with the specified properties which should point to a Content Repository of Gentics Content.Node. |
|
static Datasource |
createDatasource(java.lang.String id)
Create a datasource instance for the datasource with given id |
|
static Expression |
createExpression(java.lang.String rule)
Parse the given expression string into an Expression. |
|
static MultichannellingDatasource |
createMultichannellingDatasource(java.util.Map<java.lang.String,java.lang.String> handleProps,
java.util.Map<java.lang.String,java.lang.String> dsProps)
Create a new instance of a multichannelling datasource |
|
static RuleTree |
createRuleTree(java.lang.String rule)
Deprecated. deprecated, replaced by createExpression(String) |
|
static WritableMultichannellingDatasource |
createWritableMultichannellingDatasource(java.util.Map<java.lang.String,java.lang.String> handleProps,
java.util.Map<java.lang.String,java.lang.String> dsProps)
Create a new writeable multichannelling datasource instance |
|
static WriteableDatasource |
createWriteableDatasource(java.util.Map handleProperties)
Creates a new datasource handle with the specified properties as well as a new writeable datasource (with default properties). |
|
static WriteableDatasource |
createWriteableDatasource(java.util.Map handleProperties,
java.util.Map datasourceProperties)
Creates a new datasource handle with the specified properties as well as a new writeable datasource with the specified properties. |
|
static void |
destroy()
Destroy the portal connector factory, close all database connections, remove the scheduler (created background threads). |
|
protected static void |
destroyDatasourceFactories()
Destroy all created datasource factories, close all handles (closing database connections) |
|
static java.util.List<java.lang.String> |
getAvailableDatasources()
Get the list of all available datasource ids |
|
static java.util.List<java.lang.String> |
getAvailableDatasources(java.lang.Class<? extends Datasource> datasourceClass)
Get the available datasources as list of ids |
|
static Changeable |
getChangeableContentObject(java.lang.String contentId,
WriteableDatasource datasource)
Returns a changeable content object with the given content id. |
|
static Resolvable |
getContentObject(java.lang.String contentId,
Datasource datasource)
Returns a content object with the given content id. |
|
static boolean |
isAutoRepair()
Check whether the auto-repair functionality is switched on or off by configuration. |
|
static boolean |
isAutoRepair2()
Check whether the auto-repair2 functionality is switched on or off by configuration. |
|
static void |
prefillAttributes(Datasource ds,
java.util.Collection<Resolvable> objects,
java.util.List<java.lang.String> prefillAttributes)
Prefill the given attributes for objects which were fetched from the given datasource |
|
static void |
registerDatasource(java.lang.String id,
DatasourceType type,
java.util.Map<java.lang.String,java.lang.String> parameters,
java.util.List<java.lang.String> handles)
Register a datasource at the factory. |
|
static void |
registerDatasource(java.lang.String id,
DatasourceType type,
java.util.Map<java.lang.String,java.lang.String> parameters,
java.util.List<java.lang.String> handleIds,
boolean allowOverwrite)
Register a datasource at the factory. |
|
static void |
registerHandle(java.lang.String id,
HandleType type,
java.util.Map<java.lang.String,java.lang.String> parameters)
Register a datasource handle at the factory. |
|
static void |
registerHandle(java.lang.String id,
HandleType type,
java.util.Map<java.lang.String,java.lang.String> parameters,
boolean allowOverwrite)
Register a datasource handle at the factory. |
|
protected static void |
startScheduler()
Start the scheduler |
|
protected static void |
stopScheduler()
Stop the scheduler. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Datasource createDatasource(java.util.Map handleprops)
handleprops
- Handle properties used when initializing SQL handle.
Datasource
,
createDatasource(Map, Map)
public static Datasource createDatasource(java.util.Map handleprops, java.util.Map dsprops)
Datasource
is NOT thread-safe.
Handle Property - Parameters:
type - Type of the datasource. (jndi or jdbc)
For JNDI:
name - The name of the defined JNDI datasource.
For JDBC:
driverClass = The name of the JDBC class to be used (e.g. com.mysql.jdbc.Driver)
url = The URL which describes the JDBC datasource. (e.g. jdbc:mysql://playground.office:3306/testdb?user=root)
Optional JDBC Pool Parameters:
maxActive = Controls the maximum number of objects that can be borrowed from the pool at one time.
maxIdle = Controls the maximum number of objects that can sit idle in the pool at any time.
for more options and more detailed documentation for JDBC Pool options
take a look at the API documentation of
GenericObjectPool
handleprops
- Handle properties used when initializing SQL handle.dsprops
- Datasource properties, may be an empty map.
public static MultichannellingDatasource createMultichannellingDatasource(java.util.Map<java.lang.String,java.lang.String> handleProps, java.util.Map<java.lang.String,java.lang.String> dsProps)
handleProps
- handle propertiesdsProps
- datasource properties
public static Resolvable getContentObject(java.lang.String contentId, Datasource datasource) throws DatasourceNotAvailableException
contentId
- The content id of the object which should be returned.
([objecttype].[object id] e.g. 10002.123)datasource
- Datasource used to load the content object.
DatasourceNotAvailableException
public static Expression createExpression(java.lang.String rule) throws ParserException
rule
- The Rule string to be parsed as Expression.
ParserException
Datasource.createDatasourceFilter(Expression)
public static RuleTree createRuleTree(java.lang.String rule) throws ParserException
createExpression(String)
rule
- The rule string which is used to initialize the RuleTree
ParserException
- when rule has invalid syntax or is null.RuleTree
public static WriteableDatasource createWriteableDatasource(java.util.Map handleProperties)
handleProperties
- Handle properties used when initializing SQL
handle.
public static WriteableDatasource createWriteableDatasource(java.util.Map handleProperties, java.util.Map datasourceProperties)
handleProperties
- Handle properties used when initializing SQL
handle.datasourceProperties
- Datasource properties, may be an empty map.
public static WritableMultichannellingDatasource createWritableMultichannellingDatasource(java.util.Map<java.lang.String,java.lang.String> handleProps, java.util.Map<java.lang.String,java.lang.String> dsProps)
handleProps
- handle propertiesdsProps
- datasource properties
public static Changeable getChangeableContentObject(java.lang.String contentId, WriteableDatasource datasource) throws DatasourceNotAvailableException
contentId
- The content id of the object which should be returned.
([objecttype].[object id] e.g. 10002.123)datasource
- Writeable Datasource used to load the content object.
DatasourceNotAvailableException
public static void prefillAttributes(Datasource ds, java.util.Collection<Resolvable> objects, java.util.List<java.lang.String> prefillAttributes) throws NodeException
ds
- datasourceobjects
- collection of objects fetched from the datasourceprefillAttributes
- list of attributes to be prefilled
NodeException
protected static void startScheduler()
protected static void stopScheduler()
protected static void destroyDatasourceFactories()
public static void destroy()
public static void registerHandle(java.lang.String id, HandleType type, java.util.Map<java.lang.String,java.lang.String> parameters) throws DuplicateIdException, NodeException
id
- id of the datasource handletype
- handle typeparameters
- handle parameters
DuplicateIdException
- if a handle with that id was already registered
NodeException
- if the parameters are invalidpublic static void registerHandle(java.lang.String id, HandleType type, java.util.Map<java.lang.String,java.lang.String> parameters, boolean allowOverwrite) throws DuplicateIdException, NodeException
id
- id of the datasource handletype
- handle typeparameters
- handle parametersallowOverwrite
- true if overwriting existing handles should be allowed
DuplicateIdException
- if a handle with that id was already registered and allowOverwrite was false
NodeException
- if the parameters are invalidpublic static void registerDatasource(java.lang.String id, DatasourceType type, java.util.Map<java.lang.String,java.lang.String> parameters, java.util.List<java.lang.String> handles) throws DuplicateIdException, NodeException
id
- datasource idtype
- datasource typeparameters
- datasource parametershandles
- list of datasource handle ids
DuplicateIdException
- if a datasource with that id was already registered
NodeException
public static void registerDatasource(java.lang.String id, DatasourceType type, java.util.Map<java.lang.String,java.lang.String> parameters, java.util.List<java.lang.String> handleIds, boolean allowOverwrite) throws DuplicateIdException, NodeException
id
- datasource idtype
- datasource typeparameters
- datasource parametershandleIds
- list of datasource handle idsallowOverwrite
- true if overwriting existing datasources should be allowed, false if not
DuplicateIdException
- if a datasource with that id was already registered and allowOverwrite was false
NodeException
public static boolean isAutoRepair()
public static boolean isAutoRepair2()
public static java.util.List<java.lang.String> getAvailableDatasources()
public static java.util.List<java.lang.String> getAvailableDatasources(java.lang.Class<? extends Datasource> datasourceClass)
datasourceClass
- datasource class. If null, all available datasources will be returned
public static Datasource createDatasource(java.lang.String id) throws NodeException
id
- datasource id
NodeException
- if no datasource with given id was registeredpublic static <T extends Datasource> T createDatasource(java.lang.Class<T> clazz, java.lang.String id) throws NodeException
clazz
- datasource classid
- datasource id
NodeException
- if no datasource with given id was registered or if the datasource does not implement the given class
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |