Virtual member manager is configured to use either the dynamic model or the static model. You can create at runtime new entity types, new property types and add existing or new property types to the new entity types.
You need to call the virtual member manager createSchema API to create new entity types, new property types and add existing or new property types to the new entity types at runtime without restarting virtual member manager. Out-of-the-box, both the LDAP Adapter and the DB Adapter supports this type of procedure. For this example you want to create a new entity type called ContactPerson which extends from the virtual member manager built-in entity type Person. You also want to create a new property type called cellPhone and add this property type to this entity type. This example uses the LDAP Adapter.
Perform the following:
On the client side, the exploiting virtual member manager application calls the virtual member manager createSchema API through the Local Service Provider. Local Service Provider detects that this call changes the schema and updates the local schema (ECore) after the createSchema API call is finished.
On the server side, the Schema Manager receives the API call from client. The Schema Manager first checks if the new entity types and property types already exist and throws an exception if they do. Then the Schema Manager creates a new ECore model (EPackage) with namespace URI (http://www.yourco.com/wim/yourext) if it does not already exist. Then it will add the schema of the new entity types and property types to the ECore model in the memory.
<?xml version="1.0" encoding="UTF-8"?> <sdo:datagraph xmlns:sdo="commonj.sdo" xmlns:wim="http://www.ibm.com/websphere/wim"> <wim:schema> <wim:entitySchema nsPrefix="yourext" nsURI="http://www.yourco.com/wim/yourext" entityName="ContactPerson" parentEntityName="Person"/> <wim:propertySchema nsURI="http://www.yourco.com/yourext" dataType="STRING" multiValued="true" propertyName="cellPhone" valueLength="256"> <wim:applicableEntityTypeNames>ContactPerson</wim:applicableEntityTypeNames> </wim:propertySchema> </wim:schema> </sdo:datagraph>The Schema Manager then calls Configuration Manager.
<config:supportedEntityTypes defaultParent="cn=users,dc=yourco,dc=com" name="yourext:ContactPerson"> <config:rdnProperties>uid</config:rdnProperties> </config:supportedEntityTypes> <config:repositories xsi:type="config:LdapRepositoryType" ...> <config:EntityTypesNotAllowDelete>yourext:ContactPerson</config:EntityTypesNotAllowDelete> <config:ldapEntityTypes name="yourext:ContactPerson"> <config:rdnAttributes name="uid"/> <config:objectClasses>eContactPerson</config:objectClasses> <config:objectClassesForCreate>eContactPerson</config:objectClassesForCreate> <config:objectClassesForCreate>inetOrgPerson</config:objectClassesForCreate> </config:ldapEntityTypes> </config:repositories>The Schema Manager then calls the Repository Manager.
If one or more repository adapters throws the OperationNotSupportedException when creating new properties from the createSchema SPI, the Schema Manager calls the Property Extension Adapter to create this property in the Property Extension database. If a Property Extension Adapter is not configured, virtual member manager throws the exception to the exploiting application.
If at least one repository adapter supports creating new entities and does not throw the OperationNotSupportedException, Virtual member manager returns the repository IDs of these repositories in the output data graph.
At the client side, after the createSchema API call is returned, the Local Service Provider calls the getEPackages API to retrieve the latest schemas. The Local Service Provider reregisters the schemas in the client JVM. Exploiting applications can call the virtual member manager create API to create a new entity of type ContactPerson with property cellPhone. Virtual member manager does not need to restart for the schema change to become active.