[OLINGO-356] removed several warnings + code clean-up

Change-Id: Id7a6ede6309e6f1109a0ded6df9c436df2449764
This commit is contained in:
Klaus Straubinger 2014-08-15 11:37:19 +02:00 committed by Michael Bolz
parent 2cc02a6300
commit 931f1324e6
57 changed files with 121 additions and 197 deletions

View File

@ -27,8 +27,6 @@ import java.net.URI;
public class AndroidHttpClientFactory extends AbstractHttpClientFactory {
private static final long serialVersionUID = -5224104561624556177L;
@Override
public AndroidHttpClient create(final HttpMethod method, final URI uri) {
return AndroidHttpClient.newInstance(USER_AGENT);

View File

@ -19,13 +19,10 @@
package org.apache.olingo.ext.proxy.api;
import java.io.Serializable;
import java.util.Collection;
public interface PrimitiveCollection<T extends Serializable>
extends GenericCollection<T, PrimitiveCollection<T>>,
CollectionQuery<PrimitiveCollection<T>>,
Collection<T>,
Serializable {
CollectionQuery<PrimitiveCollection<T>> {
void delete();
}

View File

@ -25,7 +25,7 @@ import java.util.Collection;
*/
public interface StructuredCollection<
T extends StructuredType<?>, EC extends Collection<T>, CT extends StructuredCollection<T, EC, ?>>
extends GenericCollection<T, EC>, java.io.Serializable {
extends GenericCollection<T, EC> {
/**
* Explicit paging result handling.

View File

@ -50,8 +50,6 @@ import org.apache.olingo.ext.proxy.utils.CoreUtils;
public abstract class AbstractCollectionInvocationHandler<T extends Serializable, EC extends Collection<T>>
extends AbstractInvocationHandler implements Collection<T> {
private static final long serialVersionUID = 98078202642671726L;
protected URI nextPageURI = null;
protected Collection<T> items;
@ -234,7 +232,7 @@ public abstract class AbstractCollectionInvocationHandler<T extends Serializable
}
@Override
public <T> T[] toArray(final T[] array) {
public <U> U[] toArray(final U[] array) {
return items.toArray(array);
}

View File

@ -46,8 +46,6 @@ public abstract class AbstractEntityCollectionInvocationHandler<
T extends EntityType<?>, EC extends EntityCollection<T, ?, ?>>
extends AbstractCollectionInvocationHandler<T, EC> {
private static final long serialVersionUID = 98078202642671727L;
protected URI targetEntitySetURI;
private boolean isSingleton = false;

View File

@ -52,8 +52,6 @@ import org.slf4j.LoggerFactory;
abstract class AbstractInvocationHandler implements InvocationHandler {
private static final long serialVersionUID = 358520026931462958L;
/**
* Logger.
*/

View File

@ -70,8 +70,6 @@ import org.apache.olingo.ext.proxy.utils.ProxyUtils;
public abstract class AbstractStructuredInvocationHandler extends AbstractInvocationHandler {
private static final long serialVersionUID = 2629912294765040037L;
protected CommonURIBuilder<?> uri;
protected URI baseURI;

View File

@ -28,8 +28,6 @@ import org.apache.olingo.ext.proxy.AbstractService;
public class AnnotatationsInvocationHandler extends AbstractInvocationHandler {
private static final long serialVersionUID = -1993362719908718985L;
private final EntityInvocationHandler entityHandler;
private final AbstractStructuredInvocationHandler targetHandler;

View File

@ -44,8 +44,6 @@ import org.apache.olingo.ext.proxy.api.ComplexType;
public class ComplexCollectionInvocationHandler<T extends ComplexType<?>>
extends AbstractCollectionInvocationHandler<T, ComplexCollection<T, ?, ?>> {
private static final long serialVersionUID = 98078202642671756L;
public ComplexCollectionInvocationHandler(
final AbstractService<?> service,
final Class<T> itemRef) {

View File

@ -27,8 +27,6 @@ import org.apache.olingo.ext.proxy.AbstractService;
public class EdmStreamValueHandler extends AbstractInvocationHandler {
private static final long serialVersionUID = 2629912294765040047L;
private URI uri;
private InputStream stream;

View File

@ -32,8 +32,6 @@ import org.apache.olingo.ext.proxy.api.EntityType;
public class EntityCollectionInvocationHandler<T extends EntityType<?>>
extends AbstractEntityCollectionInvocationHandler<T, EntityCollection<T, ?, ?>> {
private static final long serialVersionUID = 98078202642671726L;
public EntityCollectionInvocationHandler(
final AbstractService<?> service, final Class<? extends EntityCollection<T, ?, ?>> collItemRef) {
this(service, new ArrayList<T>(), collItemRef, null, null);

View File

@ -47,8 +47,6 @@ import java.util.Map;
final class OperationInvocationHandler extends AbstractInvocationHandler {
private static final long serialVersionUID = 2629912294765040027L;
private final InvocationHandler target;
private final FullQualifiedName targetFQN;

View File

@ -42,8 +42,6 @@ import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
public class PrimitiveCollectionInvocationHandler<T extends Serializable>
extends AbstractCollectionInvocationHandler<T, PrimitiveCollection<T>> {
private static final long serialVersionUID = 98078202642671756L;
public PrimitiveCollectionInvocationHandler(
final AbstractService<?> service,
final Class<T> itemRef) {

View File

@ -35,22 +35,18 @@ import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
import java.util.Properties;
import java.util.UUID;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.SimpleFormatter;
/**
*
* Server for integration tests.
*/
public class TomcatTestServer {
private static final Logger LOG = LoggerFactory.getLogger(TomcatTestServer.class);
@ -105,7 +101,9 @@ public class TomcatTestServer {
LOG.info("...and run as long as the thread is running.");
server.start();
}
} catch (Exception e) {
} catch (IOException e) {
throw new RuntimeException("Failed to start Tomcat server from main method.", e);
} catch (LifecycleException e) {
throw new RuntimeException("Failed to start Tomcat server from main method.", e);
}
}
@ -257,7 +255,7 @@ public class TomcatTestServer {
return this;
}
public TestServerBuilder addStaticContent(String uri, String resourceName) throws Exception {
public TestServerBuilder addStaticContent(String uri, String resourceName) throws IOException {
File targetResourcesDir = getFileForDirProperty(PROJECT_RESOURCES_DIR);
String resource = new File(targetResourcesDir, resourceName).getAbsolutePath();
LOG.info("Added static content from '{}' at uri '{}'.", resource, uri);
@ -265,7 +263,7 @@ public class TomcatTestServer {
return addServlet(staticContent, String.valueOf(uri.hashCode()), uri);
}
public TestServerBuilder addServlet(HttpServlet httpServlet, String name, String path) throws Exception {
public TestServerBuilder addServlet(HttpServlet httpServlet, String name, String path) throws IOException {
if(server != null) {
return this;
}
@ -315,26 +313,4 @@ public class TomcatTestServer {
tomcat.destroy();
}
}
private static void extract(File jarFile, File destDir) throws IOException {
JarFile jar = new JarFile(jarFile);
Enumeration<JarEntry> enumEntries = jar.entries();
while (enumEntries.hasMoreElements()) {
JarEntry file = enumEntries.nextElement();
File f = new File(destDir, file.getName());
if (file.isDirectory()) {
if(!f.exists() && !f.mkdir()) {
throw new IOException("Unable to create directory at path '" + f.getAbsolutePath() + "'.");
}
} else {
InputStream is = jar.getInputStream(file);
FileOutputStream fos = new FileOutputStream(f);
while (is.available() > 0) {
fos.write(is.read());
}
fos.close();
is.close();
}
}
}
}

View File

@ -161,7 +161,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase {
}
@Override
protected CommonODataClient getClient() {
protected CommonODataClient<?> getClient() {
throw new RuntimeException("This method should not be used from proxy tests.");
}
}

View File

@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
@org.apache.olingo.ext.proxy.api.annotations.CompoundKey
public class MessageKey extends AbstractEntityKey {
private java.lang.String _fromUsername;
private static final long serialVersionUID = 3366500795925894331L;
private java.lang.String _fromUsername;
@CompoundKeyElement(name = "FromUsername", position = 0)
public java.lang.String getFromUsername() {

View File

@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
@org.apache.olingo.ext.proxy.api.annotations.CompoundKey
public class OrderLineKey extends AbstractEntityKey {
private java.lang.Integer _orderId;
private static final long serialVersionUID = -1727537164739906574L;
private java.lang.Integer _orderId;
@CompoundKeyElement(name = "OrderId", position = 0)
public java.lang.Integer getOrderId() {

View File

@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
@org.apache.olingo.ext.proxy.api.annotations.CompoundKey
public class ProductPhotoKey extends AbstractEntityKey {
private java.lang.Integer _photoId;
private static final long serialVersionUID = 1910899056846394895L;
private java.lang.Integer _photoId;
@CompoundKeyElement(name = "PhotoId", position = 0)
public java.lang.Integer getPhotoId() {

View File

@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
@org.apache.olingo.ext.proxy.api.annotations.CompoundKey
public class ProductReviewKey extends AbstractEntityKey {
private java.lang.Integer _productId;
private static final long serialVersionUID = -1529404858249138672L;
private java.lang.Integer _productId;
@CompoundKeyElement(name = "ProductId", position = 0)
public java.lang.Integer getProductId() {

View File

@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
@org.apache.olingo.ext.proxy.api.annotations.CompoundKey
public class MessageKey extends AbstractEntityKey {
private java.lang.String _fromUsername;
private static final long serialVersionUID = -2882168811541786714L;
private java.lang.String _fromUsername;
@CompoundKeyElement(name = "FromUsername", position = 0)
public java.lang.String getFromUsername() {

View File

@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
@org.apache.olingo.ext.proxy.api.annotations.CompoundKey
public class OrderLineKey extends AbstractEntityKey {
private java.lang.Integer _orderId;
private static final long serialVersionUID = 5409689671465693207L;
private java.lang.Integer _orderId;
@CompoundKeyElement(name = "OrderId", position = 0)
public java.lang.Integer getOrderId() {

View File

@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
@org.apache.olingo.ext.proxy.api.annotations.CompoundKey
public class ProductPhotoKey extends AbstractEntityKey {
private java.lang.Integer _photoId;
private static final long serialVersionUID = -3057054846709839639L;
private java.lang.Integer _photoId;
@CompoundKeyElement(name = "PhotoId", position = 0)
public java.lang.Integer getPhotoId() {

View File

@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
@org.apache.olingo.ext.proxy.api.annotations.CompoundKey
public class ProductReviewKey extends AbstractEntityKey {
private java.lang.Integer _productId;
private static final long serialVersionUID = 2903240760530127688L;
private java.lang.Integer _productId;
@CompoundKeyElement(name = "ProductId", position = 0)
public java.lang.Integer getProductId() {

View File

@ -577,8 +577,7 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase {
/**
* Java client should support the deletion based on locally created entity.
*
* @see https://issues.apache.org/jira/browse/OLINGO-395
* See also <a href="https://issues.apache.org/jira/browse/OLINGO-395">Olingo Issue 395</a>.
*/
@Test
public void issueOLINGO395() {

View File

@ -142,7 +142,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase {
}
@Override
protected CommonODataClient getClient() {
protected CommonODataClient<?> getClient() {
throw new RuntimeException("This method should not be used from proxy tests.");
}
}

View File

@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
@org.apache.olingo.ext.proxy.api.annotations.CompoundKey
public class OrderDetailKey extends AbstractEntityKey {
private java.lang.Integer _orderID;
private static final long serialVersionUID = -4068508671802176607L;
private java.lang.Integer _orderID;
@CompoundKeyElement(name = "OrderID", position = 0)
public java.lang.Integer getOrderID() {

View File

@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
@org.apache.olingo.ext.proxy.api.annotations.CompoundKey
public class ProductDetailKey extends AbstractEntityKey {
private java.lang.Integer _productID;
private static final long serialVersionUID = -6268946147639590355L;
private java.lang.Integer _productID;
@CompoundKeyElement(name = "ProductID", position = 0)
public java.lang.Integer getProductID() {

View File

@ -26,7 +26,9 @@ import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
@org.apache.olingo.ext.proxy.api.annotations.CompoundKey
public class ProductReviewKey extends AbstractEntityKey {
private java.lang.Integer _productID;
private static final long serialVersionUID = 5483520057777167030L;
private java.lang.Integer _productID;
@CompoundKeyElement(name = "ProductID", position = 0)
public java.lang.Integer getProductID() {

View File

@ -23,8 +23,8 @@ import java.util.Collection;
/**
* ODataHeaders wraps OData request/response headers.
*
* @see org.apache.olingo.client.core.communication.request.ODataRequest
* @see org.apache.olingo.client.core.communication.response.ODataResponse
* @see org.apache.olingo.client.api.communication.request.ODataRequest
* @see org.apache.olingo.client.api.communication.response.ODataResponse
*/
public interface ODataHeaders {

View File

@ -32,10 +32,8 @@ import java.util.Collection;
* @see org.apache.olingo.client.api.communication.request.cud.v4.CUDRequestFactory
* @see org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory
* @see org.apache.olingo.client.api.communication.request.batch.v4.BatchRequestFactory
* @see org.apache.olingo.client.api.communication.request.invoke.v3.InvokeRequestFactory
* @see org.apache.olingo.client.api.communication.request.invoke.v4.InvokeRequestFactory
* @see org.apache.olingo.client.api.communication.request.streamed.v3.StreamedRequestFactory
* @see org.apache.olingo.client.api.communication.request.streamed.v4.StreamedRequestFactory
* @see org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory
* @see org.apache.olingo.client.api.communication.request.streamed.StreamedRequestFactory
*/
public interface ODataRequest {
@ -50,7 +48,6 @@ public interface ODataRequest {
* Sets OData request target URI.
*
* @param uri target URI.
* @return OData request target URI.
*/
void setURI(URI uri);
@ -81,7 +78,7 @@ public interface ODataRequest {
*
* @param value header value.
* @return current object
* @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#accept
* @see org.apache.olingo.client.api.communication.header.HeaderName#accept
*/
ODataRequest setAccept(final String value);
@ -89,7 +86,7 @@ public interface ODataRequest {
* Gets <tt>Accept</tt> OData request header.
*
* @return header value.
* @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#accept
* @see org.apache.olingo.client.api.communication.header.HeaderName#accept
*/
String getAccept();
@ -98,7 +95,7 @@ public interface ODataRequest {
*
* @param value header value.
* @return current object
* @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#ifMatch
* @see org.apache.olingo.client.api.communication.header.HeaderName#ifMatch
*/
ODataRequest setIfMatch(final String value);
@ -106,7 +103,7 @@ public interface ODataRequest {
* Gets <tt>If-Match</tt> OData request header.
*
* @return header value.
* @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#ifMatch
* @see org.apache.olingo.client.api.communication.header.HeaderName#ifMatch
*/
String getIfMatch();
@ -115,7 +112,7 @@ public interface ODataRequest {
*
* @param value header value.
* @return current object
* @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#ifNoneMatch
* @see org.apache.olingo.client.api.communication.header.HeaderName#ifNoneMatch
*/
ODataRequest setIfNoneMatch(final String value);
@ -123,7 +120,7 @@ public interface ODataRequest {
* Gets <tt>If-None-Match</tt> OData request header.
*
* @return header value.
* @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#ifNoneMatch
* @see org.apache.olingo.client.api.communication.header.HeaderName#ifNoneMatch
*/
String getIfNoneMatch();
@ -132,7 +129,7 @@ public interface ODataRequest {
*
* @param value header value.
* @return current object
* @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#prefer
* @see org.apache.olingo.client.api.communication.header.HeaderName#prefer
*/
ODataRequest setPrefer(final String value);
@ -140,7 +137,7 @@ public interface ODataRequest {
* Gets <tt>Prefer</tt> OData request header.
*
* @return header value.
* @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#prefer
* @see org.apache.olingo.client.api.communication.header.HeaderName#prefer
*/
String getPrefer();
@ -149,7 +146,7 @@ public interface ODataRequest {
*
* @param value header value.
* @return current object
* @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#contentType
* @see org.apache.olingo.client.api.communication.header.HeaderName#contentType
*/
ODataRequest setContentType(final String value);
@ -157,7 +154,7 @@ public interface ODataRequest {
* Gets <tt>contentType</tt> OData request header.
*
* @return header value.
* @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#contentType
* @see org.apache.olingo.client.api.communication.header.HeaderName#contentType
*/
String getContentType();
@ -166,7 +163,7 @@ public interface ODataRequest {
*
* @param value header value.
* @return current object
* @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#slug
* @see org.apache.olingo.client.api.communication.header.HeaderName#slug
*/
ODataRequest setSlug(final String value);
@ -175,7 +172,7 @@ public interface ODataRequest {
*
* @param value header value.
* @return current object
* @see org.apache.olingo.client.core.communication.header.ODataHeaders.HeaderName#xHttpMethod
* @see org.apache.olingo.client.api.communication.header.HeaderName#xHttpMethod
*/
ODataRequest setXHTTPMethod(final String value);

View File

@ -36,7 +36,7 @@ public interface ODataStreamedEntityRequest<V extends ODataResponse, T extends O
* Returns resource representation format.
*
* @return the configured format (or default if not specified).
* @see org.apache.olingo.client.api.CommonConfiguration#getDefaultPubFormat()
* @see org.apache.olingo.client.api.Configuration#getDefaultPubFormat()
*/
ODataFormat getFormat();

View File

@ -25,7 +25,7 @@ import java.util.Iterator;
/**
* This class implements a response to a batch request.
*
* @see org.apache.olingo.client.core.communication.request.batch.ODataBatchRequest
* @see org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest
*/
public interface ODataBatchResponse extends ODataResponse {

View File

@ -21,7 +21,7 @@ package org.apache.olingo.client.api.communication.response;
/**
* This class implements the response to an OData delete request.
*
* @see org.apache.olingo.client.core.communication.request.cud.ODataDeleteRequest
* @see org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest
*/
public interface ODataDeleteResponse extends ODataResponse {
}

View File

@ -24,7 +24,7 @@ import org.apache.olingo.commons.api.domain.CommonODataEntity;
* This interface describes the response to an OData entity create request.
*
* @param <E> concrete ODataEntity implementation
* @see org.apache.olingo.client.core.communication.request.cud.ODataEntityCreateRequest
* @see org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest
*/
public interface ODataEntityCreateResponse<E extends CommonODataEntity> extends ODataResponse {

View File

@ -24,7 +24,7 @@ import org.apache.olingo.commons.api.domain.CommonODataEntity;
* This class implements the response to an OData update request.
*
* @param <E> concrete ODataEntity implementation
* @see org.apache.olingo.client.core.communication.request.cud.ODataEntityUpdateRequest
* @see org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest
*/
public interface ODataEntityUpdateResponse<E extends CommonODataEntity> extends ODataResponse {

View File

@ -21,8 +21,8 @@ package org.apache.olingo.client.api.communication.response;
/**
* This interface defines the response to an OData link operation request.
*
* @see org.apache.olingo.client.core.communication.request.cud.ODataLinkCreateRequest
* @see org.apache.olingo.client.core.communication.request.cud.ODataLinkUpdateRequest
* @see org.apache.olingo.client.api.communication.request.cud.v3.ODataLinkCreateRequest
* @see org.apache.olingo.client.api.communication.request.cud.v3.ODataLinkUpdateRequest
*/
public interface ODataLinkOperationResponse extends ODataResponse {
}

View File

@ -23,7 +23,7 @@ import org.apache.olingo.commons.api.domain.CommonODataProperty;
/**
* This class implements the response to an OData update entity property request.
*
* @see org.apache.olingo.client.core.communication.request.cud.ODataPropertyUpdateRequest
* @see org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest
*/
public interface ODataPropertyUpdateResponse extends ODataResponse {

View File

@ -21,7 +21,7 @@ package org.apache.olingo.client.api.communication.response;
/**
* This class implements a response to a specific query request.
*
* @see org.apache.olingo.client.core.communication.request.retrieve.ODataRetrieveRequest
* @see org.apache.olingo.client.api.communication.request.retrieve.ODataRetrieveRequest
*/
public interface ODataRetrieveResponse<T> extends ODataResponse {

View File

@ -23,7 +23,7 @@ import java.io.InputStream;
/**
* This class implements the response to an Odata stream create/update request.
*
* @see org.apache.olingo.client.core.communication.request.streamed.ODataStreamUpdateRequest
* @see org.apache.olingo.client.api.communication.request.streamed.ODataStreamUpdateRequest
*/
public interface ODataStreamUpdateResponse extends ODataResponse {

View File

@ -23,7 +23,7 @@ import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
/**
* This class implements the response to an OData update entity property request.
*
* @see org.apache.olingo.client.core.communication.request.cud.ODataPropertyUpdateRequest
* @see org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest
*/
public interface ODataValueUpdateResponse extends ODataResponse {

View File

@ -23,7 +23,7 @@ import org.apache.olingo.client.api.communication.response.*;
/**
* This class implements the response to an OData delete request.
*
* @see org.apache.olingo.client.core.communication.request.cud.ODataDeleteRequest
* @see org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest
*/
public interface ODataReferenceAddingResponse extends ODataResponse {
}

View File

@ -24,7 +24,7 @@ import java.util.List;
/**
* REST resource for an <tt>ODataServiceDocument</tt>.
*
* @see org.apache.olingo.client.api.domain.ODataServiceDocument
* @see org.apache.olingo.commons.api.domain.ODataServiceDocument
*/
public interface ServiceDocument {
@ -59,7 +59,7 @@ public interface ServiceDocument {
*/
List<ServiceDocumentItem> getFunctionImports();
/*
/**
* Gets top level function import set with given name.
*
* @param name function import name

View File

@ -170,12 +170,12 @@ public interface CommonURIBuilder<UB extends CommonURIBuilder<?>> {
/**
* Adds filter for filter query option.
*
* @param filter filter instance (to be obtained via <tt>ODataFilterFactory</tt>): note that <tt>build()</tt> method
* will be immediately invoked.
* @param filter filter instance (to be obtained via <tt>FilterFactory</tt>);
* note that <tt>build()</tt> method will be immediately invoked.
* @return current URIBuilder instance
* @see QueryOption#FILTER
* @see URIFilter
* @see org.apache.olingo.client.api.uri.filter.FilterFactory
* @see org.apache.olingo.client.api.uri.CommonFilterFactory
*/
UB filter(URIFilter filter);

View File

@ -21,7 +21,7 @@ package org.apache.olingo.client.api.uri;
/**
* Interface for any available filter; obtain instances via <tt>FilterFactory</tt>.
*
* @see FilterFactory
* @see org.apache.olingo.client.api.uri.CommonFilterFactory
*/
public interface URIFilter {

View File

@ -70,9 +70,6 @@ public abstract class AbstractODataBatchRequest<V extends ODataResponse, T exten
expectedResItems.add(item);
}
/**
* {@inheritDoc }
*/
public PipedOutputStream getOutputStream() {
return getPayloadManager().getBodyStreamWriter();
}

View File

@ -23,7 +23,7 @@ import org.apache.olingo.client.api.uri.FilterArg;
/**
* Filter property path; obtain instances via <tt>FilterArgFactory</tt>.
*
* @see org.apache.olingo.client.api.uri.filter.FilterArgFactory
* @see org.apache.olingo.client.api.uri.CommonFilterArgFactory
*/
public class FilterConst implements FilterArg {

View File

@ -23,7 +23,7 @@ import org.apache.olingo.client.api.uri.FilterArg;
/**
* Filter property path; obtain instances via <tt>FilterArgFactory</tt>.
*
* @see FilterArgFactory
* @see org.apache.olingo.client.api.uri.CommonFilterArgFactory
*/
public class FilterProperty implements FilterArg {

View File

@ -21,9 +21,9 @@ package org.apache.olingo.commons.api.domain;
/**
* Marker interface for any OData domain object that can be returned by an operation invocation.
*
* @see ODataEntitySet
* @see ODataEntity
* @see ODataProperty
* @see CommonODataEntitySet
* @see CommonODataEntity
* @see CommonODataProperty
* @see ODataNoContent
*/
public interface ODataInvokeResult {}

View File

@ -73,10 +73,10 @@ public interface EdmStructuredType extends EdmType, EdmAnnotationsTarget, EdmAnn
EdmStructuredType getBaseType();
/**
* Checks if this type is convertible to parameter {@link targetType}
* Checks if this type is convertible to parameter {@code targetType}
*
* @param targetType
* @return true if this type is compatible to the testType ( i.e. this type is a subtype of targetType )
* @return true if this type is compatible to the testType (i.e., this type is a subtype of targetType)
*/
boolean compatibleTo(EdmType targetType);

View File

@ -21,6 +21,7 @@ package org.apache.olingo.commons.core.edm.primitivetype;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import java.net.URI;
import java.net.URISyntaxException;
/**
* Implementation of the EDM primitive type Stream as URI.
@ -49,7 +50,7 @@ public final class EdmStream extends SingletonPrimitiveType {
try {
new URI(value);
return true;
} catch (Exception e) {
} catch (final URISyntaxException e) {
return false;
}
}
@ -62,7 +63,7 @@ public final class EdmStream extends SingletonPrimitiveType {
URI stream = null;
try {
stream = new URI(value);
} catch (Exception e) {
} catch (final URISyntaxException e) {
throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
}

View File

@ -87,9 +87,8 @@ public class DefaultProcessor implements MetadataProcessor, ServiceDocumentProce
} catch (Exception e) {
// This should never happen but to be sure we have this catch here to prevent sending a stacktrace to a client.
String responseContent =
"{\"error\":{\"code\":null,\"message\":\"An unexpected exception occoured during " +
"error processing with message: "
+ e.getMessage() + "\"}}";
"{\"error\":{\"code\":null,\"message\":\"An unexpected exception occurred during " +
"error processing with message: " + e.getMessage() + "\"}}";
response.setContent(new ByteArrayInputStream(responseContent.getBytes()));
response.setStatusCode(HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode());
response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_JSON.toContentTypeString());

View File

@ -49,7 +49,7 @@ public class TechnicalServlet extends HttpServlet {
HttpSession session = req.getSession(true);
DataProvider dataProvider = (DataProvider) session.getAttribute(DataProvider.class.getName());
if (dataProvider == null) {
dataProvider = new DataProvider(edm);
dataProvider = new DataProvider();
session.setAttribute(DataProvider.class.getName(), dataProvider);
LOG.info("Created new data provider.");
}
@ -57,7 +57,7 @@ public class TechnicalServlet extends HttpServlet {
ODataHttpHandler handler = odata.createHandler(edm);
handler.register(new TechnicalProcessor(dataProvider));
handler.process(req, resp);
} catch (Exception e) {
} catch (RuntimeException e) {
LOG.error("Server Error", e);
throw new ServletException(e);
}

View File

@ -34,7 +34,6 @@ import org.apache.olingo.commons.api.data.EntitySet;
import org.apache.olingo.commons.api.data.LinkedComplexValue;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ValueType;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
@ -50,11 +49,9 @@ public class DataProvider {
private static final UUID GUID = UUID.fromString("01234567-89ab-cdef-0123-456789abcdef");
private final Edm edm;
private Map<String, EntitySet> data;
public DataProvider(final Edm edm) {
this.edm = edm;
public DataProvider() {
data = new HashMap<String, EntitySet>();
data.put("ESTwoPrim", createESTwoPrim());
data.put("ESAllPrim", createESAllPrim());

View File

@ -48,7 +48,6 @@ import java.util.Locale;
public class TechnicalProcessor implements EntityCollectionProcessor, EntityProcessor {
private OData odata;
private Edm edm;
private DataProvider dataProvider;
public TechnicalProcessor(final DataProvider dataProvider) {
@ -58,7 +57,6 @@ public class TechnicalProcessor implements EntityCollectionProcessor, EntityProc
@Override
public void init(final OData odata, final Edm edm) {
this.odata = odata;
this.edm = edm;
}
@Override
@ -70,7 +68,7 @@ public class TechnicalProcessor implements EntityCollectionProcessor, EntityProc
}
try {
final EdmEntitySet edmEntitySet = getEdmEntitySet(uriInfo.asUriInfoResource());
final EntitySet entitySet = readEntitySetInternal(edmEntitySet, request.getRawBaseUri());
final EntitySet entitySet = readEntitySetInternal(edmEntitySet);
if (entitySet == null) {
response.setStatusCode(HttpStatusCode.NOT_FOUND.getStatusCode());
} else {
@ -115,8 +113,7 @@ public class TechnicalProcessor implements EntityCollectionProcessor, EntityProc
}
}
private EntitySet readEntitySetInternal(final EdmEntitySet edmEntitySet, final String serviceRoot)
throws DataProvider.DataProviderException {
private EntitySet readEntitySetInternal(final EdmEntitySet edmEntitySet) throws DataProvider.DataProviderException {
EntitySet entitySet = dataProvider.readAll(edmEntitySet);
// TODO: set count and next link
return entitySet;

View File

@ -18,6 +18,7 @@
*/
package org.apache.olingo.server.tecsvc.data;
import java.util.Arrays;
import java.util.List;
import org.apache.olingo.commons.api.data.Entity;
@ -25,22 +26,16 @@ import org.apache.olingo.commons.api.data.EntitySet;
import org.apache.olingo.commons.api.data.LinkedComplexValue;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmComplexType;
import org.apache.olingo.commons.api.edm.EdmElement;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmStructuredType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.tecsvc.provider.ContainerProvider;
import org.apache.olingo.server.api.uri.UriParameter;
import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
/**
*/
public class DataProviderTest {
private final Edm edm = OData.newInstance().createEdm(new EdmTechProvider());
@ -61,16 +56,19 @@ public class DataProviderTest {
@Test
public void esAllPrimEntity() throws Exception {
DataProvider jdp = getDataProvider();
Entity first = jdp.readAll(esAllPrim).getEntities().get(0);
final DataProvider dataProvider = new DataProvider();
Entity first = dataProvider.readAll(esAllPrim).getEntities().get(0);
Assert.assertEquals(16, first.getProperties().size());
UriParameter parameter = Mockito.mock(UriParameter.class);
Mockito.when(parameter.getName()).thenReturn("PropertyInt16");
Mockito.when(parameter.getText()).thenReturn(Short.toString(Short.MAX_VALUE));
Assert.assertEquals(first, dataProvider.read(esAllPrim, Arrays.asList(parameter)));
}
@Test
public void esAllPrim() throws Exception {
DataProvider jdp = getDataProvider();
EntitySet outSet = jdp.readAll(esAllPrim);
EntitySet outSet = new DataProvider().readAll(esAllPrim);
Assert.assertEquals(3, outSet.getEntities().size());
Entity first = outSet.getEntities().get(0);
@ -81,8 +79,7 @@ public class DataProviderTest {
@Test
public void esCollAllPrim() throws Exception {
DataProvider jdp = getDataProvider();
EntitySet outSet = jdp.readAll(esCollAllPrim);
EntitySet outSet = new DataProvider().readAll(esCollAllPrim);
Assert.assertEquals(3, outSet.getEntities().size());
Assert.assertEquals(17, outSet.getEntities().get(0).getProperties().size());
@ -95,8 +92,7 @@ public class DataProviderTest {
@Test
public void esCompAllPrim() throws Exception {
DataProvider jdp = getDataProvider();
EntitySet outSet = jdp.readAll(esCompAllPrim);
EntitySet outSet = new DataProvider().readAll(esCompAllPrim);
Assert.assertEquals(3, outSet.getEntities().size());
Assert.assertEquals(2, outSet.getEntities().get(0).getProperties().size());
@ -109,8 +105,7 @@ public class DataProviderTest {
@Test
public void esMixPrimCollComp() throws Exception {
DataProvider jdp = getDataProvider();
EntitySet outSet = jdp.readAll(esMixPrimCollAllPrim);
EntitySet outSet = new DataProvider().readAll(esMixPrimCollAllPrim);
Assert.assertEquals(3, outSet.getEntities().size());
Assert.assertEquals(4, outSet.getEntities().get(0).getProperties().size());
@ -130,41 +125,4 @@ public class DataProviderTest {
Assert.assertEquals(4, outSet.getEntities().get(1).getProperties().size());
Assert.assertEquals(4, outSet.getEntities().get(2).getProperties().size());
}
private DataProvider getDataProvider() throws DataProvider.DataProviderException {
OData odata = OData.newInstance();
Edm edm = odata.createEdm(new EdmTechProvider());
return new DataProvider(edm);
}
@Test
public void edm() {
OData odata = OData.newInstance();
Edm edm = odata.createEdm(new EdmTechProvider());
EdmEntitySet edmEntitySet =
edm.getEntityContainer(ContainerProvider.nameContainer).getEntitySet("ESCompAllPrim");
EdmEntityType et = edmEntitySet.getEntityType();
printType(edm, et);
}
private void printType(Edm edm, EdmStructuredType type) {
List<String> propNames = type.getPropertyNames();
for (String propName : propNames) {
EdmElement element = type.getProperty(propName);
if(element instanceof EdmProperty) {
EdmProperty property = (EdmProperty) element;
if(property.isPrimitive()) {
System.out.println("Primitive name/type: " + property.getName() + "/" + property.getType());
} else {
// recursion
EdmComplexType complex = edm.getComplexType(property.getType().getFullQualifiedName());
System.out.println("Complex name/type [" + property.getName() + "/" + property.getType() + "]");
printType(edm, complex);
}
}
}
}
}

View File

@ -47,7 +47,7 @@ public class ODataJsonSerializerTest {
private final Edm edm = OData.newInstance().createEdm(new EdmTechProvider());
private final EdmEntityContainer entityContainer = edm.getEntityContainer(
new FullQualifiedName("com.sap.odata.test1", "Container"));
private final DataProvider data = new DataProvider(edm);
private final DataProvider data = new DataProvider();
private ODataSerializer serializer = new ODataJsonSerializer(ODataFormat.JSON);
@Test

View File

@ -44,10 +44,12 @@ import org.apache.olingo.server.core.uri.UriResourceNavigationPropertyImpl;
import org.apache.olingo.server.core.uri.UriResourcePrimitivePropertyImpl;
import org.apache.olingo.server.core.uri.UriResourceSingletonImpl;
import org.apache.olingo.server.core.uri.UriResourceWithKeysImpl;
import org.apache.olingo.server.core.uri.parser.UriParserException;
import org.apache.olingo.server.core.uri.queryoption.CustomQueryOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.SelectOptionImpl;
import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
import org.apache.olingo.server.core.uri.validator.UriValidationException;
import org.apache.olingo.server.core.uri.validator.UriValidator;
import java.util.List;
@ -91,11 +93,15 @@ public class ResourceValidator implements TestValidator {
uriPathInfo = null;
try {
uriInfoTmp = testParser.parseUri(uri, edm);
} catch (final UriParserException e) {
fail("Exception occurred while parsing the URI: " + uri + "\n"
+ " Message: " + e.getMessage());
}
UriValidator uriValidator = new UriValidator();
uriValidator.validate(uriInfoTmp, HttpMethod.GET);
} catch (Exception e) {
fail("Exception occured while parsing the URI: " + uri + "\n"
try {
new UriValidator().validate(uriInfoTmp, HttpMethod.GET);
} catch (final UriValidationException e) {
fail("Exception occurred while validating the URI: " + uri + "\n"
+ " Message: " + e.getMessage());
}