Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] adding a import statement into a JAR file.

Hi Russ, 
I think you have the correct understanding. I think I'm looking at this incorrectly. I am working from the architects requirements. I haven't fully come to terms with using AspectJ. The whole concept of AOP was new to me before I was introduced to it, when I took over from the previous person assigned to this research. The problem I have to solve or at least show it could be done is as shown. Any advice or inputs would be appricated.
Thank you
Trishan


//  <IMPORT>    
/*
* [1] the following dummy import statement is to be replaced by:
*    --> import com.sys.logging.*; 
*/
import java.lang.ref.*;
//  </IMPORT>

/**
 * 
 *
 * testbed for replacing and inserting code via aspects
 * ..to confirm expected results before applying the aspect to source targets
 */
public class AspectLoggerTestbed {
	

	

	public void someMethod() {

        //  <LOG_VARIABLE>    
	/*
	 *   [2] create a variable that holds a reference to the derived logger
	 *    --> Logger LOG = Loggers.assessLogger(this.class);
	 */
	 //  <LOG_VARIABLE>

		try {} catch (Exception e) {
			// <EXCEPTION> a block that contains an exception
			/* 
			 * [3] this syntax is used to log the stack trace
			 * --> LOG.debug("..exception caught", new Throwable());
			 */
			// </EXCEPTION>      
		}

	}

}





-----Original Message-----
From: Russell Miles [mailto:russellmiles@xxxxxxx]
Sent: Friday, November 14, 2003 9:57 AM
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] adding a import statement into a JAR file.



Hi Trishan,

I'm not sure I quite understand why you need to add an import? This is a pretty standard use of aspectJ in my experience and I've always done it by using around advice on the execution or call to the existing logging mechanisms (dependant on where I want to join, or where I am allowed to join for that matter due to licenses). This way the existing logging mechanism is still there but I have overriden it with the new mechanisms. But this approach doesn't lead me to needed to add import statements as the aspect itself then encapsulates the new logging logic, or in turn makes the onward call to the logging mechanism of choice.

Am I not understanding something on this ?

Cheers

Russ Miles



On Friday, November 14, 2003, at 03:49AM, Trishan de Lanerolle <tlanerolle@xxxxxxxxxxx> wrote:

>Why do you need it?
>We are looking into using AspectJ to replace a existing loging system (Log4J) with our custom built one, may be implimented using the around advice. (any "advice" you may have on doing this would be appriciated)We would identify the method calls and replace it with our own ones. We are using the JAR file as an experiement, we have the source files to play with as well. However when the program goes into 100-1000s files adding a single statement in becomes tedious to say the least. Its a task given by the architects to try out AspectJ in their projects.
>Thanks
>Trishan
>
>
>-----Original Message-----
>From: Wes Isberg [mailto:wes@xxxxxxxxxxxxxx]
>Sent: Thursday, November 13, 2003 11:42 PM
>To: aspectj-users@xxxxxxxxxxx
>Subject: Re: [aspectj-users] adding a import statement into a JAR file.
>
>
>AspectJ doesn't do that.  Why do you need it?
>
>Wes
>
>Trishan de Lanerolle wrote:
>>             
>> Questions
>> How can I add a new package import for specific java classes contained within a JAR file using aspectJ.
>> I think it has to be done with around advice. However I am not replacing anything just adding the line. I appologise in advance if the answer is obvious. I am new at this and I'm short for time and thought getting your input on this would help. 
>> Thank you
>> Trishan
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
>
>_______________________________________________
>aspectj-users mailing list
>aspectj-users@xxxxxxxxxxx
>http://dev.eclipse.org/mailman/listinfo/aspectj-users
>_______________________________________________
>aspectj-users mailing list
>aspectj-users@xxxxxxxxxxx
>http://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top