You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by da...@apache.org on 2018/04/06 08:28:14 UTC
[10/31] atlas git commit: ATLAS-2122 OMAG Server Application and OMRS
APIs
http://git-wip-us.apache.org/repos/asf/atlas/blob/a1fd4068/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefHelper.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefHelper.java b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefHelper.java
index 113393b..d66a485 100644
--- a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefHelper.java
+++ b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefHelper.java
@@ -17,13 +17,15 @@
*/
package org.apache.atlas.omrs.localrepository.repositorycontentmanager;
+import org.apache.atlas.omrs.ffdc.exception.InvalidParameterException;
import org.apache.atlas.omrs.ffdc.exception.PatchErrorException;
import org.apache.atlas.omrs.ffdc.exception.TypeErrorException;
-import org.apache.atlas.omrs.metadatacollection.properties.instances.InstanceType;
import org.apache.atlas.omrs.metadatacollection.properties.typedefs.AttributeTypeDef;
import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDef;
+import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefGallery;
import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefPatch;
+
/**
* OMRSTypeDefHelper provides methods for manipulating TypeDefs and creating metadata instances with the correct TypeDef
* headers
@@ -31,6 +33,22 @@ import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefPatch
public interface OMRSTypeDefHelper
{
/**
+ * Return the list of typedefs active in the local repository.
+ *
+ * @return TypeDef gallery
+ */
+ TypeDefGallery getActiveTypeDefGallery();
+
+
+ /**
+ * Return the list of typedefs known by the local repository.
+ *
+ * @return TypeDef gallery
+ */
+ TypeDefGallery getKnownTypeDefGallery();
+
+
+ /**
* Return the TypeDef identified by the name supplied by the caller. This is used in the connectors when
* validating the actual types of the repository with the known open metadata types - looking specifically
* for types of the same name but with different content.
@@ -57,6 +75,45 @@ public interface OMRSTypeDefHelper
/**
+ * Return the TypeDefs identified by the name supplied by the caller. The TypeDef name may have wild
+ * card characters in it such as * and & which is why the results are returned in a list.
+ *
+ * @param sourceName - source of the request (used for logging)
+ * @param typeDefName - unique name for the TypeDef
+ * @return TypeDef object or null if TypeDef is not known.
+ */
+ TypeDefGallery getActiveTypesByWildCardName (String sourceName,
+ String typeDefName);
+
+
+ /**
+ * Return the TypeDef identified by the guid supplied by the caller. This call is used when
+ * retrieving a type that only the guid is known.
+ *
+ * @param sourceName - source of the request (used for logging)
+ * @param typeDefGUID - unique identifier for the TypeDef
+ * @return TypeDef object
+ * @throws TypeErrorException - unknown or invalid type
+ */
+ TypeDef getTypeDef (String sourceName,
+ String typeDefGUID) throws TypeErrorException;
+
+
+ /**
+ * Return the AttributeTypeDef identified by the guid and name supplied by the caller. This call is used when
+ * retrieving a type that only the guid is known.
+ *
+ * @param sourceName - source of the request (used for logging)
+ * @param attributeTypeDefGUID - unique identifier for the AttributeTypeDef
+ * @return TypeDef object
+ * @throws TypeErrorException - unknown or invalid type
+ */
+ AttributeTypeDef getAttributeTypeDef (String sourceName,
+ String attributeTypeDefGUID) throws TypeErrorException;
+
+
+
+ /**
* Return the TypeDef identified by the guid and name supplied by the caller. This call is used when
* retrieving a type that should exist. For example, retrieving the type of a metadata instance.
*
@@ -85,17 +142,4 @@ public interface OMRSTypeDefHelper
AttributeTypeDef getAttributeTypeDef (String sourceName,
String attributeTypeDefGUID,
String attributeTypeDefName) throws TypeErrorException;
-
-
- /**
- * Returns an updated TypeDef that has had the supplied patch applied. It throws an exception if any part of
- * the patch is incompatible with the original TypeDef. For example, if there is a mismatch between
- * the type or version that either represents.
- *
- * @param sourceName - source of the request (used for logging)
- * @param typeDefPatch - patch to apply
- * @return updated TypeDef
- * @throws PatchErrorException - the patch is either badly formatted, or does not apply to the supplied TypeDef
- */
- TypeDef applyPatch(String sourceName, TypeDefPatch typeDefPatch) throws PatchErrorException;
}
http://git-wip-us.apache.org/repos/asf/atlas/blob/a1fd4068/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefManager.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefManager.java b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefManager.java
index 34bc02a..0597e9f 100644
--- a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefManager.java
+++ b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefManager.java
@@ -26,8 +26,7 @@ import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefCateg
/**
- * OMRSTypeDefManager provides maintenance methods for managing the TypeDefs in the local cache and supporting
- * the OMRSInstanceHelper to build instances that respect their type definition (TypeDef).
+ * OMRSTypeDefManager provides maintenance methods for managing the TypeDefs in the local cache.
*/
public interface OMRSTypeDefManager
{
@@ -59,6 +58,15 @@ public interface OMRSTypeDefManager
/**
+ * Update one or more properties of a cached TypeDef.
+ *
+ * @param sourceName - source of the request (used for logging)
+ * @param attributeTypeDef - AttributeTypeDef structure.
+ */
+ void updateAttributeTypeDef(String sourceName, AttributeTypeDef attributeTypeDef);
+
+
+ /**
* Delete a cached TypeDef.
*
* @param sourceName - source of the request (used for logging)
http://git-wip-us.apache.org/repos/asf/atlas/blob/a1fd4068/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefValidator.java
----------------------------------------------------------------------
diff --git a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefValidator.java b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefValidator.java
index 9c7281a..5ead6df 100644
--- a/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefValidator.java
+++ b/omrs/src/main/java/org/apache/atlas/omrs/localrepository/repositorycontentmanager/OMRSTypeDefValidator.java
@@ -17,11 +17,10 @@
*/
package org.apache.atlas.omrs.localrepository.repositorycontentmanager;
-import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDef;
-import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefCategory;
-import org.apache.atlas.omrs.metadatacollection.properties.typedefs.TypeDefSummary;
+import org.apache.atlas.omrs.metadatacollection.properties.typedefs.*;
import java.util.ArrayList;
+import java.util.List;
/**
* OMRSTypeDefValidator describes a component that is able to manage TypeDefs for the local metadata repository.
@@ -56,7 +55,7 @@ public interface OMRSTypeDefValidator
* @param typeDefSummaries - list of summary information about the TypeDefs.
*/
void validateAgainstLocalTypeDefs(String sourceName,
- ArrayList<TypeDefSummary> typeDefSummaries);
+ List<TypeDefSummary> typeDefSummaries);
/**
@@ -71,11 +70,11 @@ public interface OMRSTypeDefValidator
* @return boolean flag
*/
boolean validateEnterpriseTypeDefs(String sourceName,
- ArrayList<TypeDef> typeDefs);
+ List<TypeDef> typeDefs);
/**
- * Return boolean indicating whether the TypeDef is one of the standard open metadata types.
+ * Return boolean indicating whether the TypeDef or AttributeTypeDef is one of the standard open metadata types.
*
* @param sourceName - source of the request (used for logging)
* @param typeDefGUID - unique identifier of the type
@@ -86,7 +85,7 @@ public interface OMRSTypeDefValidator
/**
- * Return boolean indicating whether the TypeDef is known, either as an open type, or one defined
+ * Return boolean indicating whether the TypeDef/AttributeTypeDef is known, either as an open type, or one defined
* by one or more of the members of the cohort.
*
* @param sourceName - source of the request (used for logging)
@@ -98,7 +97,7 @@ public interface OMRSTypeDefValidator
/**
- * Return boolean indicating whether the TypeDef is in use in the local repository.
+ * Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the local repository.
*
* @param sourceName - source of the request (used for logging)
* @param typeDefGUID - unique identifier of the type
@@ -109,7 +108,7 @@ public interface OMRSTypeDefValidator
/**
- * Return boolean indicating whether the TypeDef identifiers are from a single known type or not.
+ * Return boolean indicating whether the TypeDef/AttributeTypeDef identifiers are from a single known type or not.
*
* @param sourceName - source of the request (used for logging)
* @param typeDefGUID - unique identifier of the TypeDef
@@ -130,10 +129,25 @@ public interface OMRSTypeDefValidator
* @param category - category for the TypeDef
* @return boolean result
*/
- boolean validTypeId(String sourceName,
- String typeDefGUID,
- String typeDefName,
- TypeDefCategory category);
+ boolean validTypeDefId(String sourceName,
+ String typeDefGUID,
+ String typeDefName,
+ TypeDefCategory category);
+
+
+ /**
+ * Return boolean indicating whether the AttributeTypeDef identifiers are from a single known type or not.
+ *
+ * @param sourceName - source of the request (used for logging)
+ * @param attributeTypeDefGUID - unique identifier of the AttributeTypeDef
+ * @param attributeTypeDefName - unique name of the AttributeTypeDef
+ * @param category - category for the AttributeTypeDef
+ * @return boolean result
+ */
+ boolean validAttributeTypeDefId(String sourceName,
+ String attributeTypeDefGUID,
+ String attributeTypeDefName,
+ AttributeTypeDefCategory category);
/**
@@ -146,11 +160,28 @@ public interface OMRSTypeDefValidator
* @param category - category for the TypeDef
* @return boolean result
*/
- boolean validTypeId(String sourceName,
- String typeDefGUID,
- String typeDefName,
- long typeDefVersion,
- TypeDefCategory category);
+ boolean validTypeDefId(String sourceName,
+ String typeDefGUID,
+ String typeDefName,
+ long typeDefVersion,
+ TypeDefCategory category);
+
+
+ /**
+ * Return boolean indicating whether the TypeDef identifiers are from a single known type or not.
+ *
+ * @param sourceName - source of the request (used for logging)
+ * @param attributeTypeDefGUID - unique identifier of the TypeDef
+ * @param attributeTypeDefName - unique name of the TypeDef
+ * @param attributeTypeDefVersion - versionName of the type
+ * @param category - category for the TypeDef
+ * @return boolean result
+ */
+ boolean validAttributeTypeDefId(String sourceName,
+ String attributeTypeDefGUID,
+ String attributeTypeDefName,
+ long attributeTypeDefVersion,
+ AttributeTypeDefCategory category);
/**
@@ -165,6 +196,16 @@ public interface OMRSTypeDefValidator
/**
+ * Return boolean indicating whether the supplied AttributeTypeDef is valid or not.
+ *
+ * @param sourceName - source of the request (used for logging)
+ * @param attributeTypeDef - TypeDef to test
+ * @return boolean result
+ */
+ boolean validAttributeTypeDef(String sourceName,
+ AttributeTypeDef attributeTypeDef);
+
+ /**
* Return boolean indicating whether the supplied TypeDefSummary is valid or not.
*
* @param sourceName - source of the TypeDefSummary (used for logging)