org.apache.directory.api.ldap.codec.api.LdapApiServiceFactory Java Examples
The following examples show how to use
org.apache.directory.api.ldap.codec.api.LdapApiServiceFactory.
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: ApiLdapCodecCoreOsgiTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
@Test public void testLdapApiServiceFactoryIsInitializedByOsgi() { assertTrue( LdapApiServiceFactory.isInitialized() ); assertFalse( LdapApiServiceFactory.isUsingStandaloneImplementation() ); LdapApiService ldapApiService = LdapApiServiceFactory.getSingleton(); assertNotNull( ldapApiService ); assertNotNull( ldapApiService.getProtocolCodecFactory() ); assertTrue( ldapApiService.isControlRegistered( SortRequest.OID ) ); }
Example #2
Source File: LdapNetworkConnection.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public ExtendedResponse extended( Oid oid, byte[] value ) throws LdapException { Map<String, ExtendedOperationFactory> factories = LdapApiServiceFactory.getSingleton().getExtendedRequestFactories(); String oidStr = oid.toString(); ExtendedOperationFactory factory = factories.get( oidStr ); if ( factory != null ) { try { if ( value == null ) { return extended( factory.newRequest() ); } else { return extended( factory.newRequest( value ) ); } } catch ( DecoderException de ) { throw new LdapNoSuchObjectException( de.getMessage() ); } } else { return extended( new OpaqueExtendedRequest( oidStr, value ) ); } }
Example #3
Source File: DefaultActivator.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public void start( BundleContext bundleContext ) throws Exception { registration = bundleContext.registerService( LdapApiService.class.getName(), codec, null ); LdapApiServiceFactory.initialize( codec ); }
Example #4
Source File: ControlsContainer.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * A constructor for this container */ public ControlsContainer() { super(); setGrammar( ControlsGrammar.getInstance() ); setTransition( ControlsStates.START_STATE ); this.codec = LdapApiServiceFactory.getSingleton(); }
Example #5
Source File: EndTransactionResponseTest.java From directory-ldap-api with Apache License 2.0 | 5 votes |
@BeforeAll public static void init() { codec = new DefaultLdapCodecService(); LdapApiServiceFactory.initialize( codec ); codec.registerResponseControl( new SyncDoneValueFactory( codec ) ); codec.registerResponseControl( new SyncStateValueFactory( codec ) ); codec.registerExtendedResponse( new EndTransactionFactory( codec ) ); }
Example #6
Source File: AbstractLdapConnection.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * Creates a new instance of an AbstractLdapConnection */ protected AbstractLdapConnection() { this( LdapApiServiceFactory.getSingleton() ); }
Example #7
Source File: LdapProtocolCodecFactory.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * Creates a new instance of LdapProtocolCodecFactory. */ public LdapProtocolCodecFactory() { this( LdapApiServiceFactory.getSingleton() ); }
Example #8
Source File: LdapProtocolEncoder.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * Creates a new instance of LdapProtocolEncoder. */ public LdapProtocolEncoder() { this( LdapApiServiceFactory.getSingleton() ); }
Example #9
Source File: JavaStoredProcUtils.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * Invoke a Stored Procedure * * @param ctx The execution context * @param procedureName The procedure to execute * @param arguments The procedure's arguments * @return The execution resut * @throws NamingException If we have had an error whil executing the stored procedure */ public static Object callStoredProcedure( LdapContext ctx, String procedureName, Object[] arguments ) throws NamingException { String language = "Java"; Object responseObject; try { /** * Create a new stored procedure execution request. */ StoredProcedureRequestImpl req = new StoredProcedureRequestImpl( 0, procedureName, language ); /** * For each argument UTF-8-encode the type name * and Java-serialize the value * and add them to the request as a parameter object. */ for ( int i = 0; i < arguments.length; i++ ) { byte[] type; byte[] value; type = arguments[i].getClass().getName().getBytes( StandardCharsets.UTF_8 ); value = SerializationUtils.serialize( ( Serializable ) arguments[i] ); req.addParameter( type, value ); } /** * Call the stored procedure via the extended operation * and get back its return value. */ ExtendedRequest jndiReq = LdapApiServiceFactory.getSingleton().toJndi( req ); ExtendedResponse resp = ctx.extendedOperation( jndiReq ); /** * Restore a Java object from the return value. */ byte[] responseStream = resp.getEncodedValue(); responseObject = SerializationUtils.deserialize( responseStream ); } catch ( Exception e ) { NamingException ne = new NamingException(); ne.setRootCause( e ); throw ne; } return responseObject; }
Example #10
Source File: LdapNetworkConnection.java From directory-ldap-api with Apache License 2.0 | 2 votes |
/** * * Creates a new instance of LdapConnection with the given connection configuration. * * @param config the configuration of the LdapConnection */ public LdapNetworkConnection( LdapConnectionConfig config ) { this( config, LdapApiServiceFactory.getSingleton() ); }