I'm sorry... just an italian how-to... :(
Maybe u can recognise the code part... :)
I hope this can help u...
Gio
In JBoss 3.2.x si possono mettere degli interceptor che intercettano la chiamata ai metodi degli EJB.
Per ottenere questo:
- Creare
una classe di interceptor:
import org.jboss.ejb.plugins.AbstractInterceptor;
import org.jboss.invocation.Invocation;
public class MyInterceptor extends AbstractInterceptor {
public Object invoke(Invocation arg0) throws Exception {
Object lRet;
Codice da eseguire prima della chiamata al metodo
lRet=getNext().invoke(arg0);
Codice da eseguire dopo la chiamata al metodo
return lRet;
}
} - Aprire conf/standarsjboss.xml e cercare la configurazione dell’EJB che si vuole intercettare, ad esempio “Standard Stateful SessionBean” oppure “Standard Stateless SessionBean” e copiare la sezione “container-interceptor”.
- Editare
jboss.xml dell’applicazione ed aggiungere prima di “</jboss>”
le linee:
1 <container-configurations>
2 <container-configuration extends="Standard Stateful SessionBean">
3 <container-name>MyConfig</container-name>
4 <container-interceptors>
5 <interceptor>it.package.MyInterceptor</interceptor>
6 Elenco copiato al punto 2
7 </container-interceptors>
8 </container-configuration>
9 </container-configurations>
Alla riga 2 mettere il nome della configurazione che si vuole estendere ossia il tipo di EJB a cui si vuole assegnare l’interceptor, alla riga 3 mettere il nome della nuova configurazione, alla riga 5 mettere il proprio interceptor (così facendo sarà il primo eseguito), alla riga 6 mettere l’elenco degli interceptor standard presenti in conf/standardjboss.xml. - Aggiungere
in jboss.xml, nella descrizione del bean relativo, la linea:
<configuration-name>MyConfig</configuration-name>
dove MyConfig è il nome dato alla configurazione.
Con i passi 3 e 4 si riportano gli interceptor di default sul nuovo bean aggiungendo il nuovo interceptor.
> -----Messaggio originale-----
> Da:
[EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]Per
conto di Heinz-Dieter
> Conradi
> Inviato: venerdi 20 febbraio 2004
14.34
> A: [EMAIL PROTECTED]
> Oggetto: Re:
[JBoss-user] JBoss3.2.3 - AOP or javassist
>
>
>
> >
> i would like to perform some general operations for most of the
calls
> > > coming to my facade session beans. instead of coding
this for
> > > every method
> > > in every facade, i
would like to use aop like techniques.
> > >
> > > as
far as i know, one cannot use JBossAOP with JBoss-3.2.3 (i guess
> >
> because of Classloader problems). is this true?
>
> > U
can't use AOP with 3.2.3 but u can use Interceptors. With AOP u can
> >
perform a complite aspect oriented programmation, with Jboss3.2.3
> >
Intercetor u can intercept calls only to ur ejbs' methods. I think this
>
> is enough for you...
>
> i guess you are right. do you have a
simple example of how to create and
> use such an
interceptor?
>
> thanks,
heinz-dieter
>
>
>
>
-------------------------------------------------------
> SF.Net is
sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps
& Web services for Linux with
> a free DVD software kit from IBM.
Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
>
_______________________________________________
> JBoss-user mailing
list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user