Cheers
Monday, November 19, 2007
IBM WAS Education Assistant
Cheers
Tuesday, November 13, 2007
Java Rules Engines | Words and Phrases
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
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