You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2013/12/06 15:51:42 UTC
[06/21] [OLINGO-77] Refactored java package names
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/EntitySet.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/EntitySet.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/EntitySet.java
deleted file mode 100644
index a39c256..0000000
--- a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/EntitySet.java
+++ /dev/null
@@ -1,34 +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.consumer.api.deserializer;
-
-import java.util.List;
-
-public interface EntitySet extends Iterable<Entity> {
-
- String getODataContext();
-
- Long getODataCount();
-
- String getODataNextLink();
-
- String getODataDeltaLink();
-
- List<Entity> getEntities();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/NavigationProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/NavigationProperty.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/NavigationProperty.java
deleted file mode 100644
index 27f6d01..0000000
--- a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/NavigationProperty.java
+++ /dev/null
@@ -1,27 +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.consumer.api.deserializer;
-
-public interface NavigationProperty extends Property {
-
- public abstract String getAssociationLink();
-
- public abstract String getNavigationLink();
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/Property.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/Property.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/Property.java
deleted file mode 100644
index 99be568..0000000
--- a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/Property.java
+++ /dev/null
@@ -1,23 +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.consumer.api.deserializer;
-
-public interface Property {
- String getName();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/Reader.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/Reader.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/Reader.java
deleted file mode 100644
index 9d4a5bf..0000000
--- a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/Reader.java
+++ /dev/null
@@ -1,30 +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.consumer.api.deserializer;
-
-import java.io.InputStream;
-
-public interface Reader {
-
- public abstract EntitySet readEntitySet(InputStream in) throws ConsumerException;
-
- public abstract Entity readEntity(InputStream in) throws ConsumerException;
-
- public abstract Property readProperty(InputStream in) throws ConsumerException;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/StructuralProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/StructuralProperty.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/StructuralProperty.java
deleted file mode 100644
index 577efc3..0000000
--- a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/StructuralProperty.java
+++ /dev/null
@@ -1,30 +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.consumer.api.deserializer;
-
-import java.util.List;
-
-public interface StructuralProperty extends Property {
-
- boolean containsCollection();
-
- Value getValue();
-
- List<Value> getValues();
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/Value.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/Value.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/Value.java
deleted file mode 100644
index ad9a85a..0000000
--- a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/consumer/api/deserializer/Value.java
+++ /dev/null
@@ -1,27 +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.consumer.api.deserializer;
-
-public interface Value {
- boolean isComplex();
-
- Object getContent();
-
- <T> T getContentAs(T type);
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/ODataConsumer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/ODataConsumer.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/ODataConsumer.java
new file mode 100644
index 0000000..abf6d30
--- /dev/null
+++ b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/ODataConsumer.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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.odata4.consumer.api;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
+
+//TODO: Exceptionhandling
+public abstract class ODataConsumer {
+
+ private static final String IMPLEMENTATION = "org.apache.olingo.odata4.consumer.core.ODataConsumerImpl";
+
+ public static ODataConsumer create() {
+ ODataConsumer instance;
+
+ try {
+ final Class<?> clazz = Class.forName(ODataConsumer.IMPLEMENTATION);
+
+ /*
+ * We explicitly do not use the singleton pattern to keep the server state free
+ * and avoid class loading issues also during hot deployment.
+ */
+ final Object object = clazz.newInstance();
+ instance = (ODataConsumer) object;
+
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ return instance;
+ }
+
+ public abstract Edm createEdm(EdmProvider provider);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/AnnotationProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/AnnotationProperty.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/AnnotationProperty.java
new file mode 100644
index 0000000..439066f
--- /dev/null
+++ b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/AnnotationProperty.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.odata4.consumer.api.deserializer;
+
+public interface AnnotationProperty extends Property {
+ String getValue();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ComplexValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ComplexValue.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ComplexValue.java
new file mode 100644
index 0000000..ab4455f
--- /dev/null
+++ b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ComplexValue.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.odata4.consumer.api.deserializer;
+
+import java.util.List;
+import java.util.Map;
+
+public interface ComplexValue extends Value {
+
+ Value getValue(String name);
+
+ List<Property> getProperties();
+
+ Map<String, NavigationProperty> getNavigationProperties();
+
+ Map<String, AnnotationProperty> getAnnotationProperties();
+
+ Map<String, StructuralProperty> getStructuralProperties();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ConsumerException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ConsumerException.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ConsumerException.java
new file mode 100644
index 0000000..def4636
--- /dev/null
+++ b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/ConsumerException.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.odata4.consumer.api.deserializer;
+
+public class ConsumerException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public ConsumerException() {
+ super();
+ }
+
+ public ConsumerException(final String message) {
+ super(message);
+ }
+
+ public ConsumerException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Entity.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Entity.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Entity.java
new file mode 100644
index 0000000..2d4c9b3
--- /dev/null
+++ b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Entity.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.odata4.consumer.api.deserializer;
+
+import java.util.List;
+import java.util.Map;
+
+public interface Entity {
+
+ String getODataContext();
+
+ String getODataMetaDataEtag();
+
+ String getODataType();
+
+ Long getODataCount();
+
+ String getODataNextLink();
+
+ String getODataDeltaLink();
+
+ String getODataId();
+
+ String getODataETag();
+
+ String getODataEditLink();
+
+ String getODataReadLink();
+
+ List<Property> getProperties();
+
+ Map<String, NavigationProperty> getNavigationProperties();
+
+ Map<String, AnnotationProperty> getAnnotationProperties();
+
+ Map<String, StructuralProperty> getStructuralProperties();
+
+ Property getProperty(String name);
+
+ <T extends Property> T getProperty(String name, Class<T> clazz);
+
+ Object getPropertyContent(String name);
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/EntitySet.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/EntitySet.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/EntitySet.java
new file mode 100644
index 0000000..1efda67
--- /dev/null
+++ b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/EntitySet.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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.odata4.consumer.api.deserializer;
+
+import java.util.List;
+
+public interface EntitySet extends Iterable<Entity> {
+
+ String getODataContext();
+
+ Long getODataCount();
+
+ String getODataNextLink();
+
+ String getODataDeltaLink();
+
+ List<Entity> getEntities();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/NavigationProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/NavigationProperty.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/NavigationProperty.java
new file mode 100644
index 0000000..67067ea
--- /dev/null
+++ b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/NavigationProperty.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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.odata4.consumer.api.deserializer;
+
+public interface NavigationProperty extends Property {
+
+ public abstract String getAssociationLink();
+
+ public abstract String getNavigationLink();
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Property.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Property.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Property.java
new file mode 100644
index 0000000..7092f72
--- /dev/null
+++ b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Property.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.odata4.consumer.api.deserializer;
+
+public interface Property {
+ String getName();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Reader.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Reader.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Reader.java
new file mode 100644
index 0000000..cf7b012
--- /dev/null
+++ b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Reader.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.odata4.consumer.api.deserializer;
+
+import java.io.InputStream;
+
+public interface Reader {
+
+ public abstract EntitySet readEntitySet(InputStream in) throws ConsumerException;
+
+ public abstract Entity readEntity(InputStream in) throws ConsumerException;
+
+ public abstract Property readProperty(InputStream in) throws ConsumerException;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/StructuralProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/StructuralProperty.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/StructuralProperty.java
new file mode 100644
index 0000000..3cdc254
--- /dev/null
+++ b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/StructuralProperty.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.odata4.consumer.api.deserializer;
+
+import java.util.List;
+
+public interface StructuralProperty extends Property {
+
+ boolean containsCollection();
+
+ Value getValue();
+
+ List<Value> getValues();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Value.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Value.java b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Value.java
new file mode 100644
index 0000000..7966c50
--- /dev/null
+++ b/odata4-lib/odata4-consumer-api/src/main/java/org/apache/olingo/odata4/consumer/api/deserializer/Value.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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.odata4.consumer.api.deserializer;
+
+public interface Value {
+ boolean isComplex();
+
+ Object getContent();
+
+ <T> T getContentAs(T type);
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/ODataConsumerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/ODataConsumerImpl.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/ODataConsumerImpl.java
deleted file mode 100644
index 6003a13..0000000
--- a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/ODataConsumerImpl.java
+++ /dev/null
@@ -1,33 +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.consumer.core;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.provider.EdmProvider;
-import org.apache.olingo.commons.core.ODataCommonsCoreImpl;
-import org.apache.olingo.consumer.api.ODataConsumer;
-
-public class ODataConsumerImpl extends ODataConsumer {
-
- @Override
- public Edm createEdm(final EdmProvider provider) {
- return new ODataCommonsCoreImpl().createEdm(provider);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/AnnotationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/AnnotationPropertyImpl.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/AnnotationPropertyImpl.java
deleted file mode 100644
index 67b93c3..0000000
--- a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/AnnotationPropertyImpl.java
+++ /dev/null
@@ -1,52 +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.consumer.core.deserializer;
-
-import org.apache.olingo.consumer.api.deserializer.AnnotationProperty;
-
-public class AnnotationPropertyImpl implements AnnotationProperty {
-
- private final String name;
- private final String value;
-
- public AnnotationPropertyImpl(final String name, final String value) {
- this.name = name;
- this.value = value;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getValue() {
- return value;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "AnnotationPropertyImpl [name=" + name + ", value=" + value + "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/ComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/ComplexValueImpl.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/ComplexValueImpl.java
deleted file mode 100644
index df52cf1..0000000
--- a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/ComplexValueImpl.java
+++ /dev/null
@@ -1,80 +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.consumer.core.deserializer;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.olingo.consumer.api.deserializer.AnnotationProperty;
-import org.apache.olingo.consumer.api.deserializer.ComplexValue;
-import org.apache.olingo.consumer.api.deserializer.NavigationProperty;
-import org.apache.olingo.consumer.api.deserializer.StructuralProperty;
-import org.apache.olingo.consumer.api.deserializer.Value;
-
-public class ComplexValueImpl extends PropertyCollection implements ComplexValue {
-
- public ComplexValueImpl() {}
-
- public ComplexValueImpl(final Map<String, AnnotationProperty> annotationProperties,
- final Map<String, NavigationProperty> navigationProperties,
- final Map<String, StructuralProperty> structuralProperties) {
- super(annotationProperties, navigationProperties, structuralProperties);
- }
-
- @Override
- public Value getValue(final String name) {
- StructuralProperty property = structuralProperties.get(name);
- if (property == null) {
- return null;
- }
- return property.getValue();
- }
-
- @Override
- public Map<String, AnnotationProperty> getAnnotationProperties() {
- return Collections.unmodifiableMap(annotationProperties);
- }
-
- @Override
- public Map<String, NavigationProperty> getNavigationProperties() {
- return Collections.unmodifiableMap(navigationProperties);
- }
-
- @Override
- public boolean isComplex() {
- return true;
- }
-
- @Override
- public Map<String, StructuralProperty> getContent() {
- return Collections.unmodifiableMap(structuralProperties);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T> T getContentAs(final T type) {
- return (T) getContent();
- }
-
- @Override
- public String toString() {
- return "ComplexValueImpl [annotations=" + annotationProperties + ", navigationProperties=" + navigationProperties
- + ", properties=" + structuralProperties + "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/EntityImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/EntityImpl.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/EntityImpl.java
deleted file mode 100644
index 25d0bf3..0000000
--- a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/EntityImpl.java
+++ /dev/null
@@ -1,124 +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.consumer.core.deserializer;
-
-import java.util.Map;
-
-import org.apache.olingo.consumer.api.deserializer.AnnotationProperty;
-import org.apache.olingo.consumer.api.deserializer.Entity;
-import org.apache.olingo.consumer.api.deserializer.NavigationProperty;
-import org.apache.olingo.consumer.api.deserializer.Property;
-import org.apache.olingo.consumer.api.deserializer.StructuralProperty;
-
-public class EntityImpl extends PropertyCollection implements Entity {
-
- public EntityImpl() {}
-
- public EntityImpl(final Map<String, AnnotationProperty> annotationProperties,
- final Map<String, NavigationProperty> navigationProperties,
- final Map<String, StructuralProperty> structuralProperties) {
- super(annotationProperties, navigationProperties, structuralProperties);
- }
-
- @Override
- public String getODataMetaDataEtag() {
- return getAnnotationValue("odata.metadataEtag");
- }
-
- @Override
- public String getODataType() {
- return getAnnotationValue("odata.type");
- }
-
- @Override
- public Long getODataCount() {
- return Long.valueOf(getAnnotationValue("odata.count"));
- }
-
- @Override
- public String getODataNextLink() {
- return getAnnotationValue("odata.nextLink");
- }
-
- @Override
- public String getODataDeltaLink() {
- return getAnnotationValue("odata.deltaLink");
- }
-
- @Override
- public String getODataReadLink() {
- return getAnnotationValue("odata.readLink");
- }
-
- @Override
- public String getODataContext() {
- return getAnnotationValue("odata.context");
- }
-
- @Override
- public String getODataId() {
- return getAnnotationValue("odata.id");
- }
-
- @Override
- public String getODataETag() {
- return getAnnotationValue("odata.etag");
- }
-
- @Override
- public String getODataEditLink() {
- return getAnnotationValue("odata.editLink");
- }
-
- @Override
- public Object getPropertyContent(final String name) {
- StructuralProperty property = structuralProperties.get(name);
- if (property != null) {
- return property.getValue().getContent();
- }
- return null;
- }
-
- @Override
- public Property getProperty(final String name) {
- Property p = structuralProperties.get(name);
- if (p == null) {
- p = annotationProperties.get(name);
- }
- if (p == null) {
- p = navigationProperties.get(name);
- }
- return p;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T extends Property> T getProperty(final String name, final Class<T> clazz) {
- Property p = getProperty(name);
- return (T) p;
- }
-
- private String getAnnotationValue(final String key) {
- AnnotationProperty prop = annotationProperties.get(key);
- if (prop == null) {
- return null;
- }
- return prop.getValue();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/EntitySetBuilder.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/EntitySetBuilder.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/EntitySetBuilder.java
deleted file mode 100644
index cec6ef7..0000000
--- a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/EntitySetBuilder.java
+++ /dev/null
@@ -1,68 +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.consumer.core.deserializer;
-
-import java.io.IOException;
-
-import org.apache.olingo.consumer.api.deserializer.EntitySet;
-
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-
-public class EntitySetBuilder {
-
- private final JsonParser parser;
-
- public EntitySetBuilder(final JsonParser jp) {
- parser = jp;
- }
-
- public EntitySet buildEntitySet() throws JsonParseException, IOException {
- return parseEntitySet(parser);
- }
-
- private EntitySet parseEntitySet(final JsonParser jp) throws JsonParseException, IOException {
- EntitySetImpl entitySet = new EntitySetImpl();
- boolean arrayStarted = false;
-
- while (jp.nextToken() != null) {
- JsonToken token = jp.getCurrentToken();
- switch (token) {
- case START_ARRAY:
- PropertyCollectionBuilder builder = new PropertyCollectionBuilder(jp, entitySet);
- entitySet.setPropertyCollectionBuilder(builder);
- arrayStarted = true;
- break;
- case START_OBJECT:
- if (arrayStarted) {
- return entitySet;
- }
- break;
- case VALUE_NUMBER_INT:
- case VALUE_STRING:
- entitySet.addAnnotation(jp.getCurrentName(), jp.getValueAsString());
- default:
- break;
- }
- }
-
- return entitySet;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/EntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/EntitySetImpl.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/EntitySetImpl.java
deleted file mode 100644
index 3e1ff13..0000000
--- a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/EntitySetImpl.java
+++ /dev/null
@@ -1,113 +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.consumer.core.deserializer;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.olingo.consumer.api.deserializer.Entity;
-import org.apache.olingo.consumer.api.deserializer.EntitySet;
-
-import com.fasterxml.jackson.core.JsonParseException;
-
-public class EntitySetImpl implements EntitySet, Iterator<Entity> {
-
- private String odataContext;
- private Long odataCount;
- private String odataNextLink;
- private String odataDeltaLink;
- private List<Entity> entities = null;
-
- private PropertyCollectionBuilder propertyCollectionsBuilder;
-
- @Override
- public String getODataContext() {
- return odataContext;
- }
-
- @Override
- public Long getODataCount() {
- return odataCount;
- }
-
- @Override
- public String getODataNextLink() {
- return odataNextLink;
- }
-
- @Override
- public String getODataDeltaLink() {
- return odataDeltaLink;
- }
-
- public void addAnnotation(final String name, final String value) {
- if ("odata.context".equalsIgnoreCase(name)) {
- odataContext = value;
- } else if ("odata.deltaLink".equalsIgnoreCase(name)) {
- odataDeltaLink = value;
- } else if ("odata.count".equalsIgnoreCase(name)) {
- odataCount = Long.parseLong(value);
- } else if ("odata.nextLink".equalsIgnoreCase(name)) {
- odataNextLink = value;
- }
- }
-
- @Override
- public List<Entity> getEntities() {
- if (entities == null) {
- entities = new ArrayList<Entity>();
-
- while (propertyCollectionsBuilder.parseNext()) {
- entities.add(propertyCollectionsBuilder.buildEntity());
- }
- }
-
- return entities;
- }
-
- public void setPropertyCollectionBuilder(final PropertyCollectionBuilder builder) {
- propertyCollectionsBuilder = builder;
- }
-
- @Override
- public boolean hasNext() {
- try {
- return propertyCollectionsBuilder.hasNext();
- } catch (JsonParseException e) {} catch (IOException e) {}
- return false;
- }
-
- @Override
- public Entity next() {
- if (propertyCollectionsBuilder.parseNext()) {
- return propertyCollectionsBuilder.buildEntity();
- }
- return null;
- }
-
- @Override
- public void remove() {}
-
- @Override
- public Iterator<Entity> iterator() {
- return this;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/JsonReader.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/JsonReader.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/JsonReader.java
deleted file mode 100644
index 82be545..0000000
--- a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/JsonReader.java
+++ /dev/null
@@ -1,89 +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.consumer.core.deserializer;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-
-import org.apache.olingo.consumer.api.deserializer.ConsumerException;
-import org.apache.olingo.consumer.api.deserializer.Entity;
-import org.apache.olingo.consumer.api.deserializer.EntitySet;
-import org.apache.olingo.consumer.api.deserializer.Property;
-import org.apache.olingo.consumer.api.deserializer.Reader;
-import org.apache.olingo.consumer.api.deserializer.StructuralProperty;
-
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonParser;
-
-public class JsonReader implements Reader {
-
- @Override
- public EntitySet readEntitySet(final InputStream in) throws ConsumerException {
-
- JsonFactory jsonFactory = new JsonFactory();
- // or, for data binding, org.codehaus.jackson.mapper.MappingJsonFactory
- try {
- JsonParser jp = jsonFactory.createParser(in);
- EntitySetBuilder entitySet = new EntitySetBuilder(jp);
- return entitySet.buildEntitySet();
- } catch (JsonParseException e) {
- throw new ConsumerException("JSON Parsing failed.", e);
- } catch (IOException e) {
- throw new ConsumerException("JSON Parsing failed.", e);
- }
- }
-
- @Override
- public Entity readEntity(final InputStream in) throws ConsumerException {
- Entity entity = null;
-
- JsonFactory jsonFactory = new JsonFactory();
- // or, for data binding, org.codehaus.jackson.mapper.MappingJsonFactory
- try {
- JsonParser jp = jsonFactory.createParser(in);
- PropertyCollectionBuilder builder = new PropertyCollectionBuilder(jp);
- builder.parseNext();
- entity = builder.buildEntity();
- } catch (JsonParseException e) {
- throw new ConsumerException("JSON Parsing failed.", e);
- } catch (IOException e) {
- throw new ConsumerException("JSON Parsing failed.", e);
- }
-
- return entity;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.olingo.core.consumer.Reader#parseProperty(java.io.InputStream)
- */
- @Override
- public Property readProperty(final InputStream in) throws ConsumerException {
- Entity entity = readEntity(in);
-
- Map<String, StructuralProperty> properties = entity.getStructuralProperties();
- if (properties.size() == 1) {
- return properties.values().iterator().next();
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/NavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/NavigationPropertyImpl.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/NavigationPropertyImpl.java
deleted file mode 100644
index 507f2f1..0000000
--- a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/NavigationPropertyImpl.java
+++ /dev/null
@@ -1,87 +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.consumer.core.deserializer;
-
-import org.apache.olingo.consumer.api.deserializer.NavigationProperty;
-
-public class NavigationPropertyImpl implements NavigationProperty {
-
- private final String name;
- private String associationLink;
- private String navigationLink;
-
- public NavigationPropertyImpl(final String name) {
- this.name = parseName(name);
- }
-
- public NavigationPropertyImpl(final String name, final String link) {
- this(name);
- updateLink(name, link);
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getAssociationLink() {
- return associationLink;
- }
-
- @Override
- public String getNavigationLink() {
- return navigationLink;
- }
-
- public void updateLink(final String name, final String link) {
- String regexNavigationLink = ".*@odata.navigationLink$";
- String regexAssociationLink = ".*@odata.associationLink$";
- if (name.matches(regexNavigationLink)) {
- navigationLink = link;
- } else if (name.matches(regexAssociationLink)) {
- associationLink = link;
- }
- }
-
- private String parseName(final String nameToParse) {
- String[] split = nameToParse.split("@");
- if (split.length == 2) {
- return split[0];
- } else {
- throw new IllegalArgumentException("Got OData Navigation with unparseable format '"
- + nameToParse + "'.");
- }
- }
-
- public void updateLink(final NavigationProperty navigationProperty) {
- if (navigationProperty.getAssociationLink() != null) {
- associationLink = navigationProperty.getAssociationLink();
- }
- if (navigationProperty.getNavigationLink() != null) {
- navigationLink = navigationProperty.getNavigationLink();
- }
- }
-
- @Override
- public String toString() {
- return "NavigationPropertyImpl [name=" + name + ", associationLink=" + associationLink
- + ", navigationLink=" + navigationLink + "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/PrimitiveValue.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/PrimitiveValue.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/PrimitiveValue.java
deleted file mode 100644
index 8a400bc..0000000
--- a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/PrimitiveValue.java
+++ /dev/null
@@ -1,51 +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.consumer.core.deserializer;
-
-import org.apache.olingo.consumer.api.deserializer.Value;
-
-public class PrimitiveValue implements Value {
-
- private final Object content;
-
- public PrimitiveValue(final Object content) {
- this.content = content;
- }
-
- @Override
- public boolean isComplex() {
- return false;
- }
-
- @Override
- public Object getContent() {
- return content;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T> T getContentAs(final T type) {
- return (T) content;
- }
-
- @Override
- public String toString() {
- return String.valueOf(content);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/PropertyCollection.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/PropertyCollection.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/PropertyCollection.java
deleted file mode 100644
index 9208796..0000000
--- a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/PropertyCollection.java
+++ /dev/null
@@ -1,91 +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.consumer.core.deserializer;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.consumer.api.deserializer.AnnotationProperty;
-import org.apache.olingo.consumer.api.deserializer.NavigationProperty;
-import org.apache.olingo.consumer.api.deserializer.Property;
-import org.apache.olingo.consumer.api.deserializer.StructuralProperty;
-
-abstract class PropertyCollection {
- protected Map<String, AnnotationProperty> annotationProperties = new HashMap<String, AnnotationProperty>();
- protected Map<String, NavigationProperty> navigationProperties = new HashMap<String, NavigationProperty>();
- protected Map<String, StructuralProperty> structuralProperties = new HashMap<String, StructuralProperty>();
-
- public PropertyCollection() {}
-
- protected PropertyCollection(final Map<String, AnnotationProperty> annotationProperties,
- final Map<String, NavigationProperty> navigationProperties,
- final Map<String, StructuralProperty> structuralProperties) {
- this.annotationProperties = annotationProperties;
- this.navigationProperties = navigationProperties;
- this.structuralProperties = structuralProperties;
- }
-
- public List<Property> getProperties() {
- int initialCapacity = annotationProperties.size() + navigationProperties.size() + structuralProperties.size();
-
- List<Property> properties = new ArrayList<Property>(initialCapacity);
- properties.addAll(annotationProperties.values());
- properties.addAll(navigationProperties.values());
- properties.addAll(structuralProperties.values());
-
- return properties;
- }
-
- public Map<String, AnnotationProperty> getAnnotationProperties() {
- return Collections.unmodifiableMap(annotationProperties);
- }
-
- public Map<String, NavigationProperty> getNavigationProperties() {
- return Collections.unmodifiableMap(navigationProperties);
- }
-
- public Map<String, StructuralProperty> getStructuralProperties() {
- return Collections.unmodifiableMap(structuralProperties);
- }
-
- public void addProperty(final Property property) {
- if (property == null) {
- throw new IllegalArgumentException("Property parameter MUST NOT be NULL.");
- }
-
- if (property instanceof NavigationPropertyImpl) {
- NavigationPropertyImpl navProperty = (NavigationPropertyImpl) navigationProperties.get(property.getName());
- if (navProperty == null) {
- navigationProperties.put(property.getName(), (NavigationPropertyImpl) property);
- } else {
- NavigationProperty temp = (NavigationProperty) property;
- navProperty.updateLink(temp);
- }
- } else if (property instanceof AnnotationPropertyImpl) {
- annotationProperties.put(property.getName(), (AnnotationPropertyImpl) property);
- } else if (property instanceof StructuralProperty) {
- structuralProperties.put(property.getName(), (StructuralProperty) property);
- } else {
- throw new IllegalArgumentException("Unknown class '" + property.getClass() + "'.");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/PropertyCollectionBuilder.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/PropertyCollectionBuilder.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/PropertyCollectionBuilder.java
deleted file mode 100644
index 4527005..0000000
--- a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/PropertyCollectionBuilder.java
+++ /dev/null
@@ -1,211 +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.consumer.core.deserializer;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.olingo.consumer.api.deserializer.AnnotationProperty;
-import org.apache.olingo.consumer.api.deserializer.ComplexValue;
-import org.apache.olingo.consumer.api.deserializer.Entity;
-import org.apache.olingo.consumer.api.deserializer.NavigationProperty;
-import org.apache.olingo.consumer.api.deserializer.Property;
-import org.apache.olingo.consumer.api.deserializer.StructuralProperty;
-import org.apache.olingo.consumer.api.deserializer.Value;
-
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonToken;
-
-public class PropertyCollectionBuilder extends PropertyCollection {
- private JsonParser parser;
- private EntitySetImpl enclosingEntitySet;
-
- public PropertyCollectionBuilder(final JsonParser parser) {
- this.parser = parser;
- }
-
- private PropertyCollectionBuilder() {};
-
- public PropertyCollectionBuilder(final JsonParser jp, final EntitySetImpl entitySet) {
- this(jp);
- enclosingEntitySet = entitySet;
- }
-
- public Entity buildEntity() {
- Entity v = new EntityImpl(annotationProperties, navigationProperties, structuralProperties);
- resetProperties();
- return v;
- }
-
- public ComplexValue buildComplexValue() {
- ComplexValue v = new ComplexValueImpl(annotationProperties, navigationProperties, structuralProperties);
- resetProperties();
- return v;
- }
-
- private void resetProperties() {
- annotationProperties = new HashMap<String, AnnotationProperty>();
- navigationProperties = new HashMap<String, NavigationProperty>();
- structuralProperties = new HashMap<String, StructuralProperty>();
- }
-
- private PropertyCollectionBuilder next = null;
-
- public boolean hasNext() throws JsonParseException, IOException {
- if (parser.isClosed()) {
- return false;
- }
- next = parseNextObject(parser, this);
- return (next != null);
- }
-
- public boolean parseNext() {
- try {
- if (hasNext()) {
- if (next != null) {
- return true;
- }
-
- if (next == null) {
- parser.close();
- return false;
- }
- return true;
- }
- } catch (JsonParseException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return false;
-
- }
-
- /**
- *
- * @param jp
- * @param builder
- * @return
- * @throws IOException
- * @throws JsonParseException
- */
- private PropertyCollectionBuilder parseNextObject(final JsonParser jp, final PropertyCollectionBuilder builder)
- throws JsonParseException, IOException {
- boolean endReached = readToStartObjectOrEnd(jp);
- if (endReached) {
- return null;
- }
-
- //
- String currentFieldName = null;
- List<Value> values = null;
-
- while (jp.nextToken() != null) {
- JsonToken token = jp.getCurrentToken();
- switch (token) {
- case START_OBJECT:
- if (currentFieldName != null) {
- ComplexValue cvp = parseNextObject(jp, new PropertyCollectionBuilder()).buildComplexValue();
- if (values == null) {
- builder.addProperty(new StructuralPropertyImpl(currentFieldName, cvp));
- } else {
- values.add(cvp);
- }
- }
- break;
- case END_OBJECT:
- return builder;
- case START_ARRAY:
- values = new ArrayList<Value>();
- break;
- case END_ARRAY:
- if (values != null) {
- builder.addProperty(new StructuralPropertyImpl(currentFieldName, values));
- values = null;
- }
- break;
- case FIELD_NAME:
- currentFieldName = jp.getCurrentName();
- break;
- case NOT_AVAILABLE:
- break;
- case VALUE_EMBEDDED_OBJECT:
- break;
- case VALUE_NULL:
- Property nullProperty = createProperty(jp.getCurrentName(), null);
- builder.addProperty(nullProperty);
- break;
- case VALUE_FALSE:
- case VALUE_NUMBER_FLOAT:
- case VALUE_NUMBER_INT:
- case VALUE_STRING:
- case VALUE_TRUE:
- if (values == null) {
- Property property = createProperty(jp.getCurrentName(), jp.getValueAsString());
- builder.addProperty(property);
- } else {
- PrimitiveValue value = new PrimitiveValue(jp.getValueAsString());
- values.add(value);
- }
- break;
- default:
- break;
- }
- }
-
- return null;
- }
-
- private boolean readToStartObjectOrEnd(final JsonParser jp) throws IOException, JsonParseException {
- JsonToken endToken = JsonToken.START_OBJECT;
- JsonToken token = jp.getCurrentToken() == null ? jp.nextToken() : jp.getCurrentToken();
- while (token != null && token != endToken) {
- if (enclosingEntitySet != null) {
- switch (token) {
- case VALUE_FALSE:
- case VALUE_NUMBER_FLOAT:
- case VALUE_NUMBER_INT:
- case VALUE_TRUE:
- case VALUE_STRING:
- enclosingEntitySet.addAnnotation(jp.getCurrentName(), jp.getValueAsString());
- break;
- default:
- break;
- }
- }
- //
- token = jp.nextToken();
- }
-
- return token == null;
- }
-
- private Property createProperty(final String name, final String value) {
- if (name.contains("@")) {
- return new NavigationPropertyImpl(name, value);
- } else if (name.contains(".")) {
- return new AnnotationPropertyImpl(name, value);
- } else {
- return new StructuralPropertyImpl(name, new PrimitiveValue(value));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/StructuralPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/StructuralPropertyImpl.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/StructuralPropertyImpl.java
deleted file mode 100644
index 7da81f6..0000000
--- a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/consumer/core/deserializer/StructuralPropertyImpl.java
+++ /dev/null
@@ -1,81 +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.consumer.core.deserializer;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.olingo.consumer.api.deserializer.StructuralProperty;
-import org.apache.olingo.consumer.api.deserializer.Value;
-
-public class StructuralPropertyImpl implements StructuralProperty {
-
- private final List<Value> values;
- private final String name;
- private final boolean containsCollection;
-
- public StructuralPropertyImpl(final String name, final Value value) {
- this(name, false, value);
- }
-
- public StructuralPropertyImpl(final String name, final List<Value> values) {
- // XXX: ugly -> refactore
- this(name, true, values.toArray(new Value[0]));
- }
-
- public StructuralPropertyImpl(final String name, final boolean asCollection, final Value... value) {
- if (value == null || value.length == 0) {
- throw new IllegalArgumentException("Missing or NULL value argument.");
- }
-
- containsCollection = asCollection;
- this.name = name;
- values = new ArrayList<Value>(value.length);
- for (Value v : value) {
- values.add(v);
- }
- }
-
- @Override
- public Value getValue() {
- return values.get(0);
- }
-
- @Override
- public List<Value> getValues() {
- return Collections.unmodifiableList(values);
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public boolean containsCollection() {
- return containsCollection;
- }
-
- @Override
- public String toString() {
- return "StructuralPropertyImpl [name=" + name + ", containsCollection=" + containsCollection
- + ", values=" + values + "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/ODataConsumerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/ODataConsumerImpl.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/ODataConsumerImpl.java
new file mode 100644
index 0000000..ec61bba
--- /dev/null
+++ b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/ODataConsumerImpl.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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.odata4.consumer.core;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.provider.EdmProvider;
+import org.apache.olingo.odata4.commons.core.ODataCommonsCoreImpl;
+import org.apache.olingo.odata4.consumer.api.ODataConsumer;
+
+public class ODataConsumerImpl extends ODataConsumer {
+
+ @Override
+ public Edm createEdm(final EdmProvider provider) {
+ return new ODataCommonsCoreImpl().createEdm(provider);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/AnnotationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/AnnotationPropertyImpl.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/AnnotationPropertyImpl.java
new file mode 100644
index 0000000..f404f02
--- /dev/null
+++ b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/AnnotationPropertyImpl.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.odata4.consumer.core.deserializer;
+
+import org.apache.olingo.odata4.consumer.api.deserializer.AnnotationProperty;
+
+public class AnnotationPropertyImpl implements AnnotationProperty {
+
+ private final String name;
+ private final String value;
+
+ public AnnotationPropertyImpl(final String name, final String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "AnnotationPropertyImpl [name=" + name + ", value=" + value + "]";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/82ae6060/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/ComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/ComplexValueImpl.java b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/ComplexValueImpl.java
new file mode 100644
index 0000000..e50cecf
--- /dev/null
+++ b/odata4-lib/odata4-consumer-core/src/main/java/org/apache/olingo/odata4/consumer/core/deserializer/ComplexValueImpl.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * 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.odata4.consumer.core.deserializer;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.apache.olingo.odata4.consumer.api.deserializer.AnnotationProperty;
+import org.apache.olingo.odata4.consumer.api.deserializer.ComplexValue;
+import org.apache.olingo.odata4.consumer.api.deserializer.NavigationProperty;
+import org.apache.olingo.odata4.consumer.api.deserializer.StructuralProperty;
+import org.apache.olingo.odata4.consumer.api.deserializer.Value;
+
+public class ComplexValueImpl extends PropertyCollection implements ComplexValue {
+
+ public ComplexValueImpl() {}
+
+ public ComplexValueImpl(final Map<String, AnnotationProperty> annotationProperties,
+ final Map<String, NavigationProperty> navigationProperties,
+ final Map<String, StructuralProperty> structuralProperties) {
+ super(annotationProperties, navigationProperties, structuralProperties);
+ }
+
+ @Override
+ public Value getValue(final String name) {
+ StructuralProperty property = structuralProperties.get(name);
+ if (property == null) {
+ return null;
+ }
+ return property.getValue();
+ }
+
+ @Override
+ public Map<String, AnnotationProperty> getAnnotationProperties() {
+ return Collections.unmodifiableMap(annotationProperties);
+ }
+
+ @Override
+ public Map<String, NavigationProperty> getNavigationProperties() {
+ return Collections.unmodifiableMap(navigationProperties);
+ }
+
+ @Override
+ public boolean isComplex() {
+ return true;
+ }
+
+ @Override
+ public Map<String, StructuralProperty> getContent() {
+ return Collections.unmodifiableMap(structuralProperties);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getContentAs(final T type) {
+ return (T) getContent();
+ }
+
+ @Override
+ public String toString() {
+ return "ComplexValueImpl [annotations=" + annotationProperties + ", navigationProperties=" + navigationProperties
+ + ", properties=" + structuralProperties + "]";
+ }
+}