Source Code Cross Referenced for WingContext.java in  » Content-Management-System » dspace » org » dspace » app » xmlui » wing » 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 » dspace » org.dspace.app.xmlui.wing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * WingContext.java
003:         *
004:         * Version: $Revision: 1.5 $
005:         *
006:         * Date: $Date: 2006/03/20 22:41:02 $
007:         *
008:         * Copyright (c) 2002, Hewlett-Packard Company and Massachusetts
009:         * Institute of Technology.  All rights reserved.
010:         *
011:         * Redistribution and use in source and binary forms, with or without
012:         * modification, are permitted provided that the following conditions are
013:         * met:
014:         *
015:         * - Redistributions of source code must retain the above copyright
016:         * notice, this list of conditions and the following disclaimer.
017:         *
018:         * - Redistributions in binary form must reproduce the above copyright
019:         * notice, this list of conditions and the following disclaimer in the
020:         * documentation and/or other materials provided with the distribution.
021:         *
022:         * - Neither the name of the Hewlett-Packard Company nor the name of the
023:         * Massachusetts Institute of Technology nor the names of their
024:         * contributors may be used to endorse or promote products derived from
025:         * this software without specific prior written permission.
026:         *
027:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
028:         * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
029:         * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
030:         * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
031:         * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
032:         * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
033:         * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
034:         * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
035:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
036:         * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
037:         * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
038:         * DAMAGE.
039:         */
040:
041:        package org.dspace.app.xmlui.wing;
042:
043:        /**
044:         * A class representing the framework's context, what component is generationg
045:         * content, where should we log. It's basicaly a grab bag for framework wide
046:         * communication, if all elements need to know about something then it should go
047:         * here.
048:         * 
049:         * @author Scott Phillips
050:         */
051:
052:        import org.apache.avalon.framework.logger.Logger;
053:
054:        public class WingContext {
055:            /** The nameing divider */
056:            public static final char DIVIDER = '.';
057:
058:            /**
059:             * What is the component name for this transformer, this is used to generate
060:             * unique ids.
061:             */
062:            private String componentName;
063:
064:            /** Cocoon logger for debugging Wing elements */
065:            private Logger logger;
066:
067:            /**
068:             * The repository specefic object manager.
069:             */
070:            private ObjectManager objectManager;
071:
072:            /**
073:             * Set the current transformer's name
074:             * 
075:             * @param componentName
076:             *            the current transformer's name.
077:             */
078:            public void setComponentName(String componentName) {
079:                this .componentName = componentName;
080:            }
081:
082:            /**
083:             * Return the current transformer's name.
084:             * 
085:             * @return
086:             */
087:            public String getComponentName() {
088:                return this .componentName;
089:            }
090:
091:            /**
092:             * Return the cocoon logger
093:             * 
094:             * @return
095:             */
096:            public Logger getLogger() {
097:                return this .logger;
098:            }
099:
100:            /**
101:             * Set the cocoon logger
102:             * 
103:             * @param contentHandler
104:             *            A new content handler.
105:             */
106:            public void setLogger(Logger logger) {
107:                this .logger = logger;
108:            }
109:
110:            /**
111:             * Generate a unique id based upon the locally unique name and the
112:             * application.
113:             * 
114:             * The format of the unique id typically is:
115:             * 
116:             * <componentName> dot <application> dot <unique name>
117:             * 
118:             * typically the componentName is the Java class path of the Wing component.
119:             * 
120:             * @param application
121:             *            The application of this element, typically this is the element
122:             *            type that is being identified. Such as p, div, table, field,
123:             *            etc...
124:             * @param name
125:             *            A locally unique name that distinguished this element from
126:             *            among its siblings.
127:             * @return A globally unique identifier.
128:             */
129:            public String generateID(String application, String name) {
130:                return combine(componentName, application, name);
131:            }
132:
133:            /**
134:             * Generate a unique id with a sub name. Like the other form of generateID
135:             * this will append another sub-name. This is typically used for when
136:             * duplicate names are used but further identification is needed for
137:             * globally unique names.
138:             * 
139:             * @param application
140:             *            The application of this element, typically this is the element
141:             *            type that is being identified. Such as p, div, table, field,
142:             *            etc...
143:             * @param name
144:             *            A locally unique name that distinguished this element from
145:             *            among its siblings.
146:             * @param subName
147:             *            An additional name to the original name to further identify it
148:             *            in cases when just the name alone does not accomplish this.
149:             * @return
150:             */
151:            public String generateID(String application, String name,
152:                    String subName) {
153:                return combine(componentName, application, name, subName);
154:            }
155:
156:            /**
157:             * Generate a specialized name based on the callers name. This is typically
158:             * used in situations where two namespaces are being merged together so that
159:             * each namespace is prepended with the current scope's name.
160:             * 
161:             * @param name
162:             *            A locally unique name that distinguished this element from
163:             *            among it's siblings.
164:             */
165:            public String generateName(String name) {
166:                return combine(componentName, name);
167:            }
168:
169:            /**
170:             * Simple utility function to join the parts into one string separated by a
171:             * DOT.
172:             * 
173:             * @param parts
174:             *            The input parts.
175:             * @return The combined string.
176:             */
177:            private String combine(String... parts) {
178:
179:                String combine = "";
180:                boolean skipDivider = true;
181:                for (String part : parts) {
182:                    if (part == null) {
183:                        skipDivider = true;
184:                        continue;
185:                    }
186:
187:                    if (skipDivider)
188:                        skipDivider = false;
189:                    else
190:                        combine += DIVIDER;
191:
192:                    combine += part;
193:
194:                }
195:
196:                return combine;
197:            }
198:
199:            /**
200:             * Set the objectManager which is repsonsible for managing the object store in the DRI document.
201:             * 
202:             * @param objectManager The new objectManager
203:             */
204:            public void setObjectManager(ObjectManager objectManager) {
205:                this .objectManager = objectManager;
206:            }
207:
208:            /**
209:             * Get the objectManager.
210:             * 
211:             * @return Return the objectManager associated with this component.
212:             */
213:            public ObjectManager getObjectManager() {
214:                return this .objectManager;
215:            }
216:
217:            /**
218:             * Check that the context is valid, and able to be used. An error should be
219:             * thrown if it is not in a valid sate.
220:             */
221:            public void checkValidity() throws WingException {
222:                // FIXME: There use to be invalid states for wing contexts however they
223:                // were removed. I think in the future however additions could require
224:                // this check so I do not want to remove it just yet.
225:            }
226:
227:            /**
228:             * Recycle this context for future use by another wing element
229:             */
230:            public void dispose() {
231:                this.componentName = null;
232:                this.objectManager = null;
233:            }
234:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.