Repository: olingo-odata4 Updated Branches: refs/heads/master cc518254f -> 9ae26a709
[OLINGO-266] Entity and EntitySet dispatching Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/dd1e5b0d Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/dd1e5b0d Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/dd1e5b0d Branch: refs/heads/master Commit: dd1e5b0d9e3b29916da1dcb89b2ed26e5a3633b6 Parents: 85fb12a Author: Christian Amend <[email protected]> Authored: Tue Jun 3 14:27:21 2014 +0200 Committer: Christian Amend <[email protected]> Committed: Tue Jun 3 14:30:03 2014 +0200 ---------------------------------------------------------------------- .../server/api/processor/EntityProcessor.java | 28 +++ .../api/processor/EntitySetProcessor.java | 29 +++ .../apache/olingo/server/core/ODataHandler.java | 64 ++++++- .../server/tecsvc/TechnicalProcessor.java | 39 ---- .../olingo/server/tecsvc/TechnicalServlet.java | 11 +- .../olingo/server/tecsvc/data/DataProvider.java | 28 +++ .../server/tecsvc/data/model/EtAllPrim.java | 188 +++++++++++++++++++ .../server/tecsvc/data/model/EtTwoPrim.java | 62 ++++++ .../tecsvc/processor/TechnicalProcessor.java | 59 ++++++ 9 files changed, 466 insertions(+), 42 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dd1e5b0d/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityProcessor.java new file mode 100644 index 0000000..b0b9476 --- /dev/null +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityProcessor.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.olingo.server.api.processor; + +import org.apache.olingo.server.api.ODataRequest; +import org.apache.olingo.server.api.ODataResponse; +import org.apache.olingo.server.api.uri.UriInfo; + +public interface EntityProcessor extends Processor { + + void readEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, String format); +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dd1e5b0d/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntitySetProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntitySetProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntitySetProcessor.java new file mode 100644 index 0000000..73f7aeb --- /dev/null +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntitySetProcessor.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.olingo.server.api.processor; + +import org.apache.olingo.server.api.ODataRequest; +import org.apache.olingo.server.api.ODataResponse; +import org.apache.olingo.server.api.uri.UriInfo; + +public interface EntitySetProcessor extends Processor { + + void readEntitySet(ODataRequest request, ODataResponse response, UriInfo uriInfo, String format); + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dd1e5b0d/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java index bafb5bc..45e8354 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java @@ -24,14 +24,20 @@ import java.util.Map; import org.apache.olingo.commons.api.ODataRuntimeException; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.http.HttpContentType; +import org.apache.olingo.commons.api.http.HttpMethod; import org.apache.olingo.server.api.OData; import org.apache.olingo.server.api.ODataRequest; import org.apache.olingo.server.api.ODataResponse; import org.apache.olingo.server.api.processor.DefaultProcessor; +import org.apache.olingo.server.api.processor.EntityProcessor; +import org.apache.olingo.server.api.processor.EntitySetProcessor; import org.apache.olingo.server.api.processor.MetadataProcessor; import org.apache.olingo.server.api.processor.Processor; import org.apache.olingo.server.api.processor.ServiceDocumentProcessor; import org.apache.olingo.server.api.uri.UriInfo; +import org.apache.olingo.server.api.uri.UriResource; +import org.apache.olingo.server.api.uri.UriResourceNavigation; +import org.apache.olingo.server.api.uri.UriResourcePartTyped; import org.apache.olingo.server.core.uri.parser.Parser; import org.apache.olingo.server.core.uri.validator.UriValidator; @@ -61,6 +67,8 @@ public class ODataHandler { UriValidator validator = new UriValidator(); validator.validate(uriInfo, request.getMethod()); + String requestedContentType = doContentNegotiation(); + switch (uriInfo.getKind()) { case metadata: MetadataProcessor mp = selectProcessor(MetadataProcessor.class); @@ -70,11 +78,14 @@ public class ODataHandler { if ("".equals(request.getRawODataPath())) { RedirectProcessor rdp = selectProcessor(RedirectProcessor.class); rdp.redirect(request, response); - }else{ + } else { ServiceDocumentProcessor sdp = selectProcessor(ServiceDocumentProcessor.class); - sdp.readServiceDocument(request, response, uriInfo, HttpContentType.APPLICATION_JSON); + sdp.readServiceDocument(request, response, uriInfo, requestedContentType); } break; + case resource: + handleResourceDispatching(request, response, uriInfo, requestedContentType); + break; default: throw new ODataRuntimeException("not implemented"); } @@ -86,6 +97,55 @@ public class ODataHandler { } } + private String doContentNegotiation() { + // TODO: Content Negotiation + return HttpContentType.APPLICATION_JSON; + } + + private void handleResourceDispatching(final ODataRequest request, ODataResponse response, UriInfo uriInfo, + String requestedContentType) { + int lastPathSegmentIndex = uriInfo.getUriResourceParts().size() - 1; + UriResource lastPathSegment = uriInfo.getUriResourceParts().get(lastPathSegmentIndex); + switch (lastPathSegment.getKind()) { + case entitySet: + if (((UriResourcePartTyped) lastPathSegment).isCollection()) { + if (request.getMethod().equals(HttpMethod.GET)) { + EntitySetProcessor esp = selectProcessor(EntitySetProcessor.class); + esp.readEntitySet(request, response, uriInfo, requestedContentType); + } else { + throw new ODataRuntimeException("not implemented"); + } + } else { + if (request.getMethod().equals(HttpMethod.GET)) { + EntityProcessor ep = selectProcessor(EntityProcessor.class); + ep.readEntity(request, response, uriInfo, requestedContentType); + } else { + throw new ODataRuntimeException("not implemented"); + } + } + break; + case navigationProperty: + if (((UriResourceNavigation) lastPathSegment).isCollection()) { + if (request.getMethod().equals(HttpMethod.GET)) { + EntitySetProcessor esp = selectProcessor(EntitySetProcessor.class); + esp.readEntitySet(request, response, uriInfo, requestedContentType); + } else { + throw new ODataRuntimeException("not implemented"); + } + } else { + if (request.getMethod().equals(HttpMethod.GET)) { + EntityProcessor ep = selectProcessor(EntityProcessor.class); + ep.readEntity(request, response, uriInfo, requestedContentType); + } else { + throw new ODataRuntimeException("not implemented"); + } + } + break; + default: + throw new ODataRuntimeException("not implemented"); + } + } + private <T extends Processor> T selectProcessor(Class<T> cls) { @SuppressWarnings("unchecked") T p = (T) processors.get(cls); http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dd1e5b0d/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalProcessor.java deleted file mode 100644 index ae0d34f..0000000 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalProcessor.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.server.tecsvc; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.server.api.OData; -import org.apache.olingo.server.api.processor.Processor; - -public class TechnicalProcessor implements Processor { - -// private OData odata; -// private Edm edm; - - - @Override - public void init(OData odata, Edm edm) { -// this.odata = odata; -// this.edm = edm; - } - - - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dd1e5b0d/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java ---------------------------------------------------------------------- diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java index 1daf164..ec8a061 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java @@ -28,6 +28,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.server.api.ODataHttpHandler; import org.apache.olingo.server.api.OData; +import org.apache.olingo.server.tecsvc.data.DataProvider; +import org.apache.olingo.server.tecsvc.processor.TechnicalProcessor; import org.apache.olingo.server.tecsvc.provider.EdmTechProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,17 +39,24 @@ public class TechnicalServlet extends HttpServlet { private static final long serialVersionUID = 1L; private static final Logger LOG = LoggerFactory.getLogger(TechnicalServlet.class); + private DataProvider dataProvider; @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { LOG.debug("ReferenceServlet:service() called"); + if(dataProvider == null){ + dataProvider = new DataProvider(); + } + + dataProvider.reset(); + OData odata = OData.newInstance(); Edm edm = odata.createEdm(new EdmTechProvider()); ODataHttpHandler handler = odata.createHandler(edm); - handler.register(new TechnicalProcessor()); + handler.register(new TechnicalProcessor(dataProvider)); handler.process(req, resp); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dd1e5b0d/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java ---------------------------------------------------------------------- diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java new file mode 100644 index 0000000..2281ac7 --- /dev/null +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.olingo.server.tecsvc.data; + +public class DataProvider { + + public void reset() { + // TODO Auto-generated method stub + + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dd1e5b0d/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/model/EtAllPrim.java ---------------------------------------------------------------------- diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/model/EtAllPrim.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/model/EtAllPrim.java new file mode 100644 index 0000000..51fef55 --- /dev/null +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/model/EtAllPrim.java @@ -0,0 +1,188 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.olingo.server.tecsvc.data.model; + +import java.util.List; + +public class EtAllPrim { + private int PropertyInt16; + private String PropertyString; + private boolean PropertyBoolean; + private byte PropertyByte; + private byte PropertySByte; + private int PropertyInt32; + private int PropertyInt64; + private long PropertySingle; + private double PropertyDouble; + private double PropertyDecimal; + private byte[] PropertyBinary; + // TODO:Define ---------- + private String PropertyDate; + private String PropertyDateTimeOffset; + private String PropertyDuration; + private String PropertyGuid; + private String PropertyTimeOfDay; + // ----------- ---------- + private EtTwoPrim NavPropertyETTwoPrimOne; + private List<EtTwoPrim> NavPropertyETTwoPrimMany; + + public int getPropertyInt16() { + return PropertyInt16; + } + + public void setPropertyInt16(int propertyInt16) { + PropertyInt16 = propertyInt16; + } + + public String getPropertyString() { + return PropertyString; + } + + public void setPropertyString(String propertyString) { + PropertyString = propertyString; + } + + public boolean isPropertyBoolean() { + return PropertyBoolean; + } + + public void setPropertyBoolean(boolean propertyBoolean) { + PropertyBoolean = propertyBoolean; + } + + public byte getPropertyByte() { + return PropertyByte; + } + + public void setPropertyByte(byte propertyByte) { + PropertyByte = propertyByte; + } + + public byte getPropertySByte() { + return PropertySByte; + } + + public void setPropertySByte(byte propertySByte) { + PropertySByte = propertySByte; + } + + public int getPropertyInt32() { + return PropertyInt32; + } + + public void setPropertyInt32(int propertyInt32) { + PropertyInt32 = propertyInt32; + } + + public int getPropertyInt64() { + return PropertyInt64; + } + + public void setPropertyInt64(int propertyInt64) { + PropertyInt64 = propertyInt64; + } + + public long getPropertySingle() { + return PropertySingle; + } + + public void setPropertySingle(long propertySingle) { + PropertySingle = propertySingle; + } + + public double getPropertyDouble() { + return PropertyDouble; + } + + public void setPropertyDouble(double propertyDouble) { + PropertyDouble = propertyDouble; + } + + public double getPropertyDecimal() { + return PropertyDecimal; + } + + public void setPropertyDecimal(double propertyDecimal) { + PropertyDecimal = propertyDecimal; + } + + public byte[] getPropertyBinary() { + return PropertyBinary; + } + + public void setPropertyBinary(byte[] propertyBinary) { + PropertyBinary = propertyBinary; + } + + public String getPropertyDate() { + return PropertyDate; + } + + public void setPropertyDate(String propertyDate) { + PropertyDate = propertyDate; + } + + public String getPropertyDateTimeOffset() { + return PropertyDateTimeOffset; + } + + public void setPropertyDateTimeOffset(String propertyDateTimeOffset) { + PropertyDateTimeOffset = propertyDateTimeOffset; + } + + public String getPropertyDuration() { + return PropertyDuration; + } + + public void setPropertyDuration(String propertyDuration) { + PropertyDuration = propertyDuration; + } + + public String getPropertyGuid() { + return PropertyGuid; + } + + public void setPropertyGuid(String propertyGuid) { + PropertyGuid = propertyGuid; + } + + public String getPropertyTimeOfDay() { + return PropertyTimeOfDay; + } + + public void setPropertyTimeOfDay(String propertyTimeOfDay) { + PropertyTimeOfDay = propertyTimeOfDay; + } + + public EtTwoPrim getNavPropertyETTwoPrimOne() { + return NavPropertyETTwoPrimOne; + } + + public void setNavPropertyETTwoPrimOne(EtTwoPrim navPropertyETTwoPrimOne) { + NavPropertyETTwoPrimOne = navPropertyETTwoPrimOne; + } + + public List<EtTwoPrim> getNavPropertyETTwoPrimMany() { + return NavPropertyETTwoPrimMany; + } + + public void setNavPropertyETTwoPrimMany(List<EtTwoPrim> navPropertyETTwoPrimMany) { + NavPropertyETTwoPrimMany = navPropertyETTwoPrimMany; + } +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dd1e5b0d/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/model/EtTwoPrim.java ---------------------------------------------------------------------- diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/model/EtTwoPrim.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/model/EtTwoPrim.java new file mode 100644 index 0000000..a2bbcd1 --- /dev/null +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/model/EtTwoPrim.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.olingo.server.tecsvc.data.model; + +import java.util.List; + +public class EtTwoPrim { + private int PropertyInt16; + private String PropertyString; + + private EtAllPrim NavPropertyETAllPrimOne; + private List<EtAllPrim> NavPropertyETAllPrimMany; + + public int getPropertyInt16() { + return PropertyInt16; + } + + public void setPropertyInt16(int propertyInt16) { + PropertyInt16 = propertyInt16; + } + + public String getPropertyString() { + return PropertyString; + } + + public void setPropertyString(String propertyString) { + PropertyString = propertyString; + } + + public EtAllPrim getNavPropertyETAllPrimOne() { + return NavPropertyETAllPrimOne; + } + + public void setNavPropertyETAllPrimOne(EtAllPrim navPropertyETAllPrimOne) { + NavPropertyETAllPrimOne = navPropertyETAllPrimOne; + } + + public List<EtAllPrim> getNavPropertyETAllPrimMany() { + return NavPropertyETAllPrimMany; + } + + public void setNavPropertyETAllPrimMany(List<EtAllPrim> navPropertyETAllPrimMany) { + NavPropertyETAllPrimMany = navPropertyETAllPrimMany; + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dd1e5b0d/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java ---------------------------------------------------------------------- diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java new file mode 100644 index 0000000..e0cebb7 --- /dev/null +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.olingo.server.tecsvc.processor; + +import java.io.ByteArrayInputStream; + +import org.apache.olingo.commons.api.edm.Edm; +import org.apache.olingo.server.api.OData; +import org.apache.olingo.server.api.ODataRequest; +import org.apache.olingo.server.api.ODataResponse; +import org.apache.olingo.server.api.processor.EntityProcessor; +import org.apache.olingo.server.api.processor.EntitySetProcessor; +import org.apache.olingo.server.api.uri.UriInfo; +import org.apache.olingo.server.tecsvc.data.DataProvider; + +public class TechnicalProcessor implements EntitySetProcessor, EntityProcessor { + + private OData odata; + private Edm edm; + private final DataProvider dataProvider; + + public TechnicalProcessor(DataProvider dataProvider) { + this.dataProvider = dataProvider; + } + + @Override + public void init(OData odata, Edm edm) { + this.odata = odata; + this.edm = edm; + } + + @Override + public void readEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, String format) { + response.setContent(new ByteArrayInputStream("Entity".getBytes())); + response.setStatusCode(200); + } + + @Override + public void readEntitySet(ODataRequest request, ODataResponse response, UriInfo uriInfo, String format) { + response.setContent(new ByteArrayInputStream("EntitySet".getBytes())); + response.setStatusCode(200); + } +}
