Code Example Interface: PresenceConsumer, Operation: subscribePresence

8-6 Developers Guide

8.5.7 Interface PresenceSupplier, Operation: publish and Oracle Specific Unpublish

This is the first operation the application must call before using another operation in this interface. It serves three purposes: ■ It allows the Web services to associate the current HTTP session with a user. ■ It publishes the user’s presence status. ■ It subscribes to watcher-info so that the Web services can keep track of any watcher requests. There are three attributes that are of interest when performing a PUBLISH. These attributes can be set in a PresenceAttribute structure and passed into the PUBLISH method. ■ Presense status with a customized note: this is the customized note configured in the My Presence text box in Oracle Communicator. The note element is contained in the person element of the Presence Information Data Format PIDF XML file. ■ Device note: implicitly inserted by Oracle Communicator, or inserted from a Web service. The note element is contained in the device element of the Presence Information Data Format PIDF XML file. ■ Service note: configured in the Presence tab in the Oracle Communicator preferences. The note element is contained in the tuple element of the Presence Information Data Format PIDF XML file.

8.5.7.1 Code Example

A simple way to publish the Presence Status PresenceAttribute pa = new PresenceAttribute; OtherValue other = new OtherValue; Set the name to DeviceNote to indicate the value must be used as device note. other.setNameDeviceNote; other.setValueDevice Name; More other values can be defined for ServiceNote etc CommunicationValue comm = new CommunicationValue; AttributeTypeAndValue typeValue = new AttributeTypeAndValue; typeValue.setUnionElementPresenceAttributeType.ACTIVITY; typeValue.setActivityactivity; typeValue.setPlacePlaceValue.PLACE_NONE; typeValue.setPrivacyPrivacyValue.PRIVACY_NONE; typeValue.setSphereSphereValue.SPHERE_NONE; typeValue.setCommunicationcomm; typeValue.setOtherother; pa.setTypeAndValuetypeValue; String note = My Note; pa.setNotenote; XMLGregorianCalendar dateTime = null; dateTime = DatatypeFactory.newInstance.newXMLGregorianCalendarnew GregorianCalendar; pa.setLastChangedateTime; ListPresenceAttribute pat = new ArrayListPresenceAttribute; pat.addpa; supplier.publishpat; To UNPUBLISH,set the OtherValue to Expires, 0 OtherValue other = new OtherValue; other.setNameExpires; other.setValue0; Parlay X Presence Web Services 8-7

8.5.8 Interface: PresenceSupplier, Operation: getOpenSubscriptions

This operation retrieves a list of new requests to be on your watcher list.

8.5.8.1 Code Example

ListSubscriptionRequest srList = getOpenSubscriptions; for SubscriptionRequest sr :srList { System.out.printlnsr.getWatcher .toString; }

8.5.9 Interface: PresenceSupplier, Operation: updateSubscriptionAuthorization

This operation allows you to place a watcher on either the block or allow list.

8.5.9.1 Code Example

PresencePermission p = new PresencePermission; p.setDecisiontrue; ListPresencePermission pp = new ArrayListPresencePermission; p.setPresenceAttributePresenceAttributeType.ACTIVITY; pp.addp; updateSubscriptionAuthorizationsip:allowtest.example.com,pp;

8.5.10 Interface: PresenceSupplier, Operation: getMyWatchers

This operation retrieves the list of watchers in your allow list.

8.5.10.1 Code Example

ListString watchers = getMyWatchers; forString watcher: watchers{ System.out.printlnwatcher; }

8.5.11 Interface: PresenceSupplier, Operation: getSubscribedAttributes

This operation returns only a single item of PresenceTypeAttribute.Activity. An exception is thrown if there is no existing subscription.

8.5.11.1 Code Example

ListPresenceAttributeType pat = getSubscribedAttributessip:watchertest.example.com;

8.5.12 Interface: PresenceSupplier, Operation: blockSubscription

This operation places a watcher into the block list.

8.5.12.1 Code Example

blockSubscriptionsip:block.this.watchertest.example.com;

8.6 OWLCS Parlay X Presence Custom Error Codes

Table 8–4 and Table 8–5 describe the error codes and their associated error message.