|
SAP NetWeaver 7.30 (SP02) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface IDestinationsService
This library enables retrival of all back-ends connection definitions which can be consumed via Connector Framework implementing connectors. The definition of how to connect to a back-end can be stored in various repository source like:
com.sap.portal.ivs.connectorservice in the portalapp.xml
references list and use:
IDestinationsService destinationsService = (IDestinationsService) PortalRuntime.getRuntimeResources().getService(IDestinationsService.KEY);To retrieve the service from other type of component, add to your component a reference to J2EE library
com.sap.portal.services.api and use:
IDestinationsService destinationsService = ServicesFactory.getDestinationService();Code sample of using this service:
String[] destinationNames;
String destinationName;
IDestinationWrapper destinationWrapper;
IConnection connection = null;
DestinationFilter destinationFilter1 = new DestinationFilter(DestinationFilter.SOURCE_PORTAL_SYSTEM_LANDSCAPE_SERVICE, DestinationFilter.TYPE_ALL);
DestinationFilter destinationFilter2 = new DestinationFilter(DestinationFilter.SOURCE_J2EE_DESTINATION_SERVICE, DestinationFilter.TYPE_SAP);
DestinationFilter[] destinationFilters = new DestinationFilter[] {destinationFilter1, destinationFilter2};
destinationNames = destinationsService.getDestinationNames(myUser, destinationFilters);
boolean hintAreCredentialsSet;
for (int i = 0; i < destinationNames.length; i++) {
destinationName = destinationNames[i];
try {
destinationWrapper = destinationsService.getDestinationWrapper(myUser, destinationName);
hintAreCredentialsSet = destinationWrapper.hintAreCredentialsSet(myUser);
if (hintAreCredentialsSet) {
connection = destinationsService.getConnection(myUser, destinationName);
} else {
// get credential (e.g. popup a logon window)
connection = destinationsService.getConnection(myUser, destinationName, "myUserName", "myPassword");
}
// consume the back-end
} catch (Exception e) {
// error handling
} finally {
if (connection != null) {
try {
connection.close();
} catch (ResourceException e1) {
// error handling
}
}
}
}
When this service needs to lookup for a destination retriever, or, get a
connection by a destination name, it searches its registered implementations
by the order they were registered.
getConnection(IUser, String, Map)
In cases where back-end require a language to connect with (e.g. SAP systems), the value is taken from IUser.getLocale().getLanguage() (default is "EN"). Client can override language value by using one of the overriding methods detailed below. This is a common case for portal scenarios where locale can be determined in various levels (portal component, portal runtime etc). The following code will set same language as portal locale would:
overridingConnectionSpecProps.put(IConnectionSpecMetaData.CONNECTION_PROPERTY_LANGUAGE, myPortalRequest.getLocale().getLanguage());
Client may create his own destination retriever source by implementing
AbstractDestinationsRetrieverSource
and registering it with registerDestinationSourceRetriever(AbstractDestinationsRetrieverSource).
| Field Summary | |
|---|---|
static String |
KEY
Constant for portal service KEY (portal application name + service name in portalapp.xml) |
static String |
SERVICE_JNDI_NAME
JNDI lookup name for this service (if using portal JNDI factory) |
| Method Summary | |
|---|---|
IConnection |
getConnection(com.sap.security.api.IUser user,
String destinationName)
Gets a connection to a back-end by its destination name. |
IConnection |
getConnection(com.sap.security.api.IUser user,
String destinationName,
DestinationFilter destinationFilter)
Gets a connection to a back-end by its destination name from matching the filter destination source and type. |
IConnection |
getConnection(com.sap.security.api.IUser user,
String destinationName,
DestinationFilter destinationFilter,
Map<String,Object> overridingConnectionSpecProps)
Gets Connector Framework connection to the back-end to a given destination name. |
IConnection |
getConnection(com.sap.security.api.IUser user,
String destinationName,
DestinationFilter destinationFilter,
String forcedUserName,
String forcedPassword)
Same as getConnection(IUser,String,String,String) with enforced filter |
IConnection |
getConnection(com.sap.security.api.IUser user,
String destinationName,
int enforceSource)
Deprecated. Use getConnection(IUser,String,DestinationFilter) |
IConnection |
getConnection(com.sap.security.api.IUser user,
String destinationName,
int enforceSource,
String forcedUserName,
String forcedPassword)
Deprecated. Use getConnection(IUser,String,DestinationFilter,String,String) |
IConnection |
getConnection(com.sap.security.api.IUser user,
String destinationName,
Map<String,Object> overridingConnectionSpecProps)
Gets Connector Framework connection to the back-end to a given destination name. |
IConnection |
getConnection(com.sap.security.api.IUser user,
String destinationName,
String forcedUserName,
String forcedPassword)
Gets Connector Framework connection to the back-end to a given destination name. |
IConnectionFactory |
getConnectionFactory(String jndiName)
Gets an instance of IConnectionFactory for a given JNDI name of
Connector Framework implementing connector |
String[] |
getDestinationNames(com.sap.security.api.IUser user)
Returens list of destination names of all supported types |
String[] |
getDestinationNames(com.sap.security.api.IUser user,
DestinationFilter[] destinationFilters)
Returens list of destination names matching given destination filters filters |
IDestinationWrapper |
getDestinationWrapper(com.sap.security.api.IUser user,
String destinationName)
Gets a destination wrapper by the destination name |
IDestinationWrapper |
getDestinationWrapper(com.sap.security.api.IUser user,
String destinationName,
DestinationFilter destinationFilter)
Gets a destination wrapper by the destination name matching the given filter |
AbstractDestinationsRetrieverSource |
getRegisteredDestinationSource(String key)
Returns a destination retriever source by its key |
List |
getRegisteredDestinationSourcesKeys()
Returns a list of registered destination source keys by the order they were registered |
void |
registerDestinationSourceRetriever(AbstractDestinationsRetrieverSource retrieverSource)
Registers a destination retriever source |
void |
unregisterDestinationSourceRetriever(String key)
Unregisters a destination retriever source |
| Field Detail |
|---|
static final String KEY
static final String SERVICE_JNDI_NAME
| Method Detail |
|---|
String[] getDestinationNames(com.sap.security.api.IUser user)
user - The user requesting the destinations list (some destinations source types require authentication to be get)
String[] getDestinationNames(com.sap.security.api.IUser user,
DestinationFilter[] destinationFilters)
user - The user requesting the destinations list (some destinations source types require authentication to be get)destinationFilters - filters array of destination source and type
e.g new DestinationFilter(IDestinationWrapper.SOURCE_PORTAL_SYSTEM_LANDSCAPE_SERVICE,
IDestinationWrapper.TYPE_SAP)
IConnection getConnection(com.sap.security.api.IUser user,
String destinationName,
int enforceSource)
throws PortalDestinationsServiceException
getConnection(IUser,String,DestinationFilter)
user - User for retrieving the connection todestinationName - name of the destination to get connection toenforceSource - the source of the destination (since same destination
name may exists on different sources)
PortalDestinationsServiceException
IConnection getConnection(com.sap.security.api.IUser user,
String destinationName,
DestinationFilter destinationFilter)
throws PortalDestinationsServiceException
user - User for retrieving the connection todestinationName - name of the destination to get connection todestinationFilter - Enforce to match destination retriever of specific source and specific back end type
PortalDestinationsServiceException
IConnection getConnection(com.sap.security.api.IUser user,
String destinationName)
throws PortalDestinationsServiceException
user - User for retrieving the connection todestinationName - name of the destination to get connection to
PortalDestinationsServiceException
IConnection getConnection(com.sap.security.api.IUser user,
String destinationName,
int enforceSource,
String forcedUserName,
String forcedPassword)
throws PortalDestinationsServiceException
getConnection(IUser,String,DestinationFilter,String,String)
getConnection(IUser,String,String,String) with enforced source
user - logged-on user to connect withdestinationName - the name of the destination to connect toenforceSource - the source of the destinationforcedUserName - user name to connect with to the back-endforcedPassword - password to connect with to the back-end
IConnection to the back-end
PortalDestinationsServiceException - when fail to get a connection
(e.g. no such destination name in the source repository, rejection from the
back-end etc)
IConnection getConnection(com.sap.security.api.IUser user,
String destinationName,
DestinationFilter destinationFilter,
String forcedUserName,
String forcedPassword)
throws PortalDestinationsServiceException
getConnection(IUser,String,String,String) with enforced filter
user - logged-on user to connect withdestinationName - the name of the destination to connect todestinationFilter - filter for the source, type and SAP typeforcedUserName - user name to connect with to the back-endforcedPassword - password to connect with to the back-end
IConnection to the back-end
PortalDestinationsServiceException - when fail to get a connection
(e.g. no such destination name in the source repository, rejection from the
back-end etc)
IConnection getConnection(com.sap.security.api.IUser user,
String destinationName,
String forcedUserName,
String forcedPassword)
throws PortalDestinationsServiceException
user - logged-on user to connect withdestinationName - the name of the destination to connect toforcedUserName - user name to connect with to the back-endforcedPassword - password to connect with to the back-end
IConnection to the back-end
PortalDestinationsServiceException - when fail to get a connection
(e.g. no such destination name in the source repository, rejection from the
back-end etc)
IConnection getConnection(com.sap.security.api.IUser user,
String destinationName,
Map<String,Object> overridingConnectionSpecProps)
throws PortalDestinationsServiceException
overridingConnectionSpecProps parameter. Clients
of this API should be familiar with the back-end connection spec, or, may discover the connection
spec using Connector Framework API via IConnectionSpecMetaData
user - logged-on user to connect withdestinationName - the name of the destination to connect tooverridingConnectionSpecProps - Map of connection spec keys and values to override back-end
connection spec as stored in the destination definition
IConnection to the back-end
PortalDestinationsServiceException
IConnection getConnection(com.sap.security.api.IUser user,
String destinationName,
DestinationFilter destinationFilter,
Map<String,Object> overridingConnectionSpecProps)
throws PortalDestinationsServiceException
overridingConnectionSpecProps parameter. Clients
of this API should be familiar with the back-end connection spec, or, may discover the connection
spec using Connector Framework API via IConnectionSpecMetaData
user - logged-on user to connect withdestinationName - the name of the destination to connect todestinationFilter - filter for the source, type and SAP typeoverridingConnectionSpecProps - Map of connection spec keys and values to override back-end
connection spec as stored in the destination definition
IConnection to the back-end
PortalDestinationsServiceException
IDestinationWrapper getDestinationWrapper(com.sap.security.api.IUser user,
String destinationName)
throws PortalDestinationsServiceException
destinationName - name of the destination
null if no
destination is matching the given name
PortalDestinationsServiceException
IDestinationWrapper getDestinationWrapper(com.sap.security.api.IUser user,
String destinationName,
DestinationFilter destinationFilter)
throws PortalDestinationsServiceException
destinationName - name of the destinationdestinationFilter - filter for the source and type
null if no
destination is matching the given name
PortalDestinationsServiceExceptionvoid registerDestinationSourceRetriever(AbstractDestinationsRetrieverSource retrieverSource)
retrieverSource - the source to registervoid unregisterDestinationSourceRetriever(String key)
key - the destination source keyList getRegisteredDestinationSourcesKeys()
StringAbstractDestinationsRetrieverSource getRegisteredDestinationSource(String key)
key - the destination retriever key
IConnectionFactory getConnectionFactory(String jndiName)
IConnectionFactory for a given JNDI name of
Connector Framework implementing connector
jndiName - JNDI name of the connector as its registered in the WebAS
IConnectionFactory instance| Access Rights |
|---|
| SC | DC | Public Part | ACH |
|---|---|---|---|
[sap.com] EP-CONNECTIVITY
|
[sap.com]
|
api
|
EP-VC-CON
|
[sap.com] EP-CONNECTIVITY
|
[sap.com] tc/ep/connectivity/api
|
api
|
EP-VC-CON
|
[sap.com] EP-CONNECTIVITY
|
[sap.com] tc/ep/connectivity/lib/api
|
api
|
EP-VC-CON
|
|
SAP NetWeaver 7.30 (SP02) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||