Skip to content

Commit

Permalink
Remove atom references (#2972)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElizabethOkerio authored Jun 27, 2024
1 parent 60fce6c commit 710bf7e
Show file tree
Hide file tree
Showing 74 changed files with 709 additions and 806 deletions.
6 changes: 3 additions & 3 deletions src/Microsoft.OData.Client/BaseSaveResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -736,8 +736,8 @@ protected void HandleOperationResponse(Descriptor descriptor, HeaderCollection c
/// </summary>
/// <param name="entityDescriptor">entity descriptor whose response is getting materialized.</param>
/// <param name="responseInfo">information about the response to be materialized.</param>
/// <returns>an instance of MaterializeAtom, that can be used to materialize the response.</returns>
protected abstract MaterializeAtom GetMaterializer(EntityDescriptor entityDescriptor, ResponseInfo responseInfo);
/// <returns>an instance of ObjectMaterializer, that can be used to materialize the response.</returns>
protected abstract ObjectMaterializer GetMaterializer(EntityDescriptor entityDescriptor, ResponseInfo responseInfo);

/// <summary>cleanup work to do once the batch / savechanges is complete</summary>
protected override void CompletedRequest()
Expand Down Expand Up @@ -1420,7 +1420,7 @@ private void AsyncEndRead(IAsyncResult asyncResult)
/// <param name="etag">etag value, if specified in the response header.</param>
private void MaterializeResponse(EntityDescriptor entityDescriptor, ResponseInfo responseInfo, string etag)
{
using (MaterializeAtom materializer = this.GetMaterializer(entityDescriptor, responseInfo))
using (ObjectMaterializer materializer = this.GetMaterializer(entityDescriptor, responseInfo))
{
materializer.SetInsertingObject(entityDescriptor.Entity);

Expand Down
12 changes: 6 additions & 6 deletions src/Microsoft.OData.Client/BatchSaveResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,12 @@ protected override DataServiceResponse HandleResponse()
/// </summary>
/// <param name="entityDescriptor">entity descriptor whose response is getting materialized.</param>
/// <param name="responseInfo">information about the response to be materialized.</param>
/// <returns>an instance of MaterializeAtom, that can be used to materialize the response.</returns>
/// <returns>an instance of ObjectMaterializer, that can be used to materialize the response.</returns>
/// <remarks>
/// This can only be called from inside the HandleBatchResponse or during enumeration of the responses.
/// This is used when processing responses for update operations.
/// </remarks>
protected override MaterializeAtom GetMaterializer(EntityDescriptor entityDescriptor, ResponseInfo responseInfo)
protected override ObjectMaterializer GetMaterializer(EntityDescriptor entityDescriptor, ResponseInfo responseInfo)
{
// check if the batch stream is empty or not
Debug.Assert(this.currentOperationResponse != null, "There must be an active operation response for this method to work correctly.");
Expand All @@ -248,7 +248,7 @@ protected override MaterializeAtom GetMaterializer(EntityDescriptor entityDescri
entityDescriptor.Entity.GetType(),
/*projection*/ null,
/*normalizerRewrites*/ null);
return new MaterializeAtom(
return new ObjectMaterializer(
responseInfo,
queryComponents,
/*projectionPlan*/ null,
Expand Down Expand Up @@ -683,7 +683,7 @@ private IEnumerable<OperationResponse> HandleBatchResponse(ODataBatchReader batc
{
DataServiceRequest query = this.Queries[queryCount];
ResponseInfo responseInfo = this.RequestInfo.GetDeserializationInfo(null /*mergeOption*/);
MaterializeAtom materializer = DataServiceRequest.Materialize(
ObjectMaterializer materializer = DataServiceRequest.Materialize(
responseInfo,
query.QueryComponents(this.RequestInfo.Model),
null,
Expand Down Expand Up @@ -716,11 +716,11 @@ private IEnumerable<OperationResponse> HandleBatchResponse(ODataBatchReader batc

if (this.RequestInfo.IgnoreResourceNotFoundException && this.currentOperationResponse.StatusCode == HttpStatusCode.NotFound)
{
qresponse = QueryOperationResponse.GetInstance(query.ElementType, this.currentOperationResponse.Headers, query, MaterializeAtom.EmptyResults);
qresponse = QueryOperationResponse.GetInstance(query.ElementType, this.currentOperationResponse.Headers, query, ObjectMaterializer.EmptyResults);
}
else
{
qresponse = QueryOperationResponse.GetInstance(query.ElementType, this.currentOperationResponse.Headers, query, MaterializeAtom.EmptyResults);
qresponse = QueryOperationResponse.GetInstance(query.ElementType, this.currentOperationResponse.Headers, query, ObjectMaterializer.EmptyResults);
qresponse.Error = exception;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ private static DataServiceContext GetContextFromItems(IEnumerable<T> items)
{
Debug.Assert(queryOperationResponse.Results != null, "Got QueryOperationResponse without valid results.");
DataServiceContext context = queryOperationResponse.Results.Context;
Debug.Assert(context != null, "Materializer must always have valid context.");
Debug.Assert(context != null, "ObjectMaterializer must always have valid context.");
return context;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Microsoft.OData.Client/BulkUpdateSaveResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -386,14 +386,14 @@ protected override ODataRequestMessageWrapper CreateRequestMessage(string method
/// </summary>
/// <param name="entityDescriptor">The entity descriptor whose response is getting materialized.</param>
/// <param name="responseInfo">Information about the response to be materialized.</param>
/// <returns>An instance of <see cref="MaterializeAtom"/> that can be used to materialize the response.</returns>
protected override MaterializeAtom GetMaterializer(EntityDescriptor entityDescriptor, ResponseInfo responseInfo)
/// <returns>An instance of <see cref="ObjectMaterializer"/> that can be used to materialize the response.</returns>
protected override ObjectMaterializer GetMaterializer(EntityDescriptor entityDescriptor, ResponseInfo responseInfo)
{
Debug.Assert(this.cachedResponse.Exception == null && this.materializerStateForDescriptor != null, "this.cachedResponse.Exception == null && this.materializerStateForDescriptor != null");

if (this.materializerStateForDescriptor.TryGetValue(entityDescriptor, out IMaterializerState materializerState) && materializerState is MaterializerEntry materializerEntry)
{
return new MaterializeAtom(responseInfo, new[] { materializerEntry.Entry }, entityDescriptor.Entity.GetType(), materializerEntry.Format, base.MaterializerCache);
return new ObjectMaterializer(responseInfo, new[] { materializerEntry.Entry }, entityDescriptor.Entity.GetType(), materializerEntry.Format, base.MaterializerCache);
}

return null;
Expand Down
4 changes: 1 addition & 3 deletions src/Microsoft.OData.Client/ContentTypeUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ internal static class ContentTypeUtil
/// </summary>
private static readonly string[] MediaTypesForEntityOrFeedV2 = new string[]
{
XmlConstants.MimeApplicationJson,
XmlConstants.MimeApplicationAtom,
XmlConstants.MimeApplicationJson
};

/// <summary>
Expand All @@ -61,7 +60,6 @@ internal static class ContentTypeUtil
private static readonly string[] MediaTypesForEntityOrFeedV3 = new string[]
{
XmlConstants.MimeApplicationJson,
XmlConstants.MimeApplicationAtom,
XmlConstants.MimeApplicationJsonODataMinimalMetadata,
XmlConstants.MimeApplicationJsonODataFullMetadata,
XmlConstants.MimeApplicationJsonODataNoMetadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class DataServiceClientConfigurations
/// <summary>
/// Creates a data service client configurations class
/// </summary>
/// <param name="sender"> The sender for the Reading Atom event.</param>
/// <param name="sender"> The sender for the Reading event.</param>
internal DataServiceClientConfigurations(object sender)
{
Debug.Assert(sender != null, "sender!= null");
Expand Down
5 changes: 2 additions & 3 deletions src/Microsoft.OData.Client/DataServiceClientFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ internal DataServiceClientFormat(DataServiceContext context)
}

/// <summary>
/// Gets the current format. Defaults to Atom if nothing else has been specified.
/// Gets the current format.
/// </summary>
public ODataFormat ODataFormat { get; private set; }

Expand Down Expand Up @@ -193,7 +193,6 @@ internal void SetRequestContentTypeForEntry(HeaderCollection headers)
/// <param name="headers">Dictionary of request headers.</param>
internal void SetRequestContentTypeForOperationParameters(HeaderCollection headers)
{
// Note: There has never been an atom or xml format for parameters.
this.SetRequestContentTypeHeader(headers, MimeApplicationJsonOData);
}

Expand Down Expand Up @@ -350,7 +349,7 @@ private void SetAcceptHeaderAndCharset(HeaderCollection headers, string mediaTyp
}

/// <summary>
/// Chooses between using JSON and the context-dependent media type for when Atom is selected based on the user-selected format.
/// Chooses between using JSON and the context-dependent media type for when entry is selected based on the user-selected format.
/// </summary>
/// <param name="hasSelectQueryOption">
/// Whether or not the select query option is present in the request URI.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class DataServiceClientResponsePipelineConfiguration
/// <summary>
/// Creates a Data service client response pipeline class
/// </summary>
/// <param name="sender"> The sender for the Reading Atom event.</param>
/// <param name="sender"> The sender for the Reading event.</param>
internal DataServiceClientResponsePipelineConfiguration(object sender)
{
Debug.Assert(sender != null, "sender!= null");
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.OData.Client/DataServiceContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public virtual bool ApplyingChanges
/// This enables the client to perform custom mapping between the type name
/// provided in a response from the server and a type on the client.
/// This method enables one to override the entity name that is serialized
/// to the target representation (ATOM,JSON, etc) for the specified type.
/// to the target representation (JSON) for the specified type.
/// </remarks>
public virtual Func<Type, string> ResolveName
{
Expand Down Expand Up @@ -3875,7 +3875,7 @@ private LoadPropertyResult CreateLoadPropertyRequest(object entity, string prope
{
if (mediaLink)
{
// special case for requesting the "media" value of an ATOM media link entry
// special case for requesting the "media" value of a media link entry
Uri relativeUri = UriUtil.CreateUri(XmlConstants.UriValueSegment, UriKind.Relative);
requestUri = UriUtil.CreateUri(box.GetResourceUri(this.BaseUriResolver, true /*queryLink*/), relativeUri);
}
Expand Down
14 changes: 7 additions & 7 deletions src/Microsoft.OData.Client/DataServiceRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ internal ODataPayloadKind PayloadKind
/// <param name="message">the message</param>
/// <param name="expectedPayloadKind">expected payload kind.</param>
/// <param name="materializerCache">Cache used to store temporary metadata used for materialization of OData items.</param>
/// <returns>atom materializer</returns>
internal static MaterializeAtom Materialize(
/// <returns>object materializer</returns>
internal static ObjectMaterializer Materialize(
ResponseInfo responseInfo,
QueryComponents queryComponents,
ProjectionPlan plan,
Expand All @@ -77,10 +77,10 @@ internal static MaterializeAtom Materialize(
// If there is no content (For e.g. /Customers(1)/BestFriend is null), we need to return empty results.
if (message.StatusCode == (int)HttpStatusCode.NoContent || String.IsNullOrEmpty(contentType))
{
return MaterializeAtom.EmptyResults;
return ObjectMaterializer.EmptyResults;
}

return new MaterializeAtom(responseInfo, queryComponents, plan, message, expectedPayloadKind, materializerCache);
return new ObjectMaterializer(responseInfo, queryComponents, plan, message, expectedPayloadKind, materializerCache);
}

/// <summary>
Expand Down Expand Up @@ -126,7 +126,7 @@ internal static IEnumerable<TElement> EndExecute<TElement>(object source, DataSe
serviceEx = serviceEx ?? previousInnerException as DataServiceClientException;
if (context.IgnoreResourceNotFoundException && serviceEx != null && serviceEx.StatusCode == (int)HttpStatusCode.NotFound)
{
QueryOperationResponse qor = new QueryOperationResponse<TElement>(ex.Response.HeaderCollection, ex.Response.Query, MaterializeAtom.EmptyResults);
QueryOperationResponse qor = new QueryOperationResponse<TElement>(ex.Response.HeaderCollection, ex.Response.Query, ObjectMaterializer.EmptyResults);
qor.StatusCode = (int)HttpStatusCode.NotFound;
return (IEnumerable<TElement>)qor;
}
Expand Down Expand Up @@ -162,7 +162,7 @@ internal QueryOperationResponse<TElement> Execute<TElement>(DataServiceContext c
{
if (result != null)
{
QueryOperationResponse operationResponse = result.GetResponse<TElement>(MaterializeAtom.EmptyResults);
QueryOperationResponse operationResponse = result.GetResponse<TElement>(ObjectMaterializer.EmptyResults);

if (operationResponse != null)
{
Expand Down Expand Up @@ -235,7 +235,7 @@ internal TElement GetValue<TElement>(DataServiceContext context, Func<QueryResul
catch (InvalidOperationException ex)
{
QueryOperationResponse operationResponse;
operationResponse = queryResult.GetResponse<TElement>(MaterializeAtom.EmptyResults);
operationResponse = queryResult.GetResponse<TElement>(ObjectMaterializer.EmptyResults);
if (operationResponse != null)
{
operationResponse.Error = ex;
Expand Down
6 changes: 3 additions & 3 deletions src/Microsoft.OData.Client/DeepInsertSaveResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -340,14 +340,14 @@ protected override void FinishCurrentChange(PerRequest peReq)
/// </summary>
/// <param name="entityDescriptor">The entity descriptor whose response is getting materialized.</param>
/// <param name="responseInfo">Information about the response to be materialized.</param>
/// <returns>An instance of <see cref="MaterializeAtom"/> that can be used to materialize the response.</returns>
protected override MaterializeAtom GetMaterializer(EntityDescriptor entityDescriptor, ResponseInfo responseInfo)
/// <returns>An instance of <see cref="ObjectMaterializer"/> that can be used to materialize the response.</returns>
protected override ObjectMaterializer GetMaterializer(EntityDescriptor entityDescriptor, ResponseInfo responseInfo)
{
Debug.Assert(this.materializerStateForDescriptor != null, "this.materializerStateForDescriptor != null");

if (this.materializerStateForDescriptor.TryGetValue(entityDescriptor, out IMaterializerState materializerState) && materializerState is MaterializerEntry materializerEntry)
{
return new MaterializeAtom(responseInfo, new[] { materializerEntry.Entry }, entityDescriptor.Entity.GetType(), materializerEntry.Format, base.MaterializerCache, false);
return new ObjectMaterializer(responseInfo, new[] { materializerEntry.Entry }, entityDescriptor.Entity.GetType(), materializerEntry.Format, base.MaterializerCache, false);
}

return null;
Expand Down
7 changes: 2 additions & 5 deletions src/Microsoft.OData.Client/EntityDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public sealed class EntityDescriptor : Descriptor
{
#region Fields
/// <summary>uri to identify the entity</summary>
/// <remarks>&lt;atom:id&gt;identity&lt;/id&gt;</remarks>
private Uri identity;

/// <summary>entity</summary>
Expand All @@ -38,11 +37,9 @@ public sealed class EntityDescriptor : Descriptor
private Uri addToUri;

/// <summary>uri to query the entity</summary>
/// <remarks>&lt;atom:link rel="self" href="queryLink" /&gt;</remarks>
private Uri selfLink;

/// <summary>uri to edit the entity. In case of deep add, this can also refer to the navigation property name.</summary>
/// <remarks>&lt;atom:link rel="edit" href="editLink" /&gt;</remarks>
private Uri editLink;

/// <summary>
Expand Down Expand Up @@ -78,7 +75,7 @@ internal EntityDescriptor(ClientEdmModel model)
#region Properties

/// <summary>Gets the URI that is the identity value of the entity.</summary>
/// <returns>The <see cref="Microsoft.OData.Client.EntityDescriptor.Identity" /> property corresponds to the identity element of the entry that represents the entity in the Atom response.</returns>
/// <returns>The <see cref="Microsoft.OData.Client.EntityDescriptor.Identity" /> property corresponds to the identity element of the entry that represents the entity in the response.</returns>
public Uri Identity
{
get
Expand Down Expand Up @@ -412,7 +409,7 @@ internal EntityDescriptor TransientEntityDescriptor
else
{
// we should merge the data always, as we do in the query case. There might be servers, who might send partial data back.
AtomMaterializerLog.MergeEntityDescriptorInfo(this.transientEntityDescriptor, value, true /*mergeInfo*/, MergeOption.OverwriteChanges);
ObjectMaterializerLog.MergeEntityDescriptorInfo(this.transientEntityDescriptor, value, true /*mergeInfo*/, MergeOption.OverwriteChanges);
}

// During save changes call, BaseSaveResult.ChangeEntries contains the list of descriptors which are changed.
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OData.Client/EntityTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ internal override void AttachIdentity(EntityDescriptor entityDescriptorFromMater
}

trackedEntityDescriptor.Identity = entityDescriptorFromMaterializer.Identity; // always attach the identity
AtomMaterializerLog.MergeEntityDescriptorInfo(trackedEntityDescriptor, entityDescriptorFromMaterializer, true /*mergeInfo*/, metadataMergeOption);
ObjectMaterializerLog.MergeEntityDescriptorInfo(trackedEntityDescriptor, entityDescriptorFromMaterializer, true /*mergeInfo*/, metadataMergeOption);
trackedEntityDescriptor.State = EntityStates.Unchanged;
trackedEntityDescriptor.PropertiesToSerialize.Clear();

Expand Down
Loading

0 comments on commit 710bf7e

Please sign in to comment.