Source Code Cross Referenced for AbstractTask.java in  » Science » Cougaar12_4 » org » cougaar » planning » servlet » data » completion » 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 » Science » Cougaar12_4 » org.cougaar.planning.servlet.data.completion 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * <copyright>
003:         *  
004:         *  Copyright 2001-2004 BBNT Solutions, LLC
005:         *  under sponsorship of the Defense Advanced Research Projects
006:         *  Agency (DARPA).
007:         * 
008:         *  You can redistribute this software and/or modify it under the
009:         *  terms of the Cougaar Open Source License as published on the
010:         *  Cougaar Open Source Website (www.cougaar.org).
011:         * 
012:         *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013:         *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014:         *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015:         *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016:         *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017:         *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018:         *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019:         *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020:         *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021:         *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022:         *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023:         *  
024:         * </copyright>
025:         */
026:        package org.cougaar.planning.servlet.data.completion;
027:
028:        import java.io.IOException;
029:        import java.io.Serializable;
030:
031:        import org.cougaar.planning.servlet.data.xml.DeXMLable;
032:        import org.cougaar.planning.servlet.data.xml.UnexpectedXMLException;
033:        import org.cougaar.planning.servlet.data.xml.XMLWriter;
034:        import org.cougaar.planning.servlet.data.xml.XMLable;
035:        import org.xml.sax.Attributes;
036:
037:        /**
038:         * Represents an abstract Task entry within the COMPLETION PSP.
039:         **/
040:        public abstract class AbstractTask implements  XMLable, DeXMLable,
041:                Serializable {
042:
043:            //Variables:
044:            ////////////
045:
046:            protected final static String UID_TAG = "UID";
047:            protected final static String UID_URL_TAG = "UID_URL";
048:            protected final static String PARENT_UID_TAG = "ParentUID";
049:            protected final static String PARENT_UID_URL_TAG = "ParentUID_URL";
050:            protected final static String CONFIDENCE_TAG = "Confidence";
051:            protected final static String PLAN_ELEMENT_TAG = "PlanElement";
052:
053:            protected String uid;
054:            protected String uid_url;
055:            protected String parentUID;
056:            protected String parentUID_url;
057:            protected double confidence;
058:            protected String planElement;
059:            protected String verb;
060:
061:            //Constructors:
062:            ///////////////
063:
064:            public AbstractTask() {
065:            }
066:
067:            //Tag override:
068:            ///////////////
069:            protected abstract String getNameTag();
070:
071:            //Setters:
072:            //////////
073:
074:            public void setUID(String uid) {
075:                this .uid = uid;
076:            }
077:
078:            public void setUID_URL(String uid_url) {
079:                this .uid_url = uid_url;
080:            }
081:
082:            public void setParentUID(String parentUID) {
083:                this .parentUID = parentUID;
084:            }
085:
086:            public void setParentUID_URL(String parentUID_url) {
087:                this .parentUID_url = parentUID_url;
088:            }
089:
090:            public void setConfidence(double confidence) {
091:                this .confidence = confidence;
092:            }
093:
094:            public void setPlanElement(String planElement) {
095:                this .planElement = planElement;
096:            }
097:
098:            public void setVerb(String verb) {
099:                this .verb = verb;
100:            }
101:
102:            //Getters:
103:            //////////
104:
105:            public String getUID() {
106:                return uid;
107:            }
108:
109:            public String getUID_URL() {
110:                return uid_url;
111:            }
112:
113:            public String getParentUID() {
114:                return parentUID;
115:            }
116:
117:            public String getParentUID_URL() {
118:                return parentUID_url;
119:            }
120:
121:            public double getConfidence() {
122:                return confidence;
123:            }
124:
125:            public String getPlanElement() {
126:                return planElement;
127:            }
128:
129:            public String getVerb() {
130:                return verb;
131:            }
132:
133:            //XMLable members:
134:            //----------------
135:
136:            /**
137:             * Write this class out to the Writer in XML format
138:             * @param w output Writer
139:             **/
140:            public void toXML(XMLWriter w) throws IOException {
141:                w.optagln(getNameTag());
142:
143:                w.tagln(UID_TAG, getUID());
144:                w.tagln(UID_URL_TAG, getUID_URL());
145:                w.tagln(PARENT_UID_TAG, getParentUID());
146:                w.tagln(PARENT_UID_URL_TAG, getParentUID_URL());
147:                w.tagln(CONFIDENCE_TAG, getConfidence());
148:                w.tagln(PLAN_ELEMENT_TAG, getPlanElement());
149:
150:                w.cltagln(getNameTag());
151:            }
152:
153:            //DeXMLable members:
154:            //------------------
155:
156:            /**
157:             * Report a startElement that pertains to THIS object, not any
158:             * sub objects.  Call also provides the elements Attributes and data.  
159:             * Note, that  unlike in a SAX parser, data is guaranteed to contain 
160:             * ALL of this tag's data, not just a 'chunk' of it.
161:             * @param name startElement tag
162:             * @param attr attributes for this tag
163:             * @param data data for this tag
164:             **/
165:            public void openTag(String name, Attributes attr, String data)
166:                    throws UnexpectedXMLException {
167:                if (name.equals(getNameTag())) {
168:                } else if (name.equals(UID_TAG)) {
169:                    setUID(data);
170:                } else if (name.equals(UID_URL_TAG)) {
171:                    setUID_URL(data);
172:                } else if (name.equals(PARENT_UID_TAG)) {
173:                    setParentUID(data);
174:                } else if (name.equals(PARENT_UID_URL_TAG)) {
175:                    setParentUID_URL(data);
176:                } else if (name.equals(CONFIDENCE_TAG)) {
177:                    try {
178:                        setConfidence(Double.parseDouble(data));
179:                    } catch (NumberFormatException e) {
180:                        throw new UnexpectedXMLException("Malformed Number: "
181:                                + name + " : " + data);
182:                    }
183:                } else if (name.equals(PLAN_ELEMENT_TAG)) {
184:                    setPlanElement(data);
185:                } else {
186:                    throw new UnexpectedXMLException("Unexpected tag: " + name);
187:                }
188:            }
189:
190:            /**
191:             * Report an endElement.
192:             * @param name endElement tag
193:             * @return true iff the object is DONE being DeXMLized
194:             **/
195:            public boolean closeTag(String name) throws UnexpectedXMLException {
196:                return name.equals(getNameTag());
197:            }
198:
199:            /**
200:             * This function will be called whenever a subobject has
201:             * completed de-XMLizing and needs to be encorporated into
202:             * this object.
203:             * @param name the startElement tag that caused this subobject
204:             * to be created
205:             * @param obj the object itself
206:             **/
207:            public void completeSubObject(String name, DeXMLable obj)
208:                    throws UnexpectedXMLException {
209:            }
210:
211:            /** 
212:             * Set the serialVersionUID to keep the object serializer from seeing
213:             * xerces (org.xml.sax.Attributes).
214:             */
215:            private static final long serialVersionUID = 728328929999383874L;
216:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.