Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

## Package com.compoze.collab.sametime

This packages provides classes for the Collaboration Sametime provider.

See:
Description

Interface Summary
ISametimeFriend | Interface provides Sametime specific extension to `IFriend`.

Class Summary
SametimeFriendStatus | The element class for the `SametimeFriendStatusEnum` enumeration.
SametimeFriendStatusEnum | The enumeration class that contains `SametimeFriendStatus` elements.

## Package com.compoze.collab.sametime Description

This packages provides classes for the Collaboration Sametime provider. This provider allow you to connect and communicate with Lotus Sametime server. Sametime provider is one of many instant messaging providers supplied with this API.
This document only describes the differences of this provider versus other IM providers. Please refer to com.compoze.collab.im for general overview of IM architecture of this API.

Interaction with the Sametime provider is done in almost exactly the same way as with any other provider in Compoze Collaboration Services IM API. Client code must first create a session and login. Once logged in, client code may:

- send and receive instant messages,
- receive and handle status change notifications,
- send and receive typing notifications and
- manage friends list.
  Please refer to com.compoze.collab.im for more detailed description of these operations.

  Opening a session
  Sametime provider requires several provider-specific properties. Please refer to the table below for detailed description of all Sametime-specific properties.

  Property | Required | Additional Information
  `PROP_PROVIDER` | Yes | Must be a string "sametime"
  `PROP_IM_USERNAME` | Yes | Short name of the Lotus Notes user trying to log in
  `PROP_IM_PASSWORD` | Yes | Lotus Notes password of the user trying to log in
  `PROP_IM_SERVER` | Yes | IP address or network name of the Sametime server
  `PROP_IM_PORT` | No | Sametime port. Defaults to 1533

  Here is an example of opening a session to a Sametime server residing at IP address 123.123.123.123, with Sametime port set to 1533.

          HashMap props = new HashMap ();

          props.put (ISession.PROP_PROVIDER, "sametime");

          props.put(IImSession.PROP_IM_USERNAME, "myusername");
          props.put(IImSession.PROP_IM_PASSWORD, "mypassword");
          props.put(IImSession.PROP_IM_SERVER, "123.123.123.123");
          // this property is optional
          props.put(IImSession.PROP_IM_PORT, "1533");

          IImSession session = (IImSession) SessionFactory.createSession( props );

  Sending an instant message
  Sending an instant message to another Sametime user differs from other Compoze Collaboration Services IM API providers only in the format of the URI used to identify a user. In Sametime, URI can vary greatly depending on how the user was set up. In the simplest case, a URI containing Lotus user's short name will be sufficient. In other cases, user's Lotus domain, email server and other properties may need to be specified. If client code is unsure of Lotus infrastructure it's communicating with, the best way to approach sending a message is locating a user in the friends list and use the `IFriend` reference when setting recipients. Here is the sample code

          IRootContainer container = session.getDefaultRootContainer();
          IContainer friends = container.getSubcontainer("Friends");

          IItem [] items = friends.getItems();

          // get the first friend we can find
          if(items.length > 0)
              {
              IFriend friend = (IFriend)items[0];

              IContainer messages = container.getSubcontainer("Messages");
              IInstantMessage message = (IInstantMessage)messages.add();
              message.addRecipient(friend);
              message.setBody("foo bar");
              message.send();
              }

  Handling of AOL friends
  Sametime client provides support for AOL Instant Messenger as a part of its functionality. This functionality is provided by the actual client implementation, not the Sametime server. Therefore, even though Compoze Collaboration Services IM API will bring back AOL Instant Messenger users for this Sametime user, actual messaging functionality is not provided. Currently, Sametime only supports native Sametime and AOL IM friends. Therefor, client code may differentiate between Sametime and AIM users by examining the `ISametimeFriend.isSametimeNative()`. Below is an example of filtering out AIM friends

          IRootContainer container = session.getDefaultRootContainer();
          IContainer friendsConainer = container.getSubcontainer("Friends");

          IItem [] friends = friendsConainer.getItems();
          for (int i=0; i<friends.length; ++i)
              {
              ISametimeFriend friend = (ISametimeFriend)friends[i];
              String sUsername = friend.getUsername();

              // let's show only Sametime friends, ignoring all AIM friends
              if(friend.isSametimeNative())
                  {
                  System.out.println(sUsername);
                  }
              }

  Sending status notifications
  Sametime status extensions to `FriendStatusEnum` are stored in the `SametimeFriendStatusEnum` enumeration. This enumeration should be used to broadcast status changes from the code. Below is an example of setting user's status to DO NOT DISTURB

          session.setPresence(SametimeFriendStatusEnum.DO_NOT_DISTURB);

  Adding and deleting friends
  Adding and deleting friends is currently unsupported. These operations will be supported in the next release. It is still allowed to add an in-memory `IFriend` or `IContainer`, but invoking `IItem.commit()` will result in `OperationUnsupportedException` being thrown.

  Overview | Package | Class | Tree | Deprecated | Index | Help
  | Compoze Software, Inc.
  PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

  Copyright ©1999-2005 Compoze Software, Inc. All rights reserved.