Source Code Cross Referenced for Property.java in  » Content-Management-System » harmonise » org » openharmonise » vfs » metadata » 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 » Content Management System » harmonise » org.openharmonise.vfs.metadata 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the 
003:         * Mozilla Public License Version 1.1 (the "License"); 
004:         * you may not use this file except in compliance with the License. 
005:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
009:         * See the License for the specific language governing rights and 
010:         * limitations under the License.
011:         *
012:         * The Initial Developer of the Original Code is Simulacra Media Ltd.
013:         * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014:         *
015:         * All Rights Reserved.
016:         *
017:         * Contributor(s):
018:         */
019:        package org.openharmonise.vfs.metadata;
020:
021:        import java.util.ArrayList;
022:        import java.util.Iterator;
023:        import java.util.List;
024:
025:        import org.openharmonise.vfs.metadata.range.*;
026:        import org.w3c.dom.Element;
027:        import org.w3c.dom.Node;
028:        import org.w3c.dom.NodeList;
029:        import org.w3c.dom.Text;
030:
031:        /**
032:         * A Property is the definition of an item of metadata. Most of the specifics
033:         * about the definition are contained in the {@link Range} and {@link Domain}
034:         * objects. Properties are stored as {@link org.openharmonise.vfs.VirtualFile}s on a Harmonise server.
035:         * 
036:         * @author Matthew Large
037:         * @version $Revision: 1.1 $
038:         *
039:         */
040:        public class Property {
041:
042:            /**
043:             * List of {@link Domain} objects, specifying where the property is allowed to be used.
044:             */
045:            private ArrayList m_aDomains = new ArrayList(3);
046:
047:            /**
048:             * The range of the property, specifying what value(s) the property is allowed to contain.
049:             */
050:            private Range m_range = null;
051:
052:            /**
053:             * Namespace, allows for multiple properties with the same name but in different namespaces.
054:             */
055:            private String m_sNamespace = null;
056:
057:            /**
058:             * Name of the property, must be unique for the namespace.
059:             */
060:            private String m_sName = null;
061:
062:            /**
063:             * Display name of the property.
064:             */
065:            private String m_sDisplayName = null;
066:
067:            /**
068:             * Version identifier for the property.
069:             */
070:            private String m_sVersion = null;
071:
072:            /**
073:             * Full path to the virtual file for this property.
074:             */
075:            private String m_sHREF = null;
076:
077:            /**
078:             * Summary of the property, usually containing some specific help text.
079:             */
080:            private String m_sSummary = "";
081:
082:            public Property() {
083:                super ();
084:            }
085:
086:            /**
087:             * Constructs a new property.
088:             * 
089:             * @param sNamespace Namespace
090:             * @param sName Name
091:             * @param sPath Full path
092:             */
093:            public Property(String sNamespace, String sName, String sPath) {
094:                super ();
095:                this .m_sNamespace = sNamespace;
096:                this .m_sName = sName;
097:                this .m_sDisplayName = sName;
098:                this .m_sHREF = sPath;
099:            }
100:
101:            /**
102:             * Sets the name of this property.
103:             * 
104:             * @param sName Name
105:             */
106:            public void setName(String sName) {
107:                this .m_sName = sName;
108:            }
109:
110:            /**
111:             * Sets the summary of this property.
112:             * 
113:             * @param sSummary Summary
114:             */
115:            public void setSummary(String sSummary) {
116:                this .m_sSummary = sSummary;
117:            }
118:
119:            /**
120:             * Returns the summary of this property.
121:             * 
122:             * @return Summary
123:             */
124:            public String getSummary() {
125:                return this .m_sSummary;
126:            }
127:
128:            /**
129:             * Sets the namespace of this property.
130:             * 
131:             * @param sNamespace Namespace
132:             */
133:            public void setNamespace(String sNamespace) {
134:                this .m_sNamespace = sNamespace;
135:            }
136:
137:            /**
138:             * Sets the display name of this property.
139:             * 
140:             * @param sDisplayName Display name
141:             */
142:            public void setDisplayName(String sDisplayName) {
143:                this .m_sDisplayName = sDisplayName;
144:            }
145:
146:            /**
147:             * Returns the display name of this property.
148:             * 
149:             * @return Display name
150:             */
151:            public String getDisplayName() {
152:                return this .m_sDisplayName;
153:            }
154:
155:            /**
156:             * Sets the version identifier of this property.
157:             * 
158:             * @param sVersion Version identifier
159:             */
160:            public void setVersion(String sVersion) {
161:                this .m_sVersion = sVersion;
162:            }
163:
164:            /**
165:             * Returns the version identifier of this property.
166:             * 
167:             * @return Version identifier
168:             */
169:            public String getVersion() {
170:                return this .m_sVersion;
171:            }
172:
173:            /**
174:             * Returns the namespace of this property.
175:             * 
176:             * @return Namespace
177:             */
178:            public String getNamespace() {
179:                return this .m_sNamespace;
180:            }
181:
182:            /**
183:             * Returns the name of this property.
184:             * 
185:             * @return Name
186:             */
187:            public String getName() {
188:                return this .m_sName;
189:            }
190:
191:            /**
192:             * Returns the full path to the virtual file for this property.
193:             * 
194:             * @return Full path
195:             */
196:            public String getHREF() {
197:                return this .m_sHREF;
198:            }
199:
200:            /**
201:             * Sets the full path to the virtual file for this property.
202:             * 
203:             * @param sHREF Full path
204:             */
205:            public void setHREF(String sHREF) {
206:                this .m_sHREF = sHREF;
207:            }
208:
209:            /**
210:             * Adds a domain to this property.
211:             * 
212:             * @param domain Domain to add
213:             */
214:            public void addDomain(Domain domain) {
215:                this .m_aDomains.add(domain);
216:            }
217:
218:            /**
219:             * Returns a list of {@link Domain} objects for this property.
220:             * 
221:             * @return List of {@link Domain} objects
222:             */
223:            public List getDomains() {
224:                return (List) this .m_aDomains.clone();
225:            }
226:
227:            /**
228:             * Sets the range for this property.
229:             * 
230:             * @param range Range
231:             */
232:            public void setRange(Range range) {
233:                this .m_range = range;
234:            }
235:
236:            /**
237:             * Returns the range for this property.
238:             * 
239:             * @return Range
240:             */
241:            public Range getRange() {
242:                if (this .m_range == null) {
243:                    return new StringRange();
244:                }
245:                return this .m_range;
246:            }
247:
248:            /**
249:             * Populates this property from a XML element.
250:             * 
251:             * @param elProperty Root element of property XML
252:             */
253:            public void instantiate(Element elProperty) {
254:                NodeList nl = elProperty
255:                        .getElementsByTagNameNS(
256:                                "http://www.simulacramedia.com/harmoniseclient/propdefs",
257:                                "displayname");
258:                for (int i = 0; i < nl.getLength(); i++) {
259:                    Element elPath = (Element) nl.item(i);
260:                    if (elPath.getChildNodes().getLength() == 1) {
261:                        Node node = elPath.getFirstChild();
262:                        if (node.getNodeType() == Node.TEXT_NODE) {
263:                            this .m_sDisplayName = ((Text) node).getNodeValue();
264:                        }
265:                        break;
266:                    }
267:                }
268:
269:                nl = elProperty
270:                        .getElementsByTagNameNS(
271:                                "http://www.simulacramedia.com/harmoniseclient/propdefs",
272:                                "version");
273:                for (int i = 0; i < nl.getLength(); i++) {
274:                    Element elVersion = (Element) nl.item(i);
275:                    if (elVersion.getChildNodes().getLength() == 1) {
276:                        Node node = elVersion.getFirstChild();
277:                        if (node.getNodeType() == Node.TEXT_NODE) {
278:                            this .m_sVersion = ((Text) node).getNodeValue();
279:                        }
280:                        break;
281:                    }
282:                }
283:
284:                nl = elProperty.getElementsByTagNameNS("DAV:", "href");
285:                for (int i = 0; i < nl.getLength(); i++) {
286:                    Element elPath = (Element) nl.item(i);
287:                    if (elPath.getChildNodes().getLength() == 1) {
288:                        Node node = elPath.getFirstChild();
289:                        if (node.getNodeType() == Node.TEXT_NODE) {
290:                            this .m_sHREF = ((Text) node).getNodeValue();
291:                        }
292:                        break;
293:                    }
294:                }
295:
296:                nl = elProperty.getElementsByTagNameNS("DAV:", "range");
297:                for (int i = 0; i < nl.getLength(); i++) {
298:                    Element elRange = (Element) nl.item(i);
299:                    if (elRange != null) {
300:                        this .m_range = RangeFactory.getRange(elRange);
301:                    }
302:
303:                }
304:
305:                nl = elProperty
306:                        .getElementsByTagNameNS(
307:                                "http://www.simulacramedia.com/harmoniseclient/propdefs",
308:                                "domains");
309:                for (int i = 0; i < nl.getLength(); i++) {
310:                    Element elDomains = (Element) nl.item(i);
311:                    if (elDomains.getChildNodes().getLength() > 0) {
312:                        NodeList domains = elDomains.getChildNodes();
313:                        for (int j = 0; j < domains.getLength(); j++) {
314:                            if (domains.item(j).getNodeType() == Node.ELEMENT_NODE) {
315:                                Domain domain = new Domain();
316:                                domain.instantiate(((Element) domains.item(j)));
317:                                this .m_aDomains.add(domain);
318:                            }
319:                        }
320:                    }
321:                }
322:            }
323:
324:            public String toString() {
325:                StringBuffer sBuff = new StringBuffer();
326:
327:                sBuff.append("-----------------------------\n");
328:
329:                sBuff.append("Property [").append(this .m_sNamespace)
330:                        .append("#").append(this .m_sName).append("]\n").append(
331:                                "DisplayName: ").append(this .m_sDisplayName)
332:                        .append("\n").append("Version: ").append(
333:                                this .m_sVersion).append("\n").append("Path: ")
334:                        .append(this .m_sHREF).append("\n").append(this .m_range)
335:                        .append("\n");
336:
337:                Iterator itor = this .m_aDomains.iterator();
338:                while (itor.hasNext()) {
339:                    sBuff.append(((Domain) itor.next())).append("\n");
340:                }
341:
342:                sBuff.append("-----------------------------\n");
343:
344:                return sBuff.toString();
345:            }
346:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.