Re: Problem with net.jxta.ext.config.Configurator

Marco Marconi <[email protected]> Mon, 29 Aug 2005 19:05:00 +0200
Newsgroups gmane.comp.java.jxta.user
Message-ID <[email protected]>
On Mon, 29 Aug 2005 07:51:41 -0700
James Todd <[email protected]> wrote:

> 
> hmmmmmmmmmm ...
> 

I've followed your steps, In my directory there is no .jxta, in the
configurator I've left only the method  createPlatformConfig, running
the peer appears no echoing(so, the method is not called), at the end I
find a .jxta only with the "cm" dir inside, without the "PlatformConfig"
file. If I insert the updatePlatformConfig method, this one is called
everytime, also when there is no .jxta dir(I think that in this case the
app should call createPlatformConfig instead no?). 
I guess there is some problem in my code, here is the configurator:

public class JxtaConfigurator extends AbstractConfigurator {
    
    public static String name = null;
    public static String cred = null;
    public static String pass = null;
        
    public PlatformConfig createPlatformConfig(Configurator configurator)
    throws ConfiguratorException {
        System.out.println("saving to: " + configurator.getJXTAHome());
        
        configurator.setName(name);
        configurator.setSecurity(cred, pass);

        return configurator.getPlatformConfig();
    }
    
    public PlatformConfig updatePlatformConfig(Configurator configurator)
    throws ConfiguratorException {
        System.out.println("update to: " + configurator.getJXTAHome());
        	
        return configurator.getPlatformConfig();
    }
    
    protected static void process() {
    
        AbstractConfigurator.register(JxtaConfigurator.class);
        
        try {
            PeerGroupFactory.newNetPeerGroup();
        } catch (Exception e) {
	  e.printStackTrace();
          System.exit(1);
        }
	
    }  
}


The Peer than configure the service by:

JxtaConfigurator.name = "Client";
JxtaConfigurator.cred = "password";
JxtaConfigurator.pass = "password";
JxtaConfigurator.process();

Is it all right?