Source Code Cross Referenced for BasicSearchSchema.java in  » Content-Management-System » harmonise » com » ibm » webdav » basicsearch » 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 » com.ibm.webdav.basicsearch 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * (C) Copyright Simulacra Media Ltd, 2004.  All rights reserved.
003:         *
004:         * The program is provided "AS IS" without any warranty express or
005:         * implied, including the warranty of non-infringement and the implied
006:         * warranties of merchantibility and fitness for a particular purpose.
007:         * Simulacra Media Ltd will not be liable for any damages suffered by you as a result
008:         * of using the Program. In no event will Simulacra Media Ltd be liable for any
009:         * special, indirect or consequential damages or lost profits even if
010:         * Simulacra Media Ltd has been advised of the possibility of their occurrence. 
011:         * Simulacra Media Ltd will not be liable for any third party claims against you.
012:         */
013:
014:        package com.ibm.webdav.basicsearch;
015:
016:        import com.ibm.webdav.*;
017:
018:        import java.util.*;
019:        import java.util.logging.*;
020:        import java.util.logging.Level;
021:
022:        import javax.xml.parsers.*;
023:
024:        import org.w3c.dom.*;
025:
026:        /**
027:         * BasicSearchSchema implements <code>SearchSchema</code> for the
028:         * DASL basic search format.
029:         * 
030:         * @author Michael Bell
031:         * @version $Revision: 1.1 $
032:         *
033:         */
034:        public class BasicSearchSchema implements  SearchSchema {
035:            public static final String TAG_SCHEMA = "D:basicsearchschema";
036:            public static final String TAG_PROPDESC = "D:propdesc";
037:            public static final String TAG_ANY_OTHER_PROP = "D:any-other-property";
038:            public static final String TAG_PROP = "D:prop";
039:            public static final String TAG_DATATYPE = "D:datatype";
040:            public static final String TAG_SEARCHABLE = "D:searchable";
041:            public static final String TAG_SELECTABLE = "D:selectable";
042:            public static final String TAG_SORTABLE = "D:sortable";
043:            public static final String TAG_OPDESC = "D:opdesc";
044:            public static final String TAG_OPERAND_PROP = "D:operand-property";
045:            public static final String TAG_OPERAND_LIT = "D:operand-literal";
046:            public static final String TAG_PROPERTIES = "D:properties";
047:            public static final String TAG_OPERATORS = "D:operators";
048:            private static final String DAV_NAMESPACE = "DAV:";
049:            private Hashtable m_propdescs = new Hashtable();
050:            private Hashtable m_operators = new Hashtable();
051:            protected Document m_document = null;
052:
053:            private static final Logger m_logger = Logger
054:                    .getLogger(BasicSearchSchema.class.getName());
055:
056:            public BasicSearchSchema() {
057:                try {
058:                    m_document = DocumentBuilderFactory.newInstance()
059:                            .newDocumentBuilder().newDocument();
060:                } catch (Exception e) {
061:                    m_logger.log(Level.WARNING, e.getMessage(), e);
062:                }
063:            }
064:
065:            public void addAnyOtherPropertyDescription(boolean bSearchable,
066:                    boolean bSelectable, boolean bSortable) throws Exception {
067:                Element el = m_document.createElementNS(
068:                        BasicSearchSchema.DAV_NAMESPACE,
069:                        BasicSearchSchema.TAG_ANY_OTHER_PROP);
070:                addPropertyDescription(el, null, bSearchable, bSelectable,
071:                        bSortable);
072:            }
073:
074:            public void addPropertyDescription(Element propertyEl,
075:                    Element datatypeDef, boolean bSearchable,
076:                    boolean bSelectable, boolean bSortable) throws Exception {
077:                String sPropname = propertyEl.getTagName();
078:
079:                Element propdescEl = m_document.createElementNS(DAV_NAMESPACE,
080:                        BasicSearchSchema.TAG_PROPDESC);
081:                Element propEl = m_document.createElementNS(DAV_NAMESPACE,
082:                        BasicSearchSchema.TAG_PROP);
083:
084:                propEl.appendChild(m_document.importNode(propertyEl, true));
085:                propdescEl.appendChild(propEl);
086:
087:                if (datatypeDef != null) {
088:                    Element datatypeEl = m_document.createElementNS(
089:                            BasicSearchSchema.DAV_NAMESPACE,
090:                            BasicSearchSchema.TAG_DATATYPE);
091:
092:                    datatypeEl.appendChild(m_document.importNode(datatypeDef,
093:                            true));
094:                    propdescEl.appendChild(datatypeEl);
095:                }
096:
097:                if (bSearchable == true) {
098:                    Element searchableEl = m_document.createElementNS(
099:                            BasicSearchSchema.DAV_NAMESPACE,
100:                            BasicSearchSchema.TAG_SEARCHABLE);
101:                    propdescEl.appendChild(searchableEl);
102:                }
103:
104:                if (bSelectable == true) {
105:                    Element selectableEl = m_document.createElementNS(
106:                            BasicSearchSchema.DAV_NAMESPACE,
107:                            BasicSearchSchema.TAG_SELECTABLE);
108:                    propdescEl.appendChild(selectableEl);
109:                }
110:
111:                if (bSortable == true) {
112:                    Element sortableEl = m_document.createElementNS(
113:                            BasicSearchSchema.DAV_NAMESPACE,
114:                            BasicSearchSchema.TAG_SORTABLE);
115:                    propdescEl.appendChild(sortableEl);
116:                }
117:
118:                m_propdescs.put(sPropname, propdescEl);
119:            }
120:
121:            public void addOperator(Element OpEl, boolean bIncludeLiteral)
122:                    throws Exception {
123:                String sOpName = OpEl.getTagName();
124:                Element opdescEl = m_document.createElementNS(
125:                        BasicSearchSchema.DAV_NAMESPACE,
126:                        BasicSearchSchema.TAG_OPDESC);
127:                opdescEl.appendChild(m_document.importNode(OpEl, true));
128:
129:                Element operandPropEl = m_document.createElementNS(
130:                        BasicSearchSchema.DAV_NAMESPACE,
131:                        BasicSearchSchema.TAG_OPERAND_PROP);
132:                opdescEl.appendChild(operandPropEl);
133:
134:                if (bIncludeLiteral == true) {
135:                    Element operandLitEl = m_document.createElementNS(
136:                            BasicSearchSchema.DAV_NAMESPACE,
137:                            BasicSearchSchema.TAG_OPERAND_LIT);
138:                    opdescEl.appendChild(operandLitEl);
139:                }
140:
141:                m_operators.put(sOpName, opdescEl);
142:            }
143:
144:            public Element asXML() {
145:                Element schemaEl = m_document.createElementNS(
146:                        BasicSearchSchema.DAV_NAMESPACE, TAG_SCHEMA);
147:                Element propertiesEl = m_document.createElementNS(
148:                        BasicSearchSchema.DAV_NAMESPACE,
149:                        BasicSearchSchema.TAG_PROPERTIES);
150:
151:                for (Iterator i = m_propdescs.values().iterator(); i.hasNext();) {
152:                    Element tempEl = (Element) i.next();
153:                    //if(tempEl.getOwnerDocument().equals(this.m_document)
154:                    propertiesEl.appendChild(tempEl);
155:                }
156:
157:                schemaEl.appendChild(propertiesEl);
158:
159:                Element operatorsEl = m_document.createElementNS(
160:                        BasicSearchSchema.DAV_NAMESPACE,
161:                        BasicSearchSchema.TAG_OPERATORS);
162:
163:                for (Iterator i = m_operators.values().iterator(); i.hasNext();) {
164:                    operatorsEl.appendChild((Element) i.next());
165:                }
166:
167:                schemaEl.appendChild(operatorsEl);
168:
169:                return schemaEl;
170:            }
171:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.