public void handleExtendedOperation( LdapSession session, StoredProcedureRequest req ) throws Exception
{
String procedure = req.getProcedureSpecification();
Entry spUnit = manager.findStoredProcUnit( session.getCoreSession(), procedure );
StoredProcEngine engine = manager.getStoredProcEngineInstance( spUnit );
List<Object> valueList = new ArrayList<Object>( req.size() );
for ( int ii = 0; ii < req.size(); ii++ )
{
byte[] serializedValue = ( byte[] ) req.getParameterValue( ii );
Object value = SerializationUtils.deserialize( serializedValue );
if ( value.getClass().equals( LdapContextParameter.class ) )
{
String paramCtx = ( ( LdapContextParameter ) value ).getValue();
value = session.getCoreSession().lookup( new Dn( paramCtx ) );
}
valueList.add( value );
}
Object[] values = valueList.toArray( EMPTY_CLASS_ARRAY );
Object response = engine.invokeProcedure( session.getCoreSession(), procedure, values );
byte[] serializedResponse = SerializationUtils.serialize( ( Serializable ) response );
StoredProcedureResponse resp =
LdapApiServiceFactory.getSingleton().newExtendedResponse( req, serializedResponse );
session.getIoSession().write( resp );
}