Inline...

On 16 December 2011 13:48, Ashutosh Singh <[email protected]> wrote:
>
> I am sorry for the getting the numbers fumbled up.
>

That's okay, it just slows us down in helping you, ultimately we'll
get the right answer.

> I was talking about
>
> public JoinManager(Object serviceProxy,
>                   Entry[] attrSets,
>                   ServiceIDListener callback,
>                   DiscoveryManagement discoveryMgr,
>                   LeaseRenewalManager leaseMgr)
>            throws IOException
>
> For the config file I was talking about other constructors that contain last 
> argument as Configuration object.
> I am again sorry for not being precise.
>
>
> Now, as from the specs I think Entry[] attributes means the attributes that 
> are used to process, manage and identify a
> service as there can be many services and these attributes help us to match a 
> minimum of one services.
>
> I have created an Entry array using EmptyConfiguration from
> net.jini.config.EmptyConfiguration  as
>
> Entry[] myattrs = (Entry[]) 
> EmptyConfiguration.INSTANCE.getEntry("com.siolabs.jini.Server","sioLabs" , 
> Entry[].class);
>
> with the help from blog
> http://www.jroller.com/dancres/entry/how_to_write_a_jini
>

Oh, I wrote that one :)

>
> If something above is wrong please correct me .
>

Nothing wrong as such but you don't need to do this unless you want
to. It'd be perfectly fine to have:

Entry[] myattrs = new Entry[0];

Or indeed:

Entry[] myattrs = new Entry[] {new ServiceInfo("serviceName",
"manufacturer", "vendor", "1.0", "model", "serialNumber")};

The only difference is that you can configure exactly what attributes
you want. Most services end up allowing some configuration but also
assert some defaults in the code but when getting started, hard-coding
is fine. Configuration can wait...

> I have written  following steps.
>
> 1. Writing a Service Interface
> 2. Writing a Service Implementation Class
> 2.1 Used BasicJeriExporter
> 2.2 Created  Service Id
> 2.3 Created a proxy Object for Service
> 2.4 Finding reggie instances using LookupLocator
> 2.5 Getting a LookupDiscoveryManager
> 2.6 Got Entry[] using EmptyConfiguration
> 2.7 Create a JoinManagerInstance with the constructor I specified above
>
>
>
>
> I think that my service is completed now or Is there something left??

On first look I'd say you've got it all done but without a thorough
review of all your code I can't be certain. There's one thing I did
notice which I think might need tweaking which is your LookupLocator:

new LookupLocator("jini://localhost:8080")

The default for a lookup service would be port 4160 so unless you've
configured your lookup service to sit on 8080 you'd want to change
that locator to either of:

new LookupLocator("jini://localhost")

or:

new LookupLocator("jini://localhost:4160")

> Regards
> Ashutosh Singh
> .
>
>> Date: Fri, 16 Dec 2011 12:52:57 +0000
>> Subject: Re: what should be written in a config file for service application?
>> From: [email protected]
>> To: [email protected]
>>
>> Inline....
>>
>> On 16 December 2011 12:24, Ashutosh Singh <[email protected]> wrote:
>> >
>> > Hi,
>> >
>> > I am trying to do that. here is my code.
>> >
>> > ///////////////////////Service Class/////////////
>> >
>> > public class Server  implements Hello{
>> >
>> >    private  LookupDiscoveryManager ldm = null;
>> >
>> >
>> >    public Server() throws IOException{
>> >        init();
>> >    }
>> >
>> >
>> >    @Override
>> >    public String sayHello() {
>> >        // TODO Auto-generated method stub
>> >        return "Hello World";
>> >
>> >    }
>> >
>> >    public void init() throws IOException{
>> >        System.out.println("in server main");
>> >        Exporter myExporter = new 
>> > BasicJeriExporter(TcpServerEndpoint.getInstance(0), new BasicILFactory());
>> >
>> >        // Create a service id as required by the join Manager
>> >        Uuid myuuid = UuidFactory.generate();
>> >        ServiceID myService = new 
>> > ServiceID(myuuid.getMostSignificantBits(), 
>> > myuuid.getLeastSignificantBits());
>> >
>> >        //Create the object proxy for use by joiinmanager
>> >        Server myProxy = (Server) myExporter.export(this);
>> >
>> >        //find the reggie instances
>> >        LookupLocator[] myLocator = new LookupLocator[]{new 
>> > LookupLocator("jini://localhost:8080")};
>> >
>> >        ldm = new 
>> > LookupDiscoveryManager(DiscoveryGroupManagement.ALL_GROUPS, myLocator,null 
>> >  );
>> >
>> >        //Now join them
>> >    }
>> >
>> >    public static void main(String[] args) throws IOException {
>> >    }
>> >
>> > }
>> >
>> > /************** *****************/
>> >
>> > Now as the Join Manager takes 4 arguments and since I am not using a 
>> > config file .
>>
>> I'm a little confused as the API docs here: http://river.apache.org/doc/api/
>>
>> Show no constructor that takes only 4 arguments. Did you really mean
>> JoinManager?
>>
>> >  How can  I provide  entry attr sets . From the documentation I found that
>> >
>> > "attrSets - array of Entry consisting of the
>> >                     attribute sets with which to register the service"
>> >
>> > But with Entry Interface i don't know what to write.
>> > Please tell what will go in an entry?
>> >
>>
>> You would typically include the "standard" attributes such as:
>>
>> net.jini.lookup.entry.ServiceInfo
>>
>> More on that is here in the specifications:
>>
>> http://river.apache.org/doc/specs/html/schema-spec.html#31204
>>
>> > Also can I provide the config argument of JoinManager as null?
>>
>> Given the above re: constructors can you please point me at the
>> constructor you're using? JoinManager has at least one constructor:
>>
>> JoinManager(Object serviceProxy, Entry[] attrSets, ServiceID
>> serviceID, DiscoveryManagement discoveryMgr, LeaseRenewalManager
>> leaseMgr)
>>
>> That doesn't take a configuration file. Perhaps you meant
>> LookupDiscoveryManager? Again:
>>
>> LookupDiscoveryManager(String[] groups, LookupLocator[] locators,
>> DiscoveryListener listener)
>>
>> That has a constructor that doesn't require  a configuration file.
>>
>>
>> >
>> > Regards
>> > Ashutosh Singh
>> >
>> >
>> >> Date: Thu, 15 Dec 2011 13:00:22 +0000
>> >> Subject: Re: what should be written in a config file for service 
>> >> application?
>> >> From: [email protected]
>> >> To: [email protected]
>> >>
>> >> Okay so then you don't need to put anything in a configuration file.
>> >> You can hard-code the lot and then come back and do configuration
>> >> later as it makes sense.
>> >>
>> >> Probably the simplest you can go is to use lookuplocators to find the
>> >> lookup service and register/lookup.
>> >>
>> >> On 15 December 2011 12:54, Ashutosh Singh <[email protected]> wrote:
>> >> >
>> >> > The  hello example given contains a complicated server with all the 
>> >> > smart proxies and different methods of exporting.
>> >> >
>> >> > So I am just writing a very basic Hello World application that uses a 
>> >> > jeri protocol. No SDM's!.
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >> Date: Thu, 15 Dec 2011 12:47:58 +0000
>> >> >> Subject: Re: what should be written in a config file for service 
>> >> >> application?
>> >> >> From: [email protected]
>> >> >> To: [email protected]
>> >> >>
>> >> >> Are you configuring one of the standard services, one of your own or
>> >> >> one of the examples?
>> >> >>
>> >> >> On 15 December 2011 11:36, Ashutosh Singh <[email protected]> wrote:
>> >> >> >
>> >> >> > Hi,
>> >> >> >
>> >> >> > I am a novice RIVER user?
>> >> >> >
>> >> >> > Can you please tell me what should be written in a config file for a 
>> >> >> > service application?
>> >> >> >
>> >> >> > Regards
>> >> >> > Ashutosh Singh
>> >> >> >
>> >> >
>> >
>

Reply via email to