org.apache.jk.apr

Class AprImpl

Implemented Interfaces:
MBeanRegistration, 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

ERROR, HANDLE_FLUSH, HANDLE_RECEIVE_PACKET, HANDLE_SEND_PACKET, HANDLE_THREAD_END, LAST, OK, domain, id, mserver, name, next, nextName, oname, properties, wEnv

Constructor Summary

AprImpl()

Method Summary

void
addJkHandler(String type, JkHandler cb)
Add a Handler for jni callbacks.
static Object
createJavaContext(String type, long cContext)
long
createJkHandler(long xEnv, String compName)
static byte[]
getBuffer(Object ctx, int id)
Return a buffer associated with the ctx.
long
getJkEnv()
long
getJkHandler(long xEnv, 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)
String
jkGetAttribute(long xEnv, long componentP, String name)
int
jkInit(long xEnv, long componentP)
static int
jkInvoke(long xEnv, long componentP, long endpointP, int code, 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, String name, String val)
static int
jniInvoke(long jContext, Object ctx)
static void
jniMode()
void
loadNative()
This method of loading the libs doesn't require setting LD_LIBRARY_PATH.
void
loadNative(String libPath)
void
releaseJkEnv(long xEnv)
Clean the temp pool, put back the env in the pool
void
setAprHome(String s)
void
setBaseDir(String s)
Native libraries are located based on base dir.
static void
setErr(String filename)
Sets the System.err stream
void
setJniModeSo(String jniModeSo)
Name of the so used in inprocess mode
void
setNativeSo(String nativeSo)
name of the so used by java.
static void
setOut(String filename)
Sets the System.out stream
void
setSoExt(String s)
int
terminate()

Methods inherited from class org.apache.jk.core.JkHandler

addHandlerCallback, createMsgContext, destroy, getDomain, getId, getName, getNext, getObjectName, getProperty, handleNotification, init, invoke, pause, postDeregister, postRegister, preDeregister, preRegister, resume, setId, setName, setNext, setNext, setProperty, setWorkerEnv

Constructor Details

AprImpl

public AprImpl()

Method Details

addJkHandler

public void addJkHandler(String type,
                         JkHandler cb)
Add a Handler for jni callbacks.


createJavaContext

public static Object createJavaContext(String type,
                                       long cContext)


createJkHandler

public long createJkHandler(long xEnv,
                            String compName)


getBuffer

public static byte[] getBuffer(Object ctx,
                               int id)
Return a buffer associated with the ctx.


getJkEnv

public long getJkEnv()


getJkHandler

public long getJkHandler(long xEnv,
                         String compName)
Get a native component

Returns:
0 if the component is not found.


init

public void init()
            throws IOException
Should register the request types it can handle, same style as apache2.
Overrides:
init in interface JkHandler


initialize

public int initialize()
Initialize APR


isLoaded

public boolean isLoaded()


jkDestroy

public int jkDestroy(long xEnv,
                     long componentP)


jkGetAttribute

public String jkGetAttribute(long xEnv,
                             long componentP,
                             String name)


jkInit

public int jkInit(long xEnv,
                  long componentP)


jkInvoke

public static int jkInvoke(long xEnv,
                           long componentP,
                           long endpointP,
                           int code,
                           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.


jkSetAttribute

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


jniInvoke

public static int jniInvoke(long jContext,
                            Object ctx)


jniMode

public static void jniMode()


loadNative

public void loadNative()
            throws 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.


loadNative

public void loadNative(String libPath)


releaseJkEnv

public void releaseJkEnv(long xEnv)
Clean the temp pool, put back the env in the pool


setAprHome

public void setAprHome(String s)


setBaseDir

public void setBaseDir(String s)
Native libraries are located based on base dir. XXX Add platform, version, etc


setErr

public static void setErr(String filename)
Sets the System.err stream


setJniModeSo

public void setJniModeSo(String jniModeSo)
Name of the so used in inprocess mode


setNativeSo

public void setNativeSo(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(String filename)
Sets the System.out stream


setSoExt

public void setSoExt(String s)


terminate

public int terminate()


Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.