[OLINGO-507] Created seperate Action_ interfaces

This commit is contained in:
Michael Bolz 2015-01-14 06:34:52 +01:00
parent 2f6b35ff59
commit 40e0ae5ecd
16 changed files with 355 additions and 128 deletions

View File

@ -0,0 +1,48 @@
/*
* 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.olingo.server.api.processor;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.server.api.uri.UriInfo;
/**
* Processor interface for handling an action import request which has a
* return type of ComplexCollection.
*/
public interface ActionComplexCollectionProcessor extends ComplexCollectionProcessor {
/**
* Process an action which has as return type a complex-type collection.
* @param request OData request object containing raw HTTP information
* @param response OData response object for collecting response data
* @param uriInfo information of a parsed OData URI
* @param requestFormat content type of body sent with request
* @param responseFormat requested content type after content negotiation
* @throws org.apache.olingo.server.api.ODataApplicationException if the service implementation encounters a failure
* @throws org.apache.olingo.server.api.deserializer.DeserializerException if deserialization failed
* @throws org.apache.olingo.server.api.serializer.SerializerException if serialization failed
*/
void processActionComplexCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo,
ContentType requestFormat, ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException;
}

View File

@ -0,0 +1,48 @@
/*
* 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.olingo.server.api.processor;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.server.api.uri.UriInfo;
/**
* Processor interface for handling an action import request which has a
* return type of Complex.
*/
public interface ActionComplexProcessor extends ComplexProcessor {
/**
* Process an action which has as return type a complex-type.
* @param request OData request object containing raw HTTP information
* @param response OData response object for collecting response data
* @param uriInfo information of a parsed OData URI
* @param requestFormat content type of body sent with request
* @param responseFormat requested content type after content negotiation
* @throws org.apache.olingo.server.api.ODataApplicationException if the service implementation encounters a failure
* @throws org.apache.olingo.server.api.deserializer.DeserializerException if deserialization failed
* @throws org.apache.olingo.server.api.serializer.SerializerException if serialization failed
*/
void processActionComplex(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat,
ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException;
}

View File

@ -0,0 +1,48 @@
/*
* 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.olingo.server.api.processor;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.server.api.uri.UriInfo;
/**
* Processor interface for handling an action import request which has a
* return type of Entity Collection.
*/
public interface ActionEntityCollectionProcessor extends EntityCollectionProcessor {
/**
* Process an action which has as return type a collection of entities.
* @param request OData request object containing raw HTTP information
* @param response OData response object for collecting response data
* @param uriInfo information of a parsed OData URI
* @param requestFormat content type of body sent with request
* @param responseFormat requested content type after content negotiation
* @throws org.apache.olingo.server.api.ODataApplicationException if the service implementation encounters a failure
* @throws org.apache.olingo.server.api.deserializer.DeserializerException if deserialization failed
* @throws org.apache.olingo.server.api.serializer.SerializerException if serialization failed
*/
void processActionEntityCollection(ODataRequest request, ODataResponse response,
UriInfo uriInfo, ContentType requestFormat, ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException;
}

View File

@ -0,0 +1,48 @@
/*
* 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.olingo.server.api.processor;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.server.api.uri.UriInfo;
/**
* Processor interface for handling an action import request which has a
* return type of Entity.
*/
public interface ActionEntityProcessor extends EntityProcessor {
/**
* Process an action which has as return type an entity.
* @param request OData request object containing raw HTTP information
* @param response OData response object for collecting response data
* @param uriInfo information of a parsed OData URI
* @param requestFormat content type of body sent with request
* @param responseFormat requested content type after content negotiation
* @throws org.apache.olingo.server.api.ODataApplicationException if the service implementation encounters a failure
* @throws org.apache.olingo.server.api.deserializer.DeserializerException if deserialization failed
* @throws org.apache.olingo.server.api.serializer.SerializerException if serialization failed
*/
void processActionEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat,
ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException;
}

View File

@ -0,0 +1,48 @@
/*
* 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.olingo.server.api.processor;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.server.api.uri.UriInfo;
/**
* Processor interface for handling an action import request which has a
* return type of Primitive Collection.
*/
public interface ActionPrimitiveCollectionProcessor extends PrimitiveCollectionProcessor {
/**
* Process an action which has as return type a primitive-type collection.
* @param request OData request object containing raw HTTP information
* @param response OData response object for collecting response data
* @param uriInfo information of a parsed OData URI
* @param requestFormat content type of body sent with request
* @param responseFormat requested content type after content negotiation
* @throws org.apache.olingo.server.api.ODataApplicationException if the service implementation encounters a failure
* @throws org.apache.olingo.server.api.deserializer.DeserializerException if deserialization failed
* @throws org.apache.olingo.server.api.serializer.SerializerException if serialization failed
*/
void processActionPrimitiveCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo,
ContentType requestFormat, ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException;
}

View File

@ -0,0 +1,48 @@
/*
* 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.olingo.server.api.processor;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.server.api.uri.UriInfo;
/**
* Processor interface for handling an action import request which has a
* return type of Primitive.
*/
public interface ActionPrimitiveProcessor extends PrimitiveProcessor {
/**
* Process an action which has as return type a primitive-type.
* @param request OData request object containing raw HTTP information
* @param response OData response object for collecting response data
* @param uriInfo information of a parsed OData URI
* @param requestFormat content type of body sent with request
* @param responseFormat requested content type after content negotiation
* @throws org.apache.olingo.server.api.ODataApplicationException if the service implementation encounters a failure
* @throws org.apache.olingo.server.api.deserializer.DeserializerException if deserialization failed
* @throws org.apache.olingo.server.api.serializer.SerializerException if serialization failed
*/
void processActionPrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo,
ContentType requestFormat, ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException;
}

View File

@ -63,20 +63,6 @@ public interface ComplexCollectionProcessor extends Processor {
ContentType requestFormat, ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException;
/**
* Process an action which has as return type a complex-type collection.
* @param request OData request object containing raw HTTP information
* @param response OData response object for collecting response data
* @param uriInfo information of a parsed OData URI
* @param requestFormat content type of body sent with request
* @param responseFormat requested content type after content negotiation
* @throws ODataApplicationException if the service implementation encounters a failure
* @throws DeserializerException if deserialization failed
* @throws SerializerException if serialization failed
*/
void processComplexCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo,
ContentType requestFormat, ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException;
/**
* Deletes complex-type collection from an entity and puts the status into the response.
* Deletion for complex-type collection is equal to

View File

@ -60,21 +60,6 @@ public interface ComplexProcessor extends Processor {
ContentType requestFormat, ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException;
/**
* Process an action which has as return type a complex-type.
* @param request OData request object containing raw HTTP information
* @param response OData response object for collecting response data
* @param uriInfo information of a parsed OData URI
* @param requestFormat content type of body sent with request
* @param responseFormat requested content type after content negotiation
* @throws ODataApplicationException if the service implementation encounters a failure
* @throws DeserializerException if deserialization failed
* @throws SerializerException if serialization failed
*/
void processComplex(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat,
ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException;
/**
* Deletes complex-type value from an entity and puts the status into the response.
* Deletion for complex-type values is equal to

View File

@ -43,18 +43,4 @@ public interface EntityCollectionProcessor extends Processor {
void readEntityCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
throws ODataApplicationException, SerializerException;
/**
* Process an action which has as return type a collection of entities.
* @param request OData request object containing raw HTTP information
* @param response OData response object for collecting response data
* @param uriInfo information of a parsed OData URI
* @param requestFormat content type of body sent with request
* @param responseFormat requested content type after content negotiation
* @throws ODataApplicationException if the service implementation encounters a failure
* @throws org.apache.olingo.server.api.deserializer.DeserializerException if deserialization failed
* @throws SerializerException if serialization failed
*/
void processEntityCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat,
ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException;
}

View File

@ -82,18 +82,4 @@ public interface EntityProcessor extends Processor {
*/
void deleteEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo) throws ODataApplicationException;
/**
* Process an action which has as return type an entity.
* @param request OData request object containing raw HTTP information
* @param response OData response object for collecting response data
* @param uriInfo information of a parsed OData URI
* @param requestFormat content type of body sent with request
* @param responseFormat requested content type after content negotiation
* @throws ODataApplicationException if the service implementation encounters a failure
* @throws DeserializerException if deserialization failed
* @throws SerializerException if serialization failed
*/
void processEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat,
ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException;
}

View File

@ -75,20 +75,4 @@ public interface PrimitiveCollectionProcessor extends Processor {
*/
void deletePrimitiveCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo)
throws ODataApplicationException;
/**
* Process an action which has as return type a primitive-type collection.
* @param request OData request object containing raw HTTP information
* @param response OData response object for collecting response data
* @param uriInfo information of a parsed OData URI
* @param requestFormat content type of body sent with request
* @param responseFormat requested content type after content negotiation
* @throws ODataApplicationException if the service implementation encounters a failure
* @throws DeserializerException if deserialization failed
* @throws SerializerException if serialization failed
*/
void processPrimitiveCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo,
ContentType requestFormat, ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException;
}

View File

@ -73,18 +73,4 @@ public interface PrimitiveProcessor extends Processor {
void deletePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo)
throws ODataApplicationException;
/**
* Process an action which has as return type a primitive-type.
* @param request OData request object containing raw HTTP information
* @param response OData response object for collecting response data
* @param uriInfo information of a parsed OData URI
* @param requestFormat content type of body sent with request
* @param responseFormat requested content type after content negotiation
* @throws ODataApplicationException if the service implementation encounters a failure
* @throws DeserializerException if deserialization failed
* @throws SerializerException if serialization failed
*/
void processPrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo,
ContentType requestFormat, ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException;
}

View File

@ -42,6 +42,12 @@ import org.apache.olingo.server.api.ODataServerError;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.apache.olingo.server.api.processor.ActionComplexCollectionProcessor;
import org.apache.olingo.server.api.processor.ActionComplexProcessor;
import org.apache.olingo.server.api.processor.ActionEntityCollectionProcessor;
import org.apache.olingo.server.api.processor.ActionEntityProcessor;
import org.apache.olingo.server.api.processor.ActionPrimitiveCollectionProcessor;
import org.apache.olingo.server.api.processor.ActionPrimitiveProcessor;
import org.apache.olingo.server.api.processor.BatchProcessor;
import org.apache.olingo.server.api.processor.ComplexCollectionProcessor;
import org.apache.olingo.server.api.processor.ComplexProcessor;
@ -476,11 +482,11 @@ public class ODataHandler {
final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
request, customContentTypeSupport, complexRepresentationType);
if (complexRepresentationType == RepresentationType.COMPLEX) {
selectProcessor(ComplexProcessor.class)
.processComplex(request, response, uriInfo, requestFormat, responseFormat);
selectProcessor(ActionComplexProcessor.class)
.processActionComplex(request, response, uriInfo, requestFormat, responseFormat);
} else {
selectProcessor(ComplexCollectionProcessor.class)
.processComplexCollection(request, response, uriInfo, requestFormat, responseFormat);
selectProcessor(ActionComplexCollectionProcessor.class)
.processActionComplexCollection(request, response, uriInfo, requestFormat, responseFormat);
}
} else if (method == HttpMethod.DELETE) {
if (complexRepresentationType == RepresentationType.COMPLEX) {
@ -535,11 +541,11 @@ public class ODataHandler {
final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
request, customContentTypeSupport, representationType);
if (representationType == RepresentationType.PRIMITIVE) {
selectProcessor(PrimitiveProcessor.class)
.processPrimitive(request, response, uriInfo, requestFormat, responseFormat);
selectProcessor(ActionPrimitiveProcessor.class)
.processActionPrimitive(request, response, uriInfo, requestFormat, responseFormat);
} else {
selectProcessor(PrimitiveCollectionProcessor.class)
.processPrimitiveCollection(request, response, uriInfo, requestFormat, responseFormat);
selectProcessor(ActionPrimitiveCollectionProcessor.class)
.processActionPrimitiveCollection(request, response, uriInfo, requestFormat, responseFormat);
}
} else {
throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
@ -601,8 +607,8 @@ public class ODataHandler {
checkContentTypeSupport(requestFormat, RepresentationType.ENTITY);
final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
request, customContentTypeSupport, RepresentationType.ENTITY);
selectProcessor(EntityCollectionProcessor.class)
.processEntityCollection(request, response, uriInfo, requestFormat, responseFormat);
selectProcessor(ActionEntityCollectionProcessor.class)
.processActionEntityCollection(request, response, uriInfo, requestFormat, responseFormat);
} else {
checkContentTypeSupport(requestFormat, RepresentationType.ENTITY);
final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
@ -631,7 +637,8 @@ public class ODataHandler {
checkContentTypeSupport(requestFormat, RepresentationType.ENTITY);
final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
request, customContentTypeSupport, RepresentationType.ENTITY);
selectProcessor(EntityProcessor.class).processEntity(request, response, uriInfo, requestFormat, responseFormat);
selectProcessor(ActionEntityProcessor.class).processActionEntity(
request, response, uriInfo, requestFormat, responseFormat);
} else if (method == HttpMethod.DELETE) {
selectProcessor(isMedia ? MediaEntityProcessor.class : EntityProcessor.class)
.deleteEntity(request, response, uriInfo);

View File

@ -35,6 +35,8 @@ import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.apache.olingo.server.api.processor.ActionEntityCollectionProcessor;
import org.apache.olingo.server.api.processor.ActionEntityProcessor;
import org.apache.olingo.server.api.processor.CountEntityCollectionProcessor;
import org.apache.olingo.server.api.processor.EntityCollectionProcessor;
import org.apache.olingo.server.api.processor.EntityProcessor;
@ -55,7 +57,8 @@ import org.apache.olingo.server.tecsvc.data.DataProvider;
* Technical Processor for entity-related functionality.
*/
public class TechnicalEntityProcessor extends TechnicalProcessor
implements EntityCollectionProcessor, CountEntityCollectionProcessor, EntityProcessor, MediaEntityProcessor {
implements EntityCollectionProcessor, ActionEntityCollectionProcessor, CountEntityCollectionProcessor,
EntityProcessor, ActionEntityProcessor, MediaEntityProcessor {
public TechnicalEntityProcessor(final DataProvider dataProvider) {
super(dataProvider);
@ -90,7 +93,7 @@ public class TechnicalEntityProcessor extends TechnicalProcessor
}
@Override
public void processEntityCollection(final ODataRequest request, final ODataResponse response,
public void processActionEntityCollection(final ODataRequest request, final ODataResponse response,
final UriInfo uriInfo,
final ContentType requestFormat, final ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException {
@ -257,7 +260,7 @@ public class TechnicalEntityProcessor extends TechnicalProcessor
}
@Override
public void processEntity(final ODataRequest request, final ODataResponse response,
public void processActionEntity(final ODataRequest request, final ODataResponse response,
final UriInfo uriInfo, final ContentType requestFormat,
final ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException {

View File

@ -41,6 +41,10 @@ import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.apache.olingo.server.api.processor.ActionComplexCollectionProcessor;
import org.apache.olingo.server.api.processor.ActionComplexProcessor;
import org.apache.olingo.server.api.processor.ActionPrimitiveCollectionProcessor;
import org.apache.olingo.server.api.processor.ActionPrimitiveProcessor;
import org.apache.olingo.server.api.processor.ComplexCollectionProcessor;
import org.apache.olingo.server.api.processor.ComplexProcessor;
import org.apache.olingo.server.api.processor.PrimitiveCollectionProcessor;
@ -68,8 +72,10 @@ import org.apache.olingo.server.tecsvc.data.DataProvider;
* Technical Processor which provides functionality related to primitive and complex types and collections thereof.
*/
public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
implements PrimitiveProcessor, PrimitiveValueProcessor, PrimitiveCollectionProcessor,
ComplexProcessor, ComplexCollectionProcessor {
implements PrimitiveProcessor, PrimitiveValueProcessor, ActionPrimitiveProcessor,
PrimitiveCollectionProcessor, ActionPrimitiveCollectionProcessor,
ComplexProcessor, ActionComplexProcessor,
ComplexCollectionProcessor, ActionComplexCollectionProcessor {
public TechnicalPrimitiveComplexProcessor(final DataProvider dataProvider) {
super(dataProvider);
@ -96,8 +102,9 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
}
@Override
public void processPrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo,
ContentType requestFormat, ContentType responseFormat)
public void processActionPrimitive(final ODataRequest request, final ODataResponse response,
final UriInfo uriInfo,
final ContentType requestFormat, final ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException {
throw new ODataApplicationException("Not supported yet.",
HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
@ -124,8 +131,10 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
}
@Override
public void processPrimitiveCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType
requestFormat, ContentType responseFormat) throws ODataApplicationException, DeserializerException,
public void processActionPrimitiveCollection(final ODataRequest request, final ODataResponse response,
final UriInfo uriInfo,
final ContentType requestFormat, final ContentType responseFormat)
throws ODataApplicationException, DeserializerException,
SerializerException {
throw new ODataApplicationException("Not supported yet.",
HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
@ -146,7 +155,7 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
}
@Override
public void processComplex(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType
public void processActionComplex(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType
requestFormat, ContentType responseFormat) throws ODataApplicationException, DeserializerException,
SerializerException {
throw new ODataApplicationException("Not supported yet.",
@ -174,9 +183,10 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
}
@Override
public void processComplexCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType
requestFormat, ContentType responseFormat) throws ODataApplicationException, DeserializerException,
SerializerException {
public void processActionComplexCollection(ODataRequest request, ODataResponse response,
UriInfo uriInfo, ContentType requestFormat,
ContentType responseFormat)
throws ODataApplicationException, DeserializerException, SerializerException {
throw new ODataApplicationException("Not supported yet.",
HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
}

View File

@ -49,6 +49,12 @@ import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.edm.provider.EdmProvider;
import org.apache.olingo.server.api.edm.provider.EntitySet;
import org.apache.olingo.server.api.edmx.EdmxReference;
import org.apache.olingo.server.api.processor.ActionComplexCollectionProcessor;
import org.apache.olingo.server.api.processor.ActionComplexProcessor;
import org.apache.olingo.server.api.processor.ActionEntityCollectionProcessor;
import org.apache.olingo.server.api.processor.ActionEntityProcessor;
import org.apache.olingo.server.api.processor.ActionPrimitiveCollectionProcessor;
import org.apache.olingo.server.api.processor.ActionPrimitiveProcessor;
import org.apache.olingo.server.api.processor.BatchProcessor;
import org.apache.olingo.server.api.processor.ComplexCollectionProcessor;
import org.apache.olingo.server.api.processor.ComplexProcessor;
@ -319,57 +325,57 @@ public class ODataHandlerTest {
@Test
public void dispatchAction() throws Exception {
PrimitiveProcessor primitiveProcessor = mock(PrimitiveProcessor.class);
ActionPrimitiveProcessor primitiveProcessor = mock(ActionPrimitiveProcessor.class);
dispatch(HttpMethod.POST, ContainerProvider.AIRT_STRING, primitiveProcessor);
verify(primitiveProcessor).processPrimitive(
verify(primitiveProcessor).processActionPrimitive(
any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
any(ContentType.class), any(ContentType.class));
PrimitiveCollectionProcessor primitiveCollectionProcessor = mock(PrimitiveCollectionProcessor.class);
ActionPrimitiveCollectionProcessor primitiveCollectionProcessor = mock(ActionPrimitiveCollectionProcessor.class);
dispatch(HttpMethod.POST, ContainerProvider.AIRT_COLL_STRING_TWO_PARAM, primitiveCollectionProcessor);
verify(primitiveCollectionProcessor).processPrimitiveCollection(
verify(primitiveCollectionProcessor).processActionPrimitiveCollection(
any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
any(ContentType.class), any(ContentType.class));
ComplexProcessor complexProcessor = mock(ComplexProcessor.class);
ActionComplexProcessor complexProcessor = mock(ActionComplexProcessor.class);
dispatch(HttpMethod.POST, ContainerProvider.AIRTCT_TWO_PRIM_PARAM, complexProcessor);
verify(complexProcessor).processComplex(
verify(complexProcessor).processActionComplex(
any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
any(ContentType.class), any(ContentType.class));
ComplexCollectionProcessor complexCollectionProcessor = mock(ComplexCollectionProcessor.class);
ActionComplexCollectionProcessor complexCollectionProcessor = mock(ActionComplexCollectionProcessor.class);
dispatch(HttpMethod.POST, ContainerProvider.AIRT_COLL_CT_TWO_PRIM_PARAM, complexCollectionProcessor);
verify(complexCollectionProcessor).processComplexCollection(
verify(complexCollectionProcessor).processActionComplexCollection(
any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
any(ContentType.class), any(ContentType.class));
EntityProcessor entityProcessor = mock(EntityProcessor.class);
ActionEntityProcessor entityProcessor = mock(ActionEntityProcessor.class);
dispatch(HttpMethod.POST, ContainerProvider.AIRTET_TWO_KEY_TWO_PRIM_PARAM, entityProcessor);
verify(entityProcessor).processEntity(
verify(entityProcessor).processActionEntity(
any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
any(ContentType.class), any(ContentType.class));
EntityCollectionProcessor entityCollectionProcessor = mock(EntityCollectionProcessor.class);
ActionEntityCollectionProcessor entityCollectionProcessor = mock(ActionEntityCollectionProcessor.class);
dispatch(HttpMethod.POST, ContainerProvider.AIRT_COLL_ET_KEY_NAV_PARAM, entityCollectionProcessor);
verify(entityCollectionProcessor).processEntityCollection(
verify(entityCollectionProcessor).processActionEntityCollection(
any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
any(ContentType.class), any(ContentType.class));
EntityProcessor entityProcessorEs = mock(EntityProcessor.class);
ActionEntityProcessor entityProcessorEs = mock(ActionEntityProcessor.class);
dispatch(HttpMethod.POST, ContainerProvider.AIRTES_ALL_PRIM_PARAM, entityProcessorEs);
verify(entityProcessorEs).processEntity(
verify(entityProcessorEs).processActionEntity(
any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
any(ContentType.class), any(ContentType.class));
EntityCollectionProcessor entityCollectionProcessorEs = mock(EntityCollectionProcessor.class);
ActionEntityCollectionProcessor entityCollectionProcessorEs = mock(ActionEntityCollectionProcessor.class);
dispatch(HttpMethod.POST, ContainerProvider.AIRT_COLL_ES_ALL_PRIM_PARAM, entityCollectionProcessorEs);
verify(entityCollectionProcessorEs).processEntityCollection(
verify(entityCollectionProcessorEs).processActionEntityCollection(
any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
any(ContentType.class), any(ContentType.class));
dispatchMethodNotAllowed(HttpMethod.GET, "AIRTString", mock(Processor.class));
}
@Test
public void dispatchEntity() throws Exception {
final String uri = "ESAllPrim(0)";