|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.sling.event.impl.AbstractRepositoryEventHandler
@Service(value=org.osgi.service.event.EventHandler.class) public abstract class AbstractRepositoryEventHandler
Abstract base class for all event handlers in this package.
Nested Class Summary | |
---|---|
static class |
AbstractRepositoryEventHandler.EventInfo
|
Field Summary | |
---|---|
protected static String |
CONFIG_PROPERTY_REPO_PATH
|
protected EnvironmentComponent |
environment
Environment component. |
protected org.slf4j.Logger |
logger
Default log. |
protected java.util.concurrent.BlockingQueue<AbstractRepositoryEventHandler.EventInfo> |
queue
A local queue for serialising the event processing. |
protected String |
repositoryPath
The path in the repository. |
protected boolean |
running
Is the background task still running? |
protected Object |
writeLock
Sync lock |
protected java.util.concurrent.BlockingQueue<org.osgi.service.event.Event> |
writeQueue
A local queue for writing received events into the repository. |
protected javax.jcr.Session |
writerSession
The repository session to write into the repository. |
Constructor Summary | |
---|---|
AbstractRepositoryEventHandler()
|
Method Summary | |
---|---|
protected void |
activate(org.osgi.service.component.ComponentContext context)
Activate this component. |
protected void |
addEventProperties(javax.jcr.Node eventNode,
Dictionary<String,Object> properties)
Add properties from the node to the event properties. |
protected void |
addNodeProperties(javax.jcr.Node eventNode,
org.osgi.service.event.Event event)
Add properties when storing event in repository. |
protected void |
deactivate(org.osgi.service.component.ComponentContext context)
Deactivate this component. |
protected String |
getEventNodeType()
Return the node type for the event. |
protected javax.jcr.Node |
getWriterRootNode()
Get the root node from the writer session. |
protected void |
ignoreException(Exception e)
Helper method which just logs the exception in debug mode. |
protected abstract void |
processWriteQueue()
|
protected org.osgi.service.event.Event |
readEvent(javax.jcr.Node eventNode)
Read an event from the repository. |
protected abstract void |
runInBackground()
|
protected void |
startWriterSession()
Start the repository session and add this handler as an observer for new events created on other nodes. |
protected void |
stopWriterSession()
Stop the session. |
protected javax.jcr.Node |
writeEvent(org.osgi.service.event.Event e,
String suggestedName)
Write an event to the repository. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.osgi.service.event.EventHandler |
---|
handleEvent |
Methods inherited from interface javax.jcr.observation.EventListener |
---|
onEvent |
Field Detail |
---|
protected final org.slf4j.Logger logger
@Property(value="/sling/events") protected static final String CONFIG_PROPERTY_REPO_PATH
protected javax.jcr.Session writerSession
protected final Object writeLock
protected String repositoryPath
protected volatile boolean running
protected final java.util.concurrent.BlockingQueue<AbstractRepositoryEventHandler.EventInfo> queue
protected final java.util.concurrent.BlockingQueue<org.osgi.service.event.Event> writeQueue
@Reference protected EnvironmentComponent environment
Constructor Detail |
---|
public AbstractRepositoryEventHandler()
Method Detail |
---|
protected void activate(org.osgi.service.component.ComponentContext context)
context
- protected abstract void runInBackground() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected abstract void processWriteQueue()
protected void deactivate(org.osgi.service.component.ComponentContext context)
context
- protected void startWriterSession() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected void stopWriterSession()
protected String getEventNodeType()
protected javax.jcr.Node getWriterRootNode()
protected javax.jcr.Node writeEvent(org.osgi.service.event.Event e, String suggestedName) throws javax.jcr.RepositoryException
e
- The eventsuggestName
- A suggest name/path for the node.
javax.jcr.RepositoryException
protected org.osgi.service.event.Event readEvent(javax.jcr.Node eventNode) throws javax.jcr.RepositoryException, ClassNotFoundException
javax.jcr.RepositoryException
ClassNotFoundException
protected void addEventProperties(javax.jcr.Node eventNode, Dictionary<String,Object> properties) throws javax.jcr.RepositoryException
eventNode
- The repository node.properties
- The event properties.
javax.jcr.RepositoryException
protected void addNodeProperties(javax.jcr.Node eventNode, org.osgi.service.event.Event event) throws javax.jcr.RepositoryException
eventNode
- event
-
javax.jcr.RepositoryException
protected void ignoreException(Exception e)
e
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |