Monday, November 19, 2007

IBM WAS Education Assistant

In this post I'd like to reference a very important Web-Site if you are interested in IBM's WebSpere Application Server. This site is called the IBM Education Assistant where you can find a lot of good ressources about the Application Server in a variety of versions (5, 6, + fixpackages, ...).

In addition you'll find a lot of good screencasts and slides which gives you a pretty good overview about this product. A few posts ago I showed off a little by posting about my IBM Certificate for the IBM WAS 6.1 and if you are interested in what I've learned in that IBM training, go to the Education Assistant and watch all the screencasts which you can find under 'WebSphere Application Server 6 / V6.1'



Cheers

Tuesday, November 13, 2007

Java Rules Engines | Words and Phrases

This Posting is about the book which I'm currently reading. (Java Rules Engines) The Post summarizes some words or phrases which were new to me and I'd like to remember them. Because I even didn't know those in german I'm going to sum them up in german.

Kapitel 1 Buch Seite 15: virale Ansätze.
Ein Viral ist ein Werbespot, der eigens für das Internet produziert wird. Sein Name leitet sich ab von der Werbeform, innerhalb derer er konzipiert und eingesetzt wird, dem viralen Marketing

Kapitel 1 Buch Seite 15: kognitive Fähigkeiten:
Der Begriff kognitiv stammt aus der Psychologie und bezeichnet solche Funktionen des Menschen, die mit Wahrnehmung, Lernen, Erinnern und Denken, also der menschlichen Erkenntnis- und Informationsverarbeitung in Zusammenhang stehen.

Kapitel 1 Buch Seite 20: Konsekutivsätze:

Das Adjektiv konsekutiv bedeutet soviel wie zeitlich folgend, von einer vorherigen Gegebenheit abhängig.

Kapitel 1 Buch Seite 23: Omnipotente Schnittstelle:

Mit Allmacht, Allmächtigkeit oder Omnipotenz wird die Fähigkeit eines Wesens bezeichnet, jedes Ereignis auch jenseits naturwissenschaftlicher Erklärbarkeit in Gang zu setzen oder zu beeinflussen.

Kapitel 1 Buch Seite 25: Profan:

Es bezeichnet im eigentlichen Sinne die Eigenschaft von Objekten oder Handlungen, die nicht im Zusammenhang mit einem Kult stehen, die keine rituelle oder religiöse Bedeutung tragen und denen keine magischen Eigenschaften und Wirkungen zugesprochen werden.

To be continued...

Monday, November 12, 2007

RMI with NetBeans 6 Beta 2

Please don't let mislead you because of this post's title. NetBeans doesn't have any special features for RMI support. I've only chosen this title because I'm going to develop my RMI-Service in NetBeans 6 Beta 2 which is my favourite IDE.

I won't explain every detail of RMI because you will find a lot of good tutorials on the web anyway. So, the first step is to open your IDE and develop the Interface for your RemoteService:



Second step: Write your service implementation class.





package at.ac.tuwien.ds.lab2.rmi.server;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

/**
* Implementation of ICustomRemot Interface.
* @author Claus Polanka
*/
public class CustomRemoteImpl extends UnicastRemoteObject implements ICustomRemote {

/**
* Necessary because Super-Class constructor throws RemoteException.
* @throws java.rmi.RemoteException Will be thrown if there are some network
* errors.
*/
public CustomRemoteImpl() throws RemoteException {
}

/**
* Returns a string which say 'Hello World with NetBeans 6 Beta2 and RMI.'
* @return the string which holds the value.
* @throws java.rmi.RemoteException Will be thrown if there are some network
* problems.
*/
public String sayHello() throws RemoteException {
return "Hello World in NetBeans 6 Beta 2 with RMI.";
}
}


Next step ist to implement a class who starts your remote service:





package at.ac.tuwien.ds.lab2.rmi.server;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
* Starts the CustomRemote Service.
* @author Claus Polanka
*/
public class StartRemoteService {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try {
ICustomRemote service = new CustomRemoteImpl();
Naming.rebind("HelloWorldService", service);
} catch (RemoteException ex) {
Logger.getLogger(StartRemoteService.class.getName())
.log(Level.SEVERE, null, ex);
} catch (MalformedURLException ex) {
Logger.getLogger(StartRemoteService.class.getName())
.log(Level.SEVERE, null, ex);
}
}

}


Now, after you have finished the serverside of your RMI application, it's time to develop the client who calls the service.





package at.ac.tuwien.ds.lab2.rmi.client;

import at.ac.tuwien.ds.lab2.rmi.server.ICustomRemote;
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
* Calls my RemoteService.
* @author Claus Polanka
*/
public class Client {

/**
* Makes a lookup and gets the String of the RemoteServcie.
*/
public void run() {
try {
ICustomRemote remoteService = (ICustomRemote)
Naming.lookup("rmi://127.0.0.1/HelloWorldService");

// Calls remote method.
String remoteString = remoteService.sayHello();

System.out.println(remoteString);

} catch (NotBoundException ex) {
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
} catch (MalformedURLException ex) {
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
} catch (RemoteException ex) {
Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
}
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Client client = new Client();
client.run();
}
}



Now, compile everything and you should see something like the following output:





So, if you have the same environment as I have (only one machine ;-) you don't have to copy anything to another location. Just generate the Service Stub-Class, start the rmiregistry and start your service. Then your client should be able to execute the Service and print out it's result which is in my case a simple string.

Generate Stub-Class:




Now, you should be able to see a new generated class in corresponding package where you have generated the Stub.



Start the RMI-Registry to register the Service.



Start your service and bind it to your registry.



Let's run the Client.



And see the result.



Hope you liked it.

Cheers