costin 02/04/10 16:53:11
Modified: jk/java/org/apache/jk/apr AprImpl.java
jk/java/org/apache/jk/common ChannelUn.java
jk/java/org/apache/jk/core JkHandler.java
jk/java/org/apache/jk/server JkCoyoteHandler.java
JkMain.java
Log:
More fixes for the new env.
The properties will find their way to the target jk component ( assuming
you want to use attributes in server.xml for config - I strongly disagree with this )
conf/jk2.properties ( or whatever name you set ) will be read.
Also: AprImpl and ChannelUn work - assuming you know the magic incantations.
( i.e. jk2.properties and LD_LIBRARY_PATH )
Revision Changes Path
1.4 +27 -11 jakarta-tomcat-connectors/jk/java/org/apache/jk/apr/AprImpl.java
Index: AprImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/apr/AprImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AprImpl.java 12 Jan 2002 04:01:47 -0000 1.3
+++ AprImpl.java 10 Apr 2002 23:53:11 -0000 1.4
@@ -10,6 +10,7 @@
public class AprImpl {
String baseDir;
String aprHome;
+ String soExt="so";
/** Initialize APR
*/
@@ -51,7 +52,11 @@
public void setBaseDir(String s) {
baseDir=s;
}
-
+
+ public void setSoExt(String s ) {
+ soExt=s;
+ }
+
// XXX maybe install the jni lib in apr-home ?
public void setAprHome( String s ) {
aprHome=s;
@@ -71,16 +76,27 @@
public void loadNative() {
if( aprHome==null )
aprHome=baseDir;
- File dir=new File(aprHome);
- // XXX platform independent, etc...
- File apr=new File( dir, "libapr.so");
-
- loadNative( apr.getAbsolutePath() );
-
- dir=new File(baseDir);
- File jniConnect=new File( dir, "jni_connect.so");
-
- loadNative( jniConnect.getAbsolutePath() );
+ if( aprHome==null ) {
+ // Use load()
+ try {
+ System.loadLibrary( "apr" );
+ System.loadLibrary( "jni_connect" );
+ } catch( Throwable ex ) {
+ ok=false;
+ ex.printStackTrace();
+ }
+ } else {
+ File dir=new File(aprHome);
+ // XXX platform independent, etc...
+ File apr=new File( dir, "libapr." + soExt );
+
+ loadNative( apr.getAbsolutePath() );
+
+ dir=new File(baseDir);
+ File jniConnect=new File( dir, "jni_connect." + soExt );
+
+ loadNative( jniConnect.getAbsolutePath() );
+ }
}
boolean ok=true;
1.8 +20 -5
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java
Index: ChannelUn.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ChannelUn.java 4 Apr 2002 00:55:35 -0000 1.7
+++ ChannelUn.java 10 Apr 2002 23:53:11 -0000 1.8
@@ -82,6 +82,7 @@
String file;
ThreadPool tp=new ThreadPool();
String jkHome;
+ String aprHome;
/* ==================== Tcp socket options ==================== */
@@ -100,6 +101,12 @@
jkHome=s;
}
+ /** Directory where APR and jni_connect are installed.
+ */
+ public void setAprHome( String s ) {
+ aprHome=s;
+ }
+
/* ==================== ==================== */
long unixListenSocket;
int socketNote=1;
@@ -120,14 +127,22 @@
public void init() throws IOException {
apr=new AprImpl();
- File f=new File( jkHome );
- File aprBase=new File( jkHome, "/WEB-INF/jk2/jni" );
- apr.setBaseDir( aprBase.getAbsolutePath() );
- apr.loadNative();
+ if( aprHome==null && jkHome != null ) {
+ File f=new File( jkHome );
+ File aprBase=new File( jkHome, "jk2/jni" );
+ if( aprBase.exists() ) {
+ aprHome=aprBase.getAbsolutePath();
+ }
+ }
+ if( aprHome != null ) {
+ apr.setBaseDir( aprHome );
+ }
+ apr.loadNative();
+
apr.initialize();
+ if( log.isDebugEnabled() ) log.debug( "Creating pool " + gPool );
gPool=apr.poolCreate( 0 );
- if( log.isDebugEnabled() ) log.debug( "Create pool " + gPool );
File socketFile=new File( file );
if( socketFile.exists() ) {
1.5 +1 -1
jakarta-tomcat-connectors/jk/java/org/apache/jk/core/JkHandler.java
Index: JkHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/core/JkHandler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- JkHandler.java 9 Apr 2002 20:40:43 -0000 1.4
+++ JkHandler.java 10 Apr 2002 23:53:11 -0000 1.5
@@ -73,7 +73,7 @@
public static final int LAST=1;
public static final int ERROR=2;
- private Properties properties=new Properties();
+ protected Properties properties=new Properties();
protected WorkerEnv wEnv;
protected JkHandler next;
protected String nextName=null;
1.10 +11 -2
jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkCoyoteHandler.java
Index: JkCoyoteHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkCoyoteHandler.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- JkCoyoteHandler.java 10 Apr 2002 20:43:41 -0000 1.9
+++ JkCoyoteHandler.java 10 Apr 2002 23:53:11 -0000 1.10
@@ -93,12 +93,21 @@
Adapter adapter;
protected JkMain jkMain=new JkMain();
+ public void setProperty( String name, String value ) {
+ log.info("setProperty " + name + " " + value );
+ jkMain.setProperty( name, value );
+ properties.put( name, value );
+ }
+
+ public String getProperty( String name ) {
+ return properties.getProperty(name) ;
+ }
+
/** Pass config info
*/
public void setAttribute( String name, Object value ) {
- log.info("setAttribute " + name + " " + value );
if( value instanceof String )
- jkMain.setProperty( name, (String)value );
+ this.setProperty( name, (String)value );
}
public Object getAttribute( String name ) {
1.15 +7 -1
jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkMain.java
Index: JkMain.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkMain.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- JkMain.java 10 Apr 2002 22:15:10 -0000 1.14
+++ JkMain.java 10 Apr 2002 23:53:11 -0000 1.15
@@ -100,7 +100,11 @@
/** Set a name/value as a jk2 property
*/
public void setProperty( String n, String v ) {
- props.put( n, v );
+ if( "jkHome".equals( n ) ) {
+ setJkHome( v );
+ } else {
+ props.put( n, v );
+ }
}
/**
@@ -138,6 +142,7 @@
// XXX use IntrospectionUtil to find myself
this.guessHome();
}
+ log.info("Jk2 home " + home );
if( home != null ) {
File hF=new File(home);
File conf=new File( home, "conf" );
@@ -147,6 +152,7 @@
File propsF=new File( conf, "jk2.properties" );
if( propsF.exists() ) {
+ log.info("Jk2 conf " + propsF );
setPropertiesFile( propsF.getAbsolutePath());
} else {
if( log.isWarnEnabled() )
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>