com.sapportals.portal.useragent
Interface IUserAgentService


public interface IUserAgentService

Version:
$Revision: #1 $.

Inner Class Summary
static interface IUserAgentService.IDTextPair
          static inner class that stores an ID-text pair, i.e. the technical ID and a human readable text.
 
Field Summary
static java.lang.String KEY
          this key is used in case of running in a Portal environment
 
Method Summary
 IUserAgentSet createUserAgentSet(java.lang.String name, java.lang.String includedPatternExpr, java.lang.String excludedPatternExpr)
          Creates a new IUserAgentSet with name name for the given pattern expressions.
 IUserAgentService.IDTextPair[] getAllKnownPlatforms(java.util.Locale locale)
          Returns an array of all known User Agent platforms as translated by the resource bundle
 IUserAgentService.IDTextPair[] getAllKnownTypes(java.util.Locale locale)
          Returns an array of all known User Agent types as translated by the resource bundle
 IUserAgentService getNewInstance()
          Returns a new instance of this User-Agent service (i.e. a clone).
 IUserAgent getUserAgent(java.lang.String userAgentString)
          Returns the IUserAgent for the given userAgentString The IUserAgent interface provides a cannonical representation of the User Agent String given by an HTTP Request Header.
 IUserAgentFamily getUserAgentFamily()
          Returns the IUserAgentFamily for this instance that is the super set of all user agent sets that are defined by this instance.
 IUserAgentSet getUserAgentSetForName(java.lang.String name)
          Returns an already defined IUserAgentSet with the given name or null, if no entry was found.
 

Field Detail

KEY

public static final java.lang.String KEY
this key is used in case of running in a Portal environment
Method Detail

getNewInstance

public IUserAgentService getNewInstance()
Returns a new instance of this User-Agent service (i.e. a clone). The new instance will life inside its own memory space so that the User-Agent Family will be disjoint from the original one. Therefore one can have several disjoint User-Agent Families with different set of User-Agents.
Returns:
a new (separate) instance of the User-Agent Service
See Also:
IUserAgentFamily

getUserAgent

public IUserAgent getUserAgent(java.lang.String userAgentString)
Returns the IUserAgent for the given userAgentString The IUserAgent interface provides a cannonical representation of the User Agent String given by an HTTP Request Header. An IUserAgent object contains the type, version and platform of the user agent. One can picture it as a triple: ( ua_type, ua_version, ua_platform ).
Parameters:
userAgentString - user agent identification string as defined in RFC 2616 "Hypertext Transfer Protocol -- HTTP/1.1", chap. 14.43
Returns:
the corresponding IUserAgent
See Also:
IUserAgent, IPortalComponentRequest

createUserAgentSet

public IUserAgentSet createUserAgentSet(java.lang.String name,
                                        java.lang.String includedPatternExpr,
                                        java.lang.String excludedPatternExpr)
                                 throws UserAgentSetException,
                                        UserAgentPatternParserException
Creates a new IUserAgentSet with name name for the given pattern expressions. The parameters includedPatternExpr and excludedPatternExpr defines a set of user agents where includedPatternExpr describes the set of included and excludedPatternExpr describes the set of excluded user agents. An IUserAgent is in this set, if and only if
  • it matches at least one of the including pattern expressions and
  • it DOESN'T match one of the excluding pattern expressions.
The expression grammar is as follows:
EXPR_STR::=P_EXPR*the whole pattern expression string
P_EXPR::=WS (P_NAME | P_UA)is a list of pattern names or user agent patterns
P_NAME::=P_IDA pattern name is an identifier
P_ID::=JAVA_IDENTIFIERthe syntax of an id is the same as in Java
P_UA::='(' WS P_TYPE WS ',' WS P_VERS WS ',' WS P_PLAT WS ')'an user agent pattern contains pattern type, version and platform
P_TYPE::='*' | CMP_1? P_IDa type pattern is either a wildcard or an id with an optional prefixed comparator
P_VERS::='*' | CMP_2? P_NUMa version pattern is either a wildcard or an number with an optional prefixed comparator
P_PLAT::='*' | CMP_1? P_IDa platform pattern is either a wildcard or an id with an optional prefixed comparator
CMP_1::='=' | '!'the simple comparator is either equal or unequal
CMP_2::='=' | '!' | '<' | '<=' | '>' | '>='the complex comparator is one of = ! < > <= >=
P_NUM::=JAVA_FLOATthe syntax of a number is the same as for a float in Java

The new created IUserAgentSet is added to the user agent family

Parameters:
name - the name for the new user agent set. This name can be used in subsequent user agent set definitions
Returns:
a new IUserAgentSet
Throws:
UserAgentSetException, - if there is already an IUserAgentSet with name=name defined.
UserAgentPatternParserException, - if the pattern expressions contain syntax errors.
See Also:
getUserAgent(String), getUserAgentFamily(), IUserAgentSet.contains(com.sapportals.portal.useragent.IUserAgent), IUserAgentSet, IUserAgent, IUserAgentFamily

getUserAgentSetForName

public IUserAgentSet getUserAgentSetForName(java.lang.String name)
Returns an already defined IUserAgentSet with the given name or null, if no entry was found.
Parameters:
name - the name of the user agent set
Returns:
the corresponding IUserAgentSet object or null.
See Also:
createUserAgentSet(java.lang.String, java.lang.String, java.lang.String), IUserAgentSet, IUserAgent

getUserAgentFamily

public IUserAgentFamily getUserAgentFamily()
Returns the IUserAgentFamily for this instance that is the super set of all user agent sets that are defined by this instance. The user agent family is automatically constructed by each creation of an IUserAgentSet
Returns:
the user agent family of this instance.
See Also:
createUserAgentSet(java.lang.String, java.lang.String, java.lang.String), IUserAgentFamily

getAllKnownTypes

public IUserAgentService.IDTextPair[] getAllKnownTypes(java.util.Locale locale)
Returns an array of all known User Agent types as translated by the resource bundle
Parameters:
locale - the desired locale of the types
Returns:
array of IUserAgentService.IDTextPairs of all known User Agent types
See Also:
getAllKnownPlatforms(Locale), IUserAgentService.IDTextPair, IUserAgentConstants

getAllKnownPlatforms

public IUserAgentService.IDTextPair[] getAllKnownPlatforms(java.util.Locale locale)
Returns an array of all known User Agent platforms as translated by the resource bundle
Parameters:
locale - the desired locale of the platforms
Returns:
array of IUserAgentService.IDTextPairs of all known User Agent types
See Also:
getAllKnownPlatforms(Locale), IUserAgentService.IDTextPair, IUserAgentConstants