You can subscribe to this list here.
| 2003 |
Jan
|
Feb
(14) |
Mar
(107) |
Apr
(211) |
May
(93) |
Jun
(158) |
Jul
(159) |
Aug
(368) |
Sep
(188) |
Oct
(151) |
Nov
(115) |
Dec
(98) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(25) |
Feb
|
Mar
(33) |
Apr
(28) |
May
(116) |
Jun
(2) |
Jul
(117) |
Aug
(19) |
Sep
(9) |
Oct
(2) |
Nov
|
Dec
(4) |
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(9) |
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
(22) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
(6) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(267) |
Sep
|
Oct
|
Nov
(6) |
Dec
(512) |
| 2008 |
Jan
(187) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(6) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Update of /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/journal/browser
In directory sc8-pr-cvs1:/tmp/cvs-serv8166/modules/gui/src/com/babeldoc/gui/journal/browser
Modified Files:
JournalBrowserModel.java JournalBrowserFrame.java
JournalTree.java Command.java
Log Message:
Added support for replaying a step and viewing a document at a step
Index: JournalBrowserModel.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/journal/browser/JournalBrowserModel.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** JournalBrowserModel.java 11 Jun 2003 23:35:38 -0000 1.2
--- JournalBrowserModel.java 6 Sep 2003 00:58:45 -0000 1.3
***************
*** 85,88 ****
--- 85,97 ----
/**
+ * Returns the Journal for this JournalBrowserModel
+ * @return Journal the journal for this JournalBrowserModel
+ */
+ public IJournal getJournal() {
+ return JournalFactory.getJournal();
+ }
+
+
+ /**
* DOCUMENT ME!
*
***************
*** 93,97 ****
public QueryTicket[] getTicketSteps(IJournalTicket ticket) {
try {
! return JournalFactory.getJournal().getAllTicketSteps(ticket);
} catch (Exception e) {
e.printStackTrace();
--- 102,106 ----
public QueryTicket[] getTicketSteps(IJournalTicket ticket) {
try {
! return getJournal().getAllTicketSteps(ticket);
} catch (Exception e) {
e.printStackTrace();
Index: JournalBrowserFrame.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/journal/browser/JournalBrowserFrame.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** JournalBrowserFrame.java 25 Aug 2003 14:13:14 -0000 1.4
--- JournalBrowserFrame.java 6 Sep 2003 00:58:45 -0000 1.5
***************
*** 70,74 ****
--- 70,77 ----
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
+ import java.util.Iterator;
+ import java.util.Set;
+ import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JMenu;
***************
*** 78,84 ****
--- 81,91 ----
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
+ import javax.swing.JTextArea;
import javax.swing.JTree;
+ import javax.swing.ScrollPaneConstants;
import javax.swing.event.TreeModelEvent;
import javax.swing.event.TreeModelListener;
+ import javax.swing.event.TreeSelectionEvent;
+ import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreePath;
***************
*** 86,97 ****
import com.babeldoc.core.config.ConfigService;
/**
* This is the main window to the the JournalBrowser
*/
! public class JournalBrowserFrame extends JFrame {
private JournalBrowserModel model;
private JournalTree tree;
private String version = ConfigService.getString("env/build", "babeldoc_version");
private String TITLE_MESSAGE = "JournalBrowser v" + version;
--- 93,114 ----
import com.babeldoc.core.config.ConfigService;
+ import com.babeldoc.core.journal.IJournal;
+ import com.babeldoc.core.journal.JournalException;
+ import com.babeldoc.core.journal.JournalOperation;
+ import com.babeldoc.core.pipeline.PipelineDocument;
/**
* This is the main window to the the JournalBrowser
*/
! public class JournalBrowserFrame extends JFrame implements TreeSelectionListener {
private JournalBrowserModel model;
private JournalTree tree;
+ private JMenuItem jMenuEditReplay; // will enable/disable these menu options
+ private JMenuItem jMenuEditShowDocument;
+
+ private int journalStart = 0;
+ private int journalCount = 100;
+
private String version = ConfigService.getString("env/build", "babeldoc_version");
private String TITLE_MESSAGE = "JournalBrowser v" + version;
***************
*** 109,130 ****
// Link the controller to this frame.
! tree = new JournalTree(this.model);
!
! getTree().getModel().addTreeModelListener(new MyTreeModelListener());
!
! getTree().getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
! getTree().setShowsRootHandles(false);
! getTree().putClientProperty("JTree.lineStyle", "Angled");
! getTree().addMouseListener(new MouseAdapter() {
! public void mousePressed(MouseEvent e) {
! TreePath selPath = getTree().getPathForLocation(e.getX(), e.getY());
! getTree().setSelectionPath(selPath);
! maybeShowPopup(e);
! }
!
! public void mouseReleased(MouseEvent e) {
! maybeShowPopup(e);
! }
! });
// build the menu options
--- 126,130 ----
// Link the controller to this frame.
! tree = initializeTree(this.model);
// build the menu options
***************
*** 149,152 ****
--- 149,163 ----
jMenuBar.add(jMenuFile);
+ // File | Reload
+ JMenuItem jMenuFileReload = new JMenuItem("Reload");
+ jMenuFileReload.setMnemonic('R');
+ jMenuFileReload.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ tree = initializeTree(model);
+ tree.populateTree(journalStart, journalCount);
+ }
+ });
+ jMenuFile.add(jMenuFileReload);
+
// File | Exit
JMenuItem jMenuFileExit = new JMenuItem("Exit");
***************
*** 164,181 ****
jMenuBar.add(jMenuEdit);
! // Edit | Replay
! JMenuItem jMenuEditReplay = new JMenuItem("Replay");
jMenuEditReplay.setMnemonic('R');
! jMenuEditReplay.addActionListener(new ActionListener() {
! public void actionPerformed(ActionEvent e) {
! JOptionPane.showMessageDialog(
! null,
! COMING_SOON_MESSAGE,
! "Coming Soon!",
! JOptionPane.PLAIN_MESSAGE);
! }
! });
jMenuEdit.add(jMenuEditReplay);
// ====== View menu items ======
JMenu jMenuView = new JMenu("View");
--- 175,192 ----
jMenuBar.add(jMenuEdit);
! // Edit | Replay (this one is declared above so it can be enabled/disabled
! jMenuEditReplay = new JMenuItem("Replay");
jMenuEditReplay.setMnemonic('R');
! jMenuEditReplay.addActionListener(new ReplayActionListener());
! jMenuEditReplay.setEnabled(false); // default to disabled
jMenuEdit.add(jMenuEditReplay);
+ // Edit | Show Document (this one is declared above so it can be enabled/disabled
+ jMenuEditShowDocument = new JMenuItem("Show Document");
+ jMenuEditShowDocument.setMnemonic('S');
+ jMenuEditShowDocument.addActionListener(new ShowDocumentActionListener());
+ jMenuEditShowDocument.setEnabled(false); // default to disabled
+ jMenuEdit.add(jMenuEditShowDocument);
+
// ====== View menu items ======
JMenu jMenuView = new JMenu("View");
***************
*** 254,257 ****
--- 265,300 ----
/**
+ * Initialize the JournalBrowser tree
+ * @return The initialized JournalTree object
+ * @param model The JournalBrowserModel containing the journal tickets to display
+ */
+ protected JournalTree initializeTree(JournalBrowserModel model) {
+
+ // Link the controller to this frame.
+ JournalTree tree = new JournalTree(model);
+
+ tree.getModel().addTreeModelListener(new MyTreeModelListener());
+ tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+ tree.setShowsRootHandles(false);
+ tree.putClientProperty("JTree.lineStyle", "Angled");
+
+ // add listeners
+ tree.addTreeSelectionListener(this);
+ tree.addMouseListener(new MouseAdapter() {
+ public void mousePressed(MouseEvent e) {
+ TreePath selPath = getTree().getPathForLocation(e.getX(), e.getY());
+ getTree().setSelectionPath(selPath);
+ maybeShowPopup(e);
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ maybeShowPopup(e);
+ }
+ });
+
+ return tree;
+ }
+
+ /**
* DOCUMENT ME!
*
***************
*** 309,311 ****
--- 352,483 ----
}
}
+
+ /**
+ * @see javax.swing.event.TreeSelectionListener#valueChanged(TreeSelectionEvent)
+ */
+ public void valueChanged(TreeSelectionEvent e) {
+ // if a step has been selected that can be replayed, enable the
+ // replay menu option. Othewise, don't...
+ DefaultMutableTreeNode selectedNode =
+ (DefaultMutableTreeNode)tree.getLastSelectedPathComponent();
+
+ // sanity checks first
+ if (selectedNode != null) {
+ if (selectedNode.getUserObject() instanceof JournalTreeTicketStep) {
+ // if the operation is updateDocument, we can replay from this step
+ JournalTreeTicketStep step = (JournalTreeTicketStep)selectedNode.getUserObject();
+ boolean found = step.getQTicket().getOperation().equals(JournalOperation.updateDocument.toString());
+ if (found) {
+ jMenuEditReplay.setEnabled(true);
+ jMenuEditShowDocument.setEnabled(true);
+ }
+ else {
+ jMenuEditReplay.setEnabled(false);
+ jMenuEditShowDocument.setEnabled(false);
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Implements the ActionListener that handles the REPLAY functionality
+ *
+ * @author David Glick
+ * @version $Revision$
+ */
+ class ReplayActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent ae) {
+ // the tree listener ensures that only steps that can be replayed will
+ // enable the replay menu option. Just do it.
+ // Sanity checks first.
+ TreePath selectedTreePath = tree.getSelectionPath();
+ if (selectedTreePath != null) {
+ DefaultMutableTreeNode selectedNode =
+ (DefaultMutableTreeNode)selectedTreePath.getLastPathComponent();
+ if (selectedNode.getUserObject() instanceof JournalTreeTicketStep) {
+ JournalTreeTicketStep step = (JournalTreeTicketStep)selectedNode.getUserObject();
+ try {
+ model.getJournal().replayTicket(step.getQTicket().getTicket(),
+ step.getQTicket().getStep());
+ }
+ catch (JournalException e) {
+ // display error message
+ JOptionPane.showMessageDialog(
+ null,
+ "Error replaying journal:\n" + e.toString(),
+ "JournalBrowser Replay Error",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Implements the ActionListener that handles the SHOW DOCUMENT functionality
+ *
+ * @author David Glick
+ * @version $Revision$
+ */
+ class ShowDocumentActionListener implements ActionListener {
+ public void actionPerformed(ActionEvent ae) {
+ // the tree listener ensures that only steps that have documents will
+ // enable the menu option. Just do it.
+ // Sanity checks first.
+ TreePath selectedTreePath = tree.getSelectionPath();
+ if (selectedTreePath != null) {
+ DefaultMutableTreeNode selectedNode =
+ (DefaultMutableTreeNode)selectedTreePath.getLastPathComponent();
+ if (selectedNode.getUserObject() instanceof JournalTreeTicketStep) {
+ JournalTreeTicketStep step = (JournalTreeTicketStep)selectedNode.getUserObject();
+ try {
+ PipelineDocument doc = model.getJournal().getDocumentAtTicketStep(step.getQTicket().getTicket(),
+ step.getQTicket().getStep());
+
+ // create a JTextArea so we can use a JScrollPane to scroll if needed
+ JTextArea text = new JTextArea();
+ text.setLineWrap(true);
+ text.setWrapStyleWord(true);
+ text.setEditable(false);
+ text.setSize(600, 600);
+
+ // show the document
+ text.append("====== Document ======\n");
+ text.append(doc.toString());
+
+ // show the attributes
+ text.append("\n\n====== Attributes ======\n");
+ Set keyset = doc.getAttributes().keySet();
+ Iterator keyiter = keyset.iterator();
+ while(keyiter.hasNext()) {
+ String key = (String)keyiter.next();
+ Object cls = doc.get(key);
+ text.append(key + ": " + cls.toString() + "\n");
+ }
+
+ // wrap the JTextArea in the JScrollpane
+ JScrollPane sp = new JScrollPane(text, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
+ ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
+
+ // show the pane
+ JOptionPane.showMessageDialog(
+ null,
+ sp,
+ "JournalBrowser Show Document",
+ JOptionPane.PLAIN_MESSAGE);
+ }
+ catch (JournalException e) {
+ // display error message
+ JOptionPane.showMessageDialog(
+ null,
+ "Error replaying journal:\n" + e.toString(),
+ "JournalBrowser Replay Error",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ }
+ }
+ }
+
}
Index: JournalTree.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/journal/browser/JournalTree.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** JournalTree.java 19 Aug 2003 05:11:38 -0000 1.3
--- JournalTree.java 6 Sep 2003 00:58:45 -0000 1.4
***************
*** 66,69 ****
--- 66,70 ----
package com.babeldoc.gui.journal.browser;
+ import com.babeldoc.core.journal.JournalOperation;
import com.babeldoc.core.journal.query.QueryTicket;
***************
*** 71,74 ****
--- 72,76 ----
import java.awt.Dimension;
import java.awt.Font;
+ import java.util.Enumeration;
import javax.swing.*;
***************
*** 107,119 ****
/**
! * Populate the tree (duh!)
*/
private void populateTree() {
! QueryTicket[] qts = this.browserModel.getTickets(0, 100);
if (qts != null) {
for (int i = 0; i < qts.length; ++i) {
JournalTreeTicket jtreeticket = new JournalTreeTicket(qts[i]);
- System.out.println("Adding ticket: " + jtreeticket);
DefaultMutableTreeNode node = new DefaultMutableTreeNode(jtreeticket);
--- 109,127 ----
/**
! * Populate the tree with the default journal record set
*/
private void populateTree() {
! populateTree(0, 100);
! }
!
! /**
! * Populate the tree (duh!)
! */
! public void populateTree(int start, int length) {
! QueryTicket[] qts = this.browserModel.getTickets(start, length);
if (qts != null) {
for (int i = 0; i < qts.length; ++i) {
JournalTreeTicket jtreeticket = new JournalTreeTicket(qts[i]);
DefaultMutableTreeNode node = new DefaultMutableTreeNode(jtreeticket);
***************
*** 137,141 ****
/**
! * Cell renderer to show error steps in red
*/
class JournalBrowserCellRenderer extends JPanel implements TreeCellRenderer {
--- 145,149 ----
/**
! * Cell renderer to show steps of interest in color
*/
class JournalBrowserCellRenderer extends JPanel implements TreeCellRenderer {
***************
*** 146,156 ****
protected Font defaultFont;
protected Font boldFont;
! private final Color FAIL_COLOR=Color.WHITE;
! private final Color FAIL_BCOLOR=Color.RED;
! private final Color MSG_COLOR=Color.WHITE;
! private final Color MSG_BCOLOR=Color.BLUE;
private final int STRUT_WIDTH=4;
/**
* Constructor
--- 154,169 ----
protected Font defaultFont;
protected Font boldFont;
+ protected Font italicFont;
! private final Color FAIL_BCOLOR=Color.WHITE;
! private final Color FAIL_COLOR=Color.RED;
! private final Color MSG_BCOLOR=Color.WHITE;
! private final Color MSG_COLOR=Color.BLUE;
private final int STRUT_WIDTH=4;
+ private final int NORMAL_STEP=0;
+ private final int ERROR_STEP=1;
+ private final int JOURNAL_STEP=2;
+
/**
* Constructor
***************
*** 173,178 ****
defaultFont = text.getFont();
! // create a bold font to use for emphasis
! boldFont = new Font(defaultFont.getName(), Font.BOLD, defaultFont.getSize());
}
--- 186,192 ----
defaultFont = text.getFont();
! // create fonts to use for emphasis
! boldFont = new Font(defaultFont.getName(), Font.BOLD, defaultFont.getSize());
! italicFont = new Font(defaultFont.getName(), Font.ITALIC, defaultFont.getSize()+2);
}
***************
*** 213,235 ****
// do a bit of sanity checking here
if (value instanceof DefaultMutableTreeNode) {
-
DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
if (node.getUserObject() instanceof JournalTreeTicketStep) {
- // Use the following color scheme:
- // failure = red background, white text
- // message = green background, white text
- QueryTicket ticket = (QueryTicket)((JournalTreeTicketStep)node.getUserObject()).getQTicket();
if (leaf) {
! if (ticket.getOperation().equals("updateStatus") && ticket.getOther().equals("fail")) {
! text.setForeground(FAIL_COLOR);
! text.setBackground(FAIL_BCOLOR);
! text.setFont(boldFont);
! }
! else if (ticket.getOperation().equals("updateJournal")) {
! text.setForeground(MSG_COLOR);
! text.setBackground(MSG_BCOLOR);
! text.setFont(boldFont);
}
}
}
}
--- 227,268 ----
// do a bit of sanity checking here
if (value instanceof DefaultMutableTreeNode) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
if (node.getUserObject() instanceof JournalTreeTicketStep) {
if (leaf) {
! setSpecialColor((JournalTreeTicketStep)node.getUserObject(), text,
! selected);
! }
! }
! else if (node.getUserObject() instanceof JournalTreeTicket) {
! // if any children are in error state, use error color. Else if
! // any children are in journalUpdate state, use journal color
! JournalTreeTicketStep step = null;
! Enumeration enum = node.children();
! while (enum.hasMoreElements()) {
! DefaultMutableTreeNode elem = (DefaultMutableTreeNode)enum.nextElement();
! if (elem.getUserObject() instanceof JournalTreeTicketStep) {
! JournalTreeTicketStep tStep = (JournalTreeTicketStep)elem.getUserObject();
!
! // any error immediately shows error and leaves
! if (tStep.getState() == JournalTreeTicketStep.ERROR_STEP) {
! step = tStep;
! break; // no need to scan any further (think about it!)
! }
! else if (tStep.getState() == JournalTreeTicketStep.JOURNAL_STEP) {
! step = tStep;
! }
! // make sure step has a value so that, if no special color needs
! // to be displayed, we can still show the normal colors
! else if (step==null) {
! step = tStep;
! }
}
}
+
+ // if any color needs to be set, do so now based on the saved
+ // step
+ if (step != null) {
+ setSpecialColor(step, text, selected);
+ }
}
}
***************
*** 249,252 ****
--- 282,312 ----
super.setBackground(color);
}
+
+ /**
+ * Change the text color if a failure or journalUpdate occurred
+ * @param ticket the QueryTicket to test
+ */
+ protected void setSpecialColor(JournalTreeTicketStep step, JTextArea text,
+ boolean selected) {
+ if (step.getState() == JournalTreeTicketStep.ERROR_STEP) {
+ text.setForeground(selected?FAIL_BCOLOR:FAIL_COLOR);
+ text.setBackground(selected?FAIL_COLOR:FAIL_BCOLOR);
+ text.setFont(boldFont);
+ }
+ else if (step.getState() == JournalTreeTicketStep.JOURNAL_STEP) {
+ text.setForeground(selected?MSG_BCOLOR:MSG_COLOR);
+ text.setBackground(selected?MSG_COLOR:MSG_BCOLOR);
+ text.setFont(boldFont);
+ }
+ else {
+ if (step.getState() == JournalTreeTicketStep.DOCUMENT_STEP) {
+ text.setFont(boldFont);
+ }
+
+ // no special color; set standard colors
+ text.setForeground(selected?text.getSelectedTextColor():text.getForeground());
+ text.setBackground(selected?text.getSelectionColor():text.getBackground());
+ }
+ }
}
}
***************
*** 326,336 ****
*/
class JournalTreeTicketStep extends JournalTreeObject {
/**
* Creates a new JournalTreeTicketStep object.
*
! * @param qticket DOCUMENT ME!
*/
public JournalTreeTicketStep(QueryTicket qticket) {
super(qticket);
}
--- 386,418 ----
*/
class JournalTreeTicketStep extends JournalTreeObject {
+ public static final int NORMAL_STEP = 1;
+ public static final int ERROR_STEP = 2;
+ public static final int JOURNAL_STEP = 3;
+ public static final int DOCUMENT_STEP = 4;
+
+ private int state; // the state of this ticket state
+
/**
* Creates a new JournalTreeTicketStep object.
*
! * @param qticket The QueryTicket represented by this instance
*/
public JournalTreeTicketStep(QueryTicket qticket) {
super(qticket);
+
+ // set the state of this step
+ if (qticket.getOperation().equals(JournalOperation.updateStatus.toString())
+ && qticket.getOther().equals("fail")) {
+ state = ERROR_STEP;
+ }
+ else if (qticket.getOperation().equals(JournalOperation.updateJournal.toString())) {
+ state = JOURNAL_STEP;
+ }
+ else if (qticket.getOperation().equals(JournalOperation.updateDocument.toString())) {
+ state = DOCUMENT_STEP;
+ }
+ else {
+ state = NORMAL_STEP;
+ }
}
***************
*** 346,348 ****
--- 428,438 ----
", other: " + getQTicket().getOther();
}
+
+ /**
+ * Returns the state.
+ * @return int
+ */
+ public int getState() {
+ return state;
+ }
}
Index: Command.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/gui/src/com/babeldoc/gui/journal/browser/Command.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Command.java 11 Jun 2003 23:35:38 -0000 1.2
--- Command.java 6 Sep 2003 00:58:45 -0000 1.3
***************
*** 99,103 ****
public void execute(CommandLine commandLine) {
JournalBrowser.run();
- System.out.println("Application has finished");
}
--- 99,102 ----
|
|
From: McDonald, B. <Bru...@ba...> - 2003-09-05 19:10:53
|
David, Hello! thanks for the message - you have come to the right list. Would you be interested in direct CVS access? Those pipeline stages look like something that should be in babeldoc. regards, Bruce. -----Original Message----- From: David Kinnvall [mailto:dav...@al...] Sent: Friday, September 05, 2003 8:09 AM To: bab...@li... Subject: [Babeldoc-devel] static IConfigInfo's in scanners intentional? Hi! I'm currently using Babeldoc (tracking CVS HEAD) to build a small newsfeed integration app for my company, where we will receive realtime news in xml format via ftp to our servers. First: I reeeeally like Babeldoc! Nice work, people! I am having a slight problem with the DirectoryScanner as it is implemented right now. It uses a static IConfigInfo, which means that I cannot define two instances with separate config for each in my scanner/config.properties, since one of the config blocks ends up being applied to and used by both of the scanner workers. My solution right now is to do this: public final IConfigInfo scannerInfo = new ...; instead of this: public static final IConfigInfo scannerInfo = new ...; in the DirectoryScanner (only scanner I currently use), which seems to work nicely. Also, when checking the other scanner implementations, the only one having an IConfigInfo member that is *not* static is the SqlScanner. It seems to me that every scanner needing configuration data should have a non-static IConfigInfo member rather than a static one? Also, I have put together two very simple pipeline stages: - SqlPreparedWriter; similar to the SqlWriter but it supports enumerating each parameter to go into the query, and then uses PreparedStatement.setFoo(index, ...) to set it. I had to do this to be able to properly escape large text blocks which may or may not contain embedded html into the database, which in this case is MySQL. I failed to make the SqlWriter do this without MySQL balking at the input. - FileTransfer; very simple stage to move data from one stream to another. In my case I use this to stream associated files via http from the news provider's website to the filesystem on our servers, based on links embedded in the news xml. It is required for us to know if any transfer failed as well as recording where the transfered files ended up in the filesystem and add this information to the master news xml document before final processing and insertion into the target database via the stage above. Works somewhat like a FileReader directly piped to a FileWriter without affecting the master document and still providing feedback (status) to it. If there is any interest in the above (very simple!) stages, I would be happy to submit them for inclusion and refinement into Babeldoc proper. Oh, if the devel list is not the proper place for posts like this, I apologize. I haven't seen any traffic at all on the users list so... Best regards, David Kinnvall ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Babeldoc-devel mailing list Bab...@li... https://lists.sourceforge.net/lists/listinfo/babeldoc-devel |
|
From: Leech, J. <jl...@vi...> - 2003-09-05 15:31:59
|
I am interested in the SqlPreparedWriter... What is the syntax for using it? I was considering writing something similar and didn't get around to it. Sincerely, Jonathan Leech Senior Software Engineer Virtela Communications, Inc. -----Original Message----- From: David Kinnvall [mailto:dav...@al...] Sent: Friday, September 05, 2003 6:09 AM To: bab...@li... Subject: [Babeldoc-devel] static IConfigInfo's in scanners intentional? Hi! I'm currently using Babeldoc (tracking CVS HEAD) to build a small newsfeed integration app for my company, where we will receive realtime news in xml format via ftp to our servers. First: I reeeeally like Babeldoc! Nice work, people! I am having a slight problem with the DirectoryScanner as it is implemented right now. It uses a static IConfigInfo, which means that I cannot define two instances with separate config for each in my scanner/config.properties, since one of the config blocks ends up being applied to and used by both of the scanner workers. My solution right now is to do this: public final IConfigInfo scannerInfo = new ...; instead of this: public static final IConfigInfo scannerInfo = new ...; in the DirectoryScanner (only scanner I currently use), which seems to work nicely. Also, when checking the other scanner implementations, the only one having an IConfigInfo member that is *not* static is the SqlScanner. It seems to me that every scanner needing configuration data should have a non-static IConfigInfo member rather than a static one? Also, I have put together two very simple pipeline stages: - SqlPreparedWriter; similar to the SqlWriter but it supports enumerating each parameter to go into the query, and then uses PreparedStatement.setFoo(index, ...) to set it. I had to do this to be able to properly escape large text blocks which may or may not contain embedded html into the database, which in this case is MySQL. I failed to make the SqlWriter do this without MySQL balking at the input. - FileTransfer; very simple stage to move data from one stream to another. In my case I use this to stream associated files via http from the news provider's website to the filesystem on our servers, based on links embedded in the news xml. It is required for us to know if any transfer failed as well as recording where the transfered files ended up in the filesystem and add this information to the master news xml document before final processing and insertion into the target database via the stage above. Works somewhat like a FileReader directly piped to a FileWriter without affecting the master document and still providing feedback (status) to it. If there is any interest in the above (very simple!) stages, I would be happy to submit them for inclusion and refinement into Babeldoc proper. Oh, if the devel list is not the proper place for posts like this, I apologize. I haven't seen any traffic at all on the users list so... Best regards, David Kinnvall ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Babeldoc-devel mailing list Bab...@li... https://lists.sourceforge.net/lists/listinfo/babeldoc-devel |
|
From: Dejan K. <dej...@nb...> - 2003-09-05 13:34:31
|
David, all, I have removed static fields form worker classes so now every worker now has each own's ConfigInfo object. However, I have no time right now for testing. So, if you have a time, please checkout CVS HEAD and let me know the results... Dejan |
|
From: <de...@us...> - 2003-09-05 13:28:33
|
Update of /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner
In directory sc8-pr-cvs1:/tmp/cvs-serv31468/modules/scanner/src/com/babeldoc/scanner
Modified Files:
ScannerWorker.java Scanner.java
Log Message:
Fixing problem with static filed for IConfigInfo object
Index: ScannerWorker.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/ScannerWorker.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** ScannerWorker.java 17 Aug 2003 04:12:29 -0000 1.23
--- ScannerWorker.java 5 Sep 2003 13:28:29 -0000 1.24
***************
*** 86,90 ****
*/
public abstract class ScannerWorker extends Named {
! /** Use this feeder to submit documents to the pipeline */
private IFeeder feeder;
--- 86,92 ----
*/
public abstract class ScannerWorker extends Named {
! private ScannerWorkerInfo info;
!
! /** Use this feeder to submit documents to the pipeline */
private IFeeder feeder;
***************
*** 119,123 ****
* Creates a new ScannerWorker object.
*/
! protected ScannerWorker() {
setStatus(ScannerWorkerStatus.STOPPED);
setValueObject(new ScannerWorkerVO());
--- 121,126 ----
* Creates a new ScannerWorker object.
*/
! protected ScannerWorker(ScannerWorkerInfo info) {
! this.info = info;
setStatus(ScannerWorkerStatus.STOPPED);
setValueObject(new ScannerWorkerVO());
***************
*** 158,162 ****
* @return information object
*/
! public abstract IConfigInfo getInfo();
/**
--- 161,167 ----
* @return information object
*/
! public IConfigInfo getInfo() {
! return info;
! }
/**
Index: Scanner.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/Scanner.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** Scanner.java 14 Aug 2003 02:34:20 -0000 1.27
--- Scanner.java 5 Sep 2003 13:28:29 -0000 1.28
***************
*** 227,231 ****
} catch (Exception e) {
getLog().logError("Error starting scanner worker " + sw[i].getName(), e);
! stop();
}
}
--- 227,232 ----
} catch (Exception e) {
getLog().logError("Error starting scanner worker " + sw[i].getName(), e);
! sw[i].stop();
! //stop();
}
}
|
|
From: Dejan K. <dej...@nb...> - 2003-09-05 12:50:34
|
> Hi! > > I'm currently using Babeldoc (tracking CVS HEAD) to build a > small newsfeed integration app for my company, where we will > receive realtime news in xml format via ftp to our servers. > > First: I reeeeally like Babeldoc! Nice work, people! Thanks, David. It is very important to us that there are users that are not afraid to work with most recent files from CVS HEAD. You like living on the edge, right! ;) > > > I am having a slight problem with the DirectoryScanner as it > is implemented right now. It uses a static IConfigInfo, which > means that I cannot define two instances with separate config > for each in my scanner/config.properties, since one of the > config blocks ends up being applied to and used by both of > the scanner workers. My solution right now is to do this: > > public final IConfigInfo scannerInfo = new ...; > > instead of this: > > public static final IConfigInfo scannerInfo = new ...; > > in the DirectoryScanner (only scanner I currently use), > which seems to work nicely. Also, when checking the other > scanner implementations, the only one having an IConfigInfo > member that is *not* static is the SqlScanner. It seems to > me that every scanner needing configuration data should have > a non-static IConfigInfo member rather than a static one? > I guess you are right. The problem is that ConfigInfo object were used to containt meta information about scanner worker. Since all workers of the same type has same meta information (description, parameter names...) it was defined as static field. But recently this was changed and now these objects contains configuration, too. So they should not be static. I guess we should use the same aproach here as with pipeline stages where Info object is used as parameter of constructor... The problem is that I am the one mostly responisble for scanner module. But these days I really haven't time for Babeldoc, so I haven't tested new code that Bruce has changed. I would also ask you to report this as a bug. > Also, I have put together two very simple pipeline stages: > > - SqlPreparedWriter; similar to the SqlWriter but it supports > enumerating each parameter to go into the query, and then > uses PreparedStatement.setFoo(index, ...) to set it. I had > to do this to be able to properly escape large text blocks > which may or may not contain embedded html into the database, > which in this case is MySQL. I failed to make the SqlWriter > do this without MySQL balking at the input. Is it possible to add this functionality to SqlWriter instead of creting new pipeline stage? > - FileTransfer; very simple stage to move data from one stream > to another. In my case I use this to stream associated files > via http from the news provider's website to the filesystem > on our servers, based on links embedded in the news xml. It > is required for us to know if any transfer failed as well as > recording where the transfered files ended up in the filesystem > and add this information to the master news xml document before > final processing and insertion into the target database via the > stage above. Works somewhat like a FileReader directly piped to > a FileWriter without affecting the master document and still > providing feedback (status) to it. > > If there is any interest in the above (very simple!) stages, I > would be happy to submit them for inclusion and refinement into > Babeldoc proper. I think you should upload your code to SF (feature suggestions or pathces section) so we can review it. > Oh, if the devel list is not the proper place for posts like > this, I apologize. I haven't seen any traffic at all on the > users list so... We have created user mailing list for some less tehnical questions but there are no posts there yet. All Babeldoc users sooner or later become developers ;) So, yes, this is the right place for your questions! Dejan |
|
From: David K. <dav...@al...> - 2003-09-05 12:09:43
|
Hi! I'm currently using Babeldoc (tracking CVS HEAD) to build a small newsfeed integration app for my company, where we will receive realtime news in xml format via ftp to our servers. First: I reeeeally like Babeldoc! Nice work, people! I am having a slight problem with the DirectoryScanner as it is implemented right now. It uses a static IConfigInfo, which means that I cannot define two instances with separate config for each in my scanner/config.properties, since one of the config blocks ends up being applied to and used by both of the scanner workers. My solution right now is to do this: public final IConfigInfo scannerInfo = new ...; instead of this: public static final IConfigInfo scannerInfo = new ...; in the DirectoryScanner (only scanner I currently use), which seems to work nicely. Also, when checking the other scanner implementations, the only one having an IConfigInfo member that is *not* static is the SqlScanner. It seems to me that every scanner needing configuration data should have a non-static IConfigInfo member rather than a static one? Also, I have put together two very simple pipeline stages: - SqlPreparedWriter; similar to the SqlWriter but it supports enumerating each parameter to go into the query, and then uses PreparedStatement.setFoo(index, ...) to set it. I had to do this to be able to properly escape large text blocks which may or may not contain embedded html into the database, which in this case is MySQL. I failed to make the SqlWriter do this without MySQL balking at the input. - FileTransfer; very simple stage to move data from one stream to another. In my case I use this to stream associated files via http from the news provider's website to the filesystem on our servers, based on links embedded in the news xml. It is required for us to know if any transfer failed as well as recording where the transfered files ended up in the filesystem and add this information to the master news xml document before final processing and insertion into the target database via the stage above. Works somewhat like a FileReader directly piped to a FileWriter without affecting the master document and still providing feedback (status) to it. If there is any interest in the above (very simple!) stages, I would be happy to submit them for inclusion and refinement into Babeldoc proper. Oh, if the devel list is not the proper place for posts like this, I apologize. I haven't seen any traffic at all on the users list so... Best regards, David Kinnvall |
|
From: <tr...@us...> - 2003-09-04 03:17:00
|
Update of /cvsroot/babeldoc/babeldoc
In directory sc8-pr-cvs1:/tmp/cvs-serv30555
Modified Files:
build.xml quickstart-en.txt
Log Message:
Changes to the build.xml, quickstart.txt and the documentation pipeline. The documentation pipeline now doesnt require a file - it loads the userguide and devguide automatically.
Index: build.xml
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/build.xml,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** build.xml 29 Aug 2003 21:16:07 -0000 1.15
--- build.xml 4 Sep 2003 03:16:53 -0000 1.16
***************
*** 45,49 ****
<zip destfile="${bin_zip_file}.zip">
<zipfileset dir="." includes="quickstart*.txt" prefix="${bin_zip_file}"/>
! <zipfileset dir="readme" prefix="${bin_zip_file}/readme"/>
<zipfileset dir="build" includes="**/*" prefix="${bin_zip_file}"/>
</zip>
--- 45,49 ----
<zip destfile="${bin_zip_file}.zip">
<zipfileset dir="." includes="quickstart*.txt" prefix="${bin_zip_file}"/>
! <!--<zipfileset dir="readme" prefix="${bin_zip_file}/readme"/>-->
<zipfileset dir="build" includes="**/*" prefix="${bin_zip_file}"/>
</zip>
***************
*** 166,169 ****
--- 166,172 ----
</target>
+ <!--
+ Setup the project
+ -->
<target
name="setup"
***************
*** 176,179 ****
--- 179,183 ----
<moduleRunner target="setup" modules="${babeldoc_modules}"/>
</target>
+
<!--
Build target - call build on all the modules
***************
*** 187,190 ****
--- 191,197 ----
<moduleRunner target="build" modules="${babeldoc_modules}"/>
+ <copy toDir="build/readme">
+ <fileset dir="readme"/>
+ </copy>
</target>
Index: quickstart-en.txt
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/quickstart-en.txt,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** quickstart-en.txt 27 Jun 2003 02:43:17 -0000 1.5
--- quickstart-en.txt 4 Sep 2003 03:16:53 -0000 1.6
***************
*** 15,23 ****
3. Building (if required)
-----------
! a1. Windows: build setup
! a2. Windows: build
- b1. Unix: ./build.sh setup (you might need to make this executable)
- b1. Unix: ./build.sh
4. Environment variables
--- 15,23 ----
3. Building (if required)
-----------
! a. Windows: build setup build
! b. Unix: ./build.sh setup build
!
! (you might need to make the build.sh script executable)
4. Environment variables
***************
*** 26,30 ****
attempt to find the correct BABELDOC_HOME directory.
! a. Set the BABELDOC_HOME environmet variable to the subdirectory
'build' in the directory you have installed Babeldoc.
b. Add %BABELDOC_HOME%\bin (Windows) or ${BABELDOC_HOME}\bin (*nix) to
--- 26,30 ----
attempt to find the correct BABELDOC_HOME directory.
! a. Set the BABELDOC_HOME environment variable to the subdirectory
'build' in the directory you have installed Babeldoc.
b. Add %BABELDOC_HOME%\bin (Windows) or ${BABELDOC_HOME}\bin (*nix) to
***************
*** 34,39 ****
5. Documentation: userguide
----------------------------
! a. Windows: build\bin\babeldoc process -p documentation -f readme\userguide.xml -a "style=html"
b1. Unix: You may need to make files executable: ./build.sh make-executable
! b2. Unix: build/bin/babeldoc process -p documentation -f readme/userguide.xml -a style=html
! (The documentation will be written to readme/userguide.xml.html)
--- 34,42 ----
5. Documentation: userguide
----------------------------
! a. Windows: babeldoc process -p documentation -a "style=html"
b1. Unix: You may need to make files executable: ./build.sh make-executable
! b2. Unix: babeldoc process -p documentation -a style=html
!
! The documentation will be written to the files:
! 1. readme/userguide.xml.html
! 2. readme/devguide.xml.html
|
|
From: <tr...@us...> - 2003-09-04 03:17:00
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/config/pipeline/documentation
In directory sc8-pr-cvs1:/tmp/cvs-serv30555/modules/core/config/pipeline/documentation
Modified Files:
documentation.properties
Log Message:
Changes to the build.xml, quickstart.txt and the documentation pipeline. The documentation pipeline now doesnt require a file - it loads the userguide and devguide automatically.
Index: documentation.properties
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/config/pipeline/documentation/documentation.properties,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** documentation.properties 9 Aug 2003 00:21:13 -0000 1.4
--- documentation.properties 4 Sep 2003 03:16:53 -0000 1.5
***************
*** 1,11 ****
entryStage=attrdefault
- #attrcheck.stageType=Scripting
- #attrcheck.nextStage=choose
- #attrcheck.language=javascript
- #attrcheck.scriptFile=core/scripts/attrcheck.js
- #attrcheck.attrs.style=Attribute 'Style' required. This attribute determines the output document type. One of: html, xhtml, text
- #attrcheck.failOnError=true
-
attrdefault.stageType=Scripting
attrdefault.nextStage=callstages
--- 1,4 ----
***************
*** 27,31 ****
callprocessors.callStage=documentation.processorxml
callprocessors.discardResults=true
! callprocessors.nextStage=choose
choose.stageType=Router
--- 20,42 ----
callprocessors.callStage=documentation.processorxml
callprocessors.discardResults=true
! callprocessors.nextStage=loaduserguide
!
! loaduserguide.stageType=Reader
! loaduserguide.nextStage=callgenerateug
! loaduserguide.file=${system.get("babeldoc.home")}/readme/userguide.xml
!
! callgenerateug.stageType=CallStage
! callgenerateug.callStage=documentation.choose
! callgenerateug.discardResults=true
! callgenerateug.nextStage=loaddevguide
!
! loaddevguide.stageType=Reader
! loaddevguide.nextStage=callgeneratedg
! loaddevguide.file=${system.get("babeldoc.home")}/readme/devguide.xml
!
! callgeneratedg.stageType=CallStage
! callgeneratedg.callStage=documentation.choose
! callgeneratedg.discardResults=true
! callgeneratedg.nextStage=null
choose.stageType=Router
***************
*** 34,43 ****
transform.stageType=XslTransform
! transform.transformationFile=readme/docbook-xsl/${document.get("style")}/docbook.xsl
transform.param."html.stylesheet"=style.css
transform.nextStage=writer
pdftransform.stageType=XslTransform
! pdftransform.transformationFile=readme/docbook-xsl/fo/docbook.xsl
pdftransform.nextStage=fotransform
--- 45,54 ----
transform.stageType=XslTransform
! transform.transformationFile=${system.get("babeldoc.home")}/readme/docbook-xsl/${document.get("style")}/docbook.xsl
transform.param."html.stylesheet"=style.css
transform.nextStage=writer
pdftransform.stageType=XslTransform
! pdftransform.transformationFile=${system.get("babeldoc.home")}/readme/docbook-xsl/fo/docbook.xsl
pdftransform.nextStage=fotransform
|
|
From: <tr...@us...> - 2003-09-04 03:02:52
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/stage
In directory sc8-pr-cvs1:/tmp/cvs-serv28411
Modified Files:
XslTransformPipelineStage.java
Log Message:
Additional xsl transform error checking for incorrectly named files
Index: XslTransformPipelineStage.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/stage/XslTransformPipelineStage.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** XslTransformPipelineStage.java 5 Aug 2003 23:28:30 -0000 1.17
--- XslTransformPipelineStage.java 4 Sep 2003 03:02:48 -0000 1.18
***************
*** 174,197 ****
if (xslfile != null) {
URL url = ResourceLoader.getUrl(xslfile);
- String protocol = url.getProtocol().toLowerCase();
! if ("file".equals(protocol)) {
! transformer = getCachedFileTransformer(xslfile);
! } else {
! InputStream is;
! StreamSource xslSource;
! is = ResourceLoader.getResourceStream(xslfile);
! xslSource = new StreamSource(is);
! // Note that if we don't do this, relative URLs can not be resolved correctly!
! String urlStr = url.toString();
! xslSource.setSystemId(urlStr);
! TransformerFactory transFact = TransformerFactory.newInstance();
! transformer = transFact.newTransformer(xslSource);
}
- } else if (xslscript != null) {
- transformer = getCachedScriptTransformer(xslscript);
- } else {
- throw new PipelineException(I18n.get("core.stage.xslTransform.error"));
}
--- 174,200 ----
if (xslfile != null) {
URL url = ResourceLoader.getUrl(xslfile);
! if(url!=null) {
! String protocol = url.getProtocol().toLowerCase();
! if ("file".equals(protocol)) {
! transformer = getCachedFileTransformer(xslfile);
! } else {
! InputStream is;
! StreamSource xslSource;
! is = ResourceLoader.getResourceStream(xslfile);
! xslSource = new StreamSource(is);
!
! // Note that if we don't do this, relative URLs can not be resolved correctly!
! String urlStr = url.toString();
! xslSource.setSystemId(urlStr);
! TransformerFactory transFact = TransformerFactory.newInstance();
! transformer = transFact.newTransformer(xslSource);
! }
! } else if (xslscript != null) {
! transformer = getCachedScriptTransformer(xslscript);
! } else {
! throw new PipelineException(I18n.get("core.stage.xslTransform.error"));
}
}
|
|
From: <tr...@us...> - 2003-09-04 03:00:38
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/stage
In directory sc8-pr-cvs1:/tmp/cvs-serv28086
Modified Files:
ReaderPipelineStage.java
Log Message:
Fixed issue where configuration data was loaded incorrectly. Added necessary attributes to the new document.
Index: ReaderPipelineStage.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/pipeline/stage/ReaderPipelineStage.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ReaderPipelineStage.java 29 Aug 2003 21:25:04 -0000 1.1
--- ReaderPipelineStage.java 4 Sep 2003 03:00:34 -0000 1.2
***************
*** 70,77 ****
import com.babeldoc.core.option.ConfigOption;
import com.babeldoc.core.option.IConfigOptionType;
! import com.babeldoc.core.pipeline.PipelineStage;
! import com.babeldoc.core.pipeline.PipelineStageInfo;
! import com.babeldoc.core.pipeline.PipelineDocument;
! import com.babeldoc.core.pipeline.PipelineException;
import java.util.ArrayList;
--- 70,74 ----
import com.babeldoc.core.option.ConfigOption;
import com.babeldoc.core.option.IConfigOptionType;
! import com.babeldoc.core.pipeline.*;
import java.util.ArrayList;
***************
*** 120,127 ****
* @throws com.babeldoc.core.pipeline.PipelineException DOCUMENT ME!
*/
! public com.babeldoc.core.pipeline.PipelineStageResult[] process()
! throws com.babeldoc.core.pipeline.PipelineException {
! String filename = getInfo().getStrValue(FILE);
if(filename!=null) {
byte [] data = new byte[0];
--- 117,125 ----
* @throws com.babeldoc.core.pipeline.PipelineException DOCUMENT ME!
*/
! public PipelineStageResult[] process()
! throws PipelineException {
! String filename = this.getOptions(FILE);
! //System.out.println("Loading filename: "+filename);
if(filename!=null) {
byte [] data = new byte[0];
***************
*** 132,135 ****
--- 130,135 ----
}
PipelineDocument newDoc = new PipelineDocument(this.getDocument(), data);
+ newDoc.setMimeType(PipelineDocument.getMimeTypeForFile(filename));
+ newDoc.put(PipelineDocument.NAME, filename);
return super.processHelper(newDoc);
}
|
|
From: <tr...@us...> - 2003-09-04 00:37:38
|
Update of /cvsroot/babeldoc/babeldoc In directory sc8-pr-cvs1:/tmp/cvs-serv7681 Modified Files: build.properties Log Message: Bumped version number and renamed CHANGELOG to ChangeLog Index: build.properties =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/build.properties,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** build.properties 29 Aug 2003 21:16:07 -0000 1.17 --- build.properties 4 Sep 2003 00:37:34 -0000 1.18 *************** *** 9,13 **** src = ./src ! babeldoc_version = 1.1.8-dev config = ./config modules = ./modules --- 9,13 ---- src = ./src ! babeldoc_version = 1.1.9-dev config = ./config modules = ./modules |
|
From: <tr...@us...> - 2003-09-04 00:37:38
|
Update of /cvsroot/babeldoc/babeldoc/readme In directory sc8-pr-cvs1:/tmp/cvs-serv7681/readme Added Files: ChangeLog Removed Files: CHANGES Log Message: Bumped version number and renamed CHANGELOG to ChangeLog --- NEW FILE: ChangeLog --- 2003-09-03 20:25 triphop * modules/core/: config/journal/config.properties, config/service/query.properties, src/com/babeldoc/core/journal/dummy/DummyJournal.java: Added a dummy journal - does not do anything with the journal logging 2003-09-02 23:25 triphop * modules/: core/config/journal/config.properties, core/src/com/babeldoc/core/journal/IJournal.java, core/src/com/babeldoc/core/journal/Journal.java, core/src/com/babeldoc/core/journal/JournalConfigInfo.java, core/src/com/babeldoc/core/journal/JournalFactory.java, core/src/com/babeldoc/core/journal/JournalType.java, core/src/com/babeldoc/core/journal/simple/SimpleJournal.java, core/src/com/babeldoc/core/pipeline/PipelineStage.java, j2ee/src/com/babeldoc/j2ee/BaseSessionBean.java, j2ee/src/com/babeldoc/j2ee/journal/EjbClientJournal.java, [...6730 lines suppressed...] modules/core/examples/xslt-include/pipeline/xslt.properties, modules/core/examples/xslt-velocity/README, modules/core/examples/xslt-velocity/data/sample.xml, modules/core/examples/xslt-velocity/data/transform-velocity.xsl, modules/core/examples/xslt-velocity/pipeline/config.properties, modules/core/examples/xslt-velocity/pipeline/xslt-velocity.properties, modules/core/lib/activation.jar, modules/core/lib/avalon-framework.jar, modules/core/lib/batik.jar, modules/core/lib/bsf.jar, modules/core/lib/commons-beanutils.jar, modules/core/lib/commons-cli.jar, modules/core/lib/commons-collections.jar, modules/core/lib/commons-dbcp.jar, modules/core/lib/commons-digester.jar, modules/core/lib/commons-lang.jar, modules/core/lib/commons-logging.jar, modules/core/lib/commons-net-1.0.0-dev.jar, modules/core/lib/commons-pool.jar, modules/core/lib/fop.jar, modules/core/lib/js.jar, modules/core/lib/JTidy.jar, modules/core/lib/junit.jar: Initial revision --- CHANGES DELETED --- |
|
From: <tr...@us...> - 2003-09-04 00:25:43
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/config/journal
In directory sc8-pr-cvs1:/tmp/cvs-serv6124/config/journal
Modified Files:
config.properties
Log Message:
Added a dummy journal - does not do anything with the journal logging
Index: config.properties
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/config/journal/config.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** config.properties 3 Sep 2003 03:25:30 -0000 1.2
--- config.properties 4 Sep 2003 00:25:39 -0000 1.3
***************
*** 1,2 ****
--- 1,7 ----
+ #
+ # Select your journal type here and set configuration
+
+ #journalType=dummy
+
journalType=simple
simpleJournalDir=${system.getProperty("babeldoc.home")}
|
|
From: <tr...@us...> - 2003-09-04 00:25:42
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/journal/dummy
In directory sc8-pr-cvs1:/tmp/cvs-serv6124/src/com/babeldoc/core/journal/dummy
Added Files:
DummyJournal.java
Log Message:
Added a dummy journal - does not do anything with the journal logging
--- NEW FILE: DummyJournal.java ---
package com.babeldoc.core.journal.dummy;
import com.babeldoc.core.journal.*;
import com.babeldoc.core.journal.query.QueryTicket;
import com.babeldoc.core.journal.query.JournalQuery;
import com.babeldoc.core.option.IConfigInfo;
import com.babeldoc.core.pipeline.PipelineDocument;
import java.util.Collection;
import java.util.ArrayList;
/**
* A dummy journal - this journal does nothing
*
* @author bmcdonald
* @version 1.1
*/
public class DummyJournal
implements IJournal {
/** maintain the configuration information object */
private IConfigInfo info;
/**
* Get the configuration iformation for this class
*
* @return IConfigInfo object
*/
public IConfigInfo getInfo() {
if(info==null) {
info = new JournalConfigInfo() {
/**
* This method returns type specific options
*
* @return comments
*/
public Collection getTypeSpecificOptions() {
return new ArrayList();
}
/**
* Return description of this worker
*
* @return description
*/
public String getDescription() {
return "Dummy journal is a do-nothing jounal";
}
/**
* return the name
*
* @return
*/
public String getName() {
return null;
}
};
}
return info;
}
/**
* getChildrenTickets. Get all the tickets which are children of this ticket
*
* @param parent
*
* @return array of child tickets.
*/
public IJournalTicket[] getAllChildTickets(IJournalTicket parent)
throws JournalException {
return new IJournalTicket[0];
}
/**
* getJournalForTicket. Get all the ticketsteps for the ticket.
*
* @param ticket number
*
* @return array of querytickets
*/
public QueryTicket[] getAllTicketSteps(IJournalTicket ticket)
throws JournalException {
return new QueryTicket[0];
}
/**
* retrieve the document from the journal for this ticket, step.
*
* @param ticket - the ticket to replay
* @param step - the step to replay from
*
* @return
*
* @throws JournalException
*/
public PipelineDocument getDocumentAtTicketStep(IJournalTicket ticket,
int step) throws JournalException {
return null;
}
/**
* Get an existing ticket from the string identifier.
*
* @param identifier ;
*
* @return the created tracker ticket
*/
public IJournalTicket getTicket(String identifier) throws JournalException {
return null;
}
/**
* getChild tickets between the specified dates. Return up to the maxreturned
* number of results.
*
* @param jQuery journal query object
*
* @return the results.
*/
public QueryTicket[] getTickets(JournalQuery jQuery)
throws JournalException {
return new QueryTicket[0];
}
/**
* Get a ticket for tracking a document.
*
* @return the created tracker ticket
*/
public IJournalTicket dummyTicket() throws JournalException {
return null;
}
/**
* Get a ticket for tracking a document from a parent ticket.
*
* @param parentTicket the creating ticket
*
* @return the created tracker ticket
*/
public IJournalTicket forkTicket(IJournalTicket parentTicket)
throws JournalException {
return null;
}
/**
* Get a ticket for tracking a document.
*
* @return the created tracker ticket
*/
public IJournalTicket newTicket() throws JournalException {
return null;
}
/**
* Log a message into the log file
*
* @param ticket track the document
* @param stage log message at this pipeline stage
* @param message The message to log
* @throws JournalException
*/
public void logMessage(IJournalTicket ticket, String stage, String message)
throws JournalException {
}
/**
* Replay this ticket from the step
*
* @param ticket - the ticket to replay
* @param step - the step to replay from
*/
public void replayTicket(IJournalTicket ticket, int step)
throws JournalException {
}
/**
* Update a document associated with this ticket
*
* @param ticket - the ticket to replay
* @param document the document to update
* @param stage the pipeline stage resulting in this status change
*/
public void updateDocument(IJournalTicket ticket, PipelineDocument document,
String stage) throws JournalException {
}
/**
* Update the status of this ticket
*
* @param ticket - the ticket for this status
* @param status - the status of the ticket
* @param stage the pipeline stage resulting in this status change
*/
public void updateStatus(IJournalTicket ticket, IJournalStatus status,
String stage) throws JournalException {
}
}
|
|
From: <tr...@us...> - 2003-09-04 00:25:42
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/config/service In directory sc8-pr-cvs1:/tmp/cvs-serv6124/config/service Modified Files: query.properties Log Message: Added a dummy journal - does not do anything with the journal logging Index: query.properties =================================================================== RCS file: /cvsroot/babeldoc/babeldoc/modules/core/config/service/query.properties,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** query.properties 29 Aug 2003 21:25:03 -0000 1.12 --- query.properties 4 Sep 2003 00:25:39 -0000 1.13 *************** *** 24,27 **** --- 24,28 ---- Journal.simple=com.babeldoc.core.journal.simple.SimpleJournal + Journal.dummy=com.babeldoc.core.journal.dummy.DummyJournal PipelineStageFactory.simple=com.babeldoc.core.pipeline.simple.SimplePipelineStageFactory |
|
From: <tr...@us...> - 2003-09-03 23:01:58
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/journal/dummy In directory sc8-pr-cvs1:/tmp/cvs-serv24801/dummy Log Message: Directory /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/journal/dummy added to the repository |
|
From: <tr...@us...> - 2003-09-03 03:26:05
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/config/journal
In directory sc8-pr-cvs1:/tmp/cvs-serv10506/core/config/journal
Modified Files:
config.properties
Log Message:
LARGE, EXTENSIVE UPDATE.
1. All journal classes are now IConfigurable
2. J2ee journal classes using IConfigurable and are consistent
3. Somewhat of a cleanup around the journal code.
Index: config.properties
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/config/journal/config.properties,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** config.properties 24 Feb 2003 22:42:15 -0000 1.1.1.1
--- config.properties 3 Sep 2003 03:25:30 -0000 1.2
***************
*** 1,5 ****
! journal=simple
! #journal=mysql
! #journal=oracle
! #journal=ejb
--- 1,6 ----
! journalType=simple
! simpleJournalDir=${system.getProperty("babeldoc.home")}
! simpleJournalLog=${system.getProperty("babeldoc.home")}/journal.log
! logMaxSize=10000000
!
|
|
From: <tr...@us...> - 2003-09-03 03:25:40
|
Update of /cvsroot/babeldoc/babeldoc/modules/j2ee/src/com/babeldoc/j2ee
In directory sc8-pr-cvs1:/tmp/cvs-serv10506/j2ee/src/com/babeldoc/j2ee
Modified Files:
BaseSessionBean.java
Log Message:
LARGE, EXTENSIVE UPDATE.
1. All journal classes are now IConfigurable
2. J2ee journal classes using IConfigurable and are consistent
3. Somewhat of a cleanup around the journal code.
Index: BaseSessionBean.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/j2ee/src/com/babeldoc/j2ee/BaseSessionBean.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** BaseSessionBean.java 29 Aug 2003 03:31:36 -0000 1.3
--- BaseSessionBean.java 3 Sep 2003 03:25:31 -0000 1.4
***************
*** 99,106 ****
*
* @throws EJBException
- * @throws RemoteException
*/
public void ejbCreate()
! throws CreateException, RemoteException {
}
--- 99,105 ----
*
* @throws EJBException
*/
public void ejbCreate()
! throws CreateException {
}
|
|
From: <tr...@us...> - 2003-09-03 03:25:40
|
Update of /cvsroot/babeldoc/babeldoc/modules/j2ee/src/com/babeldoc/j2ee/pipeline
In directory sc8-pr-cvs1:/tmp/cvs-serv10506/j2ee/src/com/babeldoc/j2ee/pipeline
Modified Files:
EjbClientPipelineStageFactory.java
EjbPipelineStageFactoryBean.java
Log Message:
LARGE, EXTENSIVE UPDATE.
1. All journal classes are now IConfigurable
2. J2ee journal classes using IConfigurable and are consistent
3. Somewhat of a cleanup around the journal code.
Index: EjbClientPipelineStageFactory.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/j2ee/src/com/babeldoc/j2ee/pipeline/EjbClientPipelineStageFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** EjbClientPipelineStageFactory.java 27 Aug 2003 03:32:32 -0000 1.2
--- EjbClientPipelineStageFactory.java 3 Sep 2003 03:25:31 -0000 1.3
***************
*** 103,107 ****
implements IPipelineStageFactory {
! /** jndi name of the remote object */
public static final String EJB_NAME = "ejbName";
public static final String NAMING_URL = "namingUrl";
--- 103,107 ----
implements IPipelineStageFactory {
! /** jndi details */
public static final String EJB_NAME = "ejbName";
public static final String NAMING_URL = "namingUrl";
***************
*** 303,307 ****
*/
public String getName() {
! return "ejbclient";
}
};
--- 303,307 ----
*/
public String getName() {
! return "EjbClientPipelineStageFactory";
}
};
Index: EjbPipelineStageFactoryBean.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/j2ee/src/com/babeldoc/j2ee/pipeline/EjbPipelineStageFactoryBean.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** EjbPipelineStageFactoryBean.java 27 Aug 2003 03:32:32 -0000 1.2
--- EjbPipelineStageFactoryBean.java 3 Sep 2003 03:25:32 -0000 1.3
***************
*** 305,310 ****
Collection specific = new ArrayList();
! specific.add(new ConfigOption(DELEGATED_FACTORY,
! PipelineStageFactoryInfo.PIPELINE_FACTORY_TYPE,
null, true, "The name of the pipeline stage factory that will do the processing of the pipeline"));
--- 305,309 ----
Collection specific = new ArrayList();
! specific.add(new ConfigOption(DELEGATED_FACTORY, PIPELINE_FACTORY_TYPE,
null, true, "The name of the pipeline stage factory that will do the processing of the pipeline"));
|
|
From: <tr...@us...> - 2003-09-03 03:25:40
|
Update of /cvsroot/babeldoc/babeldoc/modules/j2ee/src/com/babeldoc/j2ee/journal
In directory sc8-pr-cvs1:/tmp/cvs-serv10506/j2ee/src/com/babeldoc/j2ee/journal
Modified Files:
EjbClientJournal.java EjbJournalBean.java
Log Message:
LARGE, EXTENSIVE UPDATE.
1. All journal classes are now IConfigurable
2. J2ee journal classes using IConfigurable and are consistent
3. Somewhat of a cleanup around the journal code.
Index: EjbClientJournal.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/j2ee/src/com/babeldoc/j2ee/journal/EjbClientJournal.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** EjbClientJournal.java 27 Aug 2003 03:32:32 -0000 1.2
--- EjbClientJournal.java 3 Sep 2003 03:25:31 -0000 1.3
***************
*** 70,76 ****
--- 70,82 ----
import com.babeldoc.core.pipeline.PipelineDocument;
import com.babeldoc.core.LogService;
+ import com.babeldoc.core.option.IConfigInfo;
+ import com.babeldoc.core.option.IConfigData;
+ import com.babeldoc.core.option.ConfigOption;
+ import com.babeldoc.core.option.IConfigOptionType;
import com.babeldoc.j2ee.ServiceLocator;
import java.rmi.RemoteException;
+ import java.util.Collection;
+ import java.util.ArrayList;
/**
***************
*** 86,105 ****
implements IJournal {
/** Bridged object */
private EjbJournalRemote journal;
/**
! * Constructor
*/
! public EjbClientJournal() {
! try {
! String journalName = EjbJournalHome.JNDI_NAME;
! EjbJournalHome home = (EjbJournalHome)ServiceLocator.getGlobal().getRemoteHome(journalName, EjbJournalHome.class);
! journal = home.create();
! } catch (Exception refx) {
! LogService.getInstance().logError("[EjbClientPipelineStageFactory]", refx);
}
}
/**
* Get an existing ticket from the string identifier.
--- 92,143 ----
implements IJournal {
+ /** jndi details */
+ public static final String EJB_NAME = "ejbName";
+ public static final String NAMING_URL = "namingUrl";
+ public static final String NAMING_PROVIDER = "namingProvider";
+
+ /** configuration information object */
+ private IConfigInfo info;
+
/** Bridged object */
private EjbJournalRemote journal;
/**
! * Set the options. This applies the configuration data
! * to the local set ONLY - the ejb pipeline factory is going to be
! * configured in the container!
! *
! * @params the options on the pipeline stage factory
*/
! public void setOptions(IConfigData data) {
! getInfo().applyConfigData(data);
! }
!
!
! public EjbJournalRemote getJournal() {
! if(journal==null) {
! try {
! String homeName = getInfo().getStrValue(EJB_NAME);
! String providerFactory = getInfo().getStrValue(NAMING_PROVIDER);
! String providerUrl = getInfo().getStrValue(NAMING_URL);
!
! ServiceLocator locator = null;
! if(providerUrl!=null&&providerFactory!=null) {
! locator = new ServiceLocator(providerUrl, providerFactory);
! } else {
! locator = ServiceLocator.getGlobal();
! }
!
! EjbJournalHome home = (EjbJournalHome)locator.
! getRemoteHome(homeName, EjbJournalHome.class);
! this.journal = home.create();
! } catch (Exception e) {
! LogService.getInstance().logError("", e);
! }
}
+ return journal;
}
+
/**
* Get an existing ticket from the string identifier.
***************
*** 111,115 ****
throws JournalException {
try {
! return journal.getTicket(identifier);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
--- 149,153 ----
throws JournalException {
try {
! return getJournal().getTicket(identifier);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
***************
*** 125,129 ****
throws JournalException {
try {
! return journal.newTicket();
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
--- 163,167 ----
throws JournalException {
try {
! return getJournal().newTicket();
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
***************
*** 142,146 ****
throws JournalException {
try {
! journal.logMessage(ticket, stage, message);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
--- 180,184 ----
throws JournalException {
try {
! getJournal().logMessage(ticket, stage, message);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
***************
*** 157,161 ****
throws JournalException {
try {
! return journal.forkTicket(parentTicket);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
--- 195,199 ----
throws JournalException {
try {
! return getJournal().forkTicket(parentTicket);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
***************
*** 174,178 ****
throws JournalException {
try {
! journal.updateDocument(ticket, document, stage);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
--- 212,216 ----
throws JournalException {
try {
! getJournal().updateDocument(ticket, document, stage);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
***************
*** 190,194 ****
throws JournalException {
try {
! journal.updateStatus(ticket, status, stage);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
--- 228,232 ----
throws JournalException {
try {
! getJournal().updateStatus(ticket, status, stage);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
***************
*** 205,209 ****
throws JournalException {
try {
! journal.replayTicket(ticket, step);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
--- 243,247 ----
throws JournalException {
try {
! getJournal().replayTicket(ticket, step);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
***************
*** 222,226 ****
throws JournalException {
try {
! return journal.getTickets(jQuery);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
--- 260,264 ----
throws JournalException {
try {
! return getJournal().getTickets(jQuery);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
***************
*** 236,240 ****
throws JournalException {
try {
! return journal.dummyTicket();
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
--- 274,278 ----
throws JournalException {
try {
! return getJournal().dummyTicket();
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
***************
*** 251,255 ****
throws JournalException {
try {
! return journal.getAllTicketSteps(ticket);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
--- 289,293 ----
throws JournalException {
try {
! return getJournal().getAllTicketSteps(ticket);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
***************
*** 268,272 ****
throws JournalException {
try {
! return journal.getDocumentAtTicketStep(ticket, step);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
--- 306,310 ----
throws JournalException {
try {
! return getJournal().getDocumentAtTicketStep(ticket, step);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
***************
*** 283,290 ****
throws JournalException {
try {
! return journal.getAllChildTickets(parent);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
}
}
}
--- 321,379 ----
throws JournalException {
try {
! return getJournal().getAllChildTickets(parent);
} catch (RemoteException remotex) {
throw new JournalException("", remotex);
}
+ }
+
+ /**
+ * Get the configuration iformation for this class
+ *
+ * @return IConfigInfo object
+ */
+ public IConfigInfo getInfo() {
+ if(info==null) {
+ info = new JournalConfigInfo() {
+ /**
+ * This method returns type specific options
+ *
+ * @return comments
+ */
+ public Collection getTypeSpecificOptions() {
+ Collection options = new ArrayList();
+
+ options.add(new ConfigOption(EJB_NAME,
+ IConfigOptionType.STRING, EjbJournalHome.JNDI_NAME, false,
+ "The name of the ejb jounal to connect to. If not provided, then the name on the HomeInterface will be used instead."));
+ options.add(new ConfigOption(NAMING_PROVIDER,
+ IConfigOptionType.STRING, null, false,
+ "The class name of the naming provider to use instead of the the default"));
+ options.add(new ConfigOption(NAMING_URL,
+ IConfigOptionType.STRING, null, false,
+ "The url of the naming system to get the to the naming provider"));
+
+ return options;
+ }
+
+ /**
+ * Return description of this worker
+ *
+ * @return description
+ */
+ public String getDescription() {
+ return "Local proxy to the ejb journal";
+ }
+
+ /**
+ * return the name
+ *
+ * @return
+ */
+ public String getName() {
+ return "EjbClientJournal";
+ }
+ };
+ }
+ return null;
}
}
Index: EjbJournalBean.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/j2ee/src/com/babeldoc/j2ee/journal/EjbJournalBean.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** EjbJournalBean.java 27 Aug 2003 03:32:32 -0000 1.2
--- EjbJournalBean.java 3 Sep 2003 03:25:31 -0000 1.3
***************
*** 74,77 ****
--- 74,84 ----
import com.babeldoc.core.journal.query.JournalQuery;
import com.babeldoc.core.pipeline.PipelineDocument;
+ import com.babeldoc.core.option.IConfigInfo;
+ import com.babeldoc.core.option.ConfigOption;
+ import com.babeldoc.core.service.ServiceException;
+ import com.babeldoc.core.LogService;
+
+ import java.util.Collection;
+ import java.util.ArrayList;
/**
***************
*** 96,107 ****
implements IJournal {
! /** Configuration Constants */
! public static final String CONFIG_FILENAME = "journal/ejb/config";
! public static final String JOURNAL_CLASS = "journalClassname";
/**
! * Implementing class
*/
! IJournal journal;
/**
--- 103,132 ----
implements IJournal {
! /** Name of the journal type that actually does the work for this ejb journal */
! public static final String DELEGATED_JOURNAL = "DelegatedJournal";
!
! /** Manage this ejb journals configuration information object */
! private IConfigInfo info;
!
! /** Delegated class */
! private IJournal journal;
!
/**
! * Get the delegated journal - create if necessary.
! *
! * @return
*/
! public IJournal getJournal() {
! if(journal==null) {
! String journalName = getInfo().getStrValue(DELEGATED_JOURNAL);
! try {
! journal = (IJournal)JournalType.getJournalType(journalName).getTypeInstance();
! } catch (ServiceException e) {
! LogService.getInstance().logError(e);
! }
! }
! return journal;
! }
/**
***************
*** 114,118 ****
public IJournalTicket getTicket(String identifier)
throws JournalException {
! return journal.getTicket(identifier);
}
--- 139,143 ----
public IJournalTicket getTicket(String identifier)
throws JournalException {
! return getJournal().getTicket(identifier);
}
***************
*** 126,130 ****
public IJournalTicket dummyTicket()
throws JournalException {
! return journal.dummyTicket();
}
--- 151,155 ----
public IJournalTicket dummyTicket()
throws JournalException {
! return getJournal().dummyTicket();
}
***************
*** 138,142 ****
public IJournalTicket newTicket()
throws JournalException {
! return journal.newTicket();
}
--- 163,167 ----
public IJournalTicket newTicket()
throws JournalException {
! return getJournal().newTicket();
}
***************
*** 161,165 ****
public IJournalTicket forkTicket(IJournalTicket parentTicket)
throws JournalException {
! return journal.forkTicket(parentTicket);
}
--- 186,190 ----
public IJournalTicket forkTicket(IJournalTicket parentTicket)
throws JournalException {
! return getJournal().forkTicket(parentTicket);
}
***************
*** 175,179 ****
String stage)
throws JournalException {
! journal.updateDocument(ticket, document, stage);
}
--- 200,204 ----
String stage)
throws JournalException {
! getJournal().updateDocument(ticket, document, stage);
}
***************
*** 189,193 ****
String stage)
throws JournalException {
! journal.updateStatus(ticket, status, stage);
}
--- 214,218 ----
String stage)
throws JournalException {
! getJournal().updateStatus(ticket, status, stage);
}
***************
*** 201,205 ****
public void replayTicket(IJournalTicket ticket, int step)
throws JournalException {
! journal.replayTicket(ticket, step);
}
--- 226,230 ----
public void replayTicket(IJournalTicket ticket, int step)
throws JournalException {
! getJournal().replayTicket(ticket, step);
}
***************
*** 214,218 ****
public QueryTicket[] getTickets(JournalQuery jQuery)
throws JournalException {
! return journal.getTickets(jQuery);
}
--- 239,243 ----
public QueryTicket[] getTickets(JournalQuery jQuery)
throws JournalException {
! return getJournal().getTickets(jQuery);
}
***************
*** 227,231 ****
public QueryTicket [] getAllTicketSteps(IJournalTicket ticket)
throws JournalException {
! return journal.getAllTicketSteps(ticket);
}
--- 252,256 ----
public QueryTicket [] getAllTicketSteps(IJournalTicket ticket)
throws JournalException {
! return getJournal().getAllTicketSteps(ticket);
}
***************
*** 241,245 ****
public PipelineDocument getDocumentAtTicketStep(IJournalTicket ticket, int step )
throws JournalException {
! return journal.getDocumentAtTicketStep(ticket, step);
}
--- 266,270 ----
public PipelineDocument getDocumentAtTicketStep(IJournalTicket ticket, int step )
throws JournalException {
! return getJournal().getDocumentAtTicketStep(ticket, step);
}
***************
*** 254,281 ****
public IJournalTicket[] getAllChildTickets(IJournalTicket parent)
throws JournalException {
! return journal.getAllChildTickets(parent);
}
/**
! * Not implemented - should be overridden if needed
*
* @ejb:interface-method view="both"
*/
! public void ejbCreate() throws CreateException {
! try {
! IConfig config = ConfigService.getInstance().
! getConfig(CONFIG_FILENAME);
! String journalClass = config.getString(JOURNAL_CLASS);
! journal = (IJournal)(Class.forName(journalClass).newInstance());
! }
! catch(ClassNotFoundException classx) {
! throw new CreateException(classx.toString());
! }
! catch(InstantiationException instantx) {
! throw new CreateException(instantx.toString());
! }
! catch(IllegalAccessException accessx) {
! throw new CreateException(accessx.toString());
}
}
}
--- 279,341 ----
public IJournalTicket[] getAllChildTickets(IJournalTicket parent)
throws JournalException {
! return getJournal().getAllChildTickets(parent);
}
/**
! * Get the configuration information from the delegated object not from
! * this object.
*
* @ejb:interface-method view="both"
*/
! public IConfigInfo getDelegatedInfo() {
! return getJournal().getInfo();
! }
!
! /**
! * Get the configuration iformation for this class
! *
! * @return IConfigInfo object
! *
! * @ejb:interface-method view="both"
! */
! public IConfigInfo getInfo() {
! if(info==null) {
! info = new JournalConfigInfo() {
! /**
! * This method returns type specific options
! *
! * @return comments
! */
! public Collection getTypeSpecificOptions() {
! Collection options = new ArrayList();
!
! options.add(new ConfigOption(DELEGATED_JOURNAL, JOURNAL_TYPE,
! null, true, "The journal type of the delegated journal - this journal implmentation actually does the work."));
!
! return options;
! }
!
! /**
! * Return description of this worker
! *
! * @return description
! */
! public String getDescription() {
! return "Ejb Journal - intended for journals running inside j2ee containers.";
! }
!
! /**
! * return the name
! *
! * @return
! */
! public String getName() {
! return "EjbJournal";
! }
!
! };
}
+ return null;
}
}
+
|
|
From: <tr...@us...> - 2003-09-03 03:25:40
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/journal/simple
In directory sc8-pr-cvs1:/tmp/cvs-serv10506/core/src/com/babeldoc/core/journal/simple
Modified Files:
SimpleJournal.java
Log Message:
LARGE, EXTENSIVE UPDATE.
1. All journal classes are now IConfigurable
2. J2ee journal classes using IConfigurable and are consistent
3. Somewhat of a cleanup around the journal code.
Index: SimpleJournal.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/journal/simple/SimpleJournal.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** SimpleJournal.java 18 Aug 2003 19:18:07 -0000 1.9
--- SimpleJournal.java 3 Sep 2003 03:25:31 -0000 1.10
***************
*** 69,73 ****
import com.babeldoc.core.LogService;
import com.babeldoc.core.VariableProcessor;
! import com.babeldoc.core.config.ConfigService;
import com.babeldoc.core.journal.*;
import com.babeldoc.core.journal.query.JournalQuery;
--- 69,75 ----
import com.babeldoc.core.LogService;
import com.babeldoc.core.VariableProcessor;
! import com.babeldoc.core.option.IConfigInfo;
! import com.babeldoc.core.option.ConfigOption;
! import com.babeldoc.core.option.IConfigOptionType;
import com.babeldoc.core.journal.*;
import com.babeldoc.core.journal.query.JournalQuery;
***************
*** 81,84 ****
--- 83,87 ----
import java.util.ArrayList;
import java.util.Date;
+ import java.util.Collection;
import org.apache.commons.lang.NumberUtils;
***************
*** 127,130 ****
--- 130,136 ----
public static final String JOURNAL_DUMMY = "dummy";
+ /** constants: default max log size */
+ public static final int DEFAULT_LOGSIZE = 1024 * 1024;
+
/** constants: configuration name */
public static final String NULL = "null";
***************
*** 137,170 ****
/** Configuration stuff */
! private static FileWriter logWriter;
! private static CSVWriter logPrinter;
! private static String logFile;
! private static int logMaxSize = 1024 * 1024;
/** Locals */
! private static String trackerDir;
private static long lastTicketVal;
- /**
- * get the configuration service
- */
- static {
- try {
- logFile = VariableProcessor.expandString(ConfigService.getString(
- CONFIG_NAME, JOURNAL_LOGFILE));
- logWriter = new FileWriter(logFile, true);
- logPrinter = new CSVWriter(logWriter);
- trackerDir = VariableProcessor.expandString(ConfigService.getString(
- CONFIG_NAME, JOURNAL_DIR));
-
- if (!trackerDir.endsWith(File.separator)) {
- trackerDir += File.separator;
- }
- logMaxSize = NumberUtils.stringToInt(ConfigService.getString(CONFIG_NAME, JOURNAL_MAXSIZE));
- } catch (Exception confx) {
- System.out.println(confx);
- }
- }
/**
--- 143,157 ----
/** Configuration stuff */
! private FileWriter logWriter;
! private CSVWriter logPrinter;
! private String logFile;
! private int logMaxSize;
/** Locals */
! private String trackerDir;
private static long lastTicketVal;
+ private IConfigInfo info;
/**
***************
*** 182,186 ****
try {
! CSVReader csvReader = new CSVReader(new FileReader(logFile));
String[] values;
String tickval = Long.toString(((JournalTicket) parent).getValue());
--- 169,173 ----
try {
! CSVReader csvReader = new CSVReader(new FileReader(getLogFile()));
String[] values;
String tickval = Long.toString(((JournalTicket) parent).getValue());
***************
*** 215,219 ****
try {
! CSVReader csvReader = new CSVReader(new FileReader(logFile));
String[] values;
--- 202,206 ----
try {
! CSVReader csvReader = new CSVReader(new FileReader(getLogFile()));
String[] values;
***************
*** 327,331 ****
try {
! BufferedReader reader = new BufferedReader(new FileReader(logFile));
CSVReader csvReader = new CSVReader(reader);
String[] values = null;
--- 314,318 ----
try {
! BufferedReader reader = new BufferedReader(new FileReader(getLogFile()));
CSVReader csvReader = new CSVReader(reader);
String[] values = null;
***************
*** 476,498 ****
if (operation.equals(JournalOperation.updateStatus)) {
! logPrinter.put(ticket.getId());
! logPrinter.put(Integer.toString(index));
! logPrinter.put(operation.toString());
! logPrinter.put(Long.toString(new Date().getTime()));
! logPrinter.put(otherStr);
! logPrinter.put(pstageName);
! logPrinter.put(addnl);
} else {
! logPrinter.put(ticket.getId());
! logPrinter.put(Integer.toString(index));
! logPrinter.put(operation.toString());
! logPrinter.put(Long.toString(new Date().getTime()));
! logPrinter.put(otherStr);
! logPrinter.put(pstageName);
! logPrinter.put(NULL);
}
! logPrinter.nl();
try {
! logWriter.flush();
} catch (IOException e) {
throw new JournalException("", e);
--- 463,485 ----
if (operation.equals(JournalOperation.updateStatus)) {
! getLogPrinter().put(ticket.getId());
! getLogPrinter().put(Integer.toString(index));
! getLogPrinter().put(operation.toString());
! getLogPrinter().put(Long.toString(new Date().getTime()));
! getLogPrinter().put(otherStr);
! getLogPrinter().put(pstageName);
! getLogPrinter().put(addnl);
} else {
! getLogPrinter().put(ticket.getId());
! getLogPrinter().put(Integer.toString(index));
! getLogPrinter().put(operation.toString());
! getLogPrinter().put(Long.toString(new Date().getTime()));
! getLogPrinter().put(otherStr);
! getLogPrinter().put(pstageName);
! getLogPrinter().put(NULL);
}
! getLogPrinter().nl();
try {
! getLogWriter().flush();
} catch (IOException e) {
throw new JournalException("", e);
***************
*** 507,522 ****
*/
protected void rollLogFile() throws IOException {
! File log = new File(logFile);
! if (log.length() > SimpleJournal.logMaxSize) {
! logWriter.close();
! String fileName = logFile + "." + new Date().toString();
com.babeldoc.core.LogService.getInstance().logInfo(I18n.get("013001",
fileName));
log.renameTo(new File(fileName));
! logWriter = new FileWriter(logFile, true);
! logPrinter = new CSVWriter(logWriter);
}
}
--- 494,509 ----
*/
protected void rollLogFile() throws IOException {
! File log = new File(getLogFile());
! if (log.length() > getLogMaxSize()) {
! getLogWriter().close();
! String fileName = getLogFile() + "." + new Date().toString();
com.babeldoc.core.LogService.getInstance().logInfo(I18n.get("013001",
fileName));
log.renameTo(new File(fileName));
! logWriter = new FileWriter(getLogFile(), true);
! logPrinter = new CSVWriter(getLogWriter());
}
}
***************
*** 529,534 ****
* @return the log director for the ticket
*/
! private static File getLogDirectory(IJournalTicket ticket) {
! String dir = trackerDir + ticket.getId();
File logDirectory = new File(dir);
--- 516,521 ----
* @return the log director for the ticket
*/
! private File getLogDirectory(IJournalTicket ticket) {
! String dir = getTrackerDir() + ticket.getId();
File logDirectory = new File(dir);
***************
*** 546,551 ****
long val = new Date().getTime();
! if (val == lastTicketVal) {
! val = lastTicketVal + 1;
}
--- 533,538 ----
long val = new Date().getTime();
! if (val == getLastTicketVal()) {
! val = getLastTicketVal() + 1;
}
***************
*** 563,568 ****
* @return the file for the settings
*/
! private static File makeTicketDocumentAttrFile(IJournalTicket ticket, int step) {
! return new File(trackerDir + ticket.getId() + File.separator +
Integer.toString(step) + ATTR_SUFFIX);
}
--- 550,555 ----
* @return the file for the settings
*/
! private File makeTicketDocumentAttrFile(IJournalTicket ticket, int step) {
! return new File(getTrackerDir() + ticket.getId() + File.separator +
Integer.toString(step) + ATTR_SUFFIX);
}
***************
*** 576,581 ****
* @return the file for the settings
*/
! private static File makeTicketDocumentFile(IJournalTicket ticket, int step) {
! return new File(trackerDir + ticket.getId() + File.separator +
Integer.toString(step) + DELTA_SUFFIX);
}
--- 563,568 ----
* @return the file for the settings
*/
! private File makeTicketDocumentFile(IJournalTicket ticket, int step) {
! return new File(getTrackerDir() + ticket.getId() + File.separator +
Integer.toString(step) + DELTA_SUFFIX);
}
***************
*** 636,639 ****
--- 623,754 ----
return i;
+ }
+
+ /**
+ * Get the configuration iformation for this class
+ *
+ * @return IConfigInfo object
+ */
+ public IConfigInfo getInfo() {
+ if(this.info==null) {
+ info = new JournalConfigInfo() {
+ /**
+ * This method returns type specific options
+ *
+ * @return comments
+ */
+ public Collection getTypeSpecificOptions() {
+ Collection options = new ArrayList();
+
+ options.add(new ConfigOption(SimpleJournal.JOURNAL_LOGFILE, IConfigOptionType.FILENAME, null, true,
+ "The journal log file. Each operation is logged to this file."));
+ options.add(new ConfigOption(SimpleJournal.JOURNAL_DIR, IConfigOptionType.DIRECTORY, null, true,
+ "The journal data directory. Each store operation gets placed in a directory."));
+ options.add(new ConfigOption(SimpleJournal.JOURNAL_MAXSIZE, IConfigOptionType.INTEGER,
+ Integer.toString(SimpleJournal.DEFAULT_LOGSIZE), false,
+ "The maximum size that the log can grow to before it is rolled."));
+
+ return options;
+ }
+
+ /**
+ * Return description of this worker
+ *
+ * @return description
+ */
+ public String getDescription() {
+ return "The Simple Journal stores its configuration information in directories and a log file.";
+ }
+
+ /**
+ * return the name
+ *
+ * @return
+ */
+ public String getName() {
+ return "simple";
+ }
+ };
+ }
+ return info;
+ }
+
+ /**
+ * Setup the log printer
+ *
+ * @return
+ */
+ protected CSVWriter getLogPrinter() {
+ if(logPrinter==null) {
+ logPrinter = new CSVWriter(getLogWriter());
+ }
+ return logPrinter;
+ }
+
+ /**
+ * Get the log writer
+ *
+ * @return
+ */
+ protected FileWriter getLogWriter() {
+ if(logWriter==null) {
+ try {
+ logWriter = new FileWriter(getLogFile(), true);
+ } catch (IOException e) {
+ LogService.getInstance().logError(e);
+ }
+ }
+ return logWriter;
+ }
+
+ /**
+ * Get the log file configuration
+ *
+ * @return
+ */
+ protected String getLogFile() {
+ if(logFile==null) {
+ logFile = getInfo().getStrValue(JOURNAL_LOGFILE);
+ logFile = VariableProcessor.expandString(logFile);
+
+ // System.out.println("Setting logFile = "+logFile);
+ }
+ return logFile;
+ }
+
+ /**
+ * Get the maximum size of the log file before it is rolled.
+ *
+ * @return
+ */
+ protected int getLogMaxSize() {
+ if(logMaxSize==0) {
+ logMaxSize = NumberUtils.stringToInt(getInfo().getStrValue(JOURNAL_MAXSIZE), DEFAULT_LOGSIZE);
+
+ // System.out.println("Setting logMaxSize="+logMaxSize);
+ }
+ return logMaxSize;
+ }
+
+ /**
+ * Get the tracker dir
+ *
+ * @return
+ */
+ protected String getTrackerDir() {
+ if(trackerDir==null) {
+ trackerDir = VariableProcessor.expandString(getInfo().getStrValue(JOURNAL_DIR));
+
+ if (!trackerDir.endsWith(File.separator)) {
+ trackerDir += File.separator;
+ }
+
+ // System.out.println("Setting trackerDir="+trackerDir);
+ }
+ return trackerDir;
+ }
+
+ protected static long getLastTicketVal() {
+ return lastTicketVal;
}
}
|
|
From: <tr...@us...> - 2003-09-03 03:25:39
|
Update of /cvsroot/babeldoc/babeldoc/modules/sql/config/journal In directory sc8-pr-cvs1:/tmp/cvs-serv10506/sql/config/journal Added Files: config.properties Log Message: LARGE, EXTENSIVE UPDATE. 1. All journal classes are now IConfigurable 2. J2ee journal classes using IConfigurable and are consistent 3. Somewhat of a cleanup around the journal code. --- NEW FILE: config.properties --- # # This the configuration options for the generic (and hence those # journals extending this journal) #Choose one of the following: #journalType=mysql #journalType=postgresql #journalType=oracle # # The only generic configuration option required - the name of the # babeldoc resource resourceName=babel-journal |
|
From: <tr...@us...> - 2003-09-03 03:25:39
|
Update of /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/journal
In directory sc8-pr-cvs1:/tmp/cvs-serv10506/sql/src/com/babeldoc/sql/journal
Modified Files:
GenericSqlJournal.java PostgreSqlJournal.java
Log Message:
LARGE, EXTENSIVE UPDATE.
1. All journal classes are now IConfigurable
2. J2ee journal classes using IConfigurable and are consistent
3. Somewhat of a cleanup around the journal code.
Index: GenericSqlJournal.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/journal/GenericSqlJournal.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** GenericSqlJournal.java 15 Aug 2003 00:25:30 -0000 1.10
--- GenericSqlJournal.java 3 Sep 2003 03:25:32 -0000 1.11
***************
*** 68,73 ****
import com.babeldoc.core.I18n;
import com.babeldoc.core.LogService;
- import com.babeldoc.core.config.ConfigService;
- import com.babeldoc.core.config.IConfig;
import com.babeldoc.core.journal.*;
import com.babeldoc.core.journal.query.JournalQuery;
--- 68,71 ----
***************
*** 75,82 ****
import com.babeldoc.core.journal.query.QueryOption;
import com.babeldoc.core.journal.query.QueryTicket;
import com.babeldoc.core.pipeline.PipelineDocument;
import com.babeldoc.core.resource.IResource;
import com.babeldoc.core.resource.ResourceFactory;
-
import com.babeldoc.sql.util.SqlQueryManager;
import com.babeldoc.sql.util.TableKeyHelper;
--- 73,82 ----
import com.babeldoc.core.journal.query.QueryOption;
import com.babeldoc.core.journal.query.QueryTicket;
+ import com.babeldoc.core.option.IConfigInfo;
+ import com.babeldoc.core.option.ConfigOption;
+ import com.babeldoc.core.option.IConfigOptionType;
import com.babeldoc.core.pipeline.PipelineDocument;
import com.babeldoc.core.resource.IResource;
import com.babeldoc.core.resource.ResourceFactory;
import com.babeldoc.sql.util.SqlQueryManager;
import com.babeldoc.sql.util.TableKeyHelper;
***************
*** 84,91 ****
import java.io.InputStream;
import java.io.ObjectInputStream;
-
import java.sql.*;
-
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
--- 84,90 ----
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.sql.*;
import java.util.ArrayList;
+ import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
***************
*** 121,143 ****
public static final String LOG_QUERY_ALL_OTHER_VALUES = "queryOtherTicketValues";
! /** The name of the resource forthis sql journal */
! protected static IResource resource;
!
! static {
! try {
! /**
! * configuarion variables
! */
! com.babeldoc.core.LogService.getInstance().logDebug(com.babeldoc.core.I18n.get(
! "sql.401"));
! IConfig config = ConfigService.getInstance().getConfig(CONFIG_FILENAME);
! com.babeldoc.core.LogService.getInstance().logDebug(com.babeldoc.core.I18n.get(
! "sql.402") + config.getString(RESOURCE_NAME));
! resource = ResourceFactory.getResource(config.getString(RESOURCE_NAME));
! } catch (Exception e) {
! com.babeldoc.core.LogService.getInstance().logError("Static{}", e);
! }
! }
/**
--- 120,128 ----
public static final String LOG_QUERY_ALL_OTHER_VALUES = "queryOtherTicketValues";
! /** The name of the resource for this sql journal */
! private IResource resource;
! /** Keep the configuration information handy */
! private SqlJournalInfo info;
/**
***************
*** 160,164 ****
try {
// Get the results from the db and place on stack
! con = (Connection) resource.checkOut();
String query = SqlQueryManager.getSqlQuery(LOG_QUERY_ALL_OTHER_VALUES);
--- 145,149 ----
try {
// Get the results from the db and place on stack
! con = (Connection) getResource().checkOut();
String query = SqlQueryManager.getSqlQuery(LOG_QUERY_ALL_OTHER_VALUES);
***************
*** 191,195 ****
}
! resource.checkIn(con);
} catch (Exception ex) {
LogService.getInstance().logError(I18n.get("sql.403"), ex);
--- 176,180 ----
}
! getResource().checkIn(con);
} catch (Exception ex) {
LogService.getInstance().logError(I18n.get("sql.403"), ex);
***************
*** 221,225 ****
// Get the results from the db and place on stack
! con = (Connection) resource.checkOut();
pstmt = con.prepareStatement(query);
pstmt.setLong(1, tickval);
--- 206,210 ----
// Get the results from the db and place on stack
! con = (Connection) getResource().checkOut();
pstmt = con.prepareStatement(query);
pstmt.setLong(1, tickval);
***************
*** 242,246 ****
}
! resource.checkIn(con);
} catch (Exception ex) {
LogService.getInstance().logError(ex);
--- 227,231 ----
}
! getResource().checkIn(con);
} catch (Exception ex) {
LogService.getInstance().logError(ex);
***************
*** 265,269 ****
try {
! con = (Connection) (resource.checkOut());
doc = (PipelineDocument) (readDelta(con,
((JournalTicket) ticket).getValue(), step));
--- 250,254 ----
try {
! con = (Connection) (getResource().checkOut());
doc = (PipelineDocument) (readDelta(con,
((JournalTicket) ticket).getValue(), step));
***************
*** 274,278 ****
} finally {
try {
! resource.checkIn(con);
} catch (Exception e) {
LogService.getInstance().logError(e);
--- 259,263 ----
} finally {
try {
! getResource().checkIn(con);
} catch (Exception e) {
LogService.getInstance().logError(e);
***************
*** 320,324 ****
// Get the results from the db and place on stack
! con = (Connection) resource.checkOut();
stmt = con.createStatement();
--- 305,309 ----
// Get the results from the db and place on stack
! con = (Connection) getResource().checkOut();
stmt = con.createStatement();
***************
*** 340,344 ****
}
! resource.checkIn(con);
} catch (Exception ex) {
LogService.getInstance().logError(ex);
--- 325,329 ----
}
! getResource().checkIn(con);
} catch (Exception ex) {
LogService.getInstance().logError(ex);
***************
*** 373,379 ****
try {
//getLog().debug("[GenericSqlJournal.forkTicket] called");
! Connection con = (Connection) resource.checkOut();
long nextVal = TableKeyHelper.getNextId(con, "LOG").longValue();
! resource.checkIn(con);
IJournalTicket ticket = new JournalTicket(nextVal);
--- 358,364 ----
try {
//getLog().debug("[GenericSqlJournal.forkTicket] called");
! Connection con = (Connection) getResource().checkOut();
long nextVal = TableKeyHelper.getNextId(con, "LOG").longValue();
! getResource().checkIn(con);
IJournalTicket ticket = new JournalTicket(nextVal);
***************
*** 401,407 ****
try {
//getLog().debug("[GenericSqlJournal.newTicket] called");
! Connection con = (Connection) resource.checkOut();
long nextVal = TableKeyHelper.getNextId(con, "LOG").longValue();
! resource.checkIn(con);
IJournalTicket ticket = new JournalTicket(nextVal);
--- 386,392 ----
try {
//getLog().debug("[GenericSqlJournal.newTicket] called");
! Connection con = (Connection) getResource().checkOut();
long nextVal = TableKeyHelper.getNextId(con, "LOG").longValue();
! getResource().checkIn(con);
IJournalTicket ticket = new JournalTicket(nextVal);
***************
*** 659,663 ****
try {
! con = (Connection) resource.checkOut();
String pstageName = (stage != null) ? stage : "null";
--- 644,648 ----
try {
! con = (Connection) getResource().checkOut();
String pstageName = (stage != null) ? stage : "null";
***************
*** 697,701 ****
}
! resource.checkIn(con);
} catch (Exception se) {
LogService.getInstance().logError(I18n.get("sql.403"), se);
--- 682,686 ----
}
! getResource().checkIn(con);
} catch (Exception se) {
LogService.getInstance().logError(I18n.get("sql.403"), se);
***************
*** 812,814 ****
--- 797,863 ----
}
}
+
+ /**
+ * Get the configuraiton information object for this class
+ *
+ * @return
+ */
+ public IConfigInfo getInfo() {
+ if(info==null) {
+ info = new SqlJournalInfo();
+ }
+ return info;
+ }
+
+ /**
+ * Get the resource for this journal.
+ *
+ * @return
+ */
+ protected IResource getResource() {
+ if(resource==null) {
+ String resourceName = getInfo().getStrValue(RESOURCE_NAME);
+ resource = ResourceFactory.getResource(resourceName);
+ }
+ return resource;
+ }
}
+
+ /**
+ * Configuration information
+ *
+ * @author bmcdonald
+ * @version 1.1
+ */
+ class SqlJournalInfo extends JournalConfigInfo {
+ /**
+ * This method returns type specific options
+ *
+ * @return comments
+ */
+ public Collection getTypeSpecificOptions() {
+ Collection options = new ArrayList();
+
+ options.add(new ConfigOption(GenericSqlJournal.RESOURCE_NAME, IConfigOptionType.FILENAME, null, true,
+ "The journal log file. Each operation is logged to this file."));
+ return options;
+ }
+
+ /**
+ * Return description of this worker
+ *
+ * @return description
+ */
+ public String getDescription() {
+ return "The Sql Journal stores its configuration information in a RDBMS";
+ }
+
+ /**
+ * return the name
+ *
+ * @return
+ */
+ public String getName() {
+ return "sql";
+ }
+ }
\ No newline at end of file
Index: PostgreSqlJournal.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/sql/src/com/babeldoc/sql/journal/PostgreSqlJournal.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PostgreSqlJournal.java 15 Aug 2003 21:22:04 -0000 1.1
--- PostgreSqlJournal.java 3 Sep 2003 03:25:32 -0000 1.2
***************
*** 28,244 ****
* @author <a href="mailto:kg...@ga...">Ken Geis</a>
*/
! public class PostgreSqlJournal extends GenericSqlJournal
! {
! public final static String DELTA_MAKEROW =
! "journalAddBlankDataRow-postgresql";
! public final static String LOG_KEY_GET = "logKeyGet-postgresql";
!
! /**
! * Write a document to the rdbms. Same as in MySqlJournal, but it's
! * probably not a good idea to just subclass it.
! *
! * @param con the connection
! * @param id the log id
! * @param step the log step
! */
! protected void writeDelta (Connection conn, long id, long step,
! PipelineDocument doc) throws SQLException
! {
!
! String insertStmt = SqlQueryManager.getSqlQuery(DELTA_MAKEROW);
! PreparedStatement stmt = null;
! ResultSet rs = null;
! ByteArrayOutputStream baos = null;
!
! try
! {
! // Write the document object to an array of bytes
! baos = new ByteArrayOutputStream();
!
! ObjectOutputStream oos = new ObjectOutputStream(baos);
! oos.writeObject(doc);
! oos.flush();
!
! byte[] docData = baos.toByteArray();
!
! // Now write the row
! stmt = conn.prepareStatement(insertStmt);
! stmt.setLong(1, id);
! stmt.setLong(2, step);
! stmt.setBytes(3, docData);
! stmt.execute();
!
! writeExtraData(conn, id, step, doc);
! }
! catch (Exception e)
! {
! throw new SQLException(e.toString());
! }
! finally
! {
! try
! {
! if (rs != null) rs.close();
! }
! catch (Exception ex)
! {
! LogService.getInstance().logError(I18n.get("sql.403"), ex);
! }
!
! try
! {
! if (stmt != null) stmt.close();
! }
! catch (Exception ex)
! {
! LogService.getInstance().logError(I18n.get("sql.403"), ex);
! }
!
! try
! {
! if (baos != null) baos.close();
! }
! catch (Exception ex)
! {
! LogService.getInstance().logError(I18n.get("sql.403"), ex);
! }
! }
}
! /**
! * getTicketsProcessQueryString concoct the query string from the bits and
! * pieces. Calls back to the getTicketsProcess...
! *
! * @param jQuery
! * @return
! */
! protected StringBuffer getTicketsProcessQueryString (JournalQuery jQuery)
! {
!
! StringBuffer query = super.getTicketsProcessQueryString(jQuery);
!
! // Limit stuff
! if (jQuery.getStartIndex() > 0)
! {
! query.append(" limit " + jQuery.getStartIndex() +
! " offset " + jQuery.getNumResults());
!
! // HACK ALERT - need to do this to stop the parent skipping
! // on the result set.
! //
! // The above comment was taken from the MySQL implementation.
! // I don't know how it effects PostgreSQL.
! jQuery.setStartIndex(0);
! }
!
! return query;
}
-
- /**
- * Get a ticket for tracking a document. This implementation logs the
- * operation to the log file and creates a directory for operations on
- * the ticket.
- *
- * @return
- * @throws JournalException
- */
- public IJournalTicket newTicket () throws JournalException
- {
- try
- {
- //getLog().debug("[PostgreSqlJournal.newTicket] called");
- long nextVal = getNewLogID();
-
- IJournalTicket ticket = new JournalTicket(nextVal);
-
- // Log the operation
- log(ticket, JournalOperation.newTicket, null, null, null);
! return ticket;
! }
! catch (Exception ex)
! {
! throw new JournalException("[GenericSqlJournal.newTicket]", ex);
! }
}
!
! /**
! * Get a ticket for tracking a document. This implementation logs the
! * operation to the log file and creates a directory for operations on
! * the ticket.
! *
! * @param parentTicket
! * @return
! * @throws JournalException
! */
! public IJournalTicket forkTicket (IJournalTicket parentTicket)
! throws JournalException
! {
! try
! {
! long nextVal = getNewLogID();
!
! IJournalTicket ticket = new JournalTicket(nextVal);
!
! // Log the operation
! log(ticket, JournalOperation.forkTicket, parentTicket.toString(),
! null, null);
!
! return ticket;
! } catch (Exception ex) {
! throw new JournalException("[GenericSqlJournal.forkTicket]", ex);
! }
}
!
! protected long getNewLogID ()
! throws SQLException, ResourceException
! {
! Connection conn = null;
! PreparedStatement stmt = null;
! ResultSet rs = null;
!
! try
! {
! String SQL = SqlQueryManager.getSqlQuery(LOG_KEY_GET);
! //getLog().debug("[PostgreSqlJournal.newTicket] called");
! conn = (Connection) resource.checkOut();
! stmt = conn.prepareStatement(SQL);
! rs = stmt.executeQuery();
! rs.next();
! long nextVal = rs.getLong(1);
!
! return nextVal;
! }
! finally
! {
! try
! {
! if (rs != null) rs.close();
! }
! catch (Exception ex)
! {
! LogService.getInstance().logError(I18n.get("sql.403"), ex);
! }
!
! try
! {
! if (stmt != null) stmt.close();
! }
! catch (Exception ex)
! {
! LogService.getInstance().logError(I18n.get("sql.403"), ex);
! }
!
! try
! {
! if (conn != null) resource.checkIn(conn);
! }
! catch (Exception ex)
! {
! LogService.getInstance().logError(I18n.get("sql.403"), ex);
! }
! }
}
!
}
--- 28,207 ----
* @author <a href="mailto:kg...@ga...">Ken Geis</a>
*/
! public class PostgreSqlJournal extends GenericSqlJournal {
! public final static String DELTA_MAKEROW =
! "journalAddBlankDataRow-postgresql";
! public final static String LOG_KEY_GET = "logKeyGet-postgresql";
!
! /**
! * Write a document to the rdbms. Same as in MySqlJournal, but it's
! * probably not a good idea to just subclass it.
! *
! * @param conn the connection
! * @param id the log id
! * @param step the log step
! */
! protected void writeDelta(Connection conn, long id, long step,
! PipelineDocument doc) throws SQLException {
!
! String insertStmt = SqlQueryManager.getSqlQuery(DELTA_MAKEROW);
! PreparedStatement stmt = null;
! ResultSet rs = null;
! ByteArrayOutputStream baos = null;
!
! try {
! // Write the document object to an array of bytes
! baos = new ByteArrayOutputStream();
!
! ObjectOutputStream oos = new ObjectOutputStream(baos);
! oos.writeObject(doc);
! oos.flush();
!
! byte[] docData = baos.toByteArray();
!
! // Now write the row
! stmt = conn.prepareStatement(insertStmt);
! stmt.setLong(1, id);
! stmt.setLong(2, step);
! stmt.setBytes(3, docData);
! stmt.execute();
!
! writeExtraData(conn, id, step, doc);
! } catch (Exception e) {
! throw new SQLException(e.toString());
! } finally {
! try {
! if (rs != null) rs.close();
! } catch (Exception ex) {
! LogService.getInstance().logError(I18n.get("sql.403"), ex);
! }
!
! try {
! if (stmt != null) stmt.close();
! } catch (Exception ex) {
! LogService.getInstance().logError(I18n.get("sql.403"), ex);
! }
!
! try {
! if (baos != null) baos.close();
! } catch (Exception ex) {
! LogService.getInstance().logError(I18n.get("sql.403"), ex);
! }
}
+ }
! /**
! * getTicketsProcessQueryString concoct the query string from the bits and
! * pieces. Calls back to the getTicketsProcess...
! *
! * @param jQuery
! * @return
! */
! protected StringBuffer getTicketsProcessQueryString(JournalQuery jQuery) {
!
! StringBuffer query = super.getTicketsProcessQueryString(jQuery);
!
! // Limit stuff
! if (jQuery.getStartIndex() > 0) {
! query.append(" limit " + jQuery.getStartIndex() +
! " offset " + jQuery.getNumResults());
!
! // HACK ALERT - need to do this to stop the parent skipping
! // on the result set.
! //
! // The above comment was taken from the MySQL implementation.
! // I don't know how it effects PostgreSQL.
! jQuery.setStartIndex(0);
}
! return query;
! }
!
! /**
! * Get a ticket for tracking a document. This implementation logs the
! * operation to the log file and creates a directory for operations on
! * the ticket.
! *
! * @return
! * @throws JournalException
! */
! public IJournalTicket newTicket() throws JournalException {
! try {
! //getLog().debug("[PostgreSqlJournal.newTicket] called");
! long nextVal = getNewLogID();
!
! IJournalTicket ticket = new JournalTicket(nextVal);
!
! // Log the operation
! log(ticket, JournalOperation.newTicket, null, null, null);
!
! return ticket;
! } catch (Exception ex) {
! throw new JournalException("[GenericSqlJournal.newTicket]", ex);
}
! }
!
! /**
! * Get a ticket for tracking a document. This implementation logs the
! * operation to the log file and creates a directory for operations on
! * the ticket.
! *
! * @param parentTicket
! * @return
! * @throws JournalException
! */
! public IJournalTicket forkTicket(IJournalTicket parentTicket)
! throws JournalException {
! try {
! long nextVal = getNewLogID();
!
! IJournalTicket ticket = new JournalTicket(nextVal);
!
! // Log the operation
! log(ticket, JournalOperation.forkTicket, parentTicket.toString(),
! null, null);
!
! return ticket;
! } catch (Exception ex) {
! throw new JournalException("[GenericSqlJournal.forkTicket]", ex);
}
! }
! protected long getNewLogID()
! throws SQLException, ResourceException {
! Connection conn = null;
! PreparedStatement stmt = null;
! ResultSet rs = null;
!
! try {
! String SQL = SqlQueryManager.getSqlQuery(LOG_KEY_GET);
!
! //getLog().debug("[PostgreSqlJournal.newTicket] called");
! conn = (Connection) getResource().checkOut();
! stmt = conn.prepareStatement(SQL);
! rs = stmt.executeQuery();
! rs.next();
! long nextVal = rs.getLong(1);
!
! return nextVal;
! } finally {
! try {
! if (rs != null) rs.close();
! } catch (Exception ex) {
! LogService.getInstance().logError(I18n.get("sql.403"), ex);
! }
!
! try {
! if (stmt != null) stmt.close();
! } catch (Exception ex) {
! LogService.getInstance().logError(I18n.get("sql.403"), ex);
! }
!
! try {
! if (conn != null) getResource().checkIn(conn);
! } catch (Exception ex) {
! LogService.getInstance().logError(I18n.get("sql.403"), ex);
! }
}
! }
!
}
|
Update of /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/journal
In directory sc8-pr-cvs1:/tmp/cvs-serv10506/core/src/com/babeldoc/core/journal
Modified Files:
IJournal.java Journal.java JournalFactory.java
JournalType.java
Added Files:
JournalConfigInfo.java
Log Message:
LARGE, EXTENSIVE UPDATE.
1. All journal classes are now IConfigurable
2. J2ee journal classes using IConfigurable and are consistent
3. Somewhat of a cleanup around the journal code.
--- NEW FILE: JournalConfigInfo.java ---
package com.babeldoc.core.journal;
import com.babeldoc.core.option.ConfigInfo;
import com.babeldoc.core.option.ServiceTypeConfigOptionType;
import java.util.Collection;
import java.util.ArrayList;
/**
* Journal configuration information class
*
* @author bmcdonald
* @version 1.1
*/
abstract public class JournalConfigInfo
extends ConfigInfo {
/** Service type for pipeline stages */
public static final ServiceTypeConfigOptionType JOURNAL_TYPE =
new ServiceTypeConfigOptionType(JournalType.SERVICE_PREFIX);
/**
* This method returns options that are general to all components
*
* @return comments
*/
public Collection getGeneralOptions() {
return new ArrayList();
}
/**
* Return an xmlized version of the of the config info
*
* @return String of configuration information.
*/
public String toXml() {
return null;
}
}
Index: IJournal.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/journal/IJournal.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** IJournal.java 18 Aug 2003 19:18:29 -0000 1.7
--- IJournal.java 3 Sep 2003 03:25:30 -0000 1.8
***************
*** 69,72 ****
--- 69,73 ----
import com.babeldoc.core.journal.query.QueryTicket;
import com.babeldoc.core.pipeline.PipelineDocument;
+ import com.babeldoc.core.option.IConfigurable;
***************
*** 78,82 ****
* @version 1.0
*/
! public interface IJournal {
/**
* getChildrenTickets. Get all the tickets which are children of this ticket
--- 79,84 ----
* @version 1.0
*/
! public interface IJournal
! extends IConfigurable {
/**
* getChildrenTickets. Get all the tickets which are children of this ticket
***************
*** 158,163 ****
/**
* Log a message into the log file
! * @param stage the stage to log
! * @param String The message to log
*/
public void logMessage(IJournalTicket ticket, String stage, String message)
--- 160,168 ----
/**
* Log a message into the log file
! *
! * @param ticket track the document
! * @param stage log message at this pipeline stage
! * @param message The message to log
! * @throws JournalException
*/
public void logMessage(IJournalTicket ticket, String stage, String message)
Index: Journal.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/journal/Journal.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Journal.java 18 Aug 2003 19:18:29 -0000 1.7
--- Journal.java 3 Sep 2003 03:25:30 -0000 1.8
***************
*** 158,163 ****
/**
* Log a message into the log file
! * @param stage the stage to log
! * @param String The message to log
*/
public void logMessage(IJournalTicket ticket, String stage, String message)
--- 158,166 ----
/**
* Log a message into the log file
! *
! * @param ticket track the document
! * @param stage log message at this pipeline stage
! * @param message The message to log
! * @throws JournalException
*/
public void logMessage(IJournalTicket ticket, String stage, String message)
Index: JournalFactory.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/journal/JournalFactory.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** JournalFactory.java 27 Jun 2003 02:19:57 -0000 1.6
--- JournalFactory.java 3 Sep 2003 03:25:30 -0000 1.7
***************
*** 68,72 ****
--- 68,75 ----
import com.babeldoc.core.I18n;
import com.babeldoc.core.LogService;
+ import com.babeldoc.core.option.ConfigData;
+ import com.babeldoc.core.option.IConfigData;
import com.babeldoc.core.config.ConfigService;
+ import com.babeldoc.core.config.IConfig;
***************
*** 84,88 ****
/** constant: journal type */
! public static final String JOURNAL_TYPE = "journal";
/** static: holds singleton reference */
--- 87,91 ----
/** constant: journal type */
! public static final String JOURNAL_TYPE = "journalType";
/** static: holds singleton reference */
***************
*** 97,118 ****
private JournalFactory() {
try {
! String journalType = ConfigService.getString(CONFIG_NAME, JOURNAL_TYPE);
LogService.getInstance().logDebug(I18n.get("016001", journalType));
! if (journalType != null) {
! Class journalClass = JournalType.getJournalType(journalType)
! .getTypeClass();
!
! if (journalClass != null) {
! try {
! journal = (IJournal) (journalClass.newInstance());
! } catch (Exception configx) {
! throw new JournalException(I18n.get("016002", JOURNAL_TYPE), configx);
! }
! } else {
! throw new JournalException(I18n.get("016003", journalType));
! }
! } else {
! throw new JournalException(I18n.get("016004"));
}
} catch (JournalException e) {
--- 100,112 ----
private JournalFactory() {
try {
! IConfigData data = ConfigData.getConfigData("root", CONFIG_NAME);
! String journalType = data.getValue(JOURNAL_TYPE);
LogService.getInstance().logDebug(I18n.get("016001", journalType));
! try {
! journal = (IJournal) JournalType.getJournalType(journalType).getTypeInstance();
! journal.getInfo().applyConfigData(data);
! } catch (Exception configx) {
! throw new JournalException(I18n.get("016002", JOURNAL_TYPE), configx);
}
} catch (JournalException e) {
***************
*** 125,132 ****
*
* @return trackerfactory object
- *
- * @throws JournalException DOCUMENT ME!
*/
! public static JournalFactory getInstance() throws JournalException {
return instance;
}
--- 119,124 ----
*
* @return trackerfactory object
*/
! public static JournalFactory getInstance() {
return instance;
}
***************
*** 136,143 ****
*
* @return the journal object
- *
- * @throws JournalException DOCUMENT ME!
*/
! public static IJournal getJournal() throws JournalException {
return JournalFactory.getInstance().journal;
}
--- 128,133 ----
*
* @return the journal object
*/
! public static IJournal getJournal() {
return JournalFactory.getInstance().journal;
}
Index: JournalType.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/core/src/com/babeldoc/core/journal/JournalType.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** JournalType.java 27 Jun 2003 02:19:57 -0000 1.4
--- JournalType.java 3 Sep 2003 03:25:30 -0000 1.5
***************
*** 77,80 ****
--- 77,83 ----
*/
public class JournalType extends Type {
+ /** Name prefix in the service/config.properties files */
+ public static final String SERVICE_PREFIX = "Journal";
+
/**
* Private constructor - do not use this - use the constants above.
***************
*** 103,107 ****
*/
public String getServicePrefix() {
! return "Journal";
}
}
--- 106,110 ----
*/
public String getServicePrefix() {
! return SERVICE_PREFIX;
}
}
|