[Idrs-commit] CVS: Idrs/dev/src/net/sourceforge/idrs/deploy/compile/units Body.java,NONE,1.1 Constru
Brought to you by:
bigman921
|
From: Marc B. <big...@us...> - 2002-02-27 23:56:35
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/units
In directory usw-pr-cvs1:/tmp/cvs-serv12455/dev/src/net/sourceforge/idrs/deploy/compile/units
Added Files:
Body.java Constructor.java Db.java Head.java Method.java
Object.java Repeat.java Rml.java SQL.java StoredProc.java
VarList.java
Log Message:
Added upload support! Thanks to Dane Foster and Equity Technology Group for posting their code on sourceforge!
--- NEW FILE: Body.java ---
/*
* Body.java
*
* Created on February 12, 2002, 12:56 PM
*/
package net.sourceforge.idrs.deploy.compile.units;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import javax.xml.parsers.*;
import java.util.*;
import net.sourceforge.idrs.core.report.*;
import net.sourceforge.idrs.deploy.compile.Compiler;
import net.sourceforge.idrs.deploy.compile.CompilerState;
import net.sourceforge.idrs.utils.ObjectStore;
/**
*
* @author mlb
* @version
*/
public class Body extends net.sourceforge.idrs.deploy.compile.Compiler {
/** Creates new Body */
public Body() {
}
/**
*allows for a compiler to use the attributes of the calling tag
*/
public void setAttributes(Attributes atts) throws Exception {
super.setAttributes(atts);
state.sealLine();
if (state.getReport().getBody().isHTML()) {
Line line = state.getCurrentLine();
line.addChunk(new net.sourceforge.idrs.core.report.TextChunk("<BODY "));
for (int i=0,m=atts.getLength();i<m;i++) {
line.addChunk(new TextChunk(atts.getLocalName(i) + "=\"" + atts.getValue(i) + "\" "));
}
line.addChunk(new TextChunk(">"));
state.sealLine();
}
}
public void useMethod(String val,Attributes atts) throws Exception {
String objid = atts.getValue("objid");
String varlistId = atts.getValue("varlist");
LinkedList varList = (LinkedList) ((HashMap) state.getAttribute("IDRS_VAR_LISTS")).get(varlistId);
Line curr = state.getCurrentLine();
curr.addChunk(new ObjectChunk(val,varList.toArray(),varlistId,objid));
}
public void field(String val,Attributes atts) throws Exception {
String format = atts.getValue("format");
String id, field;
id = val.substring(0,val.indexOf("."));
field = val.substring(val.indexOf(".")+1);
Line line = state.getCurrentLine();
line.addChunk(new net.sourceforge.idrs.core.report.FieldChunk(id,field,format,state.getCurrentRepeatLine()));
}
public void inputResults(String val,Attributes atts) throws Exception {
Line line = state.getCurrentLine();
line.addChunk(new net.sourceforge.idrs.core.report.InputResultsChunk(val));
}
public void script(String val, Attributes atts) throws Exception {
state.getCurrentLine().addChunk(new net.sourceforge.idrs.core.report.ShortScriptChunk(val));
}
public void evalScript(String val,Attributes atts) throws Exception {
state.getCurrentLine().addChunk(new net.sourceforge.idrs.core.report.EvalScriptChunk(val));
}
public void text(String val,Attributes atts) throws Exception {
if (val.indexOf('\n') != -1) {
StringTokenizer tok = new StringTokenizer(val,"\n",false);
Line line;
while (tok.hasMoreTokens()) {
line = state.getCurrentLine();
line.addChunk(new net.sourceforge.idrs.core.report.TextChunk(tok.nextToken()));
state.sealLine();
}
}
else {
state.getCurrentLine().addChunk(new TextChunk(val));
}
}
/**
* allows for the execution of any wrap-up code at the hitting of the end tag
*/
public void seal() throws Exception {
}
}
--- NEW FILE: Constructor.java ---
/*
* Constructor.java
*
* Created on February 6, 2002, 3:26 PM
*/
package net.sourceforge.idrs.deploy.compile.units;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import javax.xml.parsers.*;
import java.util.*;
import net.sourceforge.idrs.core.report.*;
import net.sourceforge.idrs.deploy.compile.Compiler;
import net.sourceforge.idrs.deploy.compile.CompilerState;
import net.sourceforge.idrs.utils.ObjectStore;
/**
* Encapulates an Object's constructor
* @author Marc Boorshtein
*/
public class Constructor extends net.sourceforge.idrs.deploy.compile.Compiler {
protected ObjectStore obj;
protected LinkedList list;
/** Creates new Constructor */
public Constructor() {
list = new LinkedList();
}
/**
* allows for the execution of any wrap-up code at the hitting of the end tag
*/
public void seal() throws Exception {
Class cls[] = new Class[list.size()];
System.arraycopy(list.toArray(),0,cls,0,list.size());
obj.firstInitiate(cls);
}
/**
* allows for a compiler to use the attributes of the calling tag
*@param atts Tag Attributes
*/
public void setAttributes(Attributes atts) throws Exception {
super.setAttributes(atts);
obj = ((net.sourceforge.idrs.deploy.compile.units.Object) this.state.peekNode()).getObjectStore();
}
/**
*Handles the vartype tag
*@param val Value of tag
*@param atts Tag attributes
*/
public void varType(String val, Attributes atts) throws Exception {
list.add(state.getClass(val));
}
}
--- NEW FILE: Db.java ---
/*
* Db.java
*
* Created on February 6, 2002, 3:50 PM
*/
package net.sourceforge.idrs.deploy.compile.units;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import javax.xml.parsers.*;
import java.util.*;
import net.sourceforge.idrs.core.report.*;
import net.sourceforge.idrs.deploy.compile.Compiler;
import net.sourceforge.idrs.deploy.compile.CompilerState;
import net.sourceforge.idrs.utils.*;
/**
*
* @author mlb
* @version
*/
public class Db extends net.sourceforge.idrs.deploy.compile.Compiler {
DB db;
String id;
/** Creates new Db */
public Db() {
}
/**
* allows for the execution of any wrap-up code at the hitting of the end tag
*/
public void seal() throws Exception {
db.seal();
this.state.getReport().getHead().addDB(db);
}
/**
* allows for a compiler to use the attributes of the calling tag
*/
public void setAttributes(Attributes atts) throws Exception {
super.setAttributes(atts);
id = atts.getValue("id");
db = new DB(id);
}
public void dbName(String val, Attributes atts) throws Exception {
db.setDBName(val);
}
public void dbDriver(String val, Attributes atts) throws Exception {
db.setDBDriver(val);
}
public void dbUser(String val, Attributes atts) throws Exception {
db.setUserName(val);
}
public void dbPass(String val, Attributes atts) throws Exception {
db.setPassword(val);
}
public void dirrection(String val, Attributes att) throws Exception {
db.setDirection( val.equalsIgnoreCase("INPUT") ? DB.INPUT : DB.OUTPUT);
}
public void useDB(String val, Attributes atts) throws Exception {
db.setDBName(this.state.getReport().getHead().getDB(val).getDBName(),false);
}
public void useMethod(String val, Attributes atts) throws Exception {
String objid;
ObjectStore obj;
objid = atts.getValue("objid");
obj = this.state.getReport().getHead().getObjectStore(objid);
db.setType(DB.METHOD);
db.setObjectStore(obj);
db.setMethodName(val);
}
public net.sourceforge.idrs.utils.DB getDB() {
return this.db;
}
}
--- NEW FILE: Head.java ---
/*
* Head.java
*
* Created on February 4, 2002, 9:05 AM
*/
package net.sourceforge.idrs.deploy.compile.units;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import javax.xml.parsers.*;
import java.util.*;
import net.sourceforge.idrs.core.report.*;
import net.sourceforge.idrs.deploy.compile.Compiler;
import net.sourceforge.idrs.deploy.compile.CompilerState;
public class Head extends net.sourceforge.idrs.deploy.compile.Compiler {
/** Creates new Head */
public Head() {
}
/**
* allows for the execution of any wrap-up code at the hitting of the end tag
*/
public void seal() throws Exception {
if (this.state.getReport().getBody().isHTML()) {
this.state.getReport().getHead().addText("</HEAD>");
}
this.state.getReport().getHead().seal();
}
/**
* allows for a compiler to use the attributes of the calling tag
*/
public void setAttributes(Attributes atts) throws Exception {
String tag;
int i;
if (this.state.getReport().getBody().isHTML()) {
tag = "<HEAD ";
for (i=0; i < atts.getLength(); i++) {
tag += atts.getLocalName(i) + "=\"" + atts.getValue(i) + "\" ";
}
tag += ">";
this.state.getReport().getHead().addText(tag);
}
}
public void text(java.lang.String val, Attributes atts) throws Exception {
this.state.getReport().getHead().addText(val);
}
}
--- NEW FILE: Method.java ---
/*
* Method.java
*
* Created on February 6, 2002, 3:41 PM
*/
package net.sourceforge.idrs.deploy.compile.units;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import javax.xml.parsers.*;
import java.util.*;
import net.sourceforge.idrs.core.report.*;
import net.sourceforge.idrs.deploy.compile.Compiler;
import net.sourceforge.idrs.deploy.compile.CompilerState;
import net.sourceforge.idrs.utils.ObjectStore;
/**
* Encapsulates the method tag
* @author Marc Boorshtein
*/
public class Method extends net.sourceforge.idrs.deploy.compile.units.Constructor {
String name;
/** Creates new Method */
public Method() {
super();
}
/**
* allows for the execution of any wrap-up code at the hitting of the end tag
*/
public void seal() throws Exception {
Class cls[] = new Class[list.size()];
System.arraycopy(list.toArray(),0,cls,0,list.size());
obj.addMethod(name,cls);
}
/**
* allows for the compiler to work with the current state of the page compilation
*@param state The CompilerState object
*/
public void setState(CompilerState state) throws Exception {
super.setState(state);
}
/**
*name tag
*@param val Value of tag
*@param atts Tag attributes
*/
public void name(String val, Attributes atts) {
this.name=name;
}
}
--- NEW FILE: Object.java ---
/*
* Object.java
*
* Created on February 6, 2002, 2:59 PM
*/
package net.sourceforge.idrs.deploy.compile.units;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import javax.xml.parsers.*;
import java.util.*;
import net.sourceforge.idrs.core.report.*;
import net.sourceforge.idrs.deploy.compile.Compiler;
import net.sourceforge.idrs.deploy.compile.CompilerState;
import net.sourceforge.idrs.utils.ObjectStore;
/**
* Encapsulates the object tag
* @author Marc Boorshtein
*/
public class Object extends net.sourceforge.idrs.deploy.compile.Compiler {
String id;
ObjectStore obj;
/** Creates new Object */
public Object() {
}
/**
* allows for the execution of any wrap-up code at the hitting of the end tag
*/
public void seal() throws Exception {
obj.seal();
this.state.getReport().getHead().addObject(obj);
}
/**
* allows for a compiler to use the attributes of the calling tag
*@param atts Tag attributes
*/
public void setAttributes(Attributes atts) throws Exception {
super.setAttributes(atts);
this.id = atts.getValue("id");
this.obj = new ObjectStore(id);
}
/**
*sets the class name
*@param val Value of tag
*@param atts Tag attributes
*/
public void className (java.lang.String val, Attributes atts) throws Exception {
obj.setClassName(val);
}
/**
*Returns the current ObjectStore
*@return current ObjectStore instance
*/
public ObjectStore getObjectStore(){
return this.obj;
}
}
--- NEW FILE: Repeat.java ---
/*
* Repeat.java
*
* Created on February 19, 2002, 1:28 PM
*/
package net.sourceforge.idrs.deploy.compile.units;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import javax.xml.parsers.*;
import java.util.*;
import net.sourceforge.idrs.core.report.*;
import net.sourceforge.idrs.deploy.compile.Compiler;
import net.sourceforge.idrs.deploy.compile.CompilerState;
import net.sourceforge.idrs.utils.ObjectStore;
/**
*
* @author mlb
* @version
*/
public class Repeat extends net.sourceforge.idrs.deploy.compile.units.Body {
String id, color1, color2;
/** Creates new Repeat */
public Repeat() {
}
/**
*allows for a compiler to use the attributes of the calling tag
*/
public void setAttributes(Attributes atts) throws Exception {
super.setAttributes(atts);
this.atts = atts;
id = atts.getValue("id");
color1 = atts.getValue("color1");
color2 = atts.getValue("color2");
}
/**
*allows for the compiler to work with the current state of the page compilation
*/
public void setState(CompilerState state) throws Exception {
super.setState(state);
state.addRepeatLine(id,color1,color2);
}
/**
* allows for the execution of any wrap-up code at the hitting of the end tag
*/
public void seal() throws Exception {
state.setRepeatLine();
}
}
--- NEW FILE: Rml.java ---
/*
* Rml.java
*
* Created on February 2, 2002, 8:57 PM
*/
package net.sourceforge.idrs.deploy.compile.units;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import javax.xml.parsers.*;
import java.util.*;
import net.sourceforge.idrs.core.report.*;
import net.sourceforge.idrs.deploy.compile.Compiler;
import net.sourceforge.idrs.deploy.compile.CompilerState;
/**
*
* @author mlb
* @version
*/
public class Rml extends net.sourceforge.idrs.deploy.compile.Compiler {
/** Creates new Rml */
public Rml() {
}
/**
* allows for the execution of any wrap-up code at the hitting of the end tag
*/
public void seal() throws Exception {
}
/**
*Handles te isHtml tag
*@param val The value of the tag
*@params atts The Attributes of the tag
*/
public void isHtml(String val, Attributes atts) throws Exception {
this.state.getReport().getBody().isHTML(Boolean.valueOf(val).booleanValue());
}
/**
*Handles te scriptClass tag
*@param val The value of the tag
*@params atts The Attributes of the tag
*/
public void scriptClass(String val, Attributes atts) throws Exception {
this.state.getReport().getHead().setScriptClass(val);
}
}
--- NEW FILE: SQL.java ---
/*
* SQL.java
*
* Created on February 6, 2002, 4:01 PM
*/
package net.sourceforge.idrs.deploy.compile.units;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import javax.xml.parsers.*;
import java.util.*;
import net.sourceforge.idrs.core.report.*;
import net.sourceforge.idrs.deploy.compile.Compiler;
import net.sourceforge.idrs.deploy.compile.CompilerState;
import net.sourceforge.idrs.utils.*;
/**
*
* @author mlb
* @version
*/
public class SQL extends net.sourceforge.idrs.deploy.compile.Compiler {
protected DB db;
/** Creates new SQL */
public SQL() throws Exception {
}
/**
* allows for the execution of any wrap-up code at the hitting of the end tag
*/
public void seal() {
}
/**
* allows for the compiler to work with the current state of the page compilation
*/
public void setState(CompilerState state) throws Exception {
super.setState(state);
db = ((net.sourceforge.idrs.deploy.compile.units.Db) this.state.peekNode()).getDB();
setType();
}
protected void setType() {
db.setType(DB.SQL);
}
void varType(String val, Attributes att) throws Exception {
db.addVarType(val);
}
void src(String val, Attributes atts) {
db.setSQL(val);
}
}
--- NEW FILE: StoredProc.java ---
/*
* StoredProc.java
*
* Created on February 6, 2002, 4:05 PM
*/
package net.sourceforge.idrs.deploy.compile.units;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import javax.xml.parsers.*;
import java.util.*;
import net.sourceforge.idrs.core.report.*;
import net.sourceforge.idrs.deploy.compile.Compiler;
import net.sourceforge.idrs.deploy.compile.CompilerState;
import net.sourceforge.idrs.utils.*;
/**
*
* @author mlb
* @version
*/
public class StoredProc extends net.sourceforge.idrs.deploy.compile.units.SQL {
/** Creates new StoredProc */
public StoredProc() throws Exception {
}
protected void setType() {
db.setType(DB.PROC);
}
}
--- NEW FILE: VarList.java ---
/*
* VarList.java
*
* Created on February 6, 2002, 2:43 PM
*/
package net.sourceforge.idrs.deploy.compile.units;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import javax.xml.parsers.*;
import java.util.*;
import net.sourceforge.idrs.core.report.*;
import net.sourceforge.idrs.deploy.compile.Compiler;
import net.sourceforge.idrs.deploy.compile.CompilerState;
/**
*
* @author mlb
* @version
*/
public class VarList extends net.sourceforge.idrs.deploy.compile.Compiler {
LinkedList list;
String id;
/** Creates new VarList */
public VarList() {
list = new LinkedList();
}
/**
* allows for the execution of any wrap-up code at the hitting of the end tag
*/
public void seal() throws Exception {
this.state.getReport().getHead().addVarList(id,new Integer(list.size()));
HashMap lists = (HashMap) this.state.getAttribute("IDRS_VAR_LISTS");
if (lists == null) {
lists = new HashMap();
this.state.setAttribute("IDRS_VAR_LISTS",lists);
}
lists.put(this.id,this.list);
}
/**
* allows for a compiler to use the attributes of the calling tag
*/
public void setAttributes(Attributes atts) throws Exception {
super.setAttributes(atts);
id = atts.getValue("id");
}
void varType(java.lang.String val, Attributes atts) throws Exception {
this.list.add(state.getClass(val));
}
}
|