org.apache.sling.event.impl.jobs.jcr
Class JCRHelper

java.lang.Object
  extended by org.apache.sling.event.impl.jobs.jcr.JCRHelper

public abstract class JCRHelper
extends Object

Helper class defining some constants and utility methods.


Field Summary
static String EVENT_NODE_TYPE
           
static String EVENT_PREFIX
          The namespace prefix.
static String JOB_NODE_TYPE
           
static String NODE_PROPERTY_APPLICATION
           
static String NODE_PROPERTY_CREATED
           
static String NODE_PROPERTY_FINISHED
           
static String NODE_PROPERTY_JOBID
           
static String NODE_PROPERTY_LOCK_OWNER
          The property for locks.
static String NODE_PROPERTY_PROCESSOR
           
static String NODE_PROPERTY_PROPERTIES
           
static String NODE_PROPERTY_TE_DATE
           
static String NODE_PROPERTY_TE_EXPRESSION
           
static String NODE_PROPERTY_TE_PERIOD
           
static String NODE_PROPERTY_TOPIC
           
static String NODETYPE_FOLDER
          The nodetype for newly created intermediate folders
static String NODETYPE_ORDERED_FOLDER
          The nodetype for newly created folders
static String TIMED_EVENT_NODE_TYPE
           
 
Constructor Summary
JCRHelper()
           
 
Method Summary
static String getNodePropertyName(String name)
          Return the converted repository property name
static javax.jcr.Value getNodePropertyValue(javax.jcr.ValueFactory valueFactory, Object eventValue)
          Return the converted repository property value
static Dictionary<String,Object> readEventProperties(javax.jcr.Node node, ClassLoader objectClassLoader, boolean forceLoad)
          Read event properties from a repository node and create a property map (dictionary).
static void writeEventProperties(javax.jcr.Node node, org.osgi.service.event.Event event)
          Add all java properties as properties to the node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVENT_PREFIX

public static final String EVENT_PREFIX
The namespace prefix.

See Also:
Constant Field Values

NODE_PROPERTY_TOPIC

public static final String NODE_PROPERTY_TOPIC
See Also:
Constant Field Values

NODE_PROPERTY_APPLICATION

public static final String NODE_PROPERTY_APPLICATION
See Also:
Constant Field Values

NODE_PROPERTY_CREATED

public static final String NODE_PROPERTY_CREATED
See Also:
Constant Field Values

NODE_PROPERTY_PROPERTIES

public static final String NODE_PROPERTY_PROPERTIES
See Also:
Constant Field Values

NODE_PROPERTY_PROCESSOR

public static final String NODE_PROPERTY_PROCESSOR
See Also:
Constant Field Values

NODE_PROPERTY_JOBID

public static final String NODE_PROPERTY_JOBID
See Also:
Constant Field Values

NODE_PROPERTY_FINISHED

public static final String NODE_PROPERTY_FINISHED
See Also:
Constant Field Values

NODE_PROPERTY_TE_EXPRESSION

public static final String NODE_PROPERTY_TE_EXPRESSION
See Also:
Constant Field Values

NODE_PROPERTY_TE_DATE

public static final String NODE_PROPERTY_TE_DATE
See Also:
Constant Field Values

NODE_PROPERTY_TE_PERIOD

public static final String NODE_PROPERTY_TE_PERIOD
See Also:
Constant Field Values

EVENT_NODE_TYPE

public static final String EVENT_NODE_TYPE
See Also:
Constant Field Values

JOB_NODE_TYPE

public static final String JOB_NODE_TYPE
See Also:
Constant Field Values

TIMED_EVENT_NODE_TYPE

public static final String TIMED_EVENT_NODE_TYPE
See Also:
Constant Field Values

NODETYPE_FOLDER

public static final String NODETYPE_FOLDER
The nodetype for newly created intermediate folders

See Also:
Constant Field Values

NODETYPE_ORDERED_FOLDER

public static final String NODETYPE_ORDERED_FOLDER
The nodetype for newly created folders

See Also:
Constant Field Values

NODE_PROPERTY_LOCK_OWNER

public static final String NODE_PROPERTY_LOCK_OWNER
The property for locks.

See Also:
Constant Field Values
Constructor Detail

JCRHelper

public JCRHelper()
Method Detail

writeEventProperties

public static void writeEventProperties(javax.jcr.Node node,
                                        org.osgi.service.event.Event event)
                                 throws javax.jcr.RepositoryException
Add all java properties as properties to the node. If the name and the value of a map entry can easily converted into a repository property, it is directly added. All other java properties are stored in one binary property.

Parameters:
node - The node where all properties are added to
event - The event.
Throws:
javax.jcr.RepositoryException

readEventProperties

public static Dictionary<String,Object> readEventProperties(javax.jcr.Node node,
                                                            ClassLoader objectClassLoader,
                                                            boolean forceLoad)
                                                     throws javax.jcr.RepositoryException,
                                                            ClassNotFoundException
Read event properties from a repository node and create a property map (dictionary). As the properties might contain serialized java objects, a class loader can be specified for loading classes of the serialized java objects.

Throws:
javax.jcr.RepositoryException
ClassNotFoundException

getNodePropertyName

public static String getNodePropertyName(String name)
Return the converted repository property name

Parameters:
name - The java object property name
Returns:
The converted name or null if not possible.

getNodePropertyValue

public static javax.jcr.Value getNodePropertyValue(javax.jcr.ValueFactory valueFactory,
                                                   Object eventValue)
Return the converted repository property value

Parameters:
valueFactory - The value factory
eventValue - The event value
Returns:
The converted value or null if not possible


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.