Nitido Inc.

com.nitido.nimx.services.brand.ldap
Class BrandServiceImpl

java.lang.Object
  extended by com.nitido.nim.NiMKernelService
      extended by com.nitido.nim.BrandService
          extended by com.nitido.nimx.services.brand.ldap.BrandServiceImpl
All Implemented Interfaces:
NiMConstants

public class BrandServiceImpl
extends BrandService

This BrandService implementation caches the domains, brands and applications in CacheContainers.

The data is retrieved from the LDAP.

The following configuration properties are required for this implementation to start up properly. (In addition to all the system defaults)


Field Summary
 
Fields inherited from class com.nitido.nim.BrandService
_confService
 
Fields inherited from interface com.nitido.nim.NiMConstants
ACTION_CREATE_NUGGET, ACTION_CREATE_NUGGET_BY_NAME, ACTION_CRED_SPACE_ADD, ACTION_CRED_SPACE_GET_KEYS, ACTION_CRED_SPACE_GET_KEYS_START_WITH, ACTION_CRED_SPACE_GET_VALUE, ACTION_CRED_SPACE_GET_VALUES, ACTION_CRED_SPACE_MODIFY, ACTION_CRED_SPACE_REMOVE_VALUE, ACTION_CRED_SPACE_REMOVE_VALUES, ACTION_CRED_SPACE_REPLACE, ACTION_DEPROVISION_ENTITY, ACTION_ENTITY_CHANGE_CRED, ACTION_LOG_EVENT, ACTION_PROVISION_ENTITY, ACTION_USER_SPACE_ADD, ACTION_USER_SPACE_GET_KEYS, ACTION_USER_SPACE_GET_KEYS_START_WITH, ACTION_USER_SPACE_GET_VALUE, ACTION_USER_SPACE_GET_VALUES, ACTION_USER_SPACE_MODIFY, ACTION_USER_SPACE_REMOVE_VALUE, ACTION_USER_SPACE_REMOVE_VALUES, ACTION_USER_SPACE_REPLACE, CONF_PREFIX_SECURITY_ACCESS, CONF_PREFIX_SECURITY_ALLOW, CONF_PREFIX_SECURITY_ASSIGN, CONF_PREFIX_SECURITY_RESOURCE, PARAM_CHANGE_CRED, PARAM_DEPROVISION_CREDENTIAL, PARAM_EVENT_NAME, PARAM_MODIFIER_CONTAINER, PARAM_NUGGET_CREATE_CRED, PARAM_NUGGET_NAME, PARAM_NUGGET_SETTINGS, PARAM_NUGGET_TYPE, PARAM_PROVISION_DESCRIPTOR, PARAM_SPACE_KEY, PARAM_SPACE_KEYS_START_WITH, PARAM_SPACE_VALUE, PREFIX_ACCESS_CLASS_IN_PACKAGE
 
Constructor Summary
BrandServiceImpl(NiMKernelServiceVisa visa)
           
 
Method Summary
protected  Brand doGetBrand(java.lang.String domainID, java.lang.String brandID, Entity user, NimletInput input)
           
 java.util.List<Application> getApplications(java.util.List<java.lang.String> brandApps, Entity user)
          Get a list of application objects for a given list of application IDs.
 Brand getBrand(NimletInput input, Entity user)
          Determines which brand to use based on HttpNimletInput and user's pref.
protected  Brand getDefaultBrand(java.lang.String domainID, Entity user)
          Get the system default brand.
 Brand getDomainBrand(java.lang.String domainID)
          Get the domain's default brand.
 java.lang.String getDomainID(NimletInput input)
          Attempt to retrieve the name of the domain from which the request is being made.
protected  java.lang.String getDomainIDFromRequest(javax.servlet.http.HttpServletRequest request)
          Get the domain name from an HTTP servlet request.
 java.lang.String getMessage(java.lang.String domainID, java.lang.String brandID, java.lang.String msgID, java.lang.String locale, java.lang.Object... msgParams)
          Get the translated message.
protected  java.util.List<java.lang.String> getStringListProperty(java.lang.String propKey)
           
 Brand getSystemDefaultBrand()
          Getting the system default brand.
protected  com.nitido.nimx.services.brand.cache.CachedBrand getSystemDefaultCachedBrand()
          Get the system default cached brand object.
 java.lang.String getSystemDefaultLocale()
          Getting the system default locale string.
protected  java.util.Map<java.lang.String,java.lang.String> getUserAppPrefs(Entity user, java.lang.String appId)
          Retrieve properties for a single application from the user space.
protected  java.util.List<java.lang.String> getUserApps(Entity user)
          Get the list of application IDs configured in the user's profile.
protected  void init(NiMKernel kernel, ConfigurationService confService)
          This method is used to initialize the kernel service.
protected  void preloadLangBundles()
           
 
Methods inherited from class com.nitido.nim.BrandService
getBooleanPropertyWithDefault, getLongProperty, getLongPropertyWithDefault, getStringProperty, getStringPropertyWithDefault, loadLocaleMap, loadSysDefaultApps
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BrandServiceImpl

public BrandServiceImpl(NiMKernelServiceVisa visa)
Method Detail

init

protected void init(NiMKernel kernel,
                    ConfigurationService confService)
             throws InitializationFailedException,
                    NiMException
Description copied from class: NiMKernelService
This method is used to initialize the kernel service. Extenders of this class must implement this method.

Overrides:
init in class BrandService
Parameters:
kernel - Reference to the NiMKernel object that instantiated the service.
confService - A reference to the configuration service. All the service implementations (except ConfigurationService) should retrieve the setting information from it.
Throws:
InitializationFailedException - If unable to initialize the kernel service.
NiMException - If service initialization can not be done due to failure in establish a connection to the back-end service. Not all service implementation will throw this exception.

getStringListProperty

protected java.util.List<java.lang.String> getStringListProperty(java.lang.String propKey)

preloadLangBundles

protected void preloadLangBundles()

getUserAppPrefs

protected java.util.Map<java.lang.String,java.lang.String> getUserAppPrefs(Entity user,
                                                                           java.lang.String appId)
Retrieve properties for a single application from the user space.

Multivalue stored in LDAP for this user:

  • appId=mail,activated=true
  • appId=cal,activated=false
  • ...

    return value:

    Map of all the properties only for the mail app:

  • appid => mail
  • actiavted => true
  • ...

    Empty map signifies that no specific settings were available for this app.

    Parameters:
    user - the user
    appId - the application ID
    Returns:
    a map of zero or more key-value pairs that represent the user's personal preferences for this application

  • getUserApps

    protected java.util.List<java.lang.String> getUserApps(Entity user)
    Get the list of application IDs configured in the user's profile.

    NOTE: At the moment the presence of an "appId=name,key=val" in the user's profile is interpreted as that user having access to the application. So, in order to allow a user to access an application that might not be available for the brand all we need to do is place that string into their profile under the US_KEY_APP_LIST property.

    Parameters:
    user - the user
    Returns:
    a list of application IDs

    getBrand

    public Brand getBrand(NimletInput input,
                          Entity user)
    Determines which brand to use based on HttpNimletInput and user's pref.

    Specified by:
    getBrand in class BrandService
    Parameters:
    input - the current request's nimlet input object. If this brand object is required for an unauthenticated entity it may be left null.
    user - the current user
    Returns:
    the Brand object

    getDomainBrand

    public Brand getDomainBrand(java.lang.String domainID)
    Get the domain's default brand.

    Specified by:
    getDomainBrand in class BrandService
    Parameters:
    domainID - domain whose default brand is to be retrieved
    Returns:
    the default brand for a given domain, or the system default brand if the domain was not found

    doGetBrand

    protected Brand doGetBrand(java.lang.String domainID,
                               java.lang.String brandID,
                               Entity user,
                               NimletInput input)
    Parameters:
    domainID - domain for which the brand is being requested. If it is null the system default brand will be returned.
    brandID - user's active brand ID. If it is not found the domain's default brand will be returned
    user - the user for whom the brand is being retrieved. may be null
    input - the nimlet input. may be null
    Returns:
    Brand object

    getSystemDefaultBrand

    public Brand getSystemDefaultBrand()
    Description copied from class: BrandService
    Getting the system default brand. This method is called by NiM.getSystemDefaultBrand().

    Specified by:
    getSystemDefaultBrand in class BrandService

    getApplications

    public java.util.List<Application> getApplications(java.util.List<java.lang.String> brandApps,
                                                       Entity user)
    Get a list of application objects for a given list of application IDs. Each application object is loaded with the user's personal preferences for that app, if they have any.

    Specified by:
    getApplications in class BrandService
    Parameters:
    brandApps - the list of application IDs
    user - the user, if the user is null then applications are loaded, but no attempt to load personal preferences for that application is made
    Returns:
    list of application objects

    getMessage

    public java.lang.String getMessage(java.lang.String domainID,
                                       java.lang.String brandID,
                                       java.lang.String msgID,
                                       java.lang.String locale,
                                       java.lang.Object... msgParams)
    Get the translated message.

    Specified by:
    getMessage in class BrandService
    Parameters:
    domainID - the requesting user's domainID (used for fail over for
    brandID - the ID of the brand (this brand's dictionary will be used to retrieve the message) the error message)
    msgID - the ID of the message
    locale - the locale for which to retrieve this message
    msgParams - variable argument which can take an array of objects, or 1 or more objects, or not be supplied at all
    Returns:
    the text of the message in the specified locale

    getDefaultBrand

    protected Brand getDefaultBrand(java.lang.String domainID,
                                    Entity user)
    Get the system default brand.

    Parameters:
    user - the user for whom the brand is being retrieved
    Returns:
    the system default Brand

    getSystemDefaultCachedBrand

    protected com.nitido.nimx.services.brand.cache.CachedBrand getSystemDefaultCachedBrand()
    Get the system default cached brand object.

    Returns:
    the system default cached brand

    getDomainID

    public java.lang.String getDomainID(NimletInput input)
    Attempt to retrieve the name of the domain from which the request is being made.

    Parameters:
    input - the input
    Returns:
    domain name from which the request was made or null if one could not be determined.

    getSystemDefaultLocale

    public java.lang.String getSystemDefaultLocale()
    Description copied from class: BrandService
    Getting the system default locale string. This method should return a character string that represent the locale as defined in ISO 639. This string is usually a 2 character string.

    Specified by:
    getSystemDefaultLocale in class BrandService

    getDomainIDFromRequest

    protected java.lang.String getDomainIDFromRequest(javax.servlet.http.HttpServletRequest request)
    Get the domain name from an HTTP servlet request.

    Parameters:
    request - the request
    Returns:
    the domain name ( host from the request URL ) or null if one could not be determined

    Nitido NiM 2.5 Java API

    These JavaDoc pages are generated for release/nim_2_5-2.5.44

    Copyright © 1999-2009 Nitido Inc.    Proprietary and Confidential.    All Rights Reserved.