com.ibm.websphere.wim.client

Class LocalServiceProvider

  • java.lang.Object
    • com.ibm.websphere.wim.client.LocalServiceProvider
  • All Implemented Interfaces:
    LocalService, ConfigConstants, ConfigService, DynamicConfigConstants, DynamicConfigService, ProfileService, SchemaConstants, SchemaService, Service


    public class LocalServiceProvider
    extends java.lang.Object
    implements LocalService
    Implementation class for LocalService interface. It can be used by remote client to access EJB service of virtual member manager. It helps a remote client to do the following:
    • Looking up virtual member manager EJB Home and create a EJB instance.
    • During the creation of LocalServiceProvider, it will retrieve the schema packages related to virtual member manager and register them at the client if they are not there . The schema packages includes build-in schema, extended schema and configuration schema.
    • Re-retrieve and register schema packages when schema is changed by calling createSchema API method.
    • Field Detail

      • PROVIDER_URL

        public static final java.lang.String PROVIDER_URL
        The key to pass in the provider URL information. The value should follow the format: corbaloc:iiop:: , for example: "corbaloc:iiop:localhost:2809".
        See Also:
        Constant Field Values
      • EJB_JNDI_NAME

        public static final java.lang.String EJB_JNDI_NAME
        The key to pass in the EJB JNDI name of virtual member manager. The parameter is only needed if the EJB JNDI name is different from default: ""ejb/com/ibm/websphere/wim/ejb/WIMServiceHome".
        See Also:
        Constant Field Values
    • Constructor Detail

      • LocalServiceProvider

        public LocalServiceProvider()
                             throws WIMException
        Creates a new instance of LocalServiceProiver which talks with local virtual member manager service.
        Throws:
        WIMException - Exceptions thrown by virtual member manager service.
      • LocalServiceProvider

        public LocalServiceProvider(java.util.Hashtable environment)
                             throws WIMException,
                                    javax.naming.NamingException,
                                    CreateException,
                                    java.rmi.RemoteException
        Creates a new instance of LocalServiceProvider which talks with remote virtual member manager EJB service. The input Hashtable parameter can contain the following key/value paires
        • providerURL (PROVIDER_URL) - The provider URL. The value should follow the format: corbaloc:iiop:: , for example: "corbaloc:iiop:localhost:2809".
        • ejbJNDIName (EJB_JNDI_NAME) - The JNDI name of virtual member manager EJB. The parameter is only needed if the EJB JNDI name is different from default: ""ejb/com/ibm/websphere/wim/ejb/WIMServiceHome".
        • Other JNDI environment properties - These environment properties will be passed to InitialContext constructor for looking up EJB.
        Parameters:
        environment - The Hashtable which contains the parameters Following are the keys and values which can be put in this Hashtable.
        • PROVIDER_URL - The provider URL with the format: corbaloc:iiop::. For example "corbaloc:iiop:localhost:2809". If this parameter is not specified, LocalServiceProvider will talks with local virtual member manager service.
        • EJB_JNDI_NAME - The JNDI name of the virtual member manager Service EJB. If this parameter is not specified, default value is ejb/com/ibm/websphere/wim/ejb/WIMServiceHome.
        If the Hashtable is null, LocalServiceProvider will talks with local virtual member manager.
        Throws:
        WIMException - Exceptions thrown by virtual member manager service.
        javax.naming.NamingException - Naming exception thrown when looking up EJB using JNDI.
        CreateException - Create exception when creating virtual member manager EJB.
        java.rmi.RemoteException - Remote exception when calling virtual member manager EJB remotely.
    • Method Detail

      • createRootDataObject

        public DataObject createRootDataObject()
                                        throws WIMException,
                                               java.rmi.RemoteException
        Description copied from interface: SchemaService
        Creates an empty root data object of virtual member manager. All entity, control and context data objects should be contained under the root data object.
        For example, the following code creates a Person data object and adds it under the root data object.
         DataObject root = service.getRootDataObject();
         DataObject person = root.createDataObject("entities", "http://www.ibm.com/websphere/wim", "Person");
         
        The root data object can be used by client applications to build the input data object. An obvious use is to build input data object for creating entity through the create API.
        Specified by:
        createRootDataObject in interface SchemaService
        Throws:
        WIMException
        java.rmi.RemoteException
      • getSchemaPackage

        public EPackage getSchemaPackage(java.lang.String nsURI)
                                  throws WIMException
        Description copied from interface: LocalService
        Returns the schema package from the given namespace URI. For example, to return build-in schema package of virtual member manager, the namespace URI is "http://www.ibm.com/websphere/wim" (SchemaConstants.WIM_NS_URI). to return build-in configuration schema package of virtual member manager, the namespace URI is "http://www.ibm.com/websphere/wim/config ((ConfigConstants.WIM_CONFIG_NS_URI)".
        Specified by:
        getSchemaPackage in interface LocalService
        Parameters:
        nsURI - The name space URI of the schema package.
        Throws:
        WIMException - Exceptions thrown by virtual member manager service .
      • getEPackages

        public byte[] getEPackages(java.lang.String nsURI)
                            throws WIMException,
                                   java.rmi.RemoteException
        Description copied from interface: SchemaService
        Returns the schema package from the given namespace URI in byte array form. For example, to return build-in schema package of virtual member manager, the namespace URI is "http://www.ibm.com/websphere/wim" (SchemaConstants.WIM_NS_URI). to return build-in configuration schema package of virtual member manager, the namespace URI is "http://www.ibm.com/websphere/wim/config ((ConfigConstants.WIM_CONFIG_NS_URI)". Byte array form of the schema package can be converted back to the EPackage form. The EPackage provides the vehicle for describing the schema of data graph. Since byte array is serializable, this method can be used by remote clients to retrieve schema packages from service and register them in the local JVM.
        Specified by:
        getEPackages in interface SchemaService
        Parameters:
        nsURI - The name space URI of the schema package. If nsURI is null, all schema packages related to virtual member manager will be returned, including build-in schema packge and custom schema packages.
        Throws:
        WIMException
        java.rmi.RemoteException
      • createSchema

        public DataObject createSchema(DataObject root)
                                throws WIMException,
                                       java.rmi.RemoteException
        Description copied from interface: SchemaService
        Creates the schema of new entity types and property types at runtime.
        Specified by:
        createSchema in interface SchemaService
        Parameters:
        root - The input root data object which contains the information of the new entity and property types. A schema data object is needed under root which contains PropertySchema or EntitySchema.

        A sample data graph for createSchema:

         <Root>
          <schema>>
           <propertySchema nsPrefix="yourext" nsURI="http://www.yourco.com/yourext" dataType="String"
             multiValued="true" propertyName="cellPhone6">
           <applicableEntityTypeNames>Person</applicableEntityTypeNames>
           <metaData name="repositoryPropertyName3">
             <values>cellularTelephoneNumber3</values>
           </metaData>
          </propertySchema>
          </schema>
         </Root>
         
        For detail, please refer to the developer guideline.
        Throws:
        WIMException
        java.rmi.RemoteException
      • getSchema

        public DataObject getSchema(DataObject root)
                             throws WIMException,
                                    java.rmi.RemoteException
        Description copied from interface: SchemaService
        Retrieves the schema of entity types and property types.
        Specified by:
        getSchema in interface SchemaService
        Parameters:
        root - The input root data object which contains the request controls. One of the following control is needed in the input data graph.
      • DataTypeControl: retrieve the supported data types. If repositoryId is not specified, the supported data types at virtual member manager level will be returned.
      • ExtensionPropertyDataTypeControl: retrieve the supported data types of the property extension repository
      • EntityTypeControl: retrieve the Entity schema
      • PropertyDefinitionControl: retrieve the property schema. If repositoryId is not specified, the virtual member manager level schema will be returned. EntityTypeName is mandatory. If no properties specified, the schema for all supported properties will be returned.
      • ExtensionPropertyDefinitionControl: retrieve property schema of the property extension repository.
      • A sample data graph for getSchema:

         <?xml version="1.0" encoding="UTF-8"?>
         <sdo:datagraph xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns="http://www.ibm.com/websphere/wim" xmlns:sdo="commonj.sdo">
         <Root>
          <controls xsi:type="PropertyDefinitionControl" repositoryId="LDAP1" entityTypeName="PersonAccount"/>
         </Root>
         </sdo:datagraph>
         
        Refer to the developer guideline for detail.
        Throws:
        WIMException
        java.rmi.RemoteException
      • createDataObject

        public DataObject createDataObject(java.lang.String uri,
                                  java.lang.String typeName)
                                    throws WIMException,
                                           java.rmi.RemoteException
        Description copied from interface: SchemaService
        Creates an empty data object of the given name space URI and type name.
        Specified by:
        createDataObject in interface SchemaService
        Parameters:
        uri - The name space URI of the type.
        typeName - The name of the type.
        Throws:
        WIMException
        java.rmi.RemoteException
      • create

        public DataObject create(DataObject root)
                          throws WIMException,
                                 java.rmi.RemoteException
        Description copied from interface: ProfileService
        Creates the entity under the given root data object. This method is used for creating an entity. Empty root data object can be obtained from createRootDataObject API. The entity needed to be created can be added under the root data object along with the properties.
        The output root data object of the create method contains the created entity data object which contains its identifier.
        Specified by:
        create in interface ProfileService
        Parameters:
        root - The root data object which contains the entity to be created.
        Throws:
        WIMException
        java.rmi.RemoteException
      • get

        public DataObject get(DataObject root)
                       throws WIMException,
                              java.rmi.RemoteException
        Description copied from interface: ProfileService
        Returns information of the specified entity or entities. The entity or entities to be retrieved are added under the root data object. Controls can be added under the root data object to specify what kind of information is returned. The entity or entities to be retrieved need to be added under the root data object with the identifiers specified. By specifying different controls, different information can be returned. For example, PropertyControl is used for returning the properties of the entity/entities. GroupMembershipControl is used for returning groups the entity/entities belongs to.
        Specified by:
        get in interface ProfileService
        Parameters:
        root - The root data object containing the request information.
        Throws:
        WIMException
        java.rmi.RemoteException
      • delete

        public DataObject delete(DataObject root)
                          throws WIMException,
                                 java.rmi.RemoteException
        Description copied from interface: ProfileService
        Deletes the entity specified in the root data object. Only one entity can be delete at one time.
        Specified by:
        delete in interface ProfileService
        Parameters:
        root - The root data object which contains the entity to delete. The identifier of the entity should be specified.
        Throws:
        WIMException
        java.rmi.RemoteException
      • update

        public DataObject update(DataObject root)
                          throws WIMException,
                                 java.rmi.RemoteException
        Description copied from interface: ProfileService
        Updates entity specified in the root data object. There are two ways to update. The caller can create a empty root data object and specify the changes needed. All the changes will replace the existing values. The caller can also call get API method to get the values to be updated, make the changes, then send back to update.
        Specified by:
        update in interface ProfileService
        Parameters:
        root - The root data object containing entity with changes need to update.
        Throws:
        WIMException
        java.rmi.RemoteException
      • search

        public DataObject search(DataObject root)
                          throws WIMException,
                                 java.rmi.RemoteException
        Description copied from interface: ProfileService
        Searches the profile repositories for entities matching the given search expression and returns them with the requested properties. The search method is used to search entities. Only the entities which match the search expression will be returned. The following four controls are related to search: SearchControl, PageControl, SortControl, PageResponseControl, and SortResponseControl. The SearchControl contains the property name list which you want to return from the search operation. For example, you want to get uid, cn for all the people whose sn equals to "Doe". The search expression is also included in the SearchControl. If you want to use the paged search function, the PageControl is needed.
        Specified by:
        search in interface ProfileService
        Parameters:
        root - the root data object containing the control(s) related to search.
        Throws:
        WIMException
        java.rmi.RemoteException
      • login

        public DataObject login(DataObject root)
                         throws WIMException,
                                java.rmi.RemoteException
        Description copied from interface: ProfileService
        Authenticates the LoginAccount data object in the specified root data object. User can be authenticated either using loginId/password or using X509Certificate. The successfully authenticated LoginAccount data object will be returned with requested properties specified in the LoginControl.
        Specified by:
        login in interface ProfileService
        Parameters:
        root - the root data object containing the LoginAccount to authenticate.
        Throws:
        WIMException
        java.rmi.RemoteException
      • getConfigEPackage

        public byte[] getConfigEPackage()
                                 throws WIMException,
                                        java.rmi.RemoteException
        Description copied from interface: ConfigService
        Returns the DataGraph schema of virtual member manager configuration model in byte array. ResourceSet can be used to convert the byte array to an EMF EPackage. The EPackage provides the vehicle for describing the DataGraph schema.
        Specified by:
        getConfigEPackage in interface ConfigService
        Throws:
        WIMException
        java.rmi.RemoteException
      • getConfig

        public DataObject getConfig()
                             throws WIMException,
                                    java.rmi.RemoteException
        Description copied from interface: ConfigService
        Gets all configuration data defined in virtual member manager configuration file. The returned data object is 'configurationProvider'. It contains all configuration data defined in virtual member manager configuration file.
        Specified by:
        getConfig in interface ConfigService
        Throws:
        WIMException - java.rmi.RemoteException
        java.rmi.RemoteException
      • dynamicUpdateConfig

        public void dynamicUpdateConfig(java.lang.String updateEvent,
                               java.util.Hashtable configData)
                                 throws WIMException,
                                        java.rmi.RemoteException
        Description copied from interface: DynamicConfigService
        Dynamically update configuration at runtime. The changes are only applied to the configuration model in memory. Configuration file will not be updated. For information on the available update events and their input parameters, please refer to DynamicConfigConstants
        Specified by:
        dynamicUpdateConfig in interface DynamicConfigService
        Parameters:
        updateEvent - The type of the configuration update.
        configData - The Hashtable which contains the data used for this type of configuration update.
        Throws:
        WIMException - DynamicUpdateConfigException and other WIMException specific to each event type.
        java.rmi.RemoteException
        See Also:
        DynamicConfigConstants