You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by fm...@apache.org on 2014/05/06 10:44:58 UTC
[1/4] [OLINGO-261] providing basics for pojo generator and proxy
annotations
Repository: olingo-odata4
Updated Branches:
refs/heads/master dda7577fa -> f02d9a07e
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
index 5c387fc..f7a71f1 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java
@@ -82,7 +82,9 @@ public abstract class AbstractEdmEntityContainer extends EdmNamedImpl implements
EdmSingleton singleton = singletons.get(singletonName);
if (singleton == null) {
singleton = createSingleton(singletonName);
- singletons.put(singletonName, singleton);
+ if (singleton != null) {
+ singletons.put(singletonName, singleton);
+ }
}
return singleton;
}
@@ -94,7 +96,9 @@ public abstract class AbstractEdmEntityContainer extends EdmNamedImpl implements
EdmEntitySet entitySet = entitySets.get(entitySetName);
if (entitySet == null) {
entitySet = createEntitySet(entitySetName);
- entitySets.put(entitySetName, entitySet);
+ if (entitySet != null) {
+ entitySets.put(entitySetName, entitySet);
+ }
}
return entitySet;
}
@@ -106,7 +110,9 @@ public abstract class AbstractEdmEntityContainer extends EdmNamedImpl implements
EdmActionImport actionImport = actionImports.get(actionImportName);
if (actionImport == null) {
actionImport = createActionImport(actionImportName);
- actionImports.put(actionImportName, actionImport);
+ if (actionImport != null) {
+ actionImports.put(actionImportName, actionImport);
+ }
}
return actionImport;
}
@@ -118,7 +124,9 @@ public abstract class AbstractEdmEntityContainer extends EdmNamedImpl implements
EdmFunctionImport functionImport = functionImports.get(functionImportName);
if (functionImport == null) {
functionImport = createFunctionImport(functionImportName);
- functionImports.put(functionImportName, functionImport);
+ if (functionImport != null) {
+ functionImports.put(functionImportName, functionImport);
+ }
}
return functionImport;
}
@@ -186,5 +194,4 @@ public abstract class AbstractEdmEntityContainer extends EdmNamedImpl implements
public FullQualifiedName getAnnotationsTargetFQN() {
return getFullQualifiedName();
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java
index 2ac876c..ed49451 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java
@@ -72,6 +72,7 @@ public abstract class AbstractEdmNavigationProperty extends EdmElementImpl imple
return partnerNavigationProperty;
}
+ @Override
public abstract String getReferencingPropertyName(String referencedPropertyName);
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java
index 5e4f13e..3a6b3d1 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeInfo.java
@@ -68,8 +68,6 @@ public class EdmTypeInfo {
}
private final Edm edm;
- private final String typeExpression;
-
private final boolean collection;
private final FullQualifiedName fullQualifiedName;
@@ -124,7 +122,6 @@ public class EdmTypeInfo {
final StringBuilder exp = new StringBuilder();
exp.append(baseType);
- this.typeExpression = (this.collection ? exp.insert(0, "Collection(").append(")") : exp).toString();
this.fullQualifiedName = new FullQualifiedName(namespace, typeName);
try {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java
index 6d9fbab..0c6a15d 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/EdmImplCachingTest.java
@@ -65,8 +65,7 @@ public class EdmImplCachingTest {
assertEquals(1, schemas.size());
List<EdmSchema> cachedSchemas = edm.getSchemas();
- assertTrue(schemas == cachedSchemas);
- assertEquals(schemas, schemas);
+ assertEquals(schemas, cachedSchemas);
}
@Test
@@ -421,7 +420,15 @@ public class EdmImplCachingTest {
@Override
protected Map<String, EdmSchema> createSchemas() {
- return Collections.singletonMap(StringUtils.EMPTY, mock(EdmSchema.class));
+ final EdmSchema schema = mock(EdmSchema.class);
+ when(schema.getNamespace()).thenReturn(NAME1.getNamespace());
+ return new HashMap<String, EdmSchema>() {
+ private static final long serialVersionUID = 3109256773218160485L;
+
+ {
+ put(StringUtils.EMPTY, schema);
+ }
+ };
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java
index 78651bc..a8bac25 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java
@@ -19,13 +19,10 @@
package org.apache.olingo.server.core.edm.provider;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmBindingTarget;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
import org.apache.olingo.commons.api.edm.Target;
import org.apache.olingo.commons.core.edm.AbstractEdmBindingTarget;
@@ -44,42 +41,6 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
}
@Override
- public EdmBindingTarget getRelatedBindingTarget(final String path) {
- EdmBindingTarget bindingTarget = null;
-
- final List<NavigationPropertyBinding> navigationPropertyBindings = target.getNavigationPropertyBindings();
- if (navigationPropertyBindings != null) {
- boolean found = false;
- for (final Iterator<NavigationPropertyBinding> itor = navigationPropertyBindings.iterator(); itor.hasNext()
- && !found;) {
-
- final NavigationPropertyBinding binding = itor.next();
- if (binding.getPath().equals(path)) {
- final Target providerTarget = binding.getTarget();
- final EdmEntityContainer entityContainer = edm.getEntityContainer(providerTarget.getEntityContainer());
- if (entityContainer == null) {
- throw new EdmException("Cant find entity container with name: " + providerTarget.getEntityContainer());
- }
- final String targetName = providerTarget.getTargetName();
- bindingTarget = entityContainer.getEntitySet(targetName);
- if (bindingTarget == null) {
- bindingTarget = entityContainer.getSingleton(targetName);
- if (bindingTarget == null) {
- throw new EdmException("Cant find target with name: " + targetName);
- }
-
- found = true;
- } else {
- found = true;
- }
- }
- }
- }
-
- return bindingTarget;
- }
-
- @Override
public List<EdmNavigationPropertyBinding> getNavigationPropertyBindings() {
if (navigationPropertyBindings == null) {
List<NavigationPropertyBinding> providerBindings = target.getNavigationPropertyBindings();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 18c133b..9cadeaf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
- <version>13</version>
+ <version>14</version>
</parent>
<licenses>
@@ -67,6 +67,7 @@
<commons.codec.version>1.9</commons.codec.version>
<commons.io.version>2.4</commons.io.version>
<commons.lang3.version>3.3.2</commons.lang3.version>
+ <commons.beanutils.version>1.8.3</commons.beanutils.version>
<commons.logging.version>1.1.3</commons.logging.version>
<commons.vfs.version>2.0</commons.vfs.version>
@@ -74,6 +75,10 @@
<servlet.version>3.0.1</servlet.version>
<cxf.version>2.7.11</cxf.version>
<spring.version>4.0.3.RELEASE</spring.version>
+
+ <velocity.version>1.7</velocity.version>
+ <maven.plugin.api.version>3.1.0</maven.plugin.api.version>
+ <maven.plugin.tools.version>3.2</maven.plugin.tools.version>
<hc.client.version>4.2.6</hc.client.version>
<jackson.version>2.3.3</jackson.version>
@@ -117,6 +122,11 @@
<version>${commons.logging.version}</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils-core</artifactId>
+ <version>${commons.beanutils.version}</version>
+ </dependency>
<dependency>
<groupId>org.antlr</groupId>
@@ -192,6 +202,24 @@
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
+
+ <!-- Pojogen Maven Plugin depenencies -->
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>${velocity.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>${maven.plugin.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>${maven.plugin.tools.version}</version>
+ </dependency>
+ <!-- /Pojogen Maven Plugin depenencies -->
<dependency>
<groupId>junit</groupId>
[3/4] [OLINGO-261] providing basics for pojo generator and proxy
annotations
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/keyAsSegmentService/verify.groovy
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/keyAsSegmentService/verify.groovy b/ext/pojogen-maven-plugin/src/it/keyAsSegmentService/verify.groovy
new file mode 100644
index 0000000..a19cf4d
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/keyAsSegmentService/verify.groovy
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ */
+File basepkg = new File( basedir, "target/generated-sources/ojc-plugin/com/msopentech/odatajclient/proxy" );
+assert basepkg.isDirectory() && basepkg.listFiles().length>0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/northwind/pom.xml
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/northwind/pom.xml b/ext/pojogen-maven-plugin/src/it/northwind/pom.xml
new file mode 100644
index 0000000..862493a
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/northwind/pom.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-maven-plugin</artifactId>
+ <version>@project.version@</version>
+
+ <description>A simple IT verifying the basic use case.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>@velocity.version@</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-proxy</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>@project.artifactId@</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <configuration>
+ <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+ <serviceRootURL>http://services.odata.org/v3/(S(g00nkir0ssikgdmz3maw5l1x))/Northwind/Northwind.svc</serviceRootURL>
+ <basePackage>org.apache.olingo.ext.proxy.northwind</basePackage>
+ </configuration>
+ <id>pojosV3</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>pojosV3</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/northwind/verify.groovy
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/northwind/verify.groovy b/ext/pojogen-maven-plugin/src/it/northwind/verify.groovy
new file mode 100644
index 0000000..a19cf4d
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/northwind/verify.groovy
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ */
+File basepkg = new File( basedir, "target/generated-sources/ojc-plugin/com/msopentech/odatajclient/proxy" );
+assert basepkg.isDirectory() && basepkg.listFiles().length>0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/odataWriterDefaultService/pom.xml
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/odataWriterDefaultService/pom.xml b/ext/pojogen-maven-plugin/src/it/odataWriterDefaultService/pom.xml
new file mode 100644
index 0000000..0f133b4
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/odataWriterDefaultService/pom.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-maven-plugin</artifactId>
+ <version>@project.version@</version>
+
+ <description>A simple IT verifying the basic use case.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>@velocity.version@</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-proxy</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>@project.artifactId@</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <configuration>
+ <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+ <serviceRootURL>@serviceRootURL@/ODataWriterDefaultService.svc</serviceRootURL>
+ <basePackage>org.apache.olingo.ext.proxy.odatawriterdefaultservice</basePackage>
+ </configuration>
+ <id>pojosV3</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>pojosV3</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/odataWriterDefaultService/verify.groovy
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/odataWriterDefaultService/verify.groovy b/ext/pojogen-maven-plugin/src/it/odataWriterDefaultService/verify.groovy
new file mode 100644
index 0000000..a19cf4d
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/odataWriterDefaultService/verify.groovy
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ */
+File basepkg = new File( basedir, "target/generated-sources/ojc-plugin/com/msopentech/odatajclient/proxy" );
+assert basepkg.isDirectory() && basepkg.listFiles().length>0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/openTypeService/pom.xml
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/openTypeService/pom.xml b/ext/pojogen-maven-plugin/src/it/openTypeService/pom.xml
new file mode 100644
index 0000000..408c57a
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/openTypeService/pom.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-maven-plugin</artifactId>
+ <version>@project.version@</version>
+
+ <description>A simple IT verifying the basic use case.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>@velocity.version@</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-proxy</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>@project.artifactId@</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <configuration>
+ <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+ <serviceRootURL>@serviceRootURL@/OpenTypeService.svc</serviceRootURL>
+ <basePackage>org.apache.olingo.ext.proxy.opentypeservice</basePackage>
+ </configuration>
+ <id>pojosV3</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>pojosV3</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/openTypeService/verify.groovy
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/openTypeService/verify.groovy b/ext/pojogen-maven-plugin/src/it/openTypeService/verify.groovy
new file mode 100644
index 0000000..a19cf4d
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/openTypeService/verify.groovy
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ */
+File basepkg = new File( basedir, "target/generated-sources/ojc-plugin/com/msopentech/odatajclient/proxy" );
+assert basepkg.isDirectory() && basepkg.listFiles().length>0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/primitiveKeysService/pom.xml
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/primitiveKeysService/pom.xml b/ext/pojogen-maven-plugin/src/it/primitiveKeysService/pom.xml
new file mode 100644
index 0000000..1596708
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/primitiveKeysService/pom.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-maven-plugin</artifactId>
+ <version>@project.version@</version>
+
+ <description>A simple IT verifying the basic use case.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>@velocity.version@</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-proxy</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>@project.artifactId@</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <configuration>
+ <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+ <serviceRootURL>@serviceRootURL@/PrimitiveKeys.svc</serviceRootURL>
+ <basePackage>org.apache.olingo.ext.proxy.primitivekeysservice</basePackage>
+ </configuration>
+ <id>pojosV3</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>pojosV3</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/primitiveKeysService/verify.groovy
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/primitiveKeysService/verify.groovy b/ext/pojogen-maven-plugin/src/it/primitiveKeysService/verify.groovy
new file mode 100644
index 0000000..a19cf4d
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/primitiveKeysService/verify.groovy
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ */
+File basepkg = new File( basedir, "target/generated-sources/ojc-plugin/com/msopentech/odatajclient/proxy" );
+assert basepkg.isDirectory() && basepkg.listFiles().length>0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/staticServiceV3/pom.xml
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/staticServiceV3/pom.xml b/ext/pojogen-maven-plugin/src/it/staticServiceV3/pom.xml
new file mode 100644
index 0000000..43cb499
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/staticServiceV3/pom.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-maven-plugin</artifactId>
+ <version>@project.version@</version>
+
+ <description>A simple IT verifying the basic use case.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>@velocity.version@</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-proxy</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>@project.artifactId@</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <configuration>
+ <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+ <serviceRootURL>http://localhost:9080/StaticService/V3/Static.svc</serviceRootURL>
+ <basePackage>org.apache.olingo.ext.proxy.staticservice</basePackage>
+ </configuration>
+ <id>pojosV3</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>pojosV3</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/staticServiceV3/verify.groovy
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/staticServiceV3/verify.groovy b/ext/pojogen-maven-plugin/src/it/staticServiceV3/verify.groovy
new file mode 100644
index 0000000..a19cf4d
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/staticServiceV3/verify.groovy
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ */
+File basepkg = new File( basedir, "target/generated-sources/ojc-plugin/com/msopentech/odatajclient/proxy" );
+assert basepkg.isDirectory() && basepkg.listFiles().length>0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/staticServiceV4/pom.xml
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/staticServiceV4/pom.xml b/ext/pojogen-maven-plugin/src/it/staticServiceV4/pom.xml
new file mode 100644
index 0000000..7c1e208
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/staticServiceV4/pom.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-maven-plugin</artifactId>
+ <version>@project.version@</version>
+
+ <description>A simple IT verifying the basic use case.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>@velocity.version@</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-proxy</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>@project.artifactId@</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <configuration>
+ <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+ <serviceRootURL>http://localhost:9080/StaticService/V4/Static.svc</serviceRootURL>
+ <basePackage>org.apache.olingo.ext.proxy.staticservice</basePackage>
+ </configuration>
+ <id>pojosV3</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>pojosV4</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/staticServiceV4/verify.groovy
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/staticServiceV4/verify.groovy b/ext/pojogen-maven-plugin/src/it/staticServiceV4/verify.groovy
new file mode 100644
index 0000000..a19cf4d
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/staticServiceV4/verify.groovy
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ */
+File basepkg = new File( basedir, "target/generated-sources/ojc-plugin/com/msopentech/odatajclient/proxy" );
+assert basepkg.isDirectory() && basepkg.listFiles().length>0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractMetadataMojo.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractMetadataMojo.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractMetadataMojo.java
new file mode 100644
index 0000000..2347761
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractMetadataMojo.java
@@ -0,0 +1,161 @@
+/*
+ * 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.ext.pojogen;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Parameter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.Velocity;
+
+public abstract class AbstractMetadataMojo extends AbstractMojo {
+
+ /**
+ * Generated files base root.
+ */
+ @Parameter(property = "outputDirectory", required = true)
+ protected String outputDirectory;
+
+ /**
+ * OData service root URL.
+ */
+ @Parameter(property = "serviceRootURL", required = true)
+ protected String serviceRootURL;
+
+ /**
+ * Base package.
+ */
+ @Parameter(property = "basePackage", required = true)
+ protected String basePackage;
+
+ protected final Set<String> namespaces = new HashSet<String>();
+
+ protected static String TOOL_DIR = "ojc-plugin";
+
+ protected AbstractUtility utility;
+
+ protected abstract AbstractUtility getUtility();
+
+ protected abstract String getVersion();
+
+ protected File mkdir(final String path) {
+ final File dir = new File(outputDirectory + File.separator + TOOL_DIR + File.separator + path);
+
+ if (dir.exists()) {
+ if (!dir.isDirectory()) {
+ throw new IllegalArgumentException("Invalid path '" + path + "': it is not a directory");
+ }
+ } else {
+ dir.mkdirs();
+ }
+
+ return dir;
+ }
+
+ protected File mkPkgDir(final String path) {
+ return mkdir(basePackage.replace('.', File.separatorChar) + File.separator + path);
+ }
+
+ protected void writeFile(final String name, final File path, final VelocityContext ctx, final Template template,
+ final boolean append) throws MojoExecutionException {
+
+ if (!path.exists()) {
+ throw new IllegalArgumentException("Invalid base path '" + path.getAbsolutePath() + "'");
+ }
+
+ FileWriter writer = null;
+ try {
+ final File toBeWritten = new File(path, name);
+ if (!append && toBeWritten.exists()) {
+ throw new IllegalStateException("File '" + toBeWritten.getAbsolutePath() + "' already exists");
+ }
+ writer = new FileWriter(toBeWritten, append);
+ template.merge(ctx, writer);
+ } catch (IOException e) {
+ throw new MojoExecutionException("Error creating file '" + name + "'", e);
+ } finally {
+ IOUtils.closeQuietly(writer);
+ }
+ }
+
+ protected VelocityContext newContext() {
+
+ final VelocityContext ctx = new VelocityContext();
+
+ ctx.put("utility", getUtility());
+ ctx.put("basePackage", basePackage);
+ ctx.put("schemaName", getUtility().getSchemaName());
+ ctx.put("namespace", getUtility().getNamespace());
+ ctx.put("namespaces", namespaces);
+ ctx.put("odataVersion", getVersion());
+
+ return ctx;
+ }
+
+ protected void parseObj(final File base, final String pkg, final String name, final String out)
+ throws MojoExecutionException {
+
+ parseObj(base, false, pkg, name, out, Collections.<String, Object>emptyMap());
+ }
+
+ protected void parseObj(
+ final File base,
+ final String pkg,
+ final String name,
+ final String out,
+ final Map<String, Object> objs)
+ throws MojoExecutionException {
+
+ parseObj(base, false, pkg, name, out, objs);
+ }
+
+ protected void parseObj(
+ final File base,
+ final boolean append,
+ final String pkg,
+ final String name,
+ final String out,
+ final Map<String, Object> objs)
+ throws MojoExecutionException {
+
+ final VelocityContext ctx = newContext();
+ ctx.put("package", pkg);
+
+ if (objs != null) {
+ for (Map.Entry<String, Object> obj : objs.entrySet()) {
+ if (StringUtils.isNotBlank(obj.getKey()) && obj.getValue() != null) {
+ ctx.put(obj.getKey(), obj.getValue());
+ }
+ }
+ }
+
+ final Template template = Velocity.getTemplate(name + ".vm");
+ writeFile(out, base, ctx, template, append);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
new file mode 100644
index 0000000..e52d278
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
@@ -0,0 +1,411 @@
+/*
+ * 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.ext.pojogen;
+
+import java.io.InputStream;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAction;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmFunction;
+import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
+import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmParameter;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.EdmSingleton;
+import org.apache.olingo.commons.api.edm.EdmStructuredType;
+import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+
+public abstract class AbstractUtility {
+
+ protected static final String FC_TARGET_PATH = "fcTargetPath";
+
+ protected static final String FC_SOURCE_PATH = "fcSourcePath";
+
+ protected static final String FC_KEEP_IN_CONTENT = "fcKeepInContent";
+
+ protected static final String FC_CONTENT_KIND = "fcContentKind";
+
+ protected static final String FC_NS_PREFIX = "fcNSPrefix";
+
+ protected static final String FC_NS_URI = "fcNSURI";
+
+ protected static final String TYPE_SUB_PKG = "types";
+
+ protected final String basePackage;
+
+ protected final String schemaName;
+
+ protected final String namespace;
+
+ private final Edm metadata;
+
+ private final EdmSchema schema;
+
+ protected final Map<String, List<EdmEntityType>> allEntityTypes = new HashMap<String, List<EdmEntityType>>();
+
+ public AbstractUtility(final Edm metadata, final EdmSchema schema, final String basePackage) {
+ this.basePackage = basePackage;
+ this.schemaName = schema.getAlias();
+ this.namespace = schema.getNamespace();
+ this.metadata = metadata;
+ this.schema = schema;
+
+ collectEntityTypes();
+ }
+
+ public EdmTypeInfo getEdmTypeInfo(final EdmType type) {
+ return new EdmTypeInfo.Builder().setEdm(metadata).
+ setTypeExpression(type.getFullQualifiedName().toString()).build();
+ }
+
+ public EdmTypeInfo getEdmTypeInfo(final String expression) {
+ return new EdmTypeInfo.Builder().setEdm(metadata).setTypeExpression(expression).build();
+ }
+
+ public EdmTypeInfo getEdmType(final EdmSingleton singleton) {
+ return getEdmTypeInfo(singleton.getEntityType().getFullQualifiedName().toString());
+ }
+
+ public Map<String, String> getEntityKeyType(final EdmSingleton singleton) {
+ return getEntityKeyType(singleton.getEntityType());
+ }
+
+ protected Edm getMetadata() {
+ return metadata;
+ }
+
+ protected EdmSchema getSchema() {
+ return schema;
+ }
+
+ public String getNavigationType(final EdmNavigationProperty property) {
+ return property.getType().getFullQualifiedName().toString();
+ }
+
+ public NavPropertyBindingDetails getNavigationBindingDetails(
+ final EdmStructuredType sourceEntityType, final EdmNavigationProperty property) {
+ if (property.containsTarget()) {
+ return new NavPropertyContainsTarget(metadata, property.getType());
+ }
+
+ try {
+ return getNavigationBindings(sourceEntityType, property);
+ } catch (Exception e) {
+ // maybe source entity type without entity set ...
+ return getNavigationBindings(property.getType());
+ }
+ }
+
+ private NavPropertyBindingDetails getNavigationBindings(final EdmStructuredType type) {
+ if (type == null) {
+ throw new IllegalStateException("Invalid navigation property");
+ }
+
+ try {
+ return new NavPropertyBindingDetails(metadata, type);
+ } catch (IllegalStateException ignore) {
+ return getNavigationBindings(type.getBaseType());
+ }
+ }
+
+ private NavPropertyBindingDetails getNavigationBindings(
+ final EdmStructuredType sourceEntityType, final EdmNavigationProperty property) {
+
+ if (sourceEntityType == null) {
+ throw new IllegalStateException("Invalid navigation property " + property.getName());
+ }
+
+ try {
+ return new NavPropertyBindingDetails(metadata, sourceEntityType, property);
+ } catch (IllegalStateException ignore) {
+ return getNavigationBindingDetails(sourceEntityType.getBaseType(), property);
+ }
+ }
+
+ public EdmFunction getFunctionByName(final FullQualifiedName name) {
+
+ final EdmSchema targetSchema = metadata.getSchema(name.getNamespace());
+
+ if (targetSchema != null) {
+ for (EdmFunction function : targetSchema.getFunctions()) {
+ if (function.getName().equals(name.getName())) {
+ return function;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public EdmAction getActionByName(final FullQualifiedName name) {
+
+ final EdmSchema targetSchema = metadata.getSchema(name.getNamespace());
+
+ if (targetSchema != null) {
+ for (EdmAction action : targetSchema.getActions()) {
+ if (action.getName().equals(name.getName())) {
+ return action;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public List<EdmFunction> getFunctionsBoundTo(final String typeExpression, final boolean collection) {
+
+ final List<EdmFunction> result = new ArrayList<EdmFunction>();
+
+ for (EdmSchema sch : getMetadata().getSchemas()) {
+ for (EdmFunction function : sch.getFunctions()) {
+ if (function.isBound()) {
+ final EdmParameter bound = function.getParameterNames().isEmpty()
+ ? null : function.getParameter(function.getParameterNames().get(0));
+
+ if (bound != null
+ && isSameType(typeExpression, bound.getType().getFullQualifiedName().toString(), false)
+ && ((bound.isCollection() && collection) || (!bound.isCollection() && !collection))) {
+ result.add(function);
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ public List<EdmAction> getActionsBoundTo(final String typeExpression, final boolean collection) {
+
+ final List<EdmAction> result = new ArrayList<EdmAction>();
+
+ for (EdmSchema sch : getMetadata().getSchemas()) {
+ for (EdmAction action : sch.getActions()) {
+ if (action.isBound()) {
+ final EdmParameter bound = action.getParameterNames().isEmpty()
+ ? null : action.getParameter(action.getParameterNames().get(0));
+
+ if (bound != null
+ && isSameType(typeExpression, bound.getType().getFullQualifiedName().toString(), false)
+ && ((bound.isCollection() && collection) || (!bound.isCollection() && !collection))) {
+ result.add(action);
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ private void collectEntityTypes() {
+ for (EdmSchema _schema : getMetadata().getSchemas()) {
+ allEntityTypes.put(_schema.getNamespace(), new ArrayList<EdmEntityType>(_schema.getEntityTypes()));
+ if (StringUtils.isNotBlank(_schema.getAlias())) {
+ allEntityTypes.put(_schema.getAlias(), new ArrayList<EdmEntityType>(_schema.getEntityTypes()));
+ }
+ }
+ }
+
+ public String getJavaType(final EdmType type, final Boolean forceCollection) {
+ return getJavaType(type.getFullQualifiedName().toString(), forceCollection);
+ }
+
+ public String getJavaType(final EdmType type) {
+ return getJavaType(type, false);
+ }
+
+ public String getJavaType(final EdmEntityType entityType, final Boolean forceCollection) {
+ return getJavaType(entityType.getFullQualifiedName().toString(), forceCollection);
+ }
+
+ public String getJavaType(final EdmEntityType entityType) {
+ return getJavaType(entityType, false);
+ }
+
+ public String getJavaType(final String typeExpression) {
+ return getJavaType(typeExpression, false);
+ }
+
+ public String getJavaType(final String typeExpression, final boolean forceCollection) {
+ final StringBuilder res = new StringBuilder();
+
+ final EdmTypeInfo edmType = getEdmTypeInfo(typeExpression);
+
+ if ((forceCollection || edmType.isCollection()) && !edmType.isEntityType()) {
+ res.append("Collection<");
+ }
+
+ if ("Edm.Stream".equals(typeExpression)) {
+ res.append(InputStream.class.getName());
+ } else if (edmType.isPrimitiveType()) {
+ final Class<?> clazz = EdmPrimitiveTypeFactory.getInstance(edmType.getPrimitiveTypeKind()).getDefaultType();
+ res.append((clazz.isAssignableFrom(Calendar.class) ? Timestamp.class : clazz).getSimpleName());
+ } else if (edmType.isComplexType()) {
+ res.append(basePackage).append('.').
+ append(edmType.getFullQualifiedName().getNamespace().toLowerCase()). // namespace
+ append('.').append(TYPE_SUB_PKG).append('.').
+ append(capitalize(edmType.getComplexType().getName())); // ComplexType capitalized name
+ } else if (edmType.isEntityType()) {
+ res.append(basePackage).append('.').
+ append(edmType.getFullQualifiedName().getNamespace().toLowerCase()). // namespace
+ append('.').append(TYPE_SUB_PKG).append('.').
+ append(capitalize(edmType.getEntityType().getName())); // EntityType capitalized name
+ } else if (edmType.isEnumType()) {
+ res.append(basePackage).append('.').
+ append(edmType.getFullQualifiedName().getNamespace().toLowerCase()). // namespace
+ append('.').append(TYPE_SUB_PKG).append('.').
+ append(capitalize(edmType.getEnumType().getName()));
+ } else {
+ throw new IllegalArgumentException("Invalid type expression '" + typeExpression + "'");
+ }
+
+ if (forceCollection || edmType.isCollection()) {
+ if (edmType.isEntityType()) {
+ res.append("Collection");
+ } else {
+ res.append(">");
+ }
+ }
+
+ return res.toString();
+ }
+
+ public EdmTypeInfo getEdmType(final EdmEntitySet entitySet) {
+ return getEdmTypeInfo(entitySet.getEntityType().getFullQualifiedName().toString());
+ }
+
+ public Map<String, String> getEntityKeyType(final EdmEntitySet entitySet) {
+ return getEntityKeyType(getEdmType(entitySet).getEntityType());
+ }
+
+ public Map<String, String> getEntityKeyType(final EdmEntityType entityType) {
+ EdmEntityType baseType = entityType;
+ while (CollectionUtils.isEmpty(baseType.getKeyPredicateNames()) && baseType.getBaseType() != null) {
+ baseType = getEdmTypeInfo(baseType.getBaseType().getFullQualifiedName().toString()).getEntityType();
+ }
+
+ final Map<String, String> res = new HashMap<String, String>();
+ for (EdmKeyPropertyRef pref : baseType.getKeyPropertyRefs()) {
+ res.put(pref.getKeyPropertyName(),
+ getJavaType(pref.getProperty().getType().getFullQualifiedName().toString()));
+ }
+
+ return res;
+ }
+
+ public final String getNameInNamespace(final String name) {
+ return getSchema().getNamespace() + "." + name;
+ }
+
+ public boolean isSameType(
+ final String entityTypeExpression, final String fullTypeExpression, final boolean collection) {
+
+ final Set<String> types = new HashSet<String>(2);
+
+ types.add((collection ? "Collection(" : StringUtils.EMPTY)
+ + getNameInNamespace(entityTypeExpression)
+ + (collection ? ")" : StringUtils.EMPTY));
+ if (StringUtils.isNotBlank(getSchema().getAlias())) {
+ types.add((collection ? "Collection(" : StringUtils.EMPTY)
+ + getSchema().getAlias() + "." + entityTypeExpression
+ + (collection ? ")" : StringUtils.EMPTY));
+ }
+
+ return types.contains(fullTypeExpression);
+ }
+
+ private void populateDescendants(final EdmTypeInfo base, final List<String> descendants) {
+ for (Map.Entry<String, List<EdmEntityType>> entry : allEntityTypes.entrySet()) {
+ for (EdmEntityType type : entry.getValue()) {
+ if (type.getBaseType() != null
+ && base.getFullQualifiedName().equals(type.getBaseType().getFullQualifiedName())) {
+
+ final EdmTypeInfo entityTypeInfo = getEdmTypeInfo(type.getFullQualifiedName().toString());
+
+ descendants.add(entityTypeInfo.getFullQualifiedName().toString());
+ populateDescendants(entityTypeInfo, descendants);
+ }
+ }
+ }
+ }
+
+ public List<String> getDescendantsOrSelf(final EdmTypeInfo entityType) {
+ final List<String> descendants = new ArrayList<String>();
+
+ descendants.add(entityType.getFullQualifiedName().toString());
+ populateDescendants(entityType, descendants);
+
+ return descendants;
+ }
+
+ public String getBasePackage() {
+ return basePackage;
+ }
+
+ public String getSchemaName() {
+ return schemaName;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public String capitalize(final String str) {
+ return StringUtils.capitalize(str);
+ }
+
+ public String uncapitalize(final String str) {
+ return StringUtils.uncapitalize(str);
+ }
+
+ public Map<String, String> getFcProperties(final EdmProperty property) {
+ return Collections.<String, String>emptyMap();
+ }
+
+ public final String getNameFromNS(final String ns) {
+ return getNameFromNS(ns, false);
+ }
+
+ public final String getNameFromNS(final String ns, final boolean toLowerCase) {
+ String res = null;
+
+ if (StringUtils.isNotBlank(ns)) {
+ final int lastpt = ns.lastIndexOf('.');
+ res = ns.substring(lastpt < 0 ? 0 : lastpt + 1);
+ res = toLowerCase ? res.toLowerCase() : res;
+ }
+
+ return res;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/NavPropertyBindingDetails.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/NavPropertyBindingDetails.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/NavPropertyBindingDetails.java
new file mode 100644
index 0000000..27555bc
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/NavPropertyBindingDetails.java
@@ -0,0 +1,141 @@
+/*
+ * 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.ext.pojogen;
+
+import org.apache.olingo.client.api.v3.UnsupportedInV3Exception;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmBindingTarget;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.EdmSingleton;
+import org.apache.olingo.commons.api.edm.EdmStructuredType;
+
+public class NavPropertyBindingDetails {
+
+ protected Edm edm;
+
+ protected EdmSchema schema;
+
+ protected EdmEntityContainer container;
+
+ protected EdmBindingTarget entitySet;
+
+ protected EdmStructuredType type;
+
+ protected NavPropertyBindingDetails() {
+ }
+
+ public NavPropertyBindingDetails(final Edm edm, final EdmStructuredType type) {
+ this.edm = edm;
+ this.type = type;
+ this.entitySet = getNavigationBindingDetails(type);
+ this.container = this.entitySet.getEntityContainer();
+ this.schema = edm.getSchema(container.getNamespace());
+ }
+
+ public NavPropertyBindingDetails(
+ final Edm edm, final EdmStructuredType sourceType, final EdmNavigationProperty property) {
+ this.edm = edm;
+ this.entitySet = getNavigationBindingDetails(sourceType, property);
+ this.container = this.entitySet.getEntityContainer();
+ this.schema = edm.getSchema(container.getNamespace());
+ this.type = entitySet.getEntityType();
+ }
+
+ private EdmBindingTarget getNavigationBindingDetails(final EdmStructuredType type) {
+ for (EdmSchema sc : edm.getSchemas()) {
+ for (EdmEntityContainer c : sc.getEntityContainers()) {
+ for (EdmEntitySet es : c.getEntitySets()) {
+ if (es.getEntityType().getFullQualifiedName().equals(type.getFullQualifiedName())) {
+ return es;
+ }
+ }
+
+ try {
+ for (EdmSingleton s : c.getSingletons()) {
+ if (s.getEntityType().getFullQualifiedName().equals(type.getFullQualifiedName())) {
+ return s;
+ }
+ }
+ } catch (UnsupportedInV3Exception ignore) {
+ // ignore
+ }
+ }
+
+ }
+
+ throw new IllegalStateException("EntitySet for '" + type.getName() + "' not found");
+ }
+
+ private EdmBindingTarget getNavigationBindingDetails(
+ final EdmStructuredType sourceType, final EdmNavigationProperty property) {
+
+ for (EdmSchema sc : edm.getSchemas()) {
+ for (EdmEntityContainer c : sc.getEntityContainers()) {
+ for (EdmEntitySet es : c.getEntitySets()) {
+ if (es.getEntityType().getFullQualifiedName().equals(sourceType.getFullQualifiedName())) {
+ for (EdmNavigationPropertyBinding binding : es.getNavigationPropertyBindings()) {
+ if (binding.getPath().equals(property.getName())
+ || binding.getPath().endsWith("/" + property.getName())) {
+ return es.getRelatedBindingTarget(binding.getPath());
+ }
+ }
+ }
+ }
+
+ try {
+ for (EdmSingleton s : c.getSingletons()) {
+ if (s.getEntityType().getFullQualifiedName().equals(sourceType.getFullQualifiedName())) {
+ for (EdmNavigationPropertyBinding binding : s.getNavigationPropertyBindings()) {
+ if (binding.getPath().equals(property.getName())
+ || binding.getPath().endsWith("/" + property.getName())) {
+ return s.getRelatedBindingTarget(binding.getPath());
+ }
+ }
+ }
+ }
+ } catch (UnsupportedInV3Exception ignore) {
+ // ignore
+ }
+ }
+ }
+
+ throw new IllegalStateException(
+ "Navigation property '" + sourceType.getName() + "." + property.getName() + "' not valid");
+ }
+
+ public EdmSchema getSchema() {
+ return schema;
+ }
+
+ public EdmEntityContainer getContainer() {
+ return container;
+ }
+
+ public EdmBindingTarget getEntitySet() {
+ return entitySet;
+ }
+
+ public EdmStructuredType getType() {
+ return type;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/NavPropertyContainsTarget.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/NavPropertyContainsTarget.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/NavPropertyContainsTarget.java
new file mode 100644
index 0000000..54ce6fe
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/NavPropertyContainsTarget.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.ext.pojogen;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+
+public class NavPropertyContainsTarget extends NavPropertyBindingDetails {
+
+ public NavPropertyContainsTarget(final Edm edm, final EdmEntityType type) {
+ super();
+ this.edm = edm;
+ this.entitySet = null;
+ this.container = null;
+ this.type = type;
+ schema = edm.getSchema(type.getNamespace());
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V3MetadataMojo.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V3MetadataMojo.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V3MetadataMojo.java
new file mode 100644
index 0000000..acd9f75
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V3MetadataMojo.java
@@ -0,0 +1,184 @@
+/*
+ * 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.ext.pojogen;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.velocity.app.Velocity;
+import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
+
+/**
+ * POJOs generator.
+ */
+@Mojo(name = "pojosV3", defaultPhase = LifecyclePhase.PROCESS_SOURCES)
+public class V3MetadataMojo extends AbstractMetadataMojo {
+
+ @Override
+ protected V3Utility getUtility() {
+ return (V3Utility) utility;
+ }
+
+ @Override
+ protected String getVersion() {
+ return ODataServiceVersion.V30.name().toLowerCase();
+ }
+
+ @Override
+ public void execute() throws MojoExecutionException {
+ if (new File(outputDirectory + File.separator + TOOL_DIR).exists()) {
+ getLog().info("Nothing to do because " + TOOL_DIR + " directory already exists. Clean to update.");
+ return;
+ }
+
+ try {
+ Velocity.addProperty(Velocity.RESOURCE_LOADER, "class");
+ Velocity.addProperty("class.resource.loader.class", ClasspathResourceLoader.class.getName());
+
+ final Edm metadata =
+ ODataClientFactory.getV3().getRetrieveRequestFactory().getMetadataRequest(serviceRootURL).execute().
+ getBody();
+
+ if (metadata == null) {
+ throw new IllegalStateException("Metadata not found");
+ }
+
+ for (EdmSchema schema : metadata.getSchemas()) {
+ namespaces.add(schema.getNamespace().toLowerCase());
+ }
+
+ final Set<String> complexTypeNames = new HashSet<String>();
+ final File services = mkdir("META-INF/services");
+
+ for (EdmSchema schema : metadata.getSchemas()) {
+ utility = new V3Utility(metadata, schema, basePackage);
+
+ // write package-info for the base package
+ final String schemaPath = utility.getNamespace().toLowerCase().replace('.', File.separatorChar);
+ final File base = mkPkgDir(schemaPath);
+ final String pkg = basePackage + "." + utility.getNamespace().toLowerCase();
+ parseObj(base, pkg, "package-info", "package-info.java");
+
+ // write package-info for types package
+ final File typesBaseDir = mkPkgDir(schemaPath + "/types");
+ final String typesPkg = pkg + ".types";
+ parseObj(typesBaseDir, typesPkg, "package-info", "package-info.java");
+
+ final Map<String, Object> objs = new HashMap<String, Object>();
+
+ // write types into types package
+ for (EdmEnumType enumType : schema.getEnumTypes()) {
+ final String className = utility.capitalize(enumType.getName());
+ objs.clear();
+ objs.put("enumType", enumType);
+ parseObj(typesBaseDir, typesPkg, "enumType", className + ".java", objs);
+ }
+
+ for (EdmComplexType complex : schema.getComplexTypes()) {
+ final String className = utility.capitalize(complex.getName());
+ complexTypeNames.add(typesPkg + "." + className);
+ objs.clear();
+ objs.put("complexType", complex);
+ parseObj(typesBaseDir, typesPkg, "complexType", className + ".java", objs);
+ }
+
+ for (EdmEntityType entity : schema.getEntityTypes()) {
+ objs.clear();
+ objs.put("entityType", entity);
+
+ final Map<String, String> keys;
+
+ EdmEntityType baseType = null;
+ if (entity.getBaseType() == null) {
+ keys = getUtility().getEntityKeyType(entity);
+ } else {
+ baseType = entity.getBaseType();
+ objs.put("baseType", getUtility().getJavaType(baseType.getFullQualifiedName().toString()));
+ while (baseType.getBaseType() != null) {
+ baseType = baseType.getBaseType();
+ }
+ keys = getUtility().getEntityKeyType(baseType);
+ }
+
+ if (keys.size() > 1) {
+ // create compound key class
+ final String keyClassName = utility.capitalize(baseType == null
+ ? entity.getName()
+ : baseType.getName()) + "Key";
+ objs.put("keyRef", keyClassName);
+
+ if (entity.getBaseType() == null) {
+ objs.put("keys", keys);
+ parseObj(typesBaseDir, typesPkg, "entityTypeKey", keyClassName + ".java", objs);
+ }
+ }
+
+ parseObj(typesBaseDir, typesPkg, "entityType",
+ utility.capitalize(entity.getName()) + ".java", objs);
+ parseObj(typesBaseDir, typesPkg, "entityCollection",
+ utility.capitalize(entity.getName()) + "Collection.java", objs);
+ }
+
+ // write container and top entity sets into the base package
+ for (EdmEntityContainer container : schema.getEntityContainers()) {
+ objs.clear();
+ objs.put("container", container);
+ parseObj(base, pkg, "container",
+ utility.capitalize(container.getName()) + ".java", objs);
+
+ for (EdmEntitySet entitySet : container.getEntitySets()) {
+ objs.clear();
+ objs.put("entitySet", entitySet);
+ parseObj(base, pkg, "entitySet",
+ utility.capitalize(entitySet.getName()) + ".java", objs);
+ }
+ }
+
+ parseObj(services, true, null, "services", "org.apache.olingo.ext.proxy.api.AbstractComplexType",
+ Collections.singletonMap("services", (Object) complexTypeNames));
+ }
+ } catch (Exception t) {
+ final StringWriter stringWriter = new StringWriter();
+ final PrintWriter printWriter = new PrintWriter(stringWriter);
+ t.printStackTrace(printWriter);
+ getLog().error(stringWriter.toString());
+
+ throw (t instanceof MojoExecutionException)
+ ? (MojoExecutionException) t
+ : new MojoExecutionException("While executin mojo", t);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V3Utility.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V3Utility.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V3Utility.java
new file mode 100644
index 0000000..47c96e5
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V3Utility.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.ext.pojogen;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+
+public class V3Utility extends AbstractUtility {
+
+ public V3Utility(final Edm metadata, final EdmSchema schema, final String basePackage) {
+ super(metadata, schema, basePackage);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4MetadataMojo.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4MetadataMojo.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4MetadataMojo.java
new file mode 100644
index 0000000..042a558
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4MetadataMojo.java
@@ -0,0 +1,192 @@
+/*
+ * 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.ext.pojogen;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmComplexType;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmEntityType;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.EdmSingleton;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.velocity.app.Velocity;
+import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
+
+/**
+ * POJOs generator.
+ */
+@Mojo(name = "pojosV4", defaultPhase = LifecyclePhase.PROCESS_SOURCES)
+public class V4MetadataMojo extends AbstractMetadataMojo {
+
+ @Override
+ protected V4Utility getUtility() {
+ return (V4Utility) utility;
+ }
+
+ @Override
+ protected String getVersion() {
+ return ODataServiceVersion.V40.name().toLowerCase();
+ }
+
+ @Override
+ public void execute() throws MojoExecutionException {
+ if (new File(outputDirectory + File.separator + TOOL_DIR).exists()) {
+ getLog().info("Nothing to do because " + TOOL_DIR + " directory already exists. Clean to update.");
+ return;
+ }
+
+ try {
+ Velocity.addProperty(Velocity.RESOURCE_LOADER, "class");
+ Velocity.addProperty("class.resource.loader.class", ClasspathResourceLoader.class.getName());
+
+ final Edm metadata =
+ ODataClientFactory.getV4().getRetrieveRequestFactory().getMetadataRequest(serviceRootURL).execute().
+ getBody();
+
+ if (metadata == null) {
+ throw new IllegalStateException("Metadata not found");
+ }
+
+ for (EdmSchema schema : metadata.getSchemas()) {
+ namespaces.add(schema.getNamespace().toLowerCase());
+ }
+
+ final Set<String> complexTypeNames = new HashSet<String>();
+ final File services = mkdir("META-INF/services");
+
+ for (EdmSchema schema : metadata.getSchemas()) {
+ utility = new V4Utility(metadata, schema, basePackage);
+
+ // write package-info for the base package
+ final String schemaPath = utility.getNamespace().toLowerCase().replace('.', File.separatorChar);
+ final File base = mkPkgDir(schemaPath);
+ final String pkg = basePackage + "." + utility.getNamespace().toLowerCase();
+ parseObj(base, pkg, "package-info", "package-info.java");
+
+ // write package-info for types package
+ final File typesBaseDir = mkPkgDir(schemaPath + "/types");
+ final String typesPkg = pkg + ".types";
+ parseObj(typesBaseDir, typesPkg, "package-info", "package-info.java");
+
+ final Map<String, Object> objs = new HashMap<String, Object>();
+
+ // write types into types package
+ for (EdmEnumType enumType : schema.getEnumTypes()) {
+ final String className = utility.capitalize(enumType.getName());
+ objs.clear();
+ objs.put("enumType", enumType);
+ parseObj(typesBaseDir, typesPkg, "enumType", className + ".java", objs);
+ }
+
+ for (EdmComplexType complex : schema.getComplexTypes()) {
+ final String className = utility.capitalize(complex.getName());
+ complexTypeNames.add(typesPkg + "." + className);
+ objs.clear();
+ objs.put("complexType", complex);
+ parseObj(typesBaseDir, typesPkg, "complexType", className + ".java", objs);
+ }
+
+ for (EdmEntityType entity : schema.getEntityTypes()) {
+ objs.clear();
+ objs.put("entityType", entity);
+
+ final Map<String, String> keys;
+
+ EdmEntityType baseType = null;
+ if (entity.getBaseType() == null) {
+ keys = getUtility().getEntityKeyType(entity);
+ } else {
+ baseType = entity.getBaseType();
+ objs.put("baseType", getUtility().getJavaType(baseType.getFullQualifiedName().toString()));
+ while (baseType.getBaseType() != null) {
+ baseType = baseType.getBaseType();
+ }
+ keys = getUtility().getEntityKeyType(baseType);
+ }
+
+ if (keys.size() > 1) {
+ // create compound key class
+ final String keyClassName = utility.capitalize(baseType == null
+ ? entity.getName()
+ : baseType.getName()) + "Key";
+ objs.put("keyRef", keyClassName);
+
+ if (entity.getBaseType() == null) {
+ objs.put("keys", keys);
+ parseObj(typesBaseDir, typesPkg, "entityTypeKey", keyClassName + ".java", objs);
+ }
+ }
+
+ parseObj(typesBaseDir, typesPkg, "entityType",
+ utility.capitalize(entity.getName()) + ".java", objs);
+ parseObj(typesBaseDir, typesPkg, "entityCollection",
+ utility.capitalize(entity.getName()) + "Collection.java", objs);
+ }
+
+ // write container and top entity sets into the base package
+ for (EdmEntityContainer container : schema.getEntityContainers()) {
+ objs.clear();
+ objs.put("container", container);
+ parseObj(base, pkg, "container",
+ utility.capitalize(container.getName()) + ".java", objs);
+
+ for (EdmEntitySet entitySet : container.getEntitySets()) {
+ objs.clear();
+ objs.put("entitySet", entitySet);
+ parseObj(base, pkg, "entitySet",
+ utility.capitalize(entitySet.getName()) + ".java", objs);
+ }
+
+ for (EdmSingleton singleton : container.getSingletons()) {
+ objs.clear();
+ objs.put("singleton", singleton);
+ parseObj(base, pkg, "singleton",
+ utility.capitalize(singleton.getName()) + ".java", objs);
+ }
+ }
+
+ parseObj(services, true, null, "services", "org.apache.olingo.ext.proxy.api.AbstractComplexType",
+ Collections.singletonMap("services", (Object) complexTypeNames));
+ }
+ } catch (Exception t) {
+ final StringWriter stringWriter = new StringWriter();
+ final PrintWriter printWriter = new PrintWriter(stringWriter);
+ t.printStackTrace(printWriter);
+ getLog().error(stringWriter.toString());
+
+ throw (t instanceof MojoExecutionException)
+ ? (MojoExecutionException) t
+ : new MojoExecutionException("While executin mojo", t);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4Utility.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4Utility.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4Utility.java
new file mode 100644
index 0000000..874e415
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4Utility.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.ext.pojogen;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+
+public class V4Utility extends AbstractUtility {
+
+ public V4Utility(final Edm metadata, final EdmSchema schema, final String basePackage) {
+ super(metadata, schema, basePackage);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/resources/complexType.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/complexType.vm b/ext/pojogen-maven-plugin/src/main/resources/complexType.vm
new file mode 100644
index 0000000..683739c
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/complexType.vm
@@ -0,0 +1,48 @@
+#*
+ * 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 ${package};
+
+import org.apache.olingo.ext.proxy.api.annotations.Namespace;
+import org.apache.olingo.ext.proxy.api.annotations.ComplexType;
+import org.apache.olingo.ext.proxy.api.annotations.Property;
+import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
+#foreach($ns in $namespaces)
+import ${basePackage}.${ns}.*;
+import ${basePackage}.${ns}.types.*;
+#end
+
+// EdmSimpleType property imports
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.UUID;
+import java.io.Serializable;
+import java.util.Collection;
+import java.sql.Timestamp;
+import javax.xml.datatype.Duration;
+
+#parse( "${odataVersion}/complexType.vm" )
+}
[2/4] [OLINGO-261] providing basics for pojo generator and proxy
annotations
Posted by fm...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/resources/container.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/container.vm b/ext/pojogen-maven-plugin/src/main/resources/container.vm
new file mode 100644
index 0000000..e37ba10
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/container.vm
@@ -0,0 +1,107 @@
+#*
+ * 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.
+ *#
+#set( $clsSuffix = ".class" )
+package ${package};
+
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.ext.proxy.api.annotations.Namespace;
+import org.apache.olingo.ext.proxy.api.annotations.EntityContainer;
+import org.apache.olingo.ext.proxy.api.annotations.Operation;
+import org.apache.olingo.ext.proxy.api.annotations.Parameter;
+import org.apache.olingo.ext.proxy.api.AbstractContainer;
+import org.apache.olingo.ext.proxy.api.OperationType;
+#foreach($ns in $namespaces)
+import ${basePackage}.${ns}.*;
+import ${basePackage}.${ns}.types.*;
+#end
+
+// EdmSimpleType property imports
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.UUID;
+import java.io.Serializable;
+import java.util.Collection;
+import java.sql.Timestamp;
+import javax.xml.datatype.Duration;
+
+@Namespace("$namespace")
+@EntityContainer(name = "$container.Name",
+ isDefaultEntityContainer = $container.Default)
+public interface $utility.capitalize($container.Name) extends AbstractContainer {
+
+#foreach($entitySet in $container.EntitySets)
+ $utility.capitalize($entitySet.Name) get$utility.capitalize($entitySet.Name)();
+
+#end
+
+#parse( "${odataVersion}/container.vm" )
+
+ Operations operations();
+
+ public interface Operations {
+ #foreach($operation in $container.FunctionImports)
+ #foreach($function in $operation.UnboundFunctions)
+ @Operation(name = "$function.Name",
+ type = OperationType.FUNCTION,
+ isComposable = $function.Composable#if($function.ReturnType),
+ returnType = "#if( $function.ReturnType.Collection )Collection(#end$function.ReturnType.Type.FullQualifiedName.toString()#if( $function.ReturnType.Collection ))#end"#end)
+ #if($function.ReturnType)$utility.getJavaType($function.ReturnType.Type, $function.ReturnType.Collection)#{else}void#end $utility.uncapitalize($function.Name)(
+ #if($function.ParameterNames)
+ #set( $count = $function.ParameterNames.size() )#*
+ *##foreach($paramName in $function.ParameterNames)#*
+ *##set( $count = $count - 1 )#*
+ *##set( $param = $function.getParameter($paramName) )#*
+ *# @Parameter(name = "$param.Name", type = "#if( $param.Collection )Collection(#end$param.Type.FullQualifiedName.toString()#if( $param.Collection ))#end", nullable = $param.Nullable) $utility.getJavaType($param.Type, $param.Collection) $utility.uncapitalize($param.Name)#if( $count > 0 ), #end
+
+ #end#*
+ *##end);
+
+ #end
+ #end
+
+ #foreach($operation in $container.ActionImports)
+ #set( $action = $operation.UnboundAction )
+ #if($action)
+ @Operation(name = "$action.Name",
+ type = OperationType.ACTION#if($action.ReturnType),
+ returnType = "#if( $action.ReturnType.Collection )Collection(#end$action.ReturnType.Type.FullQualifiedName.toString()#if( $action.ReturnType.Collection ))#end"#end)
+ #if($action.ReturnType)$utility.getJavaType($action.ReturnType.Type, $action.ReturnType.Collection)#{else}void#end $utility.uncapitalize($action.Name)(
+ #if($action.ParameterNames)
+ #set( $count = $action.ParameterNames.size() )#*
+ *##foreach($paramName in $action.ParameterNames)#*
+ *##set( $count = $count - 1 )#*
+ *##set( $param = $action.getParameter($paramName) )#*
+ *# @Parameter(name = "$param.Name", type = "#if( $param.Collection )Collection(#end$param.Type.FullQualifiedName.toString()#if( $param.Collection ))#end", nullable = $param.Nullable) $utility.getJavaType($param.Type, $param.Collection) $utility.uncapitalize($param.Name)#if( $count > 0 ), #end
+
+ #end#*
+ *##end);
+ #set( $action = false )
+
+ #end
+ #end
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/resources/entityCollection.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/entityCollection.vm b/ext/pojogen-maven-plugin/src/main/resources/entityCollection.vm
new file mode 100644
index 0000000..4f7a6a6
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/entityCollection.vm
@@ -0,0 +1,96 @@
+#*
+ * 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 ${package};
+
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.ext.proxy.api.AbstractEntityCollection;
+import org.apache.olingo.ext.proxy.api.OperationType;
+import org.apache.olingo.ext.proxy.api.annotations.Operation;
+import org.apache.olingo.ext.proxy.api.annotations.Parameter;
+#foreach($ns in $namespaces)
+import ${basePackage}.${ns}.*;
+import ${basePackage}.${ns}.types.*;
+#end
+
+// EdmSimpleType property imports
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.UUID;
+import java.io.Serializable;
+import java.util.Collection;
+import java.sql.Timestamp;
+import javax.xml.datatype.Duration;
+
+public interface $utility.capitalize($entityType.Name)Collection extends AbstractEntityCollection<$utility.capitalize($entityType.Name)> {
+#set( $functions = $utility.getFunctionsBoundTo($entityType.Name, false) )
+#set( $actions = $utility.getActionsBoundTo($entityType.Name, false) )
+#if( $functions.size() > 0 || $actions.size() > 0 )
+ Operations operations();
+
+ public interface Operations {
+
+ #foreach($operation in $functions)
+ @Operation(name = "$operation.Name",
+ type = OperationType.FUNCTION,
+ isComposable = $operation.Composable#if($operation.ReturnType),
+ returnType = "#if( $operation.ReturnType.Collection )Collection(#end$operation.ReturnType.Type.FullQualifiedName.toString()#if( $operation.ReturnType.Collection ))#end"#end)
+ #if($operation.ReturnType)$utility.getJavaType($operation.ReturnType.Type, $operation.ReturnType.Collection)#{else}void#end $utility.uncapitalize($operation.Name)(
+ #if($operation.ParameterNames)
+ #set( $count = $operation.ParameterNames.size() )#*
+ *##foreach($paramName in $operation.ParameterNames)#*
+ *##set( $count = $count - 1 )#*
+ *##set( $param = $operation.getParameter($paramName) )#*
+ *##if( !$entityType.FullQualifiedName.equals($param.Type.FullQualifiedName) )#*
+ *# @Parameter(name = "$param.Name", type = "#if( $param.Collection )Collection(#end$param.Type.FullQualifiedName.toString()#if( $param.Collection ))#end", nullable = $param.Nullable) $utility.getJavaType($param.Type, $param.Collection) $utility.uncapitalize($param.Name)#if( $count > 0 ), #end
+
+ #end
+ #end#*
+ *##end);
+
+ #end
+
+ #foreach($operation in $actions)
+ @Operation(name = "$operation.Name",
+ type = OperationType.ACTION#if($operation.ReturnType),
+ returnType = "#if( $operation.ReturnType.Collection )Collection(#end$operation.ReturnType.Type.FullQualifiedName.toString()#if( $operation.ReturnType.Collection ))#end"#end)
+ #if($operation.ReturnType)$utility.getJavaType($operation.ReturnType.Type, $operation.ReturnType.Collection)#{else}void#end $utility.uncapitalize($operation.Name)(
+ #if($operation.ParameterNames)
+ #set( $count = $operation.ParameterNames.size() )#*
+ *##foreach($paramName in $operation.ParameterNames)#*
+ *##set( $count = $count - 1 )#*
+ *##set( $param = $operation.getParameter($paramName) )#*
+ *##if( !$entityType.FullQualifiedName.equals($param.Type.FullQualifiedName) )#*
+ *# @Parameter(name = "$param.Name", type = "#if( $param.Collection )Collection(#end$param.Type.FullQualifiedName.toString()#if( $param.Collection ))#end", nullable = $param.Nullable) $utility.getJavaType($param.Type, $param.Collection) $utility.uncapitalize($param.Name)#if( $count > 0 ), #end
+
+ #end
+ #end#*
+ *##end);
+
+ #end
+ }
+#end
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/resources/entitySet.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/entitySet.vm b/ext/pojogen-maven-plugin/src/main/resources/entitySet.vm
new file mode 100644
index 0000000..49c8212
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/entitySet.vm
@@ -0,0 +1,65 @@
+#*
+ * 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 ${package};
+
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.ext.proxy.api.annotations.EntitySet;
+import org.apache.olingo.ext.proxy.api.annotations.CompoundKey;
+import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
+#foreach($ns in $namespaces)
+import ${basePackage}.${ns}.*;
+import ${basePackage}.${ns}.types.*;
+#end
+
+// EdmSimpleType property imports
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.UUID;
+import java.io.Serializable;
+import java.util.Collection;
+import java.sql.Timestamp;
+import javax.xml.datatype.Duration;
+
+#set( $keys = $utility.getEntityKeyType($entitySet) )
+#if( $keys.size() > 1 )
+ #set( $type = $utility.getEdmType($entitySet).EntityType.Name + "Key" )
+#elseif( $keys.size() == 1 )
+ #set( $type = $keys.values().iterator().next() )
+#else
+ #set( $type = "" )
+#end
+
+#parse( "${odataVersion}/entitySet.vm" )
+public interface $utility.capitalize($entitySet.Name) extends AbstractEntitySet<$utility.getJavaType($entitySet.EntityType), $type, $utility.getJavaType($entitySet.EntityType)Collection> {
+
+#foreach( $dos in $utility.getDescendantsOrSelf($utility.getEdmType($entitySet)) )
+ #set( $djt = $utility.getJavaType($dos) )
+ #set( $sIdx = $djt.lastIndexOf('.') + 1 )
+ $djt new$djt.substring($sIdx)();
+ ${djt}Collection new$djt.substring($sIdx)Collection();
+#end
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/resources/entityType.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/entityType.vm b/ext/pojogen-maven-plugin/src/main/resources/entityType.vm
new file mode 100644
index 0000000..e831d93
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/entityType.vm
@@ -0,0 +1,169 @@
+#*
+ * 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.
+ *#
+#set( $clsSuffix = ".class" )
+package ${package};
+
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.ext.proxy.api.annotations.Namespace;
+import org.apache.olingo.ext.proxy.api.annotations.EntityType;
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+import org.apache.olingo.ext.proxy.api.annotations.KeyRef;
+import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
+import org.apache.olingo.ext.proxy.api.annotations.Property;
+import org.apache.olingo.ext.proxy.api.annotations.Operation;
+import org.apache.olingo.ext.proxy.api.annotations.Parameter;
+import org.apache.olingo.ext.proxy.api.AbstractOpenType;
+import org.apache.olingo.ext.proxy.api.OperationType;
+import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
+import org.apache.olingo.client.api.edm.ConcurrencyMode;
+#foreach($ns in $namespaces)
+import ${basePackage}.${ns}.*;
+import ${basePackage}.${ns}.types.*;
+#end
+
+// EdmSimpleType property imports
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.UUID;
+import java.io.Serializable;
+import java.util.Collection;
+import java.sql.Timestamp;
+import javax.xml.datatype.Duration;
+
+#if( $keyRef )@KeyRef(${keyRef}.class)#end
+
+@Namespace("$namespace")
+@EntityType(name = "$entityType.Name",
+ openType = $entityType.isOpenType(),
+ hasStream = $entityType.hasStream(),
+ isAbstract = $entityType.Abstract#if($entityType.getBaseType()),
+ baseType = "$entityType.getBaseType().getFullQualifiedName().toString()"#end)
+public interface $utility.capitalize($entityType.Name) extends #if( $entityType.getBaseType() )$utility.getJavaType($entityType.getBaseType())#{elseif}( $entityType.isOpenType() )AbstractOpenType#{else}Serializable#end {
+
+#set( $keys = [] )
+#foreach($key in $entityType.KeyPropertyRefs)
+ #if(!$keys.add($key.KeyPropertyName)) #stop #end
+#end
+
+#foreach($propertyName in $entityType.PropertyNames)
+ #set($property = $entityType.getProperty($propertyName))
+ #set($fcprops = $utility.getFcProperties($property) )
+ #if($keys.contains($property.Name))@Key#end
+
+ @Property(name = "$property.Name",
+ type = "$property.Type.FullQualifiedName.toString()",
+ nullable = $property.Nullable,
+ defaultValue = "#if($property.getDefaultValue())$property.getDefaultValue()#end",
+ maxLenght = #if($property.getMaxLength() && !$property.getMaxLength().equalsIgnoreCase("max"))$property.getMaxLength()#{else}Integer.MAX_VALUE#end,
+ fixedLenght = #if($property.isFixedLength())$property.isFixedLength()#{else}false#end,
+ precision = #if($property.getPrecision())$property.getPrecision()#{else}0#end,
+ scale = #if($property.getScale())$property.getScale()#{else}0#end,
+ unicode = #if($property.isUnicode())$property.isUnicode()#{else}false#end,
+ collation = "#if($property.getCollation())$property.getCollation()#end",
+ srid = "#if($property.getSRID())$property.getSRID()#end",
+ concurrencyMode = #if($property.getConcurrencyMode())ConcurrencyMode.$property.getConcurrencyMode()#{else}ConcurrencyMode.None#end,
+ fcSourcePath = "#if($fcprops.containsKey("fcSourcePath"))$fcprops.get("fcSourcePath")#end",
+ fcTargetPath = "#if($fcprops.containsKey("fcTargetPath"))$fcprops.get("fcTargetPath")#end",
+ fcContentKind = #if($fcprops.containsKey("fcContentKind"))EdmContentKind.$fcprops.get("fcContentKind")#{else}EdmContentKind.text#end,
+ fcNSPrefix = "#if($fcprops.containsKey("fcNSPrefix"))$fcprops.get("fcNSPrefix")#end",
+ fcNSURI = "#if($fcprops.containsKey("fcNSURI"))$fcprops.get("fcNSURI")#end",
+ fcKeepInContent = #if($fcprops.containsKey("fcKeepInContent"))$fcprops.get("fcKeepInContent")#{else}false#end)
+ $utility.getJavaType($property.Type) get$utility.capitalize($property.Name)();
+
+ void set$utility.capitalize($property.Name)(final $utility.getJavaType($property.Type) _$utility.uncapitalize($property.Name));
+
+#end
+
+#foreach($propertyName in $entityType.NavigationPropertyNames)
+ #set($property = $entityType.getNavigationProperty($propertyName))
+ #set( $type = $utility.getNavigationType($property) )
+ #set( $binding = $utility.getNavigationBindingDetails($entityType, $property) )
+
+ @NavigationProperty(name = "$property.Name",
+ type = "$type",
+ targetSchema = "$binding.Schema.Namespace",
+ targetContainer = "#if($binding.Container)$binding.Container.Name#end",
+ targetEntitySet = "#if($binding.EntitySet)$binding.EntitySet.Name#end")
+ $utility.getJavaType($type, $property.Collection) get$utility.capitalize($property.Name)();
+
+ void set$utility.capitalize($property.Name)(final $utility.getJavaType($type, $property.Collection) _$utility.uncapitalize($property.Name));
+
+#end
+
+#if($entityType.hasStream())
+ void setStream(java.io.InputStream stream);
+
+ java.io.InputStream getStream();
+#end
+
+#set( $functions = $utility.getFunctionsBoundTo($entityType.Name, false) )
+#set( $actions = $utility.getActionsBoundTo($entityType.Name, false) )
+#if( $functions.size() > 0 || $actions.size() > 0 )
+ Operations operations();
+
+ public interface Operations {
+ #foreach($operation in $functions)
+ @Operation(name = "$operation.Name",
+ type = OperationType.FUNCTION,
+ isComposable = $operation.Composable#if($operation.ReturnType),
+ returnType = "#if( $operation.ReturnType.Collection )Collection(#end$operation.ReturnType.Type.FullQualifiedName.toString()#if( $operation.ReturnType.Collection ))#end"#end)
+ #if($operation.ReturnType)$utility.getJavaType($operation.ReturnType.Type, $operation.ReturnType.Collection)#{else}void#end $utility.uncapitalize($operation.Name)(
+ #if($operation.ParameterNames)
+ #set( $count = $operation.ParameterNames.size() )#*
+ *##foreach($paramName in $operation.ParameterNames)#*
+ *##set( $count = $count - 1 )#*
+ *##set( $param = $operation.getParameter($paramName) )#*
+ *##if( !$entityType.FullQualifiedName.equals($param.Type.FullQualifiedName) )#*
+ *# @Parameter(name = "$param.Name", type = "#if( $param.Collection )Collection(#end$param.Type.FullQualifiedName.toString()#if( $param.Collection ))#end", nullable = $param.Nullable) $utility.getJavaType($param.Type, $param.Collection) $utility.uncapitalize($param.Name)#if( $count > 0 ), #end
+
+ #end
+ #end#*
+ *##end);
+
+ #end
+
+ #foreach($operation in $actions)
+ @Operation(name = "$operation.Name",
+ type = OperationType.ACTION#if($operation.ReturnType),
+ returnType = "#if( $operation.ReturnType.Collection )Collection(#end$operation.ReturnType.Type.FullQualifiedName.toString()#if( $operation.ReturnType.Collection ))#end"#end)
+ #if($operation.ReturnType)$utility.getJavaType($operation.ReturnType.Type, $operation.ReturnType.Collection)#{else}void#end $utility.uncapitalize($operation.Name)(
+ #if($operation.ParameterNames)
+ #set( $count = $operation.ParameterNames.size() )#*
+ *##foreach($paramName in $operation.ParameterNames)#*
+ *##set( $count = $count - 1 )#*
+ *##set( $param = $operation.getParameter($paramName) )#*
+ *##if( !$entityType.FullQualifiedName.equals($param.Type.FullQualifiedName) )#*
+ *# @Parameter(name = "$param.Name", type = "#if( $param.Collection )Collection(#end$param.Type.FullQualifiedName.toString()#if( $param.Collection ))#end", nullable = $param.Nullable) $utility.getJavaType($param.Type, $param.Collection) $utility.uncapitalize($param.Name)#if( $count > 0 ), #end
+
+ #end
+ #end#*
+ *##end);
+
+ #end
+ }
+#end
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/resources/entityTypeKey.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/entityTypeKey.vm b/ext/pojogen-maven-plugin/src/main/resources/entityTypeKey.vm
new file mode 100644
index 0000000..a4392bb
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/entityTypeKey.vm
@@ -0,0 +1,69 @@
+#*
+ * 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 ${package};
+
+import org.apache.olingo.ext.proxy.api.annotations.EntityType;
+import org.apache.olingo.ext.proxy.api.annotations.Key;
+import org.apache.olingo.ext.proxy.api.annotations.CompoundKey;
+import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
+import org.apache.olingo.ext.proxy.api.annotations.NavigationProperty;
+import org.apache.olingo.ext.proxy.api.annotations.Property;
+import org.apache.olingo.ext.proxy.api.AbstractEntityKey;
+import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
+import org.apache.olingo.client.api.edm.ConcurrencyMode;
+#foreach($ns in $namespaces)
+import ${basePackage}.${ns}.*;
+import ${basePackage}.${ns}.types.*;
+#end
+
+// EdmSimpleType property imports
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.UUID;
+import java.io.Serializable;
+import java.util.Collection;
+import java.sql.Timestamp;
+import javax.xml.datatype.Duration;
+
+@CompoundKey
+public class $keyRef extends AbstractEntityKey {
+#set ( $count = 0 )
+#foreach ($entry in $keys.entrySet())
+
+ private $entry.getValue() _$utility.uncapitalize($entry.getKey());
+
+ @CompoundKeyElement(name = "$entry.getKey()", position = $count)
+ public $entry.getValue() get$utility.capitalize($entry.getKey())() {
+ return _$utility.uncapitalize($entry.getKey());
+ }
+
+ public void set$utility.capitalize($entry.getKey())(final $entry.getValue() _$utility.uncapitalize($entry.getKey())) {
+ this._$utility.uncapitalize($entry.getKey()) = _$utility.uncapitalize($entry.getKey());
+ }#*
+ *##set ( $count = $count + 1 )
+
+#end}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/resources/enumType.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/enumType.vm b/ext/pojogen-maven-plugin/src/main/resources/enumType.vm
new file mode 100644
index 0000000..5467613
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/enumType.vm
@@ -0,0 +1,56 @@
+#*
+ * 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 ${package};
+
+import org.apache.olingo.ext.proxy.api.annotations.Namespace;
+import org.apache.olingo.ext.proxy.api.annotations.EnumType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+#set( $enumName = $utility.capitalize($enumType.Name) )
+#set( $count = $enumType.MemberNames.size() )
+#if( $enumType.UnderlyingType )
+ #set( $javatype = $utility.getJavaType($enumType.UnderlyingType) )
+#else
+ #set( $javatype = $utility.getJavaType("Edm.Int32") )
+#end
+
+@Namespace("$namespace")
+@EnumType(name = "$enumType.Name",
+ #if( $enumType.UnderlyingType )underlyingType = EdmPrimitiveTypeKind.${utility.getEdmTypeInfo($enumType.UnderlyingType).PrimitiveTypeKind.name()},
+ #{end}isFlags = $enumType.Flags)
+public enum $enumName {
+#foreach ($memberName in $enumType.MemberNames)#*
+ *##set( $member = $enumType.getMember($memberName) )#*
+ *##set( $count = $count - 1 )
+ $member.Name#if( $member.Value )($member.Value)#set( $valued = 1 )#end#if( $count > 0 ),#elseif( $count <= 0 );#end
+
+#end
+
+#if( $valued )
+ private $javatype value;
+
+ public $javatype getValue(){
+ return this.value;
+ }
+
+ private $enumName(final $javatype value){
+ this.value=value;
+ }
+#end
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/resources/package-info.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/package-info.vm b/ext/pojogen-maven-plugin/src/main/resources/package-info.vm
new file mode 100644
index 0000000..ce11c6a
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/package-info.vm
@@ -0,0 +1,20 @@
+#*
+ * 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 $package;
+
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/resources/services.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/services.vm b/ext/pojogen-maven-plugin/src/main/resources/services.vm
new file mode 100644
index 0000000..94480f3
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/services.vm
@@ -0,0 +1,21 @@
+#*
+ * 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.
+ *#
+#foreach ($service in $services)
+$service
+#end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/resources/singleton.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/singleton.vm b/ext/pojogen-maven-plugin/src/main/resources/singleton.vm
new file mode 100644
index 0000000..7fc2bff
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/singleton.vm
@@ -0,0 +1,48 @@
+#*
+ * 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 ${package};
+
+import org.apache.olingo.ext.proxy.api.AbstractEntitySet;
+import org.apache.olingo.ext.proxy.api.annotations.EntitySet;
+import org.apache.olingo.ext.proxy.api.annotations.Singleton;
+import org.apache.olingo.ext.proxy.api.annotations.CompoundKey;
+import org.apache.olingo.ext.proxy.api.annotations.CompoundKeyElement;
+#foreach($ns in $namespaces)
+import ${basePackage}.${ns}.*;
+import ${basePackage}.${ns}.types.*;
+#end
+
+// EdmSimpleType property imports
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.UUID;
+import java.io.Serializable;
+import java.util.Collection;
+import java.sql.Timestamp;
+
+#parse( "${odataVersion}/singleton.vm" )
+
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/resources/v30/complexType.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/v30/complexType.vm b/ext/pojogen-maven-plugin/src/main/resources/v30/complexType.vm
new file mode 100644
index 0000000..6764408
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/v30/complexType.vm
@@ -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.
+ *#
+@Namespace("$namespace")
+@ComplexType(name = "$complexType.Name")
+public interface $utility.capitalize($complexType.Name) extends Serializable {
+
+#foreach($propertyName in $complexType.PropertyNames)
+ #set($property = $complexType.getProperty($propertyName))
+
+ @Property(name = "$property.Name", type = "$property.Type.FullQualifiedName.toString()", nullable = $property.Nullable)
+ $utility.getJavaType($property.Type) get$utility.capitalize($property.Name)();
+
+ void set$utility.capitalize($property.Name)(final $utility.getJavaType($property.Type) _$utility.uncapitalize($property.Name));
+#end
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/resources/v30/container.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/v30/container.vm b/ext/pojogen-maven-plugin/src/main/resources/v30/container.vm
new file mode 100644
index 0000000..88a989c
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/v30/container.vm
@@ -0,0 +1,19 @@
+#*
+ * 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.
+ *#
+
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/resources/v30/entitySet.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/v30/entitySet.vm b/ext/pojogen-maven-plugin/src/main/resources/v30/entitySet.vm
new file mode 100644
index 0000000..86f2bad
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/v30/entitySet.vm
@@ -0,0 +1,19 @@
+#*
+ * 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.
+ *#
+@EntitySet(name = "$entitySet.Name")
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/resources/v40/complexType.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/v40/complexType.vm b/ext/pojogen-maven-plugin/src/main/resources/v40/complexType.vm
new file mode 100644
index 0000000..92307ec
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/v40/complexType.vm
@@ -0,0 +1,60 @@
+#*
+ * 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.
+ *#
+@Namespace("$namespace")
+@ComplexType(name = "$complexType.Name",
+ isOpenType = $complexType.isOpenType(),
+ isAbstract = $complexType.Abstract#if($complexType.getBaseType()),
+ baseType = "$complexType.getBaseType().getFullQualifiedName().toString()"#end)
+public interface $utility.capitalize($complexType.Name) extends #if($complexType.getBaseType())$utility.getJavaType($complexType.getBaseType().getFullQualifiedName().toString())#{else}Serializable#end {
+
+#foreach($propertyName in $complexType.PropertyNames)
+ #set($property = $complexType.getProperty($propertyName))
+
+ @Property(name = "$property.Name",
+ type = "$property.Type",
+ nullable = $property.Nullable,
+ defaultValue = "#if($property.getDefaultValue())$property.getDefaultValue()#end",
+ maxLenght = #if($property.getMaxLength() && !$property.getMaxLength().equalsIgnoreCase("max"))$property.getMaxLength()#{else}Integer.MAX_VALUE#end,
+ fixedLenght = #if($property.isFixedLength())$property.isFixedLength()#{else}false#end,
+ precision = #if($property.getPrecision())$property.getPrecision()#{else}0#end,
+ scale = #if($property.getScale())$property.getScale()#{else}0#end,
+ unicode = #if($property.isUnicode())$property.isUnicode()#{else}false#end,
+ collation = "#if($property.getCollation())$property.getCollation()#end",
+ srid = "#if($property.getSRID())$property.getSRID()#end")
+ $utility.getJavaType($property.Type) get$utility.capitalize($property.Name)();
+
+ void set$utility.capitalize($property.Name)(final $utility.getJavaType($property.Type) _$utility.uncapitalize($property.Name));
+
+#end
+
+#foreach($propertyName in $complexType.NavigationPropertyNames)
+ #set($property = $complexType.getNavigationProperty($propertyName))
+ #set( $type = $utility.getNavigationType($property) )
+ #set( $binding = $utility.getNavigationBindingDetails($complexType, $property) )
+
+ @NavigationProperty(name = "$property.Name",
+ type = "$type",
+ targetSchema = "$binding.Schema.Namespace",
+ targetContainer = "#if($binding.Container)$binding.Container.Name#end",
+ targetEntitySet = "#if($binding.EntitySet)$binding.EntitySet.Name#end")
+ $utility.getJavaType($type, $property.Collection) get$utility.capitalize($property.Name)();
+
+ void set$utility.capitalize($property.Name)(final $utility.getJavaType($type, $property.Collection) _$utility.uncapitalize($property.Name));
+
+#end
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/resources/v40/container.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/v40/container.vm b/ext/pojogen-maven-plugin/src/main/resources/v40/container.vm
new file mode 100644
index 0000000..fb8c4b3
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/v40/container.vm
@@ -0,0 +1,22 @@
+#*
+ * 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.
+ *#
+#foreach($singleton in $container.Singletons)
+ $utility.capitalize($singleton.Name) get$utility.capitalize($singleton.Name)();
+
+#end
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/resources/v40/entitySet.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/v40/entitySet.vm b/ext/pojogen-maven-plugin/src/main/resources/v40/entitySet.vm
new file mode 100644
index 0000000..cf60af0
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/v40/entitySet.vm
@@ -0,0 +1,19 @@
+#*
+ * 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.
+ *#
+@EntitySet(name = "$entitySet.Name", includeInServiceDocument = $entitySet.IncludeInServiceDocument)
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/main/resources/v40/singleton.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/v40/singleton.vm b/ext/pojogen-maven-plugin/src/main/resources/v40/singleton.vm
new file mode 100644
index 0000000..71cc553
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/resources/v40/singleton.vm
@@ -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.
+ *#
+#set( $keys = $utility.getEntityKeyType($singleton) )
+#if( $keys.size() > 1 )
+ #set( $type = $utility.getEdmType($singleton).EntityType.Name + "Key" )
+#elseif( $keys.size() == 1 )
+ #set( $type = $keys.values().iterator().next() )
+#else
+ #set( $type = "" )
+#end
+
+@Singleton(name = "$singleton.Name")
+public interface $utility.capitalize($singleton.Name) extends AbstractEntitySet<$utility.getJavaType($singleton.EntityType), $type, $utility.getJavaType($singleton.EntityType)Collection> {
+
+#foreach( $dos in $utility.getDescendantsOrSelf($utility.getEdmType($singleton)) )
+ #set( $djt = $utility.getJavaType($dos) )
+ #set( $sIdx = $djt.lastIndexOf('.') + 1 )
+ $djt new$djt.substring($sIdx)();
+#end
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pom.xml
----------------------------------------------------------------------
diff --git a/ext/pom.xml b/ext/pom.xml
index 37c9436..c2667ae 100644
--- a/ext/pom.xml
+++ b/ext/pom.xml
@@ -37,5 +37,7 @@
<modules>
<module>client-core-android</module>
+ <module>pojogen-maven-plugin</module>
+ <module>client-proxy</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/fit/pom.xml
----------------------------------------------------------------------
diff --git a/fit/pom.xml b/fit/pom.xml
index 84a38d6..b47bdf1 100644
--- a/fit/pom.xml
+++ b/fit/pom.xml
@@ -36,6 +36,7 @@
<properties>
<war.maven.plugin.version>2.4</war.maven.plugin.version>
+ <invoker.maven.plugin.version>1.8</invoker.maven.plugin.version>
</properties>
<dependencies>
@@ -107,6 +108,34 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>${invoker.maven.plugin.version}</version>
+ <inherited>true</inherited>
+ <configuration>
+ <debug>true</debug>
+ <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+ <pomIncludes>
+ <pomInclude>*/pom.xml</pomInclude>
+ </pomIncludes>
+ <postBuildHookScript>verify</postBuildHookScript>
+ <goals>
+ <goal>clean</goal>
+ <goal>test-compile</goal>
+ </goals>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${war.maven.plugin.version}</version>
<configuration>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/fit/src/it/staticServiceV3/pom.xml
----------------------------------------------------------------------
diff --git a/fit/src/it/staticServiceV3/pom.xml b/fit/src/it/staticServiceV3/pom.xml
new file mode 100644
index 0000000..0e2d189
--- /dev/null
+++ b/fit/src/it/staticServiceV3/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>pojogen-maven-plugin-v3test</artifactId>
+ <groupId>org.apache.olingo</groupId>
+ <version>@project.version@</version>
+ <name>${project.artifactId}</name>
+ <description>A simple IT verifying the basic use case of pojogen-man-plugin.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <artifactId>pojogen-maven-plugin</artifactId>
+ <groupId>org.apache.olingo</groupId>
+ <version>@project.version@</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <artifactId>client-proxy</artifactId>
+ <groupId>org.apache.olingo</groupId>
+ <version>@project.version@</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>pojogen-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <configuration>
+ <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+ <serviceRootURL>http://localhost:9080/stub/StaticService/V30/Static.svc</serviceRootURL>
+ <basePackage>org.apache.olingo.proxy.staticservice</basePackage>
+ </configuration>
+ <id>pojosV3</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>pojosV3</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/fit/src/it/staticServiceV3/verify.groovy
----------------------------------------------------------------------
diff --git a/fit/src/it/staticServiceV3/verify.groovy b/fit/src/it/staticServiceV3/verify.groovy
new file mode 100644
index 0000000..9bb42a2
--- /dev/null
+++ b/fit/src/it/staticServiceV3/verify.groovy
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ */
+File basepkg = new File( basedir, "target/generated-sources/ojc-plugin/org/apache/olingo/proxy" );
+assert basepkg.isDirectory() && basepkg.listFiles().length>0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/fit/src/it/staticServiceV4/pom.xml
----------------------------------------------------------------------
diff --git a/fit/src/it/staticServiceV4/pom.xml b/fit/src/it/staticServiceV4/pom.xml
new file mode 100644
index 0000000..113b69b
--- /dev/null
+++ b/fit/src/it/staticServiceV4/pom.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>pojogen-maven-plugin-v4test</artifactId>
+ <groupId>org.apache.olingo</groupId>
+ <version>@project.version@</version>
+ <name>${project.artifactId}</name>
+ <description>A simple IT verifying the basic use case of pojogen-man-plugin.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <artifactId>pojogen-maven-plugin</artifactId>
+ <groupId>org.apache.olingo</groupId>
+ <version>@project.version@</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <artifactId>client-proxy</artifactId>
+ <groupId>org.apache.olingo</groupId>
+ <version>@project.version@</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>pojogen-maven-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <configuration>
+ <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+ <serviceRootURL>http://localhost:9080/stub/StaticService/V40/Static.svc</serviceRootURL>
+ <basePackage>org.apache.olingo.proxy.staticservice</basePackage>
+ </configuration>
+ <id>pojosV4</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>pojosV4</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/fit/src/it/staticServiceV4/verify.groovy
----------------------------------------------------------------------
diff --git a/fit/src/it/staticServiceV4/verify.groovy b/fit/src/it/staticServiceV4/verify.groovy
new file mode 100644
index 0000000..9bb42a2
--- /dev/null
+++ b/fit/src/it/staticServiceV4/verify.groovy
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ */
+File basepkg = new File( basedir, "target/generated-sources/ojc-plugin/org/apache/olingo/proxy" );
+assert basepkg.isDirectory() && basepkg.listFiles().length>0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/fit/src/main/resources/V40/metadata.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/V40/metadata.xml b/fit/src/main/resources/V40/metadata.xml
index b51bf0f..5e7c9c6 100644
--- a/fit/src/main/resources/V40/metadata.xml
+++ b/fit/src/main/resources/V40/metadata.xml
@@ -32,6 +32,7 @@
</ComplexType>
<ComplexType Name="CompanyAddress" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Address">
<Property Name="CompanyName" Type="Edm.String" Nullable="false" />
+ <NavigationProperty Name="Contact" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="true" />
</ComplexType>
<EnumType Name="AccessLevel" IsFlags="true">
<Member Name="None" Value="0" />
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/fit/src/test/java/org/apache/olingo/fit/v3/ActionOverloadingTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/ActionOverloadingTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/ActionOverloadingTestITCase.java
index a28b354..de6d62d 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v3/ActionOverloadingTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v3/ActionOverloadingTestITCase.java
@@ -18,9 +18,9 @@
*/
package org.apache.olingo.fit.v3;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertEquals;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -37,6 +37,7 @@ import org.apache.olingo.commons.api.edm.EdmAction;
import org.apache.olingo.commons.api.edm.EdmActionImport;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmSchema;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.core.edm.primitivetype.EdmInt32;
import org.junit.Test;
@@ -124,58 +125,53 @@ public class ActionOverloadingTestITCase extends AbstractTestITCase {
getMetadataRequest(testActionOverloadingServiceRootURL).execute().getBody();
assertNotNull(edm);
- final EdmEntityContainer container = edm.getSchemas().get(0).getEntityContainer();
- assertNotNull(container);
-
- int execs = 0;
- for (EdmActionImport actImp : container.getActionImports()) {
- if ("IncreaseSalaries".equals(actImp.getName())) {
- final Map<String, ODataValue> parameters = new LinkedHashMap<String, ODataValue>(1);
- parameters.put("n", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(5));
-
- // 1. bound to employees
- final EdmAction employeeBound = edm.getBoundAction(
- new FullQualifiedName(container.getNamespace(), actImp.getName()),
- new FullQualifiedName(container.getNamespace(), "Employee"), true);
- assertNotNull(employeeBound);
- assertNull(employeeBound.getReturnType());
-
- final URIBuilder employeeBuilder = getClient().getURIBuilder(testActionOverloadingServiceRootURL).
- appendEntitySetSegment("Person").
- appendDerivedEntityTypeSegment("Microsoft.Test.OData.Services.AstoriaDefaultService.Employee");
- final ODataEntitySet employees = getClient().getRetrieveRequestFactory().getEntitySetRequest(
- employeeBuilder.build()).execute().getBody();
- assertNotNull(employees);
-
- final ODataInvokeResponse<ODataNoContent> employeeRes = getClient().getInvokeRequestFactory().
- <ODataNoContent>getInvokeRequest(employeeBuilder.appendOperationCallSegment(actImp.getName()).build(),
- employeeBound, parameters).execute();
- assertNotNull(employeeRes);
- assertEquals(204, employeeRes.getStatusCode());
- execs++;
-
- // 1. bound to special employees
- final EdmAction specEmpBound = edm.getBoundAction(
- new FullQualifiedName(container.getNamespace(), actImp.getName()),
- new FullQualifiedName(container.getNamespace(), "SpecialEmployee"), true);
- assertNotNull(specEmpBound);
- assertNull(specEmpBound.getReturnType());
-
- final URIBuilder specEmpBuilder = getClient().getURIBuilder(testActionOverloadingServiceRootURL).
- appendEntitySetSegment("Person").
- appendDerivedEntityTypeSegment("Microsoft.Test.OData.Services.AstoriaDefaultService.SpecialEmployee");
- final ODataEntitySet specEmps = getClient().getRetrieveRequestFactory().getEntitySetRequest(
- specEmpBuilder.build()).execute().getBody();
- assertNotNull(specEmps);
-
- final ODataInvokeResponse<ODataNoContent> specEmpsRes = getClient().getInvokeRequestFactory().
- <ODataNoContent>getInvokeRequest(specEmpBuilder.appendOperationCallSegment(actImp.getName()).build(),
- specEmpBound, parameters).execute();
- assertNotNull(specEmpsRes);
- assertEquals(204, specEmpsRes.getStatusCode());
- execs++;
- }
- }
- assertEquals(2, execs);
+ final EdmSchema schema = edm.getSchemas().get(0);
+ assertNotNull(schema);
+
+ EdmAction actImp = edm.getBoundAction(
+ new FullQualifiedName(schema.getNamespace(), "IncreaseSalaries"),
+ new FullQualifiedName(schema.getNamespace(), "Employee"),
+ true);
+
+ final Map<String, ODataValue> parameters = new LinkedHashMap<String, ODataValue>(1);
+ parameters.put("n", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(5));
+
+ // 1. bound to employees
+ assertNotNull(actImp);
+ assertNull(actImp.getReturnType());
+
+ final URIBuilder employeeBuilder = getClient().getURIBuilder(testActionOverloadingServiceRootURL).
+ appendEntitySetSegment("Person").
+ appendDerivedEntityTypeSegment("Microsoft.Test.OData.Services.AstoriaDefaultService.Employee");
+ final ODataEntitySet employees = getClient().getRetrieveRequestFactory().getEntitySetRequest(
+ employeeBuilder.build()).execute().getBody();
+ assertNotNull(employees);
+
+ final ODataInvokeResponse<ODataNoContent> employeeRes = getClient().getInvokeRequestFactory().
+ <ODataNoContent>getInvokeRequest(employeeBuilder.appendOperationCallSegment(actImp.getName()).build(),
+ actImp, parameters).execute();
+ assertNotNull(employeeRes);
+ assertEquals(204, employeeRes.getStatusCode());
+
+ // 2. bound to special employees
+ actImp = edm.getBoundAction(
+ new FullQualifiedName(schema.getNamespace(), "IncreaseSalaries"),
+ new FullQualifiedName(schema.getNamespace(), "SpecialEmployee"),
+ true);
+ assertNotNull(actImp);
+ assertNull(actImp.getReturnType());
+
+ final URIBuilder specEmpBuilder = getClient().getURIBuilder(testActionOverloadingServiceRootURL).
+ appendEntitySetSegment("Person").
+ appendDerivedEntityTypeSegment("Microsoft.Test.OData.Services.AstoriaDefaultService.SpecialEmployee");
+ final ODataEntitySet specEmps = getClient().getRetrieveRequestFactory().getEntitySetRequest(
+ specEmpBuilder.build()).execute().getBody();
+ assertNotNull(specEmps);
+
+ final ODataInvokeResponse<ODataNoContent> specEmpsRes = getClient().getInvokeRequestFactory().
+ <ODataNoContent>getInvokeRequest(specEmpBuilder.appendOperationCallSegment(actImp.getName()).build(),
+ actImp, parameters).execute();
+ assertNotNull(specEmpsRes);
+ assertEquals(204, specEmpsRes.getStatusCode());
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java
index bb23128..ed26215 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java
@@ -19,20 +19,16 @@
package org.apache.olingo.client.core.edm;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.apache.olingo.client.api.edm.xml.v4.BindingTarget;
import org.apache.olingo.client.api.edm.xml.v4.NavigationPropertyBinding;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmBindingTarget;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
import org.apache.olingo.commons.api.edm.EdmTerm;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.Target;
import org.apache.olingo.commons.core.edm.AbstractEdmBindingTarget;
import org.apache.olingo.commons.core.edm.EdmAnnotationHelper;
import org.apache.olingo.commons.core.edm.EdmNavigationPropertyBindingImpl;
@@ -54,41 +50,6 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
}
@Override
- public EdmBindingTarget getRelatedBindingTarget(final String path) {
- EdmBindingTarget bindingTarget = null;
-
- final List<? extends NavigationPropertyBinding> navigationPropertyBindings = target.getNavigationPropertyBindings();
- boolean found = false;
- for (final Iterator<? extends NavigationPropertyBinding> itor = navigationPropertyBindings.iterator(); itor
- .hasNext()
- && !found;) {
-
- final NavigationPropertyBinding binding = itor.next();
- if (binding.getPath().equals(path)) {
- final Target edmTarget = new Target.Builder(binding.getTarget(), container).build();
-
- final EdmEntityContainer entityContainer = edm.getEntityContainer(edmTarget.getEntityContainer());
- if (entityContainer == null) {
- throw new EdmException("Cannot find entity container with name: " + edmTarget.getEntityContainer());
- }
- bindingTarget = entityContainer.getEntitySet(edmTarget.getTargetName());
- if (bindingTarget == null) {
- bindingTarget = entityContainer.getSingleton(edmTarget.getTargetName());
- if (bindingTarget == null) {
- throw new EdmException("Cannot find target with name: " + edmTarget.getTargetName());
- }
-
- found = true;
- } else {
- found = true;
- }
- }
- }
-
- return bindingTarget;
- }
-
- @Override
public List<EdmNavigationPropertyBinding> getNavigationPropertyBindings() {
if (navigationPropertyBindings == null) {
List<? extends NavigationPropertyBinding> providerBindings = target.getNavigationPropertyBindings();
@@ -111,5 +72,4 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
public List<EdmAnnotation> getAnnotations() {
return helper.getAnnotations();
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
index 30127d3..799e439 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
@@ -33,6 +33,7 @@ import org.apache.olingo.client.api.edm.xml.v4.Singleton;
import org.apache.olingo.client.core.edm.v3.EdmActionImportProxy;
import org.apache.olingo.client.core.edm.v3.EdmEntitySetProxy;
import org.apache.olingo.client.core.edm.v3.EdmFunctionImportProxy;
+import org.apache.olingo.client.core.edm.v3.FunctionImportUtils;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmActionImport;
import org.apache.olingo.commons.api.edm.EdmAnnotation;
@@ -169,16 +170,18 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
@Override
protected void loadAllFunctionImports() {
final List<? extends CommonFunctionImport> localFunctionImports = xmlEntityContainer.getFunctionImports();
- if (localFunctionImports != null) {
- for (CommonFunctionImport functionImport : localFunctionImports) {
- EdmFunctionImport edmFunctionImport;
- if (functionImport instanceof org.apache.olingo.client.api.edm.xml.v4.FunctionImport) {
- edmFunctionImport = new EdmFunctionImportImpl(edm, this, functionImport.getName(),
- (org.apache.olingo.client.api.edm.xml.v4.FunctionImport) functionImport);
- } else {
- edmFunctionImport = new EdmFunctionImportProxy(edm, this, functionImport.getName(),
- (org.apache.olingo.client.api.edm.xml.v3.FunctionImport) functionImport);
- }
+ for (CommonFunctionImport functionImport : localFunctionImports) {
+ EdmFunctionImport edmFunctionImport;
+ if (functionImport instanceof org.apache.olingo.client.api.edm.xml.v4.FunctionImport) {
+ edmFunctionImport = new EdmFunctionImportImpl(edm, this, functionImport.getName(),
+ (org.apache.olingo.client.api.edm.xml.v4.FunctionImport) functionImport);
+ functionImports.put(edmFunctionImport.getName(), edmFunctionImport);
+ } else if (FunctionImportUtils.canProxyFunction(
+ (org.apache.olingo.client.api.edm.xml.v3.FunctionImport) functionImport)
+ && !((org.apache.olingo.client.api.edm.xml.v3.FunctionImport) functionImport).isBindable()
+ && !((org.apache.olingo.client.api.edm.xml.v3.FunctionImport) functionImport).isAlwaysBindable()) {
+ edmFunctionImport = new EdmFunctionImportProxy(edm, this, functionImport.getName(),
+ (org.apache.olingo.client.api.edm.xml.v3.FunctionImport) functionImport);
functionImports.put(edmFunctionImport.getName(), edmFunctionImport);
}
}
@@ -216,8 +219,9 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
} else {
@SuppressWarnings("unchecked")
final List<FunctionImport> localFunctionImports = (List<FunctionImport>) xmlEntityContainer.getFunctionImports();
- if (localFunctionImports != null) {
- for (FunctionImport functionImport : localFunctionImports) {
+ for (FunctionImport functionImport : localFunctionImports) {
+ if (!FunctionImportUtils.canProxyFunction(functionImport) && !functionImport.isBindable()
+ && !functionImport.isAlwaysBindable()) {
actionImports.put(functionImport.getName(),
new EdmActionImportProxy(edm, this, functionImport.getName(), functionImport));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java
index 3643dbd..9e8b3bc 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java
@@ -20,6 +20,7 @@ package org.apache.olingo.client.core.edm;
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.edm.xml.CommonParameter;
import org.apache.olingo.client.api.edm.xml.v4.Action;
@@ -46,7 +47,12 @@ public abstract class EdmOperationImpl extends AbstractEdmOperation {
}
instance.setParameters(_parameters);
- instance.setEntitySetPath(instance.operation.getEntitySetPath());
+ final String entitySetPath = instance.operation.getEntitySetPath();
+ if (StringUtils.isNotBlank(entitySetPath)) {
+ // remove bindingParameter info and keep path only
+ int firstSlashIndex = entitySetPath.indexOf("/");
+ instance.setEntitySetPath(entitySetPath.substring(firstSlashIndex + 1));
+ }
instance.setIsBound(instance.operation.isBound());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
index 12107ba..61e5267 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
@@ -78,9 +78,10 @@ public class EdmSchemaImpl extends AbstractEdmSchema {
@Override
public List<EdmEntityContainer> getEntityContainers() {
if (entityContainers == null) {
+ entityContainerByName = new HashMap<FullQualifiedName, EdmEntityContainer>();
+
if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
entityContainers = super.getEntityContainers();
- entityContainerByName = new HashMap<FullQualifiedName, EdmEntityContainer>();
entityContainerByName.put(getEntityContainer().getFullQualifiedName(), getEntityContainer());
} else {
entityContainers = new ArrayList<EdmEntityContainer>(schema.getEntityContainers().size());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
index 51a2356..f6bcdb9 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
@@ -123,6 +123,10 @@ public class MetadataTest extends AbstractTest {
assertEquals(container.getEntitySet("Customer").getEntityContainer().getFullQualifiedName(),
logins.getRelatedBindingTarget("Customer").getEntityContainer().getFullQualifiedName());
assertEquals(container.getEntitySet("Customer").getName(), logins.getRelatedBindingTarget("Customer").getName());
+ assertEquals(6, container.getFunctionImports().size());
+ assertEquals(1, container.getActionImports().size());
+ assertNotNull(container.getActionImports().iterator().next().getUnboundAction());
+ assertEquals("ResetDataSource", container.getActionImports().iterator().next().getUnboundAction().getName());
// 5. Operation
final EdmFunctionImport funcImp = container.getFunctionImport("InStreamErrorGetCustomer");
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
index 267083a..ace8960 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
@@ -100,11 +100,15 @@ public class MetadataTest extends AbstractTest {
final EdmEntityType user = edm.getEntityType(
new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "User"));
assertNotNull(user);
+ assertFalse(user.getPropertyNames().isEmpty());
+ assertFalse(user.getNavigationPropertyNames().isEmpty());
+
final EdmEntityType entity = edm.getEntityType(
new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Entity"));
assertEquals(entity, user.getBaseType());
- assertFalse(user.getPropertyNames().isEmpty());
- assertFalse(user.getNavigationPropertyNames().isEmpty());
+ assertFalse(entity.getPropertyNames().isEmpty());
+ assertTrue(entity.getNavigationPropertyNames().isEmpty());
+
final EdmEntityType folder = edm.getEntityType(
new FullQualifiedName("Microsoft.Exchange.Services.OData.Model", "Folder"));
assertEquals(folder, user.getNavigationProperty("Inbox").getType());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java
index 4db1e8e..74e490e 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java
@@ -111,5 +111,4 @@ public interface EdmEntityContainer extends EdmNamed, EdmAnnotationsTarget, EdmA
* @return the {@link FullQualifiedName} of the parentContainer or null if no parent is specified
*/
FullQualifiedName getParentContainerName();
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java
index 0aa7404..4e93811 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdm.java
@@ -82,6 +82,26 @@ public abstract class AbstractEdm implements Edm {
@Override
public List<EdmSchema> getSchemas() {
+ initSchemas();
+ return schemaList;
+ }
+
+ @Override
+ public EdmSchema getSchema(final String namespace) {
+ initSchemas();
+
+ EdmSchema schema = schemas.get(namespace);
+ if (schema == null) {
+ if (aliasToNamespaceInfo == null) {
+ aliasToNamespaceInfo = createAliasToNamespaceInfo();
+ }
+ schema = schemas.get(aliasToNamespaceInfo.get(namespace));
+ }
+
+ return schema;
+ }
+
+ private void initSchemas() {
if (schemas == null) {
schemas = createSchemas();
if (schemas != null) {
@@ -89,6 +109,8 @@ public abstract class AbstractEdm implements Edm {
aliasToNamespaceInfo = new HashMap<String, String>();
for (EdmSchema schema : schemas.values()) {
final String namespace = schema.getNamespace();
+ schemas.put(namespace, schema);
+
if (schema.getAlias() != null) {
aliasToNamespaceInfo.put(schema.getAlias(), namespace);
}
@@ -166,25 +188,6 @@ public abstract class AbstractEdm implements Edm {
}
}
}
- return schemaList;
- }
-
- @Override
- public EdmSchema getSchema(final String namespace) {
- // enusure schemas are loaded
- getSchemas();
-
- EdmSchema schema = null;
- if (schemas != null) {
- schema = schemas.get(namespace);
- if (schema == null) {
- if (aliasToNamespaceInfo == null) {
- aliasToNamespaceInfo = createAliasToNamespaceInfo();
- }
- schema = schemas.get(aliasToNamespaceInfo.get(namespace));
- }
- }
- return schema;
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmBindingTarget.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmBindingTarget.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmBindingTarget.java
index d4efd43..58317f1 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmBindingTarget.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmBindingTarget.java
@@ -18,12 +18,15 @@
*/
package org.apache.olingo.commons.core.edm;
+import java.util.Iterator;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmBindingTarget;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmException;
+import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.Target;
public abstract class AbstractEdmBindingTarget extends EdmNamedImpl implements EdmBindingTarget {
@@ -63,4 +66,40 @@ public abstract class AbstractEdmBindingTarget extends EdmNamedImpl implements E
return getName();
}
+ @Override
+ public EdmBindingTarget getRelatedBindingTarget(final String path) {
+ EdmBindingTarget bindingTarget = null;
+ boolean found = false;
+ for (final Iterator<EdmNavigationPropertyBinding> itor = getNavigationPropertyBindings().iterator();
+ itor.hasNext() && !found;) {
+
+ final EdmNavigationPropertyBinding binding = itor.next();
+ if (binding.getPath().equals(path)) {
+ final Target edmTarget = new Target.Builder(binding.getTarget(), container).build();
+
+ final EdmEntityContainer entityContainer = edm.getEntityContainer(edmTarget.getEntityContainer());
+ if (entityContainer == null) {
+ throw new EdmException("Cannot find entity container with name: " + edmTarget.getEntityContainer());
+ }
+ try {
+ bindingTarget = entityContainer.getEntitySet(edmTarget.getTargetName());
+
+ if (bindingTarget == null) {
+ throw new EdmException("Cannot find EntitySet " + edmTarget.getTargetName());
+ }
+ } catch (EdmException e) {
+ // try with singletons ...
+ bindingTarget = entityContainer.getSingleton(edmTarget.getTargetName());
+
+ if (bindingTarget == null) {
+ throw new EdmException("Cannot find Singleton " + edmTarget.getTargetName());
+ }
+ } finally {
+ found = bindingTarget != null;
+ }
+ }
+ }
+
+ return bindingTarget;
+ }
}
[4/4] git commit: [OLINGO-261] providing basics for pojo generator
and proxy annotations
Posted by fm...@apache.org.
[OLINGO-261] providing basics for pojo generator and proxy annotations
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/f02d9a07
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/f02d9a07
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/f02d9a07
Branch: refs/heads/master
Commit: f02d9a07e46b5ec336f33c2dfba3d7f384279576
Parents: dda7577
Author: fmartelli <fa...@gmail.com>
Authored: Tue May 6 10:44:38 2014 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Tue May 6 10:44:38 2014 +0200
----------------------------------------------------------------------
ext/client-proxy/pom.xml | 76 ++++
.../olingo/ext/proxy/api/AbstractContainer.java | 32 ++
.../ext/proxy/api/AbstractEntityCollection.java | 25 ++
.../olingo/ext/proxy/api/AbstractEntityKey.java | 54 +++
.../olingo/ext/proxy/api/AbstractEntitySet.java | 108 +++++
.../olingo/ext/proxy/api/AbstractOpenType.java | 31 ++
.../olingo/ext/proxy/api/NoResultException.java | 35 ++
.../ext/proxy/api/NonUniqueResultException.java | 35 ++
.../olingo/ext/proxy/api/OperationType.java | 40 ++
.../org/apache/olingo/ext/proxy/api/Query.java | 128 ++++++
.../org/apache/olingo/ext/proxy/api/Sort.java | 65 +++
.../ext/proxy/api/annotations/ComplexType.java | 42 ++
.../ext/proxy/api/annotations/CompoundKey.java | 32 ++
.../api/annotations/CompoundKeyElement.java | 38 ++
.../proxy/api/annotations/EntityContainer.java | 36 ++
.../ext/proxy/api/annotations/EntitySet.java | 38 ++
.../ext/proxy/api/annotations/EntityType.java | 44 ++
.../ext/proxy/api/annotations/EnumType.java | 39 ++
.../olingo/ext/proxy/api/annotations/Key.java | 34 ++
.../ext/proxy/api/annotations/KeyClass.java | 39 ++
.../ext/proxy/api/annotations/KeyRef.java | 34 ++
.../ext/proxy/api/annotations/Namespace.java | 36 ++
.../api/annotations/NavigationProperty.java | 42 ++
.../ext/proxy/api/annotations/Operation.java | 62 +++
.../ext/proxy/api/annotations/Parameter.java | 50 +++
.../ext/proxy/api/annotations/Property.java | 76 ++++
.../api/annotations/ReferentialConstraint.java | 42 ++
.../ext/proxy/api/annotations/RowType.java | 32 ++
.../ext/proxy/api/annotations/Singleton.java | 35 ++
ext/pojogen-maven-plugin/pom.xml | 129 ++++++
.../src/it/actionOverloadingService/pom.xml | 92 +++++
.../it/actionOverloadingService/verify.groovy | 20 +
.../src/it/defaultService/pom.xml | 92 +++++
.../src/it/defaultService/verify.groovy | 20 +
.../src/it/keyAsSegmentService/pom.xml | 92 +++++
.../src/it/keyAsSegmentService/verify.groovy | 20 +
.../src/it/northwind/pom.xml | 92 +++++
.../src/it/northwind/verify.groovy | 20 +
.../src/it/odataWriterDefaultService/pom.xml | 92 +++++
.../it/odataWriterDefaultService/verify.groovy | 20 +
.../src/it/openTypeService/pom.xml | 92 +++++
.../src/it/openTypeService/verify.groovy | 20 +
.../src/it/primitiveKeysService/pom.xml | 92 +++++
.../src/it/primitiveKeysService/verify.groovy | 20 +
.../src/it/staticServiceV3/pom.xml | 92 +++++
.../src/it/staticServiceV3/verify.groovy | 20 +
.../src/it/staticServiceV4/pom.xml | 92 +++++
.../src/it/staticServiceV4/verify.groovy | 20 +
.../ext/pojogen/AbstractMetadataMojo.java | 161 ++++++++
.../olingo/ext/pojogen/AbstractUtility.java | 411 +++++++++++++++++++
.../ext/pojogen/NavPropertyBindingDetails.java | 141 +++++++
.../ext/pojogen/NavPropertyContainsTarget.java | 34 ++
.../olingo/ext/pojogen/V3MetadataMojo.java | 184 +++++++++
.../apache/olingo/ext/pojogen/V3Utility.java | 29 ++
.../olingo/ext/pojogen/V4MetadataMojo.java | 192 +++++++++
.../apache/olingo/ext/pojogen/V4Utility.java | 29 ++
.../src/main/resources/complexType.vm | 48 +++
.../src/main/resources/container.vm | 107 +++++
.../src/main/resources/entityCollection.vm | 96 +++++
.../src/main/resources/entitySet.vm | 65 +++
.../src/main/resources/entityType.vm | 169 ++++++++
.../src/main/resources/entityTypeKey.vm | 69 ++++
.../src/main/resources/enumType.vm | 56 +++
.../src/main/resources/package-info.vm | 20 +
.../src/main/resources/services.vm | 21 +
.../src/main/resources/singleton.vm | 48 +++
.../src/main/resources/v30/complexType.vm | 30 ++
.../src/main/resources/v30/container.vm | 19 +
.../src/main/resources/v30/entitySet.vm | 19 +
.../src/main/resources/v40/complexType.vm | 60 +++
.../src/main/resources/v40/container.vm | 22 +
.../src/main/resources/v40/entitySet.vm | 19 +
.../src/main/resources/v40/singleton.vm | 36 ++
ext/pom.xml | 2 +
fit/pom.xml | 29 ++
fit/src/it/staticServiceV3/pom.xml | 93 +++++
fit/src/it/staticServiceV3/verify.groovy | 20 +
fit/src/it/staticServiceV4/pom.xml | 93 +++++
fit/src/it/staticServiceV4/verify.groovy | 20 +
fit/src/main/resources/V40/metadata.xml | 1 +
.../fit/v3/ActionOverloadingTestITCase.java | 104 +++--
.../client/core/edm/EdmBindingTargetImpl.java | 40 --
.../client/core/edm/EdmEntityContainerImpl.java | 28 +-
.../client/core/edm/EdmOperationImpl.java | 8 +-
.../olingo/client/core/edm/EdmSchemaImpl.java | 3 +-
.../olingo/client/core/v3/MetadataTest.java | 4 +
.../olingo/client/core/v4/MetadataTest.java | 8 +-
.../commons/api/edm/EdmEntityContainer.java | 1 -
.../olingo/commons/core/edm/AbstractEdm.java | 41 +-
.../core/edm/AbstractEdmBindingTarget.java | 39 ++
.../core/edm/AbstractEdmEntityContainer.java | 17 +-
.../core/edm/AbstractEdmNavigationProperty.java | 1 +
.../olingo/commons/core/edm/EdmTypeInfo.java | 3 -
.../commons/core/edm/EdmImplCachingTest.java | 13 +-
.../core/edm/provider/EdmBindingTargetImpl.java | 39 --
pom.xml | 30 +-
96 files changed, 5058 insertions(+), 181 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/pom.xml
----------------------------------------------------------------------
diff --git a/ext/client-proxy/pom.xml b/ext/client-proxy/pom.xml
new file mode 100644
index 0000000..39e742b
--- /dev/null
+++ b/ext/client-proxy/pom.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>client-proxy</artifactId>
+ <packaging>jar</packaging>
+ <name>${project.artifactId}</name>
+ <description>Java client API for OData services: Proxy.</description>
+
+ <parent>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-ext</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <properties>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-client-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractContainer.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractContainer.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractContainer.java
new file mode 100644
index 0000000..e062f02
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractContainer.java
@@ -0,0 +1,32 @@
+/*
+ * 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.ext.proxy.api;
+
+import java.io.Serializable;
+
+/**
+ * Interface for container operations.
+ */
+public abstract interface AbstractContainer extends Serializable {
+
+ /**
+ * Flushes all pending changes to the OData service.
+ */
+ void flush();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractEntityCollection.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractEntityCollection.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractEntityCollection.java
new file mode 100644
index 0000000..3dc3719
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractEntityCollection.java
@@ -0,0 +1,25 @@
+/*
+ * 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.ext.proxy.api;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+public abstract interface AbstractEntityCollection<T extends Serializable> extends Collection<T>, Serializable {
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractEntityKey.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractEntityKey.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractEntityKey.java
new file mode 100644
index 0000000..8740d07
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractEntityKey.java
@@ -0,0 +1,54 @@
+/*
+ * 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.ext.proxy.api;
+
+import java.io.Serializable;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+public abstract class AbstractEntityKey implements Serializable {
+
+ private static final long serialVersionUID = 1662634743346775238L;
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractEntitySet.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractEntitySet.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractEntitySet.java
new file mode 100644
index 0000000..b4df7c9
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractEntitySet.java
@@ -0,0 +1,108 @@
+/*
+ * 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.ext.proxy.api;
+
+import java.io.Serializable;
+
+/**
+ * Interface for synchronous CRUD operations on an EntitySet.
+ */
+public abstract interface AbstractEntitySet<
+ T extends Serializable, KEY extends Serializable, EC extends AbstractEntityCollection<T>>
+ extends Iterable<T>, Serializable {
+
+ /**
+ * Returns whether an entity with the given id exists.
+ *
+ * @param key must not be null
+ * @return true if an entity with the given id exists, false otherwise
+ * @throws IllegalArgumentException in case the given key is null
+ */
+ Boolean exists(KEY key) throws IllegalArgumentException;
+
+ /**
+ * Retrieves an entity by its key.
+ *
+ * @param key must not be null
+ * @return the entity with the given id or null if none found
+ * @throws IllegalArgumentException in case the given key is null
+ */
+ T get(KEY key) throws IllegalArgumentException;
+
+ /**
+ * Retrieves an entity by its key, considering polymorphism.
+ *
+ * @param key must not be null
+ * @param reference entity class to be returned
+ * @return the entity with the given id or null if none found
+ * @throws IllegalArgumentException in case the given key is null
+ */
+ <S extends T> S get(KEY key, Class<S> reference) throws IllegalArgumentException;
+
+ /**
+ * Returns the number of entities available.
+ *
+ * @return the number of entities
+ */
+ Long count();
+
+ /**
+ * Returns all instances.
+ *
+ * @return all entities
+ */
+ EC getAll();
+
+ /**
+ * Returns all instances of the given subtype.
+ *
+ * @param reference entity collection class to be returned
+ * @return all entities of the given subtype
+ */
+ <S extends T, SEC extends AbstractEntityCollection<S>> SEC getAll(Class<SEC> reference);
+
+ /**
+ * Deletes the entity with the given key.
+ *
+ * @param key must not be null
+ * @throws IllegalArgumentException in case the given key is null
+ */
+ void delete(KEY key) throws IllegalArgumentException;
+
+ /**
+ * Deletes the given entities in a batch.
+ *
+ * @param entities to be deleted
+ */
+ <S extends T> void delete(Iterable<S> entities);
+
+ /**
+ * Create an instance of <tt>Query</tt>.
+ *
+ * @return the new query instance
+ */
+ Query<T, EC> createQuery();
+
+ /**
+ * Create an instance of <tt>Query</tt>.
+ *
+ * @return the new query instance
+ */
+ <S extends T, SEC extends AbstractEntityCollection<S>> Query<S, SEC> createQuery(Class<SEC> reference);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractOpenType.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractOpenType.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractOpenType.java
new file mode 100644
index 0000000..4b200b4
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/AbstractOpenType.java
@@ -0,0 +1,31 @@
+/*
+ * 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.ext.proxy.api;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+public abstract interface AbstractOpenType extends Serializable {
+
+ void addAdditionalProperty(String name, Object value);
+
+ Object getAdditionalProperty(String name);
+
+ Collection<String> getAdditionalPropertyNames();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/NoResultException.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/NoResultException.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/NoResultException.java
new file mode 100644
index 0000000..da76bf0
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/NoResultException.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.ext.proxy.api;
+
+/**
+ * Thrown when <tt>Query.getSingleResult()</tt> or <tt>EntityQuery.getSingleResult()</tt> is executed on a query and
+ * there is no result to return.
+ *
+ * @see Query#getSingleResult()
+ * @see EntityQuery#getSingleResult()
+ */
+public class NoResultException extends RuntimeException {
+
+ private static final long serialVersionUID = -6643642637364303053L;
+
+ public NoResultException() {
+ super();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/NonUniqueResultException.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/NonUniqueResultException.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/NonUniqueResultException.java
new file mode 100644
index 0000000..bb5737f
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/NonUniqueResultException.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.ext.proxy.api;
+
+/**
+ * Thrown when <tt>Query.getSingleResult()</tt> or <tt>EntityQuery.getSingleResult()</tt> is executed on a query and
+ * there is more than one result from the query.
+ *
+ * @see Query#getSingleResult()
+ * @see EntityQuery#getSingleResult()
+ */
+public class NonUniqueResultException extends RuntimeException {
+
+ private static final long serialVersionUID = 4444551737338550185L;
+
+ public NonUniqueResultException() {
+ super();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/OperationType.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/OperationType.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/OperationType.java
new file mode 100644
index 0000000..47c69a5
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/OperationType.java
@@ -0,0 +1,40 @@
+/*
+ * 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.ext.proxy.api;
+
+public enum OperationType {
+
+ /**
+ * Function or action (not specified explicitly).
+ * <br />
+ * OData V3 only.
+ */
+ LEGACY,
+ /**
+ * Functions MUST NOT have observable side effects and MUST return a single instance or a collection of instances of
+ * any type. Functions MAY be composable.
+ */
+ FUNCTION,
+ /**
+ * Actions MAY have observable side effects and MAY return a single instance or a collection of instances of any type.
+ * Actions cannot be composed with additional path segments.
+ */
+ ACTION;
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/Query.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/Query.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/Query.java
new file mode 100644
index 0000000..ec7b944
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/Query.java
@@ -0,0 +1,128 @@
+/*
+ * 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.ext.proxy.api;
+
+import java.io.Serializable;
+import org.apache.olingo.client.api.uri.URIFilter;
+
+/**
+ * Interface used to control query execution.
+ *
+ * @param <T> query result type
+ */
+public interface Query<T extends Serializable, EC extends AbstractEntityCollection<T>> extends Serializable {
+
+ /**
+ * Sets the <tt>$filter</tt> expression for this query. Any of available operators and functions can be embodied here.
+ *
+ * @param filter the <tt>$filter</tt> expression for this query
+ * @return the same query instance
+ */
+ Query<T, EC> setFilter(String filter);
+
+ /**
+ * Sets the filter generating the <tt>$filter</tt> expression for this query.
+ *
+ * @param filter filter instance (to be obtained via <tt>ODataFilterFactory</tt>): note that <tt>build()</tt> method
+ * will be immediately invoked.
+ * @return the same query instance
+ */
+ Query<T, EC> setFilter(URIFilter filter);
+
+ /**
+ * The <tt>$filter</tt> expression for this query.
+ *
+ * @return the <tt>$filter</tt> expression for this query
+ */
+ String getFilter();
+
+ /**
+ * Sets the <tt>$orderBy</tt> expression for this query via sort options.
+ *
+ * @param sort sort options
+ * @return the same query instance
+ */
+ Query<T, EC> setOrderBy(Sort... sort);
+
+ /**
+ * Sets the <tt>$orderBy</tt> expression for this query.
+ *
+ * @param select the <tt>$orderBy</tt> expression for this query
+ * @return the same query instance
+ */
+ Query<T, EC> setOrderBy(String orderBy);
+
+ /**
+ * The <tt>$orderBy</tt> expression for this query.
+ *
+ * @return the <tt>$orderBy</tt> expression for this query
+ */
+ String getOrderBy();
+
+ /**
+ * Sets the maximum number of results to retrieve (<tt>$top</tt>).
+ *
+ * @param maxResults maximum number of results to retrieve
+ * @return the same query instance
+ * @throws IllegalArgumentException if the argument is negative
+ */
+ Query<T, EC> setMaxResults(int maxResults) throws IllegalArgumentException;
+
+ /**
+ * The maximum number of results the query object was set to retrieve (<tt>$top</tt>). Returns
+ * <tt>Integer.MAX_VALUE</tt> if setMaxResults was not applied to the query object.
+ *
+ * @return maximum number of results
+ */
+ int getMaxResults();
+
+ /**
+ * Sets the position of the first result to retrieve (<tt>$skip</tt>).
+ *
+ * @param firstResult position of the first result, numbered from 0
+ * @return the same query instance
+ * @throws IllegalArgumentException if the argument is negative
+ */
+ Query<T, EC> setFirstResult(int firstResult) throws IllegalArgumentException;
+
+ /**
+ * The position of the first result the query object was set to retrieve (<tt>$skip</tt>).
+ *
+ * Returns 0 if <tt>setFirstResult</tt> was not applied to the query object.
+ *
+ * @return position of the first result
+ */
+ int getFirstResult();
+
+ /**
+ * Executes a <tt>$filter</tt> query that returns a single result.
+ *
+ * @return the result
+ * @throws NoResultException if there is no result
+ * @throws NonUniqueResultException if more than one result
+ */
+ T getSingleResult() throws NoResultException, NonUniqueResultException;
+
+ /**
+ * Executes a <tt>$filter</tt> query and return the query results as collection.
+ *
+ * @return an iterable view of the results
+ */
+ EC getResult();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/Sort.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/Sort.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/Sort.java
new file mode 100644
index 0000000..9e6f924
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/Sort.java
@@ -0,0 +1,65 @@
+/*
+ * 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.ext.proxy.api;
+
+import java.util.Map;
+
+/**
+ * Sort option for queries.
+ */
+public class Sort implements Map.Entry<String, Sort.Direction> {
+
+ /**
+ * Enumeration for sort directions.
+ */
+ public enum Direction {
+
+ ASC,
+ DESC;
+
+ @Override
+ public String toString() {
+ return name().toLowerCase();
+ }
+ }
+ private final String key;
+
+ private Direction value;
+
+ public Sort(final String key, final Direction value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ @Override
+ public String getKey() {
+ return this.key;
+ }
+
+ @Override
+ public Direction getValue() {
+ return this.value;
+ }
+
+ @Override
+ public Direction setValue(final Direction value) {
+ this.value = value;
+ return this.value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/ComplexType.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/ComplexType.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/ComplexType.java
new file mode 100644
index 0000000..ec41f52
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/ComplexType.java
@@ -0,0 +1,42 @@
+/*
+ * 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.ext.proxy.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Mark POJO as EDM complex type.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface ComplexType {
+
+ String name();
+
+ String baseType() default "";
+
+ boolean isAbstract() default false;
+
+ boolean isOpenType() default false;
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/CompoundKey.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/CompoundKey.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/CompoundKey.java
new file mode 100644
index 0000000..217cc96
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/CompoundKey.java
@@ -0,0 +1,32 @@
+/*
+ * 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.ext.proxy.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Identifies a compound key.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface CompoundKey {
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/CompoundKeyElement.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/CompoundKeyElement.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/CompoundKeyElement.java
new file mode 100644
index 0000000..5f45d06
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/CompoundKeyElement.java
@@ -0,0 +1,38 @@
+/*
+ * 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.ext.proxy.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Mark multi key class field (property) as multi key element.
+ *
+ * @see Property
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface CompoundKeyElement {
+
+ String name();
+
+ int position();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/EntityContainer.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/EntityContainer.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/EntityContainer.java
new file mode 100644
index 0000000..e76cfc8
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/EntityContainer.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.ext.proxy.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Mark POJO as EDM entity container.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface EntityContainer {
+
+ String name();
+
+ boolean isDefaultEntityContainer() default false;
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/EntitySet.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/EntitySet.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/EntitySet.java
new file mode 100644
index 0000000..0a94df4
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/EntitySet.java
@@ -0,0 +1,38 @@
+/*
+ * 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.ext.proxy.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Give entity set a name. If interface extending EntitySet is not annotated with this, the effective name will be
+ * class'
+ * <tt>getSimpleName()</tt>.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface EntitySet {
+
+ String name();
+
+ boolean includeInServiceDocument() default true;
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/EntityType.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/EntityType.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/EntityType.java
new file mode 100644
index 0000000..a875098
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/EntityType.java
@@ -0,0 +1,44 @@
+/*
+ * 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.ext.proxy.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Mark POJO as EDM entity type.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Inherited
+public @interface EntityType {
+
+ String name();
+
+ String baseType() default "";
+
+ boolean isAbstract() default false;
+
+ boolean openType() default false;
+
+ boolean hasStream() default false;
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/EnumType.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/EnumType.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/EnumType.java
new file mode 100644
index 0000000..51afe79
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/EnumType.java
@@ -0,0 +1,39 @@
+/*
+ * 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.ext.proxy.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+
+/**
+ * Mark Java enum as EDM enum type.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface EnumType {
+
+ String name();
+
+ EdmPrimitiveTypeKind underlyingType() default EdmPrimitiveTypeKind.Int32;
+
+ boolean isFlags() default false;
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Key.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Key.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Key.java
new file mode 100644
index 0000000..7e10e87
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Key.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.ext.proxy.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Mark POJO field (property) as key.
+ *
+ * @see Property
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface Key {
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/KeyClass.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/KeyClass.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/KeyClass.java
new file mode 100644
index 0000000..5729ca5
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/KeyClass.java
@@ -0,0 +1,39 @@
+/*
+ * 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.ext.proxy.api.annotations;
+
+import java.io.Serializable;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Specifies a composite primary key class that is mapped to multiple fields or properties of an EntityType.
+ * <p>The names of the fields or properties in the primary key class and the primary key fields or properties of the
+ * EntityType must correspond and their types must be the same.</p>
+ *
+ * @see Key
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface KeyClass {
+
+ Class<? extends Serializable> value();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/KeyRef.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/KeyRef.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/KeyRef.java
new file mode 100644
index 0000000..41f3b06
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/KeyRef.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.ext.proxy.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Identifies a compound key.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface KeyRef {
+
+ Class<?> value();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Namespace.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Namespace.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Namespace.java
new file mode 100644
index 0000000..81f1a95
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Namespace.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.ext.proxy.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Associate Java package with OData namespace.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface Namespace {
+
+ String value();
+
+ String alias() default "";
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/NavigationProperty.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/NavigationProperty.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/NavigationProperty.java
new file mode 100644
index 0000000..88379bc
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/NavigationProperty.java
@@ -0,0 +1,42 @@
+/*
+ * 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.ext.proxy.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Bind POJO field to EDM navigation property.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface NavigationProperty {
+
+ String name();
+
+ String type();
+
+ String targetSchema();
+
+ String targetContainer();
+
+ String targetEntitySet();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Operation.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Operation.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Operation.java
new file mode 100644
index 0000000..ad5a148
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Operation.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.ext.proxy.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.olingo.ext.proxy.api.OperationType;
+
+/**
+ * Mark method as EDM function import.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface Operation {
+
+ String name();
+
+ /**
+ * Operation type, function or action.
+ *
+ * @return operation type.
+ */
+ OperationType type();
+
+ /**
+ * The action/function MAY/MUST specify a return type using the edm:ReturnType element. The return type must be a
+ * scalar, entity or complex type, or a collection of scalar, entity or complex types.
+ *
+ * @return operation return type.
+ */
+ String returnType() default "";
+
+ /**
+ * A function element MAY specify a Boolean value for the IsComposable attribute. If no value is specified for the
+ * IsComposable attribute, the value defaults to false.
+ * <br/>
+ * Functions whose IsComposable attribute is true are considered composable. A composable function can be invoked with
+ * additional path segments or system query options appended to the path that identifies the composable function as
+ * appropriate for the type returned by the composable function.
+ *
+ * @return <tt>TRUE</tt> if is composable; <tt>FALSE</tt> otherwise.
+ */
+ boolean isComposable() default false;
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Parameter.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Parameter.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Parameter.java
new file mode 100644
index 0000000..2ecd79b
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Parameter.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.ext.proxy.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
+import org.apache.olingo.client.api.edm.xml.v3.ParameterMode;
+
+/**
+ * Function import parameter information.
+ *
+ * @see FunctionImport
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.PARAMETER)
+public @interface Parameter {
+
+ String name();
+
+ String type();
+
+ boolean nullable() default true;
+
+ ParameterMode mode() default ParameterMode.In;
+
+ int maxLenght() default Integer.MAX_VALUE;
+
+ int precision() default 0;
+
+ int scale() default 0;
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Property.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Property.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Property.java
new file mode 100644
index 0000000..86da393
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Property.java
@@ -0,0 +1,76 @@
+/*
+ * 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.ext.proxy.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.olingo.client.api.edm.ConcurrencyMode;
+import org.apache.olingo.client.api.edm.StoreGeneratedPattern;
+import org.apache.olingo.commons.api.edm.constants.EdmContentKind;
+
+/**
+ * Bind POJO field to EDM property.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface Property {
+
+ String name();
+
+ String type();
+
+ boolean nullable() default true;
+
+ String defaultValue() default "";
+
+ int maxLenght() default Integer.MAX_VALUE;
+
+ boolean fixedLenght() default false;
+
+ int precision() default 0;
+
+ int scale() default 0;
+
+ boolean unicode() default true;
+
+ String collation() default "";
+
+ String srid() default "";
+
+ ConcurrencyMode concurrencyMode() default ConcurrencyMode.None;
+
+ String mimeType() default "";
+
+ /* -- Feed Customization annotations -- */
+ String fcSourcePath() default "";
+
+ String fcTargetPath() default "";
+
+ EdmContentKind fcContentKind() default EdmContentKind.text;
+
+ String fcNSPrefix() default "";
+
+ String fcNSURI() default "";
+
+ boolean fcKeepInContent() default false;
+
+ StoreGeneratedPattern storeGeneratedPattern() default StoreGeneratedPattern.None;
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/ReferentialConstraint.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/ReferentialConstraint.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/ReferentialConstraint.java
new file mode 100644
index 0000000..92ab4db
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/ReferentialConstraint.java
@@ -0,0 +1,42 @@
+/*
+ * 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.ext.proxy.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotate navigation property with information about referential constraint.
+ *
+ * @see NavigationProperty
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface ReferentialConstraint {
+
+ Class<?> principalRole();
+
+ String[] principalPropertyRefs();
+
+ Class<?> dependentRole();
+
+ String[] dependentPropertyRefs();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/RowType.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/RowType.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/RowType.java
new file mode 100644
index 0000000..50334d1
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/RowType.java
@@ -0,0 +1,32 @@
+/*
+ * 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.ext.proxy.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Mark inner class as EDM row type.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface RowType {
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Singleton.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Singleton.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Singleton.java
new file mode 100644
index 0000000..3f85c88
--- /dev/null
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/api/annotations/Singleton.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.ext.proxy.api.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Give singleton a name. If interface extending Singleton is not annotated with this, the effective name will be class'
+ * <tt>getSimpleName()</tt>.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface Singleton {
+
+ String name();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/pom.xml b/ext/pojogen-maven-plugin/pom.xml
new file mode 100644
index 0000000..2364dac
--- /dev/null
+++ b/ext/pojogen-maven-plugin/pom.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>pojogen-maven-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>${project.artifactId}</name>
+ <description>Java client API for OData services: Maven plugin generating POJOs from metadata.</description>
+
+ <parent>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-ext</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <properties>
+ <serviceRootURL>${test.base.url}</serviceRootURL>
+ <main.basedir>${project.parent.basedir}</main.basedir>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-client-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <goalPrefix>odatajclient</goalPrefix>
+ <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
+ </configuration>
+ <executions>
+ <execution>
+ <id>mojo-descriptor</id>
+ <goals>
+ <goal>descriptor</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>help-goal</id>
+ <goals>
+ <goal>helpmojo</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ <resource>
+ <directory>..</directory>
+ <targetPath>META-INF</targetPath>
+ <includes>
+ <include>LICENSE</include>
+ </includes>
+ </resource>
+ </resources>
+
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/actionOverloadingService/pom.xml
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/actionOverloadingService/pom.xml b/ext/pojogen-maven-plugin/src/it/actionOverloadingService/pom.xml
new file mode 100644
index 0000000..ba36e81
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/actionOverloadingService/pom.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-maven-plugin</artifactId>
+ <version>@project.version@</version>
+
+ <description>A simple IT verifying the basic use case.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>@velocity.version@</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-proxy</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>@project.artifactId@</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <configuration>
+ <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+ <serviceRootURL>@serviceRootURL@/ActionOverloadingService.svc</serviceRootURL>
+ <basePackage>org.apache.olingo.ext.proxy.actionoverloadingservice</basePackage>
+ </configuration>
+ <id>pojosV3</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>pojosV3</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/actionOverloadingService/verify.groovy
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/actionOverloadingService/verify.groovy b/ext/pojogen-maven-plugin/src/it/actionOverloadingService/verify.groovy
new file mode 100644
index 0000000..a19cf4d
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/actionOverloadingService/verify.groovy
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ */
+File basepkg = new File( basedir, "target/generated-sources/ojc-plugin/com/msopentech/odatajclient/proxy" );
+assert basepkg.isDirectory() && basepkg.listFiles().length>0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/defaultService/pom.xml
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/defaultService/pom.xml b/ext/pojogen-maven-plugin/src/it/defaultService/pom.xml
new file mode 100644
index 0000000..c82709f
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/defaultService/pom.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-maven-plugin</artifactId>
+ <version>@project.version@</version>
+
+ <description>A simple IT verifying the basic use case.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>@velocity.version@</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-proxy</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>@project.artifactId@</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <configuration>
+ <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+ <serviceRootURL>@serviceRootURL@/DefaultService.svc</serviceRootURL>
+ <basePackage>org.apache.olingo.ext.proxy.defaultservice</basePackage>
+ </configuration>
+ <id>pojosV3</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>pojosV3</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/defaultService/verify.groovy
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/defaultService/verify.groovy b/ext/pojogen-maven-plugin/src/it/defaultService/verify.groovy
new file mode 100644
index 0000000..a19cf4d
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/defaultService/verify.groovy
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ */
+File basepkg = new File( basedir, "target/generated-sources/ojc-plugin/com/msopentech/odatajclient/proxy" );
+assert basepkg.isDirectory() && basepkg.listFiles().length>0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f02d9a07/ext/pojogen-maven-plugin/src/it/keyAsSegmentService/pom.xml
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/keyAsSegmentService/pom.xml b/ext/pojogen-maven-plugin/src/it/keyAsSegmentService/pom.xml
new file mode 100644
index 0000000..174ee91
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/keyAsSegmentService/pom.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-maven-plugin</artifactId>
+ <version>@project.version@</version>
+
+ <description>A simple IT verifying the basic use case.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>@velocity.version@</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.olingo.ext</groupId>
+ <artifactId>odatajclient-proxy</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>@project.groupId@</groupId>
+ <artifactId>@project.artifactId@</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <configuration>
+ <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+ <serviceRootURL>@serviceRootURL@/KeyAsSegmentService.svc</serviceRootURL>
+ <basePackage>org.apache.olingo.ext.proxy.keyassegmentservice</basePackage>
+ </configuration>
+ <id>pojosV3</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>pojosV3</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>