This commit is contained in:
Francesco Chicchiriccò 2014-05-06 11:00:38 +02:00
commit 936e19ca49
96 changed files with 5051 additions and 174 deletions

76
ext/client-proxy/pom.xml Normal file
View File

@ -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>

View File

@ -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();
}

View File

@ -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 {
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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();
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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 {
}

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 {
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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 "";
}

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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 {
}

View File

@ -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();
}

View File

@ -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>

View File

@ -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>

View File

@ -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;

View File

@ -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>

View File

@ -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;

View File

@ -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>

View File

@ -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;

View File

@ -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>

View File

@ -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;

View File

@ -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>

View File

@ -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;

View File

@ -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>

View File

@ -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;

View File

@ -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>

View File

@ -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;

View File

@ -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>

View File

@ -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;

View File

@ -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>

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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());
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}

View File

@ -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" )
}

View File

@ -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
}
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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}

View File

@ -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
}

View File

@ -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;

View File

@ -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

View File

@ -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" )

View File

@ -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

View File

@ -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.
*#

View File

@ -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")

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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
}

View File

@ -37,5 +37,7 @@
<modules>
<module>client-core-android</module>
<module>pojogen-maven-plugin</module>
<module>client-proxy</module>
</modules>
</project>

View File

@ -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>
@ -105,6 +106,34 @@
<build>
<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>

View File

@ -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>

View File

@ -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;

View File

@ -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>

View File

@ -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;

View File

@ -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" />

View File

@ -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);
final EdmSchema schema = edm.getSchemas().get(0);
assertNotNull(schema);
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));
EdmAction actImp = edm.getBoundAction(
new FullQualifiedName(schema.getNamespace(), "IncreaseSalaries"),
new FullQualifiedName(schema.getNamespace(), "Employee"),
true);
// 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 Map<String, ODataValue> parameters = new LinkedHashMap<String, ODataValue>(1);
parameters.put("n", getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(5));
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);
// 1. bound to employees
assertNotNull(actImp);
assertNull(actImp.getReturnType());
final ODataInvokeResponse<ODataNoContent> employeeRes = getClient().getInvokeRequestFactory().
<ODataNoContent>getInvokeRequest(employeeBuilder.appendOperationCallSegment(actImp.getName()).build(),
employeeBound, parameters).execute();
assertNotNull(employeeRes);
assertEquals(204, employeeRes.getStatusCode());
execs++;
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);
// 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 ODataInvokeResponse<ODataNoContent> employeeRes = getClient().getInvokeRequestFactory().
<ODataNoContent>getInvokeRequest(employeeBuilder.appendOperationCallSegment(actImp.getName()).build(),
actImp, parameters).execute();
assertNotNull(employeeRes);
assertEquals(204, employeeRes.getStatusCode());
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);
// 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 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 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());
}
}

View File

@ -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;
@ -53,41 +49,6 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
this.helper = new EdmAnnotationHelperImpl(edm, target);
}
@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) {
@ -111,5 +72,4 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
public List<EdmAnnotation> getAnnotations() {
return helper.getAnnotations();
}
}

View File

@ -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));
}

View File

@ -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());

View File

@ -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());

View File

@ -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");

View File

@ -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());

View File

@ -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();
}

View File

@ -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

View File

@ -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;
}
}

View File

@ -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();
}
}

View File

@ -72,6 +72,7 @@ public abstract class AbstractEdmNavigationProperty extends EdmElementImpl imple
return partnerNavigationProperty;
}
@Override
public abstract String getReferencingPropertyName(String referencedPropertyName);
@Override

View File

@ -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 {

View File

@ -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

View File

@ -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;
@ -43,42 +40,6 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
this.target = target;
}
@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) {

30
pom.xml
View File

@ -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>