[OLINGO-841] CleanUp Server API

This commit is contained in:
Christian Amend 2015-12-18 13:42:53 +01:00
parent d1055fd8ef
commit d4902f725b
158 changed files with 517 additions and 515 deletions

View File

@ -21,10 +21,10 @@ package org.apache.olingo.server.api;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType; import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider; import org.apache.olingo.commons.api.edm.provider.CsdlEdmProvider;
import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.debug.DebugResponseHelper; import org.apache.olingo.server.api.debug.DebugResponseHelper;
import org.apache.olingo.server.api.deserializer.DeserializerException; import org.apache.olingo.server.api.deserializer.DeserializerException;

View File

@ -226,7 +226,7 @@ public class ODataRequest {
* @param protocol * @param protocol
* @see #getProtocol() * @see #getProtocol()
*/ */
public void setProtocol(String protocol) { public void setProtocol(final String protocol) {
this.protocol = protocol; this.protocol = protocol;
} }

View File

@ -115,7 +115,6 @@ public class ODataResponse {
return values == null || values.isEmpty() ? null : values.get(0); return values == null || values.isEmpty() ? null : values.get(0);
} }
/** /**
* Sets the content (body). * Sets the content (body).
* @param content the content as {@link InputStream} * @param content the content as {@link InputStream}

View File

@ -17,57 +17,57 @@
* under the License. * under the License.
*/package org.apache.olingo.server.api.batch; */package org.apache.olingo.server.api.batch;
import org.apache.olingo.server.api.ODataApplicationException; import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.ODataLibraryException; import org.apache.olingo.server.api.ODataLibraryException;
import org.apache.olingo.server.api.ODataRequest; import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse; import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart; import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart; import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
/** /**
* <p>Provides methods to process {@link ODataRequest}s and {@link BatchRequestPart}s * <p>Provides methods to process {@link ODataRequest}s and {@link BatchRequestPart}s
* in the context of a batch request.</p> * in the context of a batch request.</p>
* *
* <p>Within a {@link org.apache.olingo.server.api.processor.BatchProcessor BatchProcessor} * <p>Within a {@link org.apache.olingo.server.api.processor.BatchProcessor BatchProcessor} implementation
* implementation BatchRequestParts should be passed to {@link #handleBatchRequest(BatchRequestPart)}. * BatchRequestParts should be passed to {@link #handleBatchRequest(BatchRequestPart)}.
* Only if the BatchRequestPart represents a change set, the request will be delegated to * Only if the BatchRequestPart represents a change set, the request will be delegated to
* {@link org.apache.olingo.server.api.processor.BatchProcessor#processChangeSet(BatchFacade, java.util.List)}. * {@link org.apache.olingo.server.api.processor.BatchProcessor#processChangeSet(BatchFacade, java.util.List)}.
* Otherwise the requests will be directly executed.</p> * Otherwise the requests will be directly executed.</p>
* *
* <p>The processor implementation could use {@link #handleODataRequest(ODataRequest)} to process * <p>The processor implementation could use {@link #handleODataRequest(ODataRequest)} to process
* requests in a change set.</p> * requests in a change set.</p>
*/ */
public interface BatchFacade { public interface BatchFacade {
/** /**
* Executes an ODataRequest, which must be a part of a change set. * Executes an ODataRequest, which must be a part of a change set.
* Each request must have a Content-Id header field, which holds an identifier * Each request must have a Content-Id header field, which holds an identifier
* that is unique in the whole batch request. * that is unique in the whole batch request.
* @param request ODataRequest to process * @param request ODataRequest to process
* @return corresponding ODataResponse to the given request * @return corresponding ODataResponse to the given request
* @throws ODataApplicationException * @throws ODataApplicationException
* @throws ODataLibraryException * @throws ODataLibraryException
*/ */
public ODataResponse handleODataRequest(ODataRequest request) public ODataResponse handleODataRequest(ODataRequest request)
throws ODataApplicationException, ODataLibraryException; throws ODataApplicationException, ODataLibraryException;
/** /**
* Handles a BatchRequestPart. * Handles a BatchRequestPart.
* @param request Request to process * @param request Request to process
* @return corresponding {@link ODataResponsePart} * @return corresponding {@link ODataResponsePart}
* @throws ODataApplicationException * @throws ODataApplicationException
* @throws ODataLibraryException * @throws ODataLibraryException
*/ */
public ODataResponsePart handleBatchRequest(BatchRequestPart request) public ODataResponsePart handleBatchRequest(BatchRequestPart request)
throws ODataApplicationException, ODataLibraryException; throws ODataApplicationException, ODataLibraryException;
/** /**
* Extracts the boundary of a multipart/mixed header. * Extracts the boundary of a multipart/mixed header.
* See RFC 2046#5.1 * See RFC 2046#5.1
* @param contentType Content Type * @param contentType Content Type
* @return boundary * @return boundary
* @throws ODataApplicationException * @throws ODataApplicationException
* @throws ODataLibraryException * @throws ODataLibraryException
*/ */
public String extractBoundaryFromContentType(String contentType) public String extractBoundaryFromContentType(String contentType)
throws ODataApplicationException, ODataLibraryException; throws ODataApplicationException, ODataLibraryException;
} }

View File

@ -46,7 +46,7 @@ public class DebugInformation {
return request; return request;
} }
public void setRequest(ODataRequest request) { public void setRequest(final ODataRequest request) {
this.request = request; this.request = request;
} }
@ -59,7 +59,7 @@ public class DebugInformation {
return applicationResponse; return applicationResponse;
} }
public void setApplicationResponse(ODataResponse applicationResponse) { public void setApplicationResponse(final ODataResponse applicationResponse) {
this.applicationResponse = applicationResponse; this.applicationResponse = applicationResponse;
} }
@ -72,7 +72,7 @@ public class DebugInformation {
return uriInfo; return uriInfo;
} }
public void setUriInfo(UriInfo uriInfo) { public void setUriInfo(final UriInfo uriInfo) {
this.uriInfo = uriInfo; this.uriInfo = uriInfo;
} }
@ -85,7 +85,7 @@ public class DebugInformation {
return exception; return exception;
} }
public void setException(Exception exception) { public void setException(final Exception exception) {
this.exception = exception; this.exception = exception;
} }
@ -98,7 +98,7 @@ public class DebugInformation {
return serverEnvironmentVariables; return serverEnvironmentVariables;
} }
public void setServerEnvironmentVariables(Map<String, String> serverEnvironmentVariables) { public void setServerEnvironmentVariables(final Map<String, String> serverEnvironmentVariables) {
this.serverEnvironmentVariables = serverEnvironmentVariables; this.serverEnvironmentVariables = serverEnvironmentVariables;
} }
@ -111,7 +111,7 @@ public class DebugInformation {
return runtimeInformation; return runtimeInformation;
} }
public void setRuntimeInformation(List<RuntimeMeasurement> runtimeInformation) { public void setRuntimeInformation(final List<RuntimeMeasurement> runtimeInformation) {
this.runtimeInformation = runtimeInformation; this.runtimeInformation = runtimeInformation;
} }

View File

@ -33,8 +33,7 @@ public interface DebugSupport {
/** /**
* Initializes the debug support implementation. * Initializes the debug support implementation.
* Is called before {@link #isUserAuthorized()} and * Is called before {@link #isUserAuthorized()} and {@link #createDebugResponse(String, DebugInformation)}.
* {@link #createDebugResponse(String, DebugInformation)}.
* @param odata * @param odata
*/ */
void init(OData odata); void init(OData odata);
@ -49,7 +48,7 @@ public interface DebugSupport {
* Creates a debug response and delivers it back to the Olingo library. * Creates a debug response and delivers it back to the Olingo library.
* This method MUST NEVER throw an exception. * This method MUST NEVER throw an exception.
* @param debugFormat the value of the odata-debug query parameter * @param debugFormat the value of the odata-debug query parameter
* @param debugInfo all necessary information to construct debug output * @param debugInfo all necessary information to construct debug output
* @return a new debug response which will be sent to the client * @return a new debug response which will be sent to the client
*/ */
ODataResponse createDebugResponse(String debugFormat, DebugInformation debugInfo); ODataResponse createDebugResponse(String debugFormat, DebugInformation debugInfo);

View File

@ -29,7 +29,7 @@ public class DefaultDebugSupport implements DebugSupport {
private OData odata; private OData odata;
@Override @Override
public void init(OData odata) { public void init(final OData odata) {
this.odata = odata; this.odata = odata;
} }
@ -39,7 +39,7 @@ public class DefaultDebugSupport implements DebugSupport {
} }
@Override @Override
public ODataResponse createDebugResponse(String debugFormat, DebugInformation debugInfo) { public ODataResponse createDebugResponse(final String debugFormat, final DebugInformation debugInfo) {
// Check if debugFormat is supported by the library // Check if debugFormat is supported by the library
if (DebugSupport.ODATA_DEBUG_JSON.equalsIgnoreCase(debugFormat) if (DebugSupport.ODATA_DEBUG_JSON.equalsIgnoreCase(debugFormat)
|| DebugSupport.ODATA_DEBUG_HTML.equalsIgnoreCase(debugFormat) || DebugSupport.ODATA_DEBUG_HTML.equalsIgnoreCase(debugFormat)

View File

@ -35,7 +35,7 @@ public class RuntimeMeasurement {
* Sets the class name. * Sets the class name.
* @param className the name of the class that is measured * @param className the name of the class that is measured
*/ */
public void setClassName(String className) { public void setClassName(final String className) {
this.className = className; this.className = className;
} }
@ -51,7 +51,7 @@ public class RuntimeMeasurement {
* Sets the method name. * Sets the method name.
* @param methodName the name of the method that is measured * @param methodName the name of the method that is measured
*/ */
public void setMethodName(String methodName) { public void setMethodName(final String methodName) {
this.methodName = methodName; this.methodName = methodName;
} }
@ -68,7 +68,7 @@ public class RuntimeMeasurement {
* @param timeStarted the start time in nanoseconds * @param timeStarted the start time in nanoseconds
* @see System#nanoTime() * @see System#nanoTime()
*/ */
public void setTimeStarted(long timeStarted) { public void setTimeStarted(final long timeStarted) {
this.timeStarted = timeStarted; this.timeStarted = timeStarted;
} }
@ -86,7 +86,7 @@ public class RuntimeMeasurement {
* @param timeStopped the stop time in nanoseconds * @param timeStopped the stop time in nanoseconds
* @see System#nanoTime() * @see System#nanoTime()
*/ */
public void setTimeStopped(long timeStopped) { public void setTimeStopped(final long timeStopped) {
this.timeStopped = timeStopped; this.timeStopped = timeStopped;
} }

View File

@ -39,23 +39,23 @@ public interface FixedFormatDeserializer {
/** /**
* Reads primitive-type data from an InputStream. * Reads primitive-type data from an InputStream.
* @param content the textual value as input stream * @param content the textual value as input stream
* @param property EDM property * @param property EDM property
*/ */
public Object primitiveValue(InputStream content, EdmProperty property) throws DeserializerException; public Object primitiveValue(InputStream content, EdmProperty property) throws DeserializerException;
/** /**
* Reads parameter data (in URI syntax) from a String. * Reads parameter data (in URI syntax) from a String.
* @param content the textual value as String * @param content the textual value as String
* @param parameter EDM parameter * @param parameter EDM parameter
*/ */
public Parameter parameter(String content, EdmParameter parameter) throws DeserializerException; public Parameter parameter(String content, EdmParameter parameter) throws DeserializerException;
/** /**
* Reads batch data from an InputStream. * Reads batch data from an InputStream.
* @param content the data as multipart input stream * @param content the data as multipart input stream
* @param boundary the boundary between the parts * @param boundary the boundary between the parts
* @param options options for the deserializer * @param options options for the deserializer
* @return a list of batch-request parts * @return a list of batch-request parts
*/ */
public List<BatchRequestPart> parseBatchRequest(InputStream content, String boundary, BatchOptions options) public List<BatchRequestPart> parseBatchRequest(InputStream content, String boundary, BatchOptions options)

View File

@ -42,8 +42,8 @@ public interface ODataDeserializer {
DeserializerResult entity(InputStream stream, EdmEntityType edmEntityType) throws DeserializerException; DeserializerResult entity(InputStream stream, EdmEntityType edmEntityType) throws DeserializerException;
/** /**
* Deserializes an entity collection stream into an * Deserializes an entity collection stream into an {@link org.apache.olingo.commons.api.data.EntityCollection
* {@link org.apache.olingo.commons.api.data.EntityCollection EntityCollection} object. * EntityCollection} object.
* @param stream * @param stream
* @param edmEntityType * @param edmEntityType
* @return {@link DeserializerResult#getEntityCollection()} * @return {@link DeserializerResult#getEntityCollection()}

View File

@ -76,8 +76,8 @@ public class BatchDeserializerException extends DeserializerException {
/** /**
* Creates batch deserializer exception. * Creates batch deserializer exception.
* @param developmentMessage message text as fallback and for debugging purposes * @param developmentMessage message text as fallback and for debugging purposes
* @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle * @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle
* @param parameters parameters for the exception text * @param parameters parameters for the exception text
*/ */
public BatchDeserializerException(final String developmentMessage, final MessageKey messageKey, public BatchDeserializerException(final String developmentMessage, final MessageKey messageKey,
final String... parameters) { final String... parameters) {
@ -87,9 +87,9 @@ public class BatchDeserializerException extends DeserializerException {
/** /**
* Creates batch deserializer exception. * Creates batch deserializer exception.
* @param developmentMessage message text as fallback and for debugging purposes * @param developmentMessage message text as fallback and for debugging purposes
* @param cause the cause of this exception * @param cause the cause of this exception
* @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle * @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle
* @param parameters parameters for the exception text * @param parameters parameters for the exception text
*/ */
public BatchDeserializerException(final String developmentMessage, final Throwable cause, public BatchDeserializerException(final String developmentMessage, final Throwable cause,
final MessageKey messageKey, final String... parameters) { final MessageKey messageKey, final String... parameters) {

View File

@ -20,8 +20,8 @@ package org.apache.olingo.server.api.deserializer.batch;
/** /**
* Options for the batch deserializer. * Options for the batch deserializer.
* @see org.apache.olingo.server.api.deserializer.FixedFormatDeserializer * @see org.apache.olingo.server.api.deserializer.FixedFormatDeserializer #parseBatchRequest(java.io.InputStream,
* #parseBatchRequest(java.io.InputStream, String, BatchOptions) * String, BatchOptions)
*/ */
public final class BatchOptions { public final class BatchOptions {
private boolean isStrict = true; private boolean isStrict = true;

View File

@ -37,14 +37,14 @@ public interface ETagHelper {
* <a href="https://www.ietf.org/rfc/rfc7232.txt">RFC 7232</a>, section 2.3.2.</p> * <a href="https://www.ietf.org/rfc/rfc7232.txt">RFC 7232</a>, section 2.3.2.</p>
* <p>This method does not nothing and returns <code>false</code> if the ETag value is * <p>This method does not nothing and returns <code>false</code> if the ETag value is
* <code>null</code>.</p> * <code>null</code>.</p>
* @param eTag the ETag value to match * @param eTag the ETag value to match
* @param ifMatchHeaders the If-Match header values * @param ifMatchHeaders the If-Match header values
* @param ifNoneMatchHeaders the If-None-Match header values * @param ifNoneMatchHeaders the If-None-Match header values
* @return whether a "Not Modified" response should be used * @return whether a "Not Modified" response should be used
*/ */
public boolean checkReadPreconditions(String eTag, public boolean checkReadPreconditions(String eTag,
Collection<String> ifMatchHeaders, Collection<String> ifNoneMatchHeaders) Collection<String> ifMatchHeaders, Collection<String> ifNoneMatchHeaders)
throws PreconditionException; throws PreconditionException;
/** /**
* <p>Checks the preconditions of a change request (with HTTP methods PUT, PATCH, or DELETE) * <p>Checks the preconditions of a change request (with HTTP methods PUT, PATCH, or DELETE)
@ -52,15 +52,15 @@ public interface ETagHelper {
* <p>If the given ETag value is not matched by the ETag information in the If-Match headers, * <p>If the given ETag value is not matched by the ETag information in the If-Match headers,
* and there are ETags in the headers to be matched, or * and there are ETags in the headers to be matched, or
* if the given ETag value is matched by the ETag information in the If-None-Match headers, * if the given ETag value is matched by the ETag information in the If-None-Match headers,
* a "Precondition Failed" exception is thrown.</p> * a "Precondition Failed" exception is thrown.</p>
* <p>All matching uses weak comparison as described in * <p>All matching uses weak comparison as described in
* <a href="https://www.ietf.org/rfc/rfc7232.txt">RFC 7232</a>, section 2.3.2.</p> * <a href="https://www.ietf.org/rfc/rfc7232.txt">RFC 7232</a>, section 2.3.2.</p>
* <p>This method does not nothing if the ETag value is <code>null</code>.</p> * <p>This method does not nothing if the ETag value is <code>null</code>.</p>
* @param eTag the ETag value to match * @param eTag the ETag value to match
* @param ifMatchHeaders the If-Match header values * @param ifMatchHeaders the If-Match header values
* @param ifNoneMatchHeaders the If-None-Match header values * @param ifNoneMatchHeaders the If-None-Match header values
*/ */
public void checkChangePreconditions(String eTag, public void checkChangePreconditions(String eTag,
Collection<String> ifMatchHeaders, Collection<String> ifNoneMatchHeaders) Collection<String> ifMatchHeaders, Collection<String> ifNoneMatchHeaders)
throws PreconditionException; throws PreconditionException;
} }

View File

@ -59,7 +59,10 @@ public interface Preferences {
/** Whether the preference <code>odata.track-changes</code> has been set. */ /** Whether the preference <code>odata.track-changes</code> has been set. */
public boolean hasTrackChanges(); public boolean hasTrackChanges();
public enum Return { REPRESENTATION, MINIMAL } public enum Return {
REPRESENTATION, MINIMAL
}
/** /**
* Gets the value of the preference <code>return</code> or <code>null</code> if not set * Gets the value of the preference <code>return</code> or <code>null</code> if not set
* or the value is not valid. * or the value is not valid.
@ -73,7 +76,7 @@ public interface Preferences {
* Gets the value of the preference <code>wait</code> or <code>null</code> if not set * Gets the value of the preference <code>wait</code> or <code>null</code> if not set
* or the value is not valid. * or the value is not valid.
* @return the number of seconds the client is prepared to wait for the service * @return the number of seconds the client is prepared to wait for the service
* to process the request synchronously * to process the request synchronously
*/ */
public Integer getWait(); public Integer getWait();
@ -104,7 +107,7 @@ public interface Preferences {
public Map<String, String> getParameters() { public Map<String, String> getParameters() {
return parameters == null ? return parameters == null ?
Collections.<String, String> emptyMap() : Collections.<String, String> emptyMap() :
Collections.unmodifiableMap(parameters); Collections.unmodifiableMap(parameters);
} }
} }
} }

View File

@ -62,16 +62,16 @@ public final class PreferencesApplied {
if (entry.getValue() != null) { if (entry.getValue() != null) {
final boolean safe = isSafe(key); final boolean safe = isSafe(key);
result.append('=') result.append('=')
.append(safe ? "" : '"') .append(safe ? "" : '"')
.append(entry.getValue().replaceAll("\\\\|\"", "\\\\$0")) .append(entry.getValue().replaceAll("\\\\|\"", "\\\\$0"))
.append(safe ? "" : '"'); .append(safe ? "" : '"');
} }
} }
return result.toString(); return result.toString();
} }
private boolean isSafe(String key) { private boolean isSafe(final String key) {
if(SAFE_PREFERENCE_NAMES.isEmpty()) { if (SAFE_PREFERENCE_NAMES.isEmpty()) {
SAFE_PREFERENCE_NAMES.add(PreferenceName.ALLOW_ENTITY_REFERENCES.getName()); SAFE_PREFERENCE_NAMES.add(PreferenceName.ALLOW_ENTITY_REFERENCES.getName());
SAFE_PREFERENCE_NAMES.add(PreferenceName.CALLBACK.getName()); SAFE_PREFERENCE_NAMES.add(PreferenceName.CALLBACK.getName());
SAFE_PREFERENCE_NAMES.add(PreferenceName.CONTINUE_ON_ERROR.getName()); SAFE_PREFERENCE_NAMES.add(PreferenceName.CONTINUE_ON_ERROR.getName());
@ -156,7 +156,7 @@ public final class PreferencesApplied {
* The preference name is converted to lowercase. * The preference name is converted to lowercase.
* The value of this preference may be <code>null</code>. * The value of this preference may be <code>null</code>.
* Name and value are not checked for validity. * Name and value are not checked for validity.
* @param name preference name * @param name preference name
* @param value preference value * @param value preference value
*/ */
public Builder preference(final String name, final String value) { public Builder preference(final String name, final String value) {

View File

@ -23,17 +23,17 @@ package org.apache.olingo.server.api.processor;
*/ */
public interface DeltaProcessor extends Processor { public interface DeltaProcessor extends Processor {
// NOT YET AVAILABLE // NOT YET AVAILABLE
// /** // /**
// * Reads delta information from persistence and put it as serialized content and // * Reads delta information from persistence and put it as serialized content and
// * with according status into the response. // * with according status into the response.
// * @param request OData request object containing raw HTTP information // * @param request OData request object containing raw HTTP information
// * @param response OData response object for collecting response data // * @param response OData response object for collecting response data
// * @param uriInfo information of a parsed OData URI // * @param uriInfo information of a parsed OData URI
// * @param responseFormat requested content type after content negotiation // * @param responseFormat requested content type after content negotiation
// * @throws ODataApplicationException if the service implementation encounters a failure // * @throws ODataApplicationException if the service implementation encounters a failure
// * @throws ODataLibraryException // * @throws ODataLibraryException
// */ // */
// void readDelta(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat) // void readDelta(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
// throws ODataApplicationException, ODataLibraryException; // throws ODataApplicationException, ODataLibraryException;
} }

View File

@ -77,6 +77,6 @@ public interface EntityProcessor extends Processor {
* @throws ODataLibraryException * @throws ODataLibraryException
*/ */
void deleteEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo) throws ODataApplicationException, void deleteEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo) throws ODataApplicationException,
ODataLibraryException; ODataLibraryException;
} }

View File

@ -19,9 +19,9 @@
package org.apache.olingo.server.api.processor; package org.apache.olingo.server.api.processor;
import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.ODataServerError;
import org.apache.olingo.server.api.ODataRequest; import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse; import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.ODataServerError;
/** /**
* Processor which is called if any error/exception occurs inside the library or another processor. * Processor which is called if any error/exception occurs inside the library or another processor.

View File

@ -57,7 +57,7 @@ public interface PrimitiveProcessor extends Processor {
*/ */
void updatePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo, void updatePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo,
ContentType requestFormat, ContentType responseFormat) ContentType requestFormat, ContentType responseFormat)
throws ODataApplicationException, ODataLibraryException; throws ODataApplicationException, ODataLibraryException;
/** /**
* Deletes primitive-type value from an entity and puts the status into the response. * Deletes primitive-type value from an entity and puts the status into the response.

View File

@ -57,7 +57,7 @@ public interface PrimitiveValueProcessor extends PrimitiveProcessor {
*/ */
void updatePrimitiveValue(ODataRequest request, ODataResponse response, UriInfo uriInfo, void updatePrimitiveValue(ODataRequest request, ODataResponse response, UriInfo uriInfo,
ContentType requestFormat, ContentType responseFormat) ContentType requestFormat, ContentType responseFormat)
throws ODataApplicationException, ODataLibraryException; throws ODataApplicationException, ODataLibraryException;
/** /**
* Deletes primitive-type raw value from an entity and puts the status into the response. * Deletes primitive-type raw value from an entity and puts the status into the response.

View File

@ -32,3 +32,4 @@
* in order to overwrite the default behavior. * in order to overwrite the default behavior.
*/ */
package org.apache.olingo.server.api.processor; package org.apache.olingo.server.api.processor;

View File

@ -18,9 +18,8 @@
*/ */
package org.apache.olingo.server.api.serializer; package org.apache.olingo.server.api.serializer;
/** /**
* Thrown for invalid batch payloads. * Thrown for invalid batch payloads.
*/ */
public class BatchSerializerException extends SerializerException { public class BatchSerializerException extends SerializerException {

View File

@ -52,7 +52,7 @@ public interface FixedFormatSerializer {
/** /**
* Serializes a batch response. * Serializes a batch response.
* @param batchResponses the response parts * @param batchResponses the response parts
* @param boundary the boundary between the parts * @param boundary the boundary between the parts
* @return response as an input stream * @return response as an input stream
*/ */
InputStream batchResponse(List<ODataResponsePart> batchResponses, String boundary) throws BatchSerializerException; InputStream batchResponse(List<ODataResponsePart> batchResponses, String boundary) throws BatchSerializerException;

View File

@ -37,7 +37,7 @@ public interface ODataSerializer {
/** /**
* Writes the service document into an InputStream. * Writes the service document into an InputStream.
* @param serviceMetadata the metadata information for the service * @param serviceMetadata the metadata information for the service
* @param serviceRoot the service-root URI of this OData service * @param serviceRoot the service-root URI of this OData service
*/ */
SerializerResult serviceDocument(ServiceMetadata serviceMetadata, String serviceRoot) throws SerializerException; SerializerResult serviceDocument(ServiceMetadata serviceMetadata, String serviceRoot) throws SerializerException;
@ -55,20 +55,20 @@ public interface ODataSerializer {
/** /**
* Writes entity-collection data into an InputStream. * Writes entity-collection data into an InputStream.
* @param metadata metadata for the service * @param metadata metadata for the service
* @param entityType the {@link EdmEntityType} * @param entityType the {@link EdmEntityType}
* @param entitySet the data of the entity set * @param entitySet the data of the entity set
* @param options options for the serializer * @param options options for the serializer
*/ */
SerializerResult entityCollection(ServiceMetadata metadata, EdmEntityType entityType, SerializerResult entityCollection(ServiceMetadata metadata, EdmEntityType entityType,
EntityCollection entitySet, EntityCollectionSerializerOptions options) throws SerializerException; EntityCollection entitySet, EntityCollectionSerializerOptions options) throws SerializerException;
/** /**
* Writes entity data into an InputStream. * Writes entity data into an InputStream.
* @param metadata metadata for the service * @param metadata metadata for the service
* @param entityType the {@link EdmEntityType} * @param entityType the {@link EdmEntityType}
* @param entity the data of the entity * @param entity the data of the entity
* @param options options for the serializer * @param options options for the serializer
*/ */
SerializerResult entity(ServiceMetadata metadata, EdmEntityType entityType, Entity entity, SerializerResult entity(ServiceMetadata metadata, EdmEntityType entityType, Entity entity,
EntitySerializerOptions options) throws SerializerException; EntitySerializerOptions options) throws SerializerException;
@ -76,9 +76,9 @@ public interface ODataSerializer {
/** /**
* Writes primitive-type instance data into an InputStream. * Writes primitive-type instance data into an InputStream.
* @param metadata metadata for the service * @param metadata metadata for the service
* @param type primitive type * @param type primitive type
* @param property property value * @param property property value
* @param options options for the serializer * @param options options for the serializer
*/ */
SerializerResult primitive(ServiceMetadata metadata, EdmPrimitiveType type, Property property, SerializerResult primitive(ServiceMetadata metadata, EdmPrimitiveType type, Property property,
PrimitiveSerializerOptions options) throws SerializerException; PrimitiveSerializerOptions options) throws SerializerException;
@ -86,9 +86,9 @@ public interface ODataSerializer {
/** /**
* Writes complex-type instance data into an InputStream. * Writes complex-type instance data into an InputStream.
* @param metadata metadata for the service * @param metadata metadata for the service
* @param type complex type * @param type complex type
* @param property property value * @param property property value
* @param options options for the serializer * @param options options for the serializer
*/ */
SerializerResult complex(ServiceMetadata metadata, EdmComplexType type, Property property, SerializerResult complex(ServiceMetadata metadata, EdmComplexType type, Property property,
ComplexSerializerOptions options) throws SerializerException; ComplexSerializerOptions options) throws SerializerException;
@ -96,9 +96,9 @@ public interface ODataSerializer {
/** /**
* Writes data of a collection of primitive-type instances into an InputStream. * Writes data of a collection of primitive-type instances into an InputStream.
* @param metadata metadata for the service * @param metadata metadata for the service
* @param type primitive type * @param type primitive type
* @param property property value * @param property property value
* @param options options for the serializer * @param options options for the serializer
*/ */
SerializerResult primitiveCollection(ServiceMetadata metadata, EdmPrimitiveType type, Property property, SerializerResult primitiveCollection(ServiceMetadata metadata, EdmPrimitiveType type, Property property,
PrimitiveSerializerOptions options) throws SerializerException; PrimitiveSerializerOptions options) throws SerializerException;
@ -106,29 +106,29 @@ public interface ODataSerializer {
/** /**
* Writes data of a collection of complex-type instances into an InputStream. * Writes data of a collection of complex-type instances into an InputStream.
* @param metadata metadata for the service * @param metadata metadata for the service
* @param type complex type * @param type complex type
* @param property property value * @param property property value
* @param options options for the serializer * @param options options for the serializer
*/ */
SerializerResult complexCollection(ServiceMetadata metadata, EdmComplexType type, Property property, SerializerResult complexCollection(ServiceMetadata metadata, EdmComplexType type, Property property,
ComplexSerializerOptions options) throws SerializerException; ComplexSerializerOptions options) throws SerializerException;
/** /**
* Writes a single entity reference into an InputStream. * Writes a single entity reference into an InputStream.
* @param metadata metadata for the service * @param metadata metadata for the service
* @param edmEntitySet {@link EdmEntitySet} * @param edmEntitySet {@link EdmEntitySet}
* @param entity data of the entity * @param entity data of the entity
* @param options {@link ReferenceSerializerOptions} * @param options {@link ReferenceSerializerOptions}
*/ */
SerializerResult reference(ServiceMetadata metadata, EdmEntitySet edmEntitySet, Entity entity, SerializerResult reference(ServiceMetadata metadata, EdmEntitySet edmEntitySet, Entity entity,
ReferenceSerializerOptions options) throws SerializerException; ReferenceSerializerOptions options) throws SerializerException;
/** /**
* Writes entity-collection references into an InputStream. * Writes entity-collection references into an InputStream.
* @param metadata metadata for the service * @param metadata metadata for the service
* @param edmEntitySet {@link EdmEntitySet} * @param edmEntitySet {@link EdmEntitySet}
* @param entityCollection data of the entity collection * @param entityCollection data of the entity collection
* @param ReferenceCollectionSerializerOptions {@link ReferenceCollectionSerializerOptions} * @param ReferenceCollectionSerializerOptions {@link ReferenceCollectionSerializerOptions}
*/ */
SerializerResult referenceCollection(ServiceMetadata metadata, EdmEntitySet edmEntitySet, SerializerResult referenceCollection(ServiceMetadata metadata, EdmEntitySet edmEntitySet,
EntityCollection entityCollection, ReferenceCollectionSerializerOptions options) throws SerializerException; EntityCollection entityCollection, ReferenceCollectionSerializerOptions options) throws SerializerException;

View File

@ -79,7 +79,7 @@ public interface UriHelper {
* *
* @param edm the edm the entity belongs to * @param edm the edm the entity belongs to
* @param entityId URI of the entity-id * @param entityId URI of the entity-id
* @param rawServiceRoot the root URI of the service * @param rawServiceRoot the root URI of the service
* @return {@link UriResourceEntitySet} - contains the entity set and the key predicates * @return {@link UriResourceEntitySet} - contains the entity set and the key predicates
* @throws DeserializerException in case the entity-id is malformed * @throws DeserializerException in case the entity-id is malformed
*/ */

View File

@ -29,7 +29,7 @@ import org.apache.olingo.server.api.uri.queryoption.SystemQueryOption;
* Use method {@link #getKind()} to obtain URI info kind information and to perform an appropriate cast.</p> * Use method {@link #getKind()} to obtain URI info kind information and to perform an appropriate cast.</p>
*/ */
public interface UriInfo extends UriInfoService, UriInfoMetadata, UriInfoResource, UriInfoBatch, public interface UriInfo extends UriInfoService, UriInfoMetadata, UriInfoResource, UriInfoBatch,
UriInfoAll, UriInfoCrossjoin, UriInfoEntityId { UriInfoAll, UriInfoCrossjoin, UriInfoEntityId {
/** /**
* See {@link UriInfoKind} for more details which kinds are allowed. * See {@link UriInfoKind} for more details which kinds are allowed.

View File

@ -23,5 +23,5 @@ package org.apache.olingo.server.api.uri;
* http://.../serviceroot/$all * http://.../serviceroot/$all
*/ */
public interface UriInfoAll { public interface UriInfoAll {
//No additional methods needed for now. // No additional methods needed for now.
} }

View File

@ -23,5 +23,5 @@ package org.apache.olingo.server.api.uri;
* http://.../serviceroot/$batch * http://.../serviceroot/$batch
*/ */
public interface UriInfoBatch { public interface UriInfoBatch {
//No additional methods needed for now. // No additional methods needed for now.
} }

View File

@ -23,5 +23,5 @@ package org.apache.olingo.server.api.uri;
* http://.../serviceroot * http://.../serviceroot
*/ */
public interface UriInfoService { public interface UriInfoService {
//No additional methods needed here. // No additional methods needed here.
} }

View File

@ -23,5 +23,5 @@ package org.apache.olingo.server.api.uri;
* For example: http://.../serviceroot/entityset(1)/$count * For example: http://.../serviceroot/entityset(1)/$count
*/ */
public interface UriResourceCount extends UriResource { public interface UriResourceCount extends UriResource {
//No additional methods needed for now. // No additional methods needed for now.
} }

View File

@ -23,5 +23,5 @@ package org.apache.olingo.server.api.uri;
* For example: http://.../serviceroot/entityset(1)/property * For example: http://.../serviceroot/entityset(1)/property
*/ */
public interface UriResourcePrimitiveProperty extends UriResourceProperty { public interface UriResourcePrimitiveProperty extends UriResourceProperty {
//No additional methods needed for now. // No additional methods needed for now.
} }

View File

@ -23,5 +23,5 @@ package org.apache.olingo.server.api.uri;
* For example: http://.../serviceroot/entityset/$ref * For example: http://.../serviceroot/entityset/$ref
*/ */
public interface UriResourceRef extends UriResource { public interface UriResourceRef extends UriResource {
//No additional methods needed for now. // No additional methods needed for now.
} }

View File

@ -24,5 +24,5 @@ package org.apache.olingo.server.api.uri;
* For example: http://.../serviceroot/entityset(1)?$filter=property eq $root/singleton/configstring * For example: http://.../serviceroot/entityset(1)?$filter=property eq $root/singleton/configstring
*/ */
public interface UriResourceRoot extends UriResource { public interface UriResourceRoot extends UriResource {
//No additional methods needed for now. // No additional methods needed for now.
} }

View File

@ -23,5 +23,5 @@ package org.apache.olingo.server.api.uri;
* For example: http://.../serviceroot/entityset(1)/property/$value * For example: http://.../serviceroot/entityset(1)/property/$value
*/ */
public interface UriResourceValue extends UriResource { public interface UriResourceValue extends UriResource {
//No additional methods needed for now. // No additional methods needed for now.
} }

View File

@ -24,5 +24,5 @@ package org.apache.olingo.server.api.uri.queryoption;
* http://.../entitySet?myOption=true * http://.../entitySet?myOption=true
*/ */
public interface CustomQueryOption extends QueryOption { public interface CustomQueryOption extends QueryOption {
//No additional methods needed for now. // No additional methods needed for now.
} }

View File

@ -22,5 +22,5 @@ package org.apache.olingo.server.api.uri.queryoption.expression;
* Super class of all classes used to build the expression tree * Super class of all classes used to build the expression tree
*/ */
public interface Expression extends VisitableExpression { public interface Expression extends VisitableExpression {
//No additional methods needed for now. // No additional methods needed for now.
} }

View File

@ -21,6 +21,7 @@ package org.apache.olingo.server.api.uri.queryoption.search;
public interface SearchUnary extends SearchExpression { public interface SearchUnary extends SearchExpression {
SearchUnaryOperatorKind getOperator(); SearchUnaryOperatorKind getOperator();
SearchTerm getOperand(); SearchTerm getOperand();
} }

View File

@ -36,27 +36,27 @@ public class PreferencesAppliedTest {
+ " odata.continue-on-error, odata.include-annotations=\"*\", odata.maxpagesize=42," + " odata.continue-on-error, odata.include-annotations=\"*\", odata.maxpagesize=42,"
+ " odata.track-changes, return=representation, respond-async, wait=12345", + " odata.track-changes, return=representation, respond-async, wait=12345",
PreferencesApplied.with().allowEntityReferences().callback().continueOnError() PreferencesApplied.with().allowEntityReferences().callback().continueOnError()
.preference("odata.include-annotations", "*").maxPageSize(42).trackChanges() .preference("odata.include-annotations", "*").maxPageSize(42).trackChanges()
.returnRepresentation(Return.REPRESENTATION).respondAsync().waitPreference(12345) .returnRepresentation(Return.REPRESENTATION).respondAsync().waitPreference(12345)
.build().toValueString()); .build().toValueString());
} }
@Test @Test
public void caseSensitivity() { public void caseSensitivity() {
assertEquals("odata.include-annotations=\"*\", odata.maxpagesize=255", assertEquals("odata.include-annotations=\"*\", odata.maxpagesize=255",
PreferencesApplied.with() PreferencesApplied.with()
.preference("OData.Include-Annotations", "*").maxPageSize(0xFF) .preference("OData.Include-Annotations", "*").maxPageSize(0xFF)
.build().toValueString()); .build().toValueString());
} }
@Test @Test
public void multipleValues() { public void multipleValues() {
assertEquals("return=minimal, wait=1", assertEquals("return=minimal, wait=1",
PreferencesApplied.with() PreferencesApplied.with()
.returnRepresentation(Return.MINIMAL).returnRepresentation(Return.REPRESENTATION) .returnRepresentation(Return.MINIMAL).returnRepresentation(Return.REPRESENTATION)
.preference(null, null).preference(null, "nullValue") .preference(null, null).preference(null, "nullValue")
.waitPreference(1).waitPreference(2).waitPreference(3) .waitPreference(1).waitPreference(2).waitPreference(3)
.build().toValueString()); .build().toValueString());
} }
@Test @Test