Source Code Cross Referenced for TurbinePull.java in  » Web-Framework » TURBINE » org » apache » turbine » services » pull » 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 » Web Framework » TURBINE » org.apache.turbine.services.pull 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.turbine.services.pull;
002:
003:        /*
004:         * Licensed to the Apache Software Foundation (ASF) under one
005:         * or more contributor license agreements.  See the NOTICE file
006:         * distributed with this work for additional information
007:         * regarding copyright ownership.  The ASF licenses this file
008:         * to you under the Apache License, Version 2.0 (the
009:         * "License"); you may not use this file except in compliance
010:         * with the License.  You may obtain a copy of the License at
011:         *
012:         *   http://www.apache.org/licenses/LICENSE-2.0
013:         *
014:         * Unless required by applicable law or agreed to in writing,
015:         * software distributed under the License is distributed on an
016:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017:         * KIND, either express or implied.  See the License for the
018:         * specific language governing permissions and limitations
019:         * under the License.
020:         */
021:
022:        import org.apache.turbine.services.TurbineServices;
023:        import org.apache.turbine.util.RunData;
024:
025:        import org.apache.velocity.context.Context;
026:
027:        /**
028:         * This is a Facade class for PullService.
029:         *
030:         * This class provides static methods that call related methods of the
031:         * implementation of the PullService used by the System, according to
032:         * the settings in TurbineResources.
033:         *
034:         * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
035:         * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
036:         * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
037:         * @version $Id: TurbinePull.java 534527 2007-05-02 16:10:59Z tv $
038:         */
039:        public abstract class TurbinePull {
040:            /**
041:             * Utility method for accessing the service
042:             * implementation
043:             *
044:             * @return a PullService implementation instance
045:             */
046:            public static PullService getService() {
047:                return (PullService) TurbineServices.getInstance().getService(
048:                        PullService.SERVICE_NAME);
049:            }
050:
051:            /**
052:             * Get the context containing global tools that will be
053:             * use as part of the Turbine Pull Model.
054:             *
055:             * @return A Context object which contains the
056:             *         Global Tool instances.
057:             */
058:            public static final Context getGlobalContext() {
059:                return getService().getGlobalContext();
060:            }
061:
062:            /**
063:             * Checks whether this service has been registered.  This is
064:             * required by the TurbineVelocityService so it can determine
065:             * whether to attempt to place the ToolBox in the context.
066:             * <p>
067:             * So users can use Turbine with templates in the traditional
068:             * manner. If the Pull Service is not listed in
069:             * <code>TurbineResources.props</code>, or no tools are specified
070:             * the TurbineVelocityService will behave in its traditional
071:             * manner.
072:             */
073:            public static final boolean isRegistered() {
074:                return TurbineServices.getInstance().isRegistered(
075:                        PullService.SERVICE_NAME);
076:            }
077:
078:            /**
079:             * Return the absolute path of the resources directory
080:             * used by application tools.
081:             *
082:             * @return A directory path in the file system or null.
083:             */
084:            public static final String getAbsolutePathToResourcesDirectory() {
085:                return getService().getAbsolutePathToResourcesDirectory();
086:            }
087:
088:            /**
089:             * Return the resources directory. This is relative
090:             * to the webapp context.
091:             *
092:             * @return A directory path to the resources directory relative to the webapp root or null.
093:             */
094:            public static final String getResourcesDirectory() {
095:                return getService().getResourcesDirectory();
096:            }
097:
098:            /**
099:             * Populate the given context with all request, session
100:             * and persistent scope tools (it is assumed that the context
101:             * already wraps the global context, and thus already contains
102:             * the global tools).
103:             *
104:             * @param context a Velocity Context to populate
105:             * @param data a RunData object for request specific data
106:             */
107:            public static void populateContext(Context context, RunData data) {
108:                getService().populateContext(context, data);
109:            }
110:
111:            /**
112:             * Refresh the global tools. This is necessary
113:             * for development work where tools depend
114:             * on configuration information. The configuration
115:             * information is typically cached after initialization
116:             * but during development you might want the tool
117:             * to refresh itself on each request.
118:             * <p>
119:             * If there are objects that don't implement
120:             * the ApplicationTool interface, then they won't
121:             * be refreshed.
122:             * @deprecated No longer needed as Pull and Velocity Service are now more separate.
123:             */
124:            public static final void refreshGlobalTools() {
125:                getService().refreshGlobalTools();
126:            }
127:
128:            /**
129:             * Shoud we refresh the tools
130:             * on each request. For development purposes.
131:             *
132:             * @return true if we should refresh the tools on every request.
133:             * @deprecated No longer needed as Pull and Velocity Service are now more separate.
134:             */
135:            public static final boolean refreshToolsPerRequest() {
136:                return getService().refreshToolsPerRequest();
137:            }
138:
139:            /**
140:             * Release tool instances from the given context to the
141:             * object pool
142:             *
143:             * @param context a Velocity Context to release tools from
144:             */
145:            public static void releaseTools(Context context) {
146:                getService().releaseTools(context);
147:            }
148:
149:            /**
150:             * Helper method that allows you to easily get a tool
151:             * from a Context. Essentially, it just does the cast
152:             * to an Application tool for you.
153:             *
154:             * @param context a Velocity Context to get tools from
155:             * @param name the name of the tool to get
156:             * @return ApplicationTool null if no tool could be found
157:             */
158:            public static ApplicationTool getTool(Context context, String name) {
159:                try {
160:                    return (ApplicationTool) context.get(name);
161:                } catch (Exception e) {
162:                }
163:                return null;
164:            }
165:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.