nclistener.objectAdded( new NamingEvent( rec.getEventContext(), NamingEvent.OBJECT_CHANGED, oldBinding, newBinding, entry ) ); } else if ( listener instanceof ObjectChangeListener ) { ObjectChangeListener oclistener = ( ObjectChangeListener ) listener; Binding oldBinding = new Binding( oldName.toString(), entry, false ); Binding newBinding = new Binding( oldName.toString(), entry, false ); oclistener.objectChanged( new NamingEvent( rec.getEventContext(), NamingEvent.OBJECT_CHANGED, oldBinding, newBinding, entry ) ); } else { throw new IllegalStateException( "unrecognized event listener type: " + listener.getClass() );
nclistener.objectRenamed( new NamingEvent( rec.getEventContext(), NamingEvent.OBJECT_RENAMED, oldBinding, newBinding, entry ) );
    private void notifyOnNameChange( Name oldName, Name newName ) throws NamingException    {        Attributes entry = nexus.lookup( newName );        Set selecting = getSelectingSources( oldName, entry );        if ( selecting.isEmpty() )        {            return;        }        Iterator list = selecting.iterator();        while ( list.hasNext() )        {            EventSourceRecord rec = ( EventSourceRecord ) list.next();            NamingListener listener = rec.getNamingListener();            if ( listener instanceof NamespaceChangeListener )            {                NamespaceChangeListener nclistener = ( NamespaceChangeListener ) listener;                Binding oldBinding = new Binding( oldName.toString(), entry, false );                Binding newBinding = new Binding( oldName.toString(), entry, false );                nclistener.objectAdded( new NamingEvent( rec.getEventContext(),                        NamingEvent.OBJECT_CHANGED, oldBinding, newBinding, entry ) );            }            else if ( listener instanceof ObjectChangeListener )            {                ObjectChangeListener oclistener = ( ObjectChangeListener ) listener;                Binding oldBinding = new Binding( oldName.toString(), entry, false );                Binding newBinding = new Binding( oldName.toString(), entry, false );                oclistener.objectChanged( new NamingEvent( rec.getEventContext(),                        NamingEvent.OBJECT_CHANGED, oldBinding, newBinding, entry ) );            }            else            {                throw new IllegalStateException( "unrecognized event listener type: " + listener.getClass() );            }        }    }