/** * {@inheritDoc} */ public void modify( DN dn, List<Modification> mods, LogChange log ) throws Exception { if ( mods == null ) { return; } List<Modification> serverModifications = new ArrayList<Modification>( mods.size() ); for ( Modification mod:mods ) { serverModifications.add( new ServerModification( directoryService.getSchemaManager(), mod ) ); } ModifyOperationContext opContext = new ModifyOperationContext( this, dn, serverModifications ); opContext.setLogChange( log ); OperationManager operationManager = directoryService.getOperationManager(); operationManager.modify( opContext ); }
/** * {@inheritDoc} */ public void modify( DN dn, List<Modification> mods, boolean ignoreReferral, LogChange log ) throws Exception { if ( mods == null ) { return; } List<Modification> serverModifications = new ArrayList<Modification>( mods.size() ); for ( Modification mod:mods ) { serverModifications.add( new ServerModification( directoryService.getSchemaManager(), mod ) ); } ModifyOperationContext opContext = new ModifyOperationContext( this, dn, serverModifications ); setReferralHandling( opContext, ignoreReferral ); opContext.setLogChange( log ); OperationManager operationManager = directoryService.getOperationManager(); operationManager.modify( opContext ); }
/** * Inits the system partition. * * @throws Exception the exception */ private void initSystemPartition() throws Exception { // change the working apacheds to something that is unique // on the system and somewhere either under target apacheds // or somewhere in a temp area of the machine. // Inject the System Partition Partition systemPartition = partitionFactory.createPartition( "system", ServerDNConstants.SYSTEM_DN, PARTITION_CACHE_SIZE, new File(directoryService.getWorkingDirectory(), "system")); systemPartition.setSchemaManager(directoryService.getSchemaManager()); partitionFactory.addIndex(systemPartition, SchemaConstants.OBJECT_CLASS_AT, INDEX_CACHE_SIZE); directoryService.setSystemPartition(systemPartition); }
private AttributeType getAttributeType(String attributeName) throws DirectoryServerException { if (this.service != null) { SchemaManager schemaManager = this.service.getSchemaManager(); if (schemaManager != null) { AttributeTypeRegistry registry = schemaManager.getAttributeTypeRegistry();
public EntryFilteringCursor search( SearchOperationContext opContext ) throws Exception { MockCursor cursor = new MockCursor( count ); cursor.setSchemaManager( opContext.getSession().getDirectoryService().getSchemaManager() ); return new BaseEntryFilteringCursor( cursor, opContext ); }
partitionInfo.getPartitionId(), partitionInfo.getRootDN(), PARTITION_CACHE_SIZE, new File(this.workingDirectory, partitionInfo.getPartitionId())); existingPartition.setSchemaManager(directoryService.getSchemaManager());
partition.setId("apiman"); partition.setPartitionDir(partitionDirectory); partition.setSchemaManager(service.getSchemaManager()); partition.setSuffix("o=apiman"); service.addPartition(partition);
/** * Add a new partition to the server. * * @param partitionId The partition Id * @param partitionDn The partition DN * @return The newly added partition * @throws Exception If the partition can't be added */ private Partition addCrowdPartition(String partitionId, String partitionDn) throws Exception { // Create a new partition named 'foo'. CrowdPartition partition = new CrowdPartition(m_CrowdClient, m_emulateADmemberOf, m_includeNested); partition.setId(partitionId); partition.setSuffix(partitionDn); partition.setSchemaManager(service.getSchemaManager()); partition.initialize(); service.addPartition(partition); return partition; }//addCrowdPartition
public void importLdif(InputStream in) throws Exception { /** the context root for the rootDSE */ CoreSession rootDSE = service.getAdminSession(); for (LdifEntry ldifEntry : new LdifReader(in)) { DefaultServerEntry entry = new DefaultServerEntry(rootDSE.getDirectoryService().getSchemaManager(), ldifEntry.getEntry()); if (!rootDSE.exists(entry.getDn())) { rootDSE.add(entry); } } }
private static void injectEntry(LdifEntry entry) throws Exception { if (entry.isChangeAdd()) { service.getAdminSession().add( new DefaultServerEntry(service.getSchemaManager(), entry.getEntry())); } else if (entry.isChangeModify()) { service.getAdminSession().modify(entry.getDn(), entry.getModificationItems()); } else { String message = I18n.err(I18n.ERR_117, entry.getChangeType()); throw new NamingException(message); } }
@Test public void testInitLdap() { try { ldapServer.getDirectoryService().getSchemaManager().enable("nis"); } catch (Exception e) { e.printStackTrace(); } for (Partition partition : ldapServer.getDirectoryService().getPartitions()) { try { partition.initialize(); } catch (Exception e) { e.printStackTrace(); } } ldapServerWrap = ldapServer; } }
partition.setId("apiman"); partition.setPartitionDir(partitionDirectory); partition.setSchemaManager(service.getSchemaManager()); partition.setSuffix("o=apiman"); service.addPartition(partition);
private static void injectEntry(LdifEntry entry) throws Exception { if (entry.isChangeAdd()) { service.getAdminSession().add( new DefaultServerEntry(service.getSchemaManager(), entry.getEntry())); } else if (entry.isChangeModify()) { service.getAdminSession().modify(entry.getDn(), entry.getModificationItems()); } else { String message = I18n.err(I18n.ERR_117, entry.getChangeType()); throw new NamingException(message); } } }
AttributeType attributeType = directoryService.getSchemaManager().lookupAttributeTypeRegistry( oid );
SchemaManager schemaManager = ldapServer.getDirectoryService().getSchemaManager(); JdbmPartition jdbmPartition = new JdbmPartition(); jdbmPartition.setPartitionDir(new File("."));