本文整理汇总了Java中javax.jcr.observation.Event.PROPERTY_REMOVED属性的典型用法代码示例。如果您正苦于以下问题:Java Event.PROPERTY_REMOVED属性的具体用法?Java Event.PROPERTY_REMOVED怎么用?Java Event.PROPERTY_REMOVED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.jcr.observation.Event
的用法示例。
在下文中一共展示了Event.PROPERTY_REMOVED属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onEvent
public void onEvent(EventIterator eventIterator) {
try {
while (eventIterator.hasNext()) {
Event event = eventIterator.nextEvent();
int type = event.getType();
switch (type) {
case Event.PROPERTY_CHANGED:
changedProperties.add(event.getPath());
break;
case Event.PROPERTY_ADDED:
addedProperties.add(event.getPath());
break;
case Event.PROPERTY_REMOVED:
removedProperties.add(event.getPath());
break;
}
}
eventBundlesProcessed++;
} catch (RepositoryException e) {
fail(e.getMessage());
}
}
开发者ID:apache,项目名称:sling-org-apache-sling-launchpad-integration-tests,代码行数:22,代码来源:PostServletPrivilegesUpdateTest.java
示例2: activate
protected void activate(ComponentContext ctx) {
try {
session = repository.loginService("serviceUser", null);
observationManager = session.getWorkspace().getObservationManager();
String[] nodeTypes = {"cq:PageContent"};
int eventTypes = Event.PROPERTY_ADDED | Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED;
observationManager.addEventListener(this, eventTypes, "/content", true, null, nodeTypes, true);
log.info("Activated JCR event listener");
} catch (LoginException le) {
log.error("Error activating JCR event listener: {}", le.getMessage());
} catch (Exception e) {
log.error("Error activating JCR event listener", e);
}
}
示例3: onEvent
/**
* Trigger on event
*
* @param eventIterator The event iterator object
*/
@Override
public void onEvent(EventIterator eventIterator) {
ResourceResolver resourceResolver = null;
try {
Map<String, Object> authenticationInfo = new HashMap<String, Object>();
authenticationInfo.put(ResourceResolverFactory.SUBSERVICE, CONFIG_SERVICE);
resourceResolver = resourceResolverFactory.getServiceResourceResolver(authenticationInfo);
ComponentManager componentManager = resourceResolver.adaptTo(ComponentManager.class);
if (resourceResolver != null) {
while (eventIterator.hasNext()) {
Event event = eventIterator.nextEvent();
String path = event.getPath();
switch (event.getType()) {
case Event.PROPERTY_REMOVED:
case Event.NODE_REMOVED:
case Event.PROPERTY_CHANGED:
case Event.PROPERTY_ADDED:
path = path.substring(0, path.lastIndexOf('/'));
break;
case Event.NODE_MOVED:
path = event.getInfo().get("srcChildRelPath").toString();
break;
case Event.NODE_ADDED:
default:
}
Resource resource = resourceResolver.getResource(path);
if (resource != null) {
com.day.cq.wcm.api.components.Component component = ResourceUtils.findContainingComponent(resource);
if (component != null) {
configCache.clear();
}
}
}
}
} catch (Exception ew) {
LOG.error(ERROR, ew);
} finally {
if (resourceResolver != null)
resourceResolver.close();
}
}