aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Pitschke2012-11-09 17:06:27 (EST)
committerSteve Pitschke2012-11-09 17:06:27 (EST)
commitc8f90cf0048e06088f32abf7963428b6075df308 (patch)
treeb69755f7d701ae63f36c3d0e0fbe9c2d33fab2ba
parent1d1c913ae9b3e89d96c5691e9f9e77a6b8ae8de0 (diff)
downloadorg.eclipse.lyo.core-c8f90cf0048e06088f32abf7963428b6075df308.zip
org.eclipse.lyo.core-c8f90cf0048e06088f32abf7963428b6075df308.tar.gz
org.eclipse.lyo.core-c8f90cf0048e06088f32abf7963428b6075df308.tar.bz2
Bug 394006: Add Support for ResponseInfo and FilteredResourcerefs/changes/27/8627/1
These two new wrapper classes allow more transparent control of whether or not a collection of resources returned from HTTP GET are wrapped in an oslc:ResponseInfo element and filtering of resource properties given oslc.select and oslc.properties query params.
-rw-r--r--OSLC4J/src/org/eclipse/lyo/oslc4j/core/model/FilteredResource.java45
-rw-r--r--OSLC4J/src/org/eclipse/lyo/oslc4j/core/model/ResponseInfo.java63
-rw-r--r--OSLC4J/src/org/eclipse/lyo/oslc4j/core/model/ResponseInfoArray.java52
-rw-r--r--OSLC4J/src/org/eclipse/lyo/oslc4j/core/model/ResponseInfoCollection.java53
-rw-r--r--OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/AbstractOslcRdfXmlProvider.java69
-rw-r--r--OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/JenaUpdatedProvidersRegistry.java48
-rw-r--r--OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlArrayProvider.java3
-rw-r--r--OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlCollectionProvider.java3
-rw-r--r--OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlProvider.java108
-rw-r--r--OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcSimpleRdfXmlArrayProvider.java67
-rw-r--r--OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcSimpleRdfXmlCollectionProvider.java68
-rw-r--r--OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/AbstractOslcRdfJsonProvider.java40
-rw-r--r--OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/Json4JUpdatedProvidersRegistry.java48
-rw-r--r--OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonArrayProvider.java2
-rw-r--r--OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonCollectionProvider.java2
-rw-r--r--OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonProvider.java108
-rw-r--r--OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcSimpleRdfJsonArrayProvider.java70
-rw-r--r--OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcSimpleRdfJsonCollectionProvider.java86
18 files changed, 913 insertions, 22 deletions
diff --git a/OSLC4J/src/org/eclipse/lyo/oslc4j/core/model/FilteredResource.java b/OSLC4J/src/org/eclipse/lyo/oslc4j/core/model/FilteredResource.java
new file mode 100644
index 0000000..3bd11ab
--- /dev/null
+++ b/OSLC4J/src/org/eclipse/lyo/oslc4j/core/model/FilteredResource.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Steve Pitschke - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.lyo.oslc4j.core.model;
+
+import java.util.Map;
+
+/**
+ * Wrapper for resources to pass in properties map to filter output
+ * to a subset of the resource's properties
+ */
+public class FilteredResource<T extends Object>
+{
+ public
+ FilteredResource(
+ T resource,
+ Map<String, Object> properties
+ )
+ {
+ this.resource = resource;
+ this.properties = properties;
+ }
+
+ public T
+ resource() { return resource; }
+
+ public Map<String, Object>
+ properties() { return properties; }
+
+ private final T resource;
+ private final Map<String, Object> properties;
+}
diff --git a/OSLC4J/src/org/eclipse/lyo/oslc4j/core/model/ResponseInfo.java b/OSLC4J/src/org/eclipse/lyo/oslc4j/core/model/ResponseInfo.java
new file mode 100644
index 0000000..80a282f
--- /dev/null
+++ b/OSLC4J/src/org/eclipse/lyo/oslc4j/core/model/ResponseInfo.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Steve Pitschke - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.lyo.oslc4j.core.model;
+
+import java.net.URI;
+import java.util.Map;
+
+/**
+ * Wrapper for a collection or resources returned from an HTTP GET
+ * to wrap that collection in a oslc:ResponseInfo element
+ */
+public abstract class ResponseInfo<T extends Object>
+ extends FilteredResource<T>
+{
+ public
+ ResponseInfo(
+ T resource,
+ Map<String, Object> properties,
+ int totalCount,
+ String nextPage
+ )
+ {
+ super(resource, properties);
+
+ this.totalCount = totalCount;
+ this.nextPage = nextPage;
+ }
+
+ public
+ ResponseInfo(
+ T resource,
+ Map<String, Object> properties,
+ int totalCount,
+ URI nextPage
+ )
+ {
+ this(resource, properties, totalCount,
+ nextPage == null ? null : nextPage.toString());
+ }
+
+ public int
+ totalCount() { return totalCount; }
+
+ public String
+ nextPage() { return nextPage; }
+
+ private final int totalCount;
+ private final String nextPage;
+}
diff --git a/OSLC4J/src/org/eclipse/lyo/oslc4j/core/model/ResponseInfoArray.java b/OSLC4J/src/org/eclipse/lyo/oslc4j/core/model/ResponseInfoArray.java
new file mode 100644
index 0000000..c98cf36
--- /dev/null
+++ b/OSLC4J/src/org/eclipse/lyo/oslc4j/core/model/ResponseInfoArray.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Steve Pitschke - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.lyo.oslc4j.core.model;
+
+import java.net.URI;
+import java.util.Map;
+
+/**
+ * Concrete ResponseInfo collection wrapper where resource are sent
+ * as an array
+ */
+public class ResponseInfoArray<T extends Object> extends ResponseInfo<T[]>
+{
+ public
+ ResponseInfoArray(
+ T[] array,
+ Map<String, Object> properties,
+ int totalCount,
+ String nextPage
+ )
+ {
+ super(array, properties, totalCount, nextPage);
+ }
+
+ public
+ ResponseInfoArray(
+ T[] array,
+ Map<String, Object> properties,
+ int totalCount,
+ URI nextPage
+ )
+ {
+ super(array, properties, totalCount, nextPage);
+ }
+
+ public T[]
+ array() { return resource(); }
+}
diff --git a/OSLC4J/src/org/eclipse/lyo/oslc4j/core/model/ResponseInfoCollection.java b/OSLC4J/src/org/eclipse/lyo/oslc4j/core/model/ResponseInfoCollection.java
new file mode 100644
index 0000000..302d92d
--- /dev/null
+++ b/OSLC4J/src/org/eclipse/lyo/oslc4j/core/model/ResponseInfoCollection.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Steve Pitschke - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.lyo.oslc4j.core.model;
+
+import java.net.URI;
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * Concrete ResponseInfo collection wrapper where resource are sent
+ * as an {@link Collection}
+ */
+public class ResponseInfoCollection<T extends Object> extends ResponseInfo<Collection<T>>
+{
+ public
+ ResponseInfoCollection(
+ Collection<T> collection,
+ Map<String, Object> properties,
+ int totalCount,
+ String nextPage
+ )
+ {
+ super(collection, properties, totalCount, nextPage);
+ }
+
+ public
+ ResponseInfoCollection(
+ Collection<T> collection,
+ Map<String, Object> properties,
+ int totalCount,
+ URI nextPage
+ )
+ {
+ super(collection, properties, totalCount, nextPage);
+ }
+
+ public Collection<T>
+ collection() { return resource(); }
+}
diff --git a/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/AbstractOslcRdfXmlProvider.java b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/AbstractOslcRdfXmlProvider.java
index c077620..b24bdae 100644
--- a/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/AbstractOslcRdfXmlProvider.java
+++ b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/AbstractOslcRdfXmlProvider.java
@@ -54,9 +54,9 @@ public abstract class AbstractOslcRdfXmlProvider
private static final Class<Error> CLASS_OSLC_ERROR = Error.class;
private static final ErrorHandler ERROR_HANDLER = new ErrorHandler();
- private @Context HttpHeaders httpHeaders; // Available only on the server
- private @Context HttpServletRequest httpServletRequest; // Available only on the server
- private @Context Providers providers; // Available on both client and server
+ private @Context HttpHeaders httpHeaders; // Available only on the server
+ protected @Context HttpServletRequest httpServletRequest; // Available only on the server
+ private @Context Providers providers; // Available on both client and server
protected AbstractOslcRdfXmlProvider()
{
@@ -113,6 +113,67 @@ public abstract class AbstractOslcRdfXmlProvider
return false;
}
+ protected void writeTo(final Object[] objects,
+ final MediaType baseMediaType,
+ final MultivaluedMap<String, Object> map,
+ final OutputStream outputStream,
+ final Map<String, Object> properties,
+ final String descriptionURI,
+ final String responseInfoURI,
+ final String nextPageURI,
+ final Integer totalCount)
+ throws WebApplicationException
+ {
+ // Determine whether to serialize in xml or abreviated xml based upon mediatype.
+ // application/rdf+xml yields xml
+ // applicaton/xml yields abbreviated xml
+ final String serializationLanguage;
+ if (OslcMediaType.APPLICATION_RDF_XML_TYPE.isCompatible(baseMediaType))
+ {
+ serializationLanguage = FileUtils.langXML;
+ }
+ else
+ {
+ serializationLanguage = FileUtils.langXMLAbbrev;
+ }
+
+ try
+ {
+ final Model model = JenaModelHelper.createJenaModel(descriptionURI,
+ responseInfoURI,
+ nextPageURI,
+ totalCount,
+ objects,
+ properties);
+ RDFWriter writer = null;
+ if (serializationLanguage.equals(FileUtils.langXMLAbbrev))
+ {
+ writer = new RdfXmlAbbreviatedWriter();
+ }
+ else
+ {
+ writer = model.getWriter(serializationLanguage);
+ }
+ writer.setProperty("showXmlDeclaration",
+ "false");
+ writer.setErrorHandler(ERROR_HANDLER);
+
+ String xmlDeclaration = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
+ outputStream.write(xmlDeclaration.getBytes());
+
+ writer.write(model,
+ outputStream,
+ null);
+ }
+ catch (final Exception exception)
+ {
+ throw new WebApplicationException(exception,
+ buildBadRequestResponse(exception,
+ baseMediaType,
+ map));
+ }
+ }
+
protected void writeTo(final boolean queryResult,
final Object[] objects,
final MediaType baseMediaType,
@@ -370,7 +431,7 @@ public abstract class AbstractOslcRdfXmlProvider
mediaType) != null);
}
- private static boolean isOslcQuery(final String parmString)
+ protected static boolean isOslcQuery(final String parmString)
{
boolean containsOslcParm = false;
diff --git a/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/JenaUpdatedProvidersRegistry.java b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/JenaUpdatedProvidersRegistry.java
new file mode 100644
index 0000000..8a00cf2
--- /dev/null
+++ b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/JenaUpdatedProvidersRegistry.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.oslc4j.provider.jena;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public final class JenaUpdatedProvidersRegistry
+{
+ private static final Set<Class<?>> PROVIDERS = new HashSet<Class<?>>();
+
+ static
+ {
+ PROVIDERS.add(OslcCompactRdfProvider.class);
+ PROVIDERS.add(OslcSimpleRdfXmlArrayProvider.class);
+ PROVIDERS.add(OslcSimpleRdfXmlCollectionProvider.class);
+ PROVIDERS.add(OslcRdfXmlProvider.class);
+ }
+
+ private JenaUpdatedProvidersRegistry()
+ {
+ super();
+ }
+
+ /**
+ * Returns a mutable set of provider classes. Each request returns a new Set.
+ */
+ public static final Set<Class<?>> getProviders()
+ {
+ return new HashSet<Class<?>>(PROVIDERS);
+ }
+}
diff --git a/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlArrayProvider.java b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlArrayProvider.java
index 5524913..5c9f4fc 100644
--- a/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlArrayProvider.java
+++ b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlArrayProvider.java
@@ -22,7 +22,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
-import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import javax.ws.rs.Consumes;
@@ -40,7 +39,7 @@ import org.eclipse.lyo.oslc4j.core.model.OslcMediaType;
@Provider
@Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.TEXT_XML})
@Consumes({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.TEXT_XML})
-public final class OslcRdfXmlArrayProvider
+public class OslcRdfXmlArrayProvider
extends AbstractOslcRdfXmlProvider
implements MessageBodyReader<Object[]>,
MessageBodyWriter<Object[]>
diff --git a/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlCollectionProvider.java b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlCollectionProvider.java
index 409adca..680ad4c 100644
--- a/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlCollectionProvider.java
+++ b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlCollectionProvider.java
@@ -50,13 +50,12 @@ import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
import org.eclipse.lyo.oslc4j.core.annotation.OslcNotQueryResult;
-import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape;
import org.eclipse.lyo.oslc4j.core.model.OslcMediaType;
@Provider
@Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.TEXT_XML})
@Consumes({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.TEXT_XML})
-public final class OslcRdfXmlCollectionProvider
+public class OslcRdfXmlCollectionProvider
extends AbstractOslcRdfXmlProvider
implements MessageBodyReader<Collection<Object>>,
MessageBodyWriter<Collection<Object>>
diff --git a/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlProvider.java b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlProvider.java
index 6c36380..b37d976 100644
--- a/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlProvider.java
+++ b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcRdfXmlProvider.java
@@ -15,6 +15,8 @@
* Alberto Giammaria - initial API and implementation
* Chris Peters - initial API and implementation
* Gianluca Bernardini - initial API and implementation
+ * Steve Pitschke - Add support for FilteredResource and
+ * ResponseInfo
*******************************************************************************/
package org.eclipse.lyo.oslc4j.provider.jena;
@@ -22,7 +24,10 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.Map;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
@@ -33,7 +38,12 @@ import javax.ws.rs.ext.MessageBodyReader;
import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
+import org.eclipse.lyo.oslc4j.core.OSLC4JUtils;
+import org.eclipse.lyo.oslc4j.core.model.FilteredResource;
import org.eclipse.lyo.oslc4j.core.model.OslcMediaType;
+import org.eclipse.lyo.oslc4j.core.model.ResponseInfo;
+import org.eclipse.lyo.oslc4j.core.model.ResponseInfoArray;
+import org.eclipse.lyo.oslc4j.core.model.ResponseInfoCollection;
@Provider
@Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.TEXT_XML})
@@ -64,7 +74,28 @@ public final class OslcRdfXmlProvider
final Annotation[] annotations,
final MediaType mediaType)
{
- return isWriteable(type,
+ Class<?> actualType;
+
+ if (FilteredResource.class.isAssignableFrom(type) &&
+ (genericType instanceof ParameterizedType))
+ {
+ ParameterizedType parameterizedType = (ParameterizedType)genericType;
+ Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
+
+ if (actualTypeArguments.length != 1 ||
+ ! (actualTypeArguments[0] instanceof Class<?>))
+ {
+ return false;
+ }
+
+ actualType = (Class<?>)actualTypeArguments[0];
+ }
+ else
+ {
+ actualType = type;
+ }
+
+ return isWriteable(actualType,
annotations,
mediaType,
OslcMediaType.APPLICATION_RDF_XML_TYPE,
@@ -83,11 +114,80 @@ public final class OslcRdfXmlProvider
throws IOException,
WebApplicationException
{
- writeTo(false,
- new Object[] {object},
+ Object[] objects;
+ Map<String, Object> properties = null;
+ String descriptionURI = null;
+ String responseInfoURI = null;
+ String nextPageURI = null;
+ Integer totalCount = null;
+
+ if (object instanceof FilteredResource<?>)
+ {
+ final FilteredResource<?> filteredResource =
+ (FilteredResource<?>)object;
+
+ properties = filteredResource.properties();
+
+ if (filteredResource instanceof ResponseInfo<?>)
+ {
+ descriptionURI = OSLC4JUtils.resolveURI(httpServletRequest, true);
+ responseInfoURI = descriptionURI;
+
+ final String queryString = httpServletRequest.getQueryString();
+
+ if ((queryString != null) &&
+ (isOslcQuery(queryString)))
+ {
+ responseInfoURI += "?" + queryString;
+ }
+
+ if (filteredResource instanceof ResponseInfoArray<?>)
+ {
+ objects = ((ResponseInfoArray<?>)filteredResource).array();
+ }
+ else
+ {
+ Collection<?> collection =
+ ((ResponseInfoCollection<?>)filteredResource).collection();
+
+ objects = collection.toArray(new Object[collection.size()]);
+ }
+
+ nextPageURI = ((ResponseInfo<?>)filteredResource).nextPage();
+ totalCount = ((ResponseInfo<?>)filteredResource).totalCount();
+ }
+ else
+ {
+ Object nestedObject = filteredResource.resource();
+
+ if (nestedObject instanceof Object[])
+ {
+ objects = (Object[])nestedObject;
+ }
+ else if (nestedObject instanceof Collection<?>)
+ {
+ objects = ((Collection<?>)nestedObject).toArray();
+ }
+ else
+ {
+ objects = new Object[] { object };
+ }
+ }
+ }
+ else
+ {
+ objects = new Object[] { object };
+ }
+
+ writeTo(objects,
mediaType,
map,
- outputStream);
+ outputStream,
+ properties,
+ descriptionURI,
+ responseInfoURI,
+ nextPageURI,
+ totalCount);
}
@Override
diff --git a/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcSimpleRdfXmlArrayProvider.java b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcSimpleRdfXmlArrayProvider.java
new file mode 100644
index 0000000..05a3ed0
--- /dev/null
+++ b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcSimpleRdfXmlArrayProvider.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.oslc4j.provider.jena;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.Provider;
+
+import org.eclipse.lyo.oslc4j.core.model.OslcMediaType;
+
+@Provider
+@Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.TEXT_XML})
+@Consumes({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.TEXT_XML})
+public final class OslcSimpleRdfXmlArrayProvider
+ extends OslcRdfXmlArrayProvider
+{
+ public OslcSimpleRdfXmlArrayProvider()
+ {
+ super();
+ }
+
+ @Override
+ public void writeTo(final Object[] objects,
+ final Class<?> type,
+ final Type genericType,
+ final Annotation[] annotations,
+ final MediaType mediaType,
+ final MultivaluedMap<String, Object> map,
+ final OutputStream outputStream)
+ throws IOException,
+ WebApplicationException
+ {
+ writeTo(objects,
+ mediaType,
+ map,
+ outputStream,
+ null,
+ null,
+ null,
+ null,
+ null);
+ }
+} \ No newline at end of file
diff --git a/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcSimpleRdfXmlCollectionProvider.java b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcSimpleRdfXmlCollectionProvider.java
new file mode 100644
index 0000000..0839f3c
--- /dev/null
+++ b/OSLC4JJenaProvider/src/org/eclipse/lyo/oslc4j/provider/jena/OslcSimpleRdfXmlCollectionProvider.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.oslc4j.provider.jena;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collection;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.Provider;
+
+import org.eclipse.lyo.oslc4j.core.model.OslcMediaType;
+
+@Provider
+@Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.TEXT_XML})
+@Consumes({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.TEXT_XML})
+public class OslcSimpleRdfXmlCollectionProvider
+ extends OslcRdfXmlCollectionProvider
+{
+ public OslcSimpleRdfXmlCollectionProvider()
+ {
+ super();
+ }
+
+ @Override
+ public void writeTo(final Collection<Object> collection,
+ final Class<?> type,
+ final Type genericType,
+ final Annotation[] annotations,
+ final MediaType mediaType,
+ final MultivaluedMap<String, Object> map,
+ final OutputStream outputStream)
+ throws IOException,
+ WebApplicationException
+ {
+ writeTo(collection.toArray(new Object[collection.size()]),
+ mediaType,
+ map,
+ outputStream,
+ null,
+ null,
+ null,
+ null,
+ null);
+ }
+} \ No newline at end of file
diff --git a/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/AbstractOslcRdfJsonProvider.java b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/AbstractOslcRdfJsonProvider.java
index 57f7e77..b0d4f5b 100644
--- a/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/AbstractOslcRdfJsonProvider.java
+++ b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/AbstractOslcRdfJsonProvider.java
@@ -46,9 +46,9 @@ public abstract class AbstractOslcRdfJsonProvider
private static final Annotation[] ANNOTATIONS_EMPTY_ARRAY = new Annotation[0];
private static final Class<Error> CLASS_OSLC_ERROR = Error.class;
- private @Context HttpHeaders httpHeaders; // Available only on the server
- private @Context HttpServletRequest httpServletRequest; // Available only on the server
- private @Context Providers providers; // Available on both client and server
+ private @Context HttpHeaders httpHeaders; // Available only on the server
+ protected @Context HttpServletRequest httpServletRequest; // Available only on the server
+ private @Context Providers providers; // Available on both client and server
protected AbstractOslcRdfJsonProvider()
{
@@ -160,6 +160,38 @@ public abstract class AbstractOslcRdfJsonProvider
}
}
+ protected void writeTo(final Object[] objects,
+ final MediaType errorMediaType,
+ final MultivaluedMap<String, Object> map,
+ final OutputStream outputStream,
+ final Map<String, Object> properties,
+ final String descriptionURI,
+ final String responseInfoURI,
+ final String nextPageURI,
+ final Integer totalCount)
+ throws WebApplicationException
+ {
+ final JSONObject jsonObject;
+
+ try
+ {
+ jsonObject = JsonHelper.createJSON(descriptionURI,
+ responseInfoURI,
+ nextPageURI,
+ objects,
+ properties);
+
+ jsonObject.write(outputStream, true);
+ }
+ catch (final Exception exception)
+ {
+ throw new WebApplicationException(exception,
+ buildBadRequestResponse(exception,
+ errorMediaType,
+ map));
+ }
+ }
+
protected static boolean isReadable(final Class<?> type,
final MediaType requiredMediaType,
final MediaType actualMediaType)
@@ -296,7 +328,7 @@ public abstract class AbstractOslcRdfJsonProvider
ANNOTATIONS_EMPTY_ARRAY,
mediaType) != null);
}
- private static boolean isOslcQuery(final String parmString)
+ protected static boolean isOslcQuery(final String parmString)
{
boolean containsOslcParm = false;
diff --git a/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/Json4JUpdatedProvidersRegistry.java b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/Json4JUpdatedProvidersRegistry.java
new file mode 100644
index 0000000..5fdbb98
--- /dev/null
+++ b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/Json4JUpdatedProvidersRegistry.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.oslc4j.provider.json4j;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public final class Json4JUpdatedProvidersRegistry
+{
+ private static final Set<Class<?>> PROVIDERS = new HashSet<Class<?>>();
+
+ static
+ {
+ PROVIDERS.add(OslcCompactJsonProvider.class);
+ PROVIDERS.add(OslcSimpleRdfJsonArrayProvider.class);
+ PROVIDERS.add(OslcSimpleRdfJsonCollectionProvider.class);
+ PROVIDERS.add(OslcRdfJsonProvider.class);
+ }
+
+ private Json4JUpdatedProvidersRegistry()
+ {
+ super();
+ }
+
+ /**
+ * Returns a mutable set of provider classes. Each request returns a new Set.
+ */
+ public static final Set<Class<?>> getProviders()
+ {
+ return new HashSet<Class<?>>(PROVIDERS);
+ }
+}
diff --git a/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonArrayProvider.java b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonArrayProvider.java
index 1b167e1..5e8139a 100644
--- a/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonArrayProvider.java
+++ b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonArrayProvider.java
@@ -38,7 +38,7 @@ import org.eclipse.lyo.oslc4j.core.model.OslcMediaType;
@Provider
@Produces(OslcMediaType.APPLICATION_JSON)
@Consumes(OslcMediaType.APPLICATION_JSON)
-public final class OslcRdfJsonArrayProvider
+public class OslcRdfJsonArrayProvider
extends AbstractOslcRdfJsonProvider
implements MessageBodyReader<Object[]>,
MessageBodyWriter<Object[]>
diff --git a/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonCollectionProvider.java b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonCollectionProvider.java
index 50887b5..9e1ed38 100644
--- a/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonCollectionProvider.java
+++ b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonCollectionProvider.java
@@ -54,7 +54,7 @@ import org.eclipse.lyo.oslc4j.core.model.OslcMediaType;
@Provider
@Produces(OslcMediaType.APPLICATION_JSON)
@Consumes(OslcMediaType.APPLICATION_JSON)
-public final class OslcRdfJsonCollectionProvider
+public class OslcRdfJsonCollectionProvider
extends AbstractOslcRdfJsonProvider
implements MessageBodyReader<Collection<Object>>,
MessageBodyWriter<Collection<Object>>
diff --git a/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonProvider.java b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonProvider.java
index ec48da2..d351051 100644
--- a/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonProvider.java
+++ b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcRdfJsonProvider.java
@@ -15,6 +15,8 @@
* Alberto Giammaria - initial API and implementation
* Chris Peters - initial API and implementation
* Gianluca Bernardini - initial API and implementation
+ * Steve Pitschke - Add support for FilteredResource and
+ * ResponseInfo
*******************************************************************************/
package org.eclipse.lyo.oslc4j.provider.json4j;
@@ -22,7 +24,10 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.Map;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
@@ -33,7 +38,12 @@ import javax.ws.rs.ext.MessageBodyReader;
import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
+import org.eclipse.lyo.oslc4j.core.OSLC4JUtils;
+import org.eclipse.lyo.oslc4j.core.model.FilteredResource;
import org.eclipse.lyo.oslc4j.core.model.OslcMediaType;
+import org.eclipse.lyo.oslc4j.core.model.ResponseInfo;
+import org.eclipse.lyo.oslc4j.core.model.ResponseInfoArray;
+import org.eclipse.lyo.oslc4j.core.model.ResponseInfoCollection;
@Provider
@Produces(OslcMediaType.APPLICATION_JSON)
@@ -64,7 +74,28 @@ public final class OslcRdfJsonProvider
final Annotation[] annotations,
final MediaType mediaType)
{
- return isWriteable(type,
+ Class<?> actualType;
+
+ if (FilteredResource.class.isAssignableFrom(type) &&
+ (genericType instanceof ParameterizedType))
+ {
+ ParameterizedType parameterizedType = (ParameterizedType)genericType;
+ Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
+
+ if (actualTypeArguments.length != 1 ||
+ ! (actualTypeArguments[0] instanceof Class<?>))
+ {
+ return false;
+ }
+
+ actualType = (Class<?>)actualTypeArguments[0];
+ }
+ else
+ {
+ actualType = type;
+ }
+
+ return isWriteable(actualType,
annotations,
OslcMediaType.APPLICATION_JSON_TYPE,
mediaType);
@@ -81,11 +112,80 @@ public final class OslcRdfJsonProvider
throws IOException,
WebApplicationException
{
- writeTo(false,
- new Object[] {object},
+ Object[] objects;
+ Map<String, Object> properties = null;
+ String descriptionURI = null;
+ String responseInfoURI = null;
+ String nextPageURI = null;
+ Integer totalCount = null;
+
+ if (object instanceof FilteredResource<?>)
+ {
+ final FilteredResource<?> filteredResource =
+ (FilteredResource<?>)object;
+
+ properties = filteredResource.properties();
+
+ if (filteredResource instanceof ResponseInfo<?>)
+ {
+ descriptionURI = OSLC4JUtils.resolveURI(httpServletRequest, true);
+ responseInfoURI = descriptionURI;
+
+ final String queryString = httpServletRequest.getQueryString();
+
+ if ((queryString != null) &&
+ (isOslcQuery(queryString)))
+ {
+ responseInfoURI += "?" + queryString;
+ }
+
+ if (filteredResource instanceof ResponseInfoArray<?>)
+ {
+ objects = ((ResponseInfoArray<?>)filteredResource).array();
+ }
+ else
+ {
+ Collection<?> collection =
+ ((ResponseInfoCollection<?>)filteredResource).collection();
+
+ objects = collection.toArray(new Object[collection.size()]);
+ }
+
+ nextPageURI = ((ResponseInfo<?>)filteredResource).nextPage();
+ totalCount = ((ResponseInfo<?>)filteredResource).totalCount();
+ }
+ else
+ {
+ Object nestedObject = filteredResource.resource();
+
+ if (nestedObject instanceof Object[])
+ {
+ objects = (Object[])nestedObject;
+ }
+ else if (nestedObject instanceof Collection<?>)
+ {
+ objects = ((Collection<?>)nestedObject).toArray();
+ }
+ else
+ {
+ objects = new Object[] { object };
+ }
+ }
+ }
+ else
+ {
+ objects = new Object[] { object };
+ }
+
+ writeTo(objects,
mediaType,
map,
- outputStream);
+ outputStream,
+ properties,
+ descriptionURI,
+ responseInfoURI,
+ nextPageURI,
+ totalCount);
}
@Override
diff --git a/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcSimpleRdfJsonArrayProvider.java b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcSimpleRdfJsonArrayProvider.java
new file mode 100644
index 0000000..fddc457
--- /dev/null
+++ b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcSimpleRdfJsonArrayProvider.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.oslc4j.provider.json4j;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+
+import org.eclipse.lyo.oslc4j.core.model.OslcMediaType;
+
+@Provider
+@Produces(OslcMediaType.APPLICATION_JSON)
+@Consumes(OslcMediaType.APPLICATION_JSON)
+public final class OslcSimpleRdfJsonArrayProvider
+ extends OslcRdfJsonArrayProvider
+{
+ public OslcSimpleRdfJsonArrayProvider()
+ {
+ super();
+ }
+
+ @Override
+ public void writeTo(final Object[] objects,
+ final Class<?> type,
+ final Type genericType,
+ final Annotation[] annotations,
+ final MediaType mediaType,
+ final MultivaluedMap<String, Object> map,
+ final OutputStream outputStream)
+ throws IOException,
+ WebApplicationException
+ {
+ writeTo(objects,
+ mediaType,
+ map,
+ outputStream,
+ null,
+ null,
+ null,
+ null,
+ null);
+ }
+} \ No newline at end of file
diff --git a/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcSimpleRdfJsonCollectionProvider.java b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcSimpleRdfJsonCollectionProvider.java
new file mode 100644
index 0000000..21cafde
--- /dev/null
+++ b/OSLC4JJson4JProvider/src/org/eclipse/lyo/oslc4j/provider/json4j/OslcSimpleRdfJsonCollectionProvider.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.oslc4j.provider.json4j;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.AbstractCollection;
+import java.util.AbstractList;
+import java.util.AbstractSequentialList;
+import java.util.AbstractSet;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Deque;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.NavigableSet;
+import java.util.Queue;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+
+import org.eclipse.lyo.oslc4j.core.model.OslcMediaType;
+
+@Provider
+@Produces(OslcMediaType.APPLICATION_JSON)
+@Consumes(OslcMediaType.APPLICATION_JSON)
+public final class OslcSimpleRdfJsonCollectionProvider
+ extends OslcRdfJsonCollectionProvider
+{
+ public OslcSimpleRdfJsonCollectionProvider()
+ {
+ super();
+ }
+
+ @Override
+ public void writeTo(final Collection<Object> collection,
+ final Class<?> type,
+ final Type genericType,
+ final Annotation[] annotations,
+ final MediaType mediaType,
+ final MultivaluedMap<String, Object> map,
+ final OutputStream outputStream)
+ throws IOException,
+ WebApplicationException
+ {
+ writeTo(collection.toArray(new Object[collection.size()]),
+ mediaType,
+ map,
+ outputStream,
+ null,
+ null,
+ null,
+ null,
+ null);
+ }
+} \ No newline at end of file