Package org.apache.directory.shared.ldap.entry.client

Examples of org.apache.directory.shared.ldap.entry.client.ClientModification


    }


    public void addModification( EntryAttribute attr, ModificationOperation modOp )
    {
        mods.add( new ClientModification( modOp, attr ) );
    }
View Full Code Here


        CoreSession session = service.getAdminSession();
       
        try
        {
            EntryAttribute attr = new DefaultClientAttribute( "Description", "this is a test" );
            Modification mod = new ClientModification(
                ModificationOperation.ADD_ATTRIBUTE, attr );
            List<Modification> mods = new ArrayList<Modification>();
           
            mods.add( mod );
           
View Full Code Here

        CoreSession session = service.getAdminSession();
       
        try
        {
            EntryAttribute attr = new DefaultClientAttribute( "Description", "this is a test" );
            Modification mod = new ClientModification(
                ModificationOperation.ADD_ATTRIBUTE, attr );
            List<Modification> mods = new ArrayList<Modification>();
           
            mods.add( mod );
           
View Full Code Here

        CoreSession session = service.getAdminSession();
       
        try
        {
            EntryAttribute attr = new DefaultClientAttribute( "Description", "this is a test" );
            Modification mod = new ClientModification(
                ModificationOperation.ADD_ATTRIBUTE, attr );
            List<Modification> mods = new ArrayList<Modification>();
           
            mods.add( mod );
           
View Full Code Here

    public void testModifyExistingEntryReferralCoreAPIManageDsaIT() throws Exception
    {
        CoreSession session = service.getAdminSession();
       
        EntryAttribute attr = new DefaultClientAttribute( "Description", "This is a description" );
        Modification mod = new ClientModification(
            ModificationOperation.ADD_ATTRIBUTE, attr );
        List<Modification> mods = new ArrayList<Modification>();
       
        mods.add( mod );
       
View Full Code Here

    @Test
    public void testCopyClientModification()
    {
        EntryAttribute attribute = new DefaultClientAttribute( atC.getName() );
        attribute.add( "test1", "test2" );
        Modification clientModification = new ClientModification( ModificationOperation.ADD_ATTRIBUTE, attribute );
       
        Modification copy = new ServerModification( schemaManager, clientModification );
       
        assertTrue( copy instanceof ServerModification );
        assertFalse( copy instanceof ClientModification );
        assertFalse( copy.equalsclientModification ) );
        assertTrue( copy.getAttribute() instanceof EntryAttribute );
        assertEquals( atC, copy.getAttribute().getAttributeType() );
        assertEquals( ModificationOperation.ADD_ATTRIBUTE, copy.getOperation() );
        assertTrue( copy.getAttribute().contains( "test1", "test2" ) );
       
        clientModification.setOperation( ModificationOperation.REMOVE_ATTRIBUTE );
        assertEquals( ModificationOperation.ADD_ATTRIBUTE, copy.getOperation() );
       
        EntryAttribute attribute2 = new DefaultClientAttribute( "cn", "t" );
        clientModification.setAttribute( attribute2 );
        assertNotSame( attribute2, copy.getAttribute() );
    }
View Full Code Here

        generator.initialize( KEY_SIZE );
        KeyPair keypair = generator.genKeyPair();

        // Generate the private key attributes
        PrivateKey privateKey = keypair.getPrivate();
        modifications.add( new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultClientAttribute(
            PRIVATE_KEY_AT, privateKey.getEncoded() ) ) );
        modifications.add( new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultClientAttribute(
            PRIVATE_KEY_FORMAT_AT, privateKey.getFormat() ) ) );

        // Generate public key
        PublicKey publicKey = keypair.getPublic();
        modifications.add( new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultClientAttribute(
            PUBLIC_KEY_AT, publicKey.getEncoded() ) ) );
        modifications.add( new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultClientAttribute(
            PUBLIC_KEY_FORMAT_AT, publicKey.getFormat() ) ) );

        // Generate the self-signed certificate
        BigInteger serialNumber = BigInteger.valueOf( System.currentTimeMillis() );
        X509V1CertificateGenerator certGen = new X509V1CertificateGenerator();
        X500Principal issuerName = new X500Principal( issuerDN );
        X500Principal subjectName = new X500Principal( subjectDN );
        certGen.setSerialNumber( serialNumber );
        certGen.setIssuerDN( issuerName );
        certGen.setNotBefore( startDate );
        certGen.setNotAfter( expiryDate );
        certGen.setSubjectDN( subjectName );
        certGen.setPublicKey( publicKey );
        certGen.setSignatureAlgorithm( "SHA1With" + keyAlgo );
        X509Certificate cert = certGen.generate( privateKey, "BC" );
        modifications.add( new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE, new DefaultClientAttribute(
            USER_CERTIFICATE_AT, cert.getEncoded() ) ) );

        // Write the modifications
        ldapServer.getDirectoryService().getAdminSession().modify( dn, modifications );
       
View Full Code Here

        CoreSession session = service.getAdminSession();
       
        try
        {
            ClientAttribute attr = new DefaultClientAttribute( "Description", "this is a test" );
            Modification mod = new ClientModification(
                ModificationOperation.ADD_ATTRIBUTE, attr );
            List<Modification> mods = new ArrayList<Modification>();
           
            mods.add( mod );
           
View Full Code Here

        CoreSession session = service.getAdminSession();
       
        try
        {
            ClientAttribute attr = new DefaultClientAttribute( "Description", "this is a test" );
            Modification mod = new ClientModification(
                ModificationOperation.ADD_ATTRIBUTE, attr );
            List<Modification> mods = new ArrayList<Modification>();
           
            mods.add( mod );
           
View Full Code Here

        CoreSession session = service.getAdminSession();
       
        try
        {
            ClientAttribute attr = new DefaultClientAttribute( "Description", "this is a test" );
            Modification mod = new ClientModification(
                ModificationOperation.ADD_ATTRIBUTE, attr );
            List<Modification> mods = new ArrayList<Modification>();
           
            mods.add( mod );
           
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.entry.client.ClientModification

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.