org.apache.jk.apr

Class AprImpl

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.
Constructor Summary
AprImpl()
Method Summary
voidaddJkHandler(String type, JkHandler cb)
Add a Handler for jni callbacks.
static ObjectcreateJavaContext(String type, long cContext)
longcreateJkHandler(long xEnv, String compName)
static byte[]getBuffer(Object ctx, int id)
Return a buffer associated with the ctx.
longgetJkEnv()
longgetJkHandler(long xEnv, String compName)
Get a native component
voidinit()
intinitialize()
Initialize APR
booleanisLoaded()
intjkDestroy(long xEnv, long componentP)
StringjkGetAttribute(long xEnv, long componentP, String name)
intjkInit(long xEnv, long componentP)
static intjkInvoke(long xEnv, long componentP, long endpointP, int code, byte[] data, int off, int len, int raw)
Send the packet to the C side.
voidjkRecycle(long xEnv, long endpointP)
Recycle an endpoint after use.
intjkSetAttribute(long xEnv, long componentP, String name, String val)
static intjniInvoke(long jContext, Object ctx)
static voidjniMode()
voidloadNative()
This method of loading the libs doesn't require setting LD_LIBRARY_PATH.
voidloadNative(String libPath)
voidreleaseJkEnv(long xEnv)
Clean the temp pool, put back the env in the pool
voidsetAprHome(String s)
voidsetBaseDir(String s)
Native libraries are located based on base dir.
static voidsetErr(String filename)
Sets the System.err stream
voidsetJniModeSo(String jniModeSo)
Name of the so used in inprocess mode
voidsetNativeSo(String nativeSo)
name of the so used by java.
static voidsetOut(String filename)
Sets the System.out stream
voidsetSoExt(String s)
intterminate()

Constructor Detail

AprImpl

public AprImpl()

Method Detail

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()

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, 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.

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()
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 © 2000-2011 Apache Software Foundation. All Rights Reserved.