You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by tb...@apache.org on 2013/03/19 20:53:31 UTC
svn commit: r1458480 - in
/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory:
./ Cluster.java Feed.java Instance.java IvoryService.java
Author: tbeerbower
Date: Tue Mar 19 19:53:31 2013
New Revision: 1458480
URL: http://svn.apache.org/r1458480
Log:
AMBARI-1658 - Implement API/Service Provider for HDFS mirroring
Added:
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Cluster.java
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Feed.java
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Instance.java
incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/IvoryService.java
Added: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Cluster.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Cluster.java?rev=1458480&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Cluster.java (added)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Cluster.java Tue Mar 19 19:53:31 2013
@@ -0,0 +1,119 @@
+/**
+ * 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.ambari.server.controller.ivory;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Ivory cluster.
+ */
+public class Cluster {
+
+ private final String name;
+ private final String colo;
+ private final Set<String> interfaces;
+ private final Set<String> locations;
+ private final Map<String, String> properties;
+
+ /**
+ * Construct a cluster.
+ *
+ * @param name the cluster name
+ * @param colo the colo
+ * @param interfaces the interfaces
+ * @param locations the locations
+ * @param properties the properties
+ */
+ public Cluster(String name, String colo, Set<String> interfaces, Set<String> locations, Map<String, String> properties) {
+ this.name = name;
+ this.colo = colo;
+ this.interfaces = interfaces;
+ this.locations = locations;
+ this.properties = properties;
+ }
+
+ /**
+ * Get the cluster name.
+ *
+ * @return the cluster name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Get the colo.
+ *
+ * @return the colo
+ */
+ public String getColo() {
+ return colo;
+ }
+
+ /**
+ * Get the interfaces.
+ *
+ * @return the interfaces
+ */
+ public Set<String> getInterfaces() {
+ return interfaces;
+ }
+
+ /**
+ * Get the locations.
+ *
+ * @return the locations
+ */
+ public Set<String> getLocations() {
+ return locations;
+ }
+
+ /**
+ * Get the properties.
+ *
+ * @return the properties
+ */
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Cluster cluster = (Cluster) o;
+
+ return !(colo != null ? !colo.equals(cluster.colo) : cluster.colo != null) &&
+ !(interfaces != null ? !interfaces.equals(cluster.interfaces) : cluster.interfaces != null) &&
+ !(locations != null ? !locations.equals(cluster.locations) : cluster.locations != null) &&
+ !(name != null ? !name.equals(cluster.name) : cluster.name != null) &&
+ !(properties != null ? !properties.equals(cluster.properties) : cluster.properties != null);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = name != null ? name.hashCode() : 0;
+ result = 31 * result + (colo != null ? colo.hashCode() : 0);
+ result = 31 * result + (interfaces != null ? interfaces.hashCode() : 0);
+ result = 31 * result + (locations != null ? locations.hashCode() : 0);
+ result = 31 * result + (properties != null ? properties.hashCode() : 0);
+ return result;
+ }
+}
Added: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Feed.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Feed.java?rev=1458480&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Feed.java (added)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Feed.java Tue Mar 19 19:53:31 2013
@@ -0,0 +1,131 @@
+/**
+ * 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.ambari.server.controller.ivory;
+
+/**
+ * Ivory feed.
+ */
+public class Feed {
+
+ private final String name;
+ private final String description;
+ private final String status;
+ private final String schedule;
+ private final String sourceClusterName;
+ private final String targetClusterName;
+
+ /**
+ * Construct a feed.
+ *
+ * @param name the feed name
+ * @param description the description
+ * @param status the status
+ * @param schedule the schedule
+ * @param sourceClusterName the source cluster name
+ * @param targetClusterName the target cluster name
+ */
+ public Feed(String name, String description, String status, String schedule, String sourceClusterName, String targetClusterName) {
+ this.name = name;
+ this.description = description;
+ this.status = status;
+ this.schedule = schedule;
+ this.sourceClusterName = sourceClusterName;
+ this.targetClusterName = targetClusterName;
+ }
+
+ /**
+ * Get the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Get the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Get the status.
+ *
+ * @return the status
+ */
+ public String getStatus() {
+ return status;
+ }
+
+ /**
+ * Get the schedule.
+ *
+ * @return the schedule
+ */
+ public String getSchedule() {
+ return schedule;
+ }
+
+ /**
+ * Get the source cluster name.
+ *
+ * @return the source cluster name
+ */
+ public String getSourceClusterName() {
+ return sourceClusterName;
+ }
+
+ /**
+ * Get the target cluster name.
+ *
+ * @return the target cluster name
+ */
+ public String getTargetClusterName() {
+ return targetClusterName;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Feed feed = (Feed) o;
+
+ return !(description != null ? !description.equals(feed.description) : feed.description != null) &&
+ !(name != null ? !name.equals(feed.name) : feed.name != null) &&
+ !(schedule != null ? !schedule.equals(feed.schedule) : feed.schedule != null) &&
+ !(sourceClusterName != null ? !sourceClusterName.equals(feed.sourceClusterName) : feed.sourceClusterName != null) &&
+ !(status != null ? !status.equals(feed.status) : feed.status != null) &&
+ !(targetClusterName != null ? !targetClusterName.equals(feed.targetClusterName) : feed.targetClusterName != null);
+
+ }
+
+ @Override
+ public int hashCode() {
+ int result = name != null ? name.hashCode() : 0;
+ result = 31 * result + (description != null ? description.hashCode() : 0);
+ result = 31 * result + (status != null ? status.hashCode() : 0);
+ result = 31 * result + (schedule != null ? schedule.hashCode() : 0);
+ result = 31 * result + (sourceClusterName != null ? sourceClusterName.hashCode() : 0);
+ result = 31 * result + (targetClusterName != null ? targetClusterName.hashCode() : 0);
+ return result;
+ }
+}
Added: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Instance.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Instance.java?rev=1458480&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Instance.java (added)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/Instance.java Tue Mar 19 19:53:31 2013
@@ -0,0 +1,144 @@
+/**
+ * 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.ambari.server.controller.ivory;
+
+/**
+ * Ivory mirroring job instance.
+ */
+public class Instance {
+
+ private final String feedName;
+ private final String id;
+ private final String status;
+ private final String startTime;
+ private final String endTime;
+ private final String details;
+ private final String log;
+
+ /**
+ * Construct an instance.
+ *
+ * @param feedName the feed name
+ * @param id the id
+ * @param status the status
+ * @param startTime the start time
+ * @param endTime the end time
+ * @param details the details
+ * @param log the log
+ */
+ public Instance(String feedName, String id, String status, String startTime, String endTime, String details, String log) {
+ this.feedName = feedName;
+ this.id = id;
+ this.status = status;
+ this.startTime = startTime;
+ this.endTime = endTime;
+ this.details = details;
+ this.log = log;
+ }
+
+ /**
+ * Get the feed name.
+ *
+ * @return the feed name
+ */
+ public String getFeedName() {
+ return feedName;
+ }
+
+ /**
+ * Get the ID.
+ *
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Get the status.
+ *
+ * @return the status
+ */
+ public String getStatus() {
+ return status;
+ }
+
+ /**
+ * Get the start time.
+ *
+ * @return the start time
+ */
+ public String getStartTime() {
+ return startTime;
+ }
+
+ /**
+ * Get the end time.
+ *
+ * @return the end time
+ */
+ public String getEndTime() {
+ return endTime;
+ }
+
+ /**
+ * Get the details.
+ *
+ * @return the details
+ */
+ public String getDetails() {
+ return details;
+ }
+
+ /**
+ * Get the log.
+ *
+ * @return the log
+ */
+ public String getLog() {
+ return log;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ Instance instance = (Instance) o;
+
+ return !(details != null ? !details.equals(instance.details) : instance.details != null) &&
+ !(endTime != null ? !endTime.equals(instance.endTime) : instance.endTime != null) &&
+ !(feedName != null ? !feedName.equals(instance.feedName) : instance.feedName != null) &&
+ !(id != null ? !id.equals(instance.id) : instance.id != null) &&
+ !(log != null ? !log.equals(instance.log) : instance.log != null) &&
+ !(startTime != null ? !startTime.equals(instance.startTime) : instance.startTime != null) &&
+ !(status != null ? !status.equals(instance.status) : instance.status != null);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = feedName != null ? feedName.hashCode() : 0;
+ result = 31 * result + (id != null ? id.hashCode() : 0);
+ result = 31 * result + (status != null ? status.hashCode() : 0);
+ result = 31 * result + (startTime != null ? startTime.hashCode() : 0);
+ result = 31 * result + (endTime != null ? endTime.hashCode() : 0);
+ result = 31 * result + (details != null ? details.hashCode() : 0);
+ result = 31 * result + (log != null ? log.hashCode() : 0);
+ return result;
+ }
+}
Added: incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/IvoryService.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/IvoryService.java?rev=1458480&view=auto
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/IvoryService.java (added)
+++ incubator/ambari/trunk/ambari-server/src/main/java/org/apache/ambari/server/controller/ivory/IvoryService.java Tue Mar 19 19:53:31 2013
@@ -0,0 +1,162 @@
+/**
+ * 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.ambari.server.controller.ivory;
+
+import java.util.List;
+
+/**
+ * Ivory service.
+ */
+public interface IvoryService {
+
+ // ----- Feed operations ---------------------------------------------------
+
+ /**
+ * Submit a feed.
+ *
+ * @param feed the feed
+ */
+ public void submitFeed(Feed feed);
+
+ /**
+ * Get a feed for the given name.
+ *
+ * @param feedName the feed name
+ *
+ * @return a feed that matches the given name; null if none is found
+ */
+ public Feed getFeed(String feedName);
+
+ /**
+ * Get all the known feed names.
+ *
+ * @return a list of feed names; may not be null
+ */
+ public List<String> getFeedNames();
+
+ /**
+ * Update a feed based on the given {@link Feed} object.
+ *
+ * @param feed the feed object
+ */
+ public void updateFeed(Feed feed);
+
+ /**
+ * Suspend the feed with the given feed name.
+ *
+ * @param feedName the feed name
+ */
+ public void suspendFeed(String feedName);
+
+ /**
+ * Resume the feed with the given feed name.
+ *
+ * @param feedName the feed name
+ */
+ public void resumeFeed(String feedName);
+
+ /**
+ * Schedule the feed with the given feed name.
+ *
+ * @param feedName the feed name
+ */
+ public void scheduleFeed(String feedName);
+
+ /**
+ * Delete the feed with the given feed name.
+ *
+ * @param feedName the feed name
+ */
+ public void deleteFeed(String feedName);
+
+
+ // ----- Cluster operations ------------------------------------------------
+
+ /**
+ * Submit a cluster.
+ *
+ * @param cluster the cluster
+ */
+ public void submitCluster(Cluster cluster);
+
+ /**
+ * Get a cluster for the given name.
+ *
+ * @param clusterName the cluster name
+ *
+ * @return a cluster that matches the given name; null if none is found
+ */
+ public Cluster getCluster(String clusterName);
+
+ /**
+ * Get all the known cluster names.
+ *
+ * @return a list of cluster names; may not be null
+ */
+ public List<String> getClusterNames();
+
+ /**
+ * Update a cluster based on the given {@link Cluster} object.
+ *
+ * @param cluster the cluster
+ */
+ public void updateCluster(Cluster cluster);
+
+ /**
+ * Delete the cluster with the given name.
+ *
+ * @param clusterName the cluster name
+ */
+ public void deleteCluster(String clusterName);
+
+
+ // ----- Instance operations -----------------------------------------------
+
+ /**
+ * Get all the instances for a given feed.
+ *
+ * @param feedName the feed name
+ *
+ * @return the list of instances for the given feed
+ */
+ public List<Instance> getInstances(String feedName); //read
+
+ /**
+ * Suspend the instance for the given feed name and id.
+ *
+ * @param feedName the feed name
+ * @param instanceId the id
+ */
+ public void suspendInstance(String feedName, String instanceId);
+
+ /**
+ * Resume the instance for the given feed name and id.
+ *
+ * @param feedName the feed name
+ * @param instanceId the id
+ */
+ public void resumeInstance(String feedName, String instanceId);
+
+ /**
+ * Kill the instance for the given feed name and id.
+ *
+ * @param feedName the feed name
+ * @param instanceId the id
+ */
+ public void killInstance(String feedName, String instanceId);
+}