2. Creating the Physical Data Service for the LDAP Sample This page last changed on Jun 19, 2008. .stickable, h1, h2, h3, h4, h5 false true Show Sticky notes Hide Sticky notes sticky_configuringtheldapserverinformation sticky_associatingcustomconditionallogicwithfunctions sticky_aldspapplicationdevelopmentbestpractices sticky_configuringthesampleapplicationtousetheembeddedldapserver sticky_acloserlook Save Cancel edocs Home > BEA AquaLogic Data Services Platform 3.0/3.2 Documentation > ALDSP 3.2 New Features Documentation ## How To Create the Physical Data Service for the LDAP Sample This topic describes how to create a physical data service based on the LDAP sample application. #### Topic Map How To Create the Physical Data Service for the LDAP Sample Installing the ALDSP Retail Dataspace Sample Importing JAR Files Creating the Physical Data Service Update the Procedure Declaration Next Step Related Topics Supporting LDAP Server Entries Through Data Services ## Installing the ALDSP Retail Dataspace Sample If it is not already running, launch Studio. If you have not already done so, install the ALDSP Retail Dataspace Sample. The sample creates a dataspace for retail data services that connects to a relational database and web services.
   | Depending on whether your are running WebLogic server 10.1 or 9.2 see: Configure the Retail Dataspace Sample Application for ALDSP 3.2 Configure the Retail Dataspace Sample Application for ALDSP 3.01
### Importing JAR Files Two separate import operations into the Retail Dataspace project are needed.
Import Source | Contents
--- | ---
Spring LDAP 1.2.1 JAR | Basic LDAP support classes.
`ldap_java.jar` | Java functions needed by the new physical data service.
| If you have not already done so, unzip the project ZIP file `LdapJavaDsp32.zip` into a temporary directory. The project files are located in the `LdapJavaDsp32` directory.
#### Importing Spring LDAP JAR Files To import the Spring LDAP JAR files which were included with the LDAP sample: Expand the Retail Dataspace project and locate the `DSP-INF/lib` folder. Project Explorer - DSP-INF/lib Folder Right-click the `DSP-INF/lib` folder and choose Import. Select General > File System and click Next. Import Source Dialog For the `From directory` field click Browse, select the `LdapJavaDsp32/lib` folder, and click OK. Importing the Spring LDAP JAR Files Click the checkbox next to `lib` to select all JAR files in the library; then click Finish. The wizard imports the selected JAR files. #### Importing the `ldap_java.jar File` The ldap_java.jar file contains Java functions for your new physical data service. To import the `ldap_java.jar` file: Right-click the `DSP-INF/lib` folder and choose Import. Select General > File System, then Next. For the `From directory` field click Browse, select the `LdapJavaDsp32/dist` folder, and click OK. Importing the ldap_java.jar File Click the checkbox next to `dist`, then click Finish. The wizard imports the `ldap_java.jar` file. ### Creating the Physical Data Service You need to create the physical data service that uses Java functions to facilitate data access.
| You can inspect the Java functions; they are in the `DspLdapWrapper.java` file.
4. To create the physical data service: In the Project Explorer right-click RetailDataspace/Physical, and choose New > Physical Data Service. Creating a New Physical Data Service Choose Java Function from the Data source type drop-down list. Click Browse next to the Class name field. The Open Java Class dialog appears. Navigate to:
       ldap_java/com/example/ldap/DspLdapWrapper.class
7. Click Open. Open Java Class Click Next. Select all functions except:
       {{main(java.lang.String)}}
11. Select the `updatePersonSDO()` function Select the With Change Summary checkbox. Select Java Function Click Next. Configure the settings in the Review New/Updated Data Service Operation(s) step, as shown in the following table:
    Operation | Public | Kind | Primary
    `updatePersonXMLBean` | Yes | Update |
    `updatePersonSDO` | Yes | Update |
    `deletePerson` | Yes | Delete | Yes
    `createPerson` | Yes | Create | Yes
    `getPersonByUserId` | Yes | Read |
    `getAllPersons` | Yes | Read |
13. Review New/Updated Data Service Operation(s) Click Next. Type a Data Service Name, such as:
        LDAPdsp
Click Finish. ### Update the Procedure Declaration The procedure declaration generated by the New Physical Data Service Wizard needs to be modified.
| This step is a workaround for CR365986 in the import wizard. Once you make these code changes to correctly list inetOrgPerson it will work correctly and will treat the function as a primary update procedure.
3. To update the procedure declaration: Double-click the data service in the Project Explorer. Click the Source tab. Update the pragma of the `updatePersonSDO()` procedure to set the operation as primary, as shown in the following:
       <f:function xmlns:f="urn:annotations.ld.bea.com" visibility="public" kind="update" isPrimary="true" nativeName="updatePersonSDO">
4. Update the declaration for the `updatePersonSDO()` procedure to match the following (make sure the namespace prefix matches your source):
       declare procedure f1:updatePersonSDO($x1 as changed-element(t1:inetOrgPerson)*) as empty() external;
Choose File > Save from the main menu. Redeploy the project. You can now perform create, read, update and delete (CRUD) operations against an LDAP server. For example, in Test view you can run the getAllPersons() operation. ##### Testing the getAllPersons() LDAP Operation You can also optionally create new logical data services that combine this physical data service with other data services, such as RDBMS, Web Services, and so on. ### Next Step Testing an LDAP-Based Operation ### Related Topics ##### Concepts Supporting LDAP Server Entries Through Data Services ##### How Tos Building a Java LDAP Application Testing an LDAP-Based Operation Creating a Physical Data Service from a Java Function - Generic Description

Document generated by Confluence on Nov 26, 2008 13:06