[OLINGO-659] Small dependency enhancement

This commit is contained in:
Christian Amend 2015-08-18 10:26:01 +02:00
parent 7ec7168b1a
commit 7df31c58c3
9 changed files with 46 additions and 42 deletions

View File

@ -41,6 +41,10 @@
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>

View File

@ -38,22 +38,13 @@
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>

View File

@ -30,12 +30,9 @@ import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.geo.SRID; import org.apache.olingo.commons.api.edm.geo.SRID;
import org.apache.olingo.commons.api.edm.provider.CsdlTerm; import org.apache.olingo.commons.api.edm.provider.CsdlTerm;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class EdmTermImpl extends AbstractEdmNamed implements EdmTerm { public class EdmTermImpl extends AbstractEdmNamed implements EdmTerm {
private static final Logger LOG = LoggerFactory.getLogger(EdmTermImpl.class);
private final CsdlTerm term; private final CsdlTerm term;
private final FullQualifiedName fqn; private final FullQualifiedName fqn;
private final EdmTypeInfo typeInfo; private final EdmTypeInfo typeInfo;
@ -92,7 +89,7 @@ public class EdmTermImpl extends AbstractEdmNamed implements EdmTerm {
try { try {
appliesToLocal.add(ClassUtils.getClass(EdmTerm.class.getPackage().getName() + ".Edm" + element)); appliesToLocal.add(ClassUtils.getClass(EdmTerm.class.getPackage().getName() + ".Edm" + element));
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
LOG.error("Could not load Edm class for {}", element, e); throw new EdmException("Could not load Edm class for {} " + element, e);
} }
} }

View File

@ -26,8 +26,6 @@ import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import org.apache.olingo.commons.api.ODataException; import org.apache.olingo.commons.api.ODataException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Abstract superclass of all translatable server exceptions. * Abstract superclass of all translatable server exceptions.
@ -35,7 +33,6 @@ import org.slf4j.LoggerFactory;
public abstract class ODataLibraryException extends ODataException { public abstract class ODataLibraryException extends ODataException {
private static final long serialVersionUID = -1210541002198287561L; private static final long serialVersionUID = -1210541002198287561L;
private static final Logger LOG = LoggerFactory.getLogger(ODataLibraryException.class);
private static final Locale DEFAULT_LOCALE = Locale.ENGLISH; private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
protected static final String DEFAULT_SERVER_BUNDLE_NAME = "server-core-exceptions-i18n"; protected static final String DEFAULT_SERVER_BUNDLE_NAME = "server-core-exceptions-i18n";
@ -109,7 +106,6 @@ public abstract class ODataLibraryException extends ODataException {
try { try {
return ResourceBundle.getBundle(getBundleName(), locale == null ? DEFAULT_LOCALE : locale); return ResourceBundle.getBundle(getBundleName(), locale == null ? DEFAULT_LOCALE : locale);
} catch (final MissingResourceException e) { } catch (final MissingResourceException e) {
LOG.error(e.getMessage(), e);
return null; return null;
} }
} }

View File

@ -31,11 +31,19 @@ public interface DebugSupport {
public static final String ODATA_DEBUG_HTML = "html"; public static final String ODATA_DEBUG_HTML = "html";
public static final String ODATA_DEBUG_DOWNLOAD = "download"; public static final String ODATA_DEBUG_DOWNLOAD = "download";
//TODO:JavaDoc /**
* Initializes the debug support implementation. Is called before {@link #isUserAuthorized()} and
* {@link #createDebugResponse(String, DebugInformation)}
* @param odata
*/
void init(OData odata); void init(OData odata);
/**
* This method is called to make sure that the user that requested the debug output is authorized to see this output.
* @return true if the current user is authorized
*/
boolean isUserAuthorized(); boolean isUserAuthorized();
/** /**
* This method should create a debug response and deliver it back to the Olingo library. This method MUST NEVER throw * This method should create a debug response and deliver it back to the Olingo library. This method MUST NEVER throw
* an exception. * an exception.

View File

@ -20,7 +20,6 @@ package org.apache.olingo.server.api.processor;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.Locale;
import org.apache.olingo.commons.api.format.ContentType; import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader; import org.apache.olingo.commons.api.http.HttpHeader;

View File

@ -143,6 +143,10 @@
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId> <artifactId>slf4j-simple</artifactId>

View File

@ -29,7 +29,6 @@ import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.Link; import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmComplexType;
import org.apache.olingo.commons.api.edm.EdmEntityContainer; import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmEntitySet; import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
@ -83,59 +82,59 @@ public class ODataXmlDeserializerTest {
XMLUnit.setCompareUnmatched(false); XMLUnit.setCompareUnmatched(false);
} }
private Object edmInt16(String value) throws EdmPrimitiveTypeException { protected Object edmInt16(String value) throws EdmPrimitiveTypeException {
return EdmInt16.getInstance().valueOfString(value, true, 10, 10, 10, true, return EdmInt16.getInstance().valueOfString(value, true, 10, 10, 10, true,
EdmInt16.getInstance().getDefaultType()); EdmInt16.getInstance().getDefaultType());
} }
private Object edmInt32(String value) throws EdmPrimitiveTypeException { protected Object edmInt32(String value) throws EdmPrimitiveTypeException {
return EdmInt32.getInstance().valueOfString(value, true, 10, 10, 10, true, return EdmInt32.getInstance().valueOfString(value, true, 10, 10, 10, true,
EdmInt32.getInstance().getDefaultType()); EdmInt32.getInstance().getDefaultType());
} }
private Object edmInt64(String value) throws EdmPrimitiveTypeException { protected Object edmInt64(String value) throws EdmPrimitiveTypeException {
return EdmInt64.getInstance().valueOfString(value, true, 10, 10, 10, true, return EdmInt64.getInstance().valueOfString(value, true, 10, 10, 10, true,
EdmInt64.getInstance().getDefaultType()); EdmInt64.getInstance().getDefaultType());
} }
private Object edmSingle(String value) throws EdmPrimitiveTypeException { protected Object edmSingle(String value) throws EdmPrimitiveTypeException {
return EdmSingle.getInstance().valueOfString(value, true, 10, 10, 10, true, return EdmSingle.getInstance().valueOfString(value, true, 10, 10, 10, true,
EdmSingle.getInstance().getDefaultType()); EdmSingle.getInstance().getDefaultType());
} }
private Object edmDouble(String value) throws EdmPrimitiveTypeException { protected Object edmDouble(String value) throws EdmPrimitiveTypeException {
return EdmDouble.getInstance().valueOfString(value, true, 10, 10, 10, true, return EdmDouble.getInstance().valueOfString(value, true, 10, 10, 10, true,
EdmDouble.getInstance().getDefaultType()); EdmDouble.getInstance().getDefaultType());
} }
private Object edmSByte(String value) throws EdmPrimitiveTypeException { protected Object edmSByte(String value) throws EdmPrimitiveTypeException {
return EdmSByte.getInstance().valueOfString(value, true, 10, 10, 10, true, return EdmSByte.getInstance().valueOfString(value, true, 10, 10, 10, true,
EdmSByte.getInstance().getDefaultType()); EdmSByte.getInstance().getDefaultType());
} }
private Object edmByte(String value) throws EdmPrimitiveTypeException { protected Object edmByte(String value) throws EdmPrimitiveTypeException {
return EdmByte.getInstance().valueOfString(value, true, 10, 10, 10, true, return EdmByte.getInstance().valueOfString(value, true, 10, 10, 10, true,
EdmByte.getInstance().getDefaultType()); EdmByte.getInstance().getDefaultType());
} }
private Object edmDecimal(String value) throws EdmPrimitiveTypeException { protected Object edmDecimal(String value) throws EdmPrimitiveTypeException {
return EdmDecimal.getInstance().valueOfString(value, true, 10, 10, 10, true, return EdmDecimal.getInstance().valueOfString(value, true, 10, 10, 10, true,
EdmDecimal.getInstance().getDefaultType()); EdmDecimal.getInstance().getDefaultType());
} }
private Object edmBinary(String value) throws EdmPrimitiveTypeException { protected Object edmBinary(String value) throws EdmPrimitiveTypeException {
return EdmBinary.getInstance().valueOfString(value, true, 10, 10, 10, true, return EdmBinary.getInstance().valueOfString(value, true, 10, 10, 10, true,
EdmBinary.getInstance().getDefaultType()); EdmBinary.getInstance().getDefaultType());
} }
private Object edmDate(String value) throws EdmPrimitiveTypeException { protected Object edmDate(String value) throws EdmPrimitiveTypeException {
return EdmDate.getInstance().valueOfString(value, true, 10, 10, 10, true, return EdmDate.getInstance().valueOfString(value, true, 10, 10, 10, true,
EdmDate.getInstance().getDefaultType()); EdmDate.getInstance().getDefaultType());
} }
private Object edmDateTimeOffset(String value) throws EdmPrimitiveTypeException { protected Object edmDateTimeOffset(String value) throws EdmPrimitiveTypeException {
return EdmDateTimeOffset.getInstance().valueOfString(value, true, 10, 10, 10, true, return EdmDateTimeOffset.getInstance().valueOfString(value, true, 10, 10, 10, true,
EdmDateTimeOffset.getInstance().getDefaultType()); EdmDateTimeOffset.getInstance().getDefaultType());
} }
private Object edmDuration(String value) throws EdmPrimitiveTypeException { protected Object edmDuration(String value) throws EdmPrimitiveTypeException {
return EdmDuration.getInstance().valueOfString(value, true, 10, 10, 10, true, return EdmDuration.getInstance().valueOfString(value, true, 10, 10, 10, true,
EdmDuration.getInstance().getDefaultType()); EdmDuration.getInstance().getDefaultType());
} }
private Object edmGUID(String value) throws EdmPrimitiveTypeException { protected Object edmGUID(String value) throws EdmPrimitiveTypeException {
return EdmGuid.getInstance().valueOfString(value, true, 10, 10, 10, true, return EdmGuid.getInstance().valueOfString(value, true, 10, 10, 10, true,
EdmGuid.getInstance().getDefaultType()); EdmGuid.getInstance().getDefaultType());
} }
private Object edmTimeOfDay(String value) throws EdmPrimitiveTypeException { protected Object edmTimeOfDay(String value) throws EdmPrimitiveTypeException {
return EdmTimeOfDay.getInstance().valueOfString(value, true, 10, 10, 10, true, return EdmTimeOfDay.getInstance().valueOfString(value, true, 10, 10, 10, true,
EdmTimeOfDay.getInstance().getDefaultType()); EdmTimeOfDay.getInstance().getDefaultType());
} }
@ -344,6 +343,7 @@ public class ODataXmlDeserializerTest {
return null; return null;
} }
@SuppressWarnings("unchecked")
@Test @Test
public void entityMixPrimCollComp() throws Exception { public void entityMixPrimCollComp() throws Exception {
final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp"); final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
@ -567,6 +567,7 @@ public class ODataXmlDeserializerTest {
Assert.assertEquals("Obere Str. 57", getCVProperty(cv, "Street").asPrimitive()); Assert.assertEquals("Obere Str. 57", getCVProperty(cv, "Street").asPrimitive());
} }
@SuppressWarnings("unchecked")
@Test @Test
public void complexCollectionProperty() throws Exception { public void complexCollectionProperty() throws Exception {
final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp"); final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");

View File

@ -27,12 +27,12 @@
<packaging>war</packaging> <packaging>war</packaging>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<parent> <parent>
<groupId>org.apache.olingo</groupId> <groupId>org.apache.olingo</groupId>
<artifactId>odata-samples</artifactId> <artifactId>odata-samples</artifactId>
<version>4.0.0-SNAPSHOT</version> <version>4.0.0-SNAPSHOT</version>
<relativePath>..</relativePath> <relativePath>..</relativePath>
</parent> </parent>
<build> <build>
<plugins> <plugins>
@ -77,6 +77,10 @@
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId> <artifactId>slf4j-simple</artifactId>