[Ejtools-cvs] libraries/common/src/main/org/ejtools/util/state WorkspaceFileTools.java,NONE,1.1 pack
Brought to you by:
letiemble
From: <let...@us...> - 2003-12-14 10:50:07
|
Update of /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/state In directory sc8-pr-cvs1:/tmp/cvs-serv18971/common/src/main/org/ejtools/util/state Modified Files: DefaultRule.java DefaultStoreVisitor.java LoadHandler.java Rule.java Storable.java StoreVisitor.java Added Files: WorkspaceFileTools.java package.html Log Message: Add more javadocs. Add package.html files. --- NEW FILE: WorkspaceFileTools.java --- /* * EJTools, the Enterprise Java Tools * * Distributable under LGPL license. * See terms of license at www.gnu.org. */ package org.ejtools.util.state; import java.util.ResourceBundle; import javax.swing.filechooser.FileFilter; import org.ejtools.util.FileTools; /** * Description of the Class * * @author Laurent Etiemble * @version $Revision: 1.1 $ */ public class WorkspaceFileTools extends FileTools { /** Description of the Field */ private static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.util.Resources"); /** Description of the Field */ public final static FileFilter WORKSPACE_FILE_FILTER = new FileTools.SimpleFileFilter(".xml", resources.getString("workspace.file.dialog.extension.description")); /** Constructor for the FileUtil object */ protected WorkspaceFileTools() { } } --- NEW FILE: package.html --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!-- EJTools, the Enterprise Java Tools Distributable under LGPL license. See terms of license at www.gnu.org. $Revision: 1.1 $ --> <html> <head/> <body> </body> </html> Index: DefaultRule.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/state/DefaultRule.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DefaultRule.java 15 Sep 2003 22:23:45 -0000 1.1 --- DefaultRule.java 13 Dec 2003 21:27:50 -0000 1.2 *************** *** 1,45 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.util.state; ! ! import java.util.Map; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class DefaultRule implements Rule ! { ! /** ! * Description of the Method ! * ! * @param context Description of the Parameter ! */ ! public void loadBody(Map context) ! { ! } ! ! ! /** ! * Description of the Method ! * ! * @param context Description of the Parameter ! */ ! public void loadEnter(Map context) ! { ! } ! ! ! /** ! * Description of the Method ! * ! * @param context Description of the Parameter ! */ ! public void loadExit(Map context) ! { ! } ! } --- 1,45 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.util.state; ! ! import java.util.Map; ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class DefaultRule implements Rule ! { ! /** ! * Description of the Method ! * ! * @param context Description of the Parameter ! */ ! public void loadBody(Map context) ! { ! } ! ! ! /** ! * Description of the Method ! * ! * @param context Description of the Parameter ! */ ! public void loadEnter(Map context) ! { ! } ! ! ! /** ! * Description of the Method ! * ! * @param context Description of the Parameter ! */ ! public void loadExit(Map context) ! { ! } ! } Index: DefaultStoreVisitor.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/state/DefaultStoreVisitor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DefaultStoreVisitor.java 15 Sep 2003 22:23:45 -0000 1.1 --- DefaultStoreVisitor.java 13 Dec 2003 21:27:50 -0000 1.2 *************** *** 1,127 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.util.state; ! ! import java.lang.reflect.Method; ! import java.util.HashMap; ! import java.util.Iterator; ! import java.util.Map; ! import java.util.Stack; ! import org.w3c.dom.Node; ! ! import org.apache.log4j.Logger; ! import org.ejtools.beans.Sort; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class DefaultStoreVisitor implements StoreVisitor ! { ! /** Description of the Field */ ! private Stack nodes = new Stack(); ! /** Description of the Field */ ! private Map persistMappings = new HashMap(); ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(DefaultStoreVisitor.class); ! ! ! ! /**Constructor for the ReflectivePersistenceStore object */ ! public DefaultStoreVisitor() { } ! ! ! /** ! * Description of the Method ! * ! * @param iterator Description of the Parameter ! */ ! public void persist(Iterator iterator) ! { ! Iterator it = Sort.getChildrenByClass(iterator, Storable.class); ! for (; it.hasNext(); ) ! { ! Storable p = (Storable) it.next(); ! p.accept(this); ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @param o Description of the Parameter ! */ ! public void persist(Object o) ! { ! Class clazz = o.getClass(); ! Method m = (Method) this.persistMappings.get(clazz); ! try ! { ! m.invoke(this, new Object[]{o}); ! } ! catch (Exception e) ! { ! logger.debug("Object of type " + o.getClass().getName() + " will not be persist"); ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! protected Node peekCurrentNode() ! { ! return (Node) this.nodes.peek(); ! } ! ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! protected Node popCurrentNode() ! { ! return (Node) this.nodes.pop(); ! } ! ! ! ! /** ! * Description of the Method ! * ! * @param node Description of the Parameter ! */ ! protected void pushCurrentNode(Node node) ! { ! this.nodes.push(node); ! } ! ! ! /** ! * Description of the Method ! * ! * @param clazz Description of the Parameter ! */ ! public final void registerForPersistence(Class clazz) ! { ! try ! { ! Method m = this.getClass().getMethod("persist", new Class[]{clazz}); ! this.persistMappings.put(clazz, m); ! } ! catch (NoSuchMethodException nsme) ! { ! logger.warn("Can't register for persistence class " + clazz.getName()); ! } ! } ! } --- 1,127 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.util.state; ! ! import java.lang.reflect.Method; ! import java.util.HashMap; ! import java.util.Iterator; ! import java.util.Map; ! import java.util.Stack; ! import org.w3c.dom.Node; ! ! import org.apache.log4j.Logger; ! import org.ejtools.beans.Sort; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class DefaultStoreVisitor implements StoreVisitor ! { ! /** Description of the Field */ ! private Stack nodes = new Stack(); ! /** Description of the Field */ ! private Map persistMappings = new HashMap(); ! /** Description of the Field */ ! private static Logger logger = Logger.getLogger(DefaultStoreVisitor.class); ! ! ! ! /**Constructor for the ReflectivePersistenceStore object */ ! public DefaultStoreVisitor() { } ! ! ! /** ! * Description of the Method ! * ! * @param iterator Description of the Parameter ! */ ! public void persist(Iterator iterator) ! { ! Iterator it = Sort.getChildrenByClass(iterator, Storable.class); ! for (; it.hasNext(); ) ! { ! Storable p = (Storable) it.next(); ! p.accept(this); ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @param o Description of the Parameter ! */ ! public void persist(Object o) ! { ! Class clazz = o.getClass(); ! Method m = (Method) this.persistMappings.get(clazz); ! try ! { ! m.invoke(this, new Object[]{o}); ! } ! catch (Exception e) ! { ! logger.debug("Object of type " + o.getClass().getName() + " will not be persist"); ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! protected Node peekCurrentNode() ! { ! return (Node) this.nodes.peek(); ! } ! ! ! ! /** ! * Description of the Method ! * ! * @return Description of the Return Value ! */ ! protected Node popCurrentNode() ! { ! return (Node) this.nodes.pop(); ! } ! ! ! ! /** ! * Description of the Method ! * ! * @param node Description of the Parameter ! */ ! protected void pushCurrentNode(Node node) ! { ! this.nodes.push(node); ! } ! ! ! /** ! * Description of the Method ! * ! * @param clazz Description of the Parameter ! */ ! public final void registerForPersistence(Class clazz) ! { ! try ! { ! Method m = this.getClass().getMethod("persist", new Class[]{clazz}); ! this.persistMappings.put(clazz, m); ! } ! catch (NoSuchMethodException nsme) ! { ! logger.warn("Can't register for persistence class " + clazz.getName()); ! } ! } ! } Index: LoadHandler.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/state/LoadHandler.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LoadHandler.java 15 Sep 2003 22:23:45 -0000 1.1 --- LoadHandler.java 13 Dec 2003 21:27:50 -0000 1.2 *************** *** 1,129 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.util.state; ! ! import java.util.HashMap; ! import java.util.Hashtable; ! import java.util.Map; ! ! import org.xml.sax.Attributes; ! import org.xml.sax.SAXException; ! import org.xml.sax.helpers.DefaultHandler; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class LoadHandler extends DefaultHandler ! { ! /** Description of the Field */ ! private Map context = new HashMap(); ! /** Description of the Field */ ! private String path = ""; ! /** Description of the Field */ ! private Map rules = new Hashtable(); ! ! /** Description of the Field */ ! public final static String ATTRIBUTES = "ATTRIBUTES"; ! /** Description of the Field */ ! public final static String ELEMENT = "ELEMENT"; ! /** Description of the Field */ ! public final static String TEXT = "TEXT"; ! ! ! /**Constructor for the WorkbenchHandler object */ ! public LoadHandler() { } ! ! ! /** ! * Adds a feature to the Rule attribute of the WorkbenchHandler object ! * ! * @param path The feature to be added to the Rule attribute ! * @param rule The feature to be added to the Rule attribute ! */ ! public void addRule(String path, Rule rule) ! { ! this.rules.put(path, rule); ! } ! ! ! /** ! * Description of the Method ! * ! * @param ch Description of the Parameter ! * @param start Description of the Parameter ! * @param length Description of the Parameter ! * @exception SAXException Description of the Exception ! */ ! public void characters(char[] ch, int start, int length) ! throws SAXException ! { ! String text = new String(ch, start, length); ! this.context.put("TEXT", text); ! Rule rule = (Rule) this.rules.get(this.path); ! if (rule != null) ! { ! rule.loadBody(this.context); ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @param uri Description of the Parameter ! * @param localName Description of the Parameter ! * @param qName Description of the Parameter ! * @exception SAXException Description of the Exception ! */ ! public void endElement(String uri, String localName, String qName) ! throws SAXException ! { ! this.context.put("ELEMENT", qName); ! Rule rule = (Rule) this.rules.get(this.path); ! if (rule != null) ! { ! rule.loadExit(this.context); ! } ! this.path = this.path.substring(0, this.path.length() - qName.length() - 1); ! } ! ! ! /** ! * Gets the context attribute of the LoadHandler object ! * ! * @return The context value ! */ ! public Map getContext() ! { ! return this.context; ! } ! ! ! /** ! * Description of the Method ! * ! * @param uri Description of the Parameter ! * @param localName Description of the Parameter ! * @param qName Description of the Parameter ! * @param attributes Description of the Parameter ! * @exception SAXException Description of the Exception ! */ ! public void startElement(String uri, String localName, String qName, Attributes attributes) ! throws SAXException ! { ! this.context.put("ELEMENT", qName); ! this.context.put("ATTRIBUTES", attributes); ! this.path = path + "/" + qName; ! Rule rule = (Rule) this.rules.get(this.path); ! if (rule != null) ! { ! rule.loadEnter(this.context); ! } ! } ! } --- 1,129 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.util.state; ! ! import java.util.HashMap; ! import java.util.Hashtable; ! import java.util.Map; ! ! import org.xml.sax.Attributes; ! import org.xml.sax.SAXException; ! import org.xml.sax.helpers.DefaultHandler; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public class LoadHandler extends DefaultHandler ! { ! /** Description of the Field */ ! private Map context = new HashMap(); ! /** Description of the Field */ ! private String path = ""; ! /** Description of the Field */ ! private Map rules = new Hashtable(); ! ! /** Description of the Field */ ! public final static String ATTRIBUTES = "ATTRIBUTES"; ! /** Description of the Field */ ! public final static String ELEMENT = "ELEMENT"; ! /** Description of the Field */ ! public final static String TEXT = "TEXT"; ! ! ! /**Constructor for the WorkbenchHandler object */ ! public LoadHandler() { } ! ! ! /** ! * Adds a feature to the Rule attribute of the WorkbenchHandler object ! * ! * @param path The feature to be added to the Rule attribute ! * @param rule The feature to be added to the Rule attribute ! */ ! public void addRule(String path, Rule rule) ! { ! this.rules.put(path, rule); ! } ! ! ! /** ! * Description of the Method ! * ! * @param ch Description of the Parameter ! * @param start Description of the Parameter ! * @param length Description of the Parameter ! * @exception SAXException Description of the Exception ! */ ! public void characters(char[] ch, int start, int length) ! throws SAXException ! { ! String text = new String(ch, start, length); ! this.context.put("TEXT", text); ! Rule rule = (Rule) this.rules.get(this.path); ! if (rule != null) ! { ! rule.loadBody(this.context); ! } ! } ! ! ! /** ! * Description of the Method ! * ! * @param uri Description of the Parameter ! * @param localName Description of the Parameter ! * @param qName Description of the Parameter ! * @exception SAXException Description of the Exception ! */ ! public void endElement(String uri, String localName, String qName) ! throws SAXException ! { ! this.context.put("ELEMENT", qName); ! Rule rule = (Rule) this.rules.get(this.path); ! if (rule != null) ! { ! rule.loadExit(this.context); ! } ! this.path = this.path.substring(0, this.path.length() - qName.length() - 1); ! } ! ! ! /** ! * Gets the context attribute of the LoadHandler object ! * ! * @return The context value ! */ ! public Map getContext() ! { ! return this.context; ! } ! ! ! /** ! * Description of the Method ! * ! * @param uri Description of the Parameter ! * @param localName Description of the Parameter ! * @param qName Description of the Parameter ! * @param attributes Description of the Parameter ! * @exception SAXException Description of the Exception ! */ ! public void startElement(String uri, String localName, String qName, Attributes attributes) ! throws SAXException ! { ! this.context.put("ELEMENT", qName); ! this.context.put("ATTRIBUTES", attributes); ! this.path = path + "/" + qName; ! Rule rule = (Rule) this.rules.get(this.path); ! if (rule != null) ! { ! rule.loadEnter(this.context); ! } ! } ! } Index: Rule.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/state/Rule.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Rule.java 15 Sep 2003 22:23:45 -0000 1.1 --- Rule.java 13 Dec 2003 21:27:50 -0000 1.2 *************** *** 1,40 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.util.state; ! ! import java.util.Map; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public interface Rule ! { ! /** ! * Description of the Method ! * ! * @param context Description of the Parameter ! */ ! public void loadEnter(Map context); ! ! ! /** ! * Description of the Method ! * ! * @param context Description of the Parameter ! */ ! public void loadBody(Map context); ! ! ! /** ! * Description of the Method ! * ! * @param context Description of the Parameter ! */ ! public void loadExit(Map context); ! } --- 1,40 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.util.state; ! ! import java.util.Map; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public interface Rule ! { ! /** ! * Description of the Method ! * ! * @param context Description of the Parameter ! */ ! public void loadEnter(Map context); ! ! ! /** ! * Description of the Method ! * ! * @param context Description of the Parameter ! */ ! public void loadBody(Map context); ! ! ! /** ! * Description of the Method ! * ! * @param context Description of the Parameter ! */ ! public void loadExit(Map context); ! } Index: Storable.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/state/Storable.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Storable.java 15 Sep 2003 22:23:45 -0000 1.1 --- Storable.java 13 Dec 2003 21:27:50 -0000 1.2 *************** *** 1,22 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.util.state; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public interface Storable ! { ! /** ! * Description of the Method ! * ! * @param visitor Description of the Parameter ! */ ! void accept(StoreVisitor visitor); ! } --- 1,22 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.util.state; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public interface Storable ! { ! /** ! * Description of the Method ! * ! * @param visitor Description of the Parameter ! */ ! void accept(StoreVisitor visitor); ! } Index: StoreVisitor.java =================================================================== RCS file: /cvsroot/ejtools/libraries/common/src/main/org/ejtools/util/state/StoreVisitor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StoreVisitor.java 15 Sep 2003 22:23:45 -0000 1.1 --- StoreVisitor.java 13 Dec 2003 21:27:50 -0000 1.2 *************** *** 1,40 **** ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.util.state; ! ! import java.util.Iterator; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public interface StoreVisitor ! { ! /** ! * Description of the Method ! * ! * @param iterator Description of the Parameter ! */ ! void persist(Iterator iterator); ! ! ! /** ! * Description of the Method ! * ! * @param o Description of the Parameter ! */ ! void persist(Object o); ! ! ! /** ! * Description of the Method ! * ! * @param clazz Description of the Parameter ! */ ! void registerForPersistence(Class clazz); ! } --- 1,40 ---- ! /* ! * EJTools, the Enterprise Java Tools ! * ! * Distributable under LGPL license. ! * See terms of license at www.gnu.org. ! */ ! package org.ejtools.util.state; ! ! import java.util.Iterator; ! ! ! /** ! * @author Laurent Etiemble ! * @version $Revision$ ! */ ! public interface StoreVisitor ! { ! /** ! * Description of the Method ! * ! * @param iterator Description of the Parameter ! */ ! void persist(Iterator iterator); ! ! ! /** ! * Description of the Method ! * ! * @param o Description of the Parameter ! */ ! void persist(Object o); ! ! ! /** ! * Description of the Method ! * ! * @param clazz Description of the Parameter ! */ ! void registerForPersistence(Class clazz); ! } |