|
SAP NetWeaver 7.30 Enterprise Portal (SP03) | |||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||||
See:
Description
| Interface Summary | |
|---|---|
| ISystem | The interface that represents a system and its attributes. |
| ISystems | The interface for the system landscape service that provides helper methods for working with systems. |
| ISystemUserMappingData | The interface that provides user mapping properties for a specific system. |
Provides interfaces for managing systems.
The following interfaces are provided:
ISystem: Represents
the system semantic object and helps manage system aliases.
ISystems: Provides
helper methods for managing systems.
ISystemUserMappingData: Provides user
mapping data associated with a particular system. Each system is set of properties that represents a back-end system. The system semantic object holds the required data that is necessary to establish a connection to the back-end system.
The systems can be referenced using a friendly name - an alias. A system can have many aliases, but an alias can be associated to only one system. If many aliases are defined for a system, one of them is the default alias. The default alias is used to associate the system with unique information, such as user mapping.
In order to obtain an ISystem
instance, a system's PCD path must be resolved from an alias. This is done by calling
ISystems.getSystemId,
which returns the PCD
path of the system associated with a specified alias. A simple JNDI lookup can return
the ISystem instance.
The following are examples for using the package. In the examples, request is an IPortalComponentRequest object that obtains an IUserContext object for the JNDI lookup.
ISystem instance from alias "alias1"
import javax.naming.Context;
import com.sap.portal.pcm.system.ISystem;
import com.sap.portal.pcm.system.ISystems;
import com.sapportals.portal.pcd.gl.IPcdContext;
import com.sapportals.portal.prt.runtime.PortalRuntime;
import com.sap.portal.directory.Constants;
import com.sap.portal.pcm.admin.PcmConstants;
import com.sapportals.portal.prt.jndisupport.InitialContext;
ISystems systemSrv = (ISystems)PortalRuntime.getRuntimeResources().getService(ISystems.KEY);
String systemId= systemSrv.systemSrv.getSystemId("alias1");
Hashtable env =
new
Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY,IPcdContext.PCD_INITIAL_CONTEXT_FACTORY); env.put(IPcdContext.PCD_PERSONALIZATION_PRINCIPAL,
request.getUser()); env.put(Context.SECURITY_PRINCIPAL, request.getUser());
env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
InitialContext iCtx = null;
try
{
iCtx = new InitialContext(env);
ISystem result =(ISystem)iCtx.lookup(sysId);
//get system attributes
java.util.Enumeration enum =
result.getAttributeIds();
//get user mapping object
ISystemUserMappingData userMappingData =
result.getUserMappingData(user);
}catch(javax.naming.NamingException e)
The system will be created as delta link, where the source is the initial content JDBC system template. The folder to create the system is: portal_content/folder/system1.
import javax.naming.Context;
import com.sap.portal.pcm.system.ISystems;
import com.sapportals.portal.pcd.gl.IPcdContext;
import com.sapportals.portal.prt.runtime.PortalRuntime;
import com.sap.portal.directory.Constants;
import com.sapportals.portal.prt.jndisupport.InitialContext;
import com.sap.portal.pcm.INewObjectDescriptor;
//look up for the folder where the system should be put in
Hashtable env = new Hashtable();
env.put(Context.SECURITY_PRINCIPAL, request.getUser() );
InitialContext iCtx;
Context contentFolder = null;
Context folder = null;
try
{
iCtx = new InitialContext(env);
contentFolder =(Context)iCtx.lookup("portal_content");
folder = (Context)contentFolder.lookup("folder");
}catch (NamingException e)
{
folder = (Context)contentFolder.createSubcontext("folder");
}
//at this point "folder" points to the "portal_content/folder" path in the PCD
//create the system descriptor to bind
ISystems systems =
(ISystems)PortalRuntime.getRuntimeResources().getService(ISystems.KEY);
//create the system as a delta link over template
INewObjectDescriptor descriptor =
(INewObjectDescriptor)systems.instantiateDescriptor(CreateMethod.DELTA_LINK,"portal_content/com.sap.pct/templates/systems/com.sap.portal.JDBCConnectorSystem",
request.getUser());
//add some attributes
descriptor.putAttribute("Attribute1","valueForAttribute1");
folder.bind("system1",descriptor);
|
SAP NetWeaver 7.30 Enterprise Portal (SP03) | |||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||||