http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedAssetProperties.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedAssetProperties.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedAssetProperties.java deleted file mode 100644 index 2ed017e..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedAssetProperties.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - - -import org.apache.atlas.ocf.ffdc.PropertyServerException; - - -/** - * RelatedAssetProperties returns detailed information about an asset that is related to a connected asset. - * - * It is a generic interface for all types of open metadata assets. However, it assumes the asset's metadata model - * inherits from <b>Asset</b> (see model 0010 in Area 0). - * - * The RelatedAssetProperties returns metadata about the asset at three levels of detail: - * <ul> - * <li><b>assetSummary</b> - used for displaying details of the asset in summary lists or hover text</li> - * <li><b>assetDetail</b> - used to display all of the information known about the asset with summaries - * of the relationships to other metadata entities</li> - * <li><b>assetUniverse</b> - used to define the broader context for the asset</li> - * </ul> - * - * RelatedAssetProperties is a base class for the asset information that returns null, - * for the asset's properties. Metadata repository implementations extend this class to add their - * implementation of the refresh() method that calls to the metadata repository to populate the metadata properties. - */ -public abstract class RelatedAssetProperties extends PropertyBase -{ - /* - * AssetUniverse extends AssetDetails which extends AssetSummary. The interaction with the metadata repository - * pulls the asset universe in one single network interaction and the caller can then explore the metadata - * property by property without incurring many network interactions (unless there are too many instances - * of a particular type of property and one of the iterators is forced to use paging). - * - * If null is returned, the caller is not linked to a metadata repository. - */ - protected AssetUniverse assetProperties = null; - protected AssetDescriptor connectedAsset = null; - protected RelatedAsset relatedAsset = null; - - - /** - * Typical constructor. - * - * @param connectedAsset - original top-level asset - * @param relatedAsset - asset to extract the full set of properties. - */ - public RelatedAssetProperties(AssetDescriptor connectedAsset, RelatedAsset relatedAsset) - { - /* - * Remember the parent asset and details of the related asset to be retrieved. - */ - this.connectedAsset = connectedAsset; - this.relatedAsset = relatedAsset; - } - - - /** - * Copy/clone constructor* - * - * @param templateProperties - template to copy - */ - public RelatedAssetProperties(RelatedAssetProperties templateProperties) - { - if (templateProperties != null) - { - AssetUniverse templateAssetUniverse = templateProperties.getAssetUniverse(); - if (templateAssetUniverse != null) - { - assetProperties = new AssetUniverse(templateAssetUniverse); - connectedAsset = templateProperties.connectedAsset; - relatedAsset = templateProperties.relatedAsset; - } - } - } - - - /** - * Returns the summary information organized in the assetSummary structure. - * - * @return AssetSummary - summary object - */ - public AssetSummary getAssetSummary() { return assetProperties; } - - - - /** - * Returns detailed information about the asset organized in the assetDetail structure. - * - * @return AssetDetail - detail object - */ - public AssetDetail getAssetDetail() { return assetProperties; } - - - /** - * Returns all of the detail of the asset and information connected to it in organized in the assetUniverse - * structure. - * - * @return AssetUniverse - universe object - */ - public AssetUniverse getAssetUniverse() { return assetProperties; } - - - /** - * Request the values in the RelatedAssetProperties are refreshed with the current values from the - * metadata repository. - * - * @throws PropertyServerException - there is a problem connecting to the server to retrieve metadata. - */ - public abstract void refresh() throws PropertyServerException; - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "RelatedAssetProperties{" + - "assetProperties=" + assetProperties + - ", connectedAsset=" + connectedAsset + - ", relatedAsset=" + relatedAsset + - '}'; - } -} -
http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedAssets.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedAssets.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedAssets.java deleted file mode 100644 index 82634bc..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedAssets.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - -import java.util.Iterator; - -/** - * RelatedAssets supports an iterator over a list of related assets. Callers can use it to step through the list - * just once. If they want to parse the list again, they could use the copy/clone constructor to create - * a new iterator. - */ -public abstract class RelatedAssets extends AssetPropertyIteratorBase implements Iterator<RelatedAsset> -{ - /** - * Typical Constructor creates an iterator with the supplied list of elements. - * - * @param parentAsset - descriptor of parent asset - * @param totalElementCount - the total number of elements to process. A negative value is converted to 0. - * @param maxCacheSize - maximum number of elements that should be retrieved from the property server and - * cached in the element list at any one time. If a number less than one is supplied, 1 is used. - */ - public RelatedAssets(AssetDescriptor parentAsset, - int totalElementCount, - int maxCacheSize) - { - super(parentAsset, totalElementCount, maxCacheSize); - } - - - /** - * Copy/clone constructor. Used to reset iterator element pointer to 0; - * - * @param parentAsset - descriptor of parent asset - * @param template - type-specific iterator to copy; null to create an empty iterator - */ - public RelatedAssets(AssetDescriptor parentAsset, RelatedAssets template) - { - super(parentAsset, template); - } - - - /** - * Provides a concrete implementation of cloneElement for the specific iterator type. - * - * @param parentAsset - descriptor of parent asset - * @param template - object to clone - * @return new cloned object. - */ - protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template) - { - return new RelatedAsset(parentAsset, (RelatedAsset)template); - } - - - /** - * Clones this iterator. - * - * @param parentAsset - descriptor of parent asset - * @return new cloned object. - */ - protected abstract RelatedAssets cloneIterator(AssetDescriptor parentAsset); - - - /** - * The iterator can only be used once to step through the elements. This method returns - * a boolean to indicate if it has got to the end of the list yet. - * - * @return boolean indicating whether there are more elements. - */ - @Override - public boolean hasNext() - { - return super.pagingIterator.hasNext(); - } - - - /** - * Return the next element in the iteration. - * - * @return RelatedAsset - next element object that has been cloned. - */ - @Override - public RelatedAsset next() - { - return (RelatedAsset)super.pagingIterator.next(); - } - - - /** - * Remove the current element in the iterator. (Null implementation since this iterator works off of cached - * elements from the property (metadata) server.) - */ - @Override - public void remove() - { - super.pagingIterator.remove(); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "RelatedAssets{" + - "pagingIterator=" + pagingIterator + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedMediaReference.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedMediaReference.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedMediaReference.java deleted file mode 100644 index 8209ee0..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedMediaReference.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.atlas.ocf.properties; - -import java.util.ArrayList; -import java.util.List; - -/** - * RelatedMediaReference stores information about an link to an external media file that - * is relevant to this asset. - */ -public class RelatedMediaReference extends Referenceable -{ - /* - * Attributes of a related media reference - */ - private String mediaId = null; - private String linkDescription = null; - private String displayName = null; - private String uri = null; - private String resourceDescription = null; - private String version = null; - private String organization = null; - private RelatedMediaType mediaType = null; - private ArrayList<RelatedMediaUsage> mediaUsageList = null; - - - /** - * Typical Constructor - * - * @param parentAsset - descriptor for parent asset - * @param type - details of the metadata type for this properties object - * @param guid - String - unique id - * @param url - String - URL - * @param classifications - enumeration of classifications - * @param qualifiedName - unique name - * @param additionalProperties - additional properties for the referenceable object. - * @param meanings - list of glossary terms (summary) - * @param mediaId the reference identifier for this asset's related media. - * @param linkDescription - description of the reference (with respect to this asset). - * @param displayName - consumable name - * @param uri - the URI used to retrieve the resource for this media reference. - * @param resourceDescription - the description of this external media. - * @param version - the version of the resource that this external reference represents. - * @param organization - the name of the organization that owns the resource that this external reference represents. - * @param mediaType - the type of media referenced - * @param mediaUsageList - List of ways the media may be used - */ - public RelatedMediaReference(AssetDescriptor parentAsset, - ElementType type, - String guid, - String url, - Classifications classifications, - String qualifiedName, - AdditionalProperties additionalProperties, - Meanings meanings, - String mediaId, - String linkDescription, - String displayName, - String uri, - String resourceDescription, - String version, - String organization, - RelatedMediaType mediaType, - ArrayList<RelatedMediaUsage> mediaUsageList) - { - super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings); - this.mediaId = mediaId; - this.linkDescription = linkDescription; - this.displayName = displayName; - this.uri = uri; - this.resourceDescription = resourceDescription; - this.version = version; - this.organization = organization; - this.mediaType = mediaType; - this.mediaUsageList = mediaUsageList; - } - - /** - * Copy/clone constructor. - * - * @param parentAsset - descriptor for parent asset - * @param templateRelatedMediaReference - element to copy - */ - public RelatedMediaReference(AssetDescriptor parentAsset, - RelatedMediaReference templateRelatedMediaReference) - { - /* - * Initialize the super class. - */ - super(parentAsset, templateRelatedMediaReference); - - if (templateRelatedMediaReference != null) - { - /* - * Copy the values from the supplied template. - */ - mediaId = templateRelatedMediaReference.getMediaId(); - linkDescription = templateRelatedMediaReference.getLinkDescription(); - displayName = templateRelatedMediaReference.getDisplayName(); - uri = templateRelatedMediaReference.getURI(); - resourceDescription = templateRelatedMediaReference.getResourceDescription(); - version = templateRelatedMediaReference.getVersion(); - organization = templateRelatedMediaReference.getOrganization(); - mediaType = templateRelatedMediaReference.getMediaType(); - - List<RelatedMediaUsage> templateMediaUsageList = templateRelatedMediaReference.getMediaUsageList(); - if (templateMediaUsageList != null) - { - mediaUsageList = new ArrayList<RelatedMediaUsage>(templateMediaUsageList); - } - } - } - - - /** - * Return the identifier given to this reference (with respect to this asset). - * - * @return String mediaId - */ - public String getMediaId() { return mediaId; } - - - /** - * Return the description of the reference (with respect to this asset). - * - * @return String link description. - */ - public String getLinkDescription() { return linkDescription; } - - - /** - * Return the display name of this media reference. - * - * @return String display name. - */ - public String getDisplayName() { return displayName; } - - - /** - * Return the URI used to retrieve the resource for this media reference. - * - * @return String URI - */ - public String getURI() { return uri; } - - - /** - * Return the description of this external media. - * - * @return String resource description - */ - public String getResourceDescription() { return resourceDescription; } - - - /** - * Return the version of the resource that this media reference represents. - * - * @return String version - */ - public String getVersion() { return version; } - - - /** - * Return the name of the organization that owns the resource that this external reference represents. - * - * @return String organization name - */ - public String getOrganization() { return organization; } - - - /** - * Return the type of media referenced. - * - * @return RelatedMediaType - */ - public RelatedMediaType getMediaType() { return mediaType; } - - - /** - * Return the list of recommended usage for the related media. Null means no usage guidance is available. - * - * @return List of RelatedMediaUsage - */ - public ArrayList<RelatedMediaUsage> getMediaUsageList() - { - if (mediaUsageList != null) - { - return mediaUsageList; - } - else - { - return new ArrayList<RelatedMediaUsage>(mediaUsageList); - } - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "RelatedMediaReference{" + - "mediaId='" + mediaId + '\'' + - ", linkDescription='" + linkDescription + '\'' + - ", displayName='" + displayName + '\'' + - ", uri='" + uri + '\'' + - ", resourceDescription='" + resourceDescription + '\'' + - ", version='" + version + '\'' + - ", organization='" + organization + '\'' + - ", mediaType=" + mediaType + - ", mediaUsageList=" + mediaUsageList + - ", qualifiedName='" + qualifiedName + '\'' + - ", additionalProperties=" + additionalProperties + - ", meanings=" + meanings + - ", type=" + type + - ", guid='" + guid + '\'' + - ", url='" + url + '\'' + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedMediaReferences.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedMediaReferences.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedMediaReferences.java deleted file mode 100644 index b4e0d5a..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedMediaReferences.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - -import java.util.Iterator; - -/** - * RelatedMediaReferences supports an iterator over a list of related media references. Callers can use it to step - * through the list just once. If they want to parse the list again, they could use the copy/clone constructor to - * create a new iterator. - */ -public abstract class RelatedMediaReferences extends AssetPropertyIteratorBase implements Iterator<RelatedMediaReference> -{ - /** - * Typical Constructor creates an iterator with the supplied list of elements. - * - * @param parentAsset - descriptor of parent asset - * @param totalElementCount - the total number of elements to process. A negative value is converted to 0. - * @param maxCacheSize - maximum number of elements that should be retrieved from the property server and - * cached in the element list at any one time. If a number less than one is supplied, 1 is used. - */ - public RelatedMediaReferences(AssetDescriptor parentAsset, - int totalElementCount, - int maxCacheSize) - { - super(parentAsset, totalElementCount, maxCacheSize); - } - - - /** - * Copy/clone constructor. Used to reset iterator element pointer to 0; - * - * @param parentAsset - descriptor of parent asset - * @param template - type-specific iterator to copy; null to create an empty iterator - */ - public RelatedMediaReferences(AssetDescriptor parentAsset, RelatedMediaReferences template) - { - super(parentAsset, template); - } - - - /** - * Provides a concrete implementation of cloneElement for the specific iterator type. - * - * @param parentAsset - descriptor of parent asset - * @param template - object to clone - * @return new cloned object. - */ - protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template) - { - return new RelatedMediaReference(parentAsset, (RelatedMediaReference)template); - } - - - /** - * Clones this iterator. - * - * @param parentAsset - descriptor of parent asset - * @return new cloned object. - */ - protected abstract RelatedMediaReferences cloneIterator(AssetDescriptor parentAsset); - - - /** - * The iterator can only be used once to step through the elements. This method returns - * a boolean to indicate if it has got to the end of the list yet. - * - * @return boolean indicating whether there are more elements. - */ - @Override - public boolean hasNext() - { - return super.pagingIterator.hasNext(); - } - - - /** - * Return the next element in the iteration. - * - * @return RelatedMediaReference - next element object that has been cloned. - */ - @Override - public RelatedMediaReference next() - { - return (RelatedMediaReference)super.pagingIterator.next(); - } - - - /** - * Remove the current element in the iterator. (Null implementation since this iterator works off of cached - * elements from the property (metadata) server.) - */ - @Override - public void remove() - { - super.pagingIterator.remove(); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "RelatedMediaReferences{" + - "pagingIterator=" + pagingIterator + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedMediaType.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedMediaType.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedMediaType.java deleted file mode 100644 index 7140ff0..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedMediaType.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.io.Serializable; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * The RelatedMediaType defines the type of resource referenced in a related media reference. - * <ul> - * <li>Image - The media is an image.</li> - * <li>Audio - The media is an audio recording.</li> - * <li>Document - The media is a text document - probably rich text.</li> - * <li>Video - The media is a video recording.</li> - * <li>Other - The media type is not supported.</li> - * </ul> - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public enum RelatedMediaType implements Serializable -{ - IMAGE(0, "Image", "The media is an image."), - AUDIO(1, "Audio", "The media is an audio recording."), - DOCUMENT(2, "Document", "The media is a text document - probably rich text."), - VIDEO(3, "Video", "The media is a video recording."), - OTHER(99, "Other", "The media type is not supported."); - - private static final long serialVersionUID = 1L; - - private int mediaTypeCode; - private String mediaTypeName; - private String mediaTypeDescription; - - - /** - * Typical Constructor - */ - RelatedMediaType(int mediaTypeCode, String mediaTypeName, String mediaTypeDescription) - { - /* - * Save the values supplied - */ - this.mediaTypeCode = mediaTypeCode; - this.mediaTypeName = mediaTypeName; - this.mediaTypeDescription = mediaTypeDescription; - } - - - /** - * Return the code for this enum instance - * - * @return int - media type code - */ - public int getMediaUsageCode() - { - return mediaTypeCode; - } - - - /** - * Return the default name for this enum instance. - * - * @return String - default name - */ - public String getMediaUsageName() - { - return mediaTypeName; - } - - - /** - * Return the default description for this enum instance. - * - * @return String - default description - */ - public String getMediaTypeDescription() - { - return mediaTypeDescription; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedMediaUsage.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedMediaUsage.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedMediaUsage.java deleted file mode 100644 index 29c6e79..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/RelatedMediaUsage.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.io.Serializable; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * The RelatedMediaUsage defines how a related media reference can be used in conjunction with the asset properties. - * These usage options are not mutually exclusive. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public enum RelatedMediaUsage implements Serializable -{ - ICON (0, "Icon", "Provides a small image to represent the asset in tree views and graphs."), - THUMBNAIL (1, "Thumbnail", "Provides a small image about the asset that can be used in lists."), - ILLUSTRATION (2, "Illustration", "Illustrates how the asset works or what it contains. It is complementary to the asset's description."), - USAGE_GUIDANCE (3, "Usage Guidance", "Provides guidance to a person on how to use the asset."), - OTHER (99, "Other", "Another usage."); - - private static final long serialVersionUID = 1L; - - private int mediaUsageCode; - private String mediaUsageName; - private String mediaUsageDescription; - - - /** - * Typical Constructor - */ - RelatedMediaUsage(int mediaUsageCode, String mediaUsageName, String mediaUsageDescription) - { - /* - * Save the values supplied - */ - this.mediaUsageCode = mediaUsageCode; - this.mediaUsageName = mediaUsageName; - this.mediaUsageDescription = mediaUsageDescription; - } - - - /** - * Return the code for this enum instance - * - * @return int - media usage code - */ - public int getMediaUsageCode() - { - return mediaUsageCode; - } - - - /** - * Return the default name for this enum instance. - * - * @return String - default name - */ - public String getMediaUsageName() - { - return mediaUsageName; - } - - - /** - * Return the default description for the media usage pattern for this enum instance. - * - * @return String - default description - */ - public String getMediaUsageDescription() - { - return mediaUsageDescription; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "RelatedMediaUsage{" + - "mediaUsageCode=" + mediaUsageCode + - ", mediaUsageName='" + mediaUsageName + '\'' + - ", mediaUsageDescription='" + mediaUsageDescription + '\'' + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Schema.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Schema.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Schema.java deleted file mode 100644 index 5904fd5..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/Schema.java +++ /dev/null @@ -1,245 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.atlas.ocf.properties; - - -/** - * The Schema object provides information about how the asset structures the data it supports. Schemas are typically - * described as nested structures of linked schema elements. Schemas can also be reused in other schemas. - * - * The schema object can be used to represent a Struct, Array, Set or Map. - * <ul> - * <li> - * A Struct has an ordered list of attributes - the position of an attribute is set up as one of its properties. - * </li> - * <li> - * An Array has one schema attribute and a maximum size plus element count. - * </li> - * <li> - * A Set also has one schema attribute and a maximum size plus element count. - * </li> - * <li> - * A Map is a Set of MapSchemaElements - * </li> - * </ul> - */ -public class Schema extends SchemaElement -{ - /* - * Properties specific to a Schema - */ - SchemaType schemaType = SchemaType.UNKNOWN; - SchemaAttributes schemaAttributes = null; - int maximumElements = 0; - SchemaLinks schemaLinks = null; - - - /** - * Typical constructor - * - * @param parentAsset - descriptor for parent asset - * @param type - details of the metadata type for this properties object - * @param guid - String - unique id - * @param url - String - URL - * @param classifications - enumeration of classifications - * @param qualifiedName - unique name - * @param additionalProperties - additional properties for the referenceable object. - * @param meanings - list of glossary terms (summary) - * @param versionNumber - the version number of the schema element - null means no version number. - * @param author - the name of the author of the schema element. Null means the author is unknown. - * @param usage - the usage guidance for this schema element. Null means no guidance available. - * @param encodingStandard - encoding standard used for this schema. It may be XML, JSON, SQL DDL or something else. - * Null means the encoding standard is unknown or there are many choices. - * @param schemaType - Struct, Array or Set - * @param schemaAttributes - the list of schema attributes in this schema. - * @param maximumElements - the maximum elements that can be stored in this schema. This is set up by the caller. - * Zero means not bounded. For a STRUCT the max elements are the number of elements in - * the structure. - * @param schemaLinks - a list of any links that exist between the schema attributes of this schema (or others). - * These links are typically used for network type schemas such as a graph schema - or may be used to show - * linkage to an element in another schema. - */ - public Schema(AssetDescriptor parentAsset, - ElementType type, - String guid, - String url, - Classifications classifications, - String qualifiedName, - AdditionalProperties additionalProperties, - Meanings meanings, - String versionNumber, - String author, - String usage, - String encodingStandard, - SchemaType schemaType, - SchemaAttributes schemaAttributes, - int maximumElements, - SchemaLinks schemaLinks) - { - super(parentAsset, - type, - guid, - url, - classifications, - qualifiedName, - additionalProperties, - meanings, - versionNumber, - author, - usage, - encodingStandard); - - this.schemaType = schemaType; - this.schemaAttributes = schemaAttributes; - this.maximumElements = maximumElements; - this.schemaLinks = schemaLinks; - } - - /** - * Copy/clone Constructor - the parentAsset is passed separately to the template because it is also - * likely to be being cloned in the same operation and we want the definitions clone to point to the - * asset clone and not the original asset. - * - * @param parentAsset - description of the asset that this schema is attached to. - * @param templateSchema - template object to copy. - */ - public Schema(AssetDescriptor parentAsset, Schema templateSchema) - { - super(parentAsset, templateSchema); - - if (templateSchema != null) - { - SchemaAttributes templateSchemaAttributes = templateSchema.getSchemaAttributes(); - - if (templateSchemaAttributes != null) - { - schemaAttributes = templateSchemaAttributes.cloneIterator(parentAsset); - } - schemaType = templateSchema.getSchemaType(); - maximumElements = templateSchema.getMaximumElements(); - - SchemaLinks templateSchemaLinks = templateSchema.getSchemaLinks(); - - if (templateSchemaLinks != null) - { - schemaLinks = templateSchemaLinks.cloneIterator(parentAsset); - } - } - } - - - /** - * Return the type of the schema. - * - * @return SchemaType - */ - public SchemaType getSchemaType() { return schemaType; } - - - /** - * Return the list of schema attributes in this schema. - * - * @return SchemaAttributes - */ - public SchemaAttributes getSchemaAttributes() - { - if (schemaAttributes == null) - { - return schemaAttributes; - } - else - { - return schemaAttributes.cloneIterator(super.getParentAsset()); - } - } - - - /** - * Return the maximum elements that can be stored in this schema. This is set up by the caller. - * Zero means not bounded. For a STRUCT the max elements are the number of elements in - * the structure. - * - * @return int maximum number of elements - */ - public int getMaximumElements() - { - if (schemaType == SchemaType.STRUCT) - { - maximumElements = schemaAttributes.getElementCount(); - } - - return maximumElements; - } - - - /** - * Return a list of any links that exist between the schema attributes of this schema (or others). - * These links are typically used for network type schemas such as a grpah schema - or may be used to show - * linkage to an element in another schema. - * - * @return SchemaLinks - list of linked schema attributes - */ - public SchemaLinks getSchemaLinks() - { - if (schemaLinks == null) - { - return schemaLinks; - } - else - { - return schemaLinks.cloneIterator(super.getParentAsset()); - } - } - - - /** - * Returns a clone of this object as the abstract SchemaElement class. - * - * @param parentAsset - description of the asset that this schema element is attached to. - * @return a copy of this schema as a SchemaElement - */ - @Override - public SchemaElement cloneSchemaElement(AssetDescriptor parentAsset) - { - return new Schema(parentAsset, this); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "Schema{" + - "schemaType=" + schemaType + - ", schemaAttributes=" + schemaAttributes + - ", maximumElements=" + maximumElements + - ", schemaLinks=" + schemaLinks + - ", qualifiedName='" + qualifiedName + '\'' + - ", additionalProperties=" + additionalProperties + - ", meanings=" + meanings + - ", type=" + type + - ", guid='" + guid + '\'' + - ", url='" + url + '\'' + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaAttribute.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaAttribute.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaAttribute.java deleted file mode 100644 index bdf234f..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaAttribute.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - - -/** - * <p> - * SchemaAttribute describes a single attribute within a schema. The attribute has a name, order in the - * schema and cardinality. - * Its type is another SchemaElement (either Schema or PrimitiveSchemaElement). - * </p> - * <p> - * If it is a PrimitiveSchemaElement it may have an override for the default value within. - * </p> - */ -public class SchemaAttribute extends AssetPropertyBase -{ - String attributeName = null; - int elementPosition = 0; - String cardinality = null; - String defaultValueOverride = null; - SchemaElement attributeType = null; - - - /** - * Typical Constructor - * - * @param parentAsset - description of the asset that this schema attribute is attached to. - * @param attributeName - the name of this attribute - * @param elementPosition - position in schema - 0 means first - * @param cardinality - cardinality defined for this schema attribute. - * @param defaultValueOverride - default value for this attribute that would override the default defined in the - * schema element for this attribute's type (note only used is type is primitive). - * @param attributeType - the SchemaElement that relates to the type of this attribute. - */ - public SchemaAttribute(AssetDescriptor parentAsset, - String attributeName, - int elementPosition, - String cardinality, - String defaultValueOverride, - SchemaElement attributeType) - { - super(parentAsset); - - this.attributeName = attributeName; - this.elementPosition = elementPosition; - this.cardinality = cardinality; - this.defaultValueOverride = defaultValueOverride; - this.attributeType = attributeType; - } - - /** - * Copy/clone constructor. - * - * @param parentAsset - description of the asset that this schema attribute is attached to. - * @param template - template schema attribute to copy. - */ - public SchemaAttribute(AssetDescriptor parentAsset, SchemaAttribute template) - { - super(parentAsset, template); - - if (template != null) - { - attributeName = template.getAttributeName(); - elementPosition = template.getElementPosition(); - cardinality = template.getCardinality(); - defaultValueOverride = template.getDefaultValueOverride(); - - SchemaElement templateAttributeType = template.getAttributeType(); - if (templateAttributeType != null) - { - /* - * SchemaElement is an abstract class with a placeholder method to clone an object - * of its sub-class. When cloneSchemaElement() is called, the implementation in the - * sub-class is called. - */ - attributeType = templateAttributeType.cloneSchemaElement(parentAsset); - } - } - } - - - /** - * Return the name of this schema attribute. - * - * @return String attribute name - */ - public String getAttributeName() { return attributeName; } - - - /** - * Return the position of this schema attribute in its parent schema. - * - * @return int position in schema - 0 means first - */ - public int getElementPosition() { return elementPosition; } - - - /** - * Return the cardinality defined for this schema attribute. - * - * @return String cardinality defined for this schema attribute. - */ - public String getCardinality() { return cardinality; } - - - /** - * Return any default value for this attribute that would override the default defined in the - * schema element for this attribute's type (note only used is type is primitive). - * - * @return String default value override - */ - public String getDefaultValueOverride() { return defaultValueOverride; } - - - /** - * Return the SchemaElement that relates to the type of this attribute. - * - * @return SchemaElement - */ - public SchemaElement getAttributeType() - { - if (attributeType == null) - { - return attributeType; - } - else - { - return attributeType.cloneSchemaElement(super.getParentAsset()); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaAttributes.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaAttributes.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaAttributes.java deleted file mode 100644 index a595427..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaAttributes.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - -import java.util.Iterator; - -/** - * SchemaAttributes supports an iterator over a list of schema attribute elements that make up a schema. - * Callers can use it to step through the list - * just once. If they want to parse the list again, they could use the copy/clone constructor to create - * a new iterator. - */ -public abstract class SchemaAttributes extends AssetPropertyIteratorBase implements Iterator<SchemaAttribute> -{ - /** - * Typical Constructor creates an iterator with the supplied list of elements. - * - * @param parentAsset - descriptor of parent asset - * @param totalElementCount - the total number of elements to process. A negative value is converted to 0. - * @param maxCacheSize - maximum number of elements that should be retrieved from the property server and - * cached in the element list at any one time. If a number less than one is supplied, 1 is used. - */ - public SchemaAttributes(AssetDescriptor parentAsset, - int totalElementCount, - int maxCacheSize) - { - super(parentAsset, totalElementCount, maxCacheSize); - } - - - /** - * Copy/clone constructor. Used to reset iterator element pointer to 0; - * - * @param parentAsset - descriptor of parent asset - * @param template - type-specific iterator to copy; null to create an empty iterator - */ - public SchemaAttributes(AssetDescriptor parentAsset, SchemaAttributes template) - { - super(parentAsset, template); - } - - - /** - * Provides a concrete implementation of cloneElement for the specific iterator type. - * - * @param parentAsset - descriptor of parent asset - * @param template - object to clone - * @return new cloned object. - */ - protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template) - { - return new SchemaAttribute(parentAsset, (SchemaAttribute)template); - } - - - /** - * Clones this iterator. - * - * @param parentAsset - descriptor of parent asset - * @return new cloned object. - */ - protected abstract SchemaAttributes cloneIterator(AssetDescriptor parentAsset); - - - /** - * The iterator can only be used once to step through the elements. This method returns - * a boolean to indicate if it has got to the end of the list yet. - * - * @return boolean indicating whether there are more elements. - */ - @Override - public boolean hasNext() - { - return super.pagingIterator.hasNext(); - } - - - /** - * Return the next element in the iteration. - * - * @return SchemaAttribute - next element object that has been cloned. - */ - @Override - public SchemaAttribute next() - { - return (SchemaAttribute)super.pagingIterator.next(); - } - - - /** - * Remove the current element in the iterator. (Null implementation since this iterator works off of cached - * elements from the property (metadata) server.) - */ - @Override - public void remove() - { - super.pagingIterator.remove(); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "SchemaAttributes{" + - "pagingIterator=" + pagingIterator + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaElement.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaElement.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaElement.java deleted file mode 100644 index 79d4dcc..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaElement.java +++ /dev/null @@ -1,173 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.atlas.ocf.properties; - - -/** - * <p> - * The SchemaElement object provides a base class for the pieces that make up a schema for a data asset. - * A schema provides information about how the data is structured in the asset. Schemas are typically - * described as nested structures of linked schema elements. Schemas can also be reused in other schemas. - * </p> - * SchemaElement is an abstract class - used to enable the most accurate and precise mapping of the - * elements in a schema to the asset. - * <ul> - * <li>PrimitiveSchemaElement is for a leaf element in a schema.</li> - * <li>Schema is a complex structure of nested schema elements.</li> - * <li>MapSchemaElement is for an attribute of type Map</li> - * </ul> - * Most assets will be linked to a Schema. - * <p> - * Schema elements can be linked to one another using SchemaLink. - * </p> - */ -public abstract class SchemaElement extends Referenceable -{ - private String versionNumber = null; - private String author = null; - private String usage = null; - private String encodingStandard = null; - - - /** - * Typical constructor - * - * @param parentAsset - descriptor for parent asset - * @param type - details of the metadata type for this properties object - * @param guid - String - unique id - * @param url - String - URL - * @param classifications - enumeration of classifications - * @param qualifiedName - unique name - * @param additionalProperties - additional properties for the referenceable object. - * @param meanings - list of glossary terms (summary) - * @param versionNumber - the version number of the schema element - null means no version number. - * @param author - the name of the author of the schema element. Null means the author is unknown. - * @param usage - the usage guidance for this schema element. Null means no guidance available. - * @param encodingStandard - encoding standard used for this schema. It may be XML, JSON, SQL DDL or something else. - * Null means the encoding standard is unknown or there are many choices. - */ - public SchemaElement(AssetDescriptor parentAsset, - ElementType type, - String guid, - String url, - Classifications classifications, - String qualifiedName, - AdditionalProperties additionalProperties, - Meanings meanings, - String versionNumber, - String author, - String usage, - String encodingStandard) - { - super(parentAsset, type, guid, url, classifications, qualifiedName, additionalProperties, meanings); - - this.versionNumber = versionNumber; - this.author = author; - this.usage = usage; - this.encodingStandard = encodingStandard; - } - - - /** - * Copy/clone Constructor - the parentAsset is passed separately to the template because it is also - * likely to be being cloned in the same operation and we want the definitions clone to point to the - * asset clone and not the original asset. - * - * @param parentAsset - description of the asset that this schema element is attached to. - * @param templateSchema - template object to copy. - */ - public SchemaElement(AssetDescriptor parentAsset, SchemaElement templateSchema) - { - super(parentAsset, templateSchema); - - if (templateSchema != null) - { - versionNumber = templateSchema.getVersionNumber(); - author = templateSchema.getAuthor(); - usage = templateSchema.getUsage(); - encodingStandard = templateSchema.getEncodingStandard(); - } - } - - - /** - * Return a clone of this schema element. This method is needed because schema element - * is abstract. - * - * @param parentAsset - description of the asset that this schema element is attached to. - * @return Either a Schema or a PrimitiveSchemaElement depending on the type of the template. - */ - public abstract SchemaElement cloneSchemaElement(AssetDescriptor parentAsset); - - - /** - * Return the version number of the schema element - null means no version number. - * - * @return String version number - */ - public String getVersionNumber() { return versionNumber; } - - - /** - * Return the name of the author of the schema element. Null means the author is unknown. - * - * @return String author name - */ - public String getAuthor() { return author; } - - - /** - * Return the usage guidance for this schema element. Null means no guidance available. - * - * @return String usage guidance - */ - public String getUsage() { return usage; } - - - /** - * Return the format (encoding standard) used for this schema. It may be XML, JSON, SQL DDL or something else. - * Null means the encoding standard is unknown or there are many choices. - * - * @return String encoding standard - */ - public String getEncodingStandard() { return encodingStandard; } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "SchemaElement{" + - "versionNumber='" + versionNumber + '\'' + - ", author='" + author + '\'' + - ", usage='" + usage + '\'' + - ", encodingStandard='" + encodingStandard + '\'' + - ", qualifiedName='" + qualifiedName + '\'' + - ", additionalProperties=" + additionalProperties + - ", meanings=" + meanings + - ", type=" + type + - ", guid='" + guid + '\'' + - ", url='" + url + '\'' + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaImplementationQueries.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaImplementationQueries.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaImplementationQueries.java deleted file mode 100644 index 23ecd0f..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaImplementationQueries.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - -import java.util.Iterator; - -/** - * SchemaImplementationQuery supports an iterator over a list of schema query elements that make up a - * formula for a derived schema element. - * Callers can use it to step through the list - * just once. If they want to parse the list again, they could use the copy/clone constructor to create - * a new iterator. - */ -public abstract class SchemaImplementationQueries extends AssetPropertyIteratorBase implements Iterator<SchemaImplementationQuery> -{ - /** - * Typical Constructor creates an iterator with the supplied list of elements. - * - * @param parentAsset - descriptor of parent asset - * @param totalElementCount - the total number of elements to process. A negative value is converted to 0. - * @param maxCacheSize - maximum number of elements that should be retrieved from the property server and - * cached in the element list at any one time. If a number less than one is supplied, 1 is used. - */ - public SchemaImplementationQueries(AssetDescriptor parentAsset, - int totalElementCount, - int maxCacheSize) - { - super(parentAsset, totalElementCount, maxCacheSize); - } - - - /** - * Copy/clone constructor. Used to reset iterator element pointer to 0; - * - * @param parentAsset - descriptor of parent asset - * @param template - type-specific iterator to copy; null to create an empty iterator - */ - public SchemaImplementationQueries(AssetDescriptor parentAsset, SchemaImplementationQueries template) - { - super(parentAsset, template); - } - - - /** - * Provides a concrete implementation of cloneElement for the specific iterator type. - * - * @param parentAsset - descriptor of parent asset - * @param template - object to clone - * @return new cloned object. - */ - protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template) - { - return new SchemaImplementationQuery(parentAsset, (SchemaImplementationQuery) template); - } - - - /** - * Clones this iterator. - * - * @param parentAsset - descriptor of parent asset - * @return new cloned object. - */ - protected abstract SchemaImplementationQueries cloneIterator(AssetDescriptor parentAsset); - - - /** - * The iterator can only be used once to step through the elements. This method returns - * a boolean to indicate if it has got to the end of the list yet. - * - * @return boolean indicating whether there are more elements. - */ - @Override - public boolean hasNext() - { - return super.pagingIterator.hasNext(); - } - - - /** - * Return the next element in the iteration. - * - * @return SchemaImplementationQuery - next element object that has been cloned. - */ - @Override - public SchemaImplementationQuery next() - { - return (SchemaImplementationQuery)super.pagingIterator.next(); - } - - - /** - * Remove the current element in the iterator. (Null implementation since this iterator works off of cached - * elements from the property (metadata) server.) - */ - @Override - public void remove() - { - super.pagingIterator.remove(); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "SchemaImplementationQueries{" + - "pagingIterator=" + pagingIterator + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaImplementationQuery.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaImplementationQuery.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaImplementationQuery.java deleted file mode 100644 index fdfb4ce..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaImplementationQuery.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - - -/** - * SchemaImplementationQuery defines a query on a schema attribute that returns all or part of the value for a - * derived field. - */ -public class SchemaImplementationQuery extends AssetPropertyBase -{ - private int queryId = 0; - private String query = null; - private String queryType = null; - private SchemaAttribute queryTargetElement = null; - - - /** - * Typical Constructor - sets attributes to null. - * - * @param parentAsset - description of the asset that this schema query is attached to. - * @param queryId - int query identifier - this is used to identify where the results of this query should be plugged into - * the other queries or the formula for the parent derived schema element. - * @param query - query string for this element. The query string may have placeholders for values returned - * by queries that have a lower queryId than this element. - * @param queryType - the name of the query language used in the query. - * @param queryTargetElement - the SchemaAttribute that describes the type of the data source that - * will be queried to get the derived value. - */ - public SchemaImplementationQuery(AssetDescriptor parentAsset, int queryId, String query, String queryType, SchemaAttribute queryTargetElement) - { - super(parentAsset); - - this.queryId = queryId; - this.query = query; - this.queryType = queryType; - this.queryTargetElement = queryTargetElement; - } - - - /** - * Copy/clone constructor. - * - * @param parentAsset - description of the asset that this schema query is attached to. - * @param template - template schema query to copy. - */ - public SchemaImplementationQuery(AssetDescriptor parentAsset, SchemaImplementationQuery template) - { - super(parentAsset, template); - - if (template != null) - { - queryId = template.getQueryId(); - query = template.getQuery(); - queryType = template.getQueryType(); - - SchemaAttribute templateQueryTargetElement = template.getQueryTargetElement(); - if (templateQueryTargetElement != null) - { - queryTargetElement = new SchemaAttribute(super.getParentAsset(), templateQueryTargetElement); - } - } - } - - - /** - * Return the query id - this is used to identify where the results of this query should be plugged into - * the other queries or the formula for the parent derived schema element. - * - * @return int query identifier - */ - public int getQueryId() { return queryId; } - - - /** - * Return the query string for this element. The query string may have placeholders for values returned - * by queries that have a lower queryId than this element. - * - * @return String query - */ - public String getQuery() { return query; } - - - /** - * Return the name of the query language used in the query. - * - * @return queryType String - */ - public String getQueryType() { return queryType; } - - - /** - * Return the SchemaAttribute that describes the type of the data source that will be queried to get the - * derived value. - * - * @return SchemaAttribute - */ - public SchemaAttribute getQueryTargetElement() - { - if (queryTargetElement == null) - { - return queryTargetElement; - } - else - { - return new SchemaAttribute(super.getParentAsset(), queryTargetElement); - } - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "SchemaImplementationQuery{" + - "queryId=" + queryId + - ", query='" + query + '\'' + - ", queryType='" + queryType + '\'' + - ", queryTargetElement=" + queryTargetElement + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaLink.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaLink.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaLink.java deleted file mode 100644 index b182e63..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaLink.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - - -import java.util.ArrayList; - -/** - * SchemaLink defines a relationship between 2 SchemaElements. It is used in network type schemas such as a graph. - */ -public class SchemaLink extends AssetPropertyBase -{ - /* - * Attributes from the relationship - */ - private String linkGUID = null; - private String linkType = null; - - /* - * Attributes specific to SchemaLink - */ - private String linkName = null; - private AdditionalProperties linkProperties = null; - private ArrayList<String> linkedAttributeGUIDs = null; - - - /** - * Typical Constructor - * - * @param parentAsset - descriptor of parent asset - * @param linkGUID - the identifier of the schema link. - * @param linkType - the type of the link - this is related to the type of the schema it is a part of. - * @param linkName - the name of the schema link. - * @param linkProperties - the list of properties associated with this schema link. - * @param linkedAttributeGUIDs - GUIDs for either end of the link - return as an iterator. - */ - public SchemaLink(AssetDescriptor parentAsset, - String linkGUID, - String linkType, - String linkName, - AdditionalProperties linkProperties, - ArrayList<String> linkedAttributeGUIDs) - { - super(parentAsset); - - this.linkGUID = linkGUID; - this.linkType = linkType; - this.linkName = linkName; - this.linkProperties = linkProperties; - this.linkedAttributeGUIDs = linkedAttributeGUIDs; - } - - - /** - * Copy/clone constructor - makes a copy of the supplied object. - * - * @param parentAsset - descriptor of parent asset - * @param template - template object to copy - */ - public SchemaLink(AssetDescriptor parentAsset, SchemaLink template) - { - super(parentAsset, template); - - if (template != null) - { - linkGUID = template.getLinkGUID(); - linkName = template.getLinkName(); - linkType = template.getLinkType(); - - AdditionalProperties templateLinkProperties = template.getLinkProperties(); - if (templateLinkProperties != null) - { - linkProperties = new AdditionalProperties(super.getParentAsset(), templateLinkProperties); - } - - linkedAttributeGUIDs = template.getLinkedAttributeGUIDs(); - } - } - - - /** - * Return the identifier for the schema link. - * - * @return String guid - */ - public String getLinkGUID() { return linkGUID; } - - - /** - * Return the type of the link - this is related to the type of the schema it is a part of. - * - * @return String link type - */ - public String getLinkType() { return linkType; } - - - /** - * Return the name of this link - * - * @return String name - */ - public String getLinkName() { return linkName; } - - - /** - * Return the list of properties associated with this schema link. - * - * @return AdditionalProperties - */ - public AdditionalProperties getLinkProperties() - { - if (linkProperties == null) - { - return linkProperties; - } - else - { - return new AdditionalProperties(super.getParentAsset(), linkProperties); - } - } - - - /** - * Return the GUIDs of the schema attributes that this link connects together. - * - * @return SchemaAttributeGUIDs - GUIDs for either end of the link - return as a list. - */ - public ArrayList<String> getLinkedAttributeGUIDs() - { - if (linkedAttributeGUIDs == null) - { - return linkedAttributeGUIDs; - } - else - { - return new ArrayList<>(linkedAttributeGUIDs); - } - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "SchemaLink{" + - "linkGUID='" + linkGUID + '\'' + - ", linkType='" + linkType + '\'' + - ", linkName='" + linkName + '\'' + - ", linkProperties=" + linkProperties + - ", linkedAttributeGUIDs=" + linkedAttributeGUIDs + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaLinks.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaLinks.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaLinks.java deleted file mode 100644 index 68f9286..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaLinks.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - -import java.util.Iterator; - -/** - * SchemaLinks supports an iterator over a list of schema attribute links for a schema. - * Callers can use it to step through the list - * just once. If they want to parse the list again, they could use the copy/clone constructor to create - * a new iterator. - */ -public abstract class SchemaLinks extends AssetPropertyIteratorBase implements Iterator<SchemaLink> -{ - /** - * Typical Constructor creates an iterator with the supplied list of elements. - * - * @param parentAsset - descriptor of parent asset - * @param totalElementCount - the total number of elements to process. A negative value is converted to 0. - * @param maxCacheSize - maximum number of elements that should be retrieved from the property server and - * cached in the element list at any one time. If a number less than one is supplied, 1 is used. - */ - public SchemaLinks(AssetDescriptor parentAsset, - int totalElementCount, - int maxCacheSize) - { - super(parentAsset, totalElementCount, maxCacheSize); - } - - - /** - * Copy/clone constructor. Used to reset iterator element pointer to 0; - * - * @param parentAsset - descriptor of parent asset - * @param template - type-specific iterator to copy; null to create an empty iterator - */ - public SchemaLinks(AssetDescriptor parentAsset, SchemaLinks template) - { - super(parentAsset, template); - } - - - /** - * Provides a concrete implementation of cloneElement for the specific iterator type. - * - * @param parentAsset - descriptor of parent asset - * @param template - object to clone - * @return new cloned object. - */ - protected AssetPropertyBase cloneElement(AssetDescriptor parentAsset, AssetPropertyBase template) - { - return new SchemaLink(parentAsset, (SchemaLink)template); - } - - - /** - * Clones this iterator. - * - * @param parentAsset - descriptor of parent asset - * @return new cloned object. - */ - protected abstract SchemaLinks cloneIterator(AssetDescriptor parentAsset); - - - /** - * The iterator can only be used once to step through the elements. This method returns - * a boolean to indicate if it has got to the end of the list yet. - * - * @return boolean indicating whether there are more elements. - */ - @Override - public boolean hasNext() - { - return super.pagingIterator.hasNext(); - } - - - /** - * Return the next element in the iteration. - * - * @return SchemaLink - next element object that has been cloned. - */ - @Override - public SchemaLink next() - { - return (SchemaLink)super.pagingIterator.next(); - } - - - /** - * Remove the current element in the iterator. (Null implementation since this iterator works off of cached - * elements from the property (metadata) server.) - */ - @Override - public void remove() - { - super.pagingIterator.remove(); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "SchemaLinks{" + - "pagingIterator=" + pagingIterator + - '}'; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/b0ecc36a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaType.java ---------------------------------------------------------------------- diff --git a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaType.java b/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaType.java deleted file mode 100644 index 5faf10d..0000000 --- a/om-fwk-ocf/src/main/java/org/apache/atlas/ocf/properties/SchemaType.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.atlas.ocf.properties; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import java.io.Serializable; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -/** - * SchemaType describes the type of schema element. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public enum SchemaType implements Serializable -{ - UNKNOWN (0, "<Unknown>", "The schema type is unknown."), - STRUCT (1, "Struct" , "The schema type is a structure containing a list of properties of potentially different types."), - ARRAY (2, "Array" , "The schema type is a structure containing an ordered list of properties all of the same type."), - SET (3, "Set" , "The schema type is a structure containing an unordered collection of properties, all of the same type."); - - private int schemaTypeCode; - private String schemaTypeName; - private String schemaTypeDescription; - - private static final long serialVersionUID = 1L; - - /** - * Constructor to set up the instance of this enum. - * - * @param schemaTypeCode - code number - * @param schemaTypeName - default name - * @param schemaTypeDescription - default description - */ - SchemaType(int schemaTypeCode, String schemaTypeName, String schemaTypeDescription) - { - this.schemaTypeCode = schemaTypeCode; - this.schemaTypeName = schemaTypeName; - this.schemaTypeDescription = schemaTypeDescription; - } - - - /** - * Return the code for this enum used for indexing based on the enum value. - * - * @return int code number - */ - public int getSchemaTypeCode() - { - return schemaTypeCode; - } - - - /** - * Return the default name for this enum type. - * - * @return String name - */ - public String getSchemaTypeName() - { - return schemaTypeName; - } - - - /** - * Return the default description for this enum. - * - * @return String description - */ - public String getSchemaTypeDescription() - { - return schemaTypeDescription; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "SchemaType{" + - "schemaTypeCode=" + schemaTypeCode + - ", schemaTypeName='" + schemaTypeName + '\'' + - ", schemaTypeDescription='" + schemaTypeDescription + '\'' + - '}'; - } -}