users@shoal.java.net

Re: [Shoal-Users] getMemberDetails: peers - how to get my and your GUID?

From: Bongjae Chang <carryel_at_korea.com>
Date: Wed, 17 Dec 2008 12:50:41 +0900

Hi Andrew.

I also agree Olaf Krische's words

Olaf Krische wrote:
"No need to know PeerID or GroupID. In fact, JXTA "is not required."


And I think that you maybe should generate own unique id anyway because of unique server token for joining the group.

Andrew wrote:
"I don't really want to have to generate my own guid as this is duplicated effort and superfluous"

Is it impossible that you try to use the server token as unique id instead of JXTA's PeerID?

If your application only uses own id or data for internal purpose, you can obtain other member' informations as the following test code.

[when the member joins the group]
-----
gms.join();
// add user's data
gms.updateMemberDetails( serverToken, "UUID", someUUID );
gms.updateMemberDetails( serverToken, "PUBLIC_KEY", somePublicKey );
-----

[when the member receives join notification]
-----
int count = 0;
Serializable uuid = null;
Serializable publicKey = null;
do {
    Map<Serializable, Serializable> details = notification.getMemberDetails();
    uuid = details.get( "UUID" );
    publicKey = details.get( "PUBLIC_KEY" );
    if( uuid != null && publicKey != null )
        break;
    // wait for dsc's synchronization
    count++;
    System.out.println( "Waiting for DSC first Sync. count = (" + count + "/" + DSC_SYNC_MAX_COUNT + ")" );
    try {
        Thread.sleep( DSC_SYNC_WAIT );
    } catch( InterruptedException ignore ) {
        // for testing
    }
} while( count <= DSC_SYNC_MAX_COUNT );
-----

I attached my sample code using join notification event.

I am worrying whether my understanding is right or not, but I hope this sample gives some help to you.

Thanks.

--
Bongjae Chang


  ----- Original Message -----
  From: Roo
  To: users_at_shoal.dev.java.net ; carryel_at_korea.com
  Sent: Wednesday, December 17, 2008 9:12 AM
  Subject: [Shoal-Users] getMemberDetails: peers - how to get my and your GUID?


Thanks Bongjae,Your answer triggered an understanding, and perhaps a thought I was going around this the wrong way.Am I right in thinking it appears the shoal implementation is deliberately (or maybe unknowingly) making it difficult to get the GUID for a peer?My use case is, I need to set up trust relationships with peers, and to do so, I need 2 things, I need a GUID and a Public Key interchange.I thought that when a peer joined the group, I could get it's GUID from the announcement and then, based on what I know about that peer, decide to open up data interchange, I would also be able to challenge it, or otherwise converse securely.Can you indicate how you think this is best achieved? I cannot even see a way to get the GUID for myself, let alone from a message. Yet the system out clearly shows the jxta GUID being sent. Do we simply not expose it through shoal?I don't really want to have to generate my own guid as this is duplicated effort and superfluous.Thanks,Andrew ----- Original Message -----
From: Bongjae Chang <carryel_at_korea.com>Date: Tue, 16 Dec 2008 16:44:07 +0900
Content-Type: multipart/alternative;
        boundary="----=_NextPart_000_146A_01C95F9D.836D91B0"
Subject: [Shoal-Users] getMemberDetails = no results

Hi Andrew.

I think you can test basic MemberDetails function from com.sun.enterprise.shoal.memberdetailstest.MemberDetailsTest class and see test source.

Of cource this test source doesn't base on JoinNotificationSignal. But I think internal conceptions of them are about the same.

If this test has no problem, I would like to know how you set member details from your sample code.

--
Bongjae Chang


  ----- Original Message -----
  From: Roo
  To: dev_at_shoal.dev.java.net ; users_at_shoal.dev.java.net
  Sent: Tuesday, December 16, 2008 2:15 PM
  Subject: [Shoal-Users] getMemberDetails = no results


  I am testing out shoal as a framework for an application and need to rely on the UUID for unique identity and to keep an internal record of trust levels for peers.


  I hoped I could get the UUID of peers as they joined the group in the signal instanceof JoinNotificationSignalImpl, via a call to Map details = signal.getMemberDetails().


  But when I log the size and also try and iterate through the values to find the UUID, I get an empty map.


              logger.debug(details.size() + " values in getMemberDetails");
              Iterator i = details.values().iterator();
              while (i.hasNext()) {
                  logger.debug(i.next());
              }


  Is the getMemberDetails not yet implemented?


  Thanks,
  Andrew