URL url = getClass().getResource( "HelloWorldProcedure.class" ); InputStream in = getClass().getResourceAsStream( "HelloWorldProcedure.class" ); File file = new File( url.getFile() ); int size = ( int ) file.length(); byte[] buf = new byte[size]; in.read( buf ); in.close();   Attributes attributes = new BasicAttributes( "objectClass", "top", true ); attributes.get( "objectClass" ).add( "javaClass" ); attributes.put( "fullyQualifiedClassName", HelloWorldProcedure.class.getName() ); attributes.put( "byteCode", buf ); ctx.createSubcontext( "fullyQualifiedClassName=" + HelloWorldProcedure.class.getName(), attributes );
URL url = getClass().getResource( "HelloWorldProcedure.class" ); InputStream in = getClass().getResourceAsStream( "HelloWorldProcedure.class" ); File file = new File( url.getFile() ); int size = ( int ) file.length(); byte[] buf = new byte[size]; in.read( buf ); in.close();   Attributes attributes = new BasicAttributes( "objectClass", "top", true ); attributes.get( "objectClass" ).add( "javaClass" ); attributes.put( "fullyQualifiedClassName", HelloWorldProcedure.class.getName() ); attributes.put( "byteCode", buf ); ctx.createSubcontext( "fullyQualifiedClassName=" + HelloWorldProcedure.class.getName(), attributes ); } catch ( Exception e ) {  e.printStackTrace(); throw e; }
    public void setUp() throws Exception    {        Set handlers = new HashSet( super.configuration.getExtendedOperationHandlers() );        handlers.add( new StoredProcedureExtendedOperationHandler() );        super.configuration.setExtendedOperationHandlers( handlers );                super.setUp();        Hashtable env = new Hashtable();        env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" );        env.put( "java.naming.provider.url", "ldap://localhost:" + port + "/ou=system" );        env.put( "java.naming.security.principal", "uid=admin,ou=system" );        env.put( "java.naming.security.credentials", "secret" );        env.put( "java.naming.security.authentication", "simple" );        ctx = new InitialLdapContext( env, null );        URL url = getClass().getResource( "HelloWorldProcedure.class" );        InputStream in = getClass().getResourceAsStream( "HelloWorldProcedure.class" );        File file = new File( url.getFile() );        int size = ( int ) file.length();        byte[] buf = new byte[size];        in.read( buf );        in.close();                // set up        Attributes attributes = new BasicAttributes( "objectClass", "top", true );        attributes.get( "objectClass" ).add( "javaClass" );        attributes.put( "fullyQualifiedClassName", HelloWorldProcedure.class.getName() );        attributes.put( "byteCode", buf );        ctx.createSubcontext( "fullyQualifiedClassName=" + HelloWorldProcedure.class.getName(), attributes );    }