Source Code Cross Referenced for HiveMind.java in  » Inversion-of-Control » hivemind » org » apache » hivemind » 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 » Inversion of Control » hivemind » org.apache.hivemind 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // Copyright 2004, 2005 The Apache Software Foundation
002:        //
003:        // Licensed under the Apache License, Version 2.0 (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
006:        //
007:        //     http://www.apache.org/licenses/LICENSE-2.0
008:        //
009:        // Unless required by applicable law or agreed to in writing, software
010:        // distributed under the License is distributed on an "AS IS" BASIS,
011:        // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012:        // See the License for the specific language governing permissions and
013:        // limitations under the License.
014:
015:        package org.apache.hivemind;
016:
017:        import java.util.Collection;
018:
019:        /**
020:         * Static utility class for HiveMind.
021:         * 
022:         * @author Howard Lewis Ship
023:         */
024:        public final class HiveMind {
025:            /**
026:             * The full id of the {@link org.apache.hivemind.service.ThreadEventNotifier} service.
027:             */
028:            public static final String THREAD_EVENT_NOTIFIER_SERVICE = "hivemind.ThreadEventNotifier";
029:
030:            /**
031:             * The full id of the {@link org.apache.hivemind.service.ThreadLocale} service.
032:             * 
033:             * @since 1.1
034:             */
035:
036:            public static final String THREAD_LOCALE_SERVICE = "hivemind.ThreadLocale";
037:
038:            /**
039:             * The full id of the {@link org.apache.hivemind.service.InterfaceSynthesizer} service.
040:             * 
041:             * @since 1.1
042:             */
043:
044:            public static final String INTERFACE_SYNTHESIZER_SERVICE = "hivemind.InterfaceSynthesizer";
045:
046:            /**
047:             * An object used to synchronize access to {@link java.beans.Introspector} (which is not fully
048:             * threadsafe).
049:             * 
050:             * @since 1.1
051:             */
052:
053:            public static final Object INTROSPECTOR_MUTEX = new Object();
054:
055:            private HiveMind() {
056:                // Prevent instantiation
057:            }
058:
059:            public static ApplicationRuntimeException createRegistryShutdownException() {
060:                return new ApplicationRuntimeException(HiveMindMessages
061:                        .registryShutdown());
062:            }
063:
064:            /**
065:             * Selects the first {@link Location} in an array of objects. Skips over nulls. The objects may
066:             * be instances of Location or {@link Locatable}. May return null if no Location can be found.
067:             */
068:
069:            public static Location findLocation(Object[] locations) {
070:                for (int i = 0; i < locations.length; i++) {
071:                    Object location = locations[i];
072:
073:                    Location result = getLocation(location);
074:
075:                    if (result != null)
076:                        return result;
077:
078:                }
079:
080:                return null;
081:            }
082:
083:            /**
084:             * Extracts a location from an object, checking to see if it implement {@link Location} or
085:             * {@link Locatable}.
086:             * 
087:             * @return the Location, or null if it can't be found
088:             */
089:            public static Location getLocation(Object object) {
090:                if (object == null)
091:                    return null;
092:
093:                if (object instanceof  Location)
094:                    return (Location) object;
095:
096:                if (object instanceof  Locatable) {
097:                    Locatable locatable = (Locatable) object;
098:
099:                    return locatable.getLocation();
100:                }
101:
102:                return null;
103:            }
104:
105:            /**
106:             * Invokes {@link #getLocation(Object)}, then translate the result to a string value, or
107:             * "unknown location" if null.
108:             */
109:            public static String getLocationString(Object object) {
110:                Location l = getLocation(object);
111:
112:                if (l != null)
113:                    return l.toString();
114:
115:                return HiveMindMessages.unknownLocation();
116:            }
117:
118:            /**
119:             * Returns true if the string is null, empty, or contains only whitespace.
120:             * <p>
121:             * The commons-lang library provides a version of this, but the naming and behavior changed
122:             * between 1.0 and 2.0, which causes some dependency issues.
123:             */
124:            public static boolean isBlank(String string) {
125:                if (string == null || string.length() == 0)
126:                    return true;
127:
128:                if (string.trim().length() == 0)
129:                    return true;
130:
131:                return false;
132:            }
133:
134:            /**
135:             * As with {@link #isBlank(String)}, but inverts the response.
136:             */
137:            public static boolean isNonBlank(String string) {
138:                return !isBlank(string);
139:            }
140:
141:            /**
142:             * Updates the location of an object, if the object implements {@link LocationHolder}.
143:             * 
144:             * @param holder
145:             *            the object to be updated
146:             * @param location
147:             *            the location to assign to the holder object
148:             */
149:            public static void setLocation(Object holder, Location location) {
150:                if (holder != null && holder instanceof  LocationHolder) {
151:                    LocationHolder lh = (LocationHolder) holder;
152:
153:                    lh.setLocation(location);
154:                }
155:            }
156:
157:            /**
158:             * Returns true if the Collection is null or empty.
159:             */
160:            public static boolean isEmpty(Collection c) {
161:                return c == null || c.isEmpty();
162:            }
163:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.