GigaSpaces XAP 9.0 API

net.jini.core.lookup
Interface ServiceRegistration


public interface ServiceRegistration

A registered service item is manipulated using an instance of this class. This is not a remote interface; each implementation of the lookup service exports proxy objects that implement this interface local the client. The proxy methods obey normal RMI remote interface semantics. Every method invocation (on both ServiceRegistrar and ServiceRegistration) is atomic with respect to other invocations.

Since:
1.0
Author:
Sun Microsystems, Inc.
See Also:
ServiceRegistrar

Method Summary
 void addAttributes(Entry[] attrSets)
          Adds the specified attribute sets (those that aren't duplicates of existing attribute sets) to the registered service item.
 Lease getLease()
          Returns the lease that controls the service registration, allowing the lease to be renewed or cancelled.
 ServiceID getServiceID()
          Returns the service ID for this service.
 void modifyAttributes(Entry[] attrSetTemplates, Entry[] attrSets)
          Modifies existing attribute sets.
 void setAttributes(Entry[] attrSets)
          Deletes all of the service item's existing attributes, and replaces them with the specified attribute sets.
 

Method Detail

getServiceID

ServiceID getServiceID()
Returns the service ID for this service. Note that this method does not make a remote call.

Returns:
the ServiceID for this service.

getLease

Lease getLease()
Returns the lease that controls the service registration, allowing the lease to be renewed or cancelled. Note that this does not make a remote call.

Returns:
the lease that controls this service registration.

addAttributes

void addAttributes(Entry[] attrSets)
                   throws UnknownLeaseException,
                          RemoteException
Adds the specified attribute sets (those that aren't duplicates of existing attribute sets) to the registered service item. Note that this operation has no effect on existing attribute sets of the service item, and can be repeated in an idempotent fashion.

Parameters:
attrSets - attribute sets to add
Throws:
UnknownLeaseException - the registration lease has expired or been cancelled.
RemoteException

modifyAttributes

void modifyAttributes(Entry[] attrSetTemplates,
                      Entry[] attrSets)
                      throws UnknownLeaseException,
                             RemoteException
Modifies existing attribute sets. The lengths of attrSetTemplates and attrSets must be equal, or IllegalArgumentException is thrown. The service item's attribute sets are modified as follows. For each array index i: if attrSets[i] is null, then every entry that matches attrSetTemplates[i] is deleted; otherwise, for every non-null field in attrSets[i], the value of that field is stored into the corresponding field of every entry that matches attrSetTemplates[i]. The class of attrSets[i] must be the same as, or a superclass of, the class of attrSetTemplates[i], or IllegalArgumentException is thrown. If the modifications result in duplicate entries within the service item, the duplicates are eliminated.

Note that it is possible to use modifyAttributes in ways that are not idempotent. The attribute schema should be designed in such a way that all intended uses of this method can be performed in an idempotent fashion. Also note that modifyAttributes does not provide a means for setting a field to null; it is assumed that the attribute schema is designed in such a way that this is not necessary.

Parameters:
attrSetTemplates - attribute set templates to match
attrSets - modifications to make to matching attribute sets
Throws:
UnknownLeaseException - the registration lease has expired or been cancelled
IllegalArgumentException - lengths of attrSetTemplates and attrSets are not equal, or class of an attrSets element is not the same as, or a superclass of, the class of the corresponding attrSetTemplates element
RemoteException

setAttributes

void setAttributes(Entry[] attrSets)
                   throws UnknownLeaseException,
                          RemoteException
Deletes all of the service item's existing attributes, and replaces them with the specified attribute sets. Any duplicate attribute sets are eliminated in the stored representation of the item.

Parameters:
attrSets - attribute sets to use
Throws:
UnknownLeaseException - the registration lease has expired or been cancelled
RemoteException

GigaSpaces XAP 9.0 API

Copyright © GigaSpaces.