idrs-commit Mailing List for Internet Document and Report Server (Page 5)
Brought to you by:
bigman921
You can subscribe to this list here.
| 2002 |
Jan
(113) |
Feb
(34) |
Mar
(38) |
Apr
(63) |
May
|
Jun
|
Jul
|
Aug
(40) |
Sep
(26) |
Oct
(4) |
Nov
(5) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(13) |
Feb
(15) |
Mar
(21) |
Apr
(7) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(71) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
|
From: Marc B. <big...@us...> - 2003-03-17 14:03:47
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/jndi In directory sc8-pr-cvs1:/tmp/cvs-serv25372/dev/src/net/sourceforge/idrs/jndi Log Message: Directory /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/jndi added to the repository |
|
From: Marc B. <big...@us...> - 2003-03-13 20:59:00
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/utils/rs In directory sc8-pr-cvs1:/tmp/cvs-serv21179/dev/src/net/sourceforge/idrs/utils/rs Added Files: ObjRsMetaData.java ObjRsMetaData.class ObjRS.class ObjRS.java Log Message: Added a ResultSet implementation that supports common listing methods for EJB --- NEW FILE: ObjRsMetaData.java --- package net.sourceforge.idrs.utils.rs; import java.sql.*; import net.sourceforge.idrs.utils.*; import java.io.*; public class ObjRsMetaData extends RSMetaData implements Serializable { String[] fieldNames; public ObjRsMetaData (String[] fieldNames) { this.fieldNames = fieldNames; } /** * Whats the number of columns in the ResultSet? * * @return the number * @exception java.sql.SQLException if a database access error occurs * * @author Mark Matthews <mma...@wo...> */ public int getColumnCount() throws java.sql.SQLException { return fieldNames.length; } /** * What's a column's name? * * @param column the first column is 1, the second is 2, etc. * @return the column name * @exception java.sql.SQLException if a databvase access error occurs * * @author Mark Matthews <mma...@wo...> */ public String getColumnName(int column) throws java.sql.SQLException { return fieldNames[column]; } } --- NEW FILE: ObjRsMetaData.class --- Êþº¾ fieldNames Exceptions SourceFile *· --- NEW FILE: ObjRS.class --- Êþº¾ %& fieldNames Exceptions getBoolean Deprecated findColumn rowUpdated rowDeleted updateNull updateByte updateLong updateDate updateTime refreshRow updateBlob updateClob SourceFile ObjRS.java getMethods ¶ *µ --- NEW FILE: ObjRS.java --- package net.sourceforge.idrs.utils.rs; import java.io.InputStream; import java.io.Reader; import java.math.BigDecimal; import java.net.URL; import java.sql.Array; import java.sql.Blob; import java.sql.Clob; import java.sql.Date; import java.sql.Ref; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; import java.sql.Time; import java.sql.Timestamp; import java.util.Calendar; [...1195 lines suppressed...] /** * @see java.sql.ResultSet#updateClob(String, Clob) */ public void updateClob(String columnName, Clob x) throws SQLException { } /** * @see java.sql.ResultSet#updateArray(int, Array) */ public void updateArray(int columnIndex, Array x) throws SQLException { } /** * @see java.sql.ResultSet#updateArray(String, Array) */ public void updateArray(String columnName, Array x) throws SQLException { } } |
|
From: Marc B. <big...@us...> - 2003-03-13 20:57:48
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/utils/rs In directory sc8-pr-cvs1:/tmp/cvs-serv20663/dev/src/net/sourceforge/idrs/utils/rs Log Message: Directory /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/utils/rs added to the repository |
|
From: Marc B. <big...@us...> - 2003-02-17 02:48:52
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile
In directory sc8-pr-cvs1:/tmp/cvs-serv8260/dev/src/net/sourceforge/idrs/deploy/compile
Modified Files:
RmlCompiler.java
Log Message:
Added methods to assist in file upload
Index: RmlCompiler.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/RmlCompiler.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** RmlCompiler.java 6 Feb 2003 20:13:45 -0000 1.3
--- RmlCompiler.java 17 Feb 2003 02:48:48 -0000 1.4
***************
*** 34,37 ****
--- 34,38 ----
String errorWord;
String err;
+ int errLine;
/** Creates new RmlCompiler */
***************
*** 64,68 ****
} catch (Exception e) {
fail = true;
! e.printStackTrace(log);
}
--- 65,77 ----
} catch (Exception e) {
fail = true;
! this.xmlsrc = rml;
! this.err = e.toString();
! this.errLine = trans.getLine();
! this.errorWord = trans.getErrWord();
! log.println(rml);
! log.println("ERROR : " + err);
! log.println("Error Word : " + this.errorWord);
! log.println("Line : " + this.errLine);
! return;
}
***************
*** 70,78 ****
log.flush();
! if (fail) {
! log.println("Translation Failed");
! log.flush();
! return;
! }
LocatorImpl locator = new LocatorImpl();
--- 79,83 ----
log.flush();
!
LocatorImpl locator = new LocatorImpl();
***************
*** 119,122 ****
--- 124,128 ----
int lineNum = err.getLineNumber() == -1 ? rmlHandler.getLastLineNum() : err.getLineNumber();
log.println("Line: " + lineNum) ;
+ this.errLine = lineNum;
//}
***************
*** 184,187 ****
--- 190,201 ----
public void setXmlsrc(String xmlsrc) {
this.xmlsrc = xmlsrc;
+ }
+
+ /**
+ * Returns the errLine.
+ * @return int
+ */
+ public int getErrLine() {
+ return errLine;
}
|
|
From: Marc B. <big...@us...> - 2003-02-17 02:48:52
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/script/embedable
In directory sc8-pr-cvs1:/tmp/cvs-serv8260/dev/src/net/sourceforge/idrs/script/embedable
Modified Files:
IDRSShell.java
Log Message:
Added methods to assist in file upload
Index: IDRSShell.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/script/embedable/IDRSShell.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** IDRSShell.java 9 Sep 2002 21:27:44 -0000 1.6
--- IDRSShell.java 17 Feb 2003 02:48:48 -0000 1.7
***************
*** 182,184 ****
--- 182,196 ----
}
+ /**
+ * Retrieves the servlet context
+ */
+ public ServletContext getServletContext() {
+ return idrs.getServletContext();
+ }
+
+ /** retrieves the name of the last property set */
+ public String getPropParamName() {
+ return idrs.getPropParamName();
+ }
+
}
|
|
From: Marc B. <big...@us...> - 2003-02-17 02:48:52
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy
In directory sc8-pr-cvs1:/tmp/cvs-serv8260/dev/src/net/sourceforge/idrs/deploy
Modified Files:
RMLDeploy.java
Log Message:
Added methods to assist in file upload
Index: RMLDeploy.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/RMLDeploy.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** RMLDeploy.java 6 Feb 2003 20:13:44 -0000 1.5
--- RMLDeploy.java 17 Feb 2003 02:48:48 -0000 1.6
***************
*** 179,183 ****
// }
! public void setSrc(
String src,
PrintWriter logger,
--- 179,183 ----
// }
! public void setSrc (
String src,
PrintWriter logger,
***************
*** 185,189 ****
String rmlTrans,
boolean isFile,
! String rmlSchema) {
//System.out.println("Compile : " + compile);
if (compile) {
--- 185,189 ----
String rmlTrans,
boolean isFile,
! String rmlSchema) throws Exception {
//System.out.println("Compile : " + compile);
if (compile) {
***************
*** 210,214 ****
err = true;
exc = e;
! return;
}
} else {
--- 210,215 ----
err = true;
exc = e;
! throw e;
!
}
} else {
|
|
From: Marc B. <big...@us...> - 2003-02-17 02:48:52
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/utils
In directory sc8-pr-cvs1:/tmp/cvs-serv8260/dev/src/net/sourceforge/idrs/utils
Modified Files:
ObjectStore.java
Log Message:
Added methods to assist in file upload
Index: ObjectStore.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/utils/ObjectStore.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** ObjectStore.java 6 Feb 2003 20:13:45 -0000 1.9
--- ObjectStore.java 17 Feb 2003 02:48:48 -0000 1.10
***************
*** 40,43 ****
--- 40,44 ----
static final long serialVersionUID = 3570053539799841110L;
+ transient String propName;
transient IDRSScript idrs;
***************
*** 368,371 ****
--- 369,373 ----
buf.setLength(0);
buf.append(this.id).append('-').append("prop").append('_').append(propNames[i].substring(3));
+ this.propName = buf.toString();
//System.out.println("type : " + props[i].getParameterTypes()[0].isArray());
***************
*** 413,416 ****
--- 415,422 ----
public void setIdrs(IDRSScript idrs) {
this.idrs = idrs;
+ }
+
+ public String getPromParam() {
+ return this.propName;
}
|
|
From: Marc B. <big...@us...> - 2003-02-17 02:48:52
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro
In directory sc8-pr-cvs1:/tmp/cvs-serv8260/dev/src/net/sourceforge/idrs/deploy/macro
Modified Files:
MacroToXML.java
Log Message:
Added methods to assist in file upload
Index: MacroToXML.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro/MacroToXML.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** MacroToXML.java 22 Aug 2002 20:06:35 -0000 1.18
--- MacroToXML.java 17 Feb 2003 02:48:48 -0000 1.19
***************
*** 23,26 ****
--- 23,30 ----
*/
public class MacroToXML {
+ String errWord;
+ int line;
+
+
String rmlSrc;
Writer out;
***************
*** 67,70 ****
--- 71,77 ----
this.rmlNS=rmlNS;
+ this.line = 0;
+ this.errWord = null;
+
XMLReader xmlParser = XMLReaderFactory.createXMLReader(parser);
***************
*** 373,377 ****
*@param tag Tag to check
*/
! protected boolean isRMLTag(String tag) {
int begin=0, end=0,tmp;
--- 380,384 ----
*@param tag Tag to check
*/
! protected boolean isRMLTag(String tag) throws Exception {
int begin=0, end=0,tmp;
***************
*** 397,400 ****
--- 404,413 ----
}
+ if (tmp < 0) {
+ this.countLines(this.rmlSrc.indexOf(tag));
+ this.errWord = tag;
+ throw new Exception("The tag is not properly closed");
+ }
+
tagName = tag.substring(begin,tmp);
***************
*** 656,659 ****
--- 669,683 ----
}
+ protected void countLines(int pos) {
+ int begin = 0;
+
+ this.line = 0;
+ while (begin != -1 && begin < pos) {
+
+ line++;
+ begin = this.rmlSrc.indexOf('\n', begin +1);
+ }
+ }
+
***************
*** 668,671 ****
--- 692,711 ----
}
}*/
+ /**
+ * Returns the errWord.
+ * @return String
+ */
+ public String getErrWord() {
+ return errWord;
+ }
+
+ /**
+ * Returns the line.
+ * @return int
+ */
+ public int getLine() {
+ return line;
+ }
+
}
|
|
From: Marc B. <big...@us...> - 2003-02-17 02:48:52
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report
In directory sc8-pr-cvs1:/tmp/cvs-serv8260/dev/src/net/sourceforge/idrs/core/report
Modified Files:
IDRSHead.java
Log Message:
Added methods to assist in file upload
Index: IDRSHead.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report/IDRSHead.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** IDRSHead.java 6 Feb 2003 20:13:44 -0000 1.13
--- IDRSHead.java 17 Feb 2003 02:48:48 -0000 1.14
***************
*** 50,53 ****
--- 50,57 ----
protected transient HashMap connsInfo;
protected transient String digest;
+
+ protected transient ObjectStore currStore;
+
+
/*
public void preBuild(HashMap connsInfo) throws Exception {
***************
*** 186,189 ****
--- 190,194 ----
//obj = (ObjectStore) objects.get((String) keys.next());
obj = (ObjectStore) objects.get(objNames[l]);
+ this.currStore = obj;
obj.setIdrs(this);
varTypes = obj.getTypes();
***************
*** 724,727 ****
--- 729,737 ----
public ServletContext getServletContext() {
return this.context;
+ }
+
+ /** retrieves the name of the last property set */
+ public String getPropParamName() {
+ return this.currStore.getPromParam();
}
|
|
From: Marc B. <big...@us...> - 2003-02-17 02:48:51
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/servlet
In directory sc8-pr-cvs1:/tmp/cvs-serv8260/dev/src/net/sourceforge/idrs/core/servlet
Modified Files:
MultiPartRequest.java
Log Message:
Added methods to assist in file upload
Index: MultiPartRequest.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/servlet/MultiPartRequest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MultiPartRequest.java 27 Feb 2002 23:56:31 -0000 1.1
--- MultiPartRequest.java 17 Feb 2003 02:48:48 -0000 1.2
***************
*** 514,517 ****
--- 514,532 ----
+ public byte[] getParameterBytes(String key) {
+ DataSource ds;
+ if (params.get(key) instanceof DataSource[]) {
+ ds = ((DataSource[]) params.get(key))[0];
+ }
+ else if (params.get(key) instanceof DataSource) {
+ ds = ((DataSource) params.get(key));
+ }
+ else {
+ throw new IllegalArgumentException(key + " is not a file");
+ }
+
+ return ds.getBinaryContent();
+ }
+
public void saveFile(String key,String path) throws Exception {
DataSource ds;
|
|
From: Marc B. <big...@us...> - 2003-02-17 02:48:50
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/script
In directory sc8-pr-cvs1:/tmp/cvs-serv8260/dev/src/net/sourceforge/idrs/script
Modified Files:
IDRSScript.java
Log Message:
Added methods to assist in file upload
Index: IDRSScript.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/script/IDRSScript.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** IDRSScript.java 6 Feb 2003 20:13:46 -0000 1.9
--- IDRSScript.java 17 Feb 2003 02:48:47 -0000 1.10
***************
*** 142,144 ****
--- 142,147 ----
*/
public ServletContext getServletContext();
+
+ /** retrieves the name of the last property set */
+ public String getPropParamName();
}
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/units
In directory sc8-pr-cvs1:/tmp/cvs-serv26777/dev/src/net/sourceforge/idrs/deploy/compile/units
Modified Files:
Object.java Repeat.java IfChange.java Portal.java
IfResults.java Db.java Body.java
Log Message:
1. Moved controller code into servlet
2. Added the ability for properties to be arrays of strings
3. Moved config file into it's own xml file
4. Added better compile errors for rml pages
5. removed all debug printings
Index: Object.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/units/Object.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Object.java 23 Mar 2002 04:48:28 -0000 1.3
--- Object.java 6 Feb 2003 20:13:45 -0000 1.4
***************
*** 63,67 ****
--- 63,73 ----
*/
public void className (java.lang.String val, Attributes atts) throws Exception {
+ try {
obj.setClassName(val);
+ }
+ catch (Exception e) {
+ state.setErrorWord(val);
+ throw new Exception(val +" -- " + e.toString());
+ }
}
***************
*** 80,84 ****
*/
public void setProps(String val, Attributes atts) throws Exception {
! System.out.println("In SetProps : " + Boolean.getBoolean(val));
this.obj.retrieveProps(val.equalsIgnoreCase("true"));
}
--- 86,90 ----
*/
public void setProps(String val, Attributes atts) throws Exception {
! // System.out.println("In SetProps : " + Boolean.getBoolean(val));
this.obj.retrieveProps(val.equalsIgnoreCase("true"));
}
Index: Repeat.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/units/Repeat.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Repeat.java 4 Mar 2002 23:05:35 -0000 1.2
--- Repeat.java 6 Feb 2003 20:13:45 -0000 1.3
***************
*** 42,45 ****
--- 42,49 ----
this.atts = atts;
id = atts.getValue("id");
+ if (state.getReport().getHead().getAllDBs().get(id) == null) {
+ state.setErrorWord(id);
+ throw new Exception(id + " is not a valid db");
+ }
color1 = atts.getValue("color1");
color2 = atts.getValue("color2");
***************
*** 72,76 ****
state.sealLine();
Vector lines = state.popLines();
! System.out.println("num lines repeat : " + lines.size());
repLine.setLines(lines);
--- 76,80 ----
state.sealLine();
Vector lines = state.popLines();
! //System.out.println("num lines repeat : " + lines.size());
repLine.setLines(lines);
Index: IfChange.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/units/IfChange.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IfChange.java 4 Mar 2002 23:05:35 -0000 1.1
--- IfChange.java 6 Feb 2003 20:13:45 -0000 1.2
***************
*** 66,74 ****
public void setAttributes(Attributes atts) throws Exception {
this.atts = atts;
String fieldname = atts.getValue("field");
String dbname = fieldname.substring(0,fieldname.indexOf("."));
! System.out.println("IfChange DbName : " + dbname);
fieldname = fieldname.substring(fieldname.indexOf(".") + 1);
! System.out.println("IfChange FieldName : " + fieldname);
ifck = new IfChangeChunk(dbname,fieldname);
state.getReport().getBody().regIfChange(ifck);
--- 66,91 ----
public void setAttributes(Attributes atts) throws Exception {
this.atts = atts;
+
String fieldname = atts.getValue("field");
+ if (fieldname == null || fieldname.trim().length()==0) {
+ state.setErrorWord("");
+ throw new Exception("Db and Field Name required in ifChange");
+
+ }
+
+ if (fieldname.indexOf(".")==-1) {
+ state.setErrorWord(fieldname);
+ throw new Exception(fieldname + " needs to have a period");
+ }
String dbname = fieldname.substring(0,fieldname.indexOf("."));
! //System.out.println("IfChange DbName : " + dbname);
fieldname = fieldname.substring(fieldname.indexOf(".") + 1);
! //System.out.println("IfChange FieldName : " + fieldname);
!
! if (state.getReport().getHead().getAllDBs().get(dbname) == null) {
! state.setErrorWord(dbname);
! throw new Exception(dbname + " is not a valid Db");
! }
!
ifck = new IfChangeChunk(dbname,fieldname);
state.getReport().getBody().regIfChange(ifck);
Index: Portal.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/units/Portal.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Portal.java 22 Nov 2002 07:16:24 -0000 1.1
--- Portal.java 6 Feb 2003 20:13:45 -0000 1.2
***************
*** 43,48 ****
public void setAttributes(Attributes atts) throws Exception {
this.groups = atts.getValue("groups");
!
! portal = new PortalChunk(groups);
}
--- 43,54 ----
public void setAttributes(Attributes atts) throws Exception {
this.groups = atts.getValue("groups");
!
! try {
! portal = new PortalChunk(groups);
! }
! catch (Exception e) {
! state.setErrorWord(atts.getValue("groups"));
! throw new Exception(atts.getValue("groups") + " -- Must be a list of integers");
! }
}
***************
*** 72,76 ****
state.sealLine();
Vector lines = state.popLines();
! System.out.println("num lines repeat : " + lines.size());
portal.setLines(lines);
--- 78,82 ----
state.sealLine();
Vector lines = state.popLines();
! //System.out.println("num lines repeat : " + lines.size());
portal.setLines(lines);
Index: IfResults.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/units/IfResults.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IfResults.java 4 Mar 2002 23:05:35 -0000 1.1
--- IfResults.java 6 Feb 2003 20:13:45 -0000 1.2
***************
*** 46,49 ****
--- 46,53 ----
public void setAttributes(Attributes atts) throws Exception {
super.setAttributes(atts);
+ if (state.getReport().getHead().getAllDBs().get(atts.getValue("db") ) == null ) {
+ state.setErrorWord(atts.getValue("db"));
+ throw new Exception(atts.getValue("db") + " is not a valid Db");
+ }
ifrs = new IfResultsChunk(atts.getValue("db"));
}
Index: Db.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/units/Db.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Db.java 16 Sep 2002 15:19:42 -0000 1.6
--- Db.java 6 Feb 2003 20:13:45 -0000 1.7
***************
*** 90,93 ****
--- 90,97 ----
objid = atts.getValue("objid");
obj = this.state.getReport().getHead().getObjectStore(objid);
+ if (obj == null) {
+ state.setErrorWord(objid);
+ throw new Exception(objid + " is not a valid Object");
+ }
db.setType(DB.METHOD);
db.setObjectStore(obj);
***************
*** 112,115 ****
--- 116,123 ----
else if (val.equalsIgnoreCase("complete")) {
db.setTransactionType(DB.TRANS_COMPLETE);
+ }
+ else {
+ state.setErrorWord(val);
+ throw new Exception(val + " must be BEGIN or COMPLETE");
}
}
Index: Body.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/units/Body.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Body.java 22 Nov 2002 07:16:24 -0000 1.7
--- Body.java 6 Feb 2003 20:13:45 -0000 1.8
***************
*** 77,84 ****
--- 77,95 ----
public void field(String val,Attributes atts) throws Exception {
+
+ if (val.indexOf(".") == -1) {
+ state.setErrorWord(val);
+ throw new Exception("No Period Found");
+ }
String format = atts.getValue("format");
String id, field;
id = val.substring(0,val.indexOf("."));
+
+
field = val.substring(val.indexOf(".")+1);
+ if (state.getReport().getHead().getAllDBs().get(id) == null) {
+ state.setErrorWord(id);
+ throw new Exception(id + " is not a valid DB");
+ }
Line line = state.getCurrentLine();
***************
*** 92,95 ****
--- 103,110 ----
public void inputResults(String val,Attributes atts) throws Exception {
+ if (state.getReport().getHead().getAllDBs().get(val) == null) {
+ state.setErrorWord(val);
+ throw new Exception(val + " is not a valid DB");
+ }
Line line = state.getCurrentLine();
line.addChunk(new net.sourceforge.idrs.core.report.InputResultsChunk(val));
***************
*** 105,110 ****
public void text(String val,Attributes atts) throws Exception {
! System.out.println("val = \"" + val + "\"");
! System.out.println("this is : " + this);
/*if (val.indexOf('\n') != -1) {
StringTokenizer tok = new StringTokenizer(val,"\n",false);
--- 120,125 ----
public void text(String val,Attributes atts) throws Exception {
! //System.out.println("val = \"" + val + "\"");
! //System.out.println("this is : " + this);
/*if (val.indexOf('\n') != -1) {
StringTokenizer tok = new StringTokenizer(val,"\n",false);
***************
*** 131,134 ****
--- 146,159 ----
name = atts.getValue("name");
+ if (val.indexOf(".") == -1) {
+ state.setErrorWord(val);
+ throw new Exception("Not A Valid Source Field");
+ }
+
+ if (state.getReport().getHead().getAllDBs().get(val.substring(0,val.indexOf("."))) == null) {
+ state.setErrorWord(val);
+ throw new Exception(val.substring(0,val.indexOf(".")) + " is not a valid DB");
+ }
+
paramFirst = atts.getValue("paramFirst") != null ? atts.getValue("paramFirst").equalsIgnoreCase("true") : false;
***************
*** 149,153 ****
if (srcType.equalsIgnoreCase("param")) isrcType = YesNo.SRC_PARAM;
else if (srcType.equalsIgnoreCase("db")) isrcType = YesNo.SRC_DB;
! else isrcType = YesNo.SRC_PROP;
state.getCurrentLine().addChunk(new YesNo(name,isingle,isrcType,val,attribs,paramFirst));
--- 174,183 ----
if (srcType.equalsIgnoreCase("param")) isrcType = YesNo.SRC_PARAM;
else if (srcType.equalsIgnoreCase("db")) isrcType = YesNo.SRC_DB;
! else if (srcType.equalsIgnoreCase("db")) isrcType = YesNo.SRC_PROP;
! else {
! state.setErrorWord(srcType);
! throw new Exception(srcType + " is not a valid source type");
! }
!
state.getCurrentLine().addChunk(new YesNo(name,isingle,isrcType,val,attribs,paramFirst));
***************
*** 170,176 ****
int isrcType,isingle,itype=-1;
boolean paramFirst;
paramFirst = atts.getValue("paramFirst") != null ? atts.getValue("paramFirst").equalsIgnoreCase("true") : false;
! System.out.println("Param First : " + paramFirst);
value = atts.getValue("value");
--- 200,210 ----
int isrcType,isingle,itype=-1;
boolean paramFirst;
+
+
+
+
paramFirst = atts.getValue("paramFirst") != null ? atts.getValue("paramFirst").equalsIgnoreCase("true") : false;
! // System.out.println("Param First : " + paramFirst);
value = atts.getValue("value");
***************
*** 180,183 ****
--- 214,219 ----
name = atts.getValue("name");
type = atts.getValue("type");
+
+
itype = type.equalsIgnoreCase("hidden") ? InputChunk.INPUT_HIDDEN : itype;
***************
*** 187,190 ****
--- 223,233 ----
itype = type.equalsIgnoreCase("radio") ? InputChunk.INPUT_RADIO : itype;
itype = type.equalsIgnoreCase("textarea") ? InputChunk.INPUT_TEXTAREA : itype;
+ itype = type.equalsIgnoreCase("file") ? InputChunk.INPUT_FILE : itype;
+
+ if (itype != InputChunk.INPUT_TEXTAREA && itype != InputChunk.INPUT_HIDDEN && itype != InputChunk.INPUT_TEXT && itype != InputChunk.INPUT_PASSWORD && itype != InputChunk.INPUT_CHECKBOX && itype != InputChunk.INPUT_RADIO&& itype != InputChunk.INPUT_FILE) {
+ state.setErrorWord(type);
+ throw new Exception(type + " is not a valid input type");
+ }
+
***************
*** 195,199 ****
if (srcType.equalsIgnoreCase("param")) isrcType = YesNo.SRC_PARAM;
else if (srcType.equalsIgnoreCase("db")) isrcType = YesNo.SRC_DB;
! else isrcType = YesNo.SRC_PROP;
state.getCurrentLine().addChunk(new InputChunk(name,itype,isrcType,val,value,attribs,paramFirst));
--- 238,256 ----
if (srcType.equalsIgnoreCase("param")) isrcType = YesNo.SRC_PARAM;
else if (srcType.equalsIgnoreCase("db")) isrcType = YesNo.SRC_DB;
! else if (srcType.equalsIgnoreCase("prop")) isrcType = YesNo.SRC_PROP;
! else {
! state.setErrorWord(srcType);
! throw new Exception(srcType + " is not a valid source type");
! }
!
! if (isrcType == YesNo.SRC_DB && val.indexOf(".") == -1) {
! state.setErrorWord("");
! throw new Exception("Not A Valid Source Field");
! }
!
! if (isrcType == YesNo.SRC_DB && state.getReport().getHead().getAllDBs().get(val.substring(0,val.indexOf("."))) == null) {
! state.setErrorWord(val);
! throw new Exception(val.substring(0,val.indexOf(".")) + " is not a valid DB");
! }
state.getCurrentLine().addChunk(new InputChunk(name,itype,isrcType,val,value,attribs,paramFirst));
***************
*** 204,208 ****
* Handles the formInput tag
*/
! public void fromSelect(String val, Attributes atts) throws Exception {
String name,srcType,type, attribs,value,srcDB,lstId,lstVal;
int isrcType,isingle,itype=-1;
--- 261,265 ----
* Handles the formInput tag
*/
! public void formSelect(String val, Attributes atts) throws Exception {
String name,srcType,type, attribs,value,srcDB,lstId,lstVal;
int isrcType,isingle,itype=-1;
***************
*** 227,233 ****
if (srcType.equalsIgnoreCase("param")) isrcType = YesNo.SRC_PARAM;
else if (srcType.equalsIgnoreCase("db")) isrcType = YesNo.SRC_DB;
! else isrcType = YesNo.SRC_PROP;
srcDB = atts.getValue("srcDB");
lstId = atts.getValue("srcID");
lstVal = atts.getValue("srcVal");
--- 284,295 ----
if (srcType.equalsIgnoreCase("param")) isrcType = YesNo.SRC_PARAM;
else if (srcType.equalsIgnoreCase("db")) isrcType = YesNo.SRC_DB;
! else if (srcType.equalsIgnoreCase("db")) isrcType = YesNo.SRC_PROP;
! else {
! state.setErrorWord(srcType);
! throw new Exception(srcType + " is not a valid source type");
! }
srcDB = atts.getValue("srcDB");
+
lstId = atts.getValue("srcID");
lstVal = atts.getValue("srcVal");
***************
*** 252,256 ****
Vector lines = state.popLines();
! System.out.println("body lines : " + lines.size());
state.getReport().getBody().setLines(lines);
state.getReport().getBody().seal();
--- 314,318 ----
Vector lines = state.popLines();
! // System.out.println("body lines : " + lines.size());
state.getReport().getBody().setLines(lines);
state.getReport().getBody().seal();
|
|
From: Marc B. <big...@us...> - 2003-02-06 20:13:50
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/script
In directory sc8-pr-cvs1:/tmp/cvs-serv26777/dev/src/net/sourceforge/idrs/script
Modified Files:
IDRSScript.java
Log Message:
1. Moved controller code into servlet
2. Added the ability for properties to be arrays of strings
3. Moved config file into it's own xml file
4. Added better compile errors for rml pages
5. removed all debug printings
Index: IDRSScript.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/script/IDRSScript.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** IDRSScript.java 9 Sep 2002 21:27:44 -0000 1.8
--- IDRSScript.java 6 Feb 2003 20:13:46 -0000 1.9
***************
*** 138,140 ****
--- 138,144 ----
public String getError() ;
+ /**
+ * Retrieves the servlet context
+ */
+ public ServletContext getServletContext();
}
|
|
From: Marc B. <big...@us...> - 2003-02-06 20:13:49
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy
In directory sc8-pr-cvs1:/tmp/cvs-serv26777/dev/src/net/sourceforge/idrs/deploy
Modified Files:
HotDeploy.java RMLDeploy.java
Log Message:
1. Moved controller code into servlet
2. Added the ability for properties to be arrays of strings
3. Moved config file into it's own xml file
4. Added better compile errors for rml pages
5. removed all debug printings
Index: HotDeploy.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/HotDeploy.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** HotDeploy.java 23 Mar 2002 04:48:27 -0000 1.4
--- HotDeploy.java 6 Feb 2003 20:13:44 -0000 1.5
***************
*** 168,172 ****
dep.deploy();
!
if (dep.isError()) {
dep.getException().printStackTrace(out);
--- 168,172 ----
dep.deploy();
! dep.getPsUsed().close();
if (dep.isError()) {
dep.getException().printStackTrace(out);
Index: RMLDeploy.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/RMLDeploy.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** RMLDeploy.java 23 Mar 2002 04:48:27 -0000 1.4
--- RMLDeploy.java 6 Feb 2003 20:13:44 -0000 1.5
***************
*** 23,359 ****
*/
public final class RMLDeploy {
! String name, groups, params, conns;
! int id, min, max, results;
! boolean compile, update, err;
! String src;
! IDRSRep report;
! Connection con;
! LinkedList names, vals;
! Exception exc;
! ByteArrayInputStream bais;
! byte[] bytes;
!
! /**
! * Initializes list of options
! */
! public RMLDeploy(Connection con) {
! this.con = con;
! this.names = new LinkedList();
! this.vals = new LinkedList();
! compile = true;
! update = false;
! err = false;
! }
! /**
! * Sets the update flag
! * @param update Wether or not this is an update of a current deployment or a new one
! */
! public void setUpdate(boolean update) {
! this.update = update;
! }
! /**
! * Sets the compile flag
! * @param compile Wether or not the RML needs to be compiled
! */
! public void setCompile(boolean compile) {
! this.compile = compile;
! }
! /**
! * Sets the ID of the page
! * @param id ID of the page
! */
! public void setID(int id) {
! this.id = id;
! names.add("DocID");
! vals.add(new Integer(id));
! }
! /**
! * Sets the Name of the page
! * @param name Name of the page
! */
! public void setName(String name) {
! this.name = name;
! names.add("DocName");
! vals.add(name);
! }
! /**
! * Sets the Groups of the page
! * @param groups Groups of the page
! */
! public void setGroups(String groups) {
! this.groups = groups;
! names.add("DocGroups");
! vals.add(groups);
! }
! /**
! * Sets the Params of the page
! * @param params Params of the page
! */
! public void setParams(String params) {
! this.params = params;
! names.add("DocParams");
! vals.add(params);
! }
! /**
! * Sets the Connections of the page
! * @param conns Connections of the page
! */
! public void setConns(String conns) {
! this.conns = conns;
! names.add("DocConns");
! vals.add(conns);
! }
! /**
! * Sets the minimum number of instances in the pool of the page
! * @param min Minimum instances of the page
! */
! public void setMin(int min) {
! this.min = min;
! names.add("DocMin");
! vals.add(new Integer(min));
! }
! /**
! * Sets the maximum number of instances in the pool of the page
! * @param max Maximum instances of the page
! */
! public void setMax(int max) {
! this.max = max;
! names.add("DocMax");
! vals.add(new Integer(max));
! }
! /**
! * Sets the page's source, wether it's been compiled or not and takes apropriate action.<br>
! * If compile is true, then the page is considered RML source and and compiled. Otherwise the compiled source is Deserialized.
! * @param src The source of the page
! * @param logger Either a PrintWriter or a PrintStream for logging output of the compile
! */
! public void setSrc(String src,Object logger) {
! if (compile) {
! try {
! report = (new IDRSCompiler((String) src, false)).setLogger(logger).buildReport();
!
! ByteArrayOutputStream baos = new ByteArrayOutputStream();
! ObjectOutputStream oos = new ObjectOutputStream(baos);
! oos.writeObject(report);
! bais = new ByteArrayInputStream(baos.toByteArray());
! bytes=baos.toByteArray();
! }
! catch (Exception e) {
! err = false;
! exc = e;
! return;
! }
! }
! else {
! bytes = src.getBytes();
! }
! bais = new ByteArrayInputStream(bytes);
! names.add("DocSrc");
! vals.add(bais);
! }
!
! public void setSrc(String src,PrintWriter logger,String parseClass,String rmlTrans,boolean isFile,String rmlSchema) {
! System.out.println("Compile : " + compile);
! if (compile) {
! try {
! //report = (new IDRSCompiler((String) src, false)).setLogger(logger).buildReport();
! RmlCompiler comp = new RmlCompiler(logger,src,parseClass,rmlTrans,isFile,rmlSchema);
!
! report = comp.getReport();
! ByteArrayOutputStream baos = new ByteArrayOutputStream();
! ObjectOutputStream oos = new ObjectOutputStream(baos);
! oos.writeObject(report);
! bais = new ByteArrayInputStream(baos.toByteArray());
! bytes=baos.toByteArray();
! }
! catch (Exception e) {
!
! e.printStackTrace(logger);
! err = true;
! exc = e;
! return;
! }
! }
! else {
! bytes = src.getBytes();
! }
! bais = new ByteArrayInputStream(bytes);
! names.add("DocSrc");
! vals.add(bais);
! }
! /**
! * Deploys the report to the database based on the connection provided to the constructor
! */
! public boolean deploy() throws Exception {
! String SQL;
! int i, m;
! Object[] vals;
! PreparedStatement ps;
! try {
! //Generate an SQL statement
! if (update) {
! SQL = deployUpdate();
! }
! else {
! SQL = deployInsert();
! }
!
! System.out.println(SQL);
! //Loop through all vals and set them using set object or as a strem if it's a report
! vals = this.vals.toArray();
! ps = con.prepareStatement(SQL);
! for (i = 0, m = vals.length; i < m; i++) {
! System.out.println(vals[i]);
! if (vals[i] instanceof ByteArrayInputStream) {
! ps.setBinaryStream(i + 1, bais, bytes.length);
! }
! else {
! ps.setObject(i + 1, vals[i]);
! }
! }
! if (update) {
! if (this.name != null) {
! ps.setString(vals.length+1, this.name);
! }
! else {
! ps.setInt(vals.length+1, this.id);
! }
! }
! this.results = ps.executeUpdate();
! ps.close();
! if (this.results < 1) {
! throw new Exception("No Rows Effected By Update");
! }
! }
! catch (Exception e) {
! this.exc = e;
! this.err = true;
! }
! return !this.err;
! }
! /**
! * Builds an SQL UPDATE statement for use in a PreparedStatement
! */
! protected String deployUpdate() throws Exception {
! try {
! Object[] vals, names;
! vals = this.vals.toArray();
! names = this.names.toArray();
! String snames = "", svals = "";
! int i, m;
! String SQL;
! //Construct A SQL string
! for (i = 0, m = names.length; i < m; i++) {
! snames += (String) names[i] + "=? ,";
! System.out.println(names[i]);
! }
! SQL =
! "UPDATE tblDoc SET "
! + snames.substring(0, snames.lastIndexOf(",") - 1)
! + " WHERE ";
! if (this.name != null) {
! SQL += "DocName=?";
! }
! else {
! SQL += "DocID=?";
! }
! return SQL;
! }
! catch (Exception e) {
! throw e;
! }
! }
! /**
! * Builds an SQL INSERT statement for use in a PreparedStatement
! */
! protected String deployInsert() throws Exception {
! try {
! Object[] vals, names;
! vals = this.vals.toArray();
! names = this.names.toArray();
! String snames = "", svals = "";
! int i, m;
! String SQL;
! //Construct A SQL string
! for (i = 0, m = names.length; i < m; i++) {
! snames += (String) names[i] + " ,";
! svals += "? , ";
! System.out.println(names[i]);
! }
! SQL =
! "INSERT INTO tblDoc ("
! + snames.substring(0, snames.lastIndexOf(",") - 1)
! + ") VALUES("
! + svals.substring(0, svals.lastIndexOf(",") - 1)
! + ")";
! return SQL;
! }
! catch (Exception e) {
! throw e;
! }
! }
!
! /**
! * Returns any eception that has occurred
! */
! public Exception getException() {
! return this.exc;
! }
! /**
! * Returns weth or not an error has occurred
! */
! public boolean isError() {
! return this.err;
! }
!
!
! }
--- 23,389 ----
*/
public final class RMLDeploy {
! String name, groups, params, conns;
! PreparedStatement psUsed;
! int id, min, max, results;
! boolean compile, update, err;
! RmlCompiler compiler;
! String src;
! IDRSRep report;
! Connection con;
! LinkedList names, vals;
! Exception exc;
! ByteArrayInputStream bais;
! byte[] bytes;
! /**
! * Initializes list of options
! */
! public RMLDeploy(Connection con) {
! this.con = con;
! this.names = new LinkedList();
! this.vals = new LinkedList();
! compile = true;
! update = false;
! err = false;
! }
! /**
! * Sets the update flag
! * @param update Wether or not this is an update of a current deployment or a new one
! */
! public void setUpdate(boolean update) {
! this.update = update;
! }
! /**
! * Sets the compile flag
! * @param compile Wether or not the RML needs to be compiled
! */
! public void setCompile(boolean compile) {
! this.compile = compile;
! }
! /**
! * Sets the ID of the page
! * @param id ID of the page
! */
! public void setID(int id) {
! this.id = id;
! names.add("DocID");
! vals.add(new Integer(id));
! }
! /**
! * Sets the Name of the page
! * @param name Name of the page
! */
! public void setName(String name) {
! this.name = name;
! names.add("DocName");
! vals.add(name);
! }
! /**
! * Sets the Groups of the page
! * @param groups Groups of the page
! */
! public void setGroups(String groups) {
! this.groups = groups;
! names.add("DocGroups");
! vals.add(groups);
! }
! /**
! * Sets the Params of the page
! * @param params Params of the page
! */
! public void setParams(String params) {
! this.params = params;
! names.add("DocParams");
! vals.add(params);
! }
! /**
! * Sets the Connections of the page
! * @param conns Connections of the page
! */
! public void setConns(String conns) {
! this.conns = conns;
! names.add("DocConns");
! vals.add(conns);
! }
! /**
! * Sets the minimum number of instances in the pool of the page
! * @param min Minimum instances of the page
! */
! public void setMin(int min) {
! this.min = min;
! names.add("DocMin");
! vals.add(new Integer(min));
! }
! /**
! * Sets the maximum number of instances in the pool of the page
! * @param max Maximum instances of the page
! */
! public void setMax(int max) {
! this.max = max;
! names.add("DocMax");
! vals.add(new Integer(max));
! }
! // /**
! // * Sets the page's source, wether it's been compiled or not and takes apropriate action.<br>
! // * If compile is true, then the page is considered RML source and and compiled. Otherwise the compiled source is Deserialized.
! // * @param src The source of the page
! // * @param logger Either a PrintWriter or a PrintStream for logging output of the compile
! // */
! //
! // public void setSrc(String src,Object logger) {
! // if (compile) {
! // try {
! // this.compiler = new IDRSCompiler((String) src, false);
! // report = compiler.setLogger(logger).buildReport();
! //
! // ByteArrayOutputStream baos = new ByteArrayOutputStream();
! // ObjectOutputStream oos = new ObjectOutputStream(baos);
! // oos.writeObject(report);
! // bais = new ByteArrayInputStream(baos.toByteArray());
! // bytes=baos.toByteArray();
! // }
! // catch (Exception e) {
! // err = false;
! // exc = e;
! // return;
! // }
! // }
! // else {
! // bytes = src.getBytes();
! // }
! //
! // bais = new ByteArrayInputStream(bytes);
! // names.add("DocSrc");
! // vals.add(bais);
! // }
! public void setSrc(
! String src,
! PrintWriter logger,
! String parseClass,
! String rmlTrans,
! boolean isFile,
! String rmlSchema) {
! //System.out.println("Compile : " + compile);
! if (compile) {
! try {
! //report = (new IDRSCompiler((String) src, false)).setLogger(logger).buildReport();
! this.compiler =
! new RmlCompiler(
! logger,
! src,
! parseClass,
! rmlTrans,
! isFile,
! rmlSchema);
! report = compiler.getReport();
! ByteArrayOutputStream baos = new ByteArrayOutputStream();
! ObjectOutputStream oos = new ObjectOutputStream(baos);
! oos.writeObject(report);
! bais = new ByteArrayInputStream(baos.toByteArray());
! bytes = baos.toByteArray();
! } catch (Exception e) {
! e.printStackTrace(logger);
! err = true;
! exc = e;
! return;
! }
! } else {
! bytes = src.getBytes();
! }
!
! this.err = compiler.getErr() != null;
! bais = new ByteArrayInputStream(bytes);
! names.add("DocSrc");
! vals.add(bais);
! }
! /**
! * Deploys the report to the database based on the connection provided to the constructor
! */
! public boolean deploy() throws Exception {
! String SQL;
! int i, m;
! Object[] vals;
! PreparedStatement ps;
! try {
! //Generate an SQL statement
! if (update) {
! SQL = deployUpdate();
! } else {
! SQL = deployInsert();
! }
! //System.out.println(SQL);
! //Loop through all vals and set them using set object or as a strem if it's a report
! vals = this.vals.toArray();
! ps = con.prepareStatement(SQL);
! for (i = 0, m = vals.length; i < m; i++) {
! //System.out.println(vals[i]);
! if (vals[i] instanceof ByteArrayInputStream) {
! ps.setBinaryStream(i + 1, bais, bytes.length);
! } else {
! ps.setObject(i + 1, vals[i]);
! }
! }
! if (update) {
! if (this.name != null) {
! ps.setString(vals.length + 1, this.name);
! } else {
! ps.setInt(vals.length + 1, this.id);
! }
! }
! this.results = ps.executeUpdate();
! //ps.close();
! this.psUsed = ps;
! if (this.results < 1) {
! throw new Exception("No Rows Effected By Update");
! }
! } catch (Exception e) {
! this.exc = e;
! this.err = true;
! }
! return !this.err;
! }
! /**
! * Builds an SQL UPDATE statement for use in a PreparedStatement
! */
! protected String deployUpdate() throws Exception {
! try {
! Object[] vals, names;
! vals = this.vals.toArray();
! names = this.names.toArray();
! String snames = "", svals = "";
! int i, m;
! String SQL;
! //Construct A SQL string
! for (i = 0, m = names.length; i < m; i++) {
! snames += (String) names[i] + "=? ,";
! System.out.println(names[i]);
! }
! SQL =
! "UPDATE tblDoc SET "
! + snames.substring(0, snames.lastIndexOf(",") - 1)
! + " WHERE ";
! if (this.name != null) {
! SQL += "DocName=?";
! } else {
! SQL += "DocID=?";
! }
! return SQL;
! } catch (Exception e) {
! throw e;
! }
! }
! /**
! * Builds an SQL INSERT statement for use in a PreparedStatement
! */
! protected String deployInsert() throws Exception {
! try {
! Object[] vals, names;
! vals = this.vals.toArray();
! names = this.names.toArray();
! String snames = "", svals = "";
! int i, m;
! String SQL;
! //Construct A SQL string
! for (i = 0, m = names.length; i < m; i++) {
! snames += (String) names[i] + " ,";
! svals += "? , ";
! System.out.println(names[i]);
! }
! SQL =
! "INSERT INTO tblDoc ("
! + snames.substring(0, snames.lastIndexOf(",") - 1)
! + ") VALUES("
! + svals.substring(0, svals.lastIndexOf(",") - 1)
! + ")";
! return SQL;
! } catch (Exception e) {
! throw e;
! }
! }
! /**
! * Returns any eception that has occurred
! */
! public Exception getException() {
! return this.exc;
! }
!
! /**
! * Returns weth or not an error has occurred
! */
+ public boolean isError() {
+ return this.err;
+ }
+
+ /**
+ * Returns the compiler.
+ * @return RmlCompiler
+ */
+ public RmlCompiler getCompiler() {
+ return compiler;
+ }
+
+ /**
+ * Sets the compiler.
+ * @param compiler The compiler to set
+ */
+ public void setCompiler(RmlCompiler compiler) {
+ this.compiler = compiler;
+ }
+
+ /**
+ * Returns the psUsed.
+ * @return PreparedStatement
+ */
+ public PreparedStatement getPsUsed() {
+ return psUsed;
+ }
+
+ }
|
|
From: Marc B. <big...@us...> - 2003-02-06 20:13:49
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/utils
In directory sc8-pr-cvs1:/tmp/cvs-serv26777/dev/src/net/sourceforge/idrs/utils
Modified Files:
ObjectStore.java UserInfo.java CleanUp.java
Log Message:
1. Moved controller code into servlet
2. Added the ability for properties to be arrays of strings
3. Moved config file into it's own xml file
4. Added better compile errors for rml pages
5. removed all debug printings
Index: ObjectStore.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/utils/ObjectStore.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** ObjectStore.java 8 Jan 2003 06:01:01 -0000 1.8
--- ObjectStore.java 6 Feb 2003 20:13:45 -0000 1.9
***************
*** 200,204 ****
Class objClass;
Class[] propArgs = new Class[1];
! propArgs[0] = "".getClass();
this.methods=new HashMap();
--- 200,206 ----
Class objClass;
Class[] propArgs = new Class[1];
!
!
!
this.methods=new HashMap();
***************
*** 210,216 ****
try {
! init.invoke(obj,vals);
!
((CleanUp) obj).setContext(this.idrs);
int i;
--- 212,219 ----
try {
! ((CleanUp) obj).reload();
((CleanUp) obj).setContext(this.idrs);
+ init.invoke(obj,vals);
+
int i;
***************
*** 229,233 ****
this.props = new Method[propNames.length];
for (i=0;i<propNames.length;i++) {
! props[i] = objClass.getMethod(propNames[i],propArgs);
}
}
--- 232,245 ----
this.props = new Method[propNames.length];
for (i=0;i<propNames.length;i++) {
!
! try {
! propArgs[0] = "".getClass();
! props[i] = objClass.getMethod(propNames[i],propArgs);
! } catch (NoSuchMethodException e) {
! propArgs[0] = String[].class;
! props[i] = objClass.getMethod(propNames[i],propArgs);
! }
!
!
}
}
***************
*** 236,240 ****
}
catch (Exception e) {
! throw new Exception("No init method");
}
}
--- 248,252 ----
}
catch (Exception e) {
! throw e;
}
}
***************
*** 351,369 ****
StringBuffer buf = new StringBuffer();
String[] args = new String[1];
String[] vals;
for (int i=0,m=this.propNames.length;i<m;i++) {
buf.setLength(0);
buf.append(this.id).append('-').append("prop").append('_').append(propNames[i].substring(3));
! args[0] = req.getParameter(buf.toString());
- /*if (vals == null) {
- args[0] = req.getParameter(buf.toString());
- }
- else {
- args[0] = vals;
- }*/
//args[0] = vals.length==1 ? vals[0] : vals;
! props[i].invoke(this.obj,args);
}
--- 363,398 ----
StringBuffer buf = new StringBuffer();
String[] args = new String[1];
+ Object[] objArgs;
String[] vals;
for (int i=0,m=this.propNames.length;i<m;i++) {
buf.setLength(0);
buf.append(this.id).append('-').append("prop").append('_').append(propNames[i].substring(3));
! //System.out.println("type : " + props[i].getParameterTypes()[0].isArray());
!
! if (props[i].getParameterTypes()[0].isArray()) {
! vals = req.getParameterValues(buf.toString());
! objArgs = new Object[]{vals};
! props[i].invoke(this.obj,objArgs);
! }
! else {
! args[0] = req.getParameter(buf.toString());
! props[i].invoke(this.obj,args);
! }
!
+
+
+
+ // vals = req.getParameterValues(buf.toString());
+ // if (vals == null || vals.length == 1) {
+ // args[0] = req.getParameter(buf.toString());
+ // }
+ // else {
+ // args[0] = vals;
+ // }
+ //
//args[0] = vals.length==1 ? vals[0] : vals;
!
}
Index: UserInfo.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/utils/UserInfo.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** UserInfo.java 18 Sep 2001 03:18:57 -0000 1.3
--- UserInfo.java 6 Feb 2003 20:13:45 -0000 1.4
***************
*** 53,60 ****
public boolean inGroup(int group) throws Exception {
boolean found = false;
! System.out.println("group : " + group);
for (int i=0, m=groups.length;i<m;i++) {
! System.out.println(groups[i]);
if (groups[i] == group) {
found =true;
--- 53,60 ----
public boolean inGroup(int group) throws Exception {
boolean found = false;
! //System.out.println("group : " + group);
for (int i=0, m=groups.length;i<m;i++) {
! //System.out.println(groups[i]);
if (groups[i] == group) {
found =true;
Index: CleanUp.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/utils/CleanUp.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** CleanUp.java 29 Dec 2002 04:01:56 -0000 1.3
--- CleanUp.java 6 Feb 2003 20:13:45 -0000 1.4
***************
*** 3,12 ****
import java.sql.*;
import java.util.*;
! public class CleanUp extends Validators {
protected transient LinkedList statements;
public CleanUp() {
! this.statements = new LinkedList();
}
--- 3,19 ----
import java.sql.*;
import java.util.*;
+ import java.io.*;
! public class CleanUp extends Validators implements Serializable {
! static final long serialVersionUID = -6760151742357546179L;
protected transient LinkedList statements;
public CleanUp() {
!
!
! }
!
! public void reload() {
! this.statements = new LinkedList();
}
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report
In directory sc8-pr-cvs1:/tmp/cvs-serv26777/dev/src/net/sourceforge/idrs/core/report
Modified Files:
IDRSHead.java GenTag.java IfResultsChunk.java
NavigateChunk.java InputChunk.java Line.java
Log Message:
1. Moved controller code into servlet
2. Added the ability for properties to be arrays of strings
3. Moved config file into it's own xml file
4. Added better compile errors for rml pages
5. removed all debug printings
Index: IDRSHead.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report/IDRSHead.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** IDRSHead.java 8 Jan 2003 06:01:30 -0000 1.12
--- IDRSHead.java 6 Feb 2003 20:13:44 -0000 1.13
***************
*** 23,26 ****
--- 23,27 ----
protected transient HashMap trans;
protected String[] objNames, dbNames;
+ protected transient ServletContext context;
***************
*** 146,150 ****
*/
public void init(HashMap conns, int userNum, int docID, String url, HttpSession session,
! HttpServletRequest request,HttpServletResponse response, Application app, IDRSScriptLanguage context,UserInfo userInfo,String digest) throws Exception {
this.digest = digest;
--- 147,152 ----
*/
public void init(HashMap conns, int userNum, int docID, String url, HttpSession session,
! HttpServletRequest request,HttpServletResponse response, Application app, IDRSScriptLanguage context,UserInfo userInfo,String digest,ServletContext servcontext) throws Exception {
! this.context = servcontext;
this.digest = digest;
***************
*** 227,231 ****
//key = (String) keys.next();
key = dbNames[l];
! System.out.println("KEY : " + key);
db = (DB) dbs.get(key);
if (conns != null) {
--- 229,233 ----
//key = (String) keys.next();
key = dbNames[l];
! // System.out.println("KEY : " + key);
db = (DB) dbs.get(key);
if (conns != null) {
***************
*** 393,397 ****
ObjectStore objstr = (ObjectStore) objects.get(obj);
if (objstr == null)
! throw new Exception("No Object defined : " + obj);
return objstr.getRef();
--- 395,399 ----
ObjectStore objstr = (ObjectStore) objects.get(obj);
if (objstr == null)
! return null;
return objstr.getRef();
***************
*** 656,662 ****
public void createError(String err) {
! System.out.println("Error 1: " + err);
request.setAttribute(ERR_NAME,err);
! System.out.println("Error 2: " + request.getAttribute(ERR_NAME));
}
--- 658,664 ----
public void createError(String err) {
! //System.out.println("Error 1: " + err);
request.setAttribute(ERR_NAME,err);
! // System.out.println("Error 2: " + request.getAttribute(ERR_NAME));
}
***************
*** 667,671 ****
*/
public boolean isError() {
! System.out.println("Error : " + request.getAttribute(ERR_NAME));
return request.getAttribute(ERR_NAME) != null;
}
--- 669,673 ----
*/
public boolean isError() {
! //System.out.println("Error : " + request.getAttribute(ERR_NAME));
return request.getAttribute(ERR_NAME) != null;
}
***************
*** 717,721 ****
}
!
--- 719,728 ----
}
! /**
! * Retrieves the servlet context
! */
! public ServletContext getServletContext() {
! return this.context;
! }
Index: GenTag.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report/GenTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** GenTag.java 8 Jan 2003 06:01:28 -0000 1.3
--- GenTag.java 6 Feb 2003 20:13:44 -0000 1.4
***************
*** 180,184 ****
sval = head.getRequest().getParameter(name);
if (sval == null) {
! System.out.println("Getting db value " + owner + "." + src + " : " + head.getFieldData(owner,src));
return (sval = head.getFieldData(owner,src)) != null ? sval : "";
}
--- 180,184 ----
sval = head.getRequest().getParameter(name);
if (sval == null) {
! // System.out.println("Getting db value " + owner + "." + src + " : " + head.getFieldData(owner,src));
return (sval = head.getFieldData(owner,src)) != null ? sval : "";
}
***************
*** 188,192 ****
}
else {
! System.out.println("Getting db value " + owner + "." + src + " : " + head.getFieldData(owner,src));
return (sval = head.getFieldData(owner,src)) != null ? sval : "";
}
--- 188,192 ----
}
else {
! // System.out.println("Getting db value " + owner + "." + src + " : " + head.getFieldData(owner,src));
return (sval = head.getFieldData(owner,src)) != null ? sval : "";
}
Index: IfResultsChunk.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report/IfResultsChunk.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** IfResultsChunk.java 4 Mar 2002 23:05:34 -0000 1.4
--- IfResultsChunk.java 6 Feb 2003 20:13:44 -0000 1.5
***************
*** 160,168 ****
this.velines = lines;
setYes = true;
! System.out.println("Set Yes");
}
else {
this.vdlines = lines;
! System.out.println("Set No");
}
--- 160,168 ----
this.velines = lines;
setYes = true;
! //System.out.println("Set Yes");
}
else {
this.vdlines = lines;
! //System.out.println("Set No");
}
Index: NavigateChunk.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report/NavigateChunk.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** NavigateChunk.java 21 Sep 2002 16:14:46 -0000 1.3
--- NavigateChunk.java 6 Feb 2003 20:13:45 -0000 1.4
***************
*** 67,71 ****
adjustedPos = adjustPosition(db);
! System.out.println("Begining : " + adjustedPos);
returnLink = returnLink || ((adjustedPos >= 0) && (adjustedPos <= db.getNumberRows()));
--- 67,71 ----
adjustedPos = adjustPosition(db);
! //System.out.println("Begining : " + adjustedPos);
returnLink = returnLink || ((adjustedPos >= 0) && (adjustedPos <= db.getNumberRows()));
Index: InputChunk.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report/InputChunk.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** InputChunk.java 8 Jan 2003 06:01:30 -0000 1.2
--- InputChunk.java 6 Feb 2003 20:13:45 -0000 1.3
***************
*** 20,23 ****
--- 20,25 ----
public static final int INPUT_TEXTAREA = 4;
public static final int INPUT_HIDDEN = 5;
+ public static final int INPUT_FILE = 6;
+
String value;
***************
*** 45,48 ****
--- 47,51 ----
case INPUT_TEXT : getTextTag(nm,"TEXT",head,tag); break;
case INPUT_PASSWORD : getTextTag(nm,"PASSWORD",head,tag); break;
+ case INPUT_FILE : getTextTag(nm,"FILE",head,tag); break;
case INPUT_RADIO : getBoolTag(nm,"RADIO",head,tag); break;
case INPUT_CHECKBOX : getBoolTag(nm,"CHECKBOX",head,tag); break;
Index: Line.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report/Line.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Line.java 22 Nov 2002 07:16:24 -0000 1.5
--- Line.java 6 Feb 2003 20:13:45 -0000 1.6
***************
*** 53,57 ****
//StringBuffer vals = new StringBuffer("");
Chunk ch;
! System.out.println("Number of chunks : " + chunks.length);
for (int i=0; i<chunks.length;i++) {
ch = chunks[i];
--- 53,57 ----
//StringBuffer vals = new StringBuffer("");
Chunk ch;
! //System.out.println("Number of chunks : " + chunks.length);
for (int i=0; i<chunks.length;i++) {
ch = chunks[i];
|
|
From: Marc B. <big...@us...> - 2003-02-06 20:13:49
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/test
In directory sc8-pr-cvs1:/tmp/cvs-serv26777/dev/src/net/sourceforge/idrs/test
Modified Files:
IDRSTester.java
Log Message:
1. Moved controller code into servlet
2. Added the ability for properties to be arrays of strings
3. Moved config file into it's own xml file
4. Added better compile errors for rml pages
5. removed all debug printings
Index: IDRSTester.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/test/IDRSTester.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** IDRSTester.java 22 Nov 2002 07:16:24 -0000 1.2
--- IDRSTester.java 6 Feb 2003 20:13:44 -0000 1.3
***************
*** 92,96 ****
public void executeHead() throws Exception {
! rep.getHead().init(conns,user.getUserID(),docID,request.getRequestURL().toString(),(HttpSession) session,(HttpServletRequest) request,(HttpServletResponse) response,app,script,user,digest);
}
--- 92,96 ----
public void executeHead() throws Exception {
! rep.getHead().init(conns,user.getUserID(),docID,request.getRequestURL().toString(),(HttpSession) session,(HttpServletRequest) request,(HttpServletResponse) response,app,script,user,digest,null);
}
|
|
From: Marc B. <big...@us...> - 2003-02-06 20:13:48
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile
In directory sc8-pr-cvs1:/tmp/cvs-serv26777/dev/src/net/sourceforge/idrs/deploy/compile
Modified Files:
RmlCompiler.java Compiler.java RMLHandler.java
CompilerState.java
Added Files:
RmlErrorHandler.java
Log Message:
1. Moved controller code into servlet
2. Added the ability for properties to be arrays of strings
3. Moved config file into it's own xml file
4. Added better compile errors for rml pages
5. removed all debug printings
--- NEW FILE: RmlErrorHandler.java ---
package net.sourceforge.idrs.deploy.compile;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/**
* @author mlb
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class RmlErrorHandler implements ErrorHandler {
SAXParseException e;
int lineNumber;
/**
* Constructor for RmlErrorHandler.
*/
public RmlErrorHandler() {
super();
lineNumber = -1;
}
/**
* @see org.xml.sax.ErrorHandler#warning(SAXParseException)
*/
public void warning(SAXParseException exception) throws SAXException {
//this.e = exception;
//throw new SAXException("warning : " + exception.getLineNumber());
}
/**
* @see org.xml.sax.ErrorHandler#error(SAXParseException)
*/
public void error(SAXParseException exception) throws SAXException {
this.lineNumber = exception.getLineNumber();
throw exception;
}
/**
* @see org.xml.sax.ErrorHandler#fatalError(SAXParseException)
*/
public void fatalError(SAXParseException exception) throws SAXException {
this.lineNumber = exception.getLineNumber();
throw exception;
}
public SAXParseException getException() {
return e;
}
/**
* Returns the lineNumber.
* @return int
*/
public int getLineNumber() {
return lineNumber;
}
}
Index: RmlCompiler.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/RmlCompiler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RmlCompiler.java 23 Mar 2002 04:48:27 -0000 1.2
--- RmlCompiler.java 6 Feb 2003 20:13:45 -0000 1.3
***************
*** 15,19 ****
*/
-
package net.sourceforge.idrs.deploy.compile;
--- 15,18 ----
***************
*** 25,29 ****
import javax.xml.parsers.*;
import net.sourceforge.idrs.deploy.macro.*;
- import net.sourceforge.idrs.deploy.compile.*;
/**
*
--- 24,27 ----
***************
*** 32,100 ****
*/
public class RmlCompiler {
! IDRSRep rep;
!
! /** Creates new RmlCompiler */
! public RmlCompiler(PrintWriter log, String rml, String xmlParser,String schemaSrc, boolean isFile, String rmlNS) throws Exception {
! boolean fail;
! StringWriter transformOut = new StringWriter();
! InputSource in;
! CompilerState comp = new CompilerState();
!
! MacroToXML trans = new MacroToXML(xmlParser,schemaSrc,isFile,rmlNS);
!
! log.println("Transformation : ");
!
! try {
! trans.setRML(rml);
! trans.setWriter(transformOut);
! trans.transformToXML();
! System.out.println("Transformation Complete!");
! fail = false;
! }
! catch (Exception e) {
! fail = true;
! e.printStackTrace(log);
! }
!
!
!
! log.println(transformOut.getBuffer());
! log.flush();
!
!
!
! if (fail) {
! log.println("Translation Failed");
! log.flush();
! return;
! }
!
!
! try {
! StringReader xmlIn = new StringReader(transformOut.getBuffer().toString());
! in = new InputSource(xmlIn);
! XMLReader parser = XMLReaderFactory.createXMLReader(xmlParser);
! RMLHandler rmlHandler = new RMLHandler(comp);
! rmlHandler.setOut(log);
! parser.setContentHandler(rmlHandler);
! parser.parse(in);
! }
! catch (Exception ee) {
! ee.printStackTrace(log);
! }
!
! if (fail) {
! log.println("Compilation Failed");
! return;
! }
! log.flush();
! rep = comp.getReport();
!
! }
!
! public IDRSRep getReport() {
! return rep;
! }
}
--- 30,188 ----
*/
public class RmlCompiler {
! IDRSRep rep;
! String xmlsrc;
! String errorWord;
! String err;
! /** Creates new RmlCompiler */
! public RmlCompiler(
! PrintWriter log,
! String rml,
! String xmlParser,
! String schemaSrc,
! boolean isFile,
! String rmlNS)
! throws Exception {
! err = null;
! errorWord = null;
! boolean fail;
! StringWriter transformOut = new StringWriter();
! InputSource in;
!
! CompilerState comp = new CompilerState();
!
! MacroToXML trans = new MacroToXML(xmlParser, schemaSrc, isFile, rmlNS);
!
! log.println("Transformation : ");
!
! try {
! trans.setRML(rml);
! trans.setWriter(transformOut);
! trans.transformToXML();
! //System.out.println("Transformation Complete!");
! fail = false;
! } catch (Exception e) {
! fail = true;
! e.printStackTrace(log);
! }
!
! log.println(transformOut.getBuffer());
! log.flush();
!
! if (fail) {
! log.println("Translation Failed");
! log.flush();
! return;
! }
!
! LocatorImpl locator = new LocatorImpl();
!
! StringReader xmlIn =
! new StringReader(transformOut.getBuffer().toString());
! in = new InputSource(xmlIn);
! XMLReader parser = XMLReaderFactory.createXMLReader(xmlParser);
! RMLHandler rmlHandler = new RMLHandler(comp);
! rmlHandler.setOut(log);
! rmlHandler.setDocumentLocator(locator);
! RmlErrorHandler err = new RmlErrorHandler();
!
! parser.setErrorHandler(err);
! parser.setContentHandler(rmlHandler);
!
! try {
! parser.parse(in);
! } catch (Exception e) {
! String msg = e.toString();
! msg = msg.substring(msg.indexOf("###") + 3);
! msg = msg.substring(msg.indexOf(":") + 1);
! this.err = msg;
! this.errorWord = comp.getErrorWord();
!
! log.println("ERROR : " + msg
! /*+ " - Line : " +err.getException().getLineNumber()*/
! );
! log.println("Error Word : " + comp.getErrorWord());
! /*if (locator.getLineNumber() != -1 && comp.getErrorWord() != null) {
! String tmp = transformOut.getBuffer().toString();
! StringTokenizer tok = new StringTokenizer(tmp, "\n");
! int i = 1;
!
! while (tok.hasMoreTokens()) {
! if (tok.nextToken().indexOf(comp.getErrorWord()) != -1) {
! log.println("Line : " + i);
! break;
! }
! i = i + 1;
! }
! }
! else {*/
! int lineNum = err.getLineNumber() == -1 ? rmlHandler.getLastLineNum() : err.getLineNumber();
! log.println("Line: " + lineNum) ;
! //}
!
! }
!
! this.xmlsrc = transformOut.getBuffer().toString();
!
! if (fail) {
! log.println("Compilation Failed");
! return;
! }
! log.flush();
! rep = comp.getReport();
!
! }
!
! public IDRSRep getReport() {
! return rep;
! }
!
! /**
! * Returns the err.
! * @return String
! */
! public String getErr() {
! return err;
! }
!
! /**
! * Returns the errorWord.
! * @return String
! */
! public String getErrorWord() {
! return errorWord;
! }
!
! /**
! * Returns the xmlsrc.
! * @return String
! */
! public String getXmlsrc() {
! return xmlsrc;
! }
!
! /**
! * Sets the err.
! * @param err The err to set
! */
! public void setErr(String err) {
! this.err = err;
! }
!
! /**
! * Sets the errorWord.
! * @param errorWord The errorWord to set
! */
! public void setErrorWord(String errorWord) {
! this.errorWord = errorWord;
! }
!
! /**
! * Sets the xmlsrc.
! * @param xmlsrc The xmlsrc to set
! */
! public void setXmlsrc(String xmlsrc) {
! this.xmlsrc = xmlsrc;
! }
}
Index: Compiler.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/Compiler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Compiler.java 4 Mar 2002 23:05:34 -0000 1.4
--- Compiler.java 6 Feb 2003 20:13:45 -0000 1.5
***************
*** 26,29 ****
--- 26,30 ----
protected Attributes atts;
protected CompilerState state;
+ protected String error;
***************
*** 48,51 ****
--- 49,68 ----
*/
public abstract void seal() throws Exception;
+
+ /**
+ * Returns the error.
+ * @return String
+ */
+ public String getError() {
+ return error;
+ }
+
+ /**
+ * Sets the error.
+ * @param error The error to set
+ */
+ public void setError(String error) {
+ this.error = error;
+ }
}
Index: RMLHandler.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/RMLHandler.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** RMLHandler.java 8 Jan 2003 06:01:37 -0000 1.6
--- RMLHandler.java 6 Feb 2003 20:13:45 -0000 1.7
***************
*** 36,39 ****
--- 36,42 ----
Stack isMethodState;
PrintWriter out;
+ protected int lastLineNum;
+
+ Locator locator;
public static String BASE_PACKAGE = "net.sourceforge.idrs.deploy.compile.units";
***************
*** 61,66 ****
*/
public void startElement(String namespaceURI, String localName, String rawName, Attributes atts) throws SAXException {
try {
! out.println("Start Element" + localName);
}
catch (Exception e){}
--- 64,71 ----
*/
public void startElement(String namespaceURI, String localName, String rawName, Attributes atts) throws SAXException {
+ //out.println("Line : " + this.locator.getLineNumber());
+ this.lastLineNum = this.locator.getLineNumber();
try {
! ///out.println("Start Element" + localName);
}
catch (Exception e){}
***************
*** 94,98 ****
compiler.setAttributes(atts);
state.pushNode(compiler);
! out.println("Push Class : " + compiler.getClass());
}
--- 99,103 ----
compiler.setAttributes(atts);
state.pushNode(compiler);
! //out.println("Push Class : " + compiler.getClass());
}
***************
*** 106,110 ****
this.isMethodState.push(new Boolean(isMethod));
try {
! out.println("Push isMethod" + isMethod);
}
catch (Exception ee){}
--- 111,115 ----
this.isMethodState.push(new Boolean(isMethod));
try {
! //out.println("Push isMethod" + isMethod);
}
catch (Exception ee){}
***************
*** 121,126 ****
*/
public void endElement(String namespaceURI, String localName, String rawName) throws SAXException {
try {
! out.println("End Element " + localName);
}
catch (Exception e){}
--- 126,133 ----
*/
public void endElement(String namespaceURI, String localName, String rawName) throws SAXException {
+ //out.println("Line : " + this.locator.getLineNumber());
+ this.lastLineNum = this.locator.getLineNumber();
try {
! // out.println("End Element " + localName);
}
catch (Exception e){}
***************
*** 134,142 ****
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);
--- 141,149 ----
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);
***************
*** 146,149 ****
--- 153,157 ----
}
catch (Exception e1) {
+
throw new SAXException(e1);
}
***************
*** 153,159 ****
try {
! out.println("Curr :" + curr + "!");
! out.println("Params :" + params[0] + "-" + params[1]);
! out.println("Method : " + meth.getName());
meth.invoke(curr,params);
--- 161,167 ----
try {
! // out.println("Curr :" + curr + "!");
! //out.println("Params :" + params[0] + "-" + params[1]);
! //out.println("Method : " + meth.getName());
meth.invoke(curr,params);
***************
*** 161,165 ****
catch (Exception e2) {
//e2.printStackTrace(System.out);
! throw new SAXException(e2);
}
}
--- 169,175 ----
catch (Exception e2) {
//e2.printStackTrace(System.out);
! //throw new SAXException(e2.getMessage());
!
! throw new SAXException("###" + e2.getCause().toString());
}
}
***************
*** 167,171 ****
if (! state.isNodeEmpty()) {
curr = state.popNode();
! out.println("Pop Class : " + curr.getClass());
try {
curr.seal();
--- 177,181 ----
if (! state.isNodeEmpty()) {
curr = state.popNode();
! //out.println("Pop Class : " + curr.getClass());
try {
curr.seal();
***************
*** 173,177 ****
catch (Exception e) {
e.printStackTrace(System.out);
! throw new SAXException(e);
}
}
--- 183,187 ----
catch (Exception e) {
e.printStackTrace(System.out);
! throw new SAXParseException(e.toString(),this.locator);
}
}
***************
*** 180,183 ****
--- 190,194 ----
public void characters(char[] ch, int start, int end) {
+ //out.println("Line : " + locator.getLineNumber());
for (int i=start;i<start + end;i++) {
currBuff.append(ch[i]);
***************
*** 209,211 ****
--- 220,239 ----
}
+ public void setDocumentLocator(Locator locator) {
+ //out.println("Line : " + locator.getLineNumber());
+ this.locator = locator;
+ }
+
+ public Locator getDocumentLocator() {
+ return this.locator;
+ }
+
+ /**
+ * Returns the lastLineNum.
+ * @return int
+ */
+ public int getLastLineNum() {
+ return lastLineNum;
+ }
+
}
Index: CompilerState.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/CompilerState.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** CompilerState.java 5 Apr 2002 14:37:52 -0000 1.5
--- CompilerState.java 6 Feb 2003 20:13:45 -0000 1.6
***************
*** 27,30 ****
--- 27,31 ----
HashMap comp_atts;
Stack lines;
+ String errorWord;
/** Creates new CompilerState */
***************
*** 223,226 ****
--- 224,243 ----
return this.currentLine == null;
}
+
+ /**
+ * Returns the errorWord.
+ * @return String
+ */
+ public String getErrorWord() {
+ return errorWord;
+ }
+
+ /**
+ * Sets the errorWord.
+ * @param errorWord The errorWord to set
+ */
+ public void setErrorWord(String errorWord) {
+ this.errorWord = errorWord;
+ }
}
|
|
From: Marc B. <big...@us...> - 2003-01-08 06:02:09
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/jdbc
In directory sc8-pr-cvs1:/tmp/cvs-serv32140/dev/src/net/sourceforge/idrs/jdbc
Modified Files:
JDBCInfo.java
Removed Files:
JDBCInfo.class JDBCPool.class
Log Message:
Added new validation capabilities, and all idrs object are given access to the idrs script oject without it being passed in as a parameter. Also fixed a security bug and setup for more memory effecient pooling. Finally add a new configuration file to simplify deployments.
Index: JDBCInfo.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/jdbc/JDBCInfo.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** JDBCInfo.java 22 Aug 2002 20:06:35 -0000 1.4
--- JDBCInfo.java 8 Jan 2003 06:01:36 -0000 1.5
***************
*** 26,33 ****
public class JDBCInfo {
! protected String poolname, drivername, url, username, password;
public JDBCInfo() {}
/**
* Generates the jdbc information
--- 26,36 ----
public class JDBCInfo {
! protected String poolname, drivername, url, username, password,logPath;
! protected int min, max,daysOpen;
public JDBCInfo() {}
+
+
/**
* Generates the jdbc information
***************
*** 91,94 ****
--- 94,99 ----
*/
public String getUsername() {
+ if (this.username == null) return "";
+
return this.username;
}
***************
*** 106,109 ****
--- 111,115 ----
*/
public String getPassword() {
+ if (this.password == null) return "";
return this.password;
}
***************
*** 133,135 ****
--- 139,205 ----
}
+ /**
+ * Returns the daysOpen.
+ * @return int
+ */
+ public int getDaysOpen() {
+ return daysOpen;
+ }
+
+ /**
+ * Returns the logPath.
+ * @return String
+ */
+ public String getLogPath() {
+ return logPath;
+ }
+
+ /**
+ * Returns the max.
+ * @return int
+ */
+ public int getMax() {
+ return max;
+ }
+
+ /**
+ * Returns the min.
+ * @return int
+ */
+ public int getMin() {
+ return min;
+ }
+
+ /**
+ * Sets the daysOpen.
+ * @param daysOpen The daysOpen to set
+ */
+ public void setDaysOpen(int daysOpen) {
+ this.daysOpen = daysOpen;
+ }
+
+ /**
+ * Sets the logPath.
+ * @param logPath The logPath to set
+ */
+ public void setLogPath(String logPath) {
+ this.logPath = logPath;
+ }
+
+ /**
+ * Sets the max.
+ * @param max The max to set
+ */
+ public void setMax(int max) {
+ this.max = max;
+ }
+
+ /**
+ * Sets the min.
+ * @param min The min to set
+ */
+ public void setMin(int min) {
+ this.min = min;
+ }
+
}
--- JDBCInfo.class DELETED ---
--- JDBCPool.class DELETED ---
|
|
From: Marc B. <big...@us...> - 2003-01-08 06:02:08
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/utils
In directory sc8-pr-cvs1:/tmp/cvs-serv32140/dev/src/net/sourceforge/idrs/utils
Modified Files:
Validators.java ObjectStore.java
Removed Files:
RSMetaData.class DB.class CleanUp.class RequestWrapper.class
ReqAttr.class RS.class Application.class UserInfo.class
IDRSPrinter.class ObjectStore.class ReqReq.class
Log Message:
Added new validation capabilities, and all idrs object are given access to the idrs script oject without it being passed in as a parameter. Also fixed a security bug and setup for more memory effecient pooling. Finally add a new configuration file to simplify deployments.
Index: Validators.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/utils/Validators.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Validators.java 29 Dec 2002 04:39:08 -0000 1.2
--- Validators.java 8 Jan 2003 06:01:00 -0000 1.3
***************
*** 111,113 ****
--- 111,157 ----
return -1;
}
+
+
+ /**
+ *Function for determining if a value has been given and is an Integer.
+ *If no value has been given (null or empty), or the value given is not an integer then an error is created.
+ *@param name The Name of the field
+ *@param val The value to be tested
+ */
+ protected int parseValInt(String name, String val, int def) {
+ try {
+
+ int tmp = val != null && val.trim().length() != 0 ? Integer.parseInt(val) : def;
+ if (tmp != 0) {
+ return tmp;
+ }
+ else {
+ idrs.createError("The " + name + " is required");
+ }
+
+
+ }
+ catch (Exception e) {
+ idrs.createError("The " + name + " " + e.toString());
+ }
+
+ return -1;
+ }
+
+ /**
+ *Function for determining if a value has been given and is a non zero Integer.
+ *If no value has been given (null or empty), or the value given is not a non zero integer then an error is created.
+ *@param name The Name of the field
+ *@param val The value to be tested
+ */
+ protected int parseValIntZero(String name, String val,int def) {
+ try {
+ return val != null && val.trim().length() != 0 ? Integer.parseInt(val) : def;
+ }
+ catch (Exception e) {
+ idrs.createError("The " + name + " " + e.toString());
+ }
+
+ return -1;
+ }
}
Index: ObjectStore.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/utils/ObjectStore.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ObjectStore.java 22 Nov 2002 07:16:24 -0000 1.7
--- ObjectStore.java 8 Jan 2003 06:01:01 -0000 1.8
***************
*** 1,353 ****
! /*
! ObjectStore.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.
! */
! package net.sourceforge.idrs.utils;
! import java.util.*;
! import java.sql.*;
! import java.lang.reflect.*;
! import javax.servlet.http.HttpServletRequest;
! import net.sourceforge.idrs.script.IDRSScript;
! import java.io.*;
! /**
! * ObjectStore.java
! */
! public final class ObjectStore implements Serializable {
! protected transient HashMap methods;
! protected Object obj;
! protected String className;
! protected Class cls;
! protected String id;
! protected boolean setProps;
! protected transient Vector bmethodNames;
! protected transient Vector bmethodClasses;
! protected String[] propNames;
!
! protected transient Method[] props;
! protected String[] methodNames;
! protected Class[][] methodClasses;
! protected Class[] varTypes;
! protected transient boolean addToMethVec = false;
! transient boolean sealed;
! static final long serialVersionUID = 3570053539799841110L;
! /**
! * Creates an ObjectStore based on an Id and a classname
! */
! public ObjectStore(String id, String className) {
! methods=new HashMap();
! this.id = id;
! this.className = className;
! try {
! cls = Class.forName(className);
! }
! catch (Exception e) {
! e.printStackTrace();
! }
! sealed = false;
! addToMethVec = false;
! }
!
! /**
! * Creates a ObjectStore based on an ID
! */
! public ObjectStore(String id) {
! this.id = id;
! addToMethVec = false;
! sealed=false;
! }
!
! /**
! * Loads given class
! */
! public void setClassName(String clsName) throws Exception {
! this.className = clsName;
! try {
! cls = Class.forName(className);
! }
! catch (Exception e) {
! throw new Exception("Class : " + clsName + " is not a vaild class");
! }
! /*
! Method[] meths = cls.getMethods();
!
! int i;
! Method meth;
! for (i = 0;i < meths.length;i++) {
! meth = meths[i];
! }
! */
! }
!
! /**
! * Loads given method for use
! */
! public void addMethod(String methodName, Class[] argsT) throws Exception {
! //Method[] meths = cls.getMethods();
! int i;
! Method meth;
!
!
!
!
! meth = cls.getMethod(methodName,argsT);
! //Class[] clss = meth.getParameterTypes();
! //clss = argTypes;
!
!
! methods.put(methodName,meth);
! if (addToMethVec) {
! bmethodNames.addElement(methodName);
! bmethodClasses.addElement(argsT);
! }
! }
!
! /**
! * Returns the class' of a given methods arguments
! */
! public Class[] getMethodTypes(String method) {
!
!
! Method meth = (Method) this.methods.get(method);
!
!
! Class[] clss = meth.getParameterTypes();
!
! return clss;
! }
!
! /**
! * Executes a given method with given arguments
! */
! public Object execMethod(String methodName, Object[] vals) throws Exception {
! Object retVal;
!
!
! retVal = ((Method) methods.get(methodName)).invoke(obj,vals);
!
!
! return retVal;
!
! }
!
! /**
! * Calls the constructor matching the artypes
! */
! public void initiate(Class[] argTypes, Object[] args) throws Exception {
!
! try {
!
! Constructor con = this.cls.getConstructor(argTypes);
! obj = con.newInstance(args);
!
!
! }
! catch (Exception e) {
! throw new Exception("No Matching Constructor");
! }
! }
!
! /**
! * Used to return a valid class for the ObjectStore
! */
! public static Object getValue(Class cls, String val,Connection con,IDRSScript idrs) throws Exception {
! val = val.trim();
! if (cls == String.class) {
! return val;
! }
! else if (cls == Integer.class) {
! return new Integer(val);
! }
! else if (cls == Float.class) {
! return new Float(val);
! }
! else if (cls == java.sql.Date.class) {
! return new java.sql.Date(java.sql.Date.parse(val));
! }
! else if (cls == java.sql.Time.class) {
! return new java.sql.Time(java.sql.Time.parse(val));
! }
! else if (cls == java.sql.Connection.class) {
! return con;
! }
! else if (cls == IDRSScript.class) {
! return idrs;
! }
! else
! throw new Exception(cls.toString() + " not a valid class for the ObjectStore");
!
! }
!
! public Object getRef() throws Exception {
! return obj;
! }
!
! //used for new IDRS
! /**
! Used for rebuilding and object after serialization when a report is called
! */
! public void rebuild(Object[] vals) throws Exception {
! Class objClass;
! Class[] propArgs = new Class[1];
! propArgs[0] = "".getClass();
!
! this.methods=new HashMap();
!
! Method init = cls.getMethod("reInit",this.varTypes);
! if (init == null) {
! throw new Exception("No init method");
! }
!
! try {
! init.invoke(obj,vals);
!
! int i;
!
! addToMethVec = false;
!
! for (i=0;i<methodNames.length;i++) {
!
!
! addMethod((String) methodNames[i],methodClasses[i]);
! }
!
! objClass = obj.getClass();
!
! if (this.setProps) {
! this.props = new Method[propNames.length];
! for (i=0;i<propNames.length;i++) {
! props[i] = objClass.getMethod(propNames[i],propArgs);
! }
! }
!
!
! }
! catch (Exception e) {
! throw new Exception("No init method");
! }
! }
!
! /**
! Used for first initialization of object for empty constructor
! */
! public void firstInitiate(Class[] argTypes) throws Exception {
! try {
! obj = cls.newInstance();
! }
! catch (Exception noCon) {
! throw new Exception("No default constructor");
! }
!
!
!
! this.varTypes = argTypes;
! //System.out.println("Argtypes Size: " + this.varTypes.length);
!
! bmethodNames = new Vector();
! bmethodClasses = new Vector();
! addToMethVec = true;
! methods = new HashMap();
! }
!
! public Class[] getTypes() {
! return this.varTypes;
! }
!
!
!
! public String getID() {
! return id;
! }
!
! public void close() throws Exception {
! //methods.clear();
! if (obj instanceof net.sourceforge.idrs.utils.CleanUp)
! ((CleanUp) obj).cleanUp();
! }
!
! /**
! "Seals" the ObjectStore moving all vector data into arrays
! */
! public int seal() {
! if (! sealed) {
!
! methodNames = new String[bmethodNames.size()];
! methodClasses = new Class[bmethodClasses.size()][];
! int i;
!
!
!
! for (i = 0;i<methodNames.length;i++) {
! methodNames[i] = (String) bmethodNames.elementAt(i);
! methodClasses[i] = (Class[]) bmethodClasses.elementAt(i);
! }
!
! bmethodNames.removeAllElements();
! bmethodClasses.removeAllElements();
! sealed = true;
! }
!
! if (this.varTypes.length > 0) {
! return methodNames.length + 1;
! }
! else {
! return methodNames.length;
! }
!
! }
!
! /**
! *Retrieves all method names of Java Bean properties
! *@param retrieve Will properties be autimaticly set?
! */
! public void retrieveProps(boolean retrieve) {
! LinkedList props = new LinkedList();
! Method[] meths;
! String name;
! Class argClass;
! int numArgs;
!
! if (retrieve) {
! this.setProps = true;
! meths = obj.getClass().getMethods();
!
! for (int i=0;i<meths.length;i++) {
! name = meths[i].getName();
! numArgs = meths[i].getParameterTypes().length;
! if (numArgs == 1) {
! argClass = meths[i].getParameterTypes()[0];
! if (name.substring(0,3).equalsIgnoreCase("set") && (argClass.equals("".getClass()) || argClass.equals(String[].class))) {
! props.add(meths[i].getName());
! }
! }
! }
!
! this.propNames = new String[props.size()];
! System.arraycopy(props.toArray(),0,this.propNames,0,this.propNames.length);
! }
! else {
! this.setProps = false;
! }
! }
!
! /**
! *Sets all properties<br>
! *All property values must have the name objId-prop_propName
! *@param req The current request
! */
! public void setProps(HttpServletRequest req) throws Exception {
! StringBuffer buf = new StringBuffer();
! String[] args = new String[1];
String[] vals;
! for (int i=0,m=this.propNames.length;i<m;i++) {
! buf.setLength(0);
! buf.append(this.id).append('-').append("prop").append('_').append(propNames[i].substring(3));
args[0] = req.getParameter(buf.toString());
--- 1,358 ----
! /*
! ObjectStore.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.
! */
! package net.sourceforge.idrs.utils;
! import java.util.*;
! import java.sql.*;
! import java.lang.reflect.*;
! import javax.servlet.http.HttpServletRequest;
! import net.sourceforge.idrs.script.IDRSScript;
! import java.io.*;
! /**
! * ObjectStore.java
! */
! public final class ObjectStore implements Serializable {
! protected transient HashMap methods;
! protected Object obj;
! protected String className;
! protected Class cls;
! protected String id;
! protected boolean setProps;
! protected transient Vector bmethodNames;
! protected transient Vector bmethodClasses;
! protected String[] propNames;
!
! protected transient Method[] props;
! protected String[] methodNames;
! protected Class[][] methodClasses;
! protected Class[] varTypes;
! protected transient boolean addToMethVec = false;
! transient boolean sealed;
! static final long serialVersionUID = 3570053539799841110L;
!
! transient IDRSScript idrs;
!
! /**
! * Creates an ObjectStore based on an Id and a classname
! */
! public ObjectStore(String id, String className) {
! methods=new HashMap();
! this.id = id;
! this.className = className;
! try {
! cls = Class.forName(className);
! }
! catch (Exception e) {
! e.printStackTrace();
! }
! sealed = false;
! addToMethVec = false;
! }
!
! /**
! * Creates a ObjectStore based on an ID
! */
! public ObjectStore(String id) {
! this.id = id;
! addToMethVec = false;
! sealed=false;
! }
!
! /**
! * Loads given class
! */
! public void setClassName(String clsName) throws Exception {
! this.className = clsName;
! try {
! cls = Class.forName(className);
! }
! catch (Exception e) {
! throw new Exception("Class : " + clsName + " is not a vaild class");
! }
! /*
! Method[] meths = cls.getMethods();
!
! int i;
! Method meth;
! for (i = 0;i < meths.length;i++) {
! meth = meths[i];
! }
! */
! }
!
! /**
! * Loads given method for use
! */
! public void addMethod(String methodName, Class[] argsT) throws Exception {
! //Method[] meths = cls.getMethods();
! int i;
! Method meth;
!
!
!
!
! meth = cls.getMethod(methodName,argsT);
! //Class[] clss = meth.getParameterTypes();
! //clss = argTypes;
!
!
! methods.put(methodName,meth);
! if (addToMethVec) {
! bmethodNames.addElement(methodName);
! bmethodClasses.addElement(argsT);
! }
! }
!
! /**
! * Returns the class' of a given methods arguments
! */
! public Class[] getMethodTypes(String method) {
!
!
! Method meth = (Method) this.methods.get(method);
!
!
! Class[] clss = meth.getParameterTypes();
!
! return clss;
! }
!
! /**
! * Executes a given method with given arguments
! */
! public Object execMethod(String methodName, Object[] vals) throws Exception {
! Object retVal;
!
!
! retVal = ((Method) methods.get(methodName)).invoke(obj,vals);
!
!
! return retVal;
!
! }
!
! /**
! * Calls the constructor matching the artypes
! */
! public void initiate(Class[] argTypes, Object[] args) throws Exception {
!
! try {
!
! Constructor con = this.cls.getConstructor(argTypes);
! obj = con.newInstance(args);
!
!
! }
! catch (Exception e) {
! throw new Exception("No Matching Constructor");
! }
! }
!
! /**
! * Used to return a valid class for the ObjectStore
! */
! public static Object getValue(Class cls, String val,Connection con,IDRSScript idrs) throws Exception {
! val = val.trim();
! if (cls == String.class) {
! return val;
! }
! else if (cls == Integer.class) {
! return new Integer(val);
! }
! else if (cls == Float.class) {
! return new Float(val);
! }
! else if (cls == java.sql.Date.class) {
! return new java.sql.Date(java.sql.Date.parse(val));
! }
! else if (cls == java.sql.Time.class) {
! return new java.sql.Time(java.sql.Time.parse(val));
! }
! else if (cls == java.sql.Connection.class) {
! return con;
! }
! else if (cls == IDRSScript.class) {
! return idrs;
! }
! else
! throw new Exception(cls.toString() + " not a valid class for the ObjectStore");
!
! }
!
! public Object getRef() throws Exception {
! return obj;
! }
!
! //used for new IDRS
! /**
! Used for rebuilding and object after serialization when a report is called
! */
! public void rebuild(Object[] vals) throws Exception {
! Class objClass;
! Class[] propArgs = new Class[1];
! propArgs[0] = "".getClass();
!
! this.methods=new HashMap();
!
! Method init = cls.getMethod("reInit",this.varTypes);
! if (init == null) {
! throw new Exception("No init method");
! }
!
! try {
! init.invoke(obj,vals);
!
! ((CleanUp) obj).setContext(this.idrs);
!
! int i;
!
! addToMethVec = false;
!
! for (i=0;i<methodNames.length;i++) {
!
!
! addMethod((String) methodNames[i],methodClasses[i]);
! }
!
! objClass = obj.getClass();
!
! if (this.setProps) {
! this.props = new Method[propNames.length];
! for (i=0;i<propNames.length;i++) {
! props[i] = objClass.getMethod(propNames[i],propArgs);
! }
! }
!
!
! }
! catch (Exception e) {
! throw new Exception("No init method");
! }
! }
!
! /**
! Used for first initialization of object for empty constructor
! */
! public void firstInitiate(Class[] argTypes) throws Exception {
! try {
! obj = cls.newInstance();
! }
! catch (Exception noCon) {
! throw new Exception("No default constructor");
! }
!
!
!
! this.varTypes = argTypes;
! //System.out.println("Argtypes Size: " + this.varTypes.length);
!
! bmethodNames = new Vector();
! bmethodClasses = new Vector();
! addToMethVec = true;
! methods = new HashMap();
! }
!
! public Class[] getTypes() {
! return this.varTypes;
! }
!
!
!
! public String getID() {
! return id;
! }
!
! public void close() throws Exception {
! //methods.clear();
! if (obj instanceof net.sourceforge.idrs.utils.CleanUp)
! ((CleanUp) obj).cleanUp();
! }
!
! /**
! "Seals" the ObjectStore moving all vector data into arrays
! */
! public int seal() {
! if (! sealed) {
!
! methodNames = new String[bmethodNames.size()];
! methodClasses = new Class[bmethodClasses.size()][];
! int i;
!
!
!
! for (i = 0;i<methodNames.length;i++) {
! methodNames[i] = (String) bmethodNames.elementAt(i);
! methodClasses[i] = (Class[]) bmethodClasses.elementAt(i);
! }
!
! bmethodNames.removeAllElements();
! bmethodClasses.removeAllElements();
! sealed = true;
! }
!
! if (this.varTypes.length > 0) {
! return methodNames.length + 1;
! }
! else {
! return methodNames.length;
! }
!
! }
!
! /**
! *Retrieves all method names of Java Bean properties
! *@param retrieve Will properties be autimaticly set?
! */
! public void retrieveProps(boolean retrieve) {
! LinkedList props = new LinkedList();
! Method[] meths;
! String name;
! Class argClass;
! int numArgs;
!
! if (retrieve) {
! this.setProps = true;
! meths = obj.getClass().getMethods();
!
! for (int i=0;i<meths.length;i++) {
! name = meths[i].getName();
! numArgs = meths[i].getParameterTypes().length;
! if (numArgs == 1) {
! argClass = meths[i].getParameterTypes()[0];
! if (name.substring(0,3).equalsIgnoreCase("set") && (argClass.equals("".getClass()) || argClass.equals(String[].class))) {
! props.add(meths[i].getName());
! }
! }
! }
!
! this.propNames = new String[props.size()];
! System.arraycopy(props.toArray(),0,this.propNames,0,this.propNames.length);
! }
! else {
! this.setProps = false;
! }
! }
!
! /**
! *Sets all properties<br>
! *All property values must have the name objId-prop_propName
! *@param req The current request
! */
! public void setProps(HttpServletRequest req) throws Exception {
! StringBuffer buf = new StringBuffer();
! String[] args = new String[1];
String[] vals;
! for (int i=0,m=this.propNames.length;i<m;i++) {
! buf.setLength(0);
! buf.append(this.id).append('-').append("prop").append('_').append(propNames[i].substring(3));
args[0] = req.getParameter(buf.toString());
***************
*** 360,375 ****
//args[0] = vals.length==1 ? vals[0] : vals;
! props[i].invoke(this.obj,args);
! }
!
! }
!
! /**
! *Determines if props are to be set
! *@return true If properties are being set
! */
! public boolean setProps() {
! return this.setProps;
! }
!
! }
--- 365,388 ----
//args[0] = vals.length==1 ? vals[0] : vals;
! props[i].invoke(this.obj,args);
! }
!
! }
!
! /**
! *Determines if props are to be set
! *@return true If properties are being set
! */
! public boolean setProps() {
! return this.setProps;
! }
!
! /**
! * Sets the idrs.
! * @param idrs The idrs to set
! */
! public void setIdrs(IDRSScript idrs) {
! this.idrs = idrs;
! }
!
! }
--- RSMetaData.class DELETED ---
--- DB.class DELETED ---
--- CleanUp.class DELETED ---
--- RequestWrapper.class DELETED ---
--- ReqAttr.class DELETED ---
--- RS.class DELETED ---
--- Application.class DELETED ---
--- UserInfo.class DELETED ---
--- IDRSPrinter.class DELETED ---
--- ObjectStore.class DELETED ---
--- ReqReq.class DELETED ---
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report
In directory sc8-pr-cvs1:/tmp/cvs-serv32140/dev/src/net/sourceforge/idrs/core/report
Modified Files:
GenTag.java IDRSHead.java InputChunk.java
Removed Files:
ShortScriptChunk.class EvalLongScript.class
IfResultsChunk.class NavNextChunk.class TextChunk.class
IfChangeChunk.class InputResultsChunk.class RepeatLine.class
Chunk.class ObjectChunk.class Int.class EvalScriptChunk.class
IDRSHead.class IDRSRep.class IDRSBody.class IDRSCompiler.class
Line.class FieldChunk.class
Log Message:
Added new validation capabilities, and all idrs object are given access to the idrs script oject without it being passed in as a parameter. Also fixed a security bug and setup for more memory effecient pooling. Finally add a new configuration file to simplify deployments.
Index: GenTag.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report/GenTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** GenTag.java 22 Aug 2002 20:06:33 -0000 1.2
--- GenTag.java 8 Jan 2003 06:01:28 -0000 1.3
***************
*** 25,29 ****
public static final int SRC_PROP=2;
!
String src;
--- 25,29 ----
public static final int SRC_PROP=2;
! static final long serialVersionUID=-8456555223234439135L;
String src;
Index: IDRSHead.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report/IDRSHead.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** IDRSHead.java 9 Sep 2002 21:27:44 -0000 1.11
--- IDRSHead.java 8 Jan 2003 06:01:30 -0000 1.12
***************
*** 184,187 ****
--- 184,188 ----
//obj = (ObjectStore) objects.get((String) keys.next());
obj = (ObjectStore) objects.get(objNames[l]);
+ obj.setIdrs(this);
varTypes = obj.getTypes();
vals = new Object[varTypes.length];
Index: InputChunk.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/report/InputChunk.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** InputChunk.java 13 Apr 2002 16:06:35 -0000 1.1
--- InputChunk.java 8 Jan 2003 06:01:30 -0000 1.2
***************
*** 13,16 ****
--- 13,17 ----
*/
public class InputChunk extends net.sourceforge.idrs.core.report.GenTag implements net.sourceforge.idrs.core.report.Chunk, java.io.Serializable {
+ static final long serialVersionUID = 5855964307701065757L;
public static final int INPUT_TEXT = 0;
public static final int INPUT_CHECKBOX = 1;
--- ShortScriptChunk.class DELETED ---
--- EvalLongScript.class DELETED ---
--- IfResultsChunk.class DELETED ---
--- NavNextChunk.class DELETED ---
--- TextChunk.class DELETED ---
--- IfChangeChunk.class DELETED ---
--- InputResultsChunk.class DELETED ---
--- RepeatLine.class DELETED ---
--- Chunk.class DELETED ---
--- ObjectChunk.class DELETED ---
--- Int.class DELETED ---
--- EvalScriptChunk.class DELETED ---
--- IDRSHead.class DELETED ---
--- IDRSRep.class DELETED ---
--- IDRSBody.class DELETED ---
--- IDRSCompiler.class DELETED ---
--- Line.class DELETED ---
--- FieldChunk.class DELETED ---
|
|
From: Marc B. <big...@us...> - 2003-01-08 06:02:00
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/servlet
In directory sc8-pr-cvs1:/tmp/cvs-serv32140/dev/src/net/sourceforge/idrs/core/servlet
Modified Files:
IDRSServlet.java IDRSSecurity.java Init.java
Removed Files:
Init.class PoolInfo.class ReportStore.class DocInfo.class
IDRSServlet.class IDRSSecurity.class
Log Message:
Added new validation capabilities, and all idrs object are given access to the idrs script oject without it being passed in as a parameter. Also fixed a security bug and setup for more memory effecient pooling. Finally add a new configuration file to simplify deployments.
Index: IDRSServlet.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/servlet/IDRSServlet.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** IDRSServlet.java 13 Oct 2002 15:04:10 -0000 1.16
--- IDRSServlet.java 8 Jan 2003 06:01:21 -0000 1.17
***************
*** 53,56 ****
--- 53,58 ----
public final static String SLASH="/";
+
+
/** Creates new IDRSServlet */
***************
*** 68,73 ****
//The Init class loads all of the configuration information from the web.xml file and
//loads all reports into the pooling system
- init = new Init(svg);
//retrieves the serverside application object from the init object
app = init.getApplication();
--- 70,79 ----
//The Init class loads all of the configuration information from the web.xml file and
//loads all reports into the pooling system
+ System.setOut(new PrintStream(new FileOutputStream(new File("/usr/local/tomcat/logs/marc_out.txt"))));
+ System.setErr(new PrintStream(new FileOutputStream(new File("/usr/local/tomcat/logs/marc_err.txt"))));
+ System.out.println("in init");
+ init = new Init(svg);
+
//retrieves the serverside application object from the init object
app = init.getApplication();
***************
*** 83,86 ****
--- 89,93 ----
catch (Exception e) {
//this is admitadly a bad idea
+ e.printStackTrace();
}
super.init(svg);
***************
*** 468,472 ****
//initialize a security object for retrieving all report information
! IDRSSecurity secure = new IDRSSecurity(getDocInfo(docID, docName), user, pass, authDB, toLower,init.digestPassword(),init.getDigestType());
poolInfo.secure = secure;
//attempt authentication of user for current page
--- 475,479 ----
//initialize a security object for retrieving all report information
! IDRSSecurity secure = new IDRSSecurity(getDocInfo(docID, docName), user, pass, authDB, toLower,init.digestPassword(),init.getDigestType(),init.getSecuretyImp(),this.app);
poolInfo.secure = secure;
//attempt authentication of user for current page
***************
*** 487,490 ****
--- 494,498 ----
secure.close();
accessDenied(req, resp);
+ return;
}
Index: IDRSSecurity.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/servlet/IDRSSecurity.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** IDRSSecurity.java 14 Apr 2002 14:10:37 -0000 1.6
--- IDRSSecurity.java 8 Jan 2003 06:01:25 -0000 1.7
***************
*** 13,17 ****
package net.sourceforge.idrs.core.servlet;
! import net.sourceforge.idrs.utils.DB;
import java.util.*;
import java.io.*;
--- 13,17 ----
package net.sourceforge.idrs.core.servlet;
! import net.sourceforge.idrs.utils.*;
import java.util.*;
import java.io.*;
***************
*** 24,27 ****
--- 24,29 ----
public class IDRSSecurity {
+ public static final String DEFAULT_IMP = "net.sourceforge.idrs.core.servlet.IdrsAuthDefault";
+
private boolean isOK, docRetrieved;
***************
*** 40,43 ****
--- 42,47 ----
private String digest;
private boolean digestPass;
+ private IDRSAuth imp;
+ private boolean hasEntry;
/**
***************
*** 49,53 ****
* @param toLower Wether or not all field names needed to be lower case
*/
! public IDRSSecurity(DocInfo doc,String userName,String password, Connection con,boolean toLower,boolean digestPass,String digest) throws Exception {
this.doc = doc;
this.userName = userName;
--- 53,57 ----
* @param toLower Wether or not all field names needed to be lower case
*/
! public IDRSSecurity(DocInfo doc,String userName,String password, Connection con,boolean toLower,boolean digestPass,String digest, IDRSAuth imp, Application app) throws Exception {
this.doc = doc;
this.userName = userName;
***************
*** 59,88 ****
docRetrieved = false;
passOK = false;
! String sql = "SELECT * FROM tblUser WHERE UserName=?";
! if (toLower)
! sql = sql.toLowerCase();
!
! psUser = con.prepareStatement(sql);
! psUser.setString(1,userName);
! rsUser = psUser.executeQuery();
- rsUser.next();
- field="UserID";
- if (toLower) field=field.toLowerCase();
- this.uid=rsUser.getInt(field);
! field="Password";
! if (toLower) field=field.toLowerCase();
! this.upass=rsUser.getString(field);
- field="GroupID";
- if (toLower) field=field.toLowerCase();
- this.ugroups=rsUser.getString(field);
! rsUser.close();
! psUser.close();
! this.toLower = toLower;
}
/**
--- 63,81 ----
docRetrieved = false;
passOK = false;
! this.toLower = toLower;
! this.imp = imp;
! this.hasEntry = imp.loadUser(con,this.userName,app,toLower);
! this.ugroups = imp.getUserGroups();
! this.upass = imp.getUserPass();
! this.uid = imp.getUserId();
!
}
+
+
/**
***************
*** 174,180 ****
if (! isOK ) {
!
isOK = doc.passGate(this.ugroups);
! return isOK && passwordOK();
}
else {
--- 167,184 ----
if (! isOK ) {
!
isOK = doc.passGate(this.ugroups);
!
! if (isOK && hasEntry) {
! return passwordOK();
! }
! else if (isOK) {
! this.ugroups="-1";
! return true;
! }
! else {
! isOK = false;
! return false;
! }
}
else {
Index: Init.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/core/servlet/Init.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Init.java 16 Sep 2002 15:19:42 -0000 1.9
--- Init.java 8 Jan 2003 06:01:27 -0000 1.10
***************
*** 32,555 ****
import net.sourceforge.idrs.exceptions.*;
-
/**
* Contains initialization logic for the IDRS, as well as the resulting information
*/
public class Init {
! static final String DEFAULT_DB_POOL="net.sourceforge.idrs.pool.JDBCPool";
! static final String DEFAULT_REPORT_POOL="net.sourceforge.idrs.pool.IDRSRepPool";
! static final String DEFAULT_SCRIPT_POOL="net.sourceforge.idrs.pool.ScriptContextPool";
[...1043 lines suppressed...]
+ public String getErrorPage() {
+ return errorPage;
+ }
+ public RepPool createReportPool() throws Exception {
+ String reportPool = cfg.getReportPoolClass();
+ reportPool = (reportPool != null) ? reportPool : DEFAULT_REPORT_POOL;
+ return (RepPool) Class.forName(reportPool).newInstance();
+ }
+ /**
+ * Returns the cfg.
+ * @return ConfigInfo
+ */
+ public ConfigInfo getConfigInfo() {
+ return cfg;
+ }
}
--- Init.class DELETED ---
--- PoolInfo.class DELETED ---
--- ReportStore.class DELETED ---
--- DocInfo.class DELETED ---
--- IDRSServlet.class DELETED ---
--- IDRSSecurity.class DELETED ---
|
|
From: Marc B. <big...@us...> - 2003-01-08 06:01:47
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy
In directory sc8-pr-cvs1:/tmp/cvs-serv32140/dev/src/net/sourceforge/idrs/deploy
Modified Files:
DocReset.java
Removed Files:
DocReset.class HotDeploy.class InsertToIDRS.class
RMLDeploy.class
Log Message:
Added new validation capabilities, and all idrs object are given access to the idrs script oject without it being passed in as a parameter. Also fixed a security bug and setup for more memory effecient pooling. Finally add a new configuration file to simplify deployments.
Index: DocReset.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/DocReset.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DocReset.java 22 Aug 2002 20:06:34 -0000 1.3
--- DocReset.java 8 Jan 2003 06:01:05 -0000 1.4
***************
*** 10,148 ****
import net.sourceforge.idrs.pool.*;
-
/**
* Background thread that listens for reset requests and updates the IDRS' internal cache of RML pages
*/
public final class DocReset extends Thread {
! String allowedHost;
! int port;
! Init init;
! ServerSocket listen;
! /**
! * Constructor for DocReset
! * @param init The Init object created in the IDRSServlet
! */
! public DocReset(Init init) {
! super();
! this.init = init;
! this.port =
! Integer.parseInt(init.getServletConfig().getInitParameter("resetPort"));
! this.allowedHost = init.getServletConfig().getInitParameter("resetAllowedHost");
! }
! /**
! * This method creates a ServerSocket on the port specified by the Init object and waits for requests.
! */
! public void run() {
! try {
! this.listen = new ServerSocket(this.port);
! Socket client;
! String input;
! BufferedReader in;
! while (true) {
! client = listen.accept();
! if ((client.getInetAddress().getHostAddress().equals(allowedHost))
! || (client.getInetAddress().getHostName().equals(allowedHost))) {
!
! System.out.println("Validation Succeeded");
! in = new BufferedReader(new InputStreamReader(client.getInputStream()));
! input = in.readLine();
! in.close();
! System.out.println("id : " + input.substring(0,input.indexOf(":")));
! System.out.println("name : " + input.substring(input.indexOf(":")+1));
! redeploy(input.substring(0,input.indexOf(":")), input.substring(input.indexOf(":")+1));
!
!
! }
! System.out.println("closing connection");
! client.close();
! }
! }
! catch (Exception e) {
! try {
! e.printStackTrace(System.out);
! }
! catch (Exception ee) {
! }
! }
! }
! /**
! * Reloads the RML page specified by id & name, creates the report pool and adds the pools the
! * IDRS's private cache
! * @param id The numeric ID of the page
! * @param name Then name of the page
! */
! public void redeploy(String id, String name) throws Exception {
! HashMap ids, names;
! IDRSRep newDoc;
! Connection con;
! RepPool pool;
! IDRSRep rep;
! PreparedStatement ps;
! ResultSet rs;
! String docid = "DocID";
! String docname = "DocName";
! String docsrc = "DocSrc";
! String docmin = "DocMin";
! String docmax = "DocMax";
! String docconns = "DocConns";
! String docparams = "DocParams";
! String docgroups = "DocGroups";
! DocInfo info;
! ReportStore repstr;
! ids = init.getDocsIDMap();
! names = init.getDocsNameMap();
! if (init.toLower()) {
! docid = docid.toLowerCase();
! docname = docname.toLowerCase();
! docsrc = docsrc.toLowerCase();
! docmin = docmin.toLowerCase();
! docmax = docmax.toLowerCase();
! docconns = docconns.toLowerCase();
! docgroups = docgroups.toLowerCase();
! docparams = docparams.toLowerCase();
! }
! con = this.init.getAppDBInfo().build();
! ps = con.prepareStatement("SELECT * FROM tblDoc WHERE DocName=?");
! ps.setString(1, name);
! rs = ps.executeQuery();
! rs.next();
! String idrslogPath = init.getServletConfig().getInitParameter("reportLogPath");
! synchronized (names) {
! rep =
! (IDRSRep) (new ObjectInputStream(rs.getBinaryStream(docsrc))).readObject();
! pool = init.createReportPool();
! pool.build(rs.getInt(docmin), rs.getInt(docmax), rep, 2000, (idrslogPath + "/" + rs.getString(docname) + ".log"), 10);
! info =
! new DocInfo(
! rs.getInt(docid),
! rs.getString(docname),
! rs.getString(docgroups),
! rs.getString(docparams),
! rs.getString(docconns));
! repstr = new ReportStore(pool, info);
!
! if (names.get(name) != null) names.remove(name);
! names.put(name, repstr);
! }
! synchronized (ids) {
! if (ids.get(id) != null) ids.remove(id);
! ids.put(id, repstr);
! }
! con.close();
! }
}
--- 10,165 ----
import net.sourceforge.idrs.pool.*;
/**
* Background thread that listens for reset requests and updates the IDRS' internal cache of RML pages
*/
public final class DocReset extends Thread {
! String allowedHost;
! int port;
! Init init;
! ServerSocket listen;
! /**
! * Constructor for DocReset
! * @param init The Init object created in the IDRSServlet
! */
! public DocReset(Init init) {
! super();
! this.init = init;
! this.port = init.getConfigInfo().getResetPort();
! this.allowedHost = init.getConfigInfo().getResetAllowedHost();
! }
! /**
! * This method creates a ServerSocket on the port specified by the Init object and waits for requests.
! */
! public void run() {
! try {
! this.listen = new ServerSocket(this.port);
! Socket client;
! String input;
! BufferedReader in;
! while (true) {
! client = listen.accept();
! if ((client
! .getInetAddress()
! .getHostAddress()
! .equals(allowedHost))
! || (client
! .getInetAddress()
! .getHostName()
! .equals(allowedHost))) {
! System.out.println("Validation Succeeded");
! in =
! new BufferedReader(
! new InputStreamReader(client.getInputStream()));
! input = in.readLine();
! in.close();
! System.out.println(
! "id : " + input.substring(0, input.indexOf(":")));
! System.out.println(
! "name : " + input.substring(input.indexOf(":") + 1));
! redeploy(
! input.substring(0, input.indexOf(":")),
! input.substring(input.indexOf(":") + 1));
! }
! System.out.println("closing connection");
! client.close();
! }
! } catch (Exception e) {
! try {
! e.printStackTrace(System.out);
! } catch (Exception ee) {
! }
! }
! }
! /**
! * Reloads the RML page specified by id & name, creates the report pool and adds the pools the
! * IDRS's private cache
! * @param id The numeric ID of the page
! * @param name Then name of the page
! */
! public void redeploy(String id, String name) throws Exception {
! HashMap ids, names;
! IDRSRep newDoc;
! Connection con;
! RepPool pool;
! IDRSRep rep;
! PreparedStatement ps;
! ResultSet rs;
! String docid = "DocID";
! String docname = "DocName";
! String docsrc = "DocSrc";
! String docmin = "DocMin";
! String docmax = "DocMax";
! String docconns = "DocConns";
! String docparams = "DocParams";
! String docgroups = "DocGroups";
! DocInfo info;
! ReportStore repstr;
! ids = init.getDocsIDMap();
! names = init.getDocsNameMap();
! if (init.toLower()) {
! docid = docid.toLowerCase();
! docname = docname.toLowerCase();
! docsrc = docsrc.toLowerCase();
! docmin = docmin.toLowerCase();
! docmax = docmax.toLowerCase();
! docconns = docconns.toLowerCase();
! docgroups = docgroups.toLowerCase();
! docparams = docparams.toLowerCase();
! }
! con = this.init.getAppDBInfo().build();
! ps = con.prepareStatement("SELECT * FROM tblDoc WHERE DocName=?");
! ps.setString(1, name);
! rs = ps.executeQuery();
! rs.next();
! String idrslogPath =
! init.getServletConfig().getInitParameter("reportLogPath");
! synchronized (names) {
! rep =
! (IDRSRep) (new ObjectInputStream(rs.getBinaryStream(docsrc)))
! .readObject();
! pool = init.createReportPool();
! pool.build(
! rs.getInt(docmin),
! rs.getInt(docmax),
! rep,
! 2000,
! (idrslogPath + "/" + rs.getString(docname) + ".log"),
! 10);
! info =
! new DocInfo(
! rs.getInt(docid),
! rs.getString(docname),
! rs.getString(docgroups),
! rs.getString(docparams),
! rs.getString(docconns));
! repstr = new ReportStore(pool, info);
! if (names.get(name) != null)
! names.remove(name);
! names.put(name, repstr);
! }
!
! synchronized (ids) {
! if (ids.get(id) != null)
! ids.remove(id);
! ids.put(id, repstr);
! }
!
! con.close();
!
! }
}
--- DocReset.class DELETED ---
--- HotDeploy.class DELETED ---
--- InsertToIDRS.class DELETED ---
--- RMLDeploy.class DELETED ---
|
|
From: Marc B. <big...@us...> - 2003-01-08 06:01:40
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/pool
In directory sc8-pr-cvs1:/tmp/cvs-serv32140/dev/src/net/sourceforge/idrs/pool
Modified Files:
IDRSRepPool.java
Log Message:
Added new validation capabilities, and all idrs object are given access to the idrs script oject without it being passed in as a parameter. Also fixed a security bug and setup for more memory effecient pooling. Finally add a new configuration file to simplify deployments.
Index: IDRSRepPool.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/pool/IDRSRepPool.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IDRSRepPool.java 22 Aug 2002 20:06:36 -0000 1.1
--- IDRSRepPool.java 8 Jan 2003 06:01:38 -0000 1.2
***************
*** 1,64 ****
! package net.sourceforge.idrs.pool;
!
! import org.apache.commons.pool.*;
! import org.apache.commons.pool.impl.*;
! import net.sourceforge.idrs.core.report.*;
!
! public class IDRSRepPool extends net.sourceforge.idrs.pool.RepPool {
! ObjectPool pool;
!
! public void build(int objectMin, int objectLimit, IDRSRep rep, long sleepTime, String path,int trys) throws Exception {
! super.build(objectMin,objectLimit,rep,sleepTime,path,trys);
! GenericObjectPool.Config conf = new GenericObjectPool.Config();
!
! conf.maxActive = limit;
! conf.maxWait = sleepTime;
! conf.testOnBorrow = true;
! conf.timeBetweenEvictionRunsMillis = 100000;
! conf.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_BLOCK;
!
! pool = new GenericObjectPool(new ReportFactory(rep),conf);
!
! }
!
!
! public Object getObj() throws Exception {
! return pool.borrowObject();
! }
!
! public void returnObj(Object obj) throws Exception {
! pool.returnObject(obj);
! }
!
! public void close() throws Exception {
! pool.close();
! }
! }
!
! class ReportFactory implements PoolableObjectFactory {
! IDRSRep rep;
!
! public ReportFactory(IDRSRep rep) {
! this.rep = rep;
! }
!
! public void activateObject(Object obj) throws Exception {
!
! }
!
! public void destroyObject(Object obj) throws Exception {
!
! }
!
! public Object makeObject() throws Exception {
! return rep.clone();
! }
!
! public void passivateObject(Object obj) throws Exception {
!
! }
!
! public boolean validateObject(Object obj) {
! return obj != null;
! }
! }
--- 1,69 ----
! package net.sourceforge.idrs.pool;
!
! import org.apache.commons.pool.*;
! import org.apache.commons.pool.impl.*;
! import net.sourceforge.idrs.core.report.*;
!
! public class IDRSRepPool extends net.sourceforge.idrs.pool.RepPool {
! ObjectPool pool;
! IDRSRep rep;
!
! public void build(int objectMin, int objectLimit, IDRSRep rep, long sleepTime, String path,int trys) throws Exception {
! super.build(objectMin,objectLimit,rep,sleepTime,path,trys);
! GenericObjectPool.Config conf = new GenericObjectPool.Config();
!
! conf.maxActive = limit;
! conf.maxWait = sleepTime;
! conf.testOnBorrow = true;
! conf.timeBetweenEvictionRunsMillis = 100000;
! conf.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_BLOCK;
! this.rep = rep;
! pool = new GenericObjectPool(new ReportFactory(rep),conf);
!
! }
!
!
! public Object getObj() throws Exception {
! return new IDRSRep((IDRSHead) pool.borrowObject(), this.rep.getBody());
! }
!
! public void returnObj(Object obj) throws Exception {
! pool.returnObject(((IDRSRep) obj).getHead());
! }
!
! public void close() throws Exception {
! pool.close();
! }
! }
!
! class ReportFactory implements PoolableObjectFactory {
! IDRSRep rep;
! IDRSHead head;
! IDRSBody body;
!
! public ReportFactory(IDRSRep rep) {
! this.rep = rep;
! this.head = rep.getHead();
! this.body = rep.getBody();
! }
!
! public void activateObject(Object obj) throws Exception {
!
! }
!
! public void destroyObject(Object obj) throws Exception {
!
! }
!
! public Object makeObject() throws Exception {
! return head.clone();
! }
!
! public void passivateObject(Object obj) throws Exception {
!
! }
!
! public boolean validateObject(Object obj) {
! return obj != null;
! }
! }
|
|
From: Marc B. <big...@us...> - 2003-01-08 06:01:40
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile In directory sc8-pr-cvs1:/tmp/cvs-serv32140/dev/src/net/sourceforge/idrs/deploy/compile Modified Files: RMLHandler.java Log Message: Added new validation capabilities, and all idrs object are given access to the idrs script oject without it being passed in as a parameter. Also fixed a security bug and setup for more memory effecient pooling. Finally add a new configuration file to simplify deployments. Index: RMLHandler.java =================================================================== RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/compile/RMLHandler.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RMLHandler.java 22 Aug 2002 20:06:34 -0000 1.5 --- RMLHandler.java 8 Jan 2003 06:01:37 -0000 1.6 *************** *** 22,25 **** --- 22,26 ---- import java.io.*; + /** *XMLHandler used to parse an RML page and call the appropriate Compiler classes |