Source Code Cross Referenced for RootLocator.java in  » Portal » uPortal_rel-2-6-1-GA » org » jasig » portal » layout » dlm » 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 » Portal » uPortal_rel 2 6 1 GA » org.jasig.portal.layout.dlm 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        package org.jasig.portal.layout.dlm;
02:
03:        import javax.xml.xpath.XPath;
04:        import javax.xml.xpath.XPathConstants;
05:        import javax.xml.xpath.XPathExpression;
06:        import javax.xml.xpath.XPathExpressionException;
07:        import javax.xml.xpath.XPathFactory;
08:
09:        import org.apache.commons.logging.Log;
10:        import org.apache.commons.logging.LogFactory;
11:        import org.jasig.portal.layout.IUserLayout;
12:        import org.w3c.dom.Document;
13:        import org.w3c.dom.Element;
14:
15:        /**
16:         * Provides centralized tool for obtaining the root folder in a user layout or
17:         * fragment layout. Uses a pre-compiled XPATH expression for increased
18:         * performance.
19:         * 
20:         * @author mboyd
21:         * 
22:         */
23:        public class RootLocator {
24:            private static final Log LOG = LogFactory.getLog(RootLocator.class);
25:            private static final String cfgPrefix = RootLocator.class.getName()
26:                    + ".";
27:            private static XPathExpression rootLocatorXpathExpression = null;
28:
29:            /**
30:             * Returns the folder having a type attribute containing the value specified
31:             * by IUserLayout.ROOT_NODE_NAME or null if such a folder does not exist in
32:             * the layout.
33:             * 
34:             * @param layout
35:             * @return 
36:             */
37:            public static Element getRootElement(Document layout) {
38:                Element root = null;
39:                try {
40:                    if (rootLocatorXpathExpression == null)
41:                        createRootLocatorXpathExpression();
42:
43:                    root = (Element) rootLocatorXpathExpression.evaluate(
44:                            layout, XPathConstants.NODE);
45:                } catch (Exception e) {
46:                    LOG.error("Unable to locate layout element of type "
47:                            + IUserLayout.ROOT_NODE_NAME, e);
48:                }
49:                return root;
50:            }
51:
52:            /**
53:             * Creates a compiled version of the XPATH evaluator for obtaining the 
54:             * root element of a layout.
55:             */
56:            private static void createRootLocatorXpathExpression() {
57:                String expression = "//layout/folder";
58:                try {
59:                    XPathFactory fac = XPathFactory.newInstance();
60:                    XPath xpath = fac.newXPath();
61:                    rootLocatorXpathExpression = xpath.compile(expression);
62:                } catch (XPathExpressionException e) {
63:                    throw new RuntimeException(
64:                            "Unable to compile XPath expression '" + expression
65:                                    + "' for obtaining root layout element.", e);
66:                }
67:            }
68:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.