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


001:        /*
002:         * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003:         * notice. All rights reserved.
004:         */
005:        package com.tc.object.appevent;
006:
007:        import com.tc.net.protocol.tcm.ChannelIDProvider;
008:        import com.tc.object.tx.UnlockedSharedObjectException;
009:        import com.tc.object.util.ReadOnlyException;
010:
011:        /**
012:         * A factory for creating the proper {@link NonPortableEventContext}
013:         */
014:        public class NonPortableEventContextFactory {
015:
016:            private final ChannelIDProvider provider;
017:
018:            /**
019:             * Construct the factory with the provider of a ChannelID
020:             * @param provider The provider
021:             */
022:            public NonPortableEventContextFactory(ChannelIDProvider provider) {
023:                this .provider = provider;
024:            }
025:
026:            private String getJVMId() {
027:                return "VM(" + provider.getChannelID().toLong() + ")";
028:            }
029:
030:            /**
031:             * Create a context for when a non-portable object is found while traversing an object graph
032:             * @param pojo The non portable object
033:             * @return The context
034:             */
035:            public NonPortableEventContext createNonPortableEventContext(
036:                    Object pojo) {
037:                return new NonPortableEventContext(pojo, Thread.currentThread()
038:                        .getName(), getJVMId());
039:            }
040:
041:            /**
042:             * Create a context for when a non-portable object is set as a root
043:             * @param rootName The root name
044:             * @param rootValue The non-portable value being set
045:             * @return The context
046:             */
047:            public NonPortableRootContext createNonPortableRootContext(
048:                    String rootName, Object rootValue) {
049:                return new NonPortableRootContext(Thread.currentThread()
050:                        .getName(), getJVMId(), rootName, rootValue);
051:            }
052:
053:            /**
054:             * Create a context for when a non-portable object is set on a field
055:             * @param pojo The object that is having the field set
056:             * @param fieldName The field of the pojo
057:             * @param fieldValue The non-portable value being set
058:             * @return The context
059:             */
060:            public NonPortableFieldSetContext createNonPortableFieldSetContext(
061:                    Object pojo, String fieldName, Object fieldValue) {
062:                return new NonPortableFieldSetContext(Thread.currentThread()
063:                        .getName(), getJVMId(), pojo, fieldName, fieldValue);
064:            }
065:
066:            /**
067:             * Create a context for an invocation of a logical method with a non-portable object
068:             * @param pojo The logical object
069:             * @param methodName The method being called on the pojo
070:             * @param params The parameters passed to the method
071:             * @param index The index into the params of the non-portable object
072:             * @return The context
073:             */
074:            public NonPortableLogicalInvokeContext createNonPortableLogicalInvokeContext(
075:                    Object pojo, String methodName, Object[] params, int index) {
076:                return new NonPortableLogicalInvokeContext(pojo, Thread
077:                        .currentThread().getName(), getJVMId(), methodName,
078:                        params, index);
079:            }
080:
081:            /**
082:             * Create a context for when there is an attempt to access a shared object outside the scope of
083:             * a shared lock.
084:             * @param pojo The object being accessed 
085:             * @param classname The class of the object
086:             * @param fieldname The field of the object being accessed
087:             * @param ex The exception thrown
088:             * @return The context
089:             */
090:            public UnlockedSharedObjectEventContext createUnlockedSharedObjectEventContext(
091:                    Object pojo, String classname, String fieldname,
092:                    UnlockedSharedObjectException ex) {
093:                return new UnlockedSharedObjectEventContext(pojo, classname,
094:                        fieldname, Thread.currentThread().getName(),
095:                        getJVMId(), ex);
096:            }
097:
098:            /**
099:             * Create a context for when there is an attempt to access a shared object outside the scope of
100:             * a shared lock.
101:             * @param pojo The object being accessed 
102:             * @param ex The exception thrown
103:             * @return The context
104:             */
105:            public UnlockedSharedObjectEventContext createUnlockedSharedObjectEventContext(
106:                    Object pojo, UnlockedSharedObjectException ex) {
107:                return new UnlockedSharedObjectEventContext(pojo, Thread
108:                        .currentThread().getName(), getJVMId(), ex);
109:            }
110:
111:            /**
112:             * Create a context for when a transaction with read-only access is attempting
113:             * to modify a shared object.
114:             * @param pojo The object being accessed
115:             * @param ex The exception that occurred
116:             * @return The context
117:             */
118:            public ReadOnlyObjectEventContext createReadOnlyObjectEventContext(
119:                    Object pojo, ReadOnlyException ex) {
120:                return new ReadOnlyObjectEventContext(pojo, Thread
121:                        .currentThread().getName(), getJVMId(), ex);
122:            }
123:
124:            /**
125:             * Create a context for when a transaction with read-only access is attempting
126:             * to modify a shared object.
127:             * @param pojo The object being accessed
128:             * @param classname The class of the pojo
129:             * @param fieldname The field name of the object
130:             * @param ex The exception that occurred
131:             * @return The context
132:             */
133:            public ReadOnlyObjectEventContext createReadOnlyObjectEventContext(
134:                    Object pojo, String classname, String fieldname,
135:                    ReadOnlyException ex) {
136:                return new ReadOnlyObjectEventContext(pojo, classname,
137:                        fieldname, Thread.currentThread().getName(),
138:                        getJVMId(), ex);
139:            }
140:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.