Core API 4.3

net.juniper.smgt.sae.portal
Class Service

java.lang.Object
  |
  +--net.juniper.smgt.sae.portal.Service

public class Service
extends Object

This bean represents a service currently loaded into SSP from the SSP'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.


Field Summary
static String ISP
          A possible value for a Service bean's type property.
static String NORMAL
          A possible value for a Service bean's type property.
 
Constructor Summary
Service()
          The default bean constructor.
Service(User user)
           
 
Method Summary
 Object getAttribute(String attributeName)
          Returns the value of the named attribute from this service's entry in SSP's LDAP service directory.
 String[] getAttributeNames()
          Get the names of the LDAP attributes defined for this service.
 String getCategory()
          Returns the category of this service (e.g.
 String getDescriptionOrServiceName()
          Returns the description of this service (e.g.
 String getDesignAndGraphics()
          Returns the `design and graphics' string for this service (e.g.
 String getDomainName()
          Returns the domain name of this service (e.g.
 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 SSP will automatically deactivate it.
 String getServiceName()
          Returns the service name with which this bean was initialized.
 String getType()
          Returns the type of this service.
 String getUrl()
          Returns the URL of this service (e.g.
 String getUserDn()
          Returns the LDAP dististinguished name with which this bean was initialized (e.g.
 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(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(String serviceName)
          Determines which service will be described by all subsequent reads of this bean's properties.
 void setUserDn(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(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.
 String toString()
          For debugging only.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NORMAL

public static final String NORMAL
A possible value for a Service bean's type property. NORMAL services apply policies to the user's router network traffic when activated, and remove them when deactivated.

See Also:
getType(), Constant Field Values

ISP

public static final String ISP
A possible value for a Service bean's type property. When activated, an ISP service changes a DHCP user's IP address from a 'token' IP address to a public IP address. When deactivated, an ISP service changes a DHCP user's IP address from a public IP address back to a 'token' IP address. ISP services also apply policies to the user's network traffic when activated, and remove them when deactivated.

See Also:
getType(), User.isTokenDhcpUser(), User.isPublicDhcpUser(), Constant Field Values
Constructor Detail

Service

public Service()
The default bean constructor.


Service

public Service(User user)
Method Detail

setServiceName

public void setServiceName(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 SSP.
See Also:
setLocationName(java.lang.String)

getServiceName

public 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:
IllegalStateException - If this bean has not been properly initialized.

setUserIp

public void setUserIp(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:
IllegalArgumentException - If the userIp string does not contain a parseable IP address.
UnknownUserException - If the specified user is not currently logged in to SSP.

getUserIp

public 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:
IllegalStateException - If this bean has not been properly initialized.

setUserDn

public void setUserDn(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:
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 SSP.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
Since:
3.0

getUserDn

public 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:
IllegalStateException - If this bean has not been properly initialized.
Since:
3.0

setLocationName

public void setLocationName(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 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:
IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SSP.
UnknownUserException - If the specified user is not currently logged in to SSP.
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:
IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SSP.
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:
IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SSP.
UnknownUserException - If the specified user is not currently logged in to SSP.
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 String getType()
               throws UnknownServiceException
Returns the type of this service. Two types of service exist, NORMAL services and ISP services:

Returns:
Either Service.ISP or Service.NORMAL will be returned.
Throws:
IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SSP.
See Also:
NORMAL, ISP

getMaxSessionTime

public long getMaxSessionTime()
                       throws UnknownServiceException,
                              UnknownUserException,
                              NonUniqueUserException
Returns the number of seconds that the service may be active before SSP 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:
IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SSP.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
UnknownUserException

getDescriptionOrServiceName

public 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 SSP'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:
IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SSP.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
UnknownUserException

getUrl

public 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 SSP'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:
IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SSP.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
UnknownUserException

getDomainName

public String getDomainName()
                     throws UnknownServiceException,
                            UnknownUserException,
                            NonUniqueUserException
Returns the domain name of this service (e.g. "elmo.com"), as it is specified in the SSP'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:
IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SSP.
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 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 SSP'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:
IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SSP.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
UnknownUserException

getCategory

public String getCategory()
                   throws UnknownServiceException,
                          UnknownUserException,
                          NonUniqueUserException
Returns the category of this service (e.g. "Video services"), as it is specified in the SSP'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:
IllegalStateException - If this bean has not been properly initialized.
UnknownServiceException - If the service is no longer loaded in SSP.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
UnknownUserException

getAttribute

public Object getAttribute(String attributeName)
                    throws UnknownServiceException,
                           UnknownUserException,
                           NonUniqueUserException
Returns the value of the named attribute from this service's entry in SSP'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 SSP's LDAP service directory does not contain an attribute with the specified name.
Throws:
IllegalStateException - If this bean's mandatory serviceName property has not been set.
UnknownServiceException - If the service is no longer loaded in SSP.
NonUniqueUserException - If the user specified by this bean's userDn property is logged in more than once.
UnknownUserException
Since:
3.0

getAttributeNames

public 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 SSP.
Since:
3.0

toString

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

Overrides:
toString in class Object

Core API 4.3