Source Code Cross Referenced for AspectContext.java in  » Net » Terracotta » com » tc » aspectwerkz » 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.aspectwerkz 
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 notice.  All rights reserved.
003:         */
004:        package com.tc.aspectwerkz;
005:
006:        import com.tc.aspectwerkz.definition.AspectDefinition;
007:
008:        import java.io.ObjectInputStream;
009:        import java.lang.ref.WeakReference;
010:        import java.util.HashMap;
011:        import java.util.Map;
012:
013:        /**
014:         * Contains information about and for classes that has been defined as cross-cutting.
015:         * 
016:         * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
017:         */
018:        public final class AspectContext {
019:            /**
020:             * An empty <code>Object</code> array.
021:             */
022:            public static final Object[] EMPTY_OBJECT_ARRAY = new Object[] {};
023:
024:            /**
025:             * The name for the cross-cuttable class.
026:             */
027:            private String m_name;
028:
029:            /**
030:             * The qualified name of the aspect. Stored for serialization purpose.
031:             */
032:            private String m_qName;
033:
034:            /**
035:             * The aspect class, wrapped in a weak reference since is a key of aspect container referenced by this object.
036:             */
037:            private transient WeakReference m_aspectClassRef;
038:
039:            /**
040:             * Holds the deployment model.
041:             */
042:            private DeploymentModel m_deploymentModel;
043:
044:            /**
045:             * Holds the parameters passed to the aspect.
046:             */
047:            private Map m_parameters = new HashMap();
048:
049:            /**
050:             * Holds the metadata.
051:             */
052:            private Map m_metaData = new HashMap();
053:
054:            /**
055:             * The UUID for the system.
056:             */
057:            private String m_uuid;
058:
059:            /**
060:             * The aspect definition.
061:             */
062:            private transient AspectDefinition m_aspectDefinition;
063:
064:            /**
065:             * The associated object.
066:             * Null for perJVM, but present for the class, target, this, instance or thread deployment models.
067:             */
068:            private transient Object m_associatedObject;
069:
070:            /**
071:             * Creates a new cross-cutting info instance.
072:             *
073:             * @param uuid
074:             * @param aspectClass
075:             * @param deploymentModel
076:             * @param aspectDef
077:             * @param parameters
078:             * @param associated      instance (null/class/instance/thread)
079:             */
080:            public AspectContext(final String uuid, final Class aspectClass,
081:                    final String name, final DeploymentModel deploymentModel,
082:                    final AspectDefinition aspectDef, final Map parameters,
083:                    final Object associated) {
084:                m_uuid = uuid;
085:                m_aspectClassRef = new WeakReference(aspectClass);
086:                m_name = name;
087:                m_qName = aspectDef.getQualifiedName();
088:                m_deploymentModel = deploymentModel;
089:                m_aspectDefinition = aspectDef;
090:                if (parameters != null) {
091:                    m_parameters = parameters;
092:                }
093:                m_associatedObject = associated;
094:            }
095:
096:            /**
097:             * Returns the UUID for the system.
098:             *
099:             * @return the UUID for the system
100:             */
101:            public String getUuid() {
102:                return m_uuid;
103:            }
104:
105:            /**
106:             * Returns the name of the aspect.
107:             *
108:             * @return the name of the aspect
109:             */
110:            public String getName() {
111:                return m_name;
112:            }
113:
114:            /**
115:             * Returns the deployment model.
116:             *
117:             * @return the deployment model
118:             */
119:            public DeploymentModel getDeploymentModel() {
120:                return m_deploymentModel;
121:            }
122:
123:            /**
124:             * Returns the cross-cuttable class.
125:             *
126:             * @return the cross-cuttable class
127:             */
128:            public Class getAspectClass() {
129:                return (Class) m_aspectClassRef.get();
130:            }
131:
132:            /**
133:             * Returns the aspect definition.
134:             * <p/>
135:             * Will return null after deserialization.
136:             *
137:             * @return the aspect definition
138:             */
139:            public AspectDefinition getAspectDefinition() {
140:                return m_aspectDefinition;
141:            }
142:
143:            /**
144:             * Sets a parameter.
145:             *
146:             * @param name  the name of the parameter
147:             * @param value the value of the parameter
148:             */
149:            public void setParameter(final String name, final String value) {
150:                m_parameters.put(name, value);
151:            }
152:
153:            /**
154:             * Returns the value of a parameter.
155:             *
156:             * @param name the name of the parameter
157:             * @return the value of the parameter or null if not specified
158:             */
159:            public String getParameter(final String name) {
160:                return (String) m_parameters.get(name);
161:            }
162:
163:            /**
164:             * Adds metadata.
165:             *
166:             * @param key   the key
167:             * @param value the value
168:             */
169:            public void addMetaData(final Object key, final Object value) {
170:                m_metaData.put(key, value);
171:            }
172:
173:            /**
174:             * Returns the metadata for a specific key.
175:             *
176:             * @param key the key
177:             * @return the value
178:             */
179:            public Object getMetaData(final Object key) {
180:                return m_metaData.get(key);
181:            }
182:
183:            /**
184:             * Returns the associated object with the aspect beeing instantiated. This depend on the aspect deployment model.
185:             * It can be a null/class/instance/thread.
186:             *
187:             * @return the associated object
188:             */
189:            public Object getAssociatedObject() {
190:                return m_associatedObject;
191:            }
192:
193:            /**
194:             * Provides custom deserialization.
195:             *
196:             * @param stream the object input stream containing the serialized object
197:             * @throws Exception in case of failure
198:             */
199:            private void readObject(final ObjectInputStream stream)
200:                    throws Exception {
201:                ObjectInputStream.GetField fields = stream.readFields();
202:                m_uuid = (String) fields.get("m_uuid", null);
203:                m_name = (String) fields.get("m_name", null);
204:                m_qName = (String) fields.get("m_qName", null);
205:                Class aspectClass = Class.forName(m_name);
206:                m_aspectClassRef = new WeakReference(aspectClass);
207:                m_deploymentModel = (DeploymentModel) fields.get(
208:                        "m_deploymentModel", DeploymentModel.PER_JVM);
209:                m_parameters = (Map) fields.get("m_parameters", new HashMap());
210:                m_metaData = (Map) fields.get("m_metaData", new HashMap());
211:
212:                //TODO aspectDef from m_qName
213:            }
214:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.