Show TOC

 Starting a Collaboration Development ProjectLocate this document in the navigation structure

Use

In the initial phase of your development project, you need to add the following items required for Collaboration to the portal project:

  • Deployment descriptor specifying the applications accessed at runtime
  • For extensions only: Portal service
  • Optional: Prepare configuration structure and files

If you modify objects shipped by SAP, see Modifications and Comparisons with SPs Using the NWDI .

Procedure

1. Define the Deployment Descriptor

In the deployment descriptor of your project, you inform the portal runtime (PRT) about the components and services that your application needs to access at runtime. The deployment descriptor is the XML file portalapp.xml (see Deployment Descriptor (portalapp.xml) .

To specify components required at runtime:

  1. Find out the names of the portal applications that you need to reference in the portalapp.xml.

    You can derive these names from the DC names. Replace the / character with ~, for example, tc/km/frwk becomes tc~km~frwk.

    Note

    Examples of portal applications you often need to reference are: usermanagement or htmlb.

  2. Open the portalapp.xml file under dist\portal-inf
  3. Enter the following data:
    • application name

      Name of the portal archive file. This is the name that you assign to the EAR file that you deploy in the portal when you have completed your development project.

    • SharingReference

      Comma-separated list of portal applications whose API is accessed at runtime.

    The example below shows the entries in a portalapp.xml file.

    <?xml version="1.0" encoding="utf-8"?>
    <application name="com.sap.ides.kmc.samples">
      <application-config>
        <property name="startup" value="true"/>
        <property name="SharingReference" value="tc~km~frwk,tc~kmc~coll~util, … "/>
      </application-config>
      <components/>
      <services>
    </application>

2. For Extensions Only: Create a Portal Service

If you are developing an extension, you need to add a portal service to your project. The portal service ensures that the extension's class loader is registered with the configuration framework at startup. As a consequence, all components that are required for the execution of the extension are available at runtime for the KM component runtime (CRT). The CRT's class loader loads the classes dynamically using Java reflection mechanisms.

In the definition of the portal service, you implement a service wrapper class and then enter the service in the deployment descriptor. Only one implementation is required for each portal application and this is part of the private section of the portal application, otherwise, only the public classes from your portal application are visible in KMC.

The figure below shows the correlation between the registration of the class loader for an enterprise-specific extension and the ability of the KMC component runtime to read and initialize the extension.

You can implement the application either manually or using the correspondent wizard. For more information about how to use KMC wizards in SAP NetWeaver Developer Studio, see SAP Note 1572813.

Manual Implementation

  1. Create a portal service and extend com.sap.ip.collaboration.core.api.fwk.portal.GenericService
  2. Optional: If you need to register a ClassLoader other than your portal application, overwrite the registerClassLoader() method.
  3. Configure the portalapp.xml
    1. Make sure the SharingReference property contains tc~kmc~coll~util.
    2. Define the new portal service:
      <?xml version="1.0" encoding="utf-8"?>
      <application name="com.sap.ides.kmc.samples">
        <application-config>
          <property name="startup" value="true"/>
          <property name="SharingReference" value="tc~kmc~coll~util, … "/>
        </application-config>
        <components/>
        <services>
          <service name="MyService">
            <service-config>
              <property name="className" value="com.sap.ides.kmc.portalservicewrapper.PortalServiceWrapper"/>
              <property name="startup" value="true"/>
            </service-config>
            <service-profile>
              <property  name="generic_service_key" value="your service key"/>
              <property  name="generic_classloader_registration" value="yes"/>
              <property  name="generic_so_registration" value="no"/>
            </service-profile>
          </service>
        </services>
      </application>
       

      Explanation:

      • generic_service_key

        Specifies the name of the service.

      • generic_classloader_registration

        (YES/NO) Registers the service class loaderin the KMC framework.

      • generic_so_registration

        (YES/NO) Registers the semantic objects in the KM registry.

Wizard-Supported Implementation

  1. Create a service and implement a service wrapper class.

    You create a portal service with a plug-in in the SAP NetWeaver Developer Studio:

    1. Choose File → New → Other. Select Portal Application and choose Create a new Portal Application Object. Select your project and then choose Portal Service. Enter the name of the service and the name of the class, for example, RFServiceWrapper . The portal service is created automatically. It includes the following items:
      • The RFServiceWrapper class in the src.core directory
      • The IRFServiceWrapper interface in the src.api directory
    2. Open the IRFServiceWrapper interface and add a value for KEY: public static final String KEY = " com.customer.package.name";. The key is the identifier for the portal service.
    3. Open the RFServiceWrapper class and implement the init method with the following lines of code:
      import com.sapportals.wcm.crt.CrtClassLoaderRegistry;
       
      public void init(IServiceContext serviceContext){
        mm_serviceContext = serviceContext;
        CrtClassLoaderRegistry.addClassLoader(
          this.getKey(), this.getClass().getClassLoader()
        );
      }
  2. Enter the service in the deployment descriptor:
    1. Open the deployment descriptor dist\ portal-inf \portalapp.xml for your KMC component.
    2. Add the new service that you created as shown in the example below. To do this, add a service element that names the portal service and properties as follows:
      • service name

        Name that you assigned to the service. A fully-qualified portal service name is constructed as follows:<application name>.<portal service name> 

      • className

        Fully-qualified name of the class

      • startup

        Set to true to ensure that the portal runtime starts the service during startup and that the CRTClassLoader registration is executed automatically.

        <?xml version="1.0" encoding="utf-8"?>
        <application name="com.sap.ides.kmc.samples">
          <application-config>
            <property name="startup" value="true"/>
            <property name="SharingReference" value="tc~km~frwk,tc~kmc~coll~util, … "/>
          </application-config>
          <components/>
          <services>
            <service name="MyService">
              <service-config>
                <property name="className" value="com.sap.ides.kmc.portalservicewrapper.PortalServiceWrapper"/>
                <property name="startup" value="true"/>
              </service-config>
            </service>
          </services>
        </application>

3. Optional: Prepare Configuration

If the DC can be configured, you need to add the folder structure and the files that contain configuration information. (See Providing Business Configuration in the Enterprise Knowledge Management developer's guide.)

Result

The portal service interacts with the portal runtime as follows:

  • When you start up the portal, the portal service is started automatically by the portal runtime (PRT) because <property name="startup" value="true"/>is set in the deployment descriptor.
  • The PRT calls the init() method of the class implemented in the portal service and specified by <property name="className" …>.
  • The init() method registers its class loader with the component runtime of the repository framework.