| java.lang.Object com.sun.ssoadapter.SSOAdapterFactory
SSOAdapterFactory | public class SSOAdapterFactory implements SSOAdapterConstants(Code) | | This is a simplified framework for creating Connections to different Backend
It has Java APIs to store/retrieve connetion related configurations and create Connections to different backend.
This class is a Java interface to create and cache instances of SSOAdapter/Connection objects.
These APIs depends on AM Session and Service. This requires the AM SDK APIs to be available with in the webapp.
An SSOAdapterFactory is associated with the following:
- An AM service: SSOAdapterConstant.SERVICE_NAME . This AM service has
- ATTR_TEMPLATES_NAME as a Global Attribute: known as SSOAdapterTemplate
- ATTR_CONFIGURATIONS_NAME as a dynamic Attribue: known as SSOAdapterConfiguration
- ATTR_CONFIGURATIONS_NAME as a User Attribute
These attributes in the above service stores the configuration information, which are stored as multiple URLs.
An Example of sunConfigurationTemplates as a Global Attribute
default|undef:///?configName=GENERIC_TEMPLATE&encoded=password&default=protocol&....
default|imap:///?configName=SUN-ONE-MAIL&encoded=password&default=protocol&....
default|http:///?configName=SUN-ONE-CALENDAR&encoded=password&default=protocol&.....
.....
An Example of SSOAdapterConfiguration as a Dynamic Attribute.
default|imap:///?configName=sunOneMail&configDesc=SUN-ONE-MAIL&port=143&smtpPort=25
default|http:///?configName=sunOneCalendar&configDesc=SUN-ONE-CALENDAR
......
An Example of SSOAdapterConfiguration as the User attribue.
sunSSOAdapterConfigurations: default|undef://b:AQIC%3D@plato.red.iplanet.com:143/?configName=sunOneMail_Mail&configDesc=SUN-ONE-MAIL....
sunSSOAdapterConfigurations: default|undef://b:AQIC%3D@plato.red.iplanet.com:82/?configName=sunOneCalendar_Calendar&configDesc=SUN-ONE-CALENDAR....
The SSOAdapterFactory has the mechanisms to obtain an instance of SSOAdapter when provided with a ConfigName and SSOAdapterSession.
PreRequiste:
- Write your own Java Class which extends SSOAdapter and implements all the required methods
- Create a SSOAdapterTemplate, Either by AdminConsole or Using amadmin/psadmin Commands and provide the above derived java className as "ssoClassName"
- Create a SSOAdapterConfiguration, Either by AdminConsole or using amadmin/psadmin Command
- The AM SDK's jar files are available inside webapp. (as it is placed in the webContainer classpath)
- This ssoadapter.jar is also available inside the webapp (as it is placed in the webContainer classpath)
Usage: It can be used Inside a Portlet/Provider
/To Get
HttpServletRequest httpReq = (HttpServletRequest)request.getAttribute("javax.portlet.portletc.httpServletRequest");
SSOAdapterSession = new SSOAdapterSession(httpReq);
SSOAdapterFactory factory = SSOAdapterFactory.getInstance();
PortletPreferences pref = request.getPreferences();
String ssoAdapterName = pref.getValue("ssoAdapter","sunOneMail");
SSOAdapter ssoAdapter = factory.getSSOAdapter(ssoAdapterName , session );
Properties props = ssoAdapter.getProperties();
Object obj = newSSOAdapter.getConnection();
if ( object != null ) {
//Cast it to your known type and invoke the APIs on it.
}
//To Edit & Save
props.setProperty("channelName", "MyPersonalMailChannel");
SSOAdapter newSSOAdapter = factory.setSSOAdapter(ssoAdapter, props , session );
version: 1.0 See Also: com.sun.ssoadapter.SSOAdapter See Also: com.sun.ssoadapter.SSOAdapterException See Also: com.sun.ssoadapter.SSOAdapterConstants |
ATTR_CONFIGURATIONS_NAME | final public static String ATTR_CONFIGURATIONS_NAME(Code) | | SSO Adapter Attribute for Configurations
|
ATTR_TEMPLATES_NAME | final public static String ATTR_TEMPLATES_NAME(Code) | | SSO Adapter Attribute for Templates
|
GENERIC_SSOADAPTER_CLASS | final public static String GENERIC_SSOADAPTER_CLASS(Code) | | Generic SSOAdapter implementation class
|
SERVICE_NAME | final public static String SERVICE_NAME(Code) | | SSO Adapter Service Name
|
ssoAdapterInstance | protected static SSOAdapterFactory ssoAdapterInstance(Code) | | Reference to SSOAdapterFactory instance
|
getConfigurationNames | public Enumeration getConfigurationNames(SSOAdapterSession session)(Code) | | Gets all the Configurations defined for the session
Parameters: session - a SSOAdapterSession an enumeration of all the configs |
getInstance | public static SSOAdapterFactory getInstance()(Code) | | Returns an instance of SSOAdapterFactory.
SSOAdapterFactory instance |
getSSOAdapter | public SSOAdapter getSSOAdapter(String configName, SSOAdapterSession session) throws SSOAdapterException(Code) | | Returns an SSOAdapter object of the appropriate configuration and of the specified
instanceName.
If "configName" is not specified, then the first configuration found
will be used.
The "instanceName" parameter provides a means of selectively
sharing (or not), a particular instance of an SSOAdapter amongst
cooperating sections of code. If two sections of code specify the
same instanceName, then they will receive the same SSOAdapter instance.
If they each specify different names, each will receive an instance
of an SSOAdapter unique to that instanceName.
Once an SSOAdapter is instantiated, it is stored in a cache within
this SSOAdapterFactory. All future invocations of this method
requesting an SSOAdapter of this particular configuration will be retrieved
from the cache. The SSOAdapter will be "uninitialized" and removed
from the cache when the user's session is terminated.
ssoAdapter: an instance of SSOAdapter Parameters: session - a SSOAdapterSession Parameters: configName - The name of the configuration to which an SSOAdaptershould be bound. throws: com.sun.ssoadapter.SSOAdapterException - incase of failure |
setSSOAdapter | public SSOAdapter setSSOAdapter(SSOAdapter immutableAdapter, Properties newProperties, SSOAdapterSession session) throws SSOAdapterException(Code) | | This method either generates a new SSOAdapter if one does not exist or updates
the existing SSOAdapter. The SSOAdapter is referenced by the Channel/Provider's
'ssoAdapter' display profile property which is used to match the Service Configurations
'configName'
an instance of SSOAdapter Parameters: session - a SSOAdapterSession Parameters: immutableAdapter - The immutable SSOAdapter object to update Parameters: newProperties - SSOAdapter Properties to update throws: com.sun.ssoadapter.SSOAdapterException - incase of failure |
|
|