[Idrs-commit] CVS: Idrs/dev/src/net/sourceforge/idrs/deploy/compile CompilerState.java,1.3,1.4 RMLHa
Brought to you by:
bigman921
|
From: Marc B. <big...@us...> - 2002-03-23 04:48:30
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile
In directory usw-pr-cvs1:/tmp/cvs-serv12732/src/net/sourceforge/idrs/deploy/compile
Modified Files:
CompilerState.java RMLHandler.java RmlCompiler.java
Log Message:
Added setprops tag
Index: CompilerState.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/CompilerState.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** CompilerState.java 4 Mar 2002 23:05:34 -0000 1.3
--- CompilerState.java 23 Mar 2002 04:48:27 -0000 1.4
***************
*** 209,212 ****
--- 209,215 ----
}
+ /**
+ *Determines if the current line is null
+ */
public boolean isLineNull() {
return this.currentLine == null;
Index: RMLHandler.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/RMLHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RMLHandler.java 4 Mar 2002 23:05:35 -0000 1.2
--- RMLHandler.java 23 Mar 2002 04:48:27 -0000 1.3
***************
*** 2,12 ****
RMLHandler.java
Copyright (C) 2001 Marc Boorshtein
!
! The contents of this file are subject to the Mozilla Public License Version 1.0 (the License);
! you may not use this file except in compliance with the License. You may obtain a copy of the
License at http://www.mozilla.org/MPL/
!
! Software distributed under the License is distributed on an "AS IS" basis,
! WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific
language governing rights and limitations under the License.
*/
--- 2,12 ----
RMLHandler.java
Copyright (C) 2001 Marc Boorshtein
!
! The contents of this file are subject to the Mozilla Public License Version 1.0 (the License);
! you may not use this file except in compliance with the License. You may obtain a copy of the
License at http://www.mozilla.org/MPL/
!
! Software distributed under the License is distributed on an "AS IS" basis,
! WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific
language governing rights and limitations under the License.
*/
***************
*** 20,23 ****
--- 20,24 ----
import net.sourceforge.idrs.core.report.*;
import java.lang.reflect.*;
+ import java.io.*;
/**
***************
*** 33,39 ****
Attributes atts;
Stack isMethodState;
!
public static String BASE_PACKAGE = "net.sourceforge.idrs.deploy.compile.units";
/** Creates new RMLHandler */
public RMLHandler(CompilerState state) {
--- 34,42 ----
Attributes atts;
Stack isMethodState;
! PrintWriter out;
public static String BASE_PACKAGE = "net.sourceforge.idrs.deploy.compile.units";
+
+
/** Creates new RMLHandler */
public RMLHandler(CompilerState state) {
***************
*** 44,47 ****
--- 47,54 ----
}
+ public void setOut(PrintWriter out) {
+ this.out = out;
+ }
+
/**
*Executed at the beginning of a tag, performs the following tasks:<br>
***************
*** 54,75 ****
public void startElement(String namespaceURI, String localName, String rawName, Attributes atts) throws SAXException {
try {
! System.out.println("Start Element");
! System.out.println(localName);
! System.out.println(rawName);
}
catch (Exception e){}
!
currBuff = new StringBuffer();
Class compileClass;
Compiler compiler;
!
String className = getClassName(localName);
!
! try {
! System.out.println("Class Name : " + className);
! }catch (Exception e1){}
!
compileClass = (Class) classes.get(className);
!
if (compileClass == null) {
try {
--- 61,78 ----
public void startElement(String namespaceURI, String localName, String rawName, Attributes atts) throws SAXException {
try {
! out.println("Start Element" + localName);
}
catch (Exception e){}
!
currBuff = new StringBuffer();
Class compileClass;
Compiler compiler;
!
String className = getClassName(localName);
!
!
!
compileClass = (Class) classes.get(className);
!
if (compileClass == null) {
try {
***************
*** 82,112 ****
this.atts = atts;
}
!
if (compileClass != null) {
try {
compiler = (Compiler) compileClass.newInstance();
!
compiler.setState(state);
compiler.setAttributes(atts);
state.pushNode(compiler);
! System.out.println("Push Class : " + compiler.getClass());
!
}
catch (Exception e) {
e.printStackTrace(System.out);
}
!
!
}
!
this.isMethodState.push(new Boolean(isMethod));
try {
! System.out.println("Push " + isMethod);
! }
! catch (Exception ee){}
}
!
}
!
/**
*Executed at the end of a tag, performs the following tasks:<br>
--- 85,115 ----
this.atts = atts;
}
!
if (compileClass != null) {
try {
compiler = (Compiler) compileClass.newInstance();
!
compiler.setState(state);
compiler.setAttributes(atts);
state.pushNode(compiler);
! out.println("Push Class : " + compiler.getClass());
!
}
catch (Exception e) {
e.printStackTrace(System.out);
}
!
!
}
!
this.isMethodState.push(new Boolean(isMethod));
try {
! out.println("Push isMethod" + isMethod);
! }
! catch (Exception ee){}
}
!
}
!
/**
*Executed at the end of a tag, performs the following tasks:<br>
***************
*** 118,157 ****
public void endElement(String namespaceURI, String localName, String rawName) throws SAXException {
try {
! System.out.println("End Element");
! System.out.println(localName);
! System.out.println(rawName);
}
catch (Exception e){}
!
String methodName = getMethodName(localName);
Compiler curr;
!
Class[] paramTypes = {String.class, Attributes.class};
Object[] params = {currBuff.toString(),this.atts};
Method meth;
!
this.isMethod = ((Boolean) this.isMethodState.pop()).booleanValue();
! System.out.println("Pop " + this.isMethod);
!
if (this.isMethod) {
curr = state.peekNode();
! System.out.println("Current Class : " + curr.getClass());
//meth = (Method) this.methods.get(methodName);
!
//if (meth == null) {
! try {
! meth = curr.getClass().getMethod(methodName,paramTypes);
! }
! catch (Exception e1) {
! throw new SAXException(e1);
! }
!
! this.methods.put(methodName,meth);
//}
!
try {
! System.out.println("Curr :" + curr + "!");
! System.out.println("Params :" + params[0] + "-" + params[1]);
! System.out.println("Method : " + meth.getName());
meth.invoke(curr,params);
--- 121,158 ----
public void endElement(String namespaceURI, String localName, String rawName) throws SAXException {
try {
! out.println("End Element " + localName);
}
catch (Exception e){}
!
String methodName = getMethodName(localName);
Compiler curr;
!
Class[] paramTypes = {String.class, Attributes.class};
Object[] params = {currBuff.toString(),this.atts};
Method meth;
!
this.isMethod = ((Boolean) this.isMethodState.pop()).booleanValue();
! out.println("Pop isMethod " + this.isMethod);
!
if (this.isMethod) {
curr = state.peekNode();
! out.println("Current Class : " + curr.getClass());
//meth = (Method) this.methods.get(methodName);
!
//if (meth == null) {
! try {
! meth = curr.getClass().getMethod(methodName,paramTypes);
! }
! catch (Exception e1) {
! throw new SAXException(e1);
! }
!
! this.methods.put(methodName,meth);
//}
!
try {
! out.println("Curr :" + curr + "!");
! out.println("Params :" + params[0] + "-" + params[1]);
! out.println("Method : " + meth.getName());
meth.invoke(curr,params);
***************
*** 164,168 ****
else {
curr = state.popNode();
! System.out.println("Pop Class : " + curr.getClass());
try {
curr.seal();
--- 165,169 ----
else {
curr = state.popNode();
! out.println("Pop Class : " + curr.getClass());
try {
curr.seal();
***************
*** 174,184 ****
}
}
!
public void characters(char[] ch, int start, int end) {
! for (int i=start;i<start + end;i++) {
! currBuff.append(ch[i]);
! }
}
!
/**
*Retrieves the compiled report
--- 175,185 ----
}
}
!
public void characters(char[] ch, int start, int end) {
! for (int i=start;i<start + end;i++) {
! currBuff.append(ch[i]);
! }
}
!
/**
*Retrieves the compiled report
***************
*** 187,191 ****
return state.getReport();
}
!
/**
*Generates a full class name by capitalizing the first character of the tag and tacking
--- 188,192 ----
return state.getReport();
}
!
/**
*Generates a full class name by capitalizing the first character of the tag and tacking
***************
*** 204,207 ****
return lower.substring(0,1) + tagName.substring(1);
}
!
}
--- 205,208 ----
return lower.substring(0,1) + tagName.substring(1);
}
!
}
Index: RmlCompiler.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/RmlCompiler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** RmlCompiler.java 4 Mar 2002 23:05:35 -0000 1.1
--- RmlCompiler.java 23 Mar 2002 04:48:27 -0000 1.2
***************
*** 76,80 ****
in = new InputSource(xmlIn);
XMLReader parser = XMLReaderFactory.createXMLReader(xmlParser);
! parser.setContentHandler(new RMLHandler(comp));
parser.parse(in);
}
--- 76,82 ----
in = new InputSource(xmlIn);
XMLReader parser = XMLReaderFactory.createXMLReader(xmlParser);
! RMLHandler rmlHandler = new RMLHandler(comp);
! rmlHandler.setOut(log);
! parser.setContentHandler(rmlHandler);
parser.parse(in);
}
|