costin 2003/02/28 13:58:02 Modified: jk/java/org/apache/jk/common ModJkMX.java Log: Few more fixes. Now both reading and writting works ( and metadata, of course ). It is a bit weird that we don't support anything but strings - but anything else would be painfull in C. Later we can extend it to override the types and convert. The only remaining issue before I cross this is adding getters and setters for more info on the C side. Revision Changes Path 1.2 +20 -4 jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ModJkMX.java Index: ModJkMX.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ModJkMX.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ModJkMX.java 28 Feb 2003 20:51:03 -0000 1.1 +++ ModJkMX.java 28 Feb 2003 21:58:02 -0000 1.2 @@ -188,6 +188,7 @@ if( time - lastRefresh < updateInterval ) { return; } + log.debug( "Refreshing attributes"); lastRefresh=time; // connect to apache, get a list of mbeans BufferedReader is=getStream( "dmp=*"); @@ -197,16 +198,20 @@ // for each mbean, create a proxy log.info("Read " + line); StringTokenizer st=new StringTokenizer(line,"|"); - if( st.countTokens() < 5 ) continue; + if( st.countTokens() < 4 ) continue; String key=st.nextToken(); if( ! "G".equals( key )) continue; String name=st.nextToken(); String att=st.nextToken(); - String val=st.nextToken(null); + String val=st.nextToken("").substring(1); log.info("Token: " + key + " name: " + name + " att=" + att + " val=" + val); MBeanProxy proxy=(MBeanProxy)mbeans.get(name); - proxy.update(att, val); + if( proxy==null ) { + log.info( "Unknown object " + name); + } else { + proxy.update(att, val); + } } } catch( Exception ex ) { @@ -301,6 +306,7 @@ { log.info("Register " + name ); int col=name.indexOf( ':' ); + this.jkName=name; String type=name.substring(0, col ); String id=name.substring(col+1); id=id.replace(':', '%'); @@ -339,6 +345,7 @@ } private void update( String name, String val ) { + log.debug( "Updating " + jkName + " " + name + " " + val); atts.put( name, val); } @@ -353,7 +360,16 @@ throws AttributeNotFoundException, MBeanException, ReflectionException { - + try { + // we support only string values + String val=(String)attribute.getValue(); + String name=attribute.getName(); + BufferedReader is=jkmx.getStream("set=" + jkName + "|" + + name + "|" + val); + log.info( "Setting " + jkName + " " + name + " result " + is.readLine()); + } catch( Exception ex ) { + throw new MBeanException(ex); + } } } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]