Source Code Cross Referenced for NonPortableWorkState.java in  » Net » Terracotta » com » tc » admin » common » 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 » Net » Terracotta » com.tc.admin.common 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003:         * notice. All rights reserved.
004:         */
005:        package com.tc.admin.common;
006:
007:        import com.tc.object.appevent.ApplicationEventContext;
008:        import com.tc.object.appevent.NonPortableEventContext;
009:        import com.tc.object.appevent.NonPortableObjectState;
010:        import com.tc.object.appevent.NonPortableRootContext;
011:
012:        import java.util.List;
013:
014:        public class NonPortableWorkState extends AbstractWorkState {
015:            private NonPortableObjectState fObjectState;
016:
017:            public NonPortableWorkState(NonPortableObjectState objectState) {
018:                fObjectState = objectState;
019:            }
020:
021:            public boolean isPortable() {
022:                return fObjectState.isPortable();
023:            }
024:
025:            public boolean isNeverPortable() {
026:                return fObjectState.isNeverPortable();
027:            }
028:
029:            public boolean extendsLogicallyManagedType() {
030:                return fObjectState.extendsLogicallyManagedType();
031:            }
032:
033:            public boolean isRequiredBootJarType() {
034:                return fObjectState.isRequiredBootJarType();
035:            }
036:
037:            public boolean isPreInstrumented() {
038:                return fObjectState.isPreInstrumented();
039:            }
040:
041:            public boolean isRepeated() {
042:                return fObjectState.isRepeated();
043:            }
044:
045:            public boolean isTransient() {
046:                return fObjectState.isTransient();
047:            }
048:
049:            public boolean isSystemType() {
050:                return fObjectState.isSystemType();
051:            }
052:
053:            public boolean isNull() {
054:                return fObjectState.isNull();
055:            }
056:
057:            public String getTypeName() {
058:                return fObjectState.getTypeName();
059:            }
060:
061:            public String getFieldName() {
062:                return fObjectState.getFieldName();
063:            }
064:
065:            public boolean hasRequiredBootTypes() {
066:                List requiredBootTypes = getRequiredBootTypes();
067:                return requiredBootTypes != null
068:                        && requiredBootTypes.size() > 0;
069:            }
070:
071:            public boolean this IsOnlyRequiredBootType() {
072:                List requiredBootTypes = getRequiredBootTypes();
073:                return requiredBootTypes != null
074:                        && requiredBootTypes.size() == 1
075:                        && requiredBootTypes.get(0).equals(getTypeName());
076:            }
077:
078:            public List getRequiredBootTypes() {
079:                return fObjectState.getRequiredBootTypes();
080:            }
081:
082:            public boolean hasNonPortableBaseTypes() {
083:                List nonPortableBaseTypes = getNonPortableBaseTypes();
084:                return nonPortableBaseTypes != null
085:                        && nonPortableBaseTypes.size() > 0;
086:            }
087:
088:            public List getNonPortableBaseTypes() {
089:                return fObjectState.getNonPortableBaseTypes();
090:            }
091:
092:            public boolean hasRequiredIncludeTypes() {
093:                List requiredIncludeTypes = getRequiredIncludeTypes();
094:                return requiredIncludeTypes != null
095:                        && requiredIncludeTypes.size() > 0;
096:            }
097:
098:            public List getRequiredIncludeTypes() {
099:                return fObjectState.getRequiredIncludeTypes();
100:            }
101:
102:            public String summary() {
103:                return fObjectState.summary();
104:            }
105:
106:            public String shortSummary() {
107:                StringBuffer sb = new StringBuffer();
108:                sb.append(getTypeName());
109:                if (isNeverPortable()) {
110:                    sb.append(" Never portable");
111:                } else {
112:                    sb.append(" not portable");
113:                }
114:                return sb.toString();
115:            }
116:
117:            public String getLabel() {
118:                return fObjectState.getLabel();
119:            }
120:
121:            public String getExplaination() {
122:                return fObjectState.getExplaination();
123:            }
124:
125:            private static final String TRANSIENT_FIELD_MSG = NonPortableMessages
126:                    .getString("TRANSIENT_FIELD_MSG"); //$NON-NLS-1$
127:            private static final String PRE_INSTRUMENTED_PREAMBLE = NonPortableMessages
128:                    .getString("PRE_INSTRUMENTED_PREAMBLE"); //$NON-NLS-1$
129:            private static final String NEVER_PORTABLE_PREAMBLE = NonPortableMessages
130:                    .getString("NEVER_PORTABLE_PREAMBLE"); //$NON-NLS-1$
131:            private static final String NEVER_PORTABLE_FIELD_MSG = NonPortableMessages
132:                    .getString("NEVER_PORTABLE_FIELD_MSG"); //$NON-NLS-1$
133:            private static final String NEVER_PORTABLE_LOGICAL_CHILD_MSG = NonPortableMessages
134:                    .getString("NEVER_PORTABLE_LOGICAL_CHILD_MSG"); //$NON-NLS-1$
135:            private static final String NEVER_PORTABLE_ROOT_MSG = NonPortableMessages
136:                    .getString("NEVER_PORTABLE_ROOT_MSG"); //$NON-NLS-1$
137:            private static final String CONSIDER_TRANSIENT_ANCESTOR = NonPortableMessages
138:                    .getString("CONSIDER_TRANSIENT_ANCESTOR_MSG"); //$NON-NLS-1$
139:            private static final String NOT_PORTABLE_SYSTEM_TYPE_PREAMBLE = NonPortableMessages
140:                    .getString("NOT_PORTABLE_SYSTEM_TYPE_PREAMBLE"); //$NON-NLS-1$
141:            private static final String NOT_PORTABLE_SYSTEM_TYPE_FIELD_MSG = NonPortableMessages
142:                    .getString("NOT_PORTABLE_SYSTEM_TYPE_FIELD_MSG"); //$NON-NLS-1$
143:            private static final String NOT_PORTABLE_SYSTEM_TYPE_LOGICAL_CHILD_MSG = NonPortableMessages
144:                    .getString("NOT_PORTABLE_SYSTEM_TYPE_LOGICAL_CHILD_MSG"); //$NON-NLS-1$
145:            private static final String NOT_PORTABLE_SYSTEM_TYPE_ROOT_MSG = NonPortableMessages
146:                    .getString("NOT_PORTABLE_SYSTEM_TYPE_ROOT_MSG"); //$NON-NLS-1$
147:            private static final String NOT_PORTABLE_PREAMBLE = NonPortableMessages
148:                    .getString("NOT_PORTABLE_PREAMBLE"); //$NON-NLS-1$
149:            private static final String NOT_PORTABLE_FIELD_MSG = NonPortableMessages
150:                    .getString("NOT_PORTABLE_FIELD_MSG"); //$NON-NLS-1$
151:            private static final String NOT_PORTABLE_LOGICAL_CHILD_MSG = NonPortableMessages
152:                    .getString("NOT_PORTABLE_LOGICAL_CHILD_MSG"); //$NON-NLS-1$
153:            private static final String NOT_PORTABLE_ROOT_MSG = NonPortableMessages
154:                    .getString("NOT_PORTABLE_ROOT_MSG"); //$NON-NLS-1$
155:            private static final String PORTABLE_PREAMBLE = NonPortableMessages
156:                    .getString("PORTABLE_PREAMBLE"); //$NON-NLS-1$
157:            private static final String PORTABLE_FIELD_MSG = NonPortableMessages
158:                    .getString("PORTABLE_FIELD_MSG"); //$NON-NLS-1$
159:            private static final String PORTABLE_LOGICAL_CHILD_MSG = NonPortableMessages
160:                    .getString("PORTABLE_LOGICAL_CHILD_MSG"); //$NON-NLS-1$
161:            private static final String NON_PORTABLE_BASE_TYPE_MSG = NonPortableMessages
162:                    .getString("NON_PORTABLE_BASE_TYPE_MSG"); //$NON-NLS-1$
163:            private static final String REQUIRED_BOOT_JAR_TYPE_MSG = NonPortableMessages
164:                    .getString("REQUIRED_BOOT_JAR_TYPE_MSG"); //$NON-NLS-1$
165:            private static final String EXTENDS_LOGICALLY_MANAGED_TYPE_MSG = NonPortableMessages
166:                    .getString("EXTENDS_LOGICALLY_MANAGED_TYPE_MSG"); //$NON-NLS-1$
167:            private static final String WHITESPACE = "\n\n";
168:
169:            private static void append(StringBuffer sb, String[] strings) {
170:                if (strings != null) {
171:                    for (int i = 0; i < strings.length; i++) {
172:                        sb.append(strings[i]);
173:                    }
174:                }
175:            }
176:
177:            private boolean isRoot(final NonPortableEventContext context) {
178:                if (context instanceof  NonPortableRootContext) {
179:                    return ((NonPortableRootContext) context).getFieldName()
180:                            .equals(getFieldName());
181:                }
182:                return false;
183:            }
184:
185:            public String descriptionFor(final ApplicationEventContext context) {
186:                if (!(context instanceof  NonPortableEventContext))
187:                    return "";
188:
189:                String explaination = getExplaination();
190:                if (explaination != null) {
191:                    return explaination;
192:                }
193:
194:                boolean isRoot = isRoot((NonPortableEventContext) context);
195:                StringBuffer sb = new StringBuffer();
196:                if (isTransient()) {
197:                    sb.append(TRANSIENT_FIELD_MSG);
198:                } else if (isPreInstrumented()) {
199:                    sb.append(PRE_INSTRUMENTED_PREAMBLE);
200:                    if (!isRoot) {
201:                        if (getFieldName() != null) {
202:                            append(sb, new String[] { WHITESPACE,
203:                                    PORTABLE_FIELD_MSG });
204:                        } else {
205:                            append(sb, new String[] { WHITESPACE,
206:                                    PORTABLE_LOGICAL_CHILD_MSG });
207:                        }
208:                    }
209:                } else if (isNeverPortable()) {
210:                    sb.append(NEVER_PORTABLE_PREAMBLE);
211:                    if (!isRoot) {
212:                        if (getFieldName() != null) {
213:                            append(sb, new String[] { WHITESPACE,
214:                                    NEVER_PORTABLE_FIELD_MSG, WHITESPACE,
215:                                    CONSIDER_TRANSIENT_ANCESTOR });
216:                        } else {
217:                            append(sb, new String[] { WHITESPACE,
218:                                    NEVER_PORTABLE_LOGICAL_CHILD_MSG,
219:                                    WHITESPACE, CONSIDER_TRANSIENT_ANCESTOR });
220:                        }
221:                    } else {
222:                        append(sb, new String[] { WHITESPACE,
223:                                NEVER_PORTABLE_ROOT_MSG });
224:                    }
225:                } else if (!isPortable()) {
226:                    String reason = "";
227:
228:                    if (hasNonPortableBaseTypes())
229:                        reason = " " + NON_PORTABLE_BASE_TYPE_MSG;
230:                    if (hasRequiredBootTypes() && !this IsOnlyRequiredBootType()) {
231:                        reason += " " + REQUIRED_BOOT_JAR_TYPE_MSG;
232:                    }
233:
234:                    if (isSystemType()) {
235:                        append(sb, new String[] {
236:                                NOT_PORTABLE_SYSTEM_TYPE_PREAMBLE, reason });
237:                        if (!isRoot) {
238:                            if (getFieldName() != null) {
239:                                append(
240:                                        sb,
241:                                        new String[] {
242:                                                WHITESPACE,
243:                                                NOT_PORTABLE_SYSTEM_TYPE_FIELD_MSG,
244:                                                WHITESPACE,
245:                                                CONSIDER_TRANSIENT_ANCESTOR });
246:                            } else {
247:                                append(
248:                                        sb,
249:                                        new String[] {
250:                                                WHITESPACE,
251:                                                NOT_PORTABLE_SYSTEM_TYPE_LOGICAL_CHILD_MSG,
252:                                                WHITESPACE,
253:                                                CONSIDER_TRANSIENT_ANCESTOR });
254:                            }
255:                        } else {
256:                            append(sb, new String[] { WHITESPACE,
257:                                    NOT_PORTABLE_SYSTEM_TYPE_ROOT_MSG });
258:                        }
259:                    } else if (extendsLogicallyManagedType()) {
260:                        sb.append(EXTENDS_LOGICALLY_MANAGED_TYPE_MSG);
261:                    } else {
262:                        append(sb,
263:                                new String[] { NOT_PORTABLE_PREAMBLE, reason });
264:                        if (!isRoot) {
265:                            if (getFieldName() != null) {
266:                                append(sb, new String[] { WHITESPACE,
267:                                        NOT_PORTABLE_FIELD_MSG, WHITESPACE,
268:                                        CONSIDER_TRANSIENT_ANCESTOR });
269:                            } else {
270:                                append(sb,
271:                                        new String[] { WHITESPACE,
272:                                                NOT_PORTABLE_LOGICAL_CHILD_MSG,
273:                                                WHITESPACE,
274:                                                CONSIDER_TRANSIENT_ANCESTOR });
275:                            }
276:                        } else {
277:                            append(sb, new String[] { WHITESPACE,
278:                                    NOT_PORTABLE_ROOT_MSG });
279:                        }
280:                    }
281:                } else {
282:                    sb.append(PORTABLE_PREAMBLE);
283:                    if (!isRoot) {
284:                        if (getFieldName() != null) {
285:                            append(sb, new String[] { WHITESPACE,
286:                                    PORTABLE_FIELD_MSG });
287:                        } else {
288:                            append(sb, new String[] { WHITESPACE,
289:                                    PORTABLE_LOGICAL_CHILD_MSG });
290:                        }
291:                    }
292:                }
293:
294:                return sb.toString();
295:            }
296:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.