KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > aop > deployers > AbstractAspectManager


1 /*
2 * JBoss, Home of Professional Open Source.
3 * Copyright 2006, Red Hat Middleware LLC, and individual contributors
4 * as indicated by the @author tags. See the copyright.txt file in the
5 * distribution for a full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.aop.deployers;
23
24 import java.io.File JavaDoc;
25
26 import javax.management.JMException JavaDoc;
27 import javax.management.ListenerNotFoundException JavaDoc;
28 import javax.management.MBeanNotificationInfo JavaDoc;
29 import javax.management.MBeanServer JavaDoc;
30 import javax.management.Notification JavaDoc;
31 import javax.management.NotificationFilter JavaDoc;
32 import javax.management.NotificationListener JavaDoc;
33 import javax.management.ObjectName JavaDoc;
34
35 import org.jboss.aop.AspectManager;
36 import org.jboss.aop.deployment.AspectManagerService;
37 import org.jboss.aop.deployment.AspectManagerServiceJDK5;
38 import org.jboss.deployment.DeploymentInfo;
39 import org.jboss.logging.Logger;
40
41 /**
42  *
43  * @author <a HREF="kabir.khan@jboss.com">Kabir Khan</a>
44  * @version $Revision: 1.1 $
45  */

46 public abstract class AbstractAspectManager
47 {
48    final static String JavaDoc BASE_ASPECTS_XML = "base-aspects.xml";
49    AspectManagerService delegate = null; //Initialised by concrete sub-classes
50
MBeanServer JavaDoc server;
51    
52    public void setMbeanServer(MBeanServer JavaDoc server)
53    {
54       this.server = server;
55    }
56
57    public MBeanServer JavaDoc getMbeanServer()
58    {
59       return server;
60    }
61    
62    public AspectManager getAspectManager()
63    {
64       return AspectManager.getTopLevelAspectManager();
65    }
66    
67    /**
68     * @param listener
69     * @param filter
70     * @param handback
71     * @see org.jboss.mx.util.JBossNotificationBroadcasterSupport#addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
72     */

73    public void addNotificationListener(NotificationListener JavaDoc listener, NotificationFilter JavaDoc filter, Object JavaDoc handback)
74    {
75       delegate.addNotificationListener(listener, filter, handback);
76    }
77
78    /**
79     * @return
80     * @see org.jboss.aop.deployment.AspectManagerService#aspectDefinitions()
81     */

82    public String JavaDoc aspectDefinitions()
83    {
84       return delegate.aspectDefinitions();
85    }
86
87    /**
88     * @param classname
89     * @see org.jboss.aop.deployment.AspectManagerService#attachClass(java.lang.String)
90     */

91    public void attachClass(String JavaDoc classname)
92    {
93       delegate.attachClass(classname);
94    }
95
96    /**
97     * @return
98     * @see org.jboss.aop.deployment.AspectManagerService#bindings()
99     */

100    public String JavaDoc bindings()
101    {
102       return delegate.bindings();
103    }
104
105    /**
106     * @throws Exception
107     * @see org.jboss.system.ServiceMBeanSupport#create()
108     */

109    public void create() throws Exception JavaDoc
110    {
111       delegate.create();
112    }
113
114    /**
115     *
116     * @see org.jboss.system.ServiceMBeanSupport#destroy()
117     */

118    public void destroy()
119    {
120       delegate.destroy();
121    }
122
123    /**
124     * @param obj
125     * @return
126     * @see java.lang.Object#equals(java.lang.Object)
127     */

128    public boolean equals(Object JavaDoc obj)
129    {
130       return delegate.equals(obj);
131    }
132
133    /**
134     * @return
135     * @throws JMException
136     * @see org.jboss.system.ServiceMBeanSupport#getDeploymentInfo()
137     */

138    public DeploymentInfo getDeploymentInfo() throws JMException JavaDoc
139    {
140       return delegate.getDeploymentInfo();
141    }
142
143    /**
144     * @return
145     * @see org.jboss.aop.deployment.AspectManagerService#getEnableLoadtimeWeaving()
146     */

147    public boolean getEnableLoadtimeWeaving()
148    {
149       return delegate.getEnableLoadtimeWeaving();
150    }
151
152    /**
153     * @return
154     * @see org.jboss.aop.deployment.AspectManagerService#getEnableTransformer()
155     */

156    public boolean getEnableTransformer()
157    {
158       return delegate.getEnableTransformer();
159    }
160
161    /**
162     * @return
163     * @see org.jboss.aop.deployment.AspectManagerService#getExclude()
164     */

165    public String JavaDoc getExclude()
166    {
167       return delegate.getExclude();
168    }
169
170    /**
171     * @return
172     * @see org.jboss.aop.deployment.AspectManagerService#getIgnore()
173     */

174    public String JavaDoc getIgnore()
175    {
176       return delegate.getIgnore();
177    }
178
179    /**
180     * @return
181     * @see org.jboss.aop.deployment.AspectManagerService#getInclude()
182     */

183    public String JavaDoc getInclude()
184    {
185       return delegate.getInclude();
186    }
187
188    /**
189     * @return
190     * @see org.jboss.aop.deployment.AspectManagerService#getInstrumentor()
191     */

192    public String JavaDoc getInstrumentor()
193    {
194       return delegate.getInstrumentor();
195    }
196
197    /**
198     * @return
199     * @see org.jboss.system.ServiceMBeanSupport#getLog()
200     */

201    public Logger getLog()
202    {
203       return delegate.getLog();
204    }
205
206    /**
207     * @return
208     * @see org.jboss.system.ServiceMBeanSupport#getName()
209     */

210    public String JavaDoc getName()
211    {
212       return delegate.getName();
213    }
214
215    /**
216     * @return
217     * @see org.jboss.mx.util.JBossNotificationBroadcasterSupport#getNotificationInfo()
218     */

219    public MBeanNotificationInfo JavaDoc[] getNotificationInfo()
220    {
221       return delegate.getNotificationInfo();
222    }
223
224    /**
225     * @return
226     * @see org.jboss.aop.deployment.AspectManagerService#getOptimized()
227     */

228    public boolean getOptimized()
229    {
230       return delegate.getOptimized();
231    }
232
233    /**
234     * @return
235     * @see org.jboss.aop.deployment.AspectManagerService#getPrune()
236     */

237    public boolean getPrune()
238    {
239       return delegate.getPrune();
240    }
241
242    /**
243     * @return
244     * @see org.jboss.system.ServiceMBeanSupport#getServer()
245     */

246    public MBeanServer JavaDoc getServer()
247    {
248       return delegate.getServer();
249    }
250
251    /**
252     * @return
253     * @see org.jboss.system.ServiceMBeanSupport#getServiceName()
254     */

255    public ObjectName JavaDoc getServiceName()
256    {
257       return delegate.getServiceName();
258    }
259
260    /**
261     * @return
262     * @see org.jboss.system.ServiceMBeanSupport#getState()
263     */

264    public int getState()
265    {
266       return delegate.getState();
267    }
268
269    /**
270     * @return
271     * @see org.jboss.system.ServiceMBeanSupport#getStateString()
272     */

273    public String JavaDoc getStateString()
274    {
275       return delegate.getStateString();
276    }
277
278    /**
279     * @return
280     * @see org.jboss.aop.deployment.AspectManagerService#getSuppressReferenceErrors()
281     */

282    public boolean getSuppressReferenceErrors()
283    {
284       return delegate.getSuppressReferenceErrors();
285    }
286
287    /**
288     * @return
289     * @see org.jboss.aop.deployment.AspectManagerService#getSuppressTransformationErrors()
290     */

291    public boolean getSuppressTransformationErrors()
292    {
293       return delegate.getSuppressTransformationErrors();
294    }
295
296    /**
297     * @return
298     * @see org.jboss.aop.deployment.AspectManagerService#getTmpClassesDir()
299     */

300    public File JavaDoc getTmpClassesDir()
301    {
302       return delegate.getTmpClassesDir();
303    }
304
305    /**
306     * @return
307     * @see org.jboss.aop.deployment.AspectManagerService#getVerbose()
308     */

309    public boolean getVerbose()
310    {
311       return delegate.getVerbose();
312    }
313
314    /**
315     * @param listener
316     * @param notification
317     * @param handback
318     * @see org.jboss.mx.util.JBossNotificationBroadcasterSupport#handleNotification(javax.management.NotificationListener, javax.management.Notification, java.lang.Object)
319     */

320    public void handleNotification(NotificationListener JavaDoc listener, Notification JavaDoc notification, Object JavaDoc handback)
321    {
322       delegate.handleNotification(listener, notification, handback);
323    }
324
325    /**
326     * @return
327     * @see java.lang.Object#hashCode()
328     */

329    public int hashCode()
330    {
331       return delegate.hashCode();
332    }
333
334    /**
335     * @return
336     * @see org.jboss.aop.deployment.AspectManagerService#interceptorFactories()
337     */

338    public String JavaDoc interceptorFactories()
339    {
340       return delegate.interceptorFactories();
341    }
342
343    /**
344     * @return
345     * @see org.jboss.aop.deployment.AspectManagerService#introductions()
346     */

347    public String JavaDoc introductions()
348    {
349       return delegate.introductions();
350    }
351
352    /**
353     * @param method
354     * @throws Exception
355     * @see org.jboss.system.ServiceMBeanSupport#jbossInternalLifecycle(java.lang.String)
356     */

357    public void jbossInternalLifecycle(String JavaDoc method) throws Exception JavaDoc
358    {
359       delegate.jbossInternalLifecycle(method);
360    }
361
362    /**
363     * @return
364     * @see org.jboss.mx.util.JBossNotificationBroadcasterSupport#nextNotificationSequenceNumber()
365     */

366    public long nextNotificationSequenceNumber()
367    {
368       return delegate.nextNotificationSequenceNumber();
369    }
370
371    /**
372     *
373     * @see org.jboss.system.ServiceMBeanSupport#postDeregister()
374     */

375    public void postDeregister()
376    {
377       delegate.postDeregister();
378    }
379
380    /**
381     * @param registrationDone
382     * @see org.jboss.system.ServiceMBeanSupport#postRegister(java.lang.Boolean)
383     */

384    public void postRegister(Boolean JavaDoc registrationDone)
385    {
386       delegate.postRegister(registrationDone);
387    }
388
389    /**
390     * @throws Exception
391     * @see org.jboss.system.ServiceMBeanSupport#preDeregister()
392     */

393    public void preDeregister() throws Exception JavaDoc
394    {
395       delegate.preDeregister();
396    }
397
398    /**
399     * @param server
400     * @param name
401     * @return
402     * @throws Exception
403     * @see org.jboss.system.ServiceMBeanSupport#preRegister(javax.management.MBeanServer, javax.management.ObjectName)
404     */

405    public ObjectName JavaDoc preRegister(MBeanServer JavaDoc server, ObjectName JavaDoc name) throws Exception JavaDoc
406    {
407       return delegate.preRegister(server, name);
408    }
409
410    /**
411     * @return
412     * @see org.jboss.aop.deployment.AspectManagerService#registeredClassLoaders()
413     */

414    public String JavaDoc registeredClassLoaders()
415    {
416       return delegate.registeredClassLoaders();
417    }
418
419    /**
420     * @param listener
421     * @param filter
422     * @param handback
423     * @throws ListenerNotFoundException
424     * @see org.jboss.mx.util.JBossNotificationBroadcasterSupport#removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
425     */

426    public void removeNotificationListener(NotificationListener JavaDoc listener, NotificationFilter JavaDoc filter, Object JavaDoc handback) throws ListenerNotFoundException JavaDoc
427    {
428       delegate.removeNotificationListener(listener, filter, handback);
429    }
430
431    /**
432     * @param listener
433     * @throws ListenerNotFoundException
434     * @see org.jboss.mx.util.JBossNotificationBroadcasterSupport#removeNotificationListener(javax.management.NotificationListener)
435     */

436    public void removeNotificationListener(NotificationListener JavaDoc listener) throws ListenerNotFoundException JavaDoc
437    {
438       delegate.removeNotificationListener(listener);
439    }
440
441    /**
442     * @param notification
443     * @see org.jboss.mx.util.JBossNotificationBroadcasterSupport#sendNotification(javax.management.Notification)
444     */

445    public void sendNotification(Notification JavaDoc notification)
446    {
447       delegate.sendNotification(notification);
448    }
449
450    /**
451     * @param enableTransformer
452     * @see org.jboss.aop.deployment.AspectManagerService#setEnableLoadtimeWeaving(boolean)
453     */

454    public void setEnableLoadtimeWeaving(boolean enableTransformer)
455    {
456       delegate.setEnableLoadtimeWeaving(enableTransformer);
457    }
458
459    /**
460     * @param enableTransformer
461     * @see org.jboss.aop.deployment.AspectManagerService#setEnableTransformer(boolean)
462     */

463    public void setEnableTransformer(boolean enableTransformer)
464    {
465       delegate.setEnableTransformer(enableTransformer);
466    }
467
468    /**
469     * @param exclude
470     * @see org.jboss.aop.deployment.AspectManagerService#setExclude(java.lang.String)
471     */

472    public void setExclude(String JavaDoc exclude)
473    {
474       delegate.setExclude(exclude);
475    }
476
477    /**
478     * @param ignore
479     * @see org.jboss.aop.deployment.AspectManagerService#setIgnore(java.lang.String)
480     */

481    public void setIgnore(String JavaDoc ignore)
482    {
483       delegate.setIgnore(ignore);
484    }
485
486    /**
487     * @param include
488     * @see org.jboss.aop.deployment.AspectManagerService#setInclude(java.lang.String)
489     */

490    public void setInclude(String JavaDoc include)
491    {
492       delegate.setInclude(include);
493    }
494
495    /**
496     * @param instrumentor
497     * @see org.jboss.aop.deployment.AspectManagerService#setInstrumentor(java.lang.String)
498     */

499    public void setInstrumentor(String JavaDoc instrumentor)
500    {
501       delegate.setInstrumentor(instrumentor);
502    }
503
504    /**
505     * @param verbose
506     * @see org.jboss.aop.deployment.AspectManagerService#setOptimized(boolean)
507     */

508    public void setOptimized(boolean verbose)
509    {
510       delegate.setOptimized(verbose);
511    }
512
513    /**
514     * @param prune
515     * @see org.jboss.aop.deployment.AspectManagerService#setPrune(boolean)
516     */

517    public void setPrune(boolean prune)
518    {
519       delegate.setPrune(prune);
520    }
521
522    /**
523     * @param suppressReferenceErrors
524     * @see org.jboss.aop.deployment.AspectManagerService#setSuppressReferenceErrors(boolean)
525     */

526    public void setSuppressReferenceErrors(boolean suppressReferenceErrors)
527    {
528       delegate.setSuppressReferenceErrors(suppressReferenceErrors);
529    }
530
531    /**
532     * @param suppressTransformationErrors
533     * @see org.jboss.aop.deployment.AspectManagerService#setSuppressTransformationErrors(boolean)
534     */

535    public void setSuppressTransformationErrors(boolean suppressTransformationErrors)
536    {
537       delegate.setSuppressTransformationErrors(suppressTransformationErrors);
538    }
539
540    /**
541     * @param tmpClassesDir
542     * @see org.jboss.aop.deployment.AspectManagerService#setTmpClassesDir(java.io.File)
543     */

544    public void setTmpClassesDir(File JavaDoc tmpClassesDir)
545    {
546       delegate.setTmpClassesDir(tmpClassesDir);
547    }
548
549    /**
550     * @param verbose
551     * @see org.jboss.aop.deployment.AspectManagerService#setVerbose(boolean)
552     */

553    public void setVerbose(boolean verbose)
554    {
555       delegate.setVerbose(verbose);
556    }
557
558    /**
559     * @return
560     * @see org.jboss.aop.deployment.AspectManagerService#stacks()
561     */

562    public String JavaDoc stacks()
563    {
564       return delegate.stacks();
565    }
566
567    /**
568     * @throws Exception
569     * @see org.jboss.system.ServiceMBeanSupport#start()
570     */

571    public void start() throws Exception JavaDoc
572    {
573       try
574       {
575          server.registerMBean(delegate, new ObjectName JavaDoc("jboss.aop:service=AspectManager"));
576       }
577       catch (Exception JavaDoc e)
578       {
579          throw new RuntimeException JavaDoc("Problem registering jboss.aop:service=AspectManager with JMXServer", e);
580       }
581       delegate.start();
582    }
583
584    /**
585     *
586     * @see org.jboss.system.ServiceMBeanSupport#stop()
587     */

588    public void stop()
589    {
590       if (this.server == null)
591       {
592          try
593          {
594             server.unregisterMBean(new ObjectName JavaDoc("jboss.aop:service=AspectManager"));
595          }
596          catch (Exception JavaDoc e)
597          {
598             // AutoGenerated
599
throw new RuntimeException JavaDoc("Problem unregistering jboss.aop:service=AspectManager with JMXServer", e);
600          }
601       }
602       delegate.stop();
603    }
604
605    /**
606     * @return
607     * @see java.lang.Object#toString()
608     */

609    public String JavaDoc toString()
610    {
611       return delegate.toString();
612    }
613    
614    
615 }
616
Popular Tags