/** * @see PartitionNexus#getSuffix(org.apache.directory.shared.ldap.name.LdapDN) */ public LdapDN getSuffix ( LdapDN dn ) throws NamingException { Partition backend = getBackend( dn ); return backend.getSuffix(); }
private Partition getPartition(String partitionSuffix) { Set availablePartitions = this.directoryService.getPartitions(); Partition partition; for (Object object : availablePartitions) { partition = (Partition) object; if (partition.getSuffix().equals(partitionSuffix)) { return partition; } } return null; }
/** * Unregisters an ContextPartition with this BackendManager. Called for each * registered Backend right befor it is to be stopped. This prevents * protocol server requests from reaching the Backend and effectively puts * the ContextPartition's naming context offline. * * Operations against the naming context should result in an LDAP BUSY * result code in the returnValue if the naming context is not online. * * @param partition ContextPartition component to unregister with this * BackendNexus. */ private void unregister( Partition partition ) throws NamingException { Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR ); namingContexts.remove( partition.getSuffix().toString() ); partitions.remove( partition.getSuffix().toString() ); }
@Override public void removeAllPartitions() throws DirectoryServerException { Set<? extends Partition> partitions = this.directoryService.getPartitions(); for (Partition partition : partitions) { if (!"schema".equalsIgnoreCase(partition.getId())) { try { if (logger.isDebugEnabled()) { logger.debug("Removing partition with id - " + partition.getId() + " suffix - " + partition.getSuffix()); } this.directoryService.removePartition(partition); } catch (Exception e) { String msg = "Unable to remove partition with id " + partition.getId() + " with suffix " + partition.getSuffix(); logger.error(msg, e); throw new DirectoryServerException(msg, e); } } } }
public synchronized void addContextPartition( PartitionConfiguration config ) throws NamingException { Partition partition = config.getContextPartition(); // Turn on default indices String key = config.getSuffix(); if ( partitions.containsKey( key ) ) { throw new ConfigurationException( "Duplicate partition suffix: " + key ); } partition.init( factoryCfg, config ); partitions.put( partition.getSuffix().toString(), partition ); Attribute namingContexts = rootDSE.get( NAMINGCTXS_ATTR ); namingContexts.add( partition.getUpSuffix().toString() ); }
system.init( factoryCfg, systemCfg ); systemCfg.setContextPartition( system ); String key = system.getSuffix().toString(); if ( partitions.containsKey( key ) )
public void addContextPartition( NextInterceptor next, PartitionConfiguration cfg ) throws NamingException { next.addContextPartition( cfg ); // add referrals immediately after adding the new partition Partition partition = cfg.getContextPartition(); LdapDN suffix = partition.getSuffix(); Invocation invocation = InvocationStack.getInstance().peek(); NamingEnumeration list = invocation.getProxy().search( suffix, env, getReferralFilter(), getControls(), SEARCH_BYPASS ); addReferrals( list, suffix ); }