com.sap.portal.pcm.system
Interface ISystems

All Superinterfaces:
com.sap.portal.pcm.IObjectsManager

public interface ISystems
extends com.sap.portal.pcm.IObjectsManager


The Portal System Landscape is a set of systems.

Each system (set of properties) is a representation for an external application.

The systems allow iViews to connect to these applications and retrieve data from
them.
The systems can be referenced using a friendly name - an "Alias".
Each System can have many aliases but an alias can be associated with only one
System.
If aliases are defined for a system one of them is a "Default" alias.
Only one default alias is defined per system.
The default alias is used to associate the system with unique information like
User Mapping.


The ISystems interface provides various services to manipulate the system objects
in the PCD.

The service provides methods for the retrieval of an ISystem instance by a given alias.
In order to get the ISystem you must find out its URL. This can be obtained when
calling the "getSystemId(String)" method. The method returns a String that represents
the required System URL. Thus, a simple lookup will result with the ISystem instance.

Example: Extracting ISystem instance by alias "alias1", retrieving its properties
and getting user mapping object out of it.

 
 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 sysId = systemSrv.getSystemId("alias1");
 Hashtable env = new Hashtable();
 env.put(Context.SECURITY_PRINCIPAL, user);
  //for comprehensive aspect documentation please refer to the PCM documentation 
 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 
 		Enumeration enum = result.getAttributeIds();
 
               //get user mapping object 
              ISystemUserMappingData userMappingData = result.getUserMappingData(user);
 }catch(NamingException e)
 {
 		...
 }
 
 
 

Example: How to create a new ISystem as Delta link over JDBC template and write it
into the PCD using a user of IPortalComponentRequest.getUser().
PCD path to write the ISystem into: "portal_content/folder/system1"
Additional attribute to add to the ISystem: "Attribute1","valueForAttribute1"

import com.sap.portal.directory.Constants; import com.sap.portal.pcm.admin.PcmConstants; import com.sapportals.portal.prt.jndisupport.InitialContext; //look up for the folder where the system should be put in Hashtable env = new Hashtable(); env.put(Context.SECURITY_PRINCIPAL, user); 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);


Field Summary
static java.lang.String KEY
           
 
Method Summary
 java.lang.String[] getAliases()
          Retrieves all aliases from the PCD
 java.lang.String[] getAliases(com.sap.security.api.IPrincipal principal, boolean usePersonalized)
          Retrieves all alias names from the PCD.
 java.lang.String[] getDefaultAliases()
          Finds out all the default aliases in the PCD
 java.lang.String getSystemId(java.lang.String alias)
          Finds out the system Id by a given alias Dynamic resolving is supported here, so the method tried to retrieve the system id by a prt registered service first.
 boolean isDefaultAlias(java.lang.String alias)
          Finds out whether a given alias is a default
 
Methods inherited from interface com.sap.portal.pcm.IObjectsManager
getDefaultAttributes, instantiateDescriptor, instantiateDescriptor
 

Field Detail

KEY

public static final java.lang.String KEY
Method Detail

getDefaultAliases

public java.lang.String[] getDefaultAliases()
Finds out all the default aliases in the PCD
Returns:
String[] - Array of alias names

getAliases

public java.lang.String[] getAliases()
Retrieves all aliases from the PCD
Returns:
String[] - Array of alias names

getAliases

public java.lang.String[] getAliases(com.sap.security.api.IPrincipal principal,
                                     boolean usePersonalized)
Retrieves all alias names from the PCD.
Parameters:
principal - - User representation
usePersonalized - - Should the lookup be performed in personalized mode for the given user. true - Aliases pointing to systems that the given user has "end user" permissions will be returned. false - Aliases pointing to systems that the given user has "admin" permissions will be returned.
Returns:
String[] - Array of alias names

getSystemId

public java.lang.String getSystemId(java.lang.String alias)
Finds out the system Id by a given alias Dynamic resolving is supported here, so the method tried to retrieve the system id by a prt registered service first. If system is not found dynamically a default PCD resolution is performed
Parameters:
alias - - Alias by which to dynamically extract the system Id.
Returns:
string - identifier of a semantic system object
Throws:
AmbiguousAliasException - - when alias is defined both in the prt registry and in the pcd

isDefaultAlias

public boolean isDefaultAlias(java.lang.String alias)
Finds out whether a given alias is a default
Parameters:
alias - - To check if default
Returns:
boolean - "true" if given alias is default, "false" otherwise