Java 类javax.naming.event.NamingEvent 实例源码

项目:activemq-artemis    文件:LegacyLDAPSecuritySettingPlugin.java   
/**
 * 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);
   }
}
项目:cn1    文件:ECNotificationControl.java   
/**
 * 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;
    }

}
项目:nextop-client    文件:ECNotificationControl.java   
/**
 * 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;
    }

}
项目:freeVM    文件:ECNotificationControl.java   
/**
 * 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;
    }

}
项目:lams    文件:SessionFactoryRegistry.java   
@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 );
}
项目:lams    文件:SessionFactoryRegistry.java   
@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 );
}
项目:parabuild-ci    文件:SessionFactoryObjectFactory.java   
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();
    }
}
项目:cacheonix-core    文件:SessionFactoryObjectFactory.java   
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();
    }
}
项目:daq-eclipse    文件:SimpleCachedLDAPAuthorizationMap.java   
@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);
    }
}
项目:daq-eclipse    文件:SimpleCachedLDAPAuthorizationMap.java   
@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);
    }
}
项目:daq-eclipse    文件:SimpleCachedLDAPAuthorizationMap.java   
@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);
    }
}
项目:daq-eclipse    文件:LdapNetworkConnector.java   
/**
 * 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);
    }
}
项目:daq-eclipse    文件:LdapNetworkConnector.java   
/**
 * 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);
    }
}
项目:daq-eclipse    文件:LdapNetworkConnector.java   
/**
 * 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 });
}
项目:daq-eclipse    文件:LdapNetworkConnector.java   
/**
 * 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);
    }
}
项目:cn1    文件:NamingEventTest.java   
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) {
    }
}
项目:freeVM    文件:NamingEventTest.java   
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) {
    }
}
项目:freeVM    文件:NamingEventTest.java   
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) {
    }
}
项目:freeVM    文件:EventDirCtx.java   
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);
}
项目:freeVM    文件:EventDirCtx.java   
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);
}
项目:freeVM    文件:EventDirCtx.java   
/**
 * @param name
 * @param type
 * @param newBd
 * @param oldBd
 * @param changeInfo
 */
private void fire(String name, int type, Binding newBd, Binding oldBd,
    Object changeInfo) {

    NamingEvent e = new NamingEvent(this, type, newBd, oldBd, changeInfo);
    List l = getListeners(name);
    for (int i = 0; i < l.size(); i++) {
        e.dispatch((NamingListener) l.get(i));
    }
}
项目:incubator-netbeans    文件:WeakListenerTest.java   
public void objectChanged(NamingEvent evt) {
    cnt++;
}
项目:lams    文件:SessionFactoryRegistry.java   
@Override
public void objectAdded(NamingEvent evt) {
    LOG.debugf("A factory was successfully bound to name: %s", evt.getNewBinding().getName());
}
项目:parabuild-ci    文件:SessionFactoryObjectFactory.java   
public void objectAdded(NamingEvent evt) {
    log.debug( "A factory was successfully bound to name: " + evt.getNewBinding().getName() );
}
项目:parabuild-ci    文件:SessionFactoryObjectFactory.java   
public void objectRenamed(NamingEvent evt) {
    String name = evt.getOldBinding().getName();
    log.info("A factory was renamed from name: " + name);
    NAMED_INSTANCES.put( evt.getNewBinding().getName(), NAMED_INSTANCES.remove(name) );
}
项目:openjdk-jdk10    文件:RemoveNamingListenerTest.java   
@Override
public void objectChanged(NamingEvent ne) {
    //do nothing
}
项目:cacheonix-core    文件:SessionFactoryObjectFactory.java   
public void objectAdded(NamingEvent evt) {
    log.debug( "A factory was successfully bound to name: " + evt.getNewBinding().getName() );
}
项目:cacheonix-core    文件:SessionFactoryObjectFactory.java   
public void objectRenamed(NamingEvent evt) {
    String name = evt.getOldBinding().getName();
    log.info("A factory was renamed from name: " + name);
    NAMED_INSTANCES.put( evt.getNewBinding().getName(), NAMED_INSTANCES.remove(name) );
}
项目:daq-eclipse    文件:SimpleCachedLDAPAuthorizationMap.java   
@Override
public void objectRenamed(NamingEvent evt) {
    SimpleCachedLDAPAuthorizationMap.this.objectRenamed(evt, destinationType, permissionType);
}
项目:activemq-artemis    文件:LegacyLDAPSecuritySettingPlugin.java   
@Override
public void objectAdded(NamingEvent evt) {
   LegacyLDAPSecuritySettingPlugin.this.objectAdded(evt);
}
项目:activemq-artemis    文件:LegacyLDAPSecuritySettingPlugin.java   
@Override
public void objectRemoved(NamingEvent evt) {
   LegacyLDAPSecuritySettingPlugin.this.objectRemoved(evt);
}
项目:activemq-artemis    文件:LegacyLDAPSecuritySettingPlugin.java   
@Override
public void objectRenamed(NamingEvent evt) {
   LegacyLDAPSecuritySettingPlugin.this.objectRenamed(evt);
}
项目:activemq-artemis    文件:LegacyLDAPSecuritySettingPlugin.java   
@Override
public void objectChanged(NamingEvent evt) {
   LegacyLDAPSecuritySettingPlugin.this.objectChanged(evt);
}
项目:cn1    文件:NamingEventTest.java   
public void testConstructorAndGetters_Null_Type() {
    log.setMethod("testConstructorAndGetters_Null_Type()");
    NamingEvent event = new NamingEvent(eventctx, -1, binding1, binding2, "anything");
    assertEquals(-1, event.getType());
}
项目:cn1    文件:NamingEventTest.java   
public TestEmptyListener(NamingEvent expectedEvent) {
    this.expectedEvent = expectedEvent;
}
项目:cn1    文件:NamingEventTest.java   
public TestAllListener(NamingEvent expectedEvent) {
    super(expectedEvent);
}
项目:cn1    文件:NamingEventTest.java   
public void objectAdded(NamingEvent namingevent) {
    assertTrue(expectedEvent == namingevent);
}
项目:cn1    文件:NamingEventTest.java   
public void objectRemoved(NamingEvent namingevent) {
    assertTrue(expectedEvent == namingevent);
}
项目:cn1    文件:NamingEventTest.java   
public void objectRenamed(NamingEvent namingevent) {
    assertTrue(expectedEvent == namingevent);
}
项目:cn1    文件:NamingEventTest.java   
public void objectChanged(NamingEvent namingevent) {
    assertTrue(expectedEvent == namingevent);
}