JShooter


#1

i used this jshooter code and i distribute my application with it.
i enjoyed this because i don’t need to transfer additional interfaces between the client and the server
but how this is possible, and i want to see why no need to use additional interfaces like RMI and JMS

file name: maplet.tld

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
  <tlibversion>1.0</tlibversion>
  <jspversion>1.1</jspversion>
  <shortname>maplet</shortname>
  <tag>
    <name>Service</name>
    <tagclass>org.j2os.shine.maplet.tag.Service</tagclass>
    <bodycontent>JSP</bodycontent>
    <attribute>
      <name>name</name>
    </attribute>
  </tag>
  <tag>
    <name>SecureService</name>
    <tagclass>org.j2os.shine.maplet.tag.SecureService</tagclass>
    <bodycontent>JSP</bodycontent>
    <attribute>
      <name>name</name>
    </attribute>
  </tag>
  <tag>
    <name>ErrorService</name>
    <tagclass>org.j2os.shine.maplet.tag.ErrorService</tagclass>
    <bodycontent>JSP</bodycontent>
  </tag>
</taglib>

==================================

server side code
file name : Server.java

package ServerSide;

public class Server 
{
//the definition of method lay here
  public void PrintName(String Name)
  {
      System.out.print("Dear user Your name is "+Name);
      System.out.print("<br>");
  }
  public int Plus(int val1,int val2)
  {
      int res = val1 + val2 ;
      System.out.print(val1+" + "+val2+" is equal "+res+"");
      System.out.print("<br>");
      return res;
  }
  private void private_Method()
  {
    System.out.print("Peivate Method is invoked");
    System.out.print("<br>");
  }
}

==================================

Client side code
file name : Client.java

package ClientSide;
import ServerSide.Server;
import org.j2sos.shine.jshooter.*;
import java.util.ArrayList;
public class Client 
{
//call the method from server side
//1- get method type
//2- invoke a method
//3- newInstat 
//4- get fild type
  public static void main(String arg[])throws Exception
  {
     ServerApplication Client_Obj = new Application().receive("Rokhsana","CommunityName");
     Client_Obj.newInstance("ServerSide.Server");
    ArrayList method_array = Client_Obj.getMethodsNames();
    int i = 0;
    while(method_array.size()!=i)
    {
      System.out.println(method_array.get(i));
      i ++;
    }
  }
}

==================================

engine code on the server
file name : Core.java

package Engin;
import org.j2sos.shine.jshooter.Application;

public class Core 
{
//distribute server class for client
  public static void main(String arg[])throws Exception
  {
    Application distrubuted_Obj = new Application();
    distrubuted_Obj.distribute(1099,"CommunityName");
    System.out.print("~~~~~~~~~~Core isrunning~~~~~~~~~~~~~~");
  }
}

==================================
jshooter sample.rar


#2

yes I test the JShooter sample and it is so interesting ,easy and powerful.
I think it use Reflection concept.Reflection is commonly used by programs which require the ability to examine or modify the runtime behavior of applications running in the Java virtual machine.Reflect has effect on performance and make application slower.you should be aware of using it in your application cause it allow you to access your code externally.