/** * 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); } }
/** * 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; } }
@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 ); }
@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 ); }
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(); } }
@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); } }
@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); } }
@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); } }
/** * 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); } }
/** * 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); } }
/** * 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 }); }
/** * 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); } }
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) { } }
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); }
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); }
/** * @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)); } }
public void objectChanged(NamingEvent evt) { cnt++; }
@Override public void objectAdded(NamingEvent evt) { LOG.debugf("A factory was successfully bound to name: %s", evt.getNewBinding().getName()); }
public void objectAdded(NamingEvent evt) { log.debug( "A factory was successfully bound to name: " + evt.getNewBinding().getName() ); }
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) ); }
@Override public void objectChanged(NamingEvent ne) { //do nothing }
@Override public void objectRenamed(NamingEvent evt) { SimpleCachedLDAPAuthorizationMap.this.objectRenamed(evt, destinationType, permissionType); }
@Override public void objectAdded(NamingEvent evt) { LegacyLDAPSecuritySettingPlugin.this.objectAdded(evt); }
@Override public void objectRemoved(NamingEvent evt) { LegacyLDAPSecuritySettingPlugin.this.objectRemoved(evt); }
@Override public void objectRenamed(NamingEvent evt) { LegacyLDAPSecuritySettingPlugin.this.objectRenamed(evt); }
@Override public void objectChanged(NamingEvent evt) { LegacyLDAPSecuritySettingPlugin.this.objectChanged(evt); }
public void testConstructorAndGetters_Null_Type() { log.setMethod("testConstructorAndGetters_Null_Type()"); NamingEvent event = new NamingEvent(eventctx, -1, binding1, binding2, "anything"); assertEquals(-1, event.getType()); }
public TestEmptyListener(NamingEvent expectedEvent) { this.expectedEvent = expectedEvent; }
public TestAllListener(NamingEvent expectedEvent) { super(expectedEvent); }
public void objectAdded(NamingEvent namingevent) { assertTrue(expectedEvent == namingevent); }
public void objectRemoved(NamingEvent namingevent) { assertTrue(expectedEvent == namingevent); }
public void objectRenamed(NamingEvent namingevent) { assertTrue(expectedEvent == namingevent); }
public void objectChanged(NamingEvent namingevent) { assertTrue(expectedEvent == namingevent); }