/** * Register the listeners for each existing consumers */ private void registerPersistentSearches() throws Exception { for ( Map.Entry<Integer, ReplicaEventLog> e : replicaLogMap.entrySet() ) { ReplicaEventLog log = e.getValue(); if ( log.getSearchCriteria() != null ) { PROVIDER_LOG.debug( "registering persistent search for the replica {}", log.getId() ); SyncReplSearchListener handler = new SyncReplSearchListener( null, null, log, false ); log.setPersistentListener( handler ); dirService.getEventService().addListener( handler, log.getSearchCriteria() ); } else { PROVIDER_LOG.warn( "invalid persistent search criteria {} for the replica {}", log.getSearchCriteria(), log .getId() ); } } }
public void removeNamingListener( NamingListener namingListener ) throws NamingException { try { DirectoryListener listener = listeners.remove( namingListener ); if ( listener != null ) { service.getEventService().removeListener( listener ); } } catch ( Exception e ) { JndiUtils.wrap( e ); } }
dirService.getEventService().addListener( replicationListener, criteria ); dirService.getEventService().removeListener( replicationListener );
criteria.setEventMask( EventType.DELETE ); dirService.getEventService().addListener( cledListener, criteria );
/** * @see javax.naming.Context#close() */ public void close() throws NamingException { for ( DirectoryListener listener : listeners.values() ) { try { service.getEventService().removeListener( listener ); } catch ( Exception e ) { JndiUtils.wrap( e ); } } listeners.clear(); }
public void addNamingListener( Name name, int scope, NamingListener namingListener ) throws NamingException { ExprNode filter = new PresenceNode( objectClassAT ); try { DirectoryListener listener = new EventListenerAdapter( ( ServerLdapContext ) this, namingListener ); NotificationCriteria criteria = new NotificationCriteria( schemaManager ); criteria.setFilter( filter ); criteria.setScope( SearchScope.getSearchScope( scope ) ); criteria.setAliasDerefMode( AliasDerefMode.getEnum( env ) ); criteria.setBase( buildTarget( JndiUtils.fromName( name ) ) ); service.getEventService().addListener( listener, criteria ); listeners.put( namingListener, listener ); } catch ( Exception e ) { JndiUtils.wrap( e ); } }
public void requestAbandoned( AbandonableRequest req ) { if ( listener != null ) { ldapServer.getDirectoryService().getEventService().removeListener( listener ); } } }
criteria.setScope( SearchScope.SUBTREE ); directoryService.getEventService().addListener( configListener, criteria );
public synchronized void removeEventLog( ReplicaEventLog replicaEventLog ) { directoryService.getEventService().removeListener( replicaEventLog.getPersistentListener() ); String name = replicaEventLog.getName(); LOG.debug( "removed the persistent listener for replication event log {}", name ); replicaLogMap.remove( replicaEventLog.getId() ); try { replicaEventLog.stop(); new File( directoryService.getInstanceLayout().getReplDirectory(), name + ".db" ).delete(); new File( directoryService.getInstanceLayout().getReplDirectory(), name + ".lg" ).delete(); LOG.info( "successfully removed replication event log {}", name ); } catch ( Exception e ) { LOG.warn( "Closing the replication event log of the entry {} was not successful, will be removed anyway", name, e ); } }
public void addNamingListener( Name name, String filterStr, SearchControls searchControls, NamingListener namingListener ) throws NamingException { ExprNode filter; try { filter = FilterParser.parse( schemaManager, filterStr ); } catch ( Exception e ) { NamingException e2 = new NamingException( I18n.err( I18n.ERR_501, filterStr ) ); e2.setRootCause( e ); throw e2; } try { DirectoryListener listener = new EventListenerAdapter( ( ServerLdapContext ) this, namingListener ); NotificationCriteria criteria = new NotificationCriteria( schemaManager ); criteria.setFilter( filter ); criteria.setScope( SearchScope.getSearchScope( searchControls.getSearchScope() ) ); criteria.setAliasDerefMode( AliasDerefMode.getEnum( getEnvironment() ) ); criteria.setBase( buildTarget( JndiUtils.fromName( name ) ) ); getDirectoryService().getEventService().addListener( listener, criteria ); getListeners().put( namingListener, listener ); } catch ( Exception e ) { JndiUtils.wrap( e ); } }
public void abandon() throws LdapException { // must abandon the operation session.getCoreSession().getDirectoryService().getEventService().removeListener( this ); /* * From RFC 2251 Section 4.11: * * In the event that a server receives an Abandon Request on a Search * operation in the midst of transmitting responses to the Search, that * server MUST cease transmitting entry responses to the abandoned * request immediately, and MUST NOT send the SearchResultDone. Of * course, the server MUST ensure that only properly encoded LDAPMessage * PDUs are transmitted. * * SO DON'T SEND BACK ANYTHING!!!!! */ }
criteria.setScope( req.getScope() ); criteria.setEventMask( EventType.getEventTypes( psearch.getChangeTypes() ) ); getLdapServer().getDirectoryService().getEventService().addListener( persistentSearchListener, criteria ); req.addAbandonListener( new SearchAbandonListener( ldapServer, persistentSearchListener ) );
evtSrv.removeListener( cledListener ); evtSrv.removeListener( log.getPersistentListener() ); log.stop();
session.getCoreSession().getDirectoryService().getEventService().removeListener( this );