Source Code Cross Referenced for AspectDefinition.java in  » Aspect-oriented » aspectwerkz-2.0 » org » codehaus » aspectwerkz » definition » 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 » Aspect oriented » aspectwerkz 2.0 » org.codehaus.aspectwerkz.definition 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**************************************************************************************
002:         * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved.                 *
003:         * http://aspectwerkz.codehaus.org                                                    *
004:         * ---------------------------------------------------------------------------------- *
005:         * The software in this package is published under the terms of the LGPL license      *
006:         * a copy of which has been included with this distribution in the license.txt file.  *
007:         **************************************************************************************/package org.codehaus.aspectwerkz.definition;
008:
009:        import java.util.ArrayList;
010:        import java.util.Collection;
011:        import java.util.HashMap;
012:        import java.util.List;
013:        import java.util.Map;
014:
015:        import org.codehaus.aspectwerkz.reflect.ClassInfo;
016:        import org.codehaus.aspectwerkz.DeploymentModel;
017:        import org.codehaus.aspectwerkz.DeploymentModel;
018:        import org.codehaus.aspectwerkz.aspect.DefaultAspectContainerStrategy;
019:
020:        /**
021:         * Holds the meta-data for the aspect.
022:         *
023:         * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
024:         * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur </a>
025:         */
026:        public class AspectDefinition {
027:
028:            private final static String DEFAULT_ASPECTCONTAINER_CLASSNAME = DefaultAspectContainerStrategy.class
029:                    .getName();
030:
031:            /**
032:             * The default aspectwerkz aspect model type id.
033:             */
034:            public static final String ASPECTWERKZ_ASPECT_MODEL_TYPE = "aspectwerkz";
035:
036:            /**
037:             * The name of the aspect (nickname).
038:             */
039:            private String m_name;
040:
041:            /**
042:             * The nickname of the aspect prefixed by the <system uuid>/
043:             */
044:            private String m_qualifiedName;
045:
046:            /**
047:             * The aspect class info.
048:             */
049:            private final ClassInfo m_classInfo;
050:
051:            /**
052:             * The deployment model for the aspect.
053:             */
054:            private DeploymentModel m_deploymentModel = DeploymentModel.PER_JVM;
055:
056:            /**
057:             * The around advices.
058:             */
059:            private final List m_aroundAdviceDefinitions = new ArrayList();
060:
061:            /**
062:             * The before advices.
063:             */
064:            private final List m_beforeAdviceDefinitions = new ArrayList();
065:
066:            /**
067:             * The after advices.
068:             */
069:            private final List m_afterAdviceDefinitions = new ArrayList();
070:
071:            /**
072:             * The interface introductions (pure interfaces)
073:             */
074:            private final List m_interfaceIntroductionDefinitions = new ArrayList();
075:
076:            /**
077:             * The pointcuts.
078:             */
079:            private final List m_pointcutDefinitions = new ArrayList();
080:
081:            /**
082:             * The parameters passed to the aspect at definition time.
083:             */
084:            private Map m_parameters = new HashMap();
085:
086:            /**
087:             * The container implementation class name.
088:             */
089:            private String m_containerClassName;
090:
091:            /**
092:             * The system definition.
093:             */
094:            private SystemDefinition m_systemDefinition;
095:
096:            /**
097:             * The aspect model.
098:             */
099:            private String m_aspectModelType = ASPECTWERKZ_ASPECT_MODEL_TYPE;
100:
101:            /**
102:             * Creates a new aspect meta-data instance.
103:             *
104:             * @param name             the name of the aspect
105:             * @param classInfo        the class info for the aspect
106:             * @param systemDefinition
107:             */
108:            public AspectDefinition(final String name,
109:                    final ClassInfo classInfo,
110:                    final SystemDefinition systemDefinition) {
111:                if (name == null) {
112:                    throw new IllegalArgumentException(
113:                            "aspect name can not be null");
114:                }
115:                if (classInfo == null) {
116:                    throw new IllegalArgumentException(
117:                            "aspect class info can not be null");
118:                }
119:                m_name = name;
120:                m_classInfo = classInfo;
121:                m_systemDefinition = systemDefinition;
122:                m_qualifiedName = systemDefinition.getUuid() + '/' + name;
123:
124:                // default container
125:                setContainerClassName(DEFAULT_ASPECTCONTAINER_CLASSNAME);
126:            }
127:
128:            /**
129:             * Returns the name for the advice
130:             *
131:             * @return the name
132:             */
133:            public String getName() {
134:                return m_name;
135:            }
136:
137:            /**
138:             * Sets the name for the aspect.
139:             *
140:             * @param name the name
141:             */
142:            public void setName(final String name) {
143:                m_name = name.trim();
144:            }
145:
146:            /**
147:             * Returns the fully qualified name for the advice
148:             *
149:             * @return the fully qualified name
150:             */
151:            public String getQualifiedName() {
152:                return m_qualifiedName;
153:            }
154:
155:            /**
156:             * Returns the system definition.
157:             *
158:             * @return
159:             */
160:            public SystemDefinition getSystemDefinition() {
161:                return m_systemDefinition;
162:            }
163:
164:            /**
165:             * Returns the class name.
166:             *
167:             * @return the class name
168:             */
169:            public String getClassName() {
170:                return m_classInfo.getName();
171:            }
172:
173:            /**
174:             * Returns the class info.
175:             *
176:             * @return the class info
177:             */
178:            public ClassInfo getClassInfo() {
179:                return m_classInfo;
180:            }
181:
182:            /**
183:             * Returns the aspect model.
184:             *
185:             * @return the aspect model
186:             */
187:            public String getAspectModel() {
188:                return m_aspectModelType;
189:            }
190:
191:            /**
192:             * Checks if the aspect defined is an AspectWerkz aspect.
193:             *
194:             * @return
195:             */
196:            public boolean isAspectWerkzAspect() {
197:                return m_aspectModelType.equals(ASPECTWERKZ_ASPECT_MODEL_TYPE);
198:            }
199:
200:            /**
201:             * Sets the aspect model.
202:             *
203:             * @param aspectModelType the aspect model
204:             */
205:            public void setAspectModel(final String aspectModelType) {
206:                m_aspectModelType = aspectModelType;
207:            }
208:
209:            /**
210:             * Sets the deployment model.
211:             *
212:             * @param deploymentModel the deployment model
213:             */
214:            public void setDeploymentModel(final DeploymentModel deploymentModel) {
215:                m_deploymentModel = deploymentModel;
216:            }
217:
218:            /**
219:             * Returns the deployment model.
220:             *
221:             * @return the deployment model
222:             */
223:            public DeploymentModel getDeploymentModel() {
224:                return m_deploymentModel;
225:            }
226:
227:            /**
228:             * Adds a new around advice.
229:             *
230:             * @param adviceDef the around advice
231:             */
232:            public void addAroundAdviceDefinition(
233:                    final AdviceDefinition adviceDef) {
234:                if (!m_aroundAdviceDefinitions.contains(adviceDef)) {
235:                    m_aroundAdviceDefinitions.add(adviceDef);
236:                }
237:            }
238:
239:            /**
240:             * Returns the around advices.
241:             *
242:             * @return the around advices
243:             */
244:            public List getAroundAdviceDefinitions() {
245:                return m_aroundAdviceDefinitions;
246:            }
247:
248:            /**
249:             * Adds a new before advice.
250:             *
251:             * @param adviceDef the before advice
252:             */
253:            public void addBeforeAdviceDefinition(
254:                    final AdviceDefinition adviceDef) {
255:                if (!m_beforeAdviceDefinitions.contains(adviceDef)) {
256:                    m_beforeAdviceDefinitions.add(adviceDef);
257:                }
258:            }
259:
260:            /**
261:             * Returns the before advices.
262:             *
263:             * @return the before advices
264:             */
265:            public List getBeforeAdviceDefinitions() {
266:                return m_beforeAdviceDefinitions;
267:            }
268:
269:            /**
270:             * Adds a new after advice.
271:             *
272:             * @param adviceDef the after advice
273:             */
274:            public void addAfterAdviceDefinition(
275:                    final AdviceDefinition adviceDef) {
276:                if (!m_afterAdviceDefinitions.contains(adviceDef)) {
277:                    m_afterAdviceDefinitions.add(adviceDef);
278:                }
279:            }
280:
281:            /**
282:             * Returns the after advices.
283:             *
284:             * @return the after advices
285:             */
286:            public List getAfterAdviceDefinitions() {
287:                return m_afterAdviceDefinitions;
288:            }
289:
290:            /**
291:             * Adds a new pure interface introduction.
292:             *
293:             * @param interfaceIntroDef the introduction
294:             */
295:            public void addInterfaceIntroductionDefinition(
296:                    final InterfaceIntroductionDefinition interfaceIntroDef) {
297:                m_interfaceIntroductionDefinitions.add(interfaceIntroDef);
298:            }
299:
300:            /**
301:             * Returns the interface introductions.
302:             *
303:             * @return the introductions
304:             */
305:            public List getInterfaceIntroductionDefinitions() {
306:                return m_interfaceIntroductionDefinitions;
307:            }
308:
309:            /**
310:             * Adds a new pointcut definition.
311:             *
312:             * @param pointcutDef the pointcut definition
313:             */
314:            public void addPointcutDefinition(
315:                    final PointcutDefinition pointcutDef) {
316:                m_pointcutDefinitions.add(pointcutDef);
317:            }
318:
319:            /**
320:             * Returns the pointcuts.
321:             *
322:             * @return the pointcuts
323:             */
324:            public Collection getPointcutDefinitions() {
325:                return m_pointcutDefinitions;
326:            }
327:
328:            /**
329:             * Adds a new parameter to the advice.
330:             *
331:             * @param name  the name of the parameter
332:             * @param value the value for the parameter
333:             */
334:            public void addParameter(final String name, final String value) {
335:                m_parameters.put(name, value);
336:            }
337:
338:            /**
339:             * Returns the parameters as a Map.
340:             *
341:             * @return the parameters
342:             */
343:            public Map getParameters() {
344:                return m_parameters;
345:            }
346:
347:            /**
348:             * Sets the name of the container implementation class.
349:             *
350:             * @param containerClassName the container class name
351:             */
352:            public void setContainerClassName(final String containerClassName) {
353:                if (containerClassName != null) {
354:                    m_containerClassName = containerClassName.replace('/', '.');
355:                }
356:            }
357:
358:            /**
359:             * Returns the name of the container implementation class.
360:             *
361:             * @return the container class name
362:             */
363:            public String getContainerClassName() {
364:                return m_containerClassName;
365:            }
366:
367:            /**
368:             * Returns all the advices for this aspect.
369:             *
370:             * @return all the advices
371:             */
372:            public List getAdviceDefinitions() {
373:                final List allAdvices = new ArrayList();
374:                allAdvices.addAll(m_aroundAdviceDefinitions);
375:                allAdvices.addAll(m_beforeAdviceDefinitions);
376:                allAdvices.addAll(m_afterAdviceDefinitions);
377:                return allAdvices;
378:            }
379:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.