JavaSpace Name

Diana Huang <[email protected]>
Newsgroups gmane.comp.java.sun.javaspaces
Message-ID <[email protected]>
Hi all,

I start a JavaSpace. Its name is "MessageSpace". And I also have a http server, a lookup server running successfully. However, after I start a outrigger, I can't find the space with a name of "MessageSpace". The details of coding : 

1.Outrigger starting script is:
java -Djava.security.policy=config\start.policy ^
      -Djinihome=%JINI_HOME% ^
      -Dcom.sun.jini.outrigger.spaceName=MessageSpace ^
      -jar %JINI_HOME%\lib\start.jar ^
     config\start-outrigger.config

2. start-outrigger.conf is
import com.sun.jini.config.ConfigUtil;
import com.sun.jini.start.ServiceDescriptor;
import com.sun.jini.start.NonActivatableServiceDescriptor;
com.sun.jini.start {
    private static codebase = ConfigUtil.concat(new Object[] {
        "http://", 
        ConfigUtil.getHostName(), ":8088/outrigger-dl.jar"});
    private static policy = "config${/}policy.all";
    private static classpath = "${jinihome}${/}lib${/}outrigger.jar";
    private static config = "config${/}jrmp-outrigger.config";

    static serviceDescriptors = new ServiceDescriptor[] {
 new NonActivatableServiceDescriptor(
     codebase, policy, classpath,
     "com.sun.jini.outrigger.TransientOutriggerImpl",
     new String[] { config })
    };
}
3. jeri-outrigger.config is

com.sun.jini.outrigger {
    initiallookupGroups = new String[] { "jiniexample" };
      
}

4. find a JavaSpace

public class Search {
 public static void main (String[] args){
  ServiceDiscoveryManager sdm = null;
  Class serviceTypes[]={JavaSpace.class};
  Entry entries[]={new Name("MessageSpace")};
        ServiceTemplate tmpl = new ServiceTemplate(null,serviceTypes,entries);
        ServiceItem serviceItem = null;
        String groups[] = new String[1];

        groups[0] = new String(getLookupGroup());
        try{
         sdm = new ServiceDiscoveryManager(new LookupDiscovery(groups), null);
         System.out.println("start to find a service");
          try {
                    serviceItem = sdm.lookup(tmpl, null, 50000);
         } catch (InterruptedException intr) {
                    System.out.println("Interrupted...");
        }
        }catch(IOException ie){
          System.out.println("Exception in service discovery"+ie);
        }
        if(serviceItem!=null){
         System.out.println("get it");
  
        }else{
         System.out.println("can't find it");
        }
 }
 private static String getLookupGroup() {
        String group = System.getProperty("com.sun.jini.lookup.groups");
        if (group == null)
            return new String("");
        else
         System.out.println(group);
            return group;
    }

}

If ServiceTemplate is changed to ServiceTemplate tmpl = new ServiceTemplate(null,serviceTypes,null), I can find the JavaSpace. I want to find a JavaSpace whose name is "MessageSpace" instead of a general one, even I only start one JavaSpace here. Any idea?

Additionally, I use Browser service to monitor the services. After the reggie and the JavaSpace is started, I can see two services (ServiceRegistrar and JavaSpace). The JavaSpace service has two attributes (ServiceInfo and BasicServiceType). I found even I set spaceName in the outrigger starting script, the name in the ServiceInfo is still "JavaSpace". wondering how to overide JavaSpace Name?

I use JSDK1.4.2 and Jini2_0_002





Thanks

Diana Huang

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JAVASPACES-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

To view past JAVASPACES-USERS postings, please see:
http://archives.java.sun.com/archives/javaspaces-users.html

JDC members can download the JavaSpaces(tm) Technology from:
http://developer.java.sun.com/developer/products/jini/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.