[Idrs-commit] CVS: Idrs/dev/src/net/sourceforge/idrs/deploy DocReset.java,1.3,1.4 DocReset.class,1.2
Brought to you by:
bigman921
|
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 ---
|