Show TOC Start of Content Area

Procedure documentation Starting a KM Development Project Locate the document in its SAP Library structure

Purpose

When you begin development, in a preparatory phase, you need to enhance the portal project with items required for KM. If no wizard is available to automatically perform this task, you need to proceed manually. This involves:

      Definition of the deployment descriptor for the portal application. This is an XML file that specifies the portal components and services that the application has to access at runtime.

      For extensions only: Definition of a portal service.

      Optionally: Creation of folder structure for configuration
For a component that can be configured, you need to add the folder structure and files that contain information for the configuration.
For more information, see Providing Business Configuration.

 

Procedure

...

Defining the Deployment Descriptor

When you run your new KM component in the portal, it needs to access various portal applications. You use the deployment descriptor in the project to inform the portal runtime (PRT) of these applications. The deployment descriptor is the XML file portalapp.xml that is located in the project under dist\WEB-INF

To specify components required at runtime:

       1.      Find out the names of the portal applications you need to reference.

For Knowledge Management, you reference the xxx tc/km/frwk and tc/km/nonwdui
For Portal applications, you identify the name of the applications in the
application name element of the corresponding portalapp.xml file. You can find the file by navigating to the deployed package on the portal.

Note

Examples of portal applications that you often need to reference are: User management, HTMLB, JCO and the portal navigation service.

       2.      Open the portalapp.xml file under dist\WEB-INF

       3.      Enter the following data:

application name
Name of the portal archive file. This is the name you assign to the PAR 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 shows the entries in a portalapp.xml file.

 

<?xml version="1.0" encoding="utf-8"?>

<application name="com.sap.ides.kmc.samples" alias="com.sap.ides.kmc.samples">

  <application-config>

    <property name="SharingReference" value="com.sap.portal.runtime.config, com.sap.portal.runtime.config.component, usermanagement, tc~km~frwk, tc~km~nonwdui, com.sap.portal.ivs.connectorservice"/>

  </application-config>

  <components/>

  <services/>

</application>

 

Extensions Only: Creating a Portal Service

If you are developing an extension without using a wizard, you add a portal service to your project. The purpose of the service is to ensure that the extension’s class loader is registered with the repository framework at startup. As a consequence, at runtime, all components that are required for the execution of the extension will be available for the KM component runtime (CRT). The CRTs class loader loads the classes dynamically using Java reflection mechanisms.

To implement the portal service, you:

     Create a portal service and implement a service wrapper class

     Enter the service in the deployment descriptor

Caution

If you are developing an extension with a wizard, you must check whether a value for the KEY is entered in the IRFServiceWrapperinterface as described below.

Creating a Service and Implementing a Service Wrapper Class

You create a portal service with a plugin 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 automatically created. It includes the following items:

     The class RFServiceWrapper in the src.core directory

     The interface IRFServiceWrapper in the src.api directory

       2.      Open the IRFServiceWrapperinterface 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 RFServiceWrapperclass 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()
  );
}
Entering the Service in the Deployment Descriptor

Open the deployment descriptor dist\web-inf\portalapp.xml for your KMC component. Add the new service 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 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 at startup and that the CRTClassLoader registration is executed automatically.

 

Adding a Service to the Deployment Descriptor

 

<?xml version="1.0" encoding="utf-8"?>
<application name="com.sap.ides.kmc.samples" alias="com.sap.ides.kmc.samples">
  <application-config>
    <property name="releasable" value="false"/>
    <property name="startup" value="true"/>
    <property name="ClassLoadingPolicy" value="CoreAccessInAPI,transitive"/>
    <property name="DeploymentPolicy" value="5.0"/>    
    <property name="SharingReference" value="com.sap.portal.runtime.
     config, com.sap.portal.runtime.config.component, usermanagement,
     tc~km~frwk, tc~km~nonwdui, com.sap.portal.ivs.connectorservice"/>
  </application-config>
  <components/>
  <services>
    <service name="RFServiceWrapper">
      <service-config>
        <property name="className" value="com.sap.ides.kmc.portalservicewrapper.PortalServiceWrapper"/>
        <property name="startup" value="true"/>
      </service-config>
    </service>
  </services>
</application>

 

Result

The portal service interacts with the portal runtime as follows:

     When you start up the portal, the portal service is automatically started 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.

End of Content Area