Core API 7.15

net.juniper.smgt.sae.portal
Class Service

java.lang.Object
  extended by net.juniper.smgt.sae.portal.Service

public class Service
extends java.lang.Object

This bean represents a service currently loaded into SAE from the SAE's LDAP directory. The current value of this bean's serviceName property determines which loaded service this bean represents. If it has been set, the current value of this bean's locationName property determines which localized version of that loaded service this bean represents. If you are not using localized versions of services, the locationName property can be safely ignored. This bean's serviceName property must be set before any other properties are read.


Constructor Summary
Service()
          The default bean constructor.
Service(User user)
           
 
Method Summary
 java.lang.Object getAttribute(java.lang.String attributeName)
          Returns the value of the named attribute from this service's entry in SAE's LDAP service directory.
 java.lang.String[] getAttributeNames()
          Get the names of the LDAP attributes defined for this service.
 java.lang.String getCategory()
          Returns the category of this service (e.g.
static java.util.Set getDeprecatedProperties()
          return a set of deprecated properties.
 java.lang.String getDescriptionOrServiceName()
          Returns the description of this service (e.g.
 java.lang.String getDesignAndGraphics()
          Returns the `design and graphics' string for this service (e.g.
 java.lang.String getDomainName()
          Returns the domain name of this service (e.g.
 java.lang.String getLocationName()
          Deprecated. Returns the location name with which this bean was initialized. The value of some Service properties will vary according to the location where the service is used.
 long getMaxSessionTime()
          Returns the number of seconds that the service may be active before SAE will automatically deactivate it.
 java.lang.String getServiceName()
          Returns the service name with which this bean was initialized.
 java.lang.String getSessionId()
          Returns the user's session ID from the user bean which this bean was initialized (e.g.
 java.lang.String getType()
          Returns the type of this service.
 java.lang.String getUrl()
          Returns the URL of this service (e.g.
 java.lang.String getUserDn()
          Returns the LDAP dististinguished name with which this bean was initialized (e.g.
 java.lang.String getUserIp()
          Returns the IP address with which this bean was initialized (e.g.
 boolean isActivateOnly()
          Returns true if this service is defined as an activate only service.
 boolean isAuthenticationRequired()
          Returns true if this service requires a subscription-specific username and password before being activated.
 boolean isInitialized()
          Returns true only if this bean has been fully initialized.
 boolean isInvisible()
          Returns true if the attribute category of this service is marked as invisible.
 void setLocationName(java.lang.String locationName)
          Deprecated. Determines which localized version of the service definition will be described by all subsequent reads of this bean's properties. The value of some Service properties will vary according to the location where the service is used. If you are using location-specific service definitions it is critical to set both the locationName and serviceName properties before reading any other properties. If you are not using localized versions of services, this property can be safely ignored. If you are using localized versions of services, the required location name can be obtained from an initialized User bean.
 void setServiceName(java.lang.String serviceName)
          Determines which service will be described by all subsequent reads of this bean's properties.
 void setSessionId(java.lang.String sessionId)
          Setting this property specifies which user's service will be described or affected by all subsequent reads or writes of this bean's properties.
 void setUserDn(java.lang.String userDn)
          Setting this property specifies which interface user's service will be described or affected by all subsequent reads or writes of this bean's properties.
 void setUserIp(java.lang.String userIp)
          Setting this property specifies which user's service will be described or affected by all subsequent reads or writes of this bean's properties.
 java.lang.String toString()
          For debugging only.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Service

public Service()
The default bean constructor.


Service

public Service(User user)
Method Detail

setServiceName

public void setServiceName(java.lang.String serviceName)
                    throws UnknownServiceException
Determines which service will be described by all subsequent reads of this bean's properties. The value of some Service properties will vary according to the location where the service is used. If you are using location-specific service definitions, it is critical to set both the locationName and serviceName properties before reading any other properties.

Parameters:
serviceName - The desired service's name (e.g. "Video Gold").
Throws:
UnknownServiceException - If the service specified by the serviceName argument is not currently loaded into SAE.
See Also:
setLocationName(java.lang.String)

getServiceName

public java.lang.String getServiceName()
Returns the service name with which this bean was initialized. If the bean was initialized for an instance of a multiple subscription (e.g. serviceName="video%channel1"), the returned name does not include the subscription qualifier (in the example "%channel1")

Throws:
java.lang.IllegalStateException - If this bean has not been properly initialized.

setSessionId

public void setSessionId(java.lang.String sessionId)
                  throws UnknownUserException
Setting this property specifies which user's service will be described or affected by all subsequent reads or writes of this bean's properties.

Parameters:
sessionId - The desired user's current session ID in string format (e.g. "jane:1113315547138:0").
Throws:
UnknownUserException - If the specified user is not currently logged in to SAE.
Since:
6.2.0

getSessionId

public java.lang.String getSessionId()
Returns the user's session ID from the user bean which this bean was initialized (e.g. "jane:1113315547138:0").

Throws:
java.lang.IllegalStateException - If this bean has not been properly initialized.
Since:
6.2.0

setUserIp

public void setUserIp(java.lang.String userIp)
               throws UnknownUserException
Setting this property specifies which user's service will be described or affected by all subsequent reads or writes of this bean's properties. Setting this userIp property has the side-effect of setting the userDn property to null.

Parameters:
userIp - The desired user's current IP address in string format (e.g. "192.168.3.34").
Throws:
java.lang.IllegalArgumentException - If the userIp string does not contain a parseable IP address.
UnknownUserException - If the specified user is not currently logged in to SAE.

getUserIp

public java.lang.String getUserIp()
Returns the IP address with which this bean was initialized (e.g. "192.168.3.34").

Returns:
Null, if this bean was initialized with an LDAP distinguished name instead of an IP address.
Throws:
java.lang.IllegalStateException - If this bean has not been properly initialized.

setUserDn

public void setUserDn(java.lang.String userDn)
               throws UnknownUserException,
                      NonUniqueUserException
Setting this property specifies which interface user's service will be described or affected by all subsequent reads or writes of this bean's properties. Setting this userDn property has the side-effect of setting the userIp

Parameters:
userDn - The desired interface user's LDAP Distinguished Name in string format (e.g. "siteName=OttawaOffice,enterpriseName=XyzCorp,ou=Ottawa,retailername=ISP3,o=Users,o=UMC").
Throws:
java.lang.IllegalArgumentException - If the userDn string does not contain a parseable DN.
UnknownUserException - If an interface user with the specified DN is not currently logged in to SAE.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
Since:
3.0

getUserDn

public java.lang.String getUserDn()
Returns the LDAP dististinguished name with which this bean was initialized (e.g. "siteName=OttawaOffice,enterpriseName=XyzCorp,ou=Ottawa,retailername=ISP3,o=Users,o=UMC").

Returns:
Null, if this bean was initialized with an IP address instead of an LDAP distinguished name.
Throws:
java.lang.IllegalStateException - If this bean has not been properly initialized.
Since:
3.0

setLocationName

public void setLocationName(java.lang.String locationName)
Deprecated. Determines which localized version of the service definition will be described by all subsequent reads of this bean's properties. The value of some Service properties will vary according to the location where the service is used. If you are using location-specific service definitions it is critical to set both the locationName and serviceName properties before reading any other properties. If you are not using localized versions of services, this property can be safely ignored. If you are using localized versions of services, the required location name can be obtained from an initialized User bean.

Parameters:
locationName - The name of the location for which the desired localized version of this service was created.
See Also:
User.getLocationName()

getLocationName

public java.lang.String getLocationName()
Deprecated. Returns the location name with which this bean was initialized. The value of some Service properties will vary according to the location where the service is used.

Returns:
Null, if this property has never been set.

isInitialized

public boolean isInitialized()
Returns true only if this bean has been fully initialized. It is fully initialized if the serviceName property has been set.


isActivateOnly

public boolean isActivateOnly()
                       throws UnknownServiceException,
                              UnknownUserException,
                              NonUniqueUserException
Returns true if this service is defined as an activate only service. Subscriptions to Activate Only Services can NOT be deactivated by setting its active property to false.

Throws:
java.lang.IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SAE.
UnknownUserException - If the specified user is not currently logged in to SAE.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
Since:
4.0
See Also:
Subscription.setSubscriptionUsername(java.lang.String), Subscription.setSubscriptionPassword(java.lang.String), Subscription.setActive(boolean)

isAuthenticationRequired

public boolean isAuthenticationRequired()
                                 throws UnknownServiceException,
                                        UnknownUserException,
                                        NonUniqueUserException
Returns true if this service requires a subscription-specific username and password before being activated. When a user requests that such a service be started, the portal should obtain a subscription-specific username and password from the user, and use them to set an appropriately initialized Subscription bean's subscriptionUsername and subscriptionPassword properties. After these properties are set, the subscription can be activated by setting its active property to true.

Throws:
java.lang.IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SAE.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
UnknownUserException
See Also:
Subscription.setSubscriptionUsername(java.lang.String), Subscription.setSubscriptionPassword(java.lang.String), Subscription.setActive(boolean)

isInvisible

public boolean isInvisible()
                    throws UnknownServiceException,
                           UnknownUserException,
                           NonUniqueUserException
Returns true if the attribute category of this service is marked as invisible. Subscriptions to services marked as invisible are not available through the portal API. Such subscriptions can be activated only automatically, when the user logs in.

Throws:
java.lang.IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SAE.
UnknownUserException - If the specified user is not currently logged in to SAE.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
Since:
4.0
See Also:
Subscription.setSubscriptionUsername(java.lang.String), Subscription.setSubscriptionPassword(java.lang.String), Subscription.setActive(boolean)

getType

public java.lang.String getType()
                         throws UnknownServiceException
Returns the type of this service. The following types of service exist:

Returns:
the String encoding of the service type.
Throws:
java.lang.IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SAE.

getMaxSessionTime

public long getMaxSessionTime()
                       throws UnknownServiceException,
                              UnknownUserException,
                              NonUniqueUserException
Returns the number of seconds that the service may be active before SAE will automatically deactivate it. Some services are designed to be automatically deactivated a specific amount of time after they are activated. If this is such a service, this method will return the number of seconds that the service may be active, as it is specified in the service's definition in LDAP.

Returns:
Returns 0 if there is no maximum session length defined for this service.
Throws:
java.lang.IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SAE.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
UnknownUserException

getDescriptionOrServiceName

public java.lang.String getDescriptionOrServiceName()
                                             throws UnknownServiceException,
                                                    UnknownUserException,
                                                    NonUniqueUserException
Returns the description of this service (e.g. "Elmo's Fast Video Service"), as it is specified in the SAE's LDAP directory. This is an arbitrary string specified when the service is being defined. Its intended use is to help web page designers provide a short description of this service to the user. If no description is defined for this service, this method will return the serviceName property instead.

Throws:
java.lang.IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SAE.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
UnknownUserException

getUrl

public java.lang.String getUrl()
                        throws UnknownServiceException,
                               UnknownUserException,
                               NonUniqueUserException
Returns the URL of this service (e.g. "http://www.elmo.com/video/fast/"), as it is specified in the SAE's LDAP directory. This is an arbitrary string specified when the service is being defined. Its intended use is to help web page designers provide a link to the web content that is accessible to the user while this service is activated.

Returns:
Null, if this attribute is not specified in the LDAP directory.
Throws:
java.lang.IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SAE.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
UnknownUserException

getDomainName

public java.lang.String getDomainName()
                               throws UnknownServiceException,
                                      UnknownUserException,
                                      NonUniqueUserException
Returns the domain name of this service (e.g. "elmo.com"), as it is specified in the SAE's LDAP directory. This is an arbitrary string specified when the service is being defined. If this domain name is non-null (i.e. if it is specified in the service definition in LDAP), then this domain name is automatically appended to the Subscription bean's subscriptionUsername property for the purposes of authentication only.

Returns:
Null, if this attribute is not specified in the LDAP directory.
Throws:
java.lang.IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SAE.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
UnknownUserException
See Also:
Subscription.setSubscriptionUsername(java.lang.String), Subscription.setActive(boolean)

getDesignAndGraphics

public java.lang.String getDesignAndGraphics()
                                      throws UnknownServiceException,
                                             UnknownUserException,
                                             NonUniqueUserException
Returns the `design and graphics' string for this service (e.g. "icons/elmoVideoFast.gif"), as it is specified in the SAE's LDAP directory. This is an arbitrary string specified when the service is being defined. Its intended use is to help web page designers by allowing service-specific icons to be handled in a uniform manner.

Returns:
Null, if this attribute is not specified in the LDAP directory.
Throws:
java.lang.IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SAE.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
UnknownUserException

getCategory

public java.lang.String getCategory()
                             throws UnknownServiceException,
                                    UnknownUserException,
                                    NonUniqueUserException
Returns the category of this service (e.g. "Video services"), as it is specified in the SAE's LDAP directory. This is an arbitrary string specified when the service is being defined. Its intended use is to help web page designers present services in logical groupings.

Returns:
Null, if this attribute is not specified in the LDAP directory.
Throws:
java.lang.IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SAE.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
UnknownUserException

getAttribute

public java.lang.Object getAttribute(java.lang.String attributeName)
                              throws UnknownServiceException,
                                     UnknownUserException,
                                     NonUniqueUserException
Returns the value of the named attribute from this service's entry in SAE's LDAP service directory. If the attribute is a single value, the returned Object must be cast to the appropriate type. If the attribute is multi-valued, the returned Object must be cast to an array of the appropriate type.

Returns:
Returns null if this service's entry in SAE's LDAP service directory does not contain an attribute with the specified name.
Throws:
java.lang.IllegalStateException - If this bean's mandatory serviceName property has not been set.
UnknownServiceException - If the service is no longer loaded in SAE.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
UnknownUserException
Since:
3.0

getAttributeNames

public java.lang.String[] getAttributeNames()
                                     throws UnknownServiceException
Get the names of the LDAP attributes defined for this service. Each returned string can be used as an argument to getAttribute().

Returns:
Array of attribute names.
Throws:
UnknownServiceException - If the service is no longer loaded in SAE.
Since:
3.0

toString

public java.lang.String toString()
For debugging only. Returns a description of this Service bean.

Overrides:
toString in class java.lang.Object

getDeprecatedProperties

public static java.util.Set getDeprecatedProperties()
return a set of deprecated properties.


Core API 7.15