[osflash] Aspect Oriented Programming

lieven.cardoen@pointx.be lieven.cardoen at pointx.be
Tue Nov 29 03:46:58 EST 2005


Hi Simon, I'm trying to figure out this part of As2lib. It looks great,
but I don't have the time to look how it exactly works. This is what I
have so far : 

 

private static function
initLogMethodExecutionsAspect(weaver:SimpleWeaver):Void {

                                    var
logMethodExecutionsAspect:LogMethodExecutionsAspect = new
LogMethodExecutionsAspect();

 
//weaver.addAspect(logMethodExecutionsAspect,
_global.be.idiomatic.framework.content);

 
weaver.addAspect(logMethodExecutionsAspect,
_global.be.idiomatic.module);

 
weaver.addAspect(logMethodExecutionsAspect, _global.org.as2lib.env.log);

                        }

            

            

            

 
//==================================================================

            //          PUBLIC METHODS

 
//==================================================================

                        public static function
init(target:MovieClip):Void{

                                    // use two separated try-catch
blocks because the application may run even if the weaving process
failed

                                    try {

                                                var weaver:SimpleWeaver
= new SimpleWeaver();

 
initLogMethodExecutionsAspect(weaver);

                                                weaver.weave();

                                    } catch
(exception:org.as2lib.env.except.Throwable) {

                                                // send email to
application programmer

                                                if
(logger.isErrorEnabled()) {

 
logger.error("Weaving failed with exception:\n" +
StringUtil.addSpaceIndent(exception.toString(), 2));

                                                }

                                    }

                                    

                                    target.attachMovie("Application",
"application", 1);

                        }

 

 

My question is how does the  LogMethodExecutionsAspect class look like.
I haven't begun programming this class. All it should do is send a
message at the beginning of a method and at the end saying which class
and method the program is in. Do you have an example of such an Aspect?

 

Thx, greetz

 

Vriendelijke groeten,

Lieven Cardoen

PointX Multimedia

Engelse Wandeling 2 K18

8500 Kortrijk

Tel. 056 361197

Fax 056 35 26 48

www.pointx.be <http://www.pointx.be/> 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/osflash_osflash.org/attachments/20051129/2e2554e9/attachment-0001.htm


More information about the osflash mailing list