本文整理汇总了Java中javax.naming.event.NamingEvent类的典型用法代码示例。如果您正苦于以下问题:Java NamingEvent类的具体用法?Java NamingEvent怎么用?Java NamingEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NamingEvent类属于javax.naming.event包,在下文中一共展示了NamingEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: objectAdded
import javax.naming.event.NamingEvent; //导入依赖的package包/类
/**
* Handler for new policy entries in the directory.
*
* @param namingEvent the new entry event that occurred
*/
public void objectAdded(NamingEvent namingEvent) {
Map<String, Set<Role>> newRoles = new HashMap<>();
try {
processSearchResult(newRoles, (SearchResult) namingEvent.getNewBinding());
for (Map.Entry<String, Set<Role>> entry : newRoles.entrySet()) {
Set<Role> existingRoles = securityRepository.getMatch(entry.getKey());
for (Role role : entry.getValue()) {
existingRoles.add(role);
}
}
} catch (NamingException e) {
ActiveMQServerLogger.LOGGER.failedToProcessEvent(e);
}
}
示例2: getJNDIChangeType
import javax.naming.event.NamingEvent; //导入依赖的package包/类
/**
* get JNDI defined change type value which is different with
* <code>getChangeType()</code>
*
* @return JNDI defined change type value
*/
public int getJNDIChangeType() {
switch (changeType) {
case ADD:
return NamingEvent.OBJECT_ADDED;
case DELETE:
return NamingEvent.OBJECT_REMOVED;
case MODIFY:
return NamingEvent.OBJECT_CHANGED;
case MODIFY_DN:
return NamingEvent.OBJECT_RENAMED;
default:
// never reach
return -1;
}
}
示例3: objectRemoved
import javax.naming.event.NamingEvent; //导入依赖的package包/类
@Override
public void objectRemoved(NamingEvent evt) {
final String jndiName = evt.getOldBinding().getName();
LOG.factoryUnboundFromName( jndiName );
final String uuid = nameUuidXref.remove( jndiName );
if ( uuid == null ) {
// serious problem... but not sure what to do yet
}
sessionFactoryMap.remove( uuid );
}
示例4: objectRenamed
import javax.naming.event.NamingEvent; //导入依赖的package包/类
@Override
public void objectRenamed(NamingEvent evt) {
final String oldJndiName = evt.getOldBinding().getName();
final String newJndiName = evt.getNewBinding().getName();
LOG.factoryJndiRename( oldJndiName, newJndiName );
final String uuid = nameUuidXref.remove( oldJndiName );
nameUuidXref.put( newJndiName, uuid );
}
示例5: objectRemoved
import javax.naming.event.NamingEvent; //导入依赖的package包/类
public void objectRemoved(NamingEvent evt) {
String name = evt.getOldBinding().getName();
log.info("A factory was unbound from name: " + name);
Object instance = NAMED_INSTANCES.remove(name);
Iterator iter = INSTANCES.values().iterator();
while ( iter.hasNext() ) {
if ( iter.next()==instance ) iter.remove();
}
}
示例6: objectAdded
import javax.naming.event.NamingEvent; //导入依赖的package包/类
@Override
public void objectAdded(NamingEvent evt) {
// This test is a hack to work around the fact that Apache DS 2.0 seems to trigger notifications
// for the entire sub-tree even when one-level is the selected search scope.
if (permissionType != null) {
SimpleCachedLDAPAuthorizationMap.this.objectAdded(evt, destinationType, permissionType);
}
}
示例7: objectRemoved
import javax.naming.event.NamingEvent; //导入依赖的package包/类
@Override
public void objectRemoved(NamingEvent evt) {
// This test is a hack to work around the fact that Apache DS 2.0 seems to trigger notifications
// for the entire sub-tree even when one-level is the selected search scope.
if (permissionType != null) {
SimpleCachedLDAPAuthorizationMap.this.objectRemoved(evt, destinationType, permissionType);
}
}
示例8: objectChanged
import javax.naming.event.NamingEvent; //导入依赖的package包/类
@Override
public void objectChanged(NamingEvent evt) {
// This test is a hack to work around the fact that Apache DS 2.0 seems to trigger notifications
// for the entire sub-tree even when one-level is the selected search scope.
if (permissionType != null) {
SimpleCachedLDAPAuthorizationMap.this.objectChanged(evt, destinationType, permissionType);
}
}
示例9: objectAdded
import javax.naming.event.NamingEvent; //导入依赖的package包/类
/**
* invoked when an entry has been added during a persistent search
*/
public void objectAdded(NamingEvent event) {
LOG.debug("entry added");
try {
addConnector((SearchResult) event.getNewBinding());
} catch (Exception err) {
LOG.error("ERR: caught unexpected exception", err);
}
}
示例10: objectRemoved
import javax.naming.event.NamingEvent; //导入依赖的package包/类
/**
* invoked when an entry has been removed during a persistent search
*/
public void objectRemoved(NamingEvent event) {
LOG.debug("entry removed");
try {
removeConnector((SearchResult) event.getOldBinding());
} catch (Exception err) {
LOG.error("ERR: caught unexpected exception", err);
}
}
示例11: objectRenamed
import javax.naming.event.NamingEvent; //导入依赖的package包/类
/**
* invoked when an entry has been renamed during a persistent search
*/
public void objectRenamed(NamingEvent event) {
LOG.debug("entry renamed");
// XXX: getNameInNamespace method does not seem to work properly,
// but getName seems to provide the result we want
String uuidOld = event.getOldBinding().getName();
String uuidNew = event.getNewBinding().getName();
URI connectorURI = uuidMap.remove(uuidOld);
uuidMap.put(uuidNew, connectorURI);
LOG.debug("connector reference renamed for URI [{}], Old UUID [{}], New UUID [{}]", new Object[]{ connectorURI, uuidOld, uuidNew });
}
示例12: objectChanged
import javax.naming.event.NamingEvent; //导入依赖的package包/类
/**
* invoked when an entry has been changed during a persistent search
*/
public void objectChanged(NamingEvent event) {
LOG.debug("entry changed");
try {
SearchResult result = (SearchResult) event.getNewBinding();
removeConnector(result);
addConnector(result);
} catch (Exception err) {
LOG.error("ERR: caught unexpected exception", err);
}
}
示例13: testConstructorAndGetters_Null_EventContext
import javax.naming.event.NamingEvent; //导入依赖的package包/类
public void testConstructorAndGetters_Null_EventContext() {
log.setMethod("testConstructorAndGetters_Null_EventContext()");
try {
new NamingEvent(null, NamingEvent.OBJECT_CHANGED, binding1, binding2, "anything");
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException e) {
}
}
示例14: rebind
import javax.naming.event.NamingEvent; //导入依赖的package包/类
public void rebind(String name, Object obj, Attributes attrs)
throws NamingException {
Binding bind = new Binding(name, obj);
attributes.put(name, attrs);
fire(name, NamingEvent.OBJECT_CHANGED, bind, (Binding) bindings.put(
name, bind), null);
}
示例15: rename
import javax.naming.event.NamingEvent; //导入依赖的package包/类
public void rename(String name1, String name2) throws NamingException {
Binding old = (Binding) bindings.remove(name1);
if (old == null) {
throw new NameNotFoundException(name1);
}
Binding newBd = new Binding(name2, old.getObject());
bindings.put(name2, newBd);
fire(name1, NamingEvent.OBJECT_RENAMED, newBd, old, null);
}