Source Code Cross Referenced for Rep.java in  » Web-Framework » rife-1.6.1 » com » uwyn » rife » rep » 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 » rife 1.6.1 » com.uwyn.rife.rep 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
003:         * Distributed under the terms of either:
004:         * - the common development and distribution license (CDDL), v1.0; or
005:         * - the GNU Lesser General Public License, v2.1 or later
006:         * $Id: Rep.java 3634 2007-01-08 21:42:24Z gbevin $
007:         */
008:        package com.uwyn.rife.rep;
009:
010:        import com.uwyn.rife.ioc.HierarchicalProperties;
011:        import com.uwyn.rife.resources.ResourceFinder;
012:        import java.util.Collection;
013:
014:        /**
015:         * This static abstract class provides easy application-wide access to the
016:         * default <code>Repository</code>.
017:         * <p>It's main purpose is to be able to quickle retrieve its
018:         * <code>Participant</code>s.
019:         * <p>It's possible to retrieve and replace the default
020:         * <code>Repository</code> with the {@link #setDefaultRepository(Repository)
021:         * setDefaultRepository} and {@link #getDefaultRepository()
022:         * getDefaultRepository} methods.
023:         *
024:         * @author Geert Bevin (gbevin[remove] at uwyn dot com)
025:         * @version $Revision: 3634 $
026:         * @see Participant
027:         * @see Repository
028:         * @since 1.0
029:         */
030:        public abstract class Rep {
031:            private static Repository sDefaultRepository = null;
032:            private static HierarchicalProperties sDummyProperties = null;
033:
034:            /**
035:             * Initializes the default repository by creating an instance of
036:             * <code>BlockingRepository</code> and initializing it with the provided
037:             * XML path, a default resource finder and no context.
038:             *
039:             * @see #initialize(String, ResourceFinder, Object)
040:             * @since 1.0
041:             */
042:            public static void initialize(String repXmlPath) {
043:                initialize(repXmlPath, null, null);
044:            }
045:
046:            /**
047:             * Initializes the default repository by creating an instance of
048:             * <code>BlockingRepository</code> and initializing it with the provided
049:             * properties and context.
050:             *
051:             * @see BlockingRepository
052:             * @see BlockingRepository#initialize(String, ResourceFinder)
053:             * @since 1.0
054:             */
055:            public static void initialize(String repXmlPath,
056:                    ResourceFinder resourcefinder, Object context) {
057:                BlockingRepository repository = new BlockingRepository(context);
058:                sDefaultRepository = repository;
059:                repository.initialize(repXmlPath, resourcefinder);
060:            }
061:
062:            /**
063:             * Replaces the default repository.
064:             *
065:             * @param repository An instance of <code>Repository</code> that will
066:             * afterwards become the application-wide default repository.
067:             * @see Repository
068:             * @since 1.0
069:             */
070:            public static void setDefaultRepository(Repository repository) {
071:                sDefaultRepository = repository;
072:            }
073:
074:            /**
075:             * Retrieves the current default repository.
076:             *
077:             * @return An instance of <code>Repository</code> that is currently the
078:             * application-wide default repository.
079:             * @see Repository
080:             * @since 1.0
081:             */
082:            public static Repository getDefaultRepository() {
083:                return sDefaultRepository;
084:            }
085:
086:            /**
087:             * Convenience method to quickly check if a participant with a certain
088:             * name is available in the default repository.
089:             *
090:             * @see Repository#hasParticipant(String)
091:             * @since 1.0
092:             */
093:            public static boolean hasParticipant(String name) {
094:                if (null == sDefaultRepository) {
095:                    return false;
096:                }
097:
098:                return sDefaultRepository.hasParticipant(name);
099:            }
100:
101:            /**
102:             * Convenience method to quickly retrieve the first participant with a
103:             * certain name from the default repository.
104:             *
105:             * @see Repository#getParticipant(String)
106:             * @since 1.0
107:             */
108:            public static Participant getParticipant(String name) {
109:                if (null == sDefaultRepository) {
110:                    return null;
111:                }
112:
113:                return sDefaultRepository.getParticipant(name);
114:            }
115:
116:            /**
117:             * Convenience method to quickly retrieve all the participants with a
118:             * certain name from the default repository.
119:             *
120:             * @see Repository#getParticipants(String)
121:             * @since 1.0
122:             */
123:            public static Collection<? extends Participant> getParticipants(
124:                    String name) {
125:                if (null == sDefaultRepository) {
126:                    return null;
127:                }
128:
129:                return sDefaultRepository.getParticipants(name);
130:            }
131:
132:            /**
133:             * Convenience method to quickly retrieve the properties from the default
134:             * repository. If no default repository has been configured, an empty instance
135:             * of <code>HierarchicalProperties</code> is returned.
136:             *
137:             * @see Repository#getProperties()
138:             * @since 1.1
139:             */
140:            public static HierarchicalProperties getProperties() {
141:                if (null == sDefaultRepository) {
142:                    if (null == sDummyProperties) {
143:                        HierarchicalProperties system_properties = new HierarchicalProperties()
144:                                .putAll(System.getProperties());
145:                        sDummyProperties = new HierarchicalProperties()
146:                                .parent(system_properties);
147:                    }
148:                    return sDummyProperties;
149:                }
150:
151:                return sDefaultRepository.getProperties();
152:            }
153:
154:            /**
155:             * Cleans up the default repository if it exists. This is typically done at
156:             * application shutdown.
157:             *
158:             * @since 1.0
159:             */
160:            public static void cleanup() {
161:                if (null == sDefaultRepository) {
162:                    return;
163:                }
164:
165:                sDefaultRepository.cleanup();
166:            }
167:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.