Class OSSUnityCatalogInsideCatalogSyncBase
java.lang.Object
org.odpi.openmetadata.adapters.connectors.unitycatalog.sync.OSSUnityCatalogInsideCatalogSyncBase
- Direct Known Subclasses:
OSSUnityCatalogInsideCatalogSyncFunctions,OSSUnityCatalogInsideCatalogSyncRegisteredModels,OSSUnityCatalogInsideCatalogSyncSchema,OSSUnityCatalogInsideCatalogSyncTables,OSSUnityCatalogInsideCatalogSyncVolumes,OSSUnityCatalogServerSyncCatalog
Common functions for the synchronizing between Egeria and Unity Catalog.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AssetClientprotected final AuditLogprotected final Stringprotected final Stringprotected final Stringprotected final Stringprotected final IntegrationContextprotected final UnityCatalogDeployedImplementationTypeprotected final Stringprotected final ExternalIdClientprotected final Stringprotected final Stringprotected final OpenMetadataStoreprotected final PropertyFacetClientprotected final PropertyHelperprotected final Stringprotected final PermittedSynchronizationprotected final Stringprotected final OSSUnityCatalogResourceConnectorprotected final String -
Constructor Summary
ConstructorsConstructorDescriptionOSSUnityCatalogInsideCatalogSyncBase(String connectorName, IntegrationContext context, String catalogTargetName, String serverGUID, String catalogGUID, String metadataCollectionGUID, String metadataCollectionQualifiedName, Map<String, String> ucFullNameToEgeriaGUID, PermittedSynchronization targetPermittedSynchronization, OSSUnityCatalogResourceConnector ucConnector, String ucServerEndpoint, String entityTypeName, UnityCatalogDeployedImplementationType deployedImplementationType, Map<String, String> templates, Map<String, Object> configurationProperties, List<String> excludeNames, List<String> includeNames, AuditLog auditLog) Set up the schema synchronizer. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExternalIdentifier(String openMetadataElementGUID, String parentGUID, ElementBase ucElement, String schemaName, String elementName, String elementType, String id, PermittedSynchronization instanceSynchronizationDirection) Add a new external identifier to an existing open metadata element.protected voidaddPropertyFacet(String parentGUID, String parentQualifiedName, BasicElementProperties basicElementProperties, Map<String, String> facetProperties) Create the property facet for an Egeria element.buildAnchorScopeGUIDs(String... ancestorGUIDs) Build the anchorScopeGUIDs list used throughout this connector for elements catalogued from Unity Catalog: the Unity Catalog server asset, the catalog the element belongs to, any additional ancestors between the catalog and the element (for example the schema, and the table/function for a column or parameter), and the technology-type GUID for the OSS Unity Catalog server product.protected voiddeleteElementInEgeria(MemberElement memberElement) Delete an element from open metadata.protected StringfindExistingSchemaAttribute(SchemaAttributeClient schemaAttributeClient, String qualifiedName) Find an existing schema attribute with the requested qualified name.protected StringfindExistingSchemaType(SchemaTypeClient schemaTypeClient, String qualifiedName) Find an existing schema type with the requested qualified name.getArrayConfigurationProperty(String propertyName, Map<String, Object> configurationProperties) Retrieve a configuration property that is a comma-separated list of strings.protected StringgetCleanStorageLocation(String storageLocation) Convert the US format for the storage location into a proper pathname.protected DategetDateFromLong(long valueFromUC) Convert the long value returned by UC into a date (or null).protected ExternalIdLinkPropertiesgetExternalIdLinkProperties(ElementBase ucElement, String schemaName, String elementName, PermittedSynchronization instanceSynchronizationDirection) Populate and return the external identifier properties for a UC Schema.protected ExternalIdPropertiesgetExternalIdProperties(ElementBase ucElement, String elementType, String id) Populate and return the external identifier properties for a UC Schema.protected StringgetParentGUIDFromMember(MemberElement memberElement) Extract the GUID of the immediate parent of an element from its Anchors classification.protected StringgetQualifiedName(String fullName) Return the qualified name of an element using UnityCatalog's full name.protected StringgetUCCatalogFromMember(MemberElement memberElement) Extract the comment for a UC element from the description attribute in an egeria element.protected StringgetUCCommentFomMember(MemberElement memberElement) Extract the comment for a UC element from the description attribute in an egeria element.protected StringgetUCNameFromMember(MemberElement memberElement) Extract the name of a UC element from the name attribute in an egeria element (which is the full name).getUCPropertiesFromMember(MemberElement memberElement) Extract the properties for a UC element from the additionalProperties attribute in an egeria element.protected StringgetUCSchemaFromMember(MemberElement memberElement) Extract the schema name for a UC element from the description attribute in an egeria element.protected StringgetUCStorageLocationFromMember(MemberElement memberElement) Extract the storage location from theprotected booleannoMismatchInExternalIdentifier(String thirdPartyExternalIdentifier, MemberElement memberElement) Check that the name of the third party element has not changed with respect to Egeria.protected abstract IntegrationIteratorrefreshEgeria(String parentGUID, String parentRelationshipTypeName, RelationshipBeanProperties relationshipProperties) Review all the elements for the subtype stored in Egeria.protected abstract voidrefreshUnityCatalog(String parentGUID, String parentRelationshipTypeName, RelationshipBeanProperties relationshipProperties, IntegrationIterator iterator) Review all the elements for the subtype stored in UC.protected voidthrowBadBeanClass(OpenMetadataType expectedType, String methodName, OpenMetadataRootElement element) Indicate that an element does not have properties of the expected bean class.protected voidthrowMissingPropertyValue(String missingPropertyName, String methodName, OpenMetadataRootElement element) Throw an exception because a necessary property is missing.
-
Field Details
-
propertyHelper
-
connectorName
-
context
-
serverGUID
-
catalogGUID
-
catalogTypeName
-
metadataCollectionGUID
-
metadataCollectionQualifiedName
-
catalogTargetName
-
targetPermittedSynchronization
-
ucConnector
-
ucServerEndpoint
-
entityTypeName
-
deployedImplementationType
-
templates
-
configurationProperties
-
auditLog
-
openMetadataStore
-
externalIdClient
-
propertyFacetClient
-
assetClient
-
excludeNames
-
includeNames
-
templateGUID
-
ucFullNameToEgeriaGUID
-
-
Constructor Details
-
OSSUnityCatalogInsideCatalogSyncBase
public OSSUnityCatalogInsideCatalogSyncBase(String connectorName, IntegrationContext context, String catalogTargetName, String serverGUID, String catalogGUID, String metadataCollectionGUID, String metadataCollectionQualifiedName, Map<String, String> ucFullNameToEgeriaGUID, PermittedSynchronization targetPermittedSynchronization, OSSUnityCatalogResourceConnector ucConnector, String ucServerEndpoint, String entityTypeName, UnityCatalogDeployedImplementationType deployedImplementationType, Map<String, throws UserNotAuthorizedException, InvalidParameterExceptionString> templates, Map<String, Object> configurationProperties, List<String> excludeNames, List<String> includeNames, AuditLog auditLog) Set up the schema synchronizer.- Parameters:
connectorName- name of this connectorcontext- context for the connectorcatalogTargetName- the catalog target nameserverGUID- guid of the Unity Catalog server asset that everything catalogued from it is scoped tocatalogGUID- guid of the catalogmetadataCollectionGUID- the managedMetadataCollectionId of the metadata collection for this UC servermetadataCollectionQualifiedName- name of the metadata collection for this UC serverucFullNameToEgeriaGUID- map of full names from UC to the GUID of the entity in Egeria.targetPermittedSynchronization- the policy that controls the direction of metadata exchangeucConnector- connector for accessing UCentityTypeName- type name of asset entity used to represent this type of elementdeployedImplementationType- technology typeucServerEndpoint- the server endpoint used to constructing the qualified namestemplates- templates supplied through the catalog targetconfigurationProperties- configuration properties supplied through the catalog targetexcludeNames- list of catalogs to ignore (and include all others)includeNames- list of catalogs to include (and ignore all others) - overrides excludeCatalogsauditLog- logging destination- Throws:
UserNotAuthorizedException- connector disconnectedInvalidParameterException- missing template
-
-
Method Details
-
refreshEgeria
protected abstract IntegrationIterator refreshEgeria(String parentGUID, String parentRelationshipTypeName, RelationshipBeanProperties relationshipProperties) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ConnectorCheckedException Review all the elements for the subtype stored in Egeria.- Parameters:
parentGUID- unique identifier of the parentparentRelationshipTypeName- relationship type between parent and elements to iterate throughrelationshipProperties- optional properties for the relationship- Returns:
- iterator
- Throws:
InvalidParameterException- parameter errorPropertyServerException- repository errorUserNotAuthorizedException- security errorConnectorCheckedException- logic error in properties
-
refreshUnityCatalog
protected abstract void refreshUnityCatalog(String parentGUID, String parentRelationshipTypeName, RelationshipBeanProperties relationshipProperties, IntegrationIterator iterator) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, ConnectorCheckedException Review all the elements for the subtype stored in UC.- Parameters:
parentGUID- unique identifier of the parentparentRelationshipTypeName- relationship type between parent and elements to iterate throughrelationshipProperties- optional properties for the relationshipiterator- iterator of choice- Throws:
InvalidParameterException- parameter errorPropertyServerException- repository errorUserNotAuthorizedException- security errorConnectorCheckedException- logic error in properties
-
getDateFromLong
Convert the long value returned by UC into a date (or null).- Parameters:
valueFromUC- long- Returns:
- date
-
getQualifiedName
Return the qualified name of an element using UnityCatalog's full name.- Parameters:
fullName- dotted name- Returns:
- qualified name
-
deleteElementInEgeria
protected void deleteElementInEgeria(MemberElement memberElement) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Delete an element from open metadata.- Parameters:
memberElement- element to delete- Throws:
InvalidParameterException- parameter errorPropertyServerException- repository errorUserNotAuthorizedException- authorization error
-
addExternalIdentifier
public void addExternalIdentifier(String openMetadataElementGUID, String parentGUID, ElementBase ucElement, String schemaName, String elementName, String elementType, String id, PermittedSynchronization instanceSynchronizationDirection) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Add a new external identifier to an existing open metadata element.- Parameters:
openMetadataElementGUID- unique identifier (GUID) of the element in the open metadata ecosystemparentGUID- unique identifier of the immediate parent of openMetadataElementGUID (eg the catalog for a schema, the schema for a table/volume/function/model, or the server for the catalog itself)ucElement- values from Unity Catalog elementschemaName- name of the schemaelementName- element type (from UC)instanceSynchronizationDirection- direction the metadata is flowing- Throws:
InvalidParameterException- one of the parameters is invalidUserNotAuthorizedException- the user is not authorized to issue this requestPropertyServerException- problem accessing the property server
-
buildAnchorScopeGUIDs
Build the anchorScopeGUIDs list used throughout this connector for elements catalogued from Unity Catalog: the Unity Catalog server asset, the catalog the element belongs to, any additional ancestors between the catalog and the element (for example the schema, and the table/function for a column or parameter), and the technology-type GUID for the OSS Unity Catalog server product. Nulls and duplicates are removed since not every element has all of these ancestors (for example, the catalog itself has no separate catalogGUID or ancestor GUIDs distinct from the server).- Parameters:
ancestorGUIDs- unique identifiers of the ancestors of the element being scoped, nearest first - eg (schemaGUID) for a table/volume/function/model, or (schemaGUID, assetGUID) for a column/parameter nested under a table/function. May be omitted or contain nulls.- Returns:
- de-duplicated, non-null list of anchor scope GUIDs
-
findExistingSchemaType
protected String findExistingSchemaType(SchemaTypeClient schemaTypeClient, String qualifiedName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Find an existing schema type with the requested qualified name. Used to make schema cataloguing (for example table columns, or API parameters) idempotent across repeated refreshes.- Parameters:
schemaTypeClient- client to search withqualifiedName- unique name to search for- Returns:
- GUID of the matching schema type, or null if not found
- Throws:
InvalidParameterException- one of the parameters is not correctUserNotAuthorizedException- the connector's userId is not able to work with open metadataPropertyServerException- there is an issue with one of the open metadata repositories
-
findExistingSchemaAttribute
protected String findExistingSchemaAttribute(SchemaAttributeClient schemaAttributeClient, String qualifiedName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Find an existing schema attribute with the requested qualified name. Used to make schema cataloguing (for example table columns, or API parameters) idempotent across repeated refreshes.- Parameters:
schemaAttributeClient- client to search withqualifiedName- unique name to search for- Returns:
- GUID of the matching schema attribute, or null if not found
- Throws:
InvalidParameterException- one of the parameters is not correctUserNotAuthorizedException- the connector's userId is not able to work with open metadataPropertyServerException- there is an issue with one of the open metadata repositories
-
getExternalIdProperties
protected ExternalIdProperties getExternalIdProperties(ElementBase ucElement, String elementType, String id) Populate and return the external identifier properties for a UC Schema.- Parameters:
ucElement- values from Unity Catalog elementelementType- element type (from UC)id- element id (from UC)- Returns:
- external identifier properties
-
getExternalIdLinkProperties
protected ExternalIdLinkProperties getExternalIdLinkProperties(ElementBase ucElement, String schemaName, String elementName, PermittedSynchronization instanceSynchronizationDirection) Populate and return the external identifier properties for a UC Schema.- Parameters:
ucElement- values from Unity Catalog elementschemaName- name of the schemaelementName- element type (from UC)instanceSynchronizationDirection- direction the metadata is flowing- Returns:
- external identifier properties
-
addPropertyFacet
protected void addPropertyFacet(String parentGUID, String parentQualifiedName, BasicElementProperties basicElementProperties, Map<String, String> facetProperties) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedExceptionCreate the property facet for an Egeria element. This holds the vendor specific properties for the element.- Parameters:
parentGUID- the parent (and anchor) unique nameparentQualifiedName- qualifiedName of the parent elementbasicElementProperties- common properties of an elementfacetProperties- these are the specialist property for the linked element.- Throws:
InvalidParameterExceptionPropertyServerExceptionUserNotAuthorizedException
-
noMismatchInExternalIdentifier
protected boolean noMismatchInExternalIdentifier(String thirdPartyExternalIdentifier, MemberElement memberElement) Check that the name of the third party element has not changed with respect to Egeria.- Parameters:
thirdPartyExternalIdentifier- id from Unity CatalogmemberElement- element from Egeria- Returns:
- boolean
-
throwMissingPropertyValue
protected void throwMissingPropertyValue(String missingPropertyName, String methodName, OpenMetadataRootElement element) throws ConnectorCheckedException Throw an exception because a necessary property is missing. The description portrays this a s logic error.- Parameters:
missingPropertyName- missing property namemethodName- calling methodelement- element in error- Throws:
ConnectorCheckedException- resulting exception
-
throwBadBeanClass
protected void throwBadBeanClass(OpenMetadataType expectedType, String methodName, OpenMetadataRootElement element) throws ConnectorCheckedException Indicate that an element does not have properties of the expected bean class. This is documented as a logic error.- Parameters:
expectedType- open metadata type informationmethodName- calling methodelement- element in error- Throws:
ConnectorCheckedException- resulting exception
-
getUCCatalogFromMember
protected String getUCCatalogFromMember(MemberElement memberElement) throws ConnectorCheckedException Extract the comment for a UC element from the description attribute in an egeria element.- Parameters:
memberElement- element from Egeria- Returns:
- catalog for UC
- Throws:
ConnectorCheckedException- logic error in properties
-
getParentGUIDFromMember
Extract the GUID of the immediate parent of an element from its Anchors classification. This is used when pushing an element created directly in open metadata out to Unity Catalog, where the only way to discover its parent (eg the schema for a table/volume/function/model) is via its anchor.- Parameters:
memberElement- element from Egeria- Returns:
- parent GUID, or null if the element is not anchored
-
getUCSchemaFromMember
protected String getUCSchemaFromMember(MemberElement memberElement) throws ConnectorCheckedException Extract the schema name for a UC element from the description attribute in an egeria element.- Parameters:
memberElement- element from Egeria- Returns:
- schema for UC
- Throws:
ConnectorCheckedException- logic error in properties
-
getUCNameFromMember
Extract the name of a UC element from the name attribute in an egeria element (which is the full name).- Parameters:
memberElement- element from Egeria- Returns:
- name for UC
- Throws:
ConnectorCheckedException- logic error in properties
-
getUCCommentFomMember
protected String getUCCommentFomMember(MemberElement memberElement) throws ConnectorCheckedException Extract the comment for a UC element from the description attribute in an egeria element.- Parameters:
memberElement- element from Egeria- Returns:
- comment for UC
- Throws:
ConnectorCheckedException- logic error in properties
-
getUCPropertiesFromMember
protected Map<String,String> getUCPropertiesFromMember(MemberElement memberElement) throws ConnectorCheckedException Extract the properties for a UC element from the additionalProperties attribute in an egeria element.- Parameters:
memberElement- element from Egeria- Returns:
- properties for UC
- Throws:
ConnectorCheckedException
-
getUCStorageLocationFromMember
Extract the storage location from the- Parameters:
memberElement- elements from egeria- Returns:
- storage location (may be null
-
getCleanStorageLocation
Convert the US format for the storage location into a proper pathname.- Parameters:
storageLocation- storage location from UC- Returns:
- pathname
-
getArrayConfigurationProperty
protected List<String> getArrayConfigurationProperty(String propertyName, Map<String, Object> configurationProperties) Retrieve a configuration property that is a comma-separated list of strings.- Parameters:
propertyName- name of propertyconfigurationProperties- configuration properties- Returns:
- list of strings or null if not set
-