本文整理汇总了Java中javax.jcr.observation.ObservationManager类的典型用法代码示例。如果您正苦于以下问题:Java ObservationManager类的具体用法?Java ObservationManager怎么用?Java ObservationManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ObservationManager类属于javax.jcr.observation包,在下文中一共展示了ObservationManager类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deactivate
import javax.jcr.observation.ObservationManager; //导入依赖的package包/类
@Deactivate
public void deactivate(final Map<String, String> config) throws RepositoryException {
try {
final ObservationManager observationManager = observationSession.getWorkspace().getObservationManager();
if (observationManager != null) {
observationManager.removeEventListener(this);
}
} finally {
if (observationSession != null) {
observationSession.logout();
}
if (resolver != null) {
resolver.close();
}
}
}
示例2: deactivate
import javax.jcr.observation.ObservationManager; //导入依赖的package包/类
@Deactivate
public void deactivate(final Map<String, String> config) throws RepositoryException {
try {
// Get JCR ObservationManager from Workspace
final ObservationManager observationManager = observationSession.getWorkspace().getObservationManager();
if (observationManager != null) {
// Un-register event handler
observationManager.removeEventListener(this);
}
} finally {
// Good housekeeping; Close your JCR Session when you are done w them!
if (observationSession != null) {
observationSession.logout();
}
}
}
示例3: addListeners
import javax.jcr.observation.ObservationManager; //导入依赖的package包/类
/**
* Hook for adding listeners to the newly returned session. We have to treat exceptions manually and can't
* reply on the template.
* @param session JCR session
* @return the listened session
* @throws javax.jcr.RepositoryException
*/
private Session addListeners(Session session) throws RepositoryException {
if (getRepository() == null) {
throw new IllegalArgumentException("repository is required");
}
if (eventListeners != null && eventListeners.length > 0) {
if (!supportsObservation(getRepository())) {
throw new IllegalArgumentException("repository " + getRepositoryInfo() + " does NOT support Observation; remove Listener definitions");
}
Workspace ws = session.getWorkspace();
ObservationManager manager = ws.getObservationManager();
for (EventListenerDefinition eventListener : eventListeners) {
manager.addEventListener(eventListener.getListener(), eventListener.getEventTypes(), eventListener.getAbsPath(), eventListener.isDeep(), eventListener.getUuid(), eventListener.getNodeTypeName(), eventListener.isNoLocal());
}
}
return session;
}
示例4: addListeners
import javax.jcr.observation.ObservationManager; //导入依赖的package包/类
/**
* Hook for adding listeners to the newly returned session. We have to treat
* exceptions manually and can't reply on the template.
*
* @param session
* JCR session
* @return the listened session
* @throws javax.jcr.RepositoryException
*/
protected Session addListeners(Session session) throws RepositoryException {
if (eventListeners != null && eventListeners.length > 0) {
Workspace ws = session.getWorkspace();
ObservationManager manager = ws.getObservationManager();
LOG.debug("adding listeners "
+ Arrays.asList(eventListeners).toString()
+ " for session " + session);
for (int i = 0; i < eventListeners.length; i++) {
manager.addEventListener(eventListeners[i].getListener(),
eventListeners[i].getEventTypes(),
eventListeners[i].getAbsPath(),
eventListeners[i].isDeep(),
eventListeners[i].getUuid(),
eventListeners[i].getNodeTypeName(),
eventListeners[i].isNoLocal());
}
}
return session;
}
示例5: deactivate
import javax.jcr.observation.ObservationManager; //导入依赖的package包/类
@Deactivate
public void deactivate(final Map<String, String> config) throws RepositoryException {
final ObservationManager observationManager = observationSession.getWorkspace().getObservationManager();
if (observationManager != null) {
observationManager.removeEventListener(this);
}
}
示例6: activate
import javax.jcr.observation.ObservationManager; //导入依赖的package包/类
@Activate
public void activate(final Map<String, String> config) throws RepositoryException {
// Get the JCR Session to bind this Event Listener too
observationSession = repository.loginAdministrative(null);
// Get JCR ObservationManager from Workspace
final ObservationManager observationManager = observationSession.getWorkspace().getObservationManager();
// Register the JCR Listener
/** !! This is the KEY element where this listener is registered !! **/
observationManager.addEventListener(this, events, absPath, isDeep,
uuids, nodeTypes, noLocal);
}
示例7: getObservationManager
import javax.jcr.observation.ObservationManager; //导入依赖的package包/类
@Override
public ObservationManager getObservationManager() throws UnsupportedRepositoryOperationException, RepositoryException {
if (observationManager == null) {
observationManager = new ObservationManagerImpl();
}
return observationManager;
}
示例8: start
import javax.jcr.observation.ObservationManager; //导入依赖的package包/类
public void start() throws Exception{
this.ocm = ocmFactory.getOcm();
ObservationManager observationManager = ocm.getSession().getWorkspace().getObservationManager();
final String[] types = { "nt:unstructured" };
observationManager.addEventListener(listener, Event.ALL_TYPES, "/board", true, null, types, false);
logger.info("Observer Started - listener:" + listener.getClass().getName());
}
示例9: activate
import javax.jcr.observation.ObservationManager; //导入依赖的package包/类
@Activate
public void activate(final Map<String, String> config) throws RepositoryException {
observationSession = repository.loginAdministrative(null);
final ObservationManager observationManager = observationSession.getWorkspace().getObservationManager();
}
示例10: activate
import javax.jcr.observation.ObservationManager; //导入依赖的package包/类
@Activate
public void activate(final Map<String, String> config) throws RepositoryException, LoginException {
observationSession = repository.loginAdministrative(null);
final ObservationManager observationManager = observationSession.getWorkspace().getObservationManager();
resolver = resourceResolverFactory.getAdministrativeResourceResolver(null);
}
示例11: getObservationManager
import javax.jcr.observation.ObservationManager; //导入依赖的package包/类
public ObservationManager getObservationManager() throws UnsupportedRepositoryOperationException, RepositoryException {
return observationMngr;
}