Ensuring the build does not warn under JDK 6

This commit is contained in:
Francesco Chicchiriccò 2014-04-16 09:09:13 +02:00
parent 39eb821258
commit 47f1ec1801
18 changed files with 42 additions and 46 deletions

View File

@ -24,5 +24,5 @@ import org.apache.olingo.commons.api.format.ODataPubFormat;
/** /**
* This class implements an OData retrieve query request returning a single entity. * This class implements an OData retrieve query request returning a single entity.
*/ */
public interface ODataEntityRequest<T extends CommonODataEntity> extends ODataRetrieveRequest<T, ODataPubFormat> { public interface ODataEntityRequest<E extends CommonODataEntity> extends ODataRetrieveRequest<E, ODataPubFormat> {
} }

View File

@ -38,7 +38,6 @@ import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.ODataServerErrorException; import org.apache.olingo.client.api.communication.ODataServerErrorException;
import org.apache.olingo.client.api.communication.header.HeaderName; import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.header.ODataHeaders; import org.apache.olingo.client.api.communication.header.ODataHeaders;
import org.apache.olingo.client.api.communication.header.ODataPreferences;
import org.apache.olingo.client.api.communication.request.ODataRequest; import org.apache.olingo.client.api.communication.request.ODataRequest;
import org.apache.olingo.client.api.communication.request.ODataStreamer; import org.apache.olingo.client.api.communication.request.ODataStreamer;
import org.apache.olingo.client.api.communication.response.ODataResponse; import org.apache.olingo.client.api.communication.response.ODataResponse;

View File

@ -44,7 +44,9 @@ public abstract class AbstractODataRetrieveRequest<V, T extends Format>
* @param formatRef reference class for the format being used * @param formatRef reference class for the format being used
* @param query query to be executed. * @param query query to be executed.
*/ */
public AbstractODataRetrieveRequest(final CommonODataClient odataClient, final Class<T> formatRef, final URI query) { public AbstractODataRetrieveRequest(final CommonODataClient<?> odataClient, final Class<T> formatRef,
final URI query) {
super(odataClient, formatRef, HttpMethod.GET, query); super(odataClient, formatRef, HttpMethod.GET, query);
} }
@ -67,14 +69,15 @@ public abstract class AbstractODataRetrieveRequest<V, T extends Format>
/** /**
* Response abstract class about an ODataRetrieveRequest. * Response abstract class about an ODataRetrieveRequest.
*/ */
protected abstract class ODataRetrieveResponseImpl extends AbstractODataResponse implements ODataRetrieveResponse<V> { protected abstract class AbstractODataRetrieveResponse
extends AbstractODataResponse implements ODataRetrieveResponse<V> {
/** /**
* Constructor. * Constructor.
* <p> * <p>
* Just to create response templates to be initialized from batch. * Just to create response templates to be initialized from batch.
*/ */
protected ODataRetrieveResponseImpl() { protected AbstractODataRetrieveResponse() {
super(); super();
} }
@ -84,7 +87,7 @@ public abstract class AbstractODataRetrieveRequest<V, T extends Format>
* @param client HTTP client. * @param client HTTP client.
* @param res HTTP response. * @param res HTTP response.
*/ */
protected ODataRetrieveResponseImpl(final HttpClient client, final HttpResponse res) { protected AbstractODataRetrieveResponse(final HttpClient client, final HttpResponse res) {
super(client, res); super(client, res);
} }

View File

@ -49,7 +49,7 @@ class EdmMetadataRequestImpl extends AbstractMetadataRequestImpl<Edm> implements
final ODataRetrieveResponse<List<? extends Schema>> xmlMetadataResponse = final ODataRetrieveResponse<List<? extends Schema>> xmlMetadataResponse =
odataClient.getRetrieveRequestFactory().getXMLMetadataRequest(serviceRoot).execute(); odataClient.getRetrieveRequestFactory().getXMLMetadataRequest(serviceRoot).execute();
return new ODataRetrieveResponseImpl() { return new AbstractODataRetrieveResponse() {
private Edm metadata = null; private Edm metadata = null;
@Override @Override

View File

@ -32,8 +32,8 @@ import org.apache.olingo.commons.api.format.ODataPubFormat;
/** /**
* This class implements an OData retrieve query request returning a single entity. * This class implements an OData retrieve query request returning a single entity.
*/ */
public class ODataEntityRequestImpl<T extends CommonODataEntity> public class ODataEntityRequestImpl<E extends CommonODataEntity>
extends AbstractODataRetrieveRequest<T, ODataPubFormat> implements ODataEntityRequest<T> { extends AbstractODataRetrieveRequest<E, ODataPubFormat> implements ODataEntityRequest<E> {
/** /**
* Private constructor. * Private constructor.
@ -41,31 +41,29 @@ public class ODataEntityRequestImpl<T extends CommonODataEntity>
* @param odataClient client instance getting this request * @param odataClient client instance getting this request
* @param query query to be executed. * @param query query to be executed.
*/ */
public ODataEntityRequestImpl(final CommonODataClient odataClient, final URI query) { public ODataEntityRequestImpl(final CommonODataClient<?> odataClient, final URI query) {
super(odataClient, ODataPubFormat.class, query); super(odataClient, ODataPubFormat.class, query);
} }
/**
* {@inheritDoc }
*/
@Override @Override
public ODataRetrieveResponse<T> execute() { public ODataRetrieveResponse<E> execute() {
return new ODataEntityResponseImpl(httpClient, doExecute()); return new ODataEntityResponseImpl(httpClient, doExecute());
} }
/** /**
* Response class about an ODataEntityRequest. * Response class about an ODataEntityRequest.
*/ */
public class ODataEntityResponseImpl extends ODataRetrieveResponseImpl { public class ODataEntityResponseImpl extends AbstractODataRetrieveResponse {
private T entity = null; private E entity = null;
/** /**
* Constructor. * Constructor.
* <p> * <br/>
* Just to create response templates to be initialized from batch. * Just to create response templates to be initialized from batch.
*/ */
private ODataEntityResponseImpl() { private ODataEntityResponseImpl() {
super();
} }
/** /**
@ -78,18 +76,15 @@ public class ODataEntityRequestImpl<T extends CommonODataEntity>
super(client, res); super(client, res);
} }
/**
* {@inheritDoc }
*/
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public T getBody() { public E getBody() {
if (entity == null) { if (entity == null) {
try { try {
final Container<Entry> container = final Container<Entry> container =
odataClient.getDeserializer().toEntry(getRawResponse(), ODataPubFormat.fromString(getContentType())); odataClient.getDeserializer().toEntry(getRawResponse(), ODataPubFormat.fromString(getContentType()));
entity = (T) odataClient.getBinder().getODataEntity(extractFromContainer(container)); entity = (E) odataClient.getBinder().getODataEntity(extractFromContainer(container));
} finally { } finally {
this.close(); this.close();
} }

View File

@ -60,7 +60,7 @@ public class ODataEntitySetIteratorRequestImpl<ES extends CommonODataEntitySet,
/** /**
* Response class about an ODataEntitySetIteratorRequest. * Response class about an ODataEntitySetIteratorRequest.
*/ */
protected class ODataEntitySetIteratorResponseImpl extends ODataRetrieveResponseImpl { protected class ODataEntitySetIteratorResponseImpl extends AbstractODataRetrieveResponse {
/** /**
* Constructor. * Constructor.

View File

@ -61,7 +61,7 @@ public class ODataEntitySetRequestImpl<ES extends CommonODataEntitySet>
/** /**
* Response class about an ODataEntitySetRequest. * Response class about an ODataEntitySetRequest.
*/ */
protected class ODataEntitySetResponseImpl extends ODataRetrieveResponseImpl { protected class ODataEntitySetResponseImpl extends AbstractODataRetrieveResponse {
/** /**
* Constructor. * Constructor.

View File

@ -65,7 +65,7 @@ public class ODataMediaRequestImpl extends AbstractODataRetrieveRequest<InputStr
/** /**
* Response class about an ODataMediaRequest. * Response class about an ODataMediaRequest.
*/ */
protected class ODataMediaResponseImpl extends ODataRetrieveResponseImpl { protected class ODataMediaResponseImpl extends AbstractODataRetrieveResponse {
private InputStream input = null; private InputStream input = null;

View File

@ -56,7 +56,7 @@ public class ODataPropertyRequestImpl<T extends CommonODataProperty>
return new ODataPropertyResponseImpl(httpClient, res); return new ODataPropertyResponseImpl(httpClient, res);
} }
protected class ODataPropertyResponseImpl extends ODataRetrieveResponseImpl { protected class ODataPropertyResponseImpl extends AbstractODataRetrieveResponse {
private T property = null; private T property = null;

View File

@ -57,7 +57,7 @@ public class ODataServiceDocumentRequestImpl extends AbstractODataRetrieveReques
/** /**
* Response class about an ODataServiceDocumentRequest. * Response class about an ODataServiceDocumentRequest.
*/ */
protected class ODataServiceResponseImpl extends ODataRetrieveResponseImpl { protected class ODataServiceResponseImpl extends AbstractODataRetrieveResponse {
private ODataServiceDocument serviceDocument = null; private ODataServiceDocument serviceDocument = null;

View File

@ -58,7 +58,7 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataPri
/** /**
* Response class about an ODataDeleteReODataValueRequestquest. * Response class about an ODataDeleteReODataValueRequestquest.
*/ */
protected class ODataValueResponseImpl extends ODataRetrieveResponseImpl { protected class ODataValueResponseImpl extends AbstractODataRetrieveResponse {
private ODataPrimitiveValue value = null; private ODataPrimitiveValue value = null;

View File

@ -56,7 +56,7 @@ public class ODataLinkCollectionRequestImpl extends AbstractODataRetrieveRequest
return new ODataLinkCollectionResponseImpl(httpClient, doExecute()); return new ODataLinkCollectionResponseImpl(httpClient, doExecute());
} }
protected class ODataLinkCollectionResponseImpl extends ODataRetrieveResponseImpl { protected class ODataLinkCollectionResponseImpl extends AbstractODataRetrieveResponse {
private ODataLinkCollection links = null; private ODataLinkCollection links = null;

View File

@ -41,7 +41,7 @@ public class XMLMetadataRequestImpl extends AbstractMetadataRequestImpl<List<? e
return new XMLMetadataResponseImpl(httpClient, doExecute()); return new XMLMetadataResponseImpl(httpClient, doExecute());
} }
public class XMLMetadataResponseImpl extends ODataRetrieveResponseImpl { public class XMLMetadataResponseImpl extends AbstractODataRetrieveResponse {
private XMLMetadata metadata = null; private XMLMetadata metadata = null;

View File

@ -77,7 +77,7 @@ public class XMLMetadataRequestImpl extends AbstractMetadataRequestImpl<List<? e
@Override @Override
public ODataRetrieveResponse<XMLMetadata> execute() { public ODataRetrieveResponse<XMLMetadata> execute() {
return new ODataRetrieveResponseImpl(httpClient, doExecute()) { return new AbstractODataRetrieveResponse(httpClient, doExecute()) {
@Override @Override
public XMLMetadata getBody() { public XMLMetadata getBody() {
@ -91,7 +91,7 @@ public class XMLMetadataRequestImpl extends AbstractMetadataRequestImpl<List<? e
} }
} }
public class XMLMetadataResponseImpl extends ODataRetrieveResponseImpl { public class XMLMetadataResponseImpl extends AbstractODataRetrieveResponse {
private final List<Schema> schemas = new ArrayList<Schema>(); private final List<Schema> schemas = new ArrayList<Schema>();

View File

@ -60,11 +60,11 @@ import org.junit.Test;
public class BatchTestITCase extends AbstractTestITCase { public class BatchTestITCase extends AbstractTestITCase {
private static String PREFIX = "!!PREFIX!!"; private static final String PREFIX = "!!PREFIX!!";
private static String SUFFIX = "!!SUFFIX!!"; private static final String SUFFIX = "!!SUFFIX!!";
private static int MAX = 10000; private static final int MAX = 10000;
@Test @Test
public void stringStreaming() { public void stringStreaming() {
@ -78,7 +78,7 @@ public class BatchTestITCase extends AbstractTestITCase {
streaming.addObject((i + ") send info\n").getBytes()); streaming.addObject((i + ") send info\n").getBytes());
} }
streaming.addObject((SUFFIX).getBytes()); streaming.addObject(SUFFIX.getBytes());
streaming.finalizeBody(); streaming.finalizeBody();
} }
@ -304,7 +304,7 @@ public class BatchTestITCase extends AbstractTestITCase {
assertEquals(202, response.getStatusCode()); assertEquals(202, response.getStatusCode());
assertEquals("Accepted", response.getStatusMessage()); assertEquals("Accepted", response.getStatusMessage());
final Iterator<ODataBatchResponseItem> iter = response.getBody(); final Iterator<ODataBatchResponseItem> iter = response.getBody();
// retrive the first item (ODataRetrieve) // retrive the first item (ODataRetrieve)
ODataBatchResponseItem item = iter.next(); ODataBatchResponseItem item = iter.next();
assertTrue(item instanceof ODataRetrieveResponseItem); assertTrue(item instanceof ODataRetrieveResponseItem);
@ -315,10 +315,11 @@ public class BatchTestITCase extends AbstractTestITCase {
assertEquals(200, res.getStatusCode()); assertEquals(200, res.getStatusCode());
assertEquals("OK", res.getStatusMessage()); assertEquals("OK", res.getStatusMessage());
ODataEntityResponseImpl entres = (ODataEntityResponseImpl) res; ODataEntityRequestImpl<ODataEntity>.ODataEntityResponseImpl entres =
ODataEntity entity = (ODataEntity)entres.getBody(); (ODataEntityRequestImpl.ODataEntityResponseImpl) res;
assertEquals(new Integer(-10), entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class)); ODataEntity entity = entres.getBody();
assertEquals(-10, entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class), 0);
// retrieve the second item (ODataChangeset) // retrieve the second item (ODataChangeset)
item = iter.next(); item = iter.next();
@ -349,8 +350,8 @@ public class BatchTestITCase extends AbstractTestITCase {
assertEquals(200, res.getStatusCode()); assertEquals(200, res.getStatusCode());
assertEquals("OK", res.getStatusMessage()); assertEquals("OK", res.getStatusMessage());
entres = (ODataEntityResponseImpl) res; entres = (ODataEntityRequestImpl.ODataEntityResponseImpl) res;
entity = (ODataEntity)entres.getBody(); entity = entres.getBody();
assertEquals("new description from batch", assertEquals("new description from batch",
entity.getProperty("Description").getPrimitiveValue().toCastValue(String.class)); entity.getProperty("Description").getPrimitiveValue().toCastValue(String.class));

View File

@ -30,7 +30,6 @@ import java.util.LinkedHashMap;
import java.util.Set; import java.util.Set;
import org.apache.http.entity.ContentType; import org.apache.http.entity.ContentType;
import org.apache.olingo.client.api.communication.header.HeaderName; import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.header.ODataPreferences;
import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest; import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest; import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType; import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;

View File

@ -26,7 +26,6 @@ import java.net.URI;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import org.apache.olingo.client.api.communication.ODataClientErrorException; import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.header.HeaderName; import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.header.ODataPreferences;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest; import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType; import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest; import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;

View File

@ -70,7 +70,7 @@
<commons.logging.version>1.1.3</commons.logging.version> <commons.logging.version>1.1.3</commons.logging.version>
<commons.vfs.version>2.0</commons.vfs.version> <commons.vfs.version>2.0</commons.vfs.version>
<esigate.version>4.3</esigate.version> <esigate.version>4.3</esigate.version>
<servlet.version>3.1.0</servlet.version> <servlet.version>3.0.1</servlet.version>
<cxf.version>2.7.11</cxf.version> <cxf.version>2.7.11</cxf.version>
<spring.version>4.0.3.RELEASE</spring.version> <spring.version>4.0.3.RELEASE</spring.version>