Source Code Cross Referenced for DAVPropertyRange.java in  » Content-Management-System » harmonise » org » openharmonise » dav » server » property » ranges » 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.dav.server.property.ranges 
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:
020:        package org.openharmonise.dav.server.property.ranges;
021:
022:        import java.util.*;
023:
024:        import org.openharmonise.commons.dsi.AbstractDataStoreInterface;
025:        import org.openharmonise.commons.xml.namespace.NamespaceType;
026:        import org.openharmonise.dav.server.managers.HarmonisePropertiesManager;
027:        import org.openharmonise.dav.server.utils.*;
028:        import org.openharmonise.rm.DataAccessException;
029:        import org.openharmonise.rm.factory.*;
030:        import org.openharmonise.rm.resources.*;
031:        import org.openharmonise.rm.resources.metadata.properties.PropertyGroup;
032:        import org.openharmonise.rm.resources.metadata.properties.ranges.*;
033:        import org.w3c.dom.*;
034:
035:        import com.ibm.webdav.*;
036:
037:        /**
038:         * A subclass of <code>DAVRange</code> which handles 
039:         * compound property ranges, i.e. a range which specifies that a
040:         * property has values which are property instances of other properties.
041:         * 
042:         * @author Michael Bell
043:         * @version $Revision: 1.2 $
044:         * @since November 20, 2003
045:         */
046:        public class DAVPropertyRange extends DAVRange {
047:
048:            /**
049:             * @param dsi
050:             */
051:            public DAVPropertyRange(AbstractDataStoreInterface dsi) {
052:                super (dsi, new ProfileRange());
053:            }
054:
055:            /**
056:             * @param dsi
057:             * @param range
058:             */
059:            public DAVPropertyRange(AbstractDataStoreInterface dsi, Range range) {
060:                super (dsi, range);
061:            }
062:
063:            /**
064:             * @param dsi
065:             * @param davPropEl
066:             */
067:            public DAVPropertyRange(AbstractDataStoreInterface dsi,
068:                    Element davPropEl) throws WebDAVException {
069:                super (dsi, new ProfileRange(), davPropEl);
070:
071:            }
072:
073:            /* (non-Javadoc)
074:             * @see org.openharmonise.dav.server.property.ranges.DAVRange#addRangeDetails(org.w3c.dom.Element, org.openharmonise.rm.resources.metadata.properties.ranges.Range, org.w3c.dom.Document)
075:             */
076:            protected void addRangeDetails(Element rangeEl, Range range,
077:                    Document doc) throws WebDAVException {
078:                Element resourceTypeEl = doc.createElementNS(NamespaceType.DAV
079:                        .getURI(), HarmonisePropertiesManager.TAG_RESOURCETYPE);
080:                resourceTypeEl.setPrefix(NamespaceType.DAV.getPrefix());
081:
082:                Element propResEl = doc.createElementNS(NamespaceType.DAV
083:                        .getURI(),
084:                        HarmonisePropertiesManager.TAG_PROPERTY_RESOURCE);
085:                propResEl.setPrefix(NamespaceType.DAV.getPrefix());
086:                resourceTypeEl.appendChild(propResEl);
087:                rangeEl.appendChild(resourceTypeEl);
088:
089:                List allowedPropGroups = ((ProfileRange) m_range)
090:                        .getAllowedPropertyParents();
091:
092:                Iterator iter = allowedPropGroups.iterator();
093:                try {
094:                    while (iter.hasNext()) {
095:                        String sPath = (String) iter.next();
096:                        if (sPath != null) {
097:                            AbstractParentObject parent = (AbstractParentObject) HarmoniseObjectFactory
098:                                    .instantiateHarmoniseObject(m_dsi,
099:                                            PropertyGroup.class.getName(),
100:                                            sPath);
101:                            String sDAVPath = HarmoniseNameResolver
102:                                    .getDAVPath(parent);
103:                            if (sDAVPath != null) {
104:                                Element hrefEl = doc.createElementNS(
105:                                        NamespaceType.DAV.getURI(),
106:                                        HarmonisePropertiesManager.TAG_HREF);
107:                                hrefEl.setPrefix(NamespaceType.DAV.getPrefix());
108:                                hrefEl
109:                                        .appendChild(doc
110:                                                .createTextNode(sDAVPath));
111:                                rangeEl.appendChild(hrefEl);
112:                            }
113:
114:                        }
115:                    }
116:
117:                } catch (HarmoniseFactoryException e) {
118:                    throw new WebDAVException(
119:                            WebDAVStatus.SC_INTERNAL_SERVER_ERROR, e
120:                                    .getLocalizedMessage());
121:                } catch (NameResolverException e) {
122:                    throw new WebDAVException(
123:                            WebDAVStatus.SC_INTERNAL_SERVER_ERROR, e
124:                                    .getLocalizedMessage());
125:                }
126:
127:            }
128:
129:            /* (non-Javadoc)
130:             * @see org.openharmonise.dav.server.property.ranges.DAVRange#populate(org.w3c.dom.Element)
131:             */
132:            public void populate(Element propEl) throws WebDAVException {
133:                try {
134:                    //deal with hrefs
135:                    NodeList hrefNodes = propEl.getElementsByTagNameNS(
136:                            NamespaceType.DAV.getURI(),
137:                            HarmonisePropertiesManager.TAG_HREF);
138:
139:                    List ohPaths = new ArrayList();
140:                    AbstractParentObject parent = null;
141:
142:                    String sParentClassName = null;
143:                    for (int i = 0; i < hrefNodes.getLength(); i++) {
144:                        Element hrefEl = (Element) hrefNodes.item(i);
145:
146:                        String hrefVal = hrefEl.getChildNodes().item(0)
147:                                .getNodeValue();
148:
149:                        if (hrefVal != null && hrefVal.length() > 0) {
150:                            AbstractChildObject child = HarmoniseNameResolver
151:                                    .getObjectFromURL(m_dsi, hrefVal);
152:
153:                            if ((child instanceof  PropertyGroup) == false) {
154:                                throw new WebDAVException(
155:                                        WebDAVStatus.SC_BAD_REQUEST,
156:                                        "Invalid path - " + hrefVal);
157:                            }
158:
159:                            ohPaths.add(child.getFullPath());
160:                            parent = (AbstractParentObject) child;
161:
162:                            //ensure that we're not mixing parent types in the hrefs
163:                            if (sParentClassName != null
164:                                    && parent.getClass().getName().equals(
165:                                            sParentClassName) == false) {
166:                                throw new WebDAVException(
167:                                        WebDAVStatus.SC_BAD_REQUEST,
168:                                        "Invalid set of paths");
169:                            }
170:
171:                            sParentClassName = parent.getClass().getName();
172:                        }
173:
174:                    }
175:
176:                    ((ProfileRange) m_range).setAllowedPropertyParents(ohPaths);
177:                } catch (DataAccessException e) {
178:                    throw new WebDAVException(
179:                            WebDAVStatus.SC_INTERNAL_SERVER_ERROR, e
180:                                    .getLocalizedMessage());
181:                } catch (NameResolverException e) {
182:                    throw new WebDAVException(
183:                            WebDAVStatus.SC_INTERNAL_SERVER_ERROR, e
184:                                    .getLocalizedMessage());
185:                }
186:
187:            }
188:
189:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.