Java Code Examples for org.apache.directory.api.ldap.model.constants.SchemaConstants#OBJECT_CLASS_AT

The following examples show how to use org.apache.directory.api.ldap.model.constants.SchemaConstants#OBJECT_CLASS_AT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TriggerUtils.java    From directory-ldap-api with Apache License 2.0 6 votes vote down vote up
/**
 * Create the Trigger execution subentry
 * 
 * @param apCtx The administration point context
 * @param subentryCN The CN used by the suentry
 * @param subtreeSpec The subtree specification
 * @param prescriptiveTriggerSpec The prescriptive trigger specification
 * @throws NamingException If the operation failed
 */
public static void createTriggerExecutionSubentry(
    LdapContext apCtx,
    String subentryCN,
    String subtreeSpec,
    String prescriptiveTriggerSpec ) throws NamingException
{
    Attributes subentry = new BasicAttributes( SchemaConstants.CN_AT, subentryCN, true );
    Attribute objectClass = new BasicAttribute( SchemaConstants.OBJECT_CLASS_AT );
    subentry.put( objectClass );
    objectClass.add( SchemaConstants.TOP_OC );
    objectClass.add( SchemaConstants.SUBENTRY_OC );
    objectClass.add( SchemaConstants.TRIGGER_EXECUTION_SUBENTRY_OC );
    subentry.put( SchemaConstants.SUBTREE_SPECIFICATION_AT, subtreeSpec );
    subentry.put( SchemaConstants.PRESCRIPTIVE_TRIGGER_SPECIFICATION_AT, prescriptiveTriggerSpec );
    apCtx.createSubcontext( "cn=" + subentryCN, subentry );
}
 
Example 2
Source File: JavaStoredProcUtils.java    From directory-ldap-api with Apache License 2.0 5 votes vote down vote up
/**
 * Loads a Java class's stream data as a subcontext of an LdapContext given.
 *
 * @param ctx
 *           The parent context of the Java class entry to be loaded.
 * @param clazz
 *           Class to be loaded.
 * @throws NamingException
 *           If an error occurs during creating the subcontext.
 */
public static void loadStoredProcedureClass( LdapContext ctx, Class<?> clazz ) throws NamingException
{
    byte[] buf = getClassFileAsStream( clazz );
    String fullClassName = clazz.getName();

    Attributes attributes = new BasicAttributes( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, true );
    attributes.get( SchemaConstants.OBJECT_CLASS_AT ).add( "storedProcUnit" );
    attributes.get( SchemaConstants.OBJECT_CLASS_AT ).add( "javaStoredProcUnit" );
    attributes.put( "storedProcLangId", "Java" );
    attributes.put( "storedProcUnitName", fullClassName );
    attributes.put( "javaByteCode", buf );

    ctx.createSubcontext( "storedProcUnitName=" + fullClassName, attributes );
}