Das Online Slotgame Book of Ra ist ein einzigartiger Spielautomat! Wieso? Tja, nirgendwo sonst besitzt man die Möglichkeit seine Spielgewinne zu verdreifachen! Das über die Gewinnwalzen fliegende Obst Symbole sorgen jedoch nicht bloss für megasüße Augenblicke, sondern können dir mit etwas Glück auch noch richtig viel Twist Gewinne bringen. Novoline Book of Ra online spielen vereinigt voll brilliante Gewinnchancen mit einer sagenhaften Grafik, die aktueller eigentlich nicht sein könnte. Technisch gesehen ist dieses Spielhighlight ein absoluter Burner, Du wirst Novoline Book of Ra online wirklich mögen! Sogar in Sachen Spielspaß kommst du definitiv auf deine Kosten.

Tutorial

In order to install the new version of AWED you need to download the binary distribution from AWED's website. The file contains all the necessary libraries (.jar) to develop your own programs using AWED.

To learn how to create programs using AWED you will learn how to create, compile and run a simple project. Remember that the current implementation of AWED is a prototype and it is not a full compiler for the language. Instead, the current implementation extends JAsCo, a compiler that provides a framework with aspect oriented abstractions.

The following section will show you how to translate AWED programs into this abstractions.

Your first AWED project: a Messenger application

In order to create the environment to complete this tutorial you will need to download the file AWEDTutorialMessenger.zip from AWED's website. Then you have to unzip the file. The contents of this file will be expanded into a directory that contains four directories and a make file:

  • src: this folder holds the source files.
  • build: this folder contains the compiled files
  • libs: this folder contains the AWED binary libraries. You should copy the jar files from AWED distribution on this folder.
  • Makefile: This make file will help you to compile and run AWED's projects.

This project contains a basic messenger client written using AWED. Each instance of the application is a messenger client that can be connected to other messenger clients. The client reads input from the keyboard , and it listens to messages from remote clients. Remote messages are shown in the screen, just like a normal messenger client. The client accepts any message, however there is a special message that causes the local client to exit: ``Exit''.

The application consists of a shell and an aspect. The shell reads input form the keyboard and passes each read message to a dummy method. Note that this method does nothing, there is no code to make the client a distributed application. All the code that implements distribution has been written in the aspect. The aspect is shown in the figure 1. The figure shows an aspect that defines a pointcut to match method calls to the processMessage method on machines that are not the local host. Thus, each client will match method calls on remote hosts. Note that each running virtual machine will be considered a remote host, either if it is running in the same machine, or if it is running in a remote machine connected to the network. The advice is a simple advice that prints the parameter of the matched message into the screen.

aspect CacheReplication{
   pointcut replicationPcut(String s): 
	call(* awedtutorial.processMessage(String)) 
        && args(s) && !on(jphost)

   before(String s): resplicationPcut(s){
     System.out.println(s); }
}

Figure 1:Distribution Aspect for a basic chat application

The previous application written in AWED now needs to be translated into the prototype in order to have a running example. Remember that AWED is implemented on top of JAsCo, so you will need to use JAsCo syntax in order to implement your aspects. JAsCo introduces two main abstractions: the first one is an abstract hook, a hook has a pointcut definition and the advice definition; these hooks are defined inside aspect files, this aspect files have a class like syntax; the second abstraction are a connectors, each connector has a concrete instantiation of the abstract hook, thus relating the abstract methods of the aspect/hook definition to concrete methods in concrete classes. To implement the basic messenger example we will need three source files: a java file that implements the shell, an abstract aspect the uses remote pointcuts, and remote advice, and a connector that binds abstract remote pointcuts to actual method calls in the base application, i.e., in the java implementation of the shell.

Figure 2 shows the code of the abstract aspect included in the project downloaded from AWED's website. The file is commented so you can read it and understand each part of the implementation.

package awedtutorial;

//README: This file is an example of a simple abstract aspect using Jasco framework.
//It contains a hook definition. Remember that a hook definition
//contains a pointcut and an advice definition. 

class MessengerAsp {
	
	//This is the hook definition.
	hook MessengerHook {

// README: This is the abstract pointcut, you have many ways to refer to 
//		an abstract method:
//
//		- MessengerHook(method(..args1)): refers to a method with any number of arguments.
//		- MessengerHook(method(String s, Map m), method2(..args2)): refers to a method
//		  with a String and a Map arguments and a method2 with any number of arguments.
//		  The parameters of the first method will be bound to variables s and m so they can be used
//		  in the advice. Note that here you don't need to indicate the return type.
//
//		You can find more information in JAsCo web site.
//		http://ssel.vub.ac.be/jasco
		
		MessengerHook(method(..args1)) {
			
//	README: This is the actual pointcut definition. the "execution(method)" pointcut 
//			matches all the	executions to the method "method". Remember that AWED's "Host"
//			pointcut translates	to "joinpointhost" in JAsCo and AWED's "on" translates
//			to "executionhost". Here you will be presented with some valid pointcuts
//			definitions:
//			  a) execution(method) && joinpointhost(localhost)
//			  b) execution(method) && joinpointhost("192.34.56.67:5678")
//			  c) execution(method) && executionhost(joinpointhost)
//			  d) execution(method) && !joinpointhost(localhost)
//			
// 	In this aspect definition we use the "d" option. Here we are interested in the execution
//	of the method but only if the "joinpoint host" is NOT the LOCALHOST.

            execution(method) && !joinpointhost(localhost);
        }  
		
//	README: This is an actual advice definition, in this case a before advice definition, 
//		that simply prints on the screen the value of the first argument of the method call.
//		it shows how to use the "thisjoinpoint" variable. Remember that you can check 
//		the methods of "thisjoinpoint" by checking in the API documentation the class
//		"DistributedJascoMethod". You don't need to change any thing. Why?
		
		before(){
			System.out.println("MSJ: " + (String) thisJoinPoint.getArgumentsArray()[0]);
		}
	}
}

Figure 2: Aspect implementing distribution for a basic chat application</CAPTION>

Figure 3 shows the code of the abstract aspect included in the project downloaded from AWED's website.

static connector MessengerCon {

//README: This is an actual connector that basically instantiates a hook and bounds it
//	to an actual method in an actual class. Here is where the actual methods are referenced
//	and bound to abstract aspects, in this case the method "proccessMessage(String)" of
//	the class "awedtutorial.Messenger" with return type "void", is bound to method "method"
//	in the aspect.You can have multiple hook instantiations in one connector.
	
	awedtutorial.MessengerAsp.MessengerHook hook0 =
		  new awedtutorial.MessengerAsp.MessengerHook(void awedtutorial.Messenger.processMessage(String));

//	This is optional, it will help you to decide what advices to execute and the precedence of
//	advices.
	hook0.before();
}

Figure 3:Connector b that binds abstract pointcuts with actual code in the application shell

Running the example

This section shows how to compile and run AWED projects using the make file. Note that the only prerequisite that the make file has is that the directory structure is that defined in the previous section.

To compile the the project you will need to type:

	make

or

	make compile

This command will compile the java files, then it will compile the aspects, and finally it will compile the connectors.

To run the application you can type:

	make run FILETORUN=<package.mainFile> [USERLIBRARIES=<library list separated by colons>]

in this case:

	make run FILETORUN=awedtutorial.Messenger

This command will start the messenger application. To open another client just open a new terminal and type the command again, you can have several applications running on the same machine at the same time. Now you can start typing on each shell and you will see how they communicate with each other

tutorial/home.txt · Last modified: 2012/03/26 04:58 by wikihelp007
Recent changes RSS feed CC Attribution-Noncommercial-Share Alike 3.0 Unported Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki