Class ConnectedAssetClientBase
java.lang.Object
org.odpi.openmetadata.frameworkservices.ocf.metadatamanagement.client.ConnectedAssetClientBase
- All Implemented Interfaces:
ConnectorFactoryInterface
- Direct Known Subclasses:
AssetConsumer
,AssetOwnerBaseClient
,ConnectedAssetClient
,ConnectedAssetClient
,ConnectedAssetClient
,ConnectedAssetClient
,ConnectedAssetClient
,ConnectedAssetClient
,ConnectedAssetClient
,ConnectedAssetClient
,ConnectedAssetClient
,ConnectedAssetClient
,ConnectedAssetClient
,ConnectedAssetClient
,ConnectedAssetClient
,ConnectedAssetClient
,ConnectedAssetClient
,ConnectedAssetClient
,ConnectedAssetClient
ConnectedAssetClientBase provides a base calls for clients that support an OCF interface.
In particular, it manages the retrieval of connections for assets, and the creation of connectors.
-
Field Summary
Modifier and TypeFieldDescriptionprotected AuditLog
protected InvalidParameterHandler
protected static NullRequestBody
protected String
protected String
-
Constructor Summary
ConstructorDescriptionConnectedAssetClientBase
(String serverName, String serverPlatformURLRoot, String serviceURLMarker) Create a new client with no authentication embedded in the HTTP request.ConnectedAssetClientBase
(String serverName, String serverPlatformURLRoot, String serviceURLMarker, int maxPageSize, AuditLog auditLog) Create a new client with no authentication embedded in the HTTP request.ConnectedAssetClientBase
(String serverName, String serverPlatformURLRoot, String serviceURLMarker, String userId, String password) Create a new client that passes userId and password in each HTTP request.ConnectedAssetClientBase
(String serverName, String serverPlatformURLRoot, String serviceURLMarker, String userId, String password, AuditLog auditLog) Create a new client that passes userId and password in each HTTP request.ConnectedAssetClientBase
(String serverName, String serverPlatformURLRoot, String serviceURLMarker, AuditLog auditLog) Create a new client with no authentication embedded in the HTTP request. -
Method Summary
Modifier and TypeMethodDescriptiongetAnchorAssetFromGUID
(String userId, String guid) Returns the anchor asset.protected String
getAssetForConnection
(OCFRESTClient restClient, String serviceName, String userId, String connectionGUID) Returns the unique identifier for the asset connected to the requested connection.getAssetProperties
(String userId, String assetGUID) Returns a comprehensive collection of properties about the requested asset.protected Asset
getAssetSummary
(String userId, String guid, String methodName) Return the basic properties of an asset.protected Connection
getConnectionByGUID
(OCFRESTClient restClient, String serviceName, String userId, String guid) Returns the connection corresponding to the supplied connection GUID.protected Connection
getConnectionByName
(OCFRESTClient restClient, String serviceName, String userId, String name) Returns the connection object corresponding to the supplied connection name.getConnectionForAsset
(OCFRESTClient restClient, String serviceName, String userId, String assetGUID) Returns the connection corresponding to the supplied asset GUID.getConnectorByConnection
(String userId, Connection connection) Returns the connector corresponding to the supplied connection.getConnectorByGUID
(String userId, String connectionGUID) Returns the connector corresponding to the supplied connection GUID.getConnectorByName
(String userId, String connectionName) Returns the connector corresponding to the supplied connection name.getConnectorForAsset
(String userId, String assetGUID) Returns the connector corresponding to the supplied asset GUID.getConnectorForAsset
(String userId, String assetGUID, AuditLog auditLog) Returns the connector corresponding to the supplied asset GUID.protected Connector
getConnectorForConnection
(OCFRESTClient restClient, String serviceName, String userId, Connection requestedConnection, String methodName) Use the Open Connector Framework (OCF) to create a connector using the supplied connection.void
logAssetAuditMessage
(String userId, String assetGUID, String serviceName, String message) Log an audit message about this asset.saveConnection
(String userId, String assetGUID, Connection connection) Returns the unique identifier corresponding to the supplied connection.saveConnection
(String userId, Connection connection) Returns the unique identifier corresponding to the supplied connection.
-
Field Details
-
serverName
-
serverPlatformURLRoot
-
auditLog
-
invalidParameterHandler
-
nullRequestBody
-
-
Constructor Details
-
ConnectedAssetClientBase
public ConnectedAssetClientBase(String serverName, String serverPlatformURLRoot, String serviceURLMarker, AuditLog auditLog) throws InvalidParameterException Create a new client with no authentication embedded in the HTTP request.- Parameters:
serverName
- name of the server to connect toserverPlatformURLRoot
- the network address of the server running the OCF REST servicesserviceURLMarker
- indicator of the OMAS that this client is supportingauditLog
- destination for log messages- Throws:
InvalidParameterException
- there is a problem creating the client-side components to issue any REST API calls.
-
ConnectedAssetClientBase
public ConnectedAssetClientBase(String serverName, String serverPlatformURLRoot, String serviceURLMarker, int maxPageSize, AuditLog auditLog) throws InvalidParameterException Create a new client with no authentication embedded in the HTTP request.- Parameters:
serverName
- name of the server to connect toserverPlatformURLRoot
- the network address of the server running the OCF REST servicesmaxPageSize
- maximum page size for this processserviceURLMarker
- indicator of the OMAS that this client is supportingauditLog
- destination for log messages- Throws:
InvalidParameterException
- there is a problem creating the client-side components to issue any REST API calls.
-
ConnectedAssetClientBase
public ConnectedAssetClientBase(String serverName, String serverPlatformURLRoot, String serviceURLMarker) throws InvalidParameterException Create a new client with no authentication embedded in the HTTP request.- Parameters:
serverName
- name of the server to connect toserverPlatformURLRoot
- the network address of the server running the OCF REST servicesserviceURLMarker
- indicator of the OMAS that this client is supporting- Throws:
InvalidParameterException
- there is a problem creating the client-side components to issue any REST API calls.
-
ConnectedAssetClientBase
public ConnectedAssetClientBase(String serverName, String serverPlatformURLRoot, String serviceURLMarker, String userId, String password, AuditLog auditLog) throws InvalidParameterException Create a new client that passes userId and password in each HTTP request. This is the userId/password of the calling server. The end user's userId is sent on each request.- Parameters:
serverName
- name of the server to connect toserverPlatformURLRoot
- the network address of the server running the OCF REST servicesserviceURLMarker
- indicator of the OMAS that this client is supportinguserId
- caller's userId embedded in all HTTP requestspassword
- caller's userId embedded in all HTTP requestsauditLog
- destination for log messages- Throws:
InvalidParameterException
- there is a problem creating the client-side components to issue any REST API calls.
-
ConnectedAssetClientBase
public ConnectedAssetClientBase(String serverName, String serverPlatformURLRoot, String serviceURLMarker, String userId, String password) throws InvalidParameterException Create a new client that passes userId and password in each HTTP request. This is the userId/password of the calling server. The end user's userId is sent on each request.- Parameters:
serverName
- name of the server to connect toserverPlatformURLRoot
- the network address of the server running the OCF REST servicesserviceURLMarker
- indicator of the OMAS that this client is supportinguserId
- caller's userId embedded in all HTTP requestspassword
- caller's userId embedded in all HTTP requests- Throws:
InvalidParameterException
- there is a problem creating the client-side components to issue any REST API calls.
-
-
Method Details
-
getAssetSummary
protected Asset getAssetSummary(String userId, String guid, String methodName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Return the basic properties of an asset.- Parameters:
userId
- calling userguid
- unique identifier of assetmethodName
- calling method- Returns:
- Asset bean
- Throws:
InvalidParameterException
- the name is invalidPropertyServerException
- there is a problem access in the property serverUserNotAuthorizedException
- the user does not have access to the properties
-
getAssetProperties
public AssetUniverse getAssetProperties(String userId, String assetGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Returns a comprehensive collection of properties about the requested asset.- Parameters:
userId
- userId of user making request.assetGUID
- unique identifier for asset.- Returns:
- a comprehensive collection of properties about the asset.
- Throws:
InvalidParameterException
- one of the parameters is null or invalid.PropertyServerException
- there is a problem retrieving the asset properties from the property servers).UserNotAuthorizedException
- the requesting user is not authorized to issue this request.
-
getConnectorForConnection
protected Connector getConnectorForConnection(OCFRESTClient restClient, String serviceName, String userId, Connection requestedConnection, String methodName) throws ConnectionCheckedException, ConnectorCheckedException Use the Open Connector Framework (OCF) to create a connector using the supplied connection. The connector is initialized by not started.- Parameters:
restClient
- client that calls REST APIsserviceName
- calling serviceuserId
- calling userrequestedConnection
- connection describing the required connectormethodName
- name of the calling method.- Returns:
- a new connector.
- Throws:
ConnectionCheckedException
- there are issues with the values in the connectionConnectorCheckedException
- the connector had an operational issue accessing the asset.
-
getConnectionByGUID
protected Connection getConnectionByGUID(OCFRESTClient restClient, String serviceName, String userId, String guid) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Returns the connection corresponding to the supplied connection GUID.- Parameters:
restClient
- client that calls REST APIsserviceName
- name of the calling serviceuserId
- userId of user making request.guid
- the unique id for the connection within the metadata repository.- Returns:
- connection instance.
- Throws:
InvalidParameterException
- one of the parameters is null or invalid.PropertyServerException
- there is a problem retrieving information from the property server(s).UserNotAuthorizedException
- the requesting user is not authorized to issue this request.
-
getConnectionByName
protected Connection getConnectionByName(OCFRESTClient restClient, String serviceName, String userId, String name) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Returns the connection object corresponding to the supplied connection name.- Parameters:
restClient
- client that calls REST APIsserviceName
- name of the calling serviceuserId
- String - userId of user making request.name
- this is the qualifiedName of the connection.- Returns:
- Connection retrieved from property server.
- Throws:
InvalidParameterException
- one of the parameters is null or invalid.PropertyServerException
- there is a problem retrieving information from the property (metadata) server.UserNotAuthorizedException
- the requesting user is not authorized to issue this request.
-
logAssetAuditMessage
public void logAssetAuditMessage(String userId, String assetGUID, String serviceName, String message) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Log an audit message about this asset.- Parameters:
userId
- the userId of the requesting user.assetGUID
- unique identifier for the asset.serviceName
- name of survey servicemessage
- message to log- Throws:
InvalidParameterException
- one of the parameters is null or invalid.PropertyServerException
- there is a problem retrieving the asset properties from the property servers).UserNotAuthorizedException
- the requesting user is not authorized to issue this request.
-
getConnectionForAsset
public Connection getConnectionForAsset(OCFRESTClient restClient, String serviceName, String userId, String assetGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Returns the connection corresponding to the supplied asset GUID.- Parameters:
restClient
- client that calls REST APIsserviceName
- name of the calling serviceuserId
- userId of user making request.assetGUID
- the unique id for the asset within the metadata repository.- Returns:
- connector instance.
- Throws:
InvalidParameterException
- one of the parameters is null or invalid.PropertyServerException
- there is a problem retrieving information from the property server(s).UserNotAuthorizedException
- the requesting user is not authorized to issue this request.
-
getAssetForConnection
protected String getAssetForConnection(OCFRESTClient restClient, String serviceName, String userId, String connectionGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Returns the unique identifier for the asset connected to the requested connection.- Parameters:
restClient
- initialized client for calling REST APIs.serviceName
- name of the calling service.userId
- the userId of the requesting user.connectionGUID
- unique identifier for the connection.- Returns:
- unique identifier of asset.
- Throws:
InvalidParameterException
- one of the parameters is null or invalid.PropertyServerException
- there is a problem retrieving information from the property server.UserNotAuthorizedException
- the requesting user is not authorized to issue this request.
-
getAnchorAssetFromGUID
public Asset getAnchorAssetFromGUID(String userId, String guid) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Returns the anchor asset.- Parameters:
userId
- the userId of the requesting user.guid
- unique identifier for the metadata element.- Returns:
- the anchor asset.
- Throws:
InvalidParameterException
- one of the parameters is null or invalid.PropertyServerException
- there is a problem retrieving information from the property server.UserNotAuthorizedException
- the requesting user is not authorized to issue this request.
-
saveConnection
public String saveConnection(String userId, Connection connection) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ConnectionCheckedException, ConnectorCheckedException Returns the unique identifier corresponding to the supplied connection.- Parameters:
userId
- calling userconnection
- the connection object that contains the properties needed to create the connection.- Returns:
- guid
- Throws:
InvalidParameterException
- one of the parameters is null or invalid.ConnectionCheckedException
- there are errors in the configuration of the connection which is preventing the creation of a connector.ConnectorCheckedException
- there are errors in the initialization of the connector.PropertyServerException
UserNotAuthorizedException
-
saveConnection
public String saveConnection(String userId, String assetGUID, Connection connection) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ConnectionCheckedException, ConnectorCheckedException Returns the unique identifier corresponding to the supplied connection.- Parameters:
userId
- calling userassetGUID
- the unique identifier of an asset to attach the connection toconnection
- the connection object that contains the properties needed to create the connection.- Returns:
- guid
- Throws:
InvalidParameterException
- one of the parameters is null or invalid.ConnectionCheckedException
- there are errors in the configuration of the connection which is preventing the creation of a connector.ConnectorCheckedException
- there are errors in the initialization of the connector.PropertyServerException
UserNotAuthorizedException
-
getConnectorByName
public Connector getConnectorByName(String userId, String connectionName) throws InvalidParameterException, ConnectionCheckedException, ConnectorCheckedException, PropertyServerException, UserNotAuthorizedException Returns the connector corresponding to the supplied connection name.- Specified by:
getConnectorByName
in interfaceConnectorFactoryInterface
- Parameters:
userId
- userId of user making request.connectionName
- this may be the qualifiedName or displayName of the connection.- Returns:
- connector instance - or null if there is no connection
- Throws:
InvalidParameterException
- one of the parameters is null or invalid.ConnectionCheckedException
- there are errors in the configuration of the connection which is preventing the creation of a connector.ConnectorCheckedException
- there are errors in the initialization of the connector.PropertyServerException
- there is a problem retrieving information from the property server(s).UserNotAuthorizedException
- the requesting user is not authorized to issue this request.
-
getConnectorForAsset
public Connector getConnectorForAsset(String userId, String assetGUID) throws InvalidParameterException, ConnectionCheckedException, ConnectorCheckedException, PropertyServerException, UserNotAuthorizedException Returns the connector corresponding to the supplied asset GUID.- Specified by:
getConnectorForAsset
in interfaceConnectorFactoryInterface
- Parameters:
userId
- userId of user making request.assetGUID
- the unique id for the asset within the metadata repository.- Returns:
- connector instance - or null if there is no connection
- Throws:
InvalidParameterException
- one of the parameters is null or invalid.ConnectionCheckedException
- there are errors in the configuration of the connection which is preventing the creation of a connector.ConnectorCheckedException
- there are errors in the initialization of the connector.PropertyServerException
- there is a problem retrieving information from the property server(s).UserNotAuthorizedException
- the requesting user is not authorized to issue this request.
-
getConnectorForAsset
public Connector getConnectorForAsset(String userId, String assetGUID, AuditLog auditLog) throws InvalidParameterException, ConnectionCheckedException, ConnectorCheckedException, PropertyServerException, UserNotAuthorizedException Returns the connector corresponding to the supplied asset GUID.- Specified by:
getConnectorForAsset
in interfaceConnectorFactoryInterface
- Parameters:
userId
- userId of user making request.assetGUID
- the unique id for the asset within the metadata repository.auditLog
- optional logging destination- Returns:
- connector instance - or null if there is no connection
- Throws:
InvalidParameterException
- one of the parameters is null or invalid.ConnectionCheckedException
- there are errors in the configuration of the connection which is preventing the creation of a connector.ConnectorCheckedException
- there are errors in the initialization of the connector.PropertyServerException
- there is a problem retrieving information from the property server(s).UserNotAuthorizedException
- the requesting user is not authorized to issue this request.
-
getConnectorByGUID
public Connector getConnectorByGUID(String userId, String connectionGUID) throws InvalidParameterException, ConnectionCheckedException, ConnectorCheckedException, PropertyServerException, UserNotAuthorizedException Returns the connector corresponding to the supplied connection GUID.- Specified by:
getConnectorByGUID
in interfaceConnectorFactoryInterface
- Parameters:
userId
- userId of user making request.connectionGUID
- the unique id for the connection within the metadata repository.- Returns:
- connector instance - or null if there is no connection
- Throws:
InvalidParameterException
- one of the parameters is null or invalid.ConnectionCheckedException
- there are errors in the configuration of the connection which is preventing the creation of a connector.ConnectorCheckedException
- there are errors in the initialization of the connector.PropertyServerException
- there is a problem retrieving information from the property server(s).UserNotAuthorizedException
- the requesting user is not authorized to issue this request.
-
getConnectorByConnection
public Connector getConnectorByConnection(String userId, Connection connection) throws InvalidParameterException, ConnectionCheckedException, ConnectorCheckedException Returns the connector corresponding to the supplied connection.- Specified by:
getConnectorByConnection
in interfaceConnectorFactoryInterface
- Parameters:
userId
- userId of user making request.connection
- the connection object that contains the properties needed to create the connection.- Returns:
- connector instance
- Throws:
InvalidParameterException
- one of the parameters is null or invalid.ConnectionCheckedException
- there are errors in the configuration of the connection which is preventing the creation of a connector.ConnectorCheckedException
- there are errors in the initialization of the connector.
-