
In the initial phase of your development project, you need to add the following items required for Collaboration to the portal project:
If you modify objects shipped by SAP, see Modifications and Comparisons with SPs Using the NWDI .
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:
You can derive these names from the DC names. Replace the / character with ~, for example, tc/km/frwk becomes tc~km~frwk.
Examples of portal applications you often need to reference are: usermanagement or htmlb.
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.
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
<?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:
Specifies the name of the service.
(YES/NO) Registers the service class loaderin the KMC framework.
(YES/NO) Registers the semantic objects in the KM registry.
Wizard-Supported Implementation
You create a portal service with a plug-in in the SAP NetWeaver Developer Studio:
import com.sapportals.wcm.crt.CrtClassLoaderRegistry;
public void init(IServiceContext serviceContext){
mm_serviceContext = serviceContext;
CrtClassLoaderRegistry.addClassLoader(
this.getKey(), this.getClass().getClassLoader()
);
}Name that you assigned to the service. A fully-qualified portal service name is constructed as follows:<application name>.<portal service name>
Fully-qualified name of the class
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.)
The portal service interacts with the portal runtime as follows: