From ocorpening at acornsys.com Wed Mar 16 12:08:42 2005 From: ocorpening at acornsys.com (Owen Corpening) Date: Thu Mar 23 12:03:23 2006 Subject: [Eos-discuss] Need a HelloWorld simple cookbook example Message-ID: <200503161710.j2GHA0IT023596@ares.cs.Virginia.EDU> Here is my AspectJ HelloWorld thing, I need the equivalent stripped to the barebones example in EOS, shouldn't be as difficult as a PHD dissertation, one would hope this represents less than an hour's work (much less actually), although it took me several days to come up with it for AspectJ, I bought a book, but also got it instrumenting already built jars, working within ant etc: The steps: C:\owen\HelloWorld>ajc com\howdy\*.java com\tracing\HelloAspect.aj C:\owen\HelloWorld>java com.howdy.HelloWorld 2005-03-15 10:54:58,084 [main] INFO trace - Entering [com.howdy.HelloWorld.main] 2005-03-15 10:54:58,124 [main] INFO trace - Entering [com.howdy.Object1.] The classes that were instrumented: Obect1.java: package com.howdy; public class Object1 { public Object1() { int i; } } HelloWorld.java: package com.howdy; public class HelloWorld { public static void main(String[] args) { Object1 fred = new Object1(); } } The aspect HelloAspect.aj: package com.tracing; import org.apache.log4j.*; import org.aspectj.lang.*; public aspect HelloAspect { Logger logger = Logger.getLogger("trace"); HelloAspect() { logger.setLevel(Level.ALL); } pointcut traceMethods():(execution(* *.*(..)) || execution(*.new(..))) && !within(HelloAspect); before():traceMethods() { if (logger.isEnabledFor(Level.INFO)) { Signature sig = thisJoinPointStaticPart.getSignature(); logger.log(Level.INFO, "Entering [" + sig.getDeclaringType().getName() + "." + sig.getName() + "]"); } } } Log4j.properties: log4j.rootLogger=DEBUG, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout # Print the date in ISO 8601 format log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n # Print only messages of level WARN or above in the package com.foo. log4j.logger.trace=INFO Here is the C# equivalent I am starting with and want to add logging to in similar fashion: File Hello.cs: using System; namespace HelloWorld { class Hello { static void Main(string[] args) { Object1 obj = new Object1(); System.Console.WriteLine("Hello"); } } } File Object1.cs: using System; namespace HelloWorld { public class Object1 { public Object1() { int i; } } } C:\owen\HelloWorld.net\HelloWorld>csc Hello.cs Object1.cs Microsoft (R) Visual C# .NET Compiler version 7.10.6001.4 for Microsoft (R) .NET Framework version 1.1.4322 Copyright (C) Microsoft Corporation 2001-2002. All rights reserved. Object1.cs(9,8): warning CS0168: The variable 'i' is declared but never used C:\owen\HelloWorld.net\HelloWorld>hello Hello C:\owen\HelloWorld.net\HelloWorld> Thanks, Thanks, Owen Corpening Acorn Systems -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.cs.Virginia.EDU/pipermail/eos-discuss/attachments/20050316/ec131fcf/attachment.htm From hr2j at cs.virginia.edu Wed Mar 16 15:23:37 2005 From: hr2j at cs.virginia.edu (Hridesh Rajan) Date: Thu Mar 23 12:03:23 2006 Subject: [Eos-discuss] Need a HelloWorld simple cookbook example In-Reply-To: <200503161710.j2GHA0IT023596@ares.cs.Virginia.EDU> Message-ID: <20050316202335.063DC201187E@guestrelay.stayonline.net> Hi Owen, I apologize for the delay, but we are attending AOSD 2005 as I speak. I am including the HelloWorld example below. You should try it with the Eos 0.3 Beta that is available from the Eos web-page. Rajan using System; namespace HelloWorld { public class Hello { static void Main(string[] arguments) { Object1 obj = new Object1(); System.Console.WriteLine("Hello"); } } public class Object1 { public Object1() { int i; } } } public aspect HelloAspect { // Logger declaration goes here HelloAspect() { // Constructor for the logger goes here } pointcut traceMethods():execution(any HelloWorld.any.any(..)) || initialization( HelloWorld.any.any(..)) && !within(HelloAspect); before():traceMethods() { // Your logging code goes here System.Console.WriteLine("Before hello"); } } From hr2j at cs.virginia.edu Wed Mar 16 16:09:29 2005 From: hr2j at cs.virginia.edu (Hridesh Rajan) Date: Thu Mar 23 12:03:23 2006 Subject: [Eos-discuss] Need a HelloWorld simple cookbook example In-Reply-To: <200503162056.j2GKuO6H012404@ares.cs.Virginia.EDU> Message-ID: <20050316210927.E9AB920118A0@guestrelay.stayonline.net> Owen, Thank you for your compliments. The objective of the Eos project is simplicity :) We however don't have a solid documentation yet, and we need to fix that problem. I am attaching the complete helloworld code that includes sample batch file to compile it. Please unzip it in the examples directory of Eos. It should work without any problems. For convenience, I have included both aspect and the class in one file, but you can write them separately. The required extension is cs, just like normal C# source files. Rajan > -----Original Message----- > From: Owen Corpening [mailto:ocorpening@acornsys.com] > Sent: Wednesday, March 16, 2005 2:55 PM > To: 'Hridesh Rajan' > Subject: RE: [Eos-discuss] Need a HelloWorld simple cookbook example > > Wow yours is the simplest I have seen! > > I asked the very same request of Aspect#, AspectDNG, > Loom.NET, Weave.NET, still intending to ask AspectC# if no > response is sufficient.... your response is the best by far > so far - most said "it's too easy, we don't have time to do > that"..... which is pretty strange. > > So a couple of details: is the below 2 files, HelloWorld.cs > and HelloAspect.aj? Or what file extension for the aspect, or > is it not a separate file? > > The aspect, when entered into VS shows red wavies everywhere, > what command compiles it? Give me the steps to take the two > files and run them, like: > > 1) csc *.cs *.aj > 2) HelloWorld > > Thanks, > > Owen Corpening > Acorn Systems > > -----Original Message----- > From: Hridesh Rajan [mailto:hr2j@cs.virginia.edu] > Sent: Wednesday, March 16, 2005 2:24 PM > To: 'Owen Corpening'; eos-discuss@cs.virginia.edu > Subject: RE: [Eos-discuss] Need a HelloWorld simple cookbook example > > Hi Owen, > > I apologize for the delay, but we are attending AOSD 2005 as > I speak. I am including the HelloWorld example below. You > should try it with the Eos 0.3 Beta that is available from > the Eos web-page. > > Rajan > > > using System; > > namespace HelloWorld > { > public class Hello > { > static void Main(string[] arguments) > { > Object1 obj = new Object1(); > System.Console.WriteLine("Hello"); > } > } > > public class Object1 > { > public Object1() > { > int i; > } > } > } > > public aspect HelloAspect > { > // Logger declaration goes here > > HelloAspect() > { > // Constructor for the logger goes here > } > > pointcut traceMethods():execution(any > HelloWorld.any.any(..)) > || initialization( HelloWorld.any.any(..)) > && !within(HelloAspect); > > > before():traceMethods() > { > // Your logging code goes here > System.Console.WriteLine("Before hello"); > } > } > > -------------- next part -------------- A non-text attachment was scrubbed... Name: HelloWorld.zip Type: application/x-zip-compressed Size: 747 bytes Desc: not available Url : http://www.cs.Virginia.EDU/pipermail/eos-discuss/attachments/20050316/2ea3b012/HelloWorld.bin From hr2j at cs.virginia.edu Tue Mar 22 14:35:00 2005 From: hr2j at cs.virginia.edu (Hridesh Rajan) Date: Thu Mar 23 12:03:23 2006 Subject: [Eos-discuss] Visual Studio .NET Add-In for Eos !!! Message-ID: <200503221935.j2MJZ4xR028051@ares.cs.Virginia.EDU> Hello Eos Users, I am glad to announce that Somkutas P?ter has just published the first stable version of his VS.NET Add-In for EOS. It is available for download from http://ect.jate.hu. I believe this plugin is a great attempt to enable tool support for Eos. I am sure Peter could use some feedback from the Eos community. I would like to personally thank Peter for taking the efforts to build this Add-In. Best, Rajan From hridesh at gmail.com Tue Mar 22 14:35:43 2005 From: hridesh at gmail.com (Hridesh Rajan) Date: Thu Mar 23 12:03:23 2006 Subject: [Eos-discuss] Visual Studio .NET Add-In for Eos !!! Message-ID: <4240738e.08081f46.19b0.1a14@mx.gmail.com> Hello Eos Users, I am glad to announce that Somkutas P?ter has just published the first stable version of his VS.NET Add-In for EOS. It is available for download from http://ect.jate.hu. I believe this plugin is a great attempt to enable tool support for Eos. I am sure Peter could use some feedback from the Eos community. I would like to personally thank Peter for taking the efforts to build this Add-In. Best, Rajan