public class IGCRestClient extends Object
registerPOJO(Class)| Modifier | Constructor and Description |
|---|---|
protected |
IGCRestClient(String baseURL,
String authorization)
Creates a new session on the server and retains the cookies to re-use the same session for the life
of the client (or until the session times out); whichever occurs first.
|
|
IGCRestClient(String baseURL,
String user,
String password)
Creates a new session on the server and retains the cookies to re-use the same session for the life
of the client (or until the session times out); whichever occurs first.
|
|
IGCRestClient(String host,
String port,
String user,
String password)
Default constructor used by the IGCRestClient.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cacheTypeDetails(String typeName)
Cache detailed information about the IGC object type.
|
String |
create(IGCCreate igcCreate)
Create the object described by the provided create object.
|
File |
createOpenIgcBundleFile(File directory)
Generates an OpenIGC bundle zip file from the provided directory path, and returns the temporary file it creates.
|
boolean |
delete(String rid)
Delete the object specified by the provided RID.
|
boolean |
deleteOpenIgcAsset(String assetXML)
Delete using the provided OpenIGC asset XML: deleting the asset(s) specified within it.
|
boolean |
detectLineage(String jobRid)
Run lineage detection against the provided job (by RID).
|
void |
disconnect()
Disconnect from IGC REST API and invalidate the session.
|
<T extends Reference> |
getAllPages(String propertyName,
ItemList<T> list)
Retrieve all pages of results from a set of Paging details and items, or if there is no next page return the
items provided.
|
List<String> |
getAllPropertiesForType(String typeName)
Retrieve the names of all properties for the provided IGC object type, or null if the type is unknown.
|
List<String> |
getAllStringPropertiesForType(String typeName)
Retrieve the names of all string properties for the provided IGC object type, or null if the type is unknown.
|
Reference |
getAssetById(String rid)
Retrieve all information about an asset from IGC.
|
Reference |
getAssetById(String rid,
ObjectCache cache)
Retrieve all information about an asset from IGC.
|
Reference |
getAssetRefById(String rid)
Retrieve only the minimal unique properties of an asset from IGC.
|
<T extends Reference> |
getAssetWithSubsetOfProperties(String rid,
String assetType,
List<String> properties)
This will generally be the most performant method by which to retrieve asset information, when only
some subset of properties is required
|
<T extends Reference> |
getAssetWithSubsetOfProperties(String rid,
String assetType,
List<String> properties,
int pageSize)
This will generally be the most performant method by which to retrieve asset information, when only
some subset of properties is required
|
<T extends Reference> |
getAssetWithSubsetOfProperties(String rid,
String assetType,
String[] properties)
This will generally be the most performant method by which to retrieve asset information, when only
some subset of properties is required
|
<T extends Reference> |
getAssetWithSubsetOfProperties(String rid,
String assetType,
String[] properties,
int pageSize)
This will generally be the most performant method by which to retrieve asset information, when only
some subset of properties is required
|
String |
getBaseURL()
Retrieve the base URL of this IGC REST API connection.
|
int |
getDefaultPageSize()
Retrieve the default page size for this IGC REST API connection.
|
String |
getDisplayNameForType(String typeName)
Retrieve the display name of this IGC object type.
|
static String |
getEncodedPathVariable(String pathVariable)
Calculate a path-encoded URL for the provided endpoint.
|
IGCVersionEnum |
getIgcVersion()
Retrieve the version of the IGC environment (static member VERSION_115 or VERSION_117).
|
<T extends Reference> |
getModificationDetails(T object,
ObjectCache cache)
Ensures that the modification details of the asset are populated (takes no action if already populated or
the asset does not support them).
|
<T extends Reference> |
getNextPage(String propertyName,
ItemList<T> list)
Retrieve the next page of results for the provided parameters.
|
List<String> |
getNonRelationshipPropertiesForType(String typeName)
Retrieve the names of all non-relationship properties for the provided IGC object type, or null if the type is
unknown.
|
List<String> |
getOpenIgcBundles()
Retrieve the set of OpenIGC bundles already defined in the environment.
|
List<String> |
getPagedRelationshipPropertiesForType(String typeName)
Retrieve the names of all paged relationship properties for the provided IGC object type, or null if the type is
unknown.
|
Class<?> |
getPOJOForType(String assetType)
Returns the POJO that is registered to serde the provided IGC asset type, preferring any that have been
registered or defaulting to the out-of-the-box ones if there are no overrides.
|
Object |
getPropertyByName(Reference object,
String property)
Retrieve a property of an IGC object based on the property's name.
|
TypeDetails |
getTypeDetails(String typeName)
Retrieves the type details (all properties and their details) for the provided type name in IGC.
|
TypeDetails |
getTypeDetails(String typeName,
boolean view,
boolean create,
boolean edit)
Retrieves the type details (requested properties and their details) for the provided type name in IGC.
|
List<TypeHeader> |
getTypes(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Retrieves the list of metadata types supported by IGC.
|
String |
getValueAsJSON(Reference asset)
Attempt to convert the provided IGC object into JSON, based on the registered POJOs.
|
boolean |
hasModificationDetails(String typeName)
Indicates whether assets of this type include modification details (true) or not (false).
|
boolean |
isCreatable(String typeName)
Indicates whether the IGC object type can be created (true) or not (false).
|
static boolean |
isEmbeddedAssetRid(String rid)
Indicates whether the provided Repository ID (RID) represents an embedded asset (true) or not (false).
|
static boolean |
isVirtualAssetRid(String rid)
Indicates whether the provided Repository ID (RID) represents a virtual asset (true) or not (false).
|
Boolean |
isWorkflowEnabled()
Returns true iff the workflow is enabled in the environment against which the REST connection is defined.
|
String |
makeCreateRequest(String endpoint,
org.springframework.http.HttpMethod method,
org.springframework.http.MediaType contentType,
String payload)
General utility for making creation requests.
|
String |
makeRequest(String endpoint,
org.springframework.http.HttpMethod method,
org.springframework.http.MediaType contentType,
String payload)
General utility for making requests.
|
<T extends Reference> |
readJSONIntoItemList(String json)
Attempt to convert the JSON string into an ItemList.
|
<T extends Reference> |
readJSONIntoPOJO(String json)
Attempt to convert the JSON string into a Java object.
|
void |
registerPOJO(Class<?> clazz)
Register a POJO as an object to handle serde of JSON objects.
Note that this MUST be done BEFORE any object mapping (translation) is done! In general, you'll want your POJO to extend at least the Reference object, and more likely the InformationAsset (for your own OpenIGC object), or if you are adding custom attributes to one of the native asset types, consider directly changing that bean. |
<T extends Reference> |
search(IGCSearch igcSearch)
Retrieve all assets that match the provided search criteria from IGC.
|
void |
setDefaultPageSize(int pageSize)
Set the default page size for this IGC REST API connection.
|
boolean |
start()
Start the client by trying to connect based on the configured parameters.
|
boolean |
update(IGCUpdate igcUpdate)
Apply the update described by the provided update object.
|
boolean |
uploadFile(String endpoint,
org.springframework.http.HttpMethod method,
org.springframework.core.io.AbstractResource file)
General utility for uploading binary files.
|
String |
upsertOpenIgcAsset(String assetXML)
Upload the provided OpenIGC asset XML: creating the asset(s) if they do not exist, updating if they do.
|
boolean |
upsertOpenIgcBundle(String name,
org.springframework.core.io.AbstractResource file)
Upload the specified bundle, creating it if it does not already exist or updating it if it does.
|
public IGCRestClient(String host, String port, String user, String password) throws IGCConnectivityException
host - the services (domain) tier hostport - the services (domain) tier port numberuser - the username with which to open and retain the sessionpassword - the password for the userIGCConnectivityException - if there is any issue connecting to IGCpublic IGCRestClient(String baseURL, String user, String password) throws IGCConnectivityException
baseURL - the base URL of the domain tier of Information Serveruser - the username with which to open and retain the sessionpassword - the password of the userIGCConnectivityException - if there is any issue connecting to IGCprotected IGCRestClient(String baseURL, String authorization) throws IGCConnectivityException
baseURL - the base URL of the domain tier of Information Serverauthorization - the Basic-encoded authorization string to use to login to Information ServerIGCConnectivityException - if there is any issue connecting to IGCpublic boolean start()
throws IGCConnectivityException,
IGCParsingException
IGCConnectivityException - if there is any issue connecting to IGCIGCParsingException - if there is any issue parsing a response from IGCpublic <T extends Reference> T readJSONIntoPOJO(String json) throws IGCParsingException
T - the type of POJO into which to readjson - the JSON string to convertIGCParsingException - if the attempt to read the JSON failspublic <T extends Reference> ItemList<T> readJSONIntoItemList(String json) throws IGCParsingException
T - the type of items that should be in the ItemListjson - the JSON string to convertItemList<T>IGCParsingException - if the attempt to read the JSON failspublic String getValueAsJSON(Reference asset) throws IGCParsingException
asset - the IGC asset to convertIGCParsingException - if the attempt to read the JSON failspublic IGCVersionEnum getIgcVersion()
public String getBaseURL()
public int getDefaultPageSize()
public void setDefaultPageSize(int pageSize)
pageSize - the new default page size to usepublic static boolean isVirtualAssetRid(String rid)
rid - the Repository ID (RID) to checkpublic static boolean isEmbeddedAssetRid(String rid)
rid - the Repository ID (RID) to checkpublic boolean uploadFile(String endpoint, org.springframework.http.HttpMethod method, org.springframework.core.io.AbstractResource file) throws IGCConnectivityException
endpoint - the REST resource against which to upload the filemethod - HttpMethod (POST, PUT, etc)file - the Spring FileSystemResource or ClassPathResource containing the file to be uploadedIGCConnectivityException - if there is any connectivity issue during the uploadpublic String makeRequest(String endpoint, org.springframework.http.HttpMethod method, org.springframework.http.MediaType contentType, String payload) throws IGCConnectivityException
endpoint - the REST resource against which to make the requestmethod - HttpMethod (GET, POST, etc)contentType - the type of content to expect in the payload (if any)payload - if POSTing some content, the JSON structure providing what should be POSTedIGCConnectivityException - if there is any connectivity issue during the requestpublic String makeCreateRequest(String endpoint, org.springframework.http.HttpMethod method, org.springframework.http.MediaType contentType, String payload) throws IGCConnectivityException
endpoint - the REST resource against which to make the requestmethod - HttpMethod (POST, PUT, etc)contentType - the type of content to expect in the payloadpayload - the data that should be createdIGCConnectivityException - if there is any connectivity issue during the requestpublic List<TypeHeader> getTypes(com.fasterxml.jackson.databind.ObjectMapper objectMapper) throws IGCConnectivityException, IGCParsingException
objectMapper - an ObjectMapper to use for translating the types listList<TypeHeader> the list of types supported by IGCIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the types payloadpublic TypeDetails getTypeDetails(String typeName) throws IGCConnectivityException, IGCParsingException
typeName - the IGC type name for which to retrieve detailsIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the types payloadpublic TypeDetails getTypeDetails(String typeName, boolean view, boolean create, boolean edit) throws IGCConnectivityException, IGCParsingException
typeName - the IGC type name for which to retrieve detailsview - whether to include the viewable propertiescreate - whether to include the properties that can be included during creationedit - whether to include editable propertiesIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the types payloadpublic Reference getAssetById(String rid) throws IGCConnectivityException, IGCParsingException
rid - the Repository ID of the assetIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCgetAssetRefById(String)public Reference getAssetById(String rid, ObjectCache cache) throws IGCConnectivityException, IGCParsingException
rid - the Repository ID of the assetcache - a cache of previously-retrieved assetsIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCgetAssetRefById(String)public static String getEncodedPathVariable(String pathVariable)
pathVariable - the value within the path to encodepublic Reference getAssetRefById(String rid) throws IGCConnectivityException, IGCParsingException
rid - the Repository ID of the assetIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCpublic <T extends Reference> T getAssetWithSubsetOfProperties(String rid, String assetType, List<String> properties) throws IGCConnectivityException, IGCParsingException
T - the type of Reference to returnrid - the repository ID (RID) of the asset to retrieveassetType - the IGC asset type of the asset to retrieveproperties - a list of the properties to retrieveIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCpublic <T extends Reference> T getAssetWithSubsetOfProperties(String rid, String assetType, String[] properties) throws IGCConnectivityException, IGCParsingException
T - the type of Reference to returnrid - the repository ID (RID) of the asset to retrieveassetType - the IGC asset type of the asset to retrieveproperties - a list of the properties to retrieveIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCpublic <T extends Reference> T getAssetWithSubsetOfProperties(String rid, String assetType, String[] properties, int pageSize) throws IGCConnectivityException, IGCParsingException
T - the type of Reference to returnrid - the repository ID (RID) of the asset to retrieveassetType - the IGC asset type of the asset to retrieveproperties - a list of the properties to retrievepageSize - the maximum number of each of the asset's relationships to return on this requestIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCpublic <T extends Reference> T getAssetWithSubsetOfProperties(String rid, String assetType, List<String> properties, int pageSize) throws IGCConnectivityException, IGCParsingException
T - the type of Reference to returnrid - the repository ID (RID) of the asset to retrieveassetType - the IGC asset type of the asset to retrieveproperties - a list of the properties to retrievepageSize - the maximum number of each of the asset's relationships to return on this requestIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCpublic <T extends Reference> ItemList<T> search(IGCSearch igcSearch) throws IGCConnectivityException, IGCParsingException
T - the type of items that should be in the ItemListigcSearch - search conditions and criteria to useItemList<T> - the first page of results from the searchIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCpublic boolean update(IGCUpdate igcUpdate) throws IGCConnectivityException
igcUpdate - update criteria to useIGCConnectivityException - if there is any connectivity issue during the requestpublic String create(IGCCreate igcCreate) throws IGCConnectivityException
igcCreate - creation criteria to useIGCConnectivityException - if there is any connectivity issue during the requestpublic boolean delete(String rid) throws IGCConnectivityException
rid - the RID of the asset to deleteIGCConnectivityException - if there is any connectivity issue during the requestpublic boolean detectLineage(String jobRid) throws IGCConnectivityException
jobRid - the RID of the job for which to detect lineageIGCConnectivityException - if there is any connectivity issue during the requestpublic boolean upsertOpenIgcBundle(String name, org.springframework.core.io.AbstractResource file) throws IGCConnectivityException, IGCParsingException
name - the bundleId of the bundlefile - the Spring FileSystemResource or ClassPathResource containing the file to be uploadedIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCpublic File createOpenIgcBundleFile(File directory) throws IGCIOException
directory - the directory under which the OpenIGC bundle is defined (ie. including an
'asset_type_descriptor.xml', an 'i18n' subdirectory and an 'icons' subdirectory)IGCIOException - if there is any issue loading the provided directory or creating a bundle from itpublic List<String> getOpenIgcBundles() throws IGCConnectivityException, IGCParsingException
List<String>IGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCpublic String upsertOpenIgcAsset(String assetXML) throws IGCConnectivityException
assetXML - the XML string defining the OpenIGC assetIGCConnectivityException - if there is any connectivity issue during the requestpublic boolean deleteOpenIgcAsset(String assetXML) throws IGCConnectivityException
assetXML - the XML string defining the OpenIGC asset deletionIGCConnectivityException - if there is any connectivity issue during the requestpublic <T extends Reference> ItemList<T> getNextPage(String propertyName, ItemList<T> list) throws IGCConnectivityException, IGCParsingException
T - the type of items to expect in the ItemListpropertyName - the name of the property for which the list provides items (or null if the result of a search)list - the list of items from which to retrieve the next pageItemList<T> - the next page of resultsIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCpublic <T extends Reference> List<T> getAllPages(String propertyName, ItemList<T> list) throws IGCConnectivityException, IGCParsingException
T - the type of items to expect in the ItemListpropertyName - the name of the property for which the list provides items (or null if the result of a search)list - the ItemList for which to retrieve all pagesList<T> - a List containing all items from all pages of resultsIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCpublic void disconnect()
throws IGCConnectivityException
IGCConnectivityException - if there is any connectivity issue during the requestpublic void cacheTypeDetails(String typeName) throws IGCConnectivityException, IGCParsingException, IGCIOException
typeName - name of the IGC object type to cacheIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCIGCIOException - if there is any issue accessing the POJO that defines the type and its propertiespublic String getDisplayNameForType(String typeName) throws IGCConnectivityException, IGCParsingException, IGCIOException
typeName - the name of the IGC object typeIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCIGCIOException - if there is any issue accessing the POJO defining the type and its propertiespublic boolean isCreatable(String typeName) throws IGCConnectivityException, IGCParsingException, IGCIOException
typeName - the name of the IGC object typeIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCIGCIOException - if there is any issue accessing the POJO defining the type and its propertiespublic boolean hasModificationDetails(String typeName) throws IGCConnectivityException, IGCParsingException, IGCIOException
typeName - the name of the IGC asset type for which to check whether it tracks modification detailsIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCIGCIOException - if there is any issue accessing the POJO defining the type and its propertiespublic List<String> getAllPropertiesForType(String typeName) throws IGCConnectivityException, IGCParsingException, IGCIOException
typeName - the name of the IGC object typeList<String>IGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCIGCIOException - if there is any issue accessing the POJO defining the type and its propertiespublic List<String> getNonRelationshipPropertiesForType(String typeName) throws IGCConnectivityException, IGCParsingException, IGCIOException
typeName - the name of the IGC object typeList<String>IGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCIGCIOException - if there is any issue accessing the POJO defining the type and its propertiespublic List<String> getAllStringPropertiesForType(String typeName) throws IGCConnectivityException, IGCParsingException, IGCIOException
typeName - the name of the IGC object typeList<String>IGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCIGCIOException - if there is any issue accessing the POJO defining the type and its propertiespublic List<String> getPagedRelationshipPropertiesForType(String typeName) throws IGCConnectivityException, IGCParsingException, IGCIOException
typeName - the name of the IGC object typeList<String>IGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCIGCIOException - if there is any issue accessing the POJO defining the type and its propertiespublic void registerPOJO(Class<?> clazz) throws IGCIOException
clazz - the Java Class (POJO) object to registerIGCIOException - if there is any issue introspecting the provided POJO classpublic Class<?> getPOJOForType(String assetType) throws IGCIOException
assetType - name of the IGC assetIGCIOException - if there is any issue introspecting the provided POJO classregisterPOJO(Class)public Boolean isWorkflowEnabled()
public Object getPropertyByName(Reference object, String property) throws IGCIOException
object - the IGC object from which to retrieve the property's valueproperty - the name of the property for which to retrieve the valueIGCIOException - if there is any issue introspecting the class that defines the type and its propertiespublic <T extends Reference> T getModificationDetails(T object, ObjectCache cache) throws IGCConnectivityException, IGCParsingException, IGCIOException
T - the type of IGC object (minimally a Reference)object - the IGC object for which to populate modification detailscache - a cache of information that may already have been retrieved about the provided objectIGCConnectivityException - if there is any connectivity issue during the requestIGCParsingException - if there is any issue parsing the response from IGCIGCIOException - if there is any issue accessing the POJO defining the type and its propertiesCopyright © 2018–2021 ODPi. All rights reserved.