javax.naming.event.NamingEvent Java Examples

The following examples show how to use javax.naming.event.NamingEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Initializer.java    From sis with Apache License 2.0 6 votes vote down vote up
/**
 * Invoked when the data source associated to {@code "jdbc/SpatialMetadata"} changed.
 * This method clears the {@link Initializer#source}, unregisters this listener
 * and notifies other SIS modules.
 *
 * @param  event  ignored. Can be null.
 */
@Override
public void objectChanged(NamingEvent event) {
    try {
        synchronized (Initializer.class) {
            source = null;
            connected = false;
            Shutdown.unregister(this);
            context.removeNamingListener(this);
        }
    } catch (NamingException e) {
        /*
         * Not a fatal error since the listener may be unregistered anyway, or may be unregistered
         * automatically by other kinds of JNDI events. Even if the listener is not unregistered,
         * it will hurt to badly: the DataSource would only be fetched more often than necessary.
         */
        Logging.recoverableException(Logging.getLogger(Loggers.SYSTEM), Listener.class, "objectChanged", e);
    }
    for (Initializer init : DefaultFactories.createServiceLoader(Initializer.class)) {
        init.dataSourceChanged();
    }
}
 
Example #2
Source File: LegacyLDAPSecuritySettingPlugin.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
/**
 * Handler for new policy entries in the directory.
 *
 * @param namingEvent the new entry event that occurred
 */
public void objectAdded(NamingEvent namingEvent) {
   if (logger.isDebugEnabled()) {
      logger.debug("objectAdded:\n\told binding: " + namingEvent.getOldBinding() + "\n\tnew binding: " + namingEvent.getNewBinding());
   }
   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);
   }
}
 
Example #3
Source File: SessionFactoryObjectFactory.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
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();
	}
}
 
Example #4
Source File: LegacyLDAPSecuritySettingPlugin.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
/**
 * Handler for changed policy entries in the directory.
 *
 * @param namingEvent the changed entry event that occurred
 */
public void objectChanged(NamingEvent namingEvent) {
   if (logger.isDebugEnabled()) {
      logger.debug("objectChanged:\n\told binding: " + namingEvent.getOldBinding() + "\n\tnew binding: " + namingEvent.getNewBinding());
   }
   objectRemoved(namingEvent);
   objectAdded(namingEvent);
}
 
Example #5
Source File: SessionFactoryRegistry.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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 );
}
 
Example #6
Source File: SessionFactoryRegistry.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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 );
}
 
Example #7
Source File: SessionFactoryRegistry.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void objectAdded(NamingEvent evt) {
	LOG.debugf( "A factory was successfully bound to name: %s", evt.getNewBinding().getName() );
}
 
Example #8
Source File: RemoveNamingListenerTest.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void objectChanged(NamingEvent ne) {
    //do nothing
}
 
Example #9
Source File: SessionFactoryObjectFactory.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void objectAdded(NamingEvent evt) {
	log.debug( "A factory was successfully bound to name: " + evt.getNewBinding().getName() );
}
 
Example #10
Source File: RemoveNamingListenerTest.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void objectChanged(NamingEvent ne) {
    //do nothing
}
 
Example #11
Source File: SessionFactoryObjectFactory.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
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) );
}
 
Example #12
Source File: WeakListenerTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void objectChanged(NamingEvent evt) {
    cnt++;
}
 
Example #13
Source File: RemoveNamingListenerTest.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void objectChanged(NamingEvent ne) {
    //do nothing
}
 
Example #14
Source File: LegacyLDAPSecuritySettingPlugin.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
public void objectAdded(NamingEvent evt) {
   LegacyLDAPSecuritySettingPlugin.this.objectAdded(evt);
}
 
Example #15
Source File: LegacyLDAPSecuritySettingPlugin.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
public void objectRemoved(NamingEvent evt) {
   LegacyLDAPSecuritySettingPlugin.this.objectRemoved(evt);
}
 
Example #16
Source File: LegacyLDAPSecuritySettingPlugin.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
public void objectRenamed(NamingEvent evt) {
   LegacyLDAPSecuritySettingPlugin.this.objectRenamed(evt);
}
 
Example #17
Source File: LegacyLDAPSecuritySettingPlugin.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
@Override
public void objectChanged(NamingEvent evt) {
   LegacyLDAPSecuritySettingPlugin.this.objectChanged(evt);
}
 
Example #18
Source File: RemoveNamingListenerTest.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void objectChanged(NamingEvent ne) {
    //do nothing
}
 
Example #19
Source File: LegacyLDAPSecuritySettingPlugin.java    From activemq-artemis with Apache License 2.0 2 votes vote down vote up
/**
 * @param namingEvent the renaming entry event that occurred
 */
public void objectRenamed(NamingEvent namingEvent) {

}