当前位置: 首页>>代码示例>>Java>>正文


Java Workspace.getObservationManager方法代码示例

本文整理汇总了Java中javax.jcr.Workspace.getObservationManager方法的典型用法代码示例。如果您正苦于以下问题:Java Workspace.getObservationManager方法的具体用法?Java Workspace.getObservationManager怎么用?Java Workspace.getObservationManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.jcr.Workspace的用法示例。


在下文中一共展示了Workspace.getObservationManager方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addListeners

import javax.jcr.Workspace; //导入方法依赖的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;
}
 
开发者ID:dooApp,项目名称:jcromfx,代码行数:26,代码来源:SessionFactoryImpl.java

示例2: addListeners

import javax.jcr.Workspace; //导入方法依赖的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;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:31,代码来源:JcrSessionFactory.java


注:本文中的javax.jcr.Workspace.getObservationManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。