http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceManager.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceManager.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceManager.java new file mode 100755 index 0000000..00e28e2 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceManager.java @@ -0,0 +1,93 @@ +/** + * Licensed 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.odf.api.discoveryservice; + +import java.io.InputStream; +import java.util.List; + +import org.apache.atlas.odf.api.settings.validation.ValidationException; + +/** + * + * External Java API for creating and managing discovery services + * + */ +public interface DiscoveryServiceManager { + + /** + * Retrieve list of discovery services registered in ODF + * @return List of registered ODF discovery services + */ + public List<DiscoveryServiceProperties> getDiscoveryServicesProperties(); + + /** + * Register a new service in ODF + * @param dsProperties Properties of the discovery service to register + * @throws ValidationException Validation of a property failed + */ + public void createDiscoveryService(DiscoveryServiceProperties dsProperties) throws ValidationException; + + /** + * Update configuration of an ODF discovery service + * @param dsProperties Properties of the discovery service to update + */ + public void replaceDiscoveryService(DiscoveryServiceProperties dsProperties) throws ServiceNotFoundException, ValidationException; + + /** + * Remove a registered service from ODF + * @param serviceId Discovery service ID + */ + public void deleteDiscoveryService(String serviceId) throws ServiceNotFoundException, ValidationException; + + /** + * Retrieve current configuration of a discovery services registered in ODF + * @param serviceId Discovery Service ID + * @return Properties of the service with this ID + * @throws ServiceNotFoundException A service with this ID is not registered + */ + public DiscoveryServiceProperties getDiscoveryServiceProperties(String serviceId) throws ServiceNotFoundException; + + /** + * Retrieve status overview of all discovery services registered in ODF + * @return List of status count maps for all discovery services + */ + public List<ServiceStatusCount> getDiscoveryServiceStatusOverview(); + + /** + * Retrieve status of a specific discovery service. Returns null if no service info can be obtained + * @param serviceId Discovery Service ID + * @return Status of the service with this ID + */ + public DiscoveryServiceStatus getDiscoveryServiceStatus(String serviceId) throws ServiceNotFoundException; + + /** + * Retrieve runtime statistics of a specific discovery service + * @param serviceId Discovery Service ID + * @return Runtime statistics of the service with this ID + */ + public DiscoveryServiceRuntimeStatistics getDiscoveryServiceRuntimeStatistics(String serviceId) throws ServiceNotFoundException; + + /** + * Delete runtime statistics of a specific discovery service + * @param serviceId Discovery Service ID + */ + public void deleteDiscoveryServiceRuntimeStatistics(String serviceId) throws ServiceNotFoundException; + + /** + * Retrieve picture representing a discovery service + * @param serviceId Discovery Service ID + * @return Input stream for image + */ + public InputStream getDiscoveryServiceImage(String serviceId) throws ServiceNotFoundException; +}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceProperties.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceProperties.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceProperties.java new file mode 100755 index 0000000..78989ec --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceProperties.java @@ -0,0 +1,173 @@ +/** + * Licensed 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.odf.api.discoveryservice; + +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +// JSON +/** + * + * This class is used for the registration of a service at an ODF instance. + * A JSON document of this type must be provided by a remote discovery service implementation in order to register it with an ODF instance + * + */ +@ApiModel(description="Parameters describing a discovery service.") +public class DiscoveryServiceProperties { + @ApiModelProperty(value="Unique id string of the discovery service", required=true) + private String id; + + @ApiModelProperty(value="Descriptive name of the discovery service", required=true) + private String name; + + @ApiModelProperty(value="Optional description of the discovery service") + private String description; + + @ApiModelProperty(value="Optional custom description of the discovery service") + private String customDescription; + + @ApiModelProperty(value="Optional link to a JPG or PNG image illustrating the discovery service") + private String iconUrl; + + @ApiModelProperty(value="Optional URL pointing to the description of the discovery service") + private String link; + + public String getCustomDescription() { + return customDescription; + } + + public void setCustomDescription(String customDescription) { + this.customDescription = customDescription; + } + + public List<String> getPrerequisiteAnnotationTypes() { + return prerequisiteAnnotationTypes; + } + + public void setPrerequisiteAnnotationTypes(List<String> prerequisiteAnnotationTypes) { + this.prerequisiteAnnotationTypes = prerequisiteAnnotationTypes; + } + + public List<String> getResultingAnnotationTypes() { + return resultingAnnotationTypes; + } + + public void setResultingAnnotationTypes(List<String> resultingAnnotationTypes) { + this.resultingAnnotationTypes = resultingAnnotationTypes; + } + + public List<String> getSupportedObjectTypes() { + return supportedObjectTypes; + } + + public void setSupportedObjectTypes(List<String> supportedObjectTypes) { + this.supportedObjectTypes = supportedObjectTypes; + } + + public List<String> getAssignedObjectTypes() { + return assignedObjectTypes; + } + + public void setAssignedObjectTypes(List<String> assignedObjectTypes) { + this.assignedObjectTypes = assignedObjectTypes; + } + + public List<String> getAssignedObjectCandidates() { + return assignedObjectCandidates; + } + + public void setAssignedObjectCandidates(List<String> assignedObjectCandidates) { + this.assignedObjectCandidates = assignedObjectCandidates; + } + + @ApiModelProperty(value="List of prerequisite annotation types required to run the discovery service") + private List<String> prerequisiteAnnotationTypes; + + @ApiModelProperty(value="List annotation types created by the discovery service") + private List<String> resultingAnnotationTypes; + + @ApiModelProperty(value="Types of objects that can be analyzed by the discovery service") + private List<String> supportedObjectTypes; + + @ApiModelProperty(value="Types of objects that may be assigned to the resulting annotations") + private List<String> assignedObjectTypes; + + @ApiModelProperty(value="Ids of specific objects (e.g. data classes) that may be assigned to resulting annotations") + private List<String> assignedObjectCandidates; + + @ApiModelProperty(value = "Number of parallel analyses the service can handle, with a default of 2") + private Integer parallelismCount = 2; + + @ApiModelProperty(value="Endpoint of the discovery service", required=true) + private DiscoveryServiceEndpoint endpoint; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getIconUrl() { + return iconUrl; + } + + public void setIconUrl(String iconURL) { + this.iconUrl = iconURL; + } + + public String getLink() { + return link; + } + + public void setLink(String link) { + this.link = link; + } + + public DiscoveryServiceEndpoint getEndpoint() { + return endpoint; + } + + public void setEndpoint(DiscoveryServiceEndpoint endpoint) { + this.endpoint = endpoint; + } + + public Integer getParallelismCount() { + return parallelismCount; + } + + public void setParallelismCount(Integer parallelismCount) { + this.parallelismCount = parallelismCount; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServicePropertiesList.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServicePropertiesList.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServicePropertiesList.java new file mode 100755 index 0000000..a922a08 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServicePropertiesList.java @@ -0,0 +1,33 @@ +/** + * Licensed 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.odf.api.discoveryservice; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * JSON object representing properties of registered discovery services. + * + */ + +@ApiModel(description="List of properties of registered discovery services") +public class DiscoveryServicePropertiesList { + + @ApiModelProperty(value="List of properties of registered discovery services", readOnly=true) + DiscoveryServiceProperties[] items; + + @ApiModelProperty(value="Number of items in the list", readOnly=true) + int count; + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceRequest.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceRequest.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceRequest.java new file mode 100755 index 0000000..392ca82 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceRequest.java @@ -0,0 +1,179 @@ +/** + * Licensed 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.odf.api.discoveryservice; + +import java.util.Map; + +import org.apache.atlas.odf.api.discoveryservice.datasets.DataSetContainer; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +// JSON +/** + * + * This class represents an analysis request that is passed from ODF to the service. + * + */ +@ApiModel(description="Request for running a single discovery service.") +public class DiscoveryServiceRequest { + /** + * The discoveryService identifier + */ + @ApiModelProperty(value="Id string of the discovery service to be issued", required=true) + private String discoveryServiceId; + /** + * This property can be used by a user to pass additional information from the analysis request to the service execution + */ + @ApiModelProperty(value="Optional additional properties to be passed to the discovery service", required=false) + private Map<String, Object> additionalProperties; + + @ApiModelProperty(value="User id under which the discovery service is supposed to run", required=true) + private String user; + /** + * This property contains information about the data that is supposed to be analysed + */ + @ApiModelProperty(value="Data set to be analyzed along with cached metadata objects", required=true) + private DataSetContainer dataSetContainer; + + @ApiModelProperty(value="Unique id of the analysis request to which the discovery service request belongs to", required=true) + private String odfRequestId; + + @ApiModelProperty(value="URL of ODF admin API for remote access to metadata", required=false) + private String odfUrl; + + @ApiModelProperty(value="ODF user id for remote access to metadata", required=false) + private String odfUser; + + @ApiModelProperty(value="ODF password for remote access to metadata", required=false) + private String odfPassword; + /** + * timestamp of the time the request was put on the ODF request queue + */ + @ApiModelProperty(value="Timestamp when the request was put on ODF request queue", required=true) + private long putOnRequestQueue; + /** + * timestamp of the time the request was taken from the queue and execution was started + */ + @ApiModelProperty(value="Timestamp when the execution was started", required=true) + private long takenFromRequestQueue; + /** + * timestamp of the time the request was processed successfully + */ + @ApiModelProperty(value="Timestamp when processing was finished", required=true) + private long finishedProcessing; + /** + * duration needed for storing the analysis results + */ + @ApiModelProperty(value="Time needed for storing results in metadata repository", required=true) + private long timeSpentStoringResults; + + public String getDiscoveryServiceId() { + return discoveryServiceId; + } + + public void setDiscoveryServiceId(String discoveryServiceId) { + this.discoveryServiceId = discoveryServiceId; + } + + public Map<String, Object> getAdditionalProperties() { + return additionalProperties; + } + + public void setAdditionalProperties(Map<String, Object> additionalProperties) { + this.additionalProperties = additionalProperties; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public DataSetContainer getDataSetContainer() { + return dataSetContainer; + } + + public void setDataSetContainer(DataSetContainer dataSet) { + this.dataSetContainer = dataSet; + } + + public String getOdfRequestId() { + return odfRequestId; + } + + public void setOdfRequestId(String odfRequestId) { + this.odfRequestId = odfRequestId; + } + + public String getOdfUrl() { + return odfUrl; + } + + public void setOdfUrl(String odfUrl) { + this.odfUrl = odfUrl; + } + + public String getOdfUser() { + return this.odfUser; + } + + public void setOdfUser(String odfUser) { + this.odfUser = odfUser; + } + + public String getOdfPassword() { + return this.odfPassword; + } + + public void setOdfPassword(String odfPassword) { + this.odfPassword = odfPassword; + } + + public long getFinishedProcessing() { + return finishedProcessing; + } + + public void setFinishedProcessing(long finishedProcessing) { + this.finishedProcessing = finishedProcessing; + } + + public long getTakenFromRequestQueue() { + return takenFromRequestQueue; + } + + public void setTakenFromRequestQueue(long takenFromRequestQueue) { + this.takenFromRequestQueue = takenFromRequestQueue; + } + + public long getPutOnRequestQueue() { + return putOnRequestQueue; + } + + public void setPutOnRequestQueue(long putOnRequestQueue) { + this.putOnRequestQueue = putOnRequestQueue; + } + + public long getTimeSpentStoringResults() { + return timeSpentStoringResults; + } + + public void setTimeSpentStoringResults(long timeSpentStoringResults) { + this.timeSpentStoringResults = timeSpentStoringResults; + } + +} + http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceResponse.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceResponse.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceResponse.java new file mode 100755 index 0000000..8208744 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceResponse.java @@ -0,0 +1,62 @@ +/** + * Licensed 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.odf.api.discoveryservice; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonSubTypes.Type; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.apache.atlas.odf.api.discoveryservice.async.DiscoveryServiceAsyncStartResponse; +import org.apache.atlas.odf.api.discoveryservice.sync.DiscoveryServiceSyncResponse; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +// JSON +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type") + +@JsonSubTypes({ + @Type(value = DiscoveryServiceAsyncStartResponse.class, name = "async"), + @Type(value = DiscoveryServiceSyncResponse.class, name = "sync") }) +@ApiModel(description="Response returned by the discovery service.", subTypes={DiscoveryServiceAsyncStartResponse.class,DiscoveryServiceSyncResponse.class}, discriminator="type") +public abstract class DiscoveryServiceResponse { + public static enum ResponseCode { + OK, NOT_AUTHORIZED, TEMPORARILY_UNAVAILABLE, UNKNOWN_ERROR + }; + + @ApiModelProperty(value="Response code indicating whether the discovery service request was issued successfully", readOnly=true, required=true) + private ResponseCode code; + + @ApiModelProperty(value="Detailed status of the analysis request", readOnly=true, required=false) + private String details; + + public ResponseCode getCode() { + return code; + } + + public void setCode(ResponseCode code) { + this.code = code; + } + + public String getDetails() { + return details; + } + + public void setDetails(String details) { + this.details = details; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceResult.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceResult.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceResult.java new file mode 100755 index 0000000..5c7fff9 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceResult.java @@ -0,0 +1,46 @@ +/** + * Licensed 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.odf.api.discoveryservice; + +import java.util.List; + +import org.apache.atlas.odf.api.metadata.models.Annotation; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +// JSON +/** + * + * This class must be returned by a service so that ODF can store the results. + * + */ +@ApiModel(description="Results of a discovery service run.") +public class DiscoveryServiceResult { + + /** + * The actual results of the service execution + */ + @ApiModelProperty(value="List of annotations generated by the discovery service run (following the format of the annotationPrototypes)", readOnly=true) + private List<Annotation> annotations; + + public List<Annotation> getAnnotations() { + return annotations; + } + + public void setAnnotations(List<Annotation> annotations) { + this.annotations = annotations; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceRuntimeStatistics.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceRuntimeStatistics.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceRuntimeStatistics.java new file mode 100755 index 0000000..15127e3 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceRuntimeStatistics.java @@ -0,0 +1,39 @@ +/** + * Licensed 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.odf.api.discoveryservice; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * JSON object representing runtime statics of a discovery service. + * + * + */ + +@ApiModel(description="Runtime statistics of a discovery service") +public class DiscoveryServiceRuntimeStatistics { + + // TODO: placeholder for things to add + @ApiModelProperty(value="Average processing time per item (in milliseconds)", readOnly=true) + long averageProcessingTimePerItemInMillis; + + public long getAverageProcessingTimePerItemInMillis() { + return averageProcessingTimePerItemInMillis; + } + + public void setAverageProcessingTimePerItemInMillis(long averageProcessingTimePerItemInMillis) { + this.averageProcessingTimePerItemInMillis = averageProcessingTimePerItemInMillis; + } +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceSparkEndpoint.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceSparkEndpoint.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceSparkEndpoint.java new file mode 100755 index 0000000..d377947 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceSparkEndpoint.java @@ -0,0 +1,79 @@ +/** + * Licensed 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.odf.api.discoveryservice; + +//JSON +/** + * + * This class describes a REST endpoint representing a remote service that can be used by ODF + * Note: It doesn't inherit from DiscoveryServiceEndpoint. To convert this from / to this class use JSONUtils.convert() + * + */ +public class DiscoveryServiceSparkEndpoint { + /** + * This property informs ODF about the type of input for the underlying Spark job, (CSV) file vs. (Database) connection. + */ + public static enum SERVICE_INTERFACE_TYPE { + DataFrame, Generic + } + + public static String ANNOTATION_PROPERTY_COLUMN_NAME = "ODF_ANNOTATED_COLUMN"; + public static String ANNOTATION_SUMMARY_COLUMN_NAME = "ODF_ANNOTATION_SUMMARY"; + public static String ODF_BEGIN_OF_ANNOTATION_RESULTS = "***ODF_BEGIN_OF_ANNOTATION_RESULTS***\n"; + + private String runtimeName; + + private SERVICE_INTERFACE_TYPE inputMethod = null; + + private String jar; + + private String className; + + public DiscoveryServiceSparkEndpoint() { + this.setRuntimeName("Spark"); + } + + public String getJar() { + return jar; + } + + public void setJar(String jar) { + this.jar = jar; + } + + public String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } + + public SERVICE_INTERFACE_TYPE getInputMethod() { + return inputMethod; + } + + public void setInputMethod(SERVICE_INTERFACE_TYPE inputMethod) { + this.inputMethod = inputMethod; + } + + public String getRuntimeName() { + return runtimeName; + } + + public void setRuntimeName(String runtimeName) { + this.runtimeName = runtimeName; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceStatus.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceStatus.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceStatus.java new file mode 100755 index 0000000..f263a9e --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/DiscoveryServiceStatus.java @@ -0,0 +1,62 @@ +/** + * Licensed 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.odf.api.discoveryservice; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel(description="Status of a discovery service") +public class DiscoveryServiceStatus { + public static enum Status { + OK, ERROR + }; + + /** + * JSON object representing the status of a discovery service. + */ + + @ApiModelProperty(value="Status of the ODF service", allowableValues="OK,ERROR", readOnly=true, required=true) + Status status; + + @ApiModelProperty(value="Status message", readOnly=true, required=true) + String message; + + @ApiModelProperty(value="Status count of the discovery service", readOnly=true, required=true) + ServiceStatusCount statusCount; + + public Status getStatus() { + return status; + } + + public void setStatus(Status status) { + this.status = status; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public ServiceStatusCount getStatusCount() { + return statusCount; + } + + public void setStatusCount(ServiceStatusCount statusCount) { + this.statusCount = statusCount; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/ServiceNotFoundException.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/ServiceNotFoundException.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/ServiceNotFoundException.java new file mode 100755 index 0000000..c320bf6 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/ServiceNotFoundException.java @@ -0,0 +1,38 @@ +/** + * Licensed 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.odf.api.discoveryservice; + +import java.text.MessageFormat; + +import org.apache.atlas.odf.api.settings.validation.ValidationException; + +public class ServiceNotFoundException extends ValidationException { + + /** + * + */ + private static final long serialVersionUID = 1L; + private String serviceId; + + public ServiceNotFoundException(String serviceId) { + super("Service not found"); + this.serviceId = serviceId; + } + + @Override + public String getMessage() { + return MessageFormat.format("Discovery service with id {0} is not registered", serviceId); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/ServiceStatusCount.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/ServiceStatusCount.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/ServiceStatusCount.java new file mode 100755 index 0000000..85ba444 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/ServiceStatusCount.java @@ -0,0 +1,58 @@ +/** + * Licensed 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.odf.api.discoveryservice; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.atlas.odf.api.analysis.AnalysisRequestTrackerStatus.STATUS; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel(description="Status of a discovery service.") +public class ServiceStatusCount { + @ApiModelProperty(value="Id string of the discovery service", readOnly=true, required=true) + private String id; + + @ApiModelProperty(value="Descriptive name of the discovery service", readOnly=true, required=true) + private String name; + + @ApiModelProperty(value="Status of the discovery service", readOnly=true) + private Map<STATUS, Integer> statusCountMap = new HashMap<STATUS, Integer>(); + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public Map<STATUS, Integer> getStatusCountMap() { + return statusCountMap; + } + + public void setStatusCountMap(Map<STATUS, Integer> statusCountMap) { + this.statusCountMap = statusCountMap; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/SyncDiscoveryServiceBase.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/SyncDiscoveryServiceBase.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/SyncDiscoveryServiceBase.java new file mode 100755 index 0000000..ef6666e --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/SyncDiscoveryServiceBase.java @@ -0,0 +1,46 @@ +/** + * Licensed 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.odf.api.discoveryservice; + +import java.util.List; + +import org.apache.atlas.odf.api.metadata.models.Annotation; +import org.apache.atlas.odf.api.discoveryservice.DiscoveryServiceResponse.ResponseCode; +import org.apache.atlas.odf.api.discoveryservice.sync.DiscoveryServiceSyncResponse; +import org.apache.atlas.odf.api.discoveryservice.sync.SyncDiscoveryService; + +/** + * + * This is an abstract class to extend when creating a synchronous discovery service + * + */ +public abstract class SyncDiscoveryServiceBase extends DiscoveryServiceBase implements SyncDiscoveryService { + + protected DiscoveryServiceSyncResponse createSyncResponse(ResponseCode code, String detailsMessage, List<? extends Annotation> annotations) { + try { + DiscoveryServiceSyncResponse response = new DiscoveryServiceSyncResponse(); + response.setCode(code); + response.setDetails(detailsMessage); + DiscoveryServiceResult result = new DiscoveryServiceResult(); + if (annotations != null) { + result.setAnnotations((List<Annotation>) annotations); + } + response.setResult(result); + return response; + } catch (Exception exc) { + throw new RuntimeException(exc); + } + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/async/AsyncDiscoveryService.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/async/AsyncDiscoveryService.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/async/AsyncDiscoveryService.java new file mode 100755 index 0000000..8a98a6b --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/async/AsyncDiscoveryService.java @@ -0,0 +1,29 @@ +/** + * Licensed 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.odf.api.discoveryservice.async; + +import org.apache.atlas.odf.api.discoveryservice.DiscoveryService; +import org.apache.atlas.odf.api.discoveryservice.DiscoveryServiceRequest; + + +/** + * An asynchronous discovery service must implement this interface + * + */ +public interface AsyncDiscoveryService extends DiscoveryService { + DiscoveryServiceAsyncStartResponse startAnalysis(DiscoveryServiceRequest request); + + DiscoveryServiceAsyncRunStatus getStatus(String runId); + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/async/DiscoveryServiceAsyncRunStatus.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/async/DiscoveryServiceAsyncRunStatus.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/async/DiscoveryServiceAsyncRunStatus.java new file mode 100755 index 0000000..49b50ca --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/async/DiscoveryServiceAsyncRunStatus.java @@ -0,0 +1,77 @@ +/** + * Licensed 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.odf.api.discoveryservice.async; + +import org.apache.atlas.odf.api.discoveryservice.DiscoveryServiceResult; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +// JSON +/** + * + * An object of this class must be returned when ODF requests the status of an analysis run. + * + */ +@ApiModel(description="Status of an asynchronous discovery service run.") +public class DiscoveryServiceAsyncRunStatus { + public static enum State { + RUNNING, ERROR, NOT_FOUND, FINISHED + } + + @ApiModelProperty(value="Id of the discovery service run", readOnly=true, required=true) + private String runId; + + @ApiModelProperty(value="Status of the discovery service run", readOnly=true, required=true) + private State state; + + @ApiModelProperty(value="Optional status message", readOnly=true) + private String details; + + @ApiModelProperty(value="Result of the discovery service run (if already available)", readOnly=true) + private DiscoveryServiceResult result; + + public String getRunId() { + return runId; + } + + public void setRunId(String runId) { + this.runId = runId; + } + + public State getState() { + return state; + } + + public void setState(State state) { + this.state = state; + } + + public String getDetails() { + return details; + } + + public void setDetails(String details) { + this.details = details; + } + + public DiscoveryServiceResult getResult() { + return result; + } + + public void setResult(DiscoveryServiceResult result) { + this.result = result; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/async/DiscoveryServiceAsyncStartResponse.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/async/DiscoveryServiceAsyncStartResponse.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/async/DiscoveryServiceAsyncStartResponse.java new file mode 100755 index 0000000..5d6027d --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/async/DiscoveryServiceAsyncStartResponse.java @@ -0,0 +1,41 @@ +/** + * Licensed 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.odf.api.discoveryservice.async; + +import org.apache.atlas.odf.api.discoveryservice.DiscoveryServiceResponse; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * An object of this class must be returned by an asynchronous service after starting + * + */ +@ApiModel(description="Response returned by an asynchronous discovery service.") +public class DiscoveryServiceAsyncStartResponse extends DiscoveryServiceResponse { + /** + * Property identifying the running analysis. This id will be used to repeatedly request the status of the analysis. + */ + @ApiModelProperty(value="Id of the analysis request (asynchronous requests only)", readOnly=true, required=true) + private String runId; + + public String getRunId() { + return runId; + } + + public void setRunId(String runId) { + this.runId = runId; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/datasets/DataSetContainer.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/datasets/DataSetContainer.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/datasets/DataSetContainer.java new file mode 100755 index 0000000..ed57357 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/datasets/DataSetContainer.java @@ -0,0 +1,52 @@ +/** + * Licensed 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.odf.api.discoveryservice.datasets; + +import org.apache.atlas.odf.api.metadata.models.MetaDataCache; +import org.apache.atlas.odf.api.metadata.models.MetaDataObject; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +// JSON +/** + * This class is a reference to a metadata object in a metadata store + * + */ +@ApiModel(description="Container keeping reference to data set along with cached metadata objects.") +public class DataSetContainer { + + @ApiModelProperty(value="Reference to the data set to be analyzed", required=true) + private MetaDataObject oMDataSet; + + @ApiModelProperty(value="A Metadata cache that may be used by discovery services if access to the metadata store is not available", required=false) + private MetaDataCache metaDataCache; + + public MetaDataObject getDataSet() { + return oMDataSet; + } + + public void setDataSet(MetaDataObject oMDataSet) { + this.oMDataSet = oMDataSet; + } + + public MetaDataCache getMetaDataCache() { + return metaDataCache; + } + + public void setMetaDataCache(MetaDataCache metaDataCache) { + this.metaDataCache = metaDataCache; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/datasets/MaterializedDataSet.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/datasets/MaterializedDataSet.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/datasets/MaterializedDataSet.java new file mode 100755 index 0000000..a00c4eb --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/datasets/MaterializedDataSet.java @@ -0,0 +1,57 @@ +/** + * Licensed 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.odf.api.discoveryservice.datasets; + +import java.util.List; + +import org.apache.atlas.odf.api.metadata.models.Column; +import org.apache.atlas.odf.api.metadata.models.RelationalDataSet; + +// JSON +/** + * This class represents the materialized contents of a data set + * + */ +public class MaterializedDataSet { + private RelationalDataSet table; + private List<Column> oMColumns; + + // row data in the same order as the oMColumns + private List<List<Object>> data; + + public List<Column> getColumns() { + return oMColumns; + } + + public void setColumns(List<Column> oMColumns) { + this.oMColumns = oMColumns; + } + + public RelationalDataSet getTable() { + return table; + } + + public void setTable(RelationalDataSet table) { + this.table = table; + } + + public List<List<Object>> getData() { + return data; + } + + public void setData(List<List<Object>> data) { + this.data = data; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/sync/DiscoveryServiceSyncResponse.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/sync/DiscoveryServiceSyncResponse.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/sync/DiscoveryServiceSyncResponse.java new file mode 100755 index 0000000..b5b69f4 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/sync/DiscoveryServiceSyncResponse.java @@ -0,0 +1,40 @@ +/** + * Licensed 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.odf.api.discoveryservice.sync; + +import org.apache.atlas.odf.api.discoveryservice.DiscoveryServiceResponse; +import org.apache.atlas.odf.api.discoveryservice.DiscoveryServiceResult; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +// JSON +/** + * An object of this class must be returned by a synchronous discovery service + * + */ +@ApiModel(description="Response returned by a synchronous discovery service.") +public class DiscoveryServiceSyncResponse extends DiscoveryServiceResponse { + @ApiModelProperty(value="Result of the analysis (synchronous requests only)", readOnly=true, required=true) + private DiscoveryServiceResult result; + + public DiscoveryServiceResult getResult() { + return result; + } + + public void setResult(DiscoveryServiceResult result) { + this.result = result; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/sync/SyncDiscoveryService.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/sync/SyncDiscoveryService.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/sync/SyncDiscoveryService.java new file mode 100755 index 0000000..626d78c --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/discoveryservice/sync/SyncDiscoveryService.java @@ -0,0 +1,33 @@ +/** + * Licensed 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.odf.api.discoveryservice.sync; + +import org.apache.atlas.odf.api.discoveryservice.DiscoveryService; +import org.apache.atlas.odf.api.discoveryservice.DiscoveryServiceRequest; + +/** + * + * Synchronous discovery services must implement this interface + * + */ +public interface SyncDiscoveryService extends DiscoveryService { + + /** + * Runs the actual discovery service. + * + * @param request Request parameter that includes a reference to the data set to be analyzed + * @return Response object that includes the annotations to be created along with status information + */ + DiscoveryServiceSyncResponse runAnalysis(DiscoveryServiceRequest request); +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/BrokerNode.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/BrokerNode.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/BrokerNode.java new file mode 100755 index 0000000..0805b30 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/BrokerNode.java @@ -0,0 +1,42 @@ +/** + * Licensed 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.odf.api.engine; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel(description="Kafka broker node details") +public class BrokerNode { + @ApiModelProperty(value="Kafka broker identifier", readOnly=true, required=true) + private String host; + + @ApiModelProperty(value="Indicates whether the broker is the leader of the partition", readOnly=true, required=true) + private boolean isLeader; + + public boolean isLeader() { + return isLeader; + } + + public void setLeader(boolean isLeader) { + this.isLeader = isLeader; + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/EngineManager.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/EngineManager.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/EngineManager.java new file mode 100755 index 0000000..4c441a9 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/EngineManager.java @@ -0,0 +1,76 @@ +/** + * Licensed 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.odf.api.engine; + +import java.util.List; + +/** +* +* External Java API for managing and controlling the ODF engine +* +*/ +public interface EngineManager { + + /** + * Checks the health status of ODF + * + * @return Health status of the ODF engine + */ + public SystemHealth checkHealthStatus(); + + + /** + * Get information about all available service runtimes. + * + * @return Runtimes info + */ + ServiceRuntimesInfo getRuntimesInfo(); + + /** + * Returns the status of the ODF thread manager + * + * @return Status of all threads making up the ODF thread manager + */ + public List<ThreadStatus> getThreadManagerStatus(); + + /** + * Returns the status of the ODF messaging subsystem + * + * @return Status of the ODF messaging subsystem + */ + public MessagingStatus getMessagingStatus(); + + /** + * Returns the status of the messaging subsystem and the internal thread manager + * + * @return Combined status of the messaging subsystem and the internal thread manager + */ + public ODFStatus getStatus(); + + /** + * Returns the current ODF version + * + * @return ODF version identifier + */ + public ODFVersion getVersion(); + + /** + * Shuts down the ODF engine, purges all scheduled analysis requests from the queues, and cancels all running analysis requests. + * This means that all running jobs will be cancelled or their results will not be reported back. + * (for debugging purposes only) + * + * @param options Option for immediately restarting the engine after shutdown (default is not to restart immediately but only when needed) + */ + public void shutdown(ODFEngineOptions options); +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaBrokerPartitionMessageCountInfo.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaBrokerPartitionMessageCountInfo.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaBrokerPartitionMessageCountInfo.java new file mode 100755 index 0000000..fdd84af --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaBrokerPartitionMessageCountInfo.java @@ -0,0 +1,39 @@ +/** + * Licensed 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.odf.api.engine; + +import java.util.HashMap; +import java.util.Map; + +public class KafkaBrokerPartitionMessageCountInfo { + + private String broker; + private Map<Integer, Long> partitionMsgCountMap = new HashMap<Integer, Long>(); + + public String getBroker() { + return broker; + } + + public void setBroker(String broker) { + this.broker = broker; + } + + public Map<Integer, Long> getPartitionMsgCountMap() { + return partitionMsgCountMap; + } + + public void setPartitionMsgCountMap(Map<Integer, Long> partitionMsgCountMap) { + this.partitionMsgCountMap = partitionMsgCountMap; + } +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaGroupOffsetInfo.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaGroupOffsetInfo.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaGroupOffsetInfo.java new file mode 100755 index 0000000..5f6e4f8 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaGroupOffsetInfo.java @@ -0,0 +1,45 @@ +/** + * Licensed 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.odf.api.engine; + +import java.util.ArrayList; +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel(description="Information on Kafka offsets per group id") +public class KafkaGroupOffsetInfo { + @ApiModelProperty(value="Kafka group id", readOnly=true, required=true) + private String groupId; + + @ApiModelProperty(value="List of Kafka offsets", readOnly=true, required=true) + private List<PartitionOffsetInfo> offsets = new ArrayList<PartitionOffsetInfo>(); + + public String getGroupId() { + return groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + public List<PartitionOffsetInfo> getOffsets() { + return offsets; + } + + public void setOffsets(List<PartitionOffsetInfo> offsets) { + this.offsets = offsets; + } +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaPartitionInfo.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaPartitionInfo.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaPartitionInfo.java new file mode 100755 index 0000000..8ab8f15 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaPartitionInfo.java @@ -0,0 +1,45 @@ +/** + * Licensed 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.odf.api.engine; + +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel(description="Kafka nodes belonging to a specific partition") +public class KafkaPartitionInfo { + @ApiModelProperty(value="Partition id", readOnly=true, required=true) + private Integer partitionId; + + @ApiModelProperty(value="List of nodes containing this partition", readOnly=true, required=true) + private List<BrokerNode> nodes; + + public List<BrokerNode> getNodes() { + return nodes; + } + + public void setNodes(List<BrokerNode> nodes) { + this.nodes = nodes; + } + + public Integer getPartitionId() { + return partitionId; + } + + public void setPartitionId(Integer partitionId) { + this.partitionId = partitionId; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaStatus.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaStatus.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaStatus.java new file mode 100755 index 0000000..10ff1a5 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaStatus.java @@ -0,0 +1,46 @@ +/** + * Licensed 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.odf.api.engine; + +import java.util.ArrayList; +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel(description="Status of the Kafka ODF queues") +public class KafkaStatus extends MessagingStatus { + @ApiModelProperty(value="List of message brokers", readOnly=true) + private List<String> brokers = new ArrayList<String>(); + + @ApiModelProperty(value="Status of the individual topics", readOnly=true) + private List<KafkaTopicStatus> topicStatus = new ArrayList<KafkaTopicStatus>(); + + public List<String> getBrokers() { + return brokers; + } + + public void setBrokers(List<String> brokers) { + this.brokers = brokers; + } + + public List<KafkaTopicStatus> getTopicStatus() { + return topicStatus; + } + + public void setTopicStatus(List<KafkaTopicStatus> topicStatus) { + this.topicStatus = topicStatus; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaTopicStatus.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaTopicStatus.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaTopicStatus.java new file mode 100755 index 0000000..7e41939 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/KafkaTopicStatus.java @@ -0,0 +1,69 @@ +/** + * Licensed 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.odf.api.engine; + +import java.util.ArrayList; +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel(description="Status of an individual Kafka topic") +public class KafkaTopicStatus { + + @ApiModelProperty(value="Kafka topic", readOnly=true, required=true) + private String topic; + + @ApiModelProperty(value="Information on Kafka offsets per group id (can be used by the admin to track how many messages are still waiting to be consumed)", readOnly=true, required=true) + private List<KafkaGroupOffsetInfo> consumerGroupOffsetInfo = new ArrayList<KafkaGroupOffsetInfo>(); + + @ApiModelProperty(value="List of Kafka partitions and the nodes they belong to", readOnly=true, required=true) + private List<KafkaPartitionInfo> partitionBrokersInfo = new ArrayList<KafkaPartitionInfo>(); + + @ApiModelProperty(value="Message counts of individual brokers", readOnly=true, required=true) + private List<KafkaBrokerPartitionMessageCountInfo> brokerPartitionMessageCountInfo = new ArrayList<KafkaBrokerPartitionMessageCountInfo>(); + + public String getTopic() { + return topic; + } + + public void setTopic(String topic) { + this.topic = topic; + } + + public List<KafkaGroupOffsetInfo> getConsumerGroupOffsetInfo() { + return consumerGroupOffsetInfo; + } + + public void setConsumerGroupOffsetInfo(List<KafkaGroupOffsetInfo> offsetInfoList) { + this.consumerGroupOffsetInfo = offsetInfoList; + } + + public List<KafkaPartitionInfo> getPartitionBrokersInfo() { + return partitionBrokersInfo; + } + + public void setPartitionBrokersInfo(List<KafkaPartitionInfo> partitionBrokersMap) { + this.partitionBrokersInfo = partitionBrokersMap; + } + + public List<KafkaBrokerPartitionMessageCountInfo> getBrokerPartitionMessageInfo() { + return brokerPartitionMessageCountInfo; + } + + public void setBrokerPartitionMessageInfo(List<KafkaBrokerPartitionMessageCountInfo> brokerInfo) { + this.brokerPartitionMessageCountInfo = brokerInfo; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/MessagingStatus.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/MessagingStatus.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/MessagingStatus.java new file mode 100755 index 0000000..f3248ac --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/MessagingStatus.java @@ -0,0 +1,21 @@ +/** + * Licensed 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.odf.api.engine; + +import io.swagger.annotations.ApiModel; + +@ApiModel(description="Status of the ODF queues", subTypes={KafkaStatus.class}) +public class MessagingStatus { + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ODFEngineOptions.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ODFEngineOptions.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ODFEngineOptions.java new file mode 100755 index 0000000..fb3d3d6 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ODFEngineOptions.java @@ -0,0 +1,32 @@ +/** + * Licensed 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.odf.api.engine; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel(description="ODF startup options.") +public class ODFEngineOptions { + + @ApiModelProperty(value="Indicates whether to explicitly restart the queues after shutting down the ODF engine (or to implicitly restart them when needed)", required=true) + private boolean restart = false; + + public boolean isRestart() { + return this.restart; + } + + public void setRestart(boolean restart) { + this.restart = restart; + } +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ODFStatus.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ODFStatus.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ODFStatus.java new file mode 100755 index 0000000..3ae9068 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ODFStatus.java @@ -0,0 +1,45 @@ +/** + * Licensed 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.odf.api.engine; + +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel(description="Overall ODF status.") +public class ODFStatus { + + @ApiModelProperty(value="Status of the ODF queues", readOnly=true) + private MessagingStatus messagingStatus; + + @ApiModelProperty(value="Status of the ODF thread manager", readOnly=true) + private List<ThreadStatus> threadManagerStatus; + + public MessagingStatus getMessagingStatus() { + return this.messagingStatus; + } + + public void setMessagingStatus(MessagingStatus messagingStatus) { + this.messagingStatus = messagingStatus; + } + + public List<ThreadStatus> getThreadManagerStatus() { + return this.threadManagerStatus; + } + + public void setThreadManagerStatus(List<ThreadStatus> threadManagerStatus) { + this.threadManagerStatus = threadManagerStatus; + } +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ODFVersion.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ODFVersion.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ODFVersion.java new file mode 100755 index 0000000..d18825b --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ODFVersion.java @@ -0,0 +1,32 @@ +/** + * Licensed 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.odf.api.engine; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel(description="ODF version information.") +public class ODFVersion { + + @ApiModelProperty(value="Version of the ODF instance", readOnly=true, required=true) + private String version; + + public String getVersion() { + return this.version; + } + + public void setVersion(String version) { + this.version = version; + } +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/PartitionOffsetInfo.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/PartitionOffsetInfo.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/PartitionOffsetInfo.java new file mode 100755 index 0000000..ccaec51 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/PartitionOffsetInfo.java @@ -0,0 +1,53 @@ +/** + * Licensed 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.odf.api.engine; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel(description="Status of an individual Kafka offset") +public class PartitionOffsetInfo { + @ApiModelProperty(value="Partition id", readOnly=true, required=true) + private Integer partitionId; + + @ApiModelProperty(value="Kafka offset identifying the last consumed message within the partition", readOnly=true, required=true) + private Long offset; + + @ApiModelProperty(value="Status message", readOnly=true) + private String message; + + public Integer getPartitionId() { + return partitionId; + } + + public void setPartitionId(Integer partitionId) { + this.partitionId = partitionId; + } + + public Long getOffset() { + return offset; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ServiceRuntimeInfo.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ServiceRuntimeInfo.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ServiceRuntimeInfo.java new file mode 100755 index 0000000..4f3e871 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ServiceRuntimeInfo.java @@ -0,0 +1,36 @@ +/** + * Licensed 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.odf.api.engine; + +public class ServiceRuntimeInfo { + private String name; + private String description; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ServiceRuntimesInfo.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ServiceRuntimesInfo.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ServiceRuntimesInfo.java new file mode 100755 index 0000000..a244127 --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ServiceRuntimesInfo.java @@ -0,0 +1,29 @@ +/** + * Licensed 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.odf.api.engine; + +import java.util.List; + +public class ServiceRuntimesInfo { + private List<ServiceRuntimeInfo> runtimes; + + public List<ServiceRuntimeInfo> getRuntimes() { + return runtimes; + } + + public void setRuntimes(List<ServiceRuntimeInfo> runtimes) { + this.runtimes = runtimes; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/SystemHealth.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/SystemHealth.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/SystemHealth.java new file mode 100755 index 0000000..b6b918b --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/SystemHealth.java @@ -0,0 +1,62 @@ +/** + * Licensed 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.odf.api.engine; + +import java.util.ArrayList; +import java.util.List; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel(description="Overall ODF system health.") +public class SystemHealth { + + public static enum HealthStatus { + OK, WARNING, ERROR + } + + @ApiModelProperty(value="ODF health status", readOnly=true, required=true) + private HealthStatus status; + + @ApiModelProperty(value="List of status messages", readOnly=true) + private List<String> messages = new ArrayList<>(); + + @ApiModelProperty(value="Health status of the individual subsystems", readOnly=true) + private List<SystemHealth> subSystemsHealth = new ArrayList<>(); + + public HealthStatus getStatus() { + return status; + } + + public void setStatus(HealthStatus status) { + this.status = status; + } + + public List<String> getMessages() { + return messages; + } + + public void setMessages(List<String> messages) { + this.messages = messages; + } + + public List<SystemHealth> getSubSystemsHealth() { + return subSystemsHealth; + } + + public void setSubSystemsHealth(List<SystemHealth> subSystemsHealth) { + this.subSystemsHealth = subSystemsHealth; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ThreadStatus.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ThreadStatus.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ThreadStatus.java new file mode 100755 index 0000000..74e939e --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/engine/ThreadStatus.java @@ -0,0 +1,57 @@ +/** + * Licensed 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.odf.api.engine; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel(description="Status of the ODF thread manager") +public class ThreadStatus { + + public static enum ThreadState { RUNNING, FINISHED, NON_EXISTENT } + + @ApiModelProperty(value="Thread id", readOnly=true) + private String id; + + @ApiModelProperty(value="Thread status", readOnly=true) + private ThreadState state; + + @ApiModelProperty(value="Thread type", readOnly=true) + private String type; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ThreadState getState() { + return state; + } + + public void setState(ThreadState state) { + this.state = state; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/metadata/AnnotationPropagator.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/metadata/AnnotationPropagator.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/metadata/AnnotationPropagator.java new file mode 100755 index 0000000..1f48d0d --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/metadata/AnnotationPropagator.java @@ -0,0 +1,31 @@ +/** + * Licensed 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.odf.api.metadata; + +import org.apache.atlas.odf.api.annotation.AnnotationStore; + +/** + * Interface for the logic that propagates annotations from the AnnotationStore to the MetadataStore + * + */ +public interface AnnotationPropagator { + + /** + * Run the actual propagation process + *@param as The annotation store from which the annotations should be taken from + *@param requestId Propagate only annotations that belong to a specific analysis request id (optional) + * + */ + void propagateAnnotations(AnnotationStore as, String requestId); +} http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/6d19e129/odf/odf-api/src/main/java/org/apache/atlas/odf/api/metadata/AtlasMetadataQueryBuilder.java ---------------------------------------------------------------------- diff --git a/odf/odf-api/src/main/java/org/apache/atlas/odf/api/metadata/AtlasMetadataQueryBuilder.java b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/metadata/AtlasMetadataQueryBuilder.java new file mode 100755 index 0000000..849277c --- /dev/null +++ b/odf/odf-api/src/main/java/org/apache/atlas/odf/api/metadata/AtlasMetadataQueryBuilder.java @@ -0,0 +1,61 @@ +/** + * Licensed 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.odf.api.metadata; + +public class AtlasMetadataQueryBuilder extends MetadataQueryBuilder { + + @Override + public String build() { + if (this.objectType != null) { + StringBuilder query = new StringBuilder("from " + objectType); + boolean firstCondition = true; + if (this.conditions != null) { + for (Condition condition : conditions) { + if (condition instanceof SimpleCondition) { + SimpleCondition simpleCond = (SimpleCondition) condition; + if (firstCondition) { + query.append(" where "); + } else { + query.append(" and "); + } + query.append(simpleCond.getAttributeName()); + switch (simpleCond.getComparator()) { + case EQUALS: + query.append(" = "); + break; + case NOT_EQUALS: + query.append(" != "); + break; + default: + throw new RuntimeException("Comparator " + simpleCond.getComparator() + " is currently not supported"); + } + Object val = simpleCond.getValue(); + if (val instanceof MetaDataObjectReference) { + query.append("'" + ((MetaDataObjectReference) val).getId() + "'"); + } else if (val instanceof String) { + query.append("'" + val.toString() + "'"); + } else if (val == null) { + query.append("null"); + } else { + query.append(val.toString()); + } + } + firstCondition = false; + } + } + return query.toString(); + } + return null; + } +}
