diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timeline/TimelineEntity.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timeline/TimelineEntity.java index d66c253..8a89a93 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timeline/TimelineEntity.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timeline/TimelineEntity.java @@ -31,6 +31,7 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Unstable; @@ -175,11 +176,21 @@ public void setEvents(List events) { * * @return the related entities */ - @XmlElement(name = "relatedentities") public Map> getRelatedEntities() { return relatedEntities; } + // Required by JAXB + @Private + @XmlElement(name = "relatedentities") + public HashMap> getRelatedEntitiesJAXB() { + if (relatedEntities != null && !(relatedEntities instanceof HashMap)) { + return new HashMap>(relatedEntities); + } else { + return (HashMap>) relatedEntities; + } + } + /** * Add an entity to the existing related entity map * @@ -232,11 +243,21 @@ public void setRelatedEntities( * * @return the primary filters */ - @XmlElement(name = "primaryfilters") public Map> getPrimaryFilters() { return primaryFilters; } + // Required by JAXB + @Private + @XmlElement(name = "primaryfilters") + public HashMap> getPrimaryFiltersJAXB() { + if (primaryFilters != null && !(primaryFilters instanceof HashMap)) { + return new HashMap>(primaryFilters); + } else { + return (HashMap>) primaryFilters; + } + } + /** * Add a single piece of primary filter to the existing primary filter map * @@ -288,11 +309,21 @@ public void setPrimaryFilters(Map> primaryFilters) { * * @return the other information of the entity */ - @XmlElement(name = "otherinfo") public Map getOtherInfo() { return otherInfo; } + // Required by JAXB + @Private + @XmlElement(name = "otherinfo") + public HashMap getOtherInfoJAXB() { + if (otherInfo != null && !(otherInfo instanceof HashMap)) { + return new HashMap(otherInfo); + } else { + return (HashMap) otherInfo; + } + } + /** * Add one piece of other information of the entity to the existing other info * map diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timeline/TimelineEvent.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timeline/TimelineEvent.java index aa49538..02450ef 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timeline/TimelineEvent.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timeline/TimelineEvent.java @@ -26,6 +26,7 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Unstable; @@ -93,11 +94,21 @@ public void setEventType(String eventType) { * * @return the information of the event */ - @XmlElement(name = "eventinfo") public Map getEventInfo() { return eventInfo; } + // Required by JAXB + @Private + @XmlElement(name = "eventinfo") + public HashMap getEventInfoJAXB() { + if (eventInfo != null && ! (eventInfo instanceof HashMap)) { + return new HashMap(eventInfo); + } else { + return (HashMap) eventInfo; + } + } + /** * Add one piece of the information of the event to the existing information * map diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/TimelineWebServices.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/TimelineWebServices.java index f290930..0907f2c 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/TimelineWebServices.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/webapp/TimelineWebServices.java @@ -42,7 +42,6 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -53,11 +52,11 @@ import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.security.UserGroupInformation; +import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; +import org.apache.hadoop.yarn.api.records.timeline.TimelineDomains; 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; -import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; -import org.apache.hadoop.yarn.api.records.timeline.TimelineDomains; import org.apache.hadoop.yarn.api.records.timeline.TimelinePutResponse; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.server.timeline.EntityIdentifier; @@ -272,7 +271,7 @@ public TimelinePutResponse postEntities( @PUT @Path("/domain") @Consumes({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */}) - public Response putDomain( + public TimelinePutResponse putDomain( @Context HttpServletRequest req, @Context HttpServletResponse res, TimelineDomain domain) { @@ -295,7 +294,7 @@ public Response putDomain( throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR); } - return Response.status(Status.OK).build(); + return new TimelinePutResponse(); } /**