From einstein at mangala-server.com Wed May 14 02:22:03 2008 From: einstein at mangala-server.com (einstein at mangala-server.com) Date: 14 May 2008 02:22:03 +0100 Subject: [einstein-dev] Einstein Update: 14th May 2008 Message-ID: !Welcome to this week's Einstein newsletter!! {maketoc} !!Introduction Einstein is a 4GL for distributed enterprise environments. If you use an ESB you'll probably be interested in Einstein; Einstein however is far from an ESB! :: http://einstein.codecauldron.org :: Before I start, I need to apologize, the names of instructions in Einstein are currently in flux - as I prepare for the 0.1 release I'm trying to clean up and make sure the code reads correctly. By the time 0.1 is released all the documentation and code will hopefully be back in sync. It's been all go over the last couple of weeks, the code base has been cleaned up and improved, hopefully the instructions now have more intuitive names. Also we have a Team City continuous build server running now and improved documentation, all ramping up for the 0.1 uber-experimental release at the end of the month. !!This Weeks Example Following on from last weeks Esper example here is an example showing some more of Einstein's features: ~pp~ new EinsteinScriptRunner(einstein.asm :: { resource "std:>" stdin; resource "std:Sorry I don't recognize: " error; resource "stack:Passwords" passwords; resource "stack:History" history; poll stdin { write history; select [ news : { clear; { @@xml; read "camel:http://rss.news.yahoo.com/rss/topstories"; split "xpath://item/title/text()" { write "std:Headline: "; }; }; }, time : { read "time:HH:mm:ss.SSSZ" >> "std:The time is "; }, password : { read "std(mask=X):Enter your password: " >> passwords; }, history : { browse all history >> "std:"; }, default : { write error; read "text:" >> "std:You could try: news, time, password or history.."; } ]; }; }).call(); ~/pp~ It's a very simple example, but illustrates some basic Einstein features. It will prompt you to type a command. If you select __news__ you will get the latest news from Yahoo, if you select __time__, it will give you the current time, __password__ will demonstrate a masked read from standard input, __history__ will list all the commands you have typed anything else will give you an error message. In Einstein terms what is happening is that we're polling standard input for our payload, adding the payload to our history stack, then selecting a block to execute from a Map Execution Group (named tuples) based on the payload. The most interesting part of course is the news headlines, that cunning little piece of code clears the current message tuple (i.e. makes the current message tuple an empty message). It then switches to an XML data model, a message is read from the URL specified (using Camel) and then split by an XPath expression. The result is then written to standard output. This example is available in the examples directory of the Einstein pre-release and will be built upon before the 0.1 release. If you're feeling adventurous you can execute the __ec__ (Einstein compiler) command against __Console.dsl__ and then run the resultant class with __einstein Console__. Good luck if you try! !!Making life easier with metadata A new feature in Einstein is that all providers (plugins for resource types like esper, camel, std etc.) now must supply a set of comprehensive metadata. This is to make life easier for all users and to help try and bring the help information closer to the developer - to this end I have added a -P option to the compiler to provide help on a provider. So if you try __ec -P esper__ you will get: ~pp~ Provider 'esper' Description ----------- Supports the Esper CEP library, the standard pattern is to write to a resource and then add a listener to the resource with a text based query. Syntax ------ 'esper:' Example ------- resource "esper:" esper; listen esper "text:select avg(value) from org.cauldron.einstein.ri.examples.esper.TessaractWidget.win:time(30 sec)" { ( -> "xpath:/underlying" ) >> "std:Tesseract average value is: "; };execute "java:org.cauldron.einstein.ri.examples.esper.EventMaker" >> esper; Facades ------- These Facades will always be honored by the provider: org.cauldron.einstein.api.provider.facade.ReadFacade org.cauldron.einstein.api.provider.facade.WriteFacade org.cauldron.einstein.api.provider.facade.ListenFacade ~/pp~ It's likely that this type of metadata will also be required from the various models in the future. !!Changes on the website Well it's been all go this week, more and more preparations for the 0.1 release. An incredibly experimental/dodgy download of the 0.1 work in progress can be found [http://mangala-server.com:8111/repository/download/bt2/.lastFinished/einstein-0.1-SNAPSHOT-bin.zip|here] (sorry if you're behind a proxy). I wouldn't expect too much from it, but for those who are curious it is there. More usefully there is now a [http://einstein.codecauldron.org/tw/tiki-download_file.php?fileId=4|PDF copy] of the new [http://einstein.codecauldron.org/tw/tiki-download_file.php?fileId=3|Einstein presentation] (the one on the front page). The 'who the hell' guide to Einstein is also [http://einstein.codecauldron.org/tw/tiki-download_file.php?fileId=1|available to download]; it's very much a work in progress but gives a reasonable (if not entirely coherent) guide to the thought process behind Einstein and how some of how the basics work. The [http://jira.codecauldron.org/browse/EINSTEIN?report=com.atlassian.jira.plugin.system.project:roadmap-panel|roadmap] is now online, this is to give an idea of what is yet to go into the language and when approximately it can be expected. If you want to help meet that timeline or even possibly improve on it then ...... !!Get involved. Plenty of Einstein has already been sketched out but it's still very early days on the project, so if you are interested in Einstein and the way it works and would like to help turn it into the definitive means for building distributed systems ... then come and join us; join the list dev-subscribe at einstein.codecauldron.org and say hello. __Right now I'm looking for some partners in crime, if you're interested in programming languages, distributed systems or enterprise architecture feel free to drop me a line directly : neil.ellis at mangala.co.uk __. I regularly add new articles on the website, also check out the downloads page for the latest downloadable PDFs and presentations. !!A word from our sponsors ... Paremus have produced a fantastic distributed, SCA configured, OSGi platform which supports some great features such as autonomic self-healing, self-scaling, distributed registry and distributed messaging. The full product is commercial and is known as Infiniflow, please feel free to drop them a line at info at paremus.com. If you are more interested in the technical side of the product or just want to take a look at how it works then drop by http://newton.codecauldron.org . All the best until next time. Neil Ellis -- You can unsubscribe from this newsletter following this link: http://einstein.mangala-server.com/tw/tiki-newsletters.php?unsubscribe=087db851b4bc17d69e7a204f7129c225 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://einstein.codecauldron.org/pipermail/dev/attachments/20080514/0743d4d5/attachment.html From einstein at mangala-server.com Wed May 21 20:40:43 2008 From: einstein at mangala-server.com (einstein at mangala-server.com) Date: 21 May 2008 20:40:43 +0100 Subject: [einstein-dev] Einstein Update: 21st May 2008 Message-ID: !Welcome to this week's Einstein newsletter {maketoc} The end of month deadline for Release 0.1 (Uber-Experimental) approaches and the tidy up work continues; but I've still got time for some goodies in this weeks newsletter. We're going to take a look at: competing execution groups, the three ways to say nothing in Einstein, regular expressions, tuple positional references and getting help from the compiler. !!Competing Execution Groups The fourth type of execution group in Einstein is a little bit unusual compared to the others. The competing execution group uses the parenthesis syntax __(,,,)__ to denote a set of instructions that should be executed independently of each other but with no guarantees over order of execution or indeed even guarantees of execution. Why would you want to do that? Well the guarantee made is: if at least one is executed succesfully then a result will be provided. So your execution model can decide how to execute them and how to determine which result to return. The strategy used for execution is down to the execution model. For example you might decide there are 3 different ways to trigger a service the first is an entry into standard input, the second a message on a queue and the third from a remote web url. The instruction would probably look like: ~pp~ ( read from "std:>", read from "jms://queue", read from "http://myservice.org"); ~/pp~ So what happens here. Well the executor can choose whether to execute all these in parallel - it probably will - and then when one of the instructions returns a value that value will be used for the next instruction. Any failures will then be discarded unless all fail. Still trying to see how this would be useful? Consider that you have an application which is driven by price feeds, you can now request a price feed and whichever feed provider returns quickest that one is used. Alternatively you may wish to have live redundancy and specify that a message should be sent to three different servers for processing, only if you are unable to communicate with all three would a failure occur otherwise processing would continue. A feature not yet in Einstein is support for Competing Resource Groups, this will be in the 0.2 release. An example of Competing Resource Groups is: ~pp~ listen ("std:>", "jms://queue", "http://myservice.org") { } ~/pp~ Now in this example the first resource to provide a message will trigger the listen block, so it is an EITHER type expression, unlike a TupleResourceGroup which would be: ~pp~ listen ["std:>", "jms://queue", "http://myservice.org"] { } ~/pp~ This waits until a message has been received from ALL the resources and then provides the messages as a tuple to the supplied instruction group. !!Regular expressions. Initial regular expression support has been added to Einstein, there's still a long way to go but you immediately use them for conditionals (__while__, __if__), __split__ and __extract__. ~pp~ // -> is the same as the extract instruction. ( "regex:b[a-z]+"; ~/pp~ Will give you a new message with a textual content of "brown". ~pp~ // % is the same as the split instruction. ( ec --list-providers camel - Supports the providers supplied by the Camel ESB. stack - This is a named local in memory stack. xpath - Allows messages to be queried using XPath/JXPath. java - A Provider for java classes. bool - Support for boolean true and false. esper - Provies CEP functionality using the Esper libraries. text - Used to create textual messages. time - Time related functions, including listening and receiving. ~/pp~ Well there will be more soon :-), okay but at least we know which are available, so let's dig further and find out more about the __java__ provider: ~pp~ > ec --provider-help java Description ----------- A Provider for java classes. Syntax ------ 'java:' [ '?' ( '=' ) ] Example ------- execute "java:org.me.MyService?initialValue=10"; Facades ------- These Facades will always be honored by the provider: org.cauldron.einstein.api.provider.facade.ReadFacade org.cauldron.einstein.api.provider.facade.WriteFacade org.cauldron.einstein.api.provider.facade.ExecuteFacade This provider can support all Facades, but it depends on the URI. ~/pp~ Magic! !!!Step 3 Be happy that you now have documentation right next to you as you play with Einstein. Of course mileage may vary on a pre 0.1 release, but I think you get the idea. !!Get involved. Plenty of Einstein has already been sketched out but it's still very early days on the project, so if you are interested in Einstein and the way it works and would like to help turn it into the definitive means for building distributed systems ... then come and join us; join the list dev-subscribe at einstein.codecauldron.org and say hello. __Right now I'm looking for some partners in crime, if you're interested in programming languages, distributed systems or enterprise architecture feel free to drop me a line directly : neil.ellis at mangala.co.uk __. I regularly add new articles on the website, also check out the downloads page for the latest downloadable PDFs and presentations. !!A word from our sponsors ... Paremus have produced a fantastic distributed, SCA configured, OSGi based distributed application platform which supports some great features such as autonomic self-healing, self-scaling, distributed registry and distributed messaging. The full product is commercial and is known as Infiniflow, please feel free to drop them a line at info at paremus.com. If you are more interested in the technical side of the product or just want to take a look at how it works then drop by http://newton.codecauldron.org . All the best until next time. Neil Ellis project:Einstein -- You can unsubscribe from this newsletter following this link: http://einstein.mangala-server.com/tw/tiki-newsletters.php?unsubscribe=087db851b4bc17d69e7a204f7129c225 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://einstein.codecauldron.org/pipermail/dev/attachments/20080521/1d39e20c/attachment-0001.html From einstein at mangala-server.com Tue May 27 21:22:23 2008 From: einstein at mangala-server.com (einstein at mangala-server.com) Date: 27 May 2008 21:22:23 +0100 Subject: [einstein-dev] Einstein Update: 27th May 2008 Message-ID: !Welcome to this week's Einstein newsletter {maketoc} The end of month deadline for Release 0.1 (Uber-Experimental) is getting much closer, so a little bit of a shorter newsletter this week. Let's do one of those nice funky examples people always do with new programming languages. !!A Quick Chat? ~pp~ 1 resource "jgroups:chat" multicast; 2 resource "stack:name" name; 3 4 read "std:Your name:" >> name; 5 6 listen multicast { >> "std(format=printf):%s said '%s'%n" }; 7 poll "std:>" { [browse name, current] >> multicast }; 8 ~/pp~ So there we have in 5 lines, a lovely little chat program. It asks your name and then you chat away with your friends. How does it work, well firstly we declare two resources: ~pp~ 1 resource "jgroups:chat" multicast; 2 resource "stack:name" name; 3 ~/pp~ One is __multicast__ which we're going to use to chat with. The resource __multicast__ actually points to is a JGroups URI, but you could easily change this to something else later like a JMS topic. It's basically a resource which we can use for multicasting. Next we declare __name__ a stack to store the name on, Einstein is still pretty young and I'm quite lazy so I use the stack provider for any variables of any size. I will add it's logical partner __queue__ at somepoint, but hey, it's early days yet. ~pp~ 1 read "std:Your name:" >> name; ~/pp~ Okay so now it asks for the users name and puts the value into the name resource. ~pp~ 1 listen multicast { >> "std(format=printf):%s said '%s'%n" }; ~/pp~ Here we listen for any messages on __multicast__, as we will see in a second this actually means we're listening for two item tuples. So when we receive them we send them to standard output formatted using the printf style of formatting; this results in __Neil said 'hello'__ for example. ~pp~ 1 poll "std:>" { [browse name, current] >> multicast }; ~/pp~ Lastly we poll for input from standard input each line read (__current__) will be placed in a tuple with the name of the sender (__browse name__). This gets sent to __multicast__ and we're done. The result looks something like: ~pp~ ------------------------------------------------------- GMS: address is 192.168.1.67:52904 ------------------------------------------------------- Your name:Neil >Richard said 'Hello Neil.' Hello Richard >Neil said 'Hello Richard' ~/pp~ !!Get involved. Plenty of Einstein has already been sketched out but it's still very early days on the project, so if you are interested in Einstein and the way it works and would like to help turn it into the definitive means for building distributed systems ... then come and join us; join the list dev-subscribe at einstein.codecauldron.org and say hello. __Right now I'm looking for some partners in crime, if you're interested in programming languages, distributed systems or enterprise architecture feel free to drop me a line directly : neil.ellis at mangala.co.uk __. I regularly add new articles on the website, also check out the downloads page for the latest downloadable PDFs and presentations. !!A word from our sponsors ... Paremus have produced a fantastic distributed, SCA configured, OSGi based distributed application platform which supports some great features such as autonomic self-healing, self-scaling, distributed registry and distributed messaging. The full product is commercial and is known as Infiniflow, please feel free to drop them a line at info at paremus.com. If you are more interested in the technical side of the product or just want to take a look at how it works then drop by http://newton.codecauldron.org . All the best until next time. Neil Ellis project:Einstein -- You can unsubscribe from this newsletter following this link: http://einstein.mangala-server.com/tw/tiki-newsletters.php?unsubscribe=087db851b4bc17d69e7a204f7129c225 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://einstein.codecauldron.org/pipermail/dev/attachments/20080527/8c4b1d41/attachment.html