Source Code Cross Referenced for MemoryStorage.java in  » Workflow-Engines » pegasus-2.1.0 » org » griphyn » vdl » parser » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Workflow Engines » pegasus 2.1.0 » org.griphyn.vdl.parser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file or a portion of this file is licensed under the terms of
003:         * the Globus Toolkit Public License, found in file GTPL, or at
004:         * http://www.globus.org/toolkit/download/license.html. This notice must
005:         * appear in redistributions of this file, with or without modification.
006:         *
007:         * Redistributions of this Software, with or without modification, must
008:         * reproduce the GTPL in: (1) the Software, or (2) the Documentation or
009:         * some other similar material which is provided with the Software (if
010:         * any).
011:         *
012:         * Copyright 1999-2004 University of Chicago and The University of
013:         * Southern California. All rights reserved.
014:         */
015:        package org.griphyn.vdl.parser;
016:
017:        import org.griphyn.vdl.classes.*;
018:        import org.griphyn.vdl.util.*;
019:        import org.xml.sax.*;
020:        import java.util.List;
021:        import java.util.ArrayList;
022:
023:        /**
024:         * This class adds a given Definition from the parser's callback into
025:         * the already established in-memory storage. 
026:         *
027:         * @author Jens-S. Vöckler
028:         * @author Yong Zhao
029:         * @version $Revision: 50 $
030:         */
031:        public class MemoryStorage implements  DefinitionHandler {
032:            /**
033:             * This is a reference to the already established in-memory storage.
034:             */
035:            private Definitions m_memory;
036:
037:            /**
038:             * This determines the behavior: insert mode (false) or update mode (true)
039:             */
040:            private boolean m_overwrite;
041:
042:            /**
043:             * This variable determines whether to keep a list of rejects
044:             */
045:            private boolean m_dontcare;
046:
047:            /**
048:             * This is the list of rejects for insert, or old values for update.
049:             */
050:            private ArrayList m_rejects;
051:
052:            /**
053:             * The c'tor initializes the references to modify the in-memory database
054:             * of definitions.
055:             *
056:             * @param definitions is a reference to the in-memory database.
057:             * @param overwrite establishes insert or update mode.
058:             */
059:            public MemoryStorage(Definitions definitions, boolean overwrite,
060:                    boolean dontcare) {
061:                if ((this .m_memory = definitions) == null)
062:                    throw new NullPointerException();
063:                this .m_overwrite = overwrite;
064:                this .m_dontcare = dontcare;
065:                this .m_rejects = new ArrayList();
066:            }
067:
068:            /**
069:             * Accessor: Provide an iterator to walk the rejects list.
070:             * @return full access to the rejects list.
071:             */
072:            public java.util.List getRejects() {
073:                return this .m_rejects;
074:            }
075:
076:            /**
077:             * This method adds the given Definition to whatever storage is
078:             * implemented underneath. 
079:             *
080:             * @param d is the Definition that is ready to be stored.
081:             * @return true, if new version was stored and database modified
082:             */
083:            public boolean store(Definition d) {
084:                int position = this .m_memory.positionOfDefinition(d);
085:                if (position != -1) {
086:                    // definition already exists
087:                    if (this .m_overwrite) {
088:                        Logging.instance().log("app", 2,
089:                                "Modifying " + d.shortID());
090:                        Definition old = this .m_memory.setDefinition(position,
091:                                d);
092:                        if (!this .m_dontcare)
093:                            this .m_rejects.add(old);
094:                        return true;
095:                    } else {
096:                        Logging.instance().log("app", 2,
097:                                "Rejecting " + d.shortID());
098:                        if (!this .m_dontcare)
099:                            this .m_rejects.add(d);
100:                        return false;
101:                    }
102:                } else {
103:                    // definition does not exist
104:                    Logging.instance().log("app", 2, "Adding " + d.shortID());
105:                    this .m_memory.addDefinition(d);
106:                    return true;
107:                }
108:            }
109:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.