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

James Todd <[email protected]> Mon, 29 Aug 2005 10:48:13 -0700
Newsgroups gmane.comp.java.jxta.user
Message-ID <[email protected]>
That is largely it. In fact, I like the JXTA Platform boot from w/in the 
AbstractConfigurator
Impl ... more on that in a bit but I firmly believe that this is a 
pattern worth pursuing.

What is the reported JXTA HOME?

Can you try running the ext:config examples:

  http://wiki.java.net/bin/view/Jxta/ExtConfig

  pull down Resources :: 2 ext-config.zip

  % unzip ext-config.zip

  % cd jxta
  # not required but i noticed the classes are in this distribution
  % ant clean
  # view targets
  % ant -projecthelp
  % ant abstractconfigurator

You should get something like the following:

  % ant abstractconfigurator
run:
     [echo] home: /home/gonzo/Desktop/jxta/build/abstractconfigurator
     [java] saving PlatformConfig to: 
file:/home/gonzo/Desktop/jxta/build/abstractconfigurator/home
     [java] update PlatformConfig to: 
file:/home/gonzo/Desktop/jxta/build/abstractconfigurator/home
     [java] Java Result: 130

and if you run it in succession:

  % ant abstractconfigurator
run:
     [echo] home: /home/gonzo/Desktop/jxta/build/abstractconfigurator
     [java] update PlatformConfig to: 
file:/home/gonzo/Desktop/jxta/build/abstractconfigurator/home/

I suspect you are persisting to a directory unbeknownst to you, perhaps 
~/.jxta.

Can you do a system search for PlatformConfig?

hth,

- james

--

James Todd :: blogs.sun.com/gonzo | weblogs.java.net/blog/gonzo

MyJXTA :: use it - learn it - do it

Java == platform independence
XML  == application independence
JXTA == network independence

Secure End-to-End Computing 


Marco Marconi wrote:

>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?
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [email protected]
>For additional commands, e-mail: [email protected]
>
>  
>