## org.apache.jk.apr
Class AprImpl

    java.lang.Object
      org.apache.jk.core.JkHandler
          org.apache.jk.apr.AprImpl

All Implemented Interfaces:
  java.util.EventListener, javax.management.MBeanRegistration, javax.management.NotificationListener

    public class AprImpl

extends JkHandler

Implements the interface with the APR library. This is for internal-use only. The goal is to use 'natural' mappings for user code - for example java.net.Socket for unix-domain sockets, etc.

Field Summary

Fields inherited from class org.apache.jk.core.JkHandler
`domain, ERROR, HANDLE_FLUSH, HANDLE_RECEIVE_PACKET, HANDLE_SEND_PACKET, HANDLE_THREAD_END, id, LAST, mserver, name, next, nextName, OK, oname, properties, wEnv`

Constructor Summary
`AprImpl()`

Method Summary
`void` `addJkHandler(java.lang.String type, JkHandler cb)` Add a Handler for jni callbacks.
`static java.lang.Object` `createJavaContext(java.lang.String type, long cContext)`
`long` `createJkHandler(long xEnv, java.lang.String compName)`
`static byte[]` `getBuffer(java.lang.Object ctx, int id)` Return a buffer associated with the ctx.
`long` `getJkEnv()`
`long` `getJkHandler(long xEnv, java.lang.String compName)` Get a native component
`void` `init()` Should register the request types it can handle, same style as apache2.
`int` `initialize()` Initialize APR
`boolean` `isLoaded()`
`int` `jkDestroy(long xEnv, long componentP)`
`java.lang.String` `jkGetAttribute(long xEnv, long componentP, java.lang.String name)`
`int` `jkInit(long xEnv, long componentP)`
`static int` `jkInvoke(long xEnv, long componentP, long endpointP, int code, byte[] data, int off, int len, int raw)` Send the packet to the C side.
`void` `jkRecycle(long xEnv, long endpointP)` Recycle an endpoint after use.
`int` `jkSetAttribute(long xEnv, long componentP, java.lang.String name, java.lang.String val)`
`static int` `jniInvoke(long jContext, java.lang.Object ctx)`
`static void` `jniMode()`
`void` `loadNative()` This method of loading the libs doesn't require setting LD_LIBRARY_PATH.
`void` `loadNative(java.lang.String libPath)`
`void` `releaseJkEnv(long xEnv)` Clean the temp pool, put back the env in the pool
`void` `setAprHome(java.lang.String s)`
`void` `setBaseDir(java.lang.String s)` Native libraries are located based on base dir.
`static void` `setErr(java.lang.String filename)` Sets the System.err stream
`void` `setJniModeSo(java.lang.String jniModeSo)` Name of the so used in inprocess mode
`void` `setNativeSo(java.lang.String nativeSo)` name of the so used by java.
`static void` `setOut(java.lang.String filename)` Sets the System.out stream
`void` `setSoExt(java.lang.String s)`
`int` `terminate()`

Methods inherited from class org.apache.jk.core.JkHandler
`addHandlerCallback, createMsgContext, createMsgContext, destroy, getDomain, getId, getName, getNext, getObjectName, getProperty, handleNotification, invoke, pause, postDeregister, postRegister, preDeregister, preRegister, resume, setId, setName, setNext, setNext, setProperty, setWorkerEnv`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AprImpl

    public AprImpl()

Method Detail

### setBaseDir

    public void setBaseDir(java.lang.String s)

  Native libraries are located based on base dir. XXX Add platform, version, etc

### setSoExt

    public void setSoExt(java.lang.String s)

### setAprHome

    public void setAprHome(java.lang.String s)

### addJkHandler

    public void addJkHandler(java.lang.String type,
                             JkHandler cb)

  Add a Handler for jni callbacks.

### setJniModeSo

    public void setJniModeSo(java.lang.String jniModeSo)

  Name of the so used in inprocess mode

### setNativeSo

    public void setNativeSo(java.lang.String nativeSo)

  name of the so used by java. If not set we'll loadLibrary("jkjni" ), if set we load( nativeSo )

### setOut

    public static void setOut(java.lang.String filename)

  Sets the System.out stream

### setErr

    public static void setErr(java.lang.String filename)

  Sets the System.err stream

### initialize

    public int initialize()

  Initialize APR

### terminate

    public int terminate()

### getJkEnv

    public long getJkEnv()

### releaseJkEnv

    public void releaseJkEnv(long xEnv)

  Clean the temp pool, put back the env in the pool

### getJkHandler

    public long getJkHandler(long xEnv,
                             java.lang.String compName)

  Get a native component

  Returns:
    0 if the component is not found.

### createJkHandler

    public long createJkHandler(long xEnv,
                                java.lang.String compName)

### jkSetAttribute

    public int jkSetAttribute(long xEnv,
                              long componentP,
                              java.lang.String name,
                              java.lang.String val)

### jkGetAttribute

    public java.lang.String jkGetAttribute(long xEnv,
                                           long componentP,
                                           java.lang.String name)

### jkInit

    public int jkInit(long xEnv,
                      long componentP)

### jkDestroy

    public int jkDestroy(long xEnv,
                         long componentP)

### jkInvoke

    public static int jkInvoke(long xEnv,
                               long componentP,
                               long endpointP,
                               int code,
                               byte[] data,
                               int off,
                               int len,
                               int raw)

  Send the packet to the C side. On return it contains the response or indication there is no response. Asymetrical because we can't do things like continuations.

### jkRecycle

    public void jkRecycle(long xEnv,
                          long endpointP)

  Recycle an endpoint after use.

### createJavaContext

    public static java.lang.Object createJavaContext(java.lang.String type,
                                                     long cContext)

### getBuffer

    public static byte[] getBuffer(java.lang.Object ctx,
                                   int id)

  Return a buffer associated with the ctx.

### jniInvoke

    public static int jniInvoke(long jContext,
                                java.lang.Object ctx)

### init

    public void init()
              throws java.io.IOException

  Description copied from class: `JkHandler`
  Should register the request types it can handle, same style as apache2.

  Overrides:
    `init` in class `JkHandler`
  Throws:
    `java.io.IOException`

### isLoaded

    public boolean isLoaded()

### jniMode

    public static void jniMode()

### loadNative

    public void loadNative()
                    throws java.lang.Throwable

  This method of loading the libs doesn't require setting LD_LIBRARY_PATH. Assuming a 'right' binary distribution, or a correct build all files will be in their right place. The burden is on our code to deal with platform specific extensions and to keep the paths consistent - not easy, but worth it if it avoids one extra step for the user. Of course, this can change to System.load() and putting the libs in LD_LIBRARY_PATH.

  Throws:
    `java.lang.Throwable`

### loadNative

    public void loadNative(java.lang.String libPath)

Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.