http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerHistoryData.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerHistoryData.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerHistoryData.java deleted file mode 100644 index e606185..0000000 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerHistoryData.java +++ /dev/null @@ -1,182 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.server.applicationhistoryservice.records; - -import org.apache.hadoop.classification.InterfaceAudience.Public; -import org.apache.hadoop.classification.InterfaceStability.Unstable; -import org.apache.hadoop.yarn.api.records.ContainerId; -import org.apache.hadoop.yarn.api.records.ContainerState; -import org.apache.hadoop.yarn.api.records.NodeId; -import org.apache.hadoop.yarn.api.records.Priority; -import org.apache.hadoop.yarn.api.records.Resource; - -/** - * The class contains all the fields that are stored persistently for - * <code>RMContainer</code>. - */ -@Public -@Unstable -public class ContainerHistoryData { - - private ContainerId containerId; - - private Resource allocatedResource; - - private NodeId assignedNode; - - private Priority priority; - - private long startTime; - - private long finishTime; - - private String diagnosticsInfo; - - private int containerExitStatus; - - private ContainerState containerState; - - @Public - @Unstable - public static ContainerHistoryData newInstance(ContainerId containerId, - Resource allocatedResource, NodeId assignedNode, Priority priority, - long startTime, long finishTime, String diagnosticsInfo, - int containerExitCode, ContainerState containerState) { - ContainerHistoryData containerHD = new ContainerHistoryData(); - containerHD.setContainerId(containerId); - containerHD.setAllocatedResource(allocatedResource); - containerHD.setAssignedNode(assignedNode); - containerHD.setPriority(priority); - containerHD.setStartTime(startTime); - containerHD.setFinishTime(finishTime); - containerHD.setDiagnosticsInfo(diagnosticsInfo); - containerHD.setContainerExitStatus(containerExitCode); - containerHD.setContainerState(containerState); - return containerHD; - } - - @Public - @Unstable - public ContainerId getContainerId() { - return containerId; - } - - @Public - @Unstable - public void setContainerId(ContainerId containerId) { - this.containerId = containerId; - } - - @Public - @Unstable - public Resource getAllocatedResource() { - return allocatedResource; - } - - @Public - @Unstable - public void setAllocatedResource(Resource resource) { - this.allocatedResource = resource; - } - - @Public - @Unstable - public NodeId getAssignedNode() { - return assignedNode; - } - - @Public - @Unstable - public void setAssignedNode(NodeId nodeId) { - this.assignedNode = nodeId; - } - - @Public - @Unstable - public Priority getPriority() { - return priority; - } - - @Public - @Unstable - public void setPriority(Priority priority) { - this.priority = priority; - } - - @Public - @Unstable - public long getStartTime() { - return startTime; - } - - @Public - @Unstable - public void setStartTime(long startTime) { - this.startTime = startTime; - } - - @Public - @Unstable - public long getFinishTime() { - return finishTime; - } - - @Public - @Unstable - public void setFinishTime(long finishTime) { - this.finishTime = finishTime; - } - - @Public - @Unstable - public String getDiagnosticsInfo() { - return diagnosticsInfo; - } - - @Public - @Unstable - public void setDiagnosticsInfo(String diagnosticsInfo) { - this.diagnosticsInfo = diagnosticsInfo; - } - - @Public - @Unstable - public int getContainerExitStatus() { - return containerExitStatus; - } - - @Public - @Unstable - public void setContainerExitStatus(int containerExitStatus) { - this.containerExitStatus = containerExitStatus; - } - - @Public - @Unstable - public ContainerState getContainerState() { - return containerState; - } - - @Public - @Unstable - public void setContainerState(ContainerState containerState) { - this.containerState = containerState; - } - -}
http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerStartData.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerStartData.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerStartData.java deleted file mode 100644 index 0c6dd81..0000000 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerStartData.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.server.applicationhistoryservice.records; - -import org.apache.hadoop.classification.InterfaceAudience.Public; -import org.apache.hadoop.classification.InterfaceStability.Unstable; -import org.apache.hadoop.yarn.api.records.ContainerId; -import org.apache.hadoop.yarn.api.records.NodeId; -import org.apache.hadoop.yarn.api.records.Priority; -import org.apache.hadoop.yarn.api.records.Resource; -import org.apache.hadoop.yarn.util.Records; - -/** - * The class contains the fields that can be determined when - * <code>RMContainer</code> starts, and that need to be stored persistently. - */ -@Public -@Unstable -public abstract class ContainerStartData { - - @Public - @Unstable - public static ContainerStartData newInstance(ContainerId containerId, - Resource allocatedResource, NodeId assignedNode, Priority priority, - long startTime) { - ContainerStartData containerSD = - Records.newRecord(ContainerStartData.class); - containerSD.setContainerId(containerId); - containerSD.setAllocatedResource(allocatedResource); - containerSD.setAssignedNode(assignedNode); - containerSD.setPriority(priority); - containerSD.setStartTime(startTime); - return containerSD; - } - - @Public - @Unstable - public abstract ContainerId getContainerId(); - - @Public - @Unstable - public abstract void setContainerId(ContainerId containerId); - - @Public - @Unstable - public abstract Resource getAllocatedResource(); - - @Public - @Unstable - public abstract void setAllocatedResource(Resource resource); - - @Public - @Unstable - public abstract NodeId getAssignedNode(); - - @Public - @Unstable - public abstract void setAssignedNode(NodeId nodeId); - - @Public - @Unstable - public abstract Priority getPriority(); - - @Public - @Unstable - public abstract void setPriority(Priority priority); - - @Public - @Unstable - public abstract long getStartTime(); - - @Public - @Unstable - public abstract void setStartTime(long startTime); - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptFinishDataPBImpl.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptFinishDataPBImpl.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptFinishDataPBImpl.java deleted file mode 100644 index 945c12f..0000000 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptFinishDataPBImpl.java +++ /dev/null @@ -1,239 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.server.applicationhistoryservice.records.impl.pb; - -import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; -import org.apache.hadoop.yarn.api.records.FinalApplicationStatus; -import org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState; -import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl; -import org.apache.hadoop.yarn.api.records.impl.pb.ProtoUtils; -import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationAttemptFinishDataProto; -import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationAttemptFinishDataProtoOrBuilder; -import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationAttemptIdProto; -import org.apache.hadoop.yarn.proto.YarnProtos.FinalApplicationStatusProto; -import org.apache.hadoop.yarn.proto.YarnProtos.YarnApplicationAttemptStateProto; -import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationAttemptFinishData; - -import com.google.protobuf.TextFormat; - -public class ApplicationAttemptFinishDataPBImpl extends - ApplicationAttemptFinishData { - - ApplicationAttemptFinishDataProto proto = ApplicationAttemptFinishDataProto - .getDefaultInstance(); - ApplicationAttemptFinishDataProto.Builder builder = null; - boolean viaProto = false; - - public ApplicationAttemptFinishDataPBImpl() { - builder = ApplicationAttemptFinishDataProto.newBuilder(); - } - - public ApplicationAttemptFinishDataPBImpl( - ApplicationAttemptFinishDataProto proto) { - this.proto = proto; - viaProto = true; - } - - private ApplicationAttemptId applicationAttemptId; - - @Override - public ApplicationAttemptId getApplicationAttemptId() { - if (this.applicationAttemptId != null) { - return this.applicationAttemptId; - } - ApplicationAttemptFinishDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasApplicationAttemptId()) { - return null; - } - this.applicationAttemptId = - convertFromProtoFormat(p.getApplicationAttemptId()); - return this.applicationAttemptId; - } - - @Override - public void - setApplicationAttemptId(ApplicationAttemptId applicationAttemptId) { - maybeInitBuilder(); - if (applicationAttemptId == null) { - builder.clearApplicationAttemptId(); - } - this.applicationAttemptId = applicationAttemptId; - } - - @Override - public String getTrackingURL() { - ApplicationAttemptFinishDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasTrackingUrl()) { - return null; - } - return p.getTrackingUrl(); - } - - @Override - public void setTrackingURL(String trackingURL) { - maybeInitBuilder(); - if (trackingURL == null) { - builder.clearTrackingUrl(); - return; - } - builder.setTrackingUrl(trackingURL); - } - - @Override - public String getDiagnosticsInfo() { - ApplicationAttemptFinishDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasDiagnosticsInfo()) { - return null; - } - return p.getDiagnosticsInfo(); - } - - @Override - public void setDiagnosticsInfo(String diagnosticsInfo) { - maybeInitBuilder(); - if (diagnosticsInfo == null) { - builder.clearDiagnosticsInfo(); - return; - } - builder.setDiagnosticsInfo(diagnosticsInfo); - } - - @Override - public FinalApplicationStatus getFinalApplicationStatus() { - ApplicationAttemptFinishDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasFinalApplicationStatus()) { - return null; - } - return convertFromProtoFormat(p.getFinalApplicationStatus()); - } - - @Override - public void setFinalApplicationStatus( - FinalApplicationStatus finalApplicationStatus) { - maybeInitBuilder(); - if (finalApplicationStatus == null) { - builder.clearFinalApplicationStatus(); - return; - } - builder - .setFinalApplicationStatus(convertToProtoFormat(finalApplicationStatus)); - } - - @Override - public YarnApplicationAttemptState getYarnApplicationAttemptState() { - ApplicationAttemptFinishDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasYarnApplicationAttemptState()) { - return null; - } - return convertFromProtoFormat(p.getYarnApplicationAttemptState()); - } - - @Override - public void setYarnApplicationAttemptState(YarnApplicationAttemptState state) { - maybeInitBuilder(); - if (state == null) { - builder.clearYarnApplicationAttemptState(); - return; - } - builder.setYarnApplicationAttemptState(convertToProtoFormat(state)); - } - - public ApplicationAttemptFinishDataProto getProto() { - mergeLocalToProto(); - proto = viaProto ? proto : builder.build(); - viaProto = true; - return proto; - } - - @Override - public int hashCode() { - return getProto().hashCode(); - } - - @Override - public boolean equals(Object other) { - if (other == null) - return false; - if (other.getClass().isAssignableFrom(this.getClass())) { - return this.getProto().equals(this.getClass().cast(other).getProto()); - } - return false; - } - - @Override - public String toString() { - return TextFormat.shortDebugString(getProto()); - } - - private void mergeLocalToBuilder() { - if (this.applicationAttemptId != null - && !((ApplicationAttemptIdPBImpl) this.applicationAttemptId).getProto() - .equals(builder.getApplicationAttemptId())) { - builder - .setApplicationAttemptId(convertToProtoFormat(this.applicationAttemptId)); - } - } - - private void mergeLocalToProto() { - if (viaProto) { - maybeInitBuilder(); - } - mergeLocalToBuilder(); - proto = builder.build(); - viaProto = true; - } - - private void maybeInitBuilder() { - if (viaProto || builder == null) { - builder = ApplicationAttemptFinishDataProto.newBuilder(proto); - } - viaProto = false; - } - - private ApplicationAttemptIdPBImpl convertFromProtoFormat( - ApplicationAttemptIdProto applicationAttemptId) { - return new ApplicationAttemptIdPBImpl(applicationAttemptId); - } - - private ApplicationAttemptIdProto convertToProtoFormat( - ApplicationAttemptId applicationAttemptId) { - return ((ApplicationAttemptIdPBImpl) applicationAttemptId).getProto(); - } - - private FinalApplicationStatus convertFromProtoFormat( - FinalApplicationStatusProto finalApplicationStatus) { - return ProtoUtils.convertFromProtoFormat(finalApplicationStatus); - } - - private FinalApplicationStatusProto convertToProtoFormat( - FinalApplicationStatus finalApplicationStatus) { - return ProtoUtils.convertToProtoFormat(finalApplicationStatus); - } - - private YarnApplicationAttemptStateProto convertToProtoFormat( - YarnApplicationAttemptState state) { - return ProtoUtils.convertToProtoFormat(state); - } - - private YarnApplicationAttemptState convertFromProtoFormat( - YarnApplicationAttemptStateProto yarnApplicationAttemptState) { - return ProtoUtils.convertFromProtoFormat(yarnApplicationAttemptState); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptStartDataPBImpl.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptStartDataPBImpl.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptStartDataPBImpl.java deleted file mode 100644 index 1f67fc7..0000000 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptStartDataPBImpl.java +++ /dev/null @@ -1,208 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.server.applicationhistoryservice.records.impl.pb; - -import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; -import org.apache.hadoop.yarn.api.records.ContainerId; -import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl; -import org.apache.hadoop.yarn.api.records.impl.pb.ContainerIdPBImpl; -import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationAttemptStartDataProto; -import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationAttemptStartDataProtoOrBuilder; -import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationAttemptIdProto; -import org.apache.hadoop.yarn.proto.YarnProtos.ContainerIdProto; -import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationAttemptStartData; - -import com.google.protobuf.TextFormat; - -public class ApplicationAttemptStartDataPBImpl extends - ApplicationAttemptStartData { - - ApplicationAttemptStartDataProto proto = ApplicationAttemptStartDataProto - .getDefaultInstance(); - ApplicationAttemptStartDataProto.Builder builder = null; - boolean viaProto = false; - - public ApplicationAttemptStartDataPBImpl() { - builder = ApplicationAttemptStartDataProto.newBuilder(); - } - - public ApplicationAttemptStartDataPBImpl( - ApplicationAttemptStartDataProto proto) { - this.proto = proto; - viaProto = true; - } - - private ApplicationAttemptId applicationAttemptId; - private ContainerId masterContainerId; - - @Override - public ApplicationAttemptId getApplicationAttemptId() { - if (this.applicationAttemptId != null) { - return this.applicationAttemptId; - } - ApplicationAttemptStartDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasApplicationAttemptId()) { - return null; - } - this.applicationAttemptId = - convertFromProtoFormat(p.getApplicationAttemptId()); - return this.applicationAttemptId; - } - - @Override - public void - setApplicationAttemptId(ApplicationAttemptId applicationAttemptId) { - maybeInitBuilder(); - if (applicationAttemptId == null) { - builder.clearApplicationAttemptId(); - } - this.applicationAttemptId = applicationAttemptId; - } - - @Override - public String getHost() { - ApplicationAttemptStartDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasHost()) { - return null; - } - return p.getHost(); - } - - @Override - public void setHost(String host) { - maybeInitBuilder(); - if (host == null) { - builder.clearHost(); - return; - } - builder.setHost(host); - } - - @Override - public int getRPCPort() { - ApplicationAttemptStartDataProtoOrBuilder p = viaProto ? proto : builder; - return p.getRpcPort(); - } - - @Override - public void setRPCPort(int rpcPort) { - maybeInitBuilder(); - builder.setRpcPort(rpcPort); - } - - @Override - public ContainerId getMasterContainerId() { - if (this.masterContainerId != null) { - return this.masterContainerId; - } - ApplicationAttemptStartDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasApplicationAttemptId()) { - return null; - } - this.masterContainerId = convertFromProtoFormat(p.getMasterContainerId()); - return this.masterContainerId; - } - - @Override - public void setMasterContainerId(ContainerId masterContainerId) { - maybeInitBuilder(); - if (masterContainerId == null) { - builder.clearMasterContainerId(); - } - this.masterContainerId = masterContainerId; - } - - public ApplicationAttemptStartDataProto getProto() { - mergeLocalToProto(); - proto = viaProto ? proto : builder.build(); - viaProto = true; - return proto; - } - - @Override - public int hashCode() { - return getProto().hashCode(); - } - - @Override - public boolean equals(Object other) { - if (other == null) - return false; - if (other.getClass().isAssignableFrom(this.getClass())) { - return this.getProto().equals(this.getClass().cast(other).getProto()); - } - return false; - } - - @Override - public String toString() { - return TextFormat.shortDebugString(getProto()); - } - - private void mergeLocalToBuilder() { - if (this.applicationAttemptId != null - && !((ApplicationAttemptIdPBImpl) this.applicationAttemptId).getProto() - .equals(builder.getApplicationAttemptId())) { - builder - .setApplicationAttemptId(convertToProtoFormat(this.applicationAttemptId)); - } - if (this.masterContainerId != null - && !((ContainerIdPBImpl) this.masterContainerId).getProto().equals( - builder.getMasterContainerId())) { - builder - .setMasterContainerId(convertToProtoFormat(this.masterContainerId)); - } - } - - private void mergeLocalToProto() { - if (viaProto) { - maybeInitBuilder(); - } - mergeLocalToBuilder(); - proto = builder.build(); - viaProto = true; - } - - private void maybeInitBuilder() { - if (viaProto || builder == null) { - builder = ApplicationAttemptStartDataProto.newBuilder(proto); - } - viaProto = false; - } - - private ApplicationAttemptIdPBImpl convertFromProtoFormat( - ApplicationAttemptIdProto applicationAttemptId) { - return new ApplicationAttemptIdPBImpl(applicationAttemptId); - } - - private ApplicationAttemptIdProto convertToProtoFormat( - ApplicationAttemptId applicationAttemptId) { - return ((ApplicationAttemptIdPBImpl) applicationAttemptId).getProto(); - } - - private ContainerIdPBImpl - convertFromProtoFormat(ContainerIdProto containerId) { - return new ContainerIdPBImpl(containerId); - } - - private ContainerIdProto convertToProtoFormat(ContainerId masterContainerId) { - return ((ContainerIdPBImpl) masterContainerId).getProto(); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationFinishDataPBImpl.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationFinishDataPBImpl.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationFinishDataPBImpl.java deleted file mode 100644 index 337426d..0000000 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationFinishDataPBImpl.java +++ /dev/null @@ -1,226 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.server.applicationhistoryservice.records.impl.pb; - -import org.apache.hadoop.yarn.api.records.ApplicationId; -import org.apache.hadoop.yarn.api.records.FinalApplicationStatus; -import org.apache.hadoop.yarn.api.records.YarnApplicationState; -import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl; -import org.apache.hadoop.yarn.api.records.impl.pb.ProtoUtils; -import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationFinishDataProto; -import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationFinishDataProtoOrBuilder; -import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto; -import org.apache.hadoop.yarn.proto.YarnProtos.FinalApplicationStatusProto; -import org.apache.hadoop.yarn.proto.YarnProtos.YarnApplicationStateProto; -import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationFinishData; - -import com.google.protobuf.TextFormat; - -public class ApplicationFinishDataPBImpl extends ApplicationFinishData { - - ApplicationFinishDataProto proto = ApplicationFinishDataProto - .getDefaultInstance(); - ApplicationFinishDataProto.Builder builder = null; - boolean viaProto = false; - - private ApplicationId applicationId; - - public ApplicationFinishDataPBImpl() { - builder = ApplicationFinishDataProto.newBuilder(); - } - - public ApplicationFinishDataPBImpl(ApplicationFinishDataProto proto) { - this.proto = proto; - viaProto = true; - } - - @Override - public ApplicationId getApplicationId() { - if (this.applicationId != null) { - return this.applicationId; - } - ApplicationFinishDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasApplicationId()) { - return null; - } - this.applicationId = convertFromProtoFormat(p.getApplicationId()); - return this.applicationId; - } - - @Override - public void setApplicationId(ApplicationId applicationId) { - maybeInitBuilder(); - if (applicationId == null) { - builder.clearApplicationId(); - } - this.applicationId = applicationId; - } - - @Override - public long getFinishTime() { - ApplicationFinishDataProtoOrBuilder p = viaProto ? proto : builder; - return p.getFinishTime(); - } - - @Override - public void setFinishTime(long finishTime) { - maybeInitBuilder(); - builder.setFinishTime(finishTime); - } - - @Override - public String getDiagnosticsInfo() { - ApplicationFinishDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasDiagnosticsInfo()) { - return null; - } - return p.getDiagnosticsInfo(); - } - - @Override - public void setDiagnosticsInfo(String diagnosticsInfo) { - maybeInitBuilder(); - if (diagnosticsInfo == null) { - builder.clearDiagnosticsInfo(); - return; - } - builder.setDiagnosticsInfo(diagnosticsInfo); - } - - @Override - public FinalApplicationStatus getFinalApplicationStatus() { - ApplicationFinishDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasFinalApplicationStatus()) { - return null; - } - return convertFromProtoFormat(p.getFinalApplicationStatus()); - } - - @Override - public void setFinalApplicationStatus( - FinalApplicationStatus finalApplicationStatus) { - maybeInitBuilder(); - if (finalApplicationStatus == null) { - builder.clearFinalApplicationStatus(); - return; - } - builder - .setFinalApplicationStatus(convertToProtoFormat(finalApplicationStatus)); - } - - @Override - public YarnApplicationState getYarnApplicationState() { - ApplicationFinishDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasYarnApplicationState()) { - return null; - } - return convertFromProtoFormat(p.getYarnApplicationState()); - } - - @Override - public void setYarnApplicationState(YarnApplicationState state) { - maybeInitBuilder(); - if (state == null) { - builder.clearYarnApplicationState(); - return; - } - builder.setYarnApplicationState(convertToProtoFormat(state)); - } - - public ApplicationFinishDataProto getProto() { - mergeLocalToProto(); - proto = viaProto ? proto : builder.build(); - viaProto = true; - return proto; - } - - @Override - public int hashCode() { - return getProto().hashCode(); - } - - @Override - public boolean equals(Object other) { - if (other == null) - return false; - if (other.getClass().isAssignableFrom(this.getClass())) { - return this.getProto().equals(this.getClass().cast(other).getProto()); - } - return false; - } - - @Override - public String toString() { - return TextFormat.shortDebugString(getProto()); - } - - private void mergeLocalToBuilder() { - if (this.applicationId != null - && !((ApplicationIdPBImpl) this.applicationId).getProto().equals( - builder.getApplicationId())) { - builder.setApplicationId(convertToProtoFormat(this.applicationId)); - } - } - - private void mergeLocalToProto() { - if (viaProto) { - maybeInitBuilder(); - } - mergeLocalToBuilder(); - proto = builder.build(); - viaProto = true; - } - - private void maybeInitBuilder() { - if (viaProto || builder == null) { - builder = ApplicationFinishDataProto.newBuilder(proto); - } - viaProto = false; - } - - private ApplicationIdProto convertToProtoFormat(ApplicationId applicationId) { - return ((ApplicationIdPBImpl) applicationId).getProto(); - } - - private ApplicationIdPBImpl convertFromProtoFormat( - ApplicationIdProto applicationId) { - return new ApplicationIdPBImpl(applicationId); - } - - private FinalApplicationStatus convertFromProtoFormat( - FinalApplicationStatusProto finalApplicationStatus) { - return ProtoUtils.convertFromProtoFormat(finalApplicationStatus); - } - - private FinalApplicationStatusProto convertToProtoFormat( - FinalApplicationStatus finalApplicationStatus) { - return ProtoUtils.convertToProtoFormat(finalApplicationStatus); - } - - private YarnApplicationStateProto convertToProtoFormat( - YarnApplicationState state) { - return ProtoUtils.convertToProtoFormat(state); - } - - private YarnApplicationState convertFromProtoFormat( - YarnApplicationStateProto yarnApplicationState) { - return ProtoUtils.convertFromProtoFormat(yarnApplicationState); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationStartDataPBImpl.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationStartDataPBImpl.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationStartDataPBImpl.java deleted file mode 100644 index 56f7aff..0000000 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationStartDataPBImpl.java +++ /dev/null @@ -1,229 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.server.applicationhistoryservice.records.impl.pb; - -import org.apache.hadoop.yarn.api.records.ApplicationId; -import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl; -import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationStartDataProto; -import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationStartDataProtoOrBuilder; -import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto; -import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationStartData; - -import com.google.protobuf.TextFormat; - -public class ApplicationStartDataPBImpl extends ApplicationStartData { - - ApplicationStartDataProto proto = ApplicationStartDataProto - .getDefaultInstance(); - ApplicationStartDataProto.Builder builder = null; - boolean viaProto = false; - - private ApplicationId applicationId; - - public ApplicationStartDataPBImpl() { - builder = ApplicationStartDataProto.newBuilder(); - } - - public ApplicationStartDataPBImpl(ApplicationStartDataProto proto) { - this.proto = proto; - viaProto = true; - } - - @Override - public ApplicationId getApplicationId() { - if (this.applicationId != null) { - return this.applicationId; - } - ApplicationStartDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasApplicationId()) { - return null; - } - this.applicationId = convertFromProtoFormat(p.getApplicationId()); - return this.applicationId; - } - - @Override - public void setApplicationId(ApplicationId applicationId) { - maybeInitBuilder(); - if (applicationId == null) { - builder.clearApplicationId(); - } - this.applicationId = applicationId; - } - - @Override - public String getApplicationName() { - ApplicationStartDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasApplicationName()) { - return null; - } - return p.getApplicationName(); - } - - @Override - public void setApplicationName(String applicationName) { - maybeInitBuilder(); - if (applicationName == null) { - builder.clearApplicationName(); - return; - } - builder.setApplicationName(applicationName); - } - - @Override - public String getApplicationType() { - ApplicationStartDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasApplicationType()) { - return null; - } - return p.getApplicationType(); - } - - @Override - public void setApplicationType(String applicationType) { - maybeInitBuilder(); - if (applicationType == null) { - builder.clearApplicationType(); - return; - } - builder.setApplicationType(applicationType); - } - - @Override - public String getUser() { - ApplicationStartDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasUser()) { - return null; - } - return p.getUser(); - } - - @Override - public void setUser(String user) { - maybeInitBuilder(); - if (user == null) { - builder.clearUser(); - return; - } - builder.setUser(user); - } - - @Override - public String getQueue() { - ApplicationStartDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasQueue()) { - return null; - } - return p.getQueue(); - } - - @Override - public void setQueue(String queue) { - maybeInitBuilder(); - if (queue == null) { - builder.clearQueue(); - return; - } - builder.setQueue(queue); - } - - @Override - public long getSubmitTime() { - ApplicationStartDataProtoOrBuilder p = viaProto ? proto : builder; - return p.getSubmitTime(); - } - - @Override - public void setSubmitTime(long submitTime) { - maybeInitBuilder(); - builder.setSubmitTime(submitTime); - } - - @Override - public long getStartTime() { - ApplicationStartDataProtoOrBuilder p = viaProto ? proto : builder; - return p.getStartTime(); - } - - @Override - public void setStartTime(long startTime) { - maybeInitBuilder(); - builder.setStartTime(startTime); - } - - public ApplicationStartDataProto getProto() { - mergeLocalToProto(); - proto = viaProto ? proto : builder.build(); - viaProto = true; - return proto; - } - - @Override - public int hashCode() { - return getProto().hashCode(); - } - - @Override - public boolean equals(Object other) { - if (other == null) - return false; - if (other.getClass().isAssignableFrom(this.getClass())) { - return this.getProto().equals(this.getClass().cast(other).getProto()); - } - return false; - } - - @Override - public String toString() { - return TextFormat.shortDebugString(getProto()); - } - - private void mergeLocalToBuilder() { - if (this.applicationId != null - && !((ApplicationIdPBImpl) this.applicationId).getProto().equals( - builder.getApplicationId())) { - builder.setApplicationId(convertToProtoFormat(this.applicationId)); - } - } - - private void mergeLocalToProto() { - if (viaProto) { - maybeInitBuilder(); - } - mergeLocalToBuilder(); - proto = builder.build(); - viaProto = true; - } - - private void maybeInitBuilder() { - if (viaProto || builder == null) { - builder = ApplicationStartDataProto.newBuilder(proto); - } - viaProto = false; - } - - private ApplicationIdProto convertToProtoFormat(ApplicationId applicationId) { - return ((ApplicationIdPBImpl) applicationId).getProto(); - } - - private ApplicationIdPBImpl convertFromProtoFormat( - ApplicationIdProto applicationId) { - return new ApplicationIdPBImpl(applicationId); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerFinishDataPBImpl.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerFinishDataPBImpl.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerFinishDataPBImpl.java deleted file mode 100644 index 8bc01e0..0000000 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerFinishDataPBImpl.java +++ /dev/null @@ -1,204 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.server.applicationhistoryservice.records.impl.pb; - -import org.apache.hadoop.yarn.api.records.ContainerId; -import org.apache.hadoop.yarn.api.records.ContainerState; -import org.apache.hadoop.yarn.api.records.impl.pb.ContainerIdPBImpl; -import org.apache.hadoop.yarn.api.records.impl.pb.ProtoUtils; -import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ContainerFinishDataProto; -import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ContainerFinishDataProtoOrBuilder; -import org.apache.hadoop.yarn.proto.YarnProtos.ContainerIdProto; -import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStateProto; -import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ContainerFinishData; - -import com.google.protobuf.TextFormat; - -public class ContainerFinishDataPBImpl extends ContainerFinishData { - - ContainerFinishDataProto proto = ContainerFinishDataProto - .getDefaultInstance(); - ContainerFinishDataProto.Builder builder = null; - boolean viaProto = false; - - private ContainerId containerId; - - public ContainerFinishDataPBImpl() { - builder = ContainerFinishDataProto.newBuilder(); - } - - public ContainerFinishDataPBImpl(ContainerFinishDataProto proto) { - this.proto = proto; - viaProto = true; - } - - @Override - public ContainerId getContainerId() { - if (this.containerId != null) { - return this.containerId; - } - ContainerFinishDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasContainerId()) { - return null; - } - this.containerId = convertFromProtoFormat(p.getContainerId()); - return this.containerId; - } - - @Override - public void setContainerId(ContainerId containerId) { - maybeInitBuilder(); - if (containerId == null) { - builder.clearContainerId(); - } - this.containerId = containerId; - } - - @Override - public long getFinishTime() { - ContainerFinishDataProtoOrBuilder p = viaProto ? proto : builder; - return p.getFinishTime(); - } - - @Override - public void setFinishTime(long finishTime) { - maybeInitBuilder(); - builder.setFinishTime(finishTime); - } - - @Override - public String getDiagnosticsInfo() { - ContainerFinishDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasDiagnosticsInfo()) { - return null; - } - return p.getDiagnosticsInfo(); - } - - @Override - public void setDiagnosticsInfo(String diagnosticsInfo) { - maybeInitBuilder(); - if (diagnosticsInfo == null) { - builder.clearDiagnosticsInfo(); - return; - } - builder.setDiagnosticsInfo(diagnosticsInfo); - } - - @Override - public int getContainerExitStatus() { - ContainerFinishDataProtoOrBuilder p = viaProto ? proto : builder; - return p.getContainerExitStatus(); - } - - @Override - public ContainerState getContainerState() { - ContainerFinishDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasContainerState()) { - return null; - } - return convertFromProtoFormat(p.getContainerState()); - } - - @Override - public void setContainerState(ContainerState state) { - maybeInitBuilder(); - if (state == null) { - builder.clearContainerState(); - return; - } - builder.setContainerState(convertToProtoFormat(state)); - } - - @Override - public void setContainerExitStatus(int containerExitStatus) { - maybeInitBuilder(); - builder.setContainerExitStatus(containerExitStatus); - } - - public ContainerFinishDataProto getProto() { - mergeLocalToProto(); - proto = viaProto ? proto : builder.build(); - viaProto = true; - return proto; - } - - @Override - public int hashCode() { - return getProto().hashCode(); - } - - @Override - public boolean equals(Object other) { - if (other == null) - return false; - if (other.getClass().isAssignableFrom(this.getClass())) { - return this.getProto().equals(this.getClass().cast(other).getProto()); - } - return false; - } - - @Override - public String toString() { - return TextFormat.shortDebugString(getProto()); - } - - private void mergeLocalToBuilder() { - if (this.containerId != null - && !((ContainerIdPBImpl) this.containerId).getProto().equals( - builder.getContainerId())) { - builder.setContainerId(convertToProtoFormat(this.containerId)); - } - } - - private void mergeLocalToProto() { - if (viaProto) { - maybeInitBuilder(); - } - mergeLocalToBuilder(); - proto = builder.build(); - viaProto = true; - } - - private void maybeInitBuilder() { - if (viaProto || builder == null) { - builder = ContainerFinishDataProto.newBuilder(proto); - } - viaProto = false; - } - - private ContainerIdProto convertToProtoFormat(ContainerId containerId) { - return ((ContainerIdPBImpl) containerId).getProto(); - } - - private ContainerIdPBImpl - convertFromProtoFormat(ContainerIdProto containerId) { - return new ContainerIdPBImpl(containerId); - } - - private ContainerStateProto convertToProtoFormat(ContainerState state) { - return ProtoUtils.convertToProtoFormat(state); - } - - private ContainerState convertFromProtoFormat( - ContainerStateProto containerState) { - return ProtoUtils.convertFromProtoFormat(containerState); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerStartDataPBImpl.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerStartDataPBImpl.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerStartDataPBImpl.java deleted file mode 100644 index 6d248b2..0000000 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerStartDataPBImpl.java +++ /dev/null @@ -1,258 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.server.applicationhistoryservice.records.impl.pb; - -import org.apache.hadoop.yarn.api.records.ContainerId; -import org.apache.hadoop.yarn.api.records.NodeId; -import org.apache.hadoop.yarn.api.records.Priority; -import org.apache.hadoop.yarn.api.records.Resource; -import org.apache.hadoop.yarn.api.records.impl.pb.ContainerIdPBImpl; -import org.apache.hadoop.yarn.api.records.impl.pb.NodeIdPBImpl; -import org.apache.hadoop.yarn.api.records.impl.pb.PriorityPBImpl; -import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl; -import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ContainerStartDataProto; -import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ContainerStartDataProtoOrBuilder; -import org.apache.hadoop.yarn.proto.YarnProtos.ContainerIdProto; -import org.apache.hadoop.yarn.proto.YarnProtos.NodeIdProto; -import org.apache.hadoop.yarn.proto.YarnProtos.PriorityProto; -import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto; -import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ContainerStartData; - -import com.google.protobuf.TextFormat; - -public class ContainerStartDataPBImpl extends ContainerStartData { - - ContainerStartDataProto proto = ContainerStartDataProto.getDefaultInstance(); - ContainerStartDataProto.Builder builder = null; - boolean viaProto = false; - - private ContainerId containerId; - private Resource resource; - private NodeId nodeId; - private Priority priority; - - public ContainerStartDataPBImpl() { - builder = ContainerStartDataProto.newBuilder(); - } - - public ContainerStartDataPBImpl(ContainerStartDataProto proto) { - this.proto = proto; - viaProto = true; - } - - @Override - public ContainerId getContainerId() { - if (this.containerId != null) { - return this.containerId; - } - ContainerStartDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasContainerId()) { - return null; - } - this.containerId = convertFromProtoFormat(p.getContainerId()); - return this.containerId; - } - - @Override - public void setContainerId(ContainerId containerId) { - maybeInitBuilder(); - if (containerId == null) { - builder.clearContainerId(); - } - this.containerId = containerId; - } - - @Override - public Resource getAllocatedResource() { - if (this.resource != null) { - return this.resource; - } - ContainerStartDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasAllocatedResource()) { - return null; - } - this.resource = convertFromProtoFormat(p.getAllocatedResource()); - return this.resource; - } - - @Override - public void setAllocatedResource(Resource resource) { - maybeInitBuilder(); - if (resource == null) { - builder.clearAllocatedResource(); - } - this.resource = resource; - } - - @Override - public NodeId getAssignedNode() { - if (this.nodeId != null) { - return this.nodeId; - } - ContainerStartDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasAssignedNodeId()) { - return null; - } - this.nodeId = convertFromProtoFormat(p.getAssignedNodeId()); - return this.nodeId; - } - - @Override - public void setAssignedNode(NodeId nodeId) { - maybeInitBuilder(); - if (nodeId == null) { - builder.clearAssignedNodeId(); - } - this.nodeId = nodeId; - } - - @Override - public Priority getPriority() { - if (this.priority != null) { - return this.priority; - } - ContainerStartDataProtoOrBuilder p = viaProto ? proto : builder; - if (!p.hasPriority()) { - return null; - } - this.priority = convertFromProtoFormat(p.getPriority()); - return this.priority; - } - - @Override - public void setPriority(Priority priority) { - maybeInitBuilder(); - if (priority == null) { - builder.clearPriority(); - } - this.priority = priority; - } - - @Override - public long getStartTime() { - ContainerStartDataProtoOrBuilder p = viaProto ? proto : builder; - return p.getStartTime(); - } - - @Override - public void setStartTime(long startTime) { - maybeInitBuilder(); - builder.setStartTime(startTime); - } - - public ContainerStartDataProto getProto() { - mergeLocalToProto(); - proto = viaProto ? proto : builder.build(); - viaProto = true; - return proto; - } - - @Override - public int hashCode() { - return getProto().hashCode(); - } - - @Override - public boolean equals(Object other) { - if (other == null) - return false; - if (other.getClass().isAssignableFrom(this.getClass())) { - return this.getProto().equals(this.getClass().cast(other).getProto()); - } - return false; - } - - @Override - public String toString() { - return TextFormat.shortDebugString(getProto()); - } - - private void mergeLocalToBuilder() { - if (this.containerId != null - && !((ContainerIdPBImpl) this.containerId).getProto().equals( - builder.getContainerId())) { - builder.setContainerId(convertToProtoFormat(this.containerId)); - } - if (this.resource != null - && !((ResourcePBImpl) this.resource).getProto().equals( - builder.getAllocatedResource())) { - builder.setAllocatedResource(convertToProtoFormat(this.resource)); - } - if (this.nodeId != null - && !((NodeIdPBImpl) this.nodeId).getProto().equals( - builder.getAssignedNodeId())) { - builder.setAssignedNodeId(convertToProtoFormat(this.nodeId)); - } - if (this.priority != null - && !((PriorityPBImpl) this.priority).getProto().equals( - builder.getPriority())) { - builder.setPriority(convertToProtoFormat(this.priority)); - } - } - - private void mergeLocalToProto() { - if (viaProto) { - maybeInitBuilder(); - } - mergeLocalToBuilder(); - proto = builder.build(); - viaProto = true; - } - - private void maybeInitBuilder() { - if (viaProto || builder == null) { - builder = ContainerStartDataProto.newBuilder(proto); - } - viaProto = false; - } - - private ContainerIdProto convertToProtoFormat(ContainerId containerId) { - return ((ContainerIdPBImpl) containerId).getProto(); - } - - private ContainerIdPBImpl - convertFromProtoFormat(ContainerIdProto containerId) { - return new ContainerIdPBImpl(containerId); - } - - private ResourceProto convertToProtoFormat(Resource resource) { - return ((ResourcePBImpl) resource).getProto(); - } - - private ResourcePBImpl convertFromProtoFormat(ResourceProto resource) { - return new ResourcePBImpl(resource); - } - - private NodeIdProto convertToProtoFormat(NodeId nodeId) { - return ((NodeIdPBImpl) nodeId).getProto(); - } - - private NodeIdPBImpl convertFromProtoFormat(NodeIdProto nodeId) { - return new NodeIdPBImpl(nodeId); - } - - private PriorityProto convertToProtoFormat(Priority priority) { - return ((PriorityPBImpl) priority).getProto(); - } - - private PriorityPBImpl convertFromProtoFormat(PriorityProto priority) { - return new PriorityPBImpl(priority); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/GenericObjectMapper.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/GenericObjectMapper.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/GenericObjectMapper.java deleted file mode 100644 index b1846a3..0000000 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/GenericObjectMapper.java +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.hadoop.yarn.server.applicationhistoryservice.timeline; - -import java.io.IOException; - -import org.apache.hadoop.classification.InterfaceAudience; -import org.apache.hadoop.classification.InterfaceStability; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.ObjectReader; -import org.codehaus.jackson.map.ObjectWriter; - -/** - * A utility class providing methods for serializing and deserializing - * objects. The {@link #write(Object)} and {@link #read(byte[])} methods are - * used by the {@link LeveldbTimelineStore} to store and retrieve arbitrary - * JSON, while the {@link #writeReverseOrderedLong} and {@link - * #readReverseOrderedLong} methods are used to sort entities in descending - * start time order. - */ [email protected] [email protected] -public class GenericObjectMapper { - private static final byte[] EMPTY_BYTES = new byte[0]; - - public static final ObjectReader OBJECT_READER; - public static final ObjectWriter OBJECT_WRITER; - - static { - ObjectMapper mapper = new ObjectMapper(); - OBJECT_READER = mapper.reader(Object.class); - OBJECT_WRITER = mapper.writer(); - } - - /** - * Serializes an Object into a byte array. Along with {@link #read(byte[])}, - * can be used to serialize an Object and deserialize it into an Object of - * the same type without needing to specify the Object's type, - * as long as it is one of the JSON-compatible objects understood by - * ObjectMapper. - * - * @param o An Object - * @return A byte array representation of the Object - * @throws IOException if there is a write error - */ - public static byte[] write(Object o) throws IOException { - if (o == null) { - return EMPTY_BYTES; - } - return OBJECT_WRITER.writeValueAsBytes(o); - } - - /** - * Deserializes an Object from a byte array created with - * {@link #write(Object)}. - * - * @param b A byte array - * @return An Object - * @throws IOException if there is a read error - */ - public static Object read(byte[] b) throws IOException { - return read(b, 0); - } - - /** - * Deserializes an Object from a byte array at a specified offset, assuming - * the bytes were created with {@link #write(Object)}. - * - * @param b A byte array - * @param offset Offset into the array - * @return An Object - * @throws IOException if there is a read error - */ - public static Object read(byte[] b, int offset) throws IOException { - if (b == null || b.length == 0) { - return null; - } - return OBJECT_READER.readValue(b, offset, b.length - offset); - } - - /** - * Converts a long to a 8-byte array so that lexicographic ordering of the - * produced byte arrays sort the longs in descending order. - * - * @param l A long - * @return A byte array - */ - public static byte[] writeReverseOrderedLong(long l) { - byte[] b = new byte[8]; - return writeReverseOrderedLong(l, b, 0); - } - - public static byte[] writeReverseOrderedLong(long l, byte[] b, int offset) { - b[offset] = (byte)(0x7f ^ ((l >> 56) & 0xff)); - for (int i = offset+1; i < offset+7; i++) { - b[i] = (byte)(0xff ^ ((l >> 8*(7-i)) & 0xff)); - } - b[offset+7] = (byte)(0xff ^ (l & 0xff)); - return b; - } - - /** - * Reads 8 bytes from an array starting at the specified offset and - * converts them to a long. The bytes are assumed to have been created - * with {@link #writeReverseOrderedLong}. - * - * @param b A byte array - * @param offset An offset into the byte array - * @return A long - */ - public static long readReverseOrderedLong(byte[] b, int offset) { - long l = b[offset] & 0xff; - for (int i = 1; i < 8; i++) { - l = l << 8; - l = l | (b[offset+i]&0xff); - } - return l ^ 0x7fffffffffffffffl; - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/NameValuePair.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/NameValuePair.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/NameValuePair.java deleted file mode 100644 index d8dabd2..0000000 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/NameValuePair.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.hadoop.yarn.server.applicationhistoryservice.timeline; - -import org.apache.hadoop.classification.InterfaceAudience; -import org.apache.hadoop.classification.InterfaceStability; - -/** - * A class holding a name and value pair, used for specifying filters in - * {@link TimelineReader}. - */ [email protected] [email protected] -public class NameValuePair { - String name; - Object value; - - public NameValuePair(String name, Object value) { - this.name = name; - this.value = value; - } - - /** - * Get the name. - * @return The name. - */ - public String getName() { - - return name; - } - - /** - * Get the value. - * @return The value. - */ - public Object getValue() { - return value; - } - - @Override - public String toString() { - return "{ name: " + name + ", value: " + value + " }"; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/TimelineReader.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/TimelineReader.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/TimelineReader.java deleted file mode 100644 index 9ae9954..0000000 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/TimelineReader.java +++ /dev/null @@ -1,155 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.server.applicationhistoryservice.timeline; - -import java.io.IOException; -import java.util.Collection; -import java.util.EnumSet; -import java.util.Set; -import java.util.SortedSet; - -import org.apache.hadoop.classification.InterfaceAudience; -import org.apache.hadoop.classification.InterfaceStability; -import org.apache.hadoop.yarn.api.records.timeline.TimelineEntities; -import org.apache.hadoop.yarn.api.records.timeline.TimelineEntity; -import org.apache.hadoop.yarn.api.records.timeline.TimelineEvents; - -/** - * This interface is for retrieving timeline information. - */ [email protected] [email protected] -public interface TimelineReader { - - /** - * Possible fields to retrieve for {@link #getEntities} and {@link #getEntity} - * . - */ - enum Field { - EVENTS, - RELATED_ENTITIES, - PRIMARY_FILTERS, - OTHER_INFO, - LAST_EVENT_ONLY - } - - /** - * Default limit for {@link #getEntities} and {@link #getEntityTimelines}. - */ - final long DEFAULT_LIMIT = 100; - - /** - * This method retrieves a list of entity information, {@link TimelineEntity}, - * sorted by the starting timestamp for the entity, descending. The starting - * timestamp of an entity is a timestamp specified by the client. If it is not - * explicitly specified, it will be chosen by the store to be the earliest - * timestamp of the events received in the first put for the entity. - * - * @param entityType - * The type of entities to return (required). - * @param limit - * A limit on the number of entities to return. If null, defaults to - * {@link #DEFAULT_LIMIT}. - * @param windowStart - * The earliest start timestamp to retrieve (exclusive). If null, - * defaults to retrieving all entities until the limit is reached. - * @param windowEnd - * The latest start timestamp to retrieve (inclusive). If null, - * defaults to {@link Long#MAX_VALUE} - * @param fromId - * If fromId is not null, retrieve entities earlier than and - * including the specified ID. If no start time is found for the - * specified ID, an empty list of entities will be returned. The - * windowEnd parameter will take precedence if the start time of this - * entity falls later than windowEnd. - * @param fromTs - * If fromTs is not null, ignore entities that were inserted into the - * store after the given timestamp. The entity's insert timestamp - * used for this comparison is the store's system time when the first - * put for the entity was received (not the entity's start time). - * @param primaryFilter - * Retrieves only entities that have the specified primary filter. If - * null, retrieves all entities. This is an indexed retrieval, and no - * entities that do not match the filter are scanned. - * @param secondaryFilters - * Retrieves only entities that have exact matches for all the - * specified filters in their primary filters or other info. This is - * not an indexed retrieval, so all entities are scanned but only - * those matching the filters are returned. - * @param fieldsToRetrieve - * Specifies which fields of the entity object to retrieve (see - * {@link Field}). If the set of fields contains - * {@link Field#LAST_EVENT_ONLY} and not {@link Field#EVENTS}, the - * most recent event for each entity is retrieved. If null, retrieves - * all fields. - * @return An {@link TimelineEntities} object. - * @throws IOException - */ - TimelineEntities getEntities(String entityType, - Long limit, Long windowStart, Long windowEnd, String fromId, Long fromTs, - NameValuePair primaryFilter, Collection<NameValuePair> secondaryFilters, - EnumSet<Field> fieldsToRetrieve) throws IOException; - - /** - * This method retrieves the entity information for a given entity. - * - * @param entityId - * The entity whose information will be retrieved. - * @param entityType - * The type of the entity. - * @param fieldsToRetrieve - * Specifies which fields of the entity object to retrieve (see - * {@link Field}). If the set of fields contains - * {@link Field#LAST_EVENT_ONLY} and not {@link Field#EVENTS}, the - * most recent event for each entity is retrieved. If null, retrieves - * all fields. - * @return An {@link TimelineEntity} object. - * @throws IOException - */ - TimelineEntity getEntity(String entityId, String entityType, EnumSet<Field> - fieldsToRetrieve) throws IOException; - - /** - * This method retrieves the events for a list of entities all of the same - * entity type. The events for each entity are sorted in order of their - * timestamps, descending. - * - * @param entityType - * The type of entities to retrieve events for. - * @param entityIds - * The entity IDs to retrieve events for. - * @param limit - * A limit on the number of events to return for each entity. If - * null, defaults to {@link #DEFAULT_LIMIT} events per entity. - * @param windowStart - * If not null, retrieves only events later than the given time - * (exclusive) - * @param windowEnd - * If not null, retrieves only events earlier than the given time - * (inclusive) - * @param eventTypes - * Restricts the events returned to the given types. If null, events - * of all types will be returned. - * @return An {@link TimelineEvents} object. - * @throws IOException - */ - TimelineEvents getEntityTimelines(String entityType, - SortedSet<String> entityIds, Long limit, Long windowStart, - Long windowEnd, Set<String> eventTypes) throws IOException; -} http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/TimelineStore.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/TimelineStore.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/TimelineStore.java deleted file mode 100644 index 6b50d83..0000000 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/TimelineStore.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.server.applicationhistoryservice.timeline; - -import org.apache.hadoop.classification.InterfaceAudience; -import org.apache.hadoop.classification.InterfaceStability; -import org.apache.hadoop.service.Service; - [email protected] [email protected] -public interface TimelineStore extends - Service, TimelineReader, TimelineWriter { -} http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/TimelineWriter.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/TimelineWriter.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/TimelineWriter.java deleted file mode 100644 index bc8aada..0000000 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/timeline/TimelineWriter.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.server.applicationhistoryservice.timeline; - -import java.io.IOException; - -import org.apache.hadoop.classification.InterfaceAudience; -import org.apache.hadoop.classification.InterfaceStability; -import org.apache.hadoop.yarn.api.records.timeline.TimelineEntities; -import org.apache.hadoop.yarn.api.records.timeline.TimelinePutResponse; - -/** - * This interface is for storing timeline information. - */ [email protected] [email protected] -public interface TimelineWriter { - - /** - * Stores entity information to the timeline store. Any errors occurring for - * individual put request objects will be reported in the response. - * - * @param data - * An {@link TimelineEntities} object. - * @return An {@link TimelinePutResponse} object. - * @throws IOException - */ - TimelinePutResponse put(TimelineEntities data) throws IOException; - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AMSController.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AMSController.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AMSController.java deleted file mode 100644 index 0bf962e..0000000 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AMSController.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.server.applicationhistoryservice.webapp; - -import org.apache.hadoop.yarn.webapp.Controller; - -import com.google.inject.Inject; - -public class AMSController extends Controller { - - @Inject - AMSController(RequestContext ctx) { - super(ctx); - } - - @Override - public void index() { - setTitle("Ambari Metrics Service"); - } - -} http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AMSWebApp.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AMSWebApp.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AMSWebApp.java deleted file mode 100644 index 2f6eec7..0000000 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AMSWebApp.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.hadoop.yarn.server.applicationhistoryservice.webapp; - -import org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.timeline.TimelineMetricStore; -import org.apache.hadoop.yarn.webapp.GenericExceptionHandler; -import org.apache.hadoop.yarn.webapp.WebApp; -import org.apache.hadoop.yarn.webapp.YarnJacksonJaxbJsonProvider; -import org.apache.hadoop.yarn.webapp.YarnWebParams; - -public class AMSWebApp extends WebApp implements YarnWebParams { - - private final TimelineMetricStore timelineMetricStore; - - public AMSWebApp(TimelineMetricStore timelineMetricStore) { - this.timelineMetricStore = timelineMetricStore; - } - - @Override - public void setup() { - bind(YarnJacksonJaxbJsonProvider.class); - bind(TimelineWebServices.class); - bind(GenericExceptionHandler.class); - bind(TimelineMetricStore.class).toInstance(timelineMetricStore); - route("/", AMSController.class); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/42112e28/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/JAXBContextResolver.java ---------------------------------------------------------------------- diff --git a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/JAXBContextResolver.java b/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/JAXBContextResolver.java deleted file mode 100644 index 5fd0124..0000000 --- a/ambari-metrics/ambari-metrics-timelineservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/JAXBContextResolver.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.server.applicationhistoryservice.webapp; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import javax.ws.rs.ext.ContextResolver; -import javax.ws.rs.ext.Provider; -import javax.xml.bind.JAXBContext; - -import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo; -import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptsInfo; -import org.apache.hadoop.yarn.server.webapp.dao.AppInfo; -import org.apache.hadoop.yarn.server.webapp.dao.AppsInfo; -import org.apache.hadoop.yarn.server.webapp.dao.ContainerInfo; -import org.apache.hadoop.yarn.server.webapp.dao.ContainersInfo; - -import com.google.inject.Singleton; -import com.sun.jersey.api.json.JSONConfiguration; -import com.sun.jersey.api.json.JSONJAXBContext; - -@Singleton -@Provider -@SuppressWarnings("rawtypes") -public class JAXBContextResolver implements ContextResolver<JAXBContext> { - - private JAXBContext context; - private final Set<Class> types; - - // you have to specify all the dao classes here - private final Class[] cTypes = { AppInfo.class, AppsInfo.class, - AppAttemptInfo.class, AppAttemptsInfo.class, ContainerInfo.class, - ContainersInfo.class }; - - public JAXBContextResolver() throws Exception { - this.types = new HashSet<Class>(Arrays.asList(cTypes)); - this.context = - new JSONJAXBContext(JSONConfiguration.natural().rootUnwrapping(false) - .build(), cTypes); - } - - @Override - public JAXBContext getContext(Class<?> objectType) { - return (types.contains(objectType)) ? context : null; - } -}
