Source Code Cross Referenced for PropGroupData.java in  » Science » Cougaar12_4 » org » cougaar » tools » csmart » core » cdata » 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.tools.csmart.core.cdata 
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.tools.csmart.core.cdata;
027:
028:        import java.io.Serializable;
029:        import java.util.ArrayList;
030:        import java.util.Iterator;
031:        import java.util.List;
032:
033:        import org.cougaar.planning.ldm.asset.NewPropertyGroup;
034:        import org.cougaar.planning.ldm.asset.PropertyGroup;
035:
036:        // FIXME: An extension of this would be time-phased
037:        // However, there the set of properties would be the same, but the
038:        // values would differ in different time-spans.
039:        // So maybe a TP-PG _contains_ multiple of these guys,
040:        // where for each it has a start + stop time
041:
042:        // Add convenience methods to getAllPropertyNames and getPropertyByName
043:
044:        /**
045:         * Hold the definition for one property group on an Agent's asset.<br>
046:         * The PG has a name (the class name), and might have a single value
047:         * (as is the case for the UniqueNames, etc). Usually, however,
048:         * it has a list of properties. These properties are instances of
049:         * <code>PGPropData</code>
050:         **/
051:        public class PropGroupData implements  Serializable, NewPropertyGroup {
052:
053:            /** Common PG class names **/
054:            public static final String ITEM_IDENTIFICATION = "ItemIdentificationPG";
055:            public static final String TYPE_IDENTIFICATION = "TypeIdentificationPG";
056:            public static final String CLUSTER = "ClusterPG";
057:            public static final String ENTITY = "EntityPG";
058:            public static final String COMMUNITY = "CommunityPG";
059:            public static final String MILITARYORG = "MilitaryOrgPG";
060:            public static final String ASSIGNMENT = "AssignmentPG";
061:            public static final String ORGANIZATION = "OrganizationPG";
062:            public static final String MAINTENANCE = "MaintenancePG";
063:            public static final String CSSCAPABILITY = "CSSCapabilityPG";
064:
065:            private String name = null;
066:            private String val = null;
067:            private List properties;
068:
069:            /**
070:             * Creates a new <code>PropGroupData</code> instance.
071:             *
072:             * @param name of the Property Group
073:             */
074:            public PropGroupData(String name) {
075:                this .name = name;
076:                properties = new ArrayList();
077:            }
078:
079:            /**
080:             * Gets the name of the Property Group.
081:             *
082:             * @return Name of the Property Group
083:             */
084:            public String getName() {
085:                return name;
086:            }
087:
088:            /**
089:             * Sets the name of the property group
090:             *
091:             * @param name of property group
092:             */
093:            public void setName(String name) {
094:                this .name = name;
095:            }
096:
097:            /**
098:             * Get a single value for this property group.
099:             *
100:             * @return value
101:             */
102:            public String getSingleValue() {
103:                return val;
104:            }
105:
106:            /**
107:             * Determines if this property group has a single value.
108:             *
109:             * @return true if only contains one value.
110:             */
111:            public boolean hasSingleValue() {
112:                return val != null;
113:            }
114:
115:            /**
116:             * Sets a single value. For this Property Group
117:             *
118:             * @param val of this property group
119:             */
120:            public void setSingleValue(String val) {
121:                this .val = val;
122:            }
123:
124:            /**
125:             * Sets all properties for this PropertyGroup
126:             *
127:             * @param newProperties PGPropData[] array of properties
128:             */
129:            public void setProperties(PGPropData[] newProperties) {
130:                properties.clear();
131:                for (int i = 0; i < newProperties.length; i++) {
132:                    properties.add(newProperties[i]);
133:                }
134:            }
135:
136:            /**
137:             * Adds a property for this PropertyGroup
138:             *
139:             * @param property as PGPropData
140:             */
141:            public void addProperty(PGPropData property) {
142:                this .properties.add(property);
143:            }
144:
145:            /**
146:             * Sets a property for this PropertyGroup, replacing the previous property at this index
147:             *
148:             * @param index for property
149:             * @param property to replace with
150:             */
151:            public void setProperty(int index, PGPropData property)
152:                    throws IndexOutOfBoundsException {
153:                this .properties.set(index, property);
154:            }
155:
156:            /**
157:             * Returns an array of properties for this PropertyGroup.
158:             *
159:             * @return properties
160:             */
161:            public PGPropData[] getProperties() {
162:                return (PGPropData[]) properties
163:                        .toArray(new PGPropData[properties.size()]);
164:            }
165:
166:            /**
167:             * Returns an iterator of properties for this PropertyGroup.
168:             *
169:             * @return iterator
170:             */
171:            public Iterator getPropertiesIterator() {
172:                return properties.iterator();
173:            }
174:
175:            /**
176:             * Returns a count of all properties for this PropertyGroup.
177:             *
178:             * @return count
179:             */
180:            public int getPropertyCount() {
181:                return properties.size();
182:            }
183:
184:            /**
185:             * Converts PropGroup to a String
186:             *
187:             * @return string of Property Group
188:             */
189:            public String toString() {
190:                StringBuffer buf = new StringBuffer();
191:                buf.append("<PropertyGroup: " + name);
192:                if (hasSingleValue()) {
193:                    buf.append(", value: " + getSingleValue() + ">");
194:                } else {
195:                    buf.append(", has " + getPropertyCount() + " properties: ");
196:                    Iterator propsIter = getPropertiesIterator();
197:                    while (propsIter.hasNext()) {
198:                        buf.append(((PGPropData) propsIter.next()).toString()
199:                                + " ");
200:                    }
201:                    buf.append(">");
202:                    // FIXME!!!  Why, whats wrong?
203:
204:                }
205:                return buf.toString();
206:            }
207:
208:            //Stub NewPropertyGroup implementation
209:
210:            public Object clone() throws CloneNotSupportedException {
211:                throw new CloneNotSupportedException();
212:            }
213:
214:            /** Unlock the PropertyGroup by returning an object which
215:             * has setter methods that side-effect this object.
216:             * The key must be == the key that locked the property
217:             * in the first place or an Exception is thrown.
218:             * @exception IllegalAccessException
219:             **/
220:            public NewPropertyGroup unlock(Object key) {
221:                return null;
222:            }
223:
224:            /** lock a property by returning an immutable object which
225:             * has a private view into the original object.
226:             * If key == null, the result is a locked object which cannot be unlocked.
227:             **/
228:            public PropertyGroup lock(Object key) {
229:                return null;
230:            }
231:
232:            /** alias for lock(null)
233:             **/
234:            public PropertyGroup lock() {
235:                return null;
236:            }
237:
238:            /** Convenience method. equivalent to clone();
239:             **/
240:            public PropertyGroup copy() {
241:                try {
242:                    return (PropertyGroup) clone();
243:                } catch (CloneNotSupportedException cnse) {
244:                    return null;
245:                }
246:            }
247:
248:            /** returns the class of the main property interface for this 
249:             * property group.  
250:             **/
251:            public Class getPrimaryClass() {
252:                return this .getClass();
253:            }
254:
255:            /** @return the method name on an asset to retrieve the PG **/
256:            public String getAssetGetMethod() {
257:                return "get" + name;
258:            }
259:
260:            /** @return the method name on an asset to set the PG **/
261:            public String getAssetSetMethod() {
262:                return "set" + name;
263:            }
264:
265:            // DataQuality
266:            /** @return true IFF the instance not only supports DataQuality
267:             * queries (e.g. is instanceof HasDataQuality), but getDataQuality()
268:             * will return non-null.
269:             **/
270:            public boolean hasDataQuality() {
271:                return false;
272:            }
273:
274:        } // end of PropGroupData.java
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.