Attributes - Java Attributes (set/get/is)

Description:

JavaBeans are using a design pattern for simple write-read attributes or simple read-only attributes. These attributes are mapped to .NET properties.
This example uses a Java class that offers some attributes. The access to these Java attributes is achieved by implementing standard .NET properties.

Source:

\DemoJava\Attributes

Mapping:

get/set/is <---> .NET Attributes


Example

Step 1. Write the Java server:

  public interface Greetings extends Remote  
  {
    void setFirstName( String name) throws RemoteException;  
    String getFirstName() throws RemoteException;
    void setBar( boolean oBar) throws RemoteException;
    boolean isBar() throws RemoteException;
    boolean getBar() throws RemoteException;
  }	

Step 2. Write the .NET client:

Get access to the server object through .NET attributes:

   oGreetings.bar = false;
   System.Console.WriteLine("Bar: {0}", oGreetings.bar);
   System.Console.WriteLine("getBar: {0}", oGreetings.getBar());  

Step 3. Run the example

a.) Start the sun name service on port 10050:

    > start orbd -ORBInitialPort 10050  

(could also use startNameService.bat located in the DemoJava directory to quick start the name service)

b.) Start the java server by using JNDI CosNaming and work with a name service running on 'localhost' at port '10050':

    > start java -cp .;Server.jar -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory -Djava.naming.provider.url=iiop://localhost:10050 Server  

(could also use buildServer.bat and startServer.bat located in the JavaServer directory to quick build and run the Java Server)

c.) Start the .NET Client.

Remarks: