You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/05/13 13:47:53 UTC
[09/31] [OLINGO-280] pojogen off-line generation implemented
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/288bbb72/ext/pojogen-maven-plugin/src/it/v4Sample/src/test/resources/metadata.xml
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/v4Sample/src/test/resources/metadata.xml b/ext/pojogen-maven-plugin/src/it/v4Sample/src/test/resources/metadata.xml
new file mode 100644
index 0000000..4bb360c
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/v4Sample/src/test/resources/metadata.xml
@@ -0,0 +1,462 @@
+<?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.
+
+-->
+<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
+ <edmx:DataServices>
+ <Schema Namespace="Microsoft.Test.OData.Services.ODataWCFService" xmlns="http://docs.oasis-open.org/odata/ns/edm">
+ <Term Name="IsBoss" Type="Edm.Boolean"/>
+ <ComplexType Name="Address">
+ <Property Name="Street" Type="Edm.String" Nullable="false"/>
+ <Property Name="City" Type="Edm.String" Nullable="false"/>
+ <Property Name="PostalCode" Type="Edm.String" Nullable="false"/>
+ </ComplexType>
+ <ComplexType Name="HomeAddress" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Address">
+ <Property Name="FamilyName" Type="Edm.String"/>
+ </ComplexType>
+ <ComplexType Name="CompanyAddress" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Address">
+ <Property Name="CompanyName" Type="Edm.String" Nullable="false"/>
+ </ComplexType>
+ <EnumType Name="AccessLevel" IsFlags="true">
+ <Member Name="None" Value="0"/>
+ <Member Name="Read" Value="1"/>
+ <Member Name="Write" Value="2"/>
+ <Member Name="Execute" Value="4"/>
+ <Member Name="ReadWrite" Value="3"/>
+ </EnumType>
+ <EnumType Name="Color">
+ <Member Name="Red" Value="1"/>
+ <Member Name="Green" Value="2"/>
+ <Member Name="Blue" Value="4"/>
+ </EnumType>
+ <EnumType Name="CompanyCategory">
+ <Member Name="IT" Value="0"/>
+ <Member Name="Communication" Value="1"/>
+ <Member Name="Electronics" Value="2"/>
+ <Member Name="Others" Value="4"/>
+ </EnumType>
+ <EntityType Name="Person">
+ <Key>
+ <PropertyRef Name="PersonID"/>
+ </Key>
+ <Property Name="PersonID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="FirstName" Type="Edm.String" Nullable="false"/>
+ <Property Name="LastName" Type="Edm.String" Nullable="false"/>
+ <Property Name="MiddleName" Type="Edm.String"/>
+ <Property Name="HomeAddress" Type="Microsoft.Test.OData.Services.ODataWCFService.Address"/>
+ <Property Name="Home" Type="Edm.GeographyPoint" SRID="4326"/>
+ <Property Name="Numbers" Type="Collection(Edm.String)" Nullable="false"/>
+ <Property Name="Emails" Type="Collection(Edm.String)"/>
+ <NavigationProperty Name="Parent" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
+ </EntityType>
+ <EntityType Name="Customer" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Person">
+ <Property Name="City" Type="Edm.String" Nullable="false"/>
+ <Property Name="Birthday" Type="Edm.DateTimeOffset" Nullable="false"/>
+ <Property Name="TimeBetweenLastTwoOrders" Type="Edm.Duration" Nullable="false"/>
+ <NavigationProperty Name="Orders" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Order)"/>
+ <NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="VipCustomer"/>
+ </EntityType>
+ <EntityType Name="Employee" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Person">
+ <Property Name="DateHired" Type="Edm.DateTimeOffset" Nullable="false"/>
+ <Property Name="Office" Type="Edm.GeographyPoint" SRID="4326"/>
+ <NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Employees"/>
+ </EntityType>
+ <EntityType Name="Product">
+ <Key>
+ <PropertyRef Name="ProductID"/>
+ </Key>
+ <Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="Name" Type="Edm.String" Nullable="false"/>
+ <Property Name="QuantityPerUnit" Type="Edm.String" Nullable="false"/>
+ <Property Name="UnitPrice" Type="Edm.Single" Nullable="false"/>
+ <Property Name="QuantityInStock" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="Discontinued" Type="Edm.Boolean" Nullable="false"/>
+ <Property Name="UserAccess" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel"/>
+ <Property Name="SkinColor" Type="Microsoft.Test.OData.Services.ODataWCFService.Color"/>
+ <Property Name="CoverColors" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)" Nullable="false"/>
+ <NavigationProperty Name="Details" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)">
+ <ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID"/>
+ </NavigationProperty>
+ </EntityType>
+ <EntityType Name="ProductDetail">
+ <Key>
+ <PropertyRef Name="ProductID"/>
+ <PropertyRef Name="ProductDetailID"/>
+ </Key>
+ <Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="ProductName" Type="Edm.String" Nullable="false"/>
+ <Property Name="Description" Type="Edm.String" Nullable="false"/>
+ <NavigationProperty Name="RelatedProduct" Type="Microsoft.Test.OData.Services.ODataWCFService.Product"/>
+ <NavigationProperty Name="Reviews" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductReview)">
+ <ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID"/>
+ <ReferentialConstraint Property="ProductDetailID" ReferencedProperty="ProductDetailID"/>
+ </NavigationProperty>
+ </EntityType>
+ <EntityType Name="ProductReview">
+ <Key>
+ <PropertyRef Name="ProductID"/>
+ <PropertyRef Name="ProductDetailID"/>
+ <PropertyRef Name="ReviewTitle"/>
+ <PropertyRef Name="RevisionID"/>
+ </Key>
+ <Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="ReviewTitle" Type="Edm.String" Nullable="false"/>
+ <Property Name="RevisionID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="Comment" Type="Edm.String" Nullable="false"/>
+ <Property Name="Author" Type="Edm.String" Nullable="false"/>
+ </EntityType>
+ <EntityType Name="Order">
+ <Key>
+ <PropertyRef Name="OrderID"/>
+ </Key>
+ <Property Name="OrderID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="OrderDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+ <Property Name="ShelfLife" Type="Edm.Duration"/>
+ <Property Name="OrderShelfLifes" Type="Collection(Edm.Duration)"/>
+ <NavigationProperty Name="LoggedInEmployee" Type="Microsoft.Test.OData.Services.ODataWCFService.Employee" Nullable="false"/>
+ <NavigationProperty Name="CustomerForOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false"/>
+ <NavigationProperty Name="OrderDetails" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.OrderDetail)"/>
+ </EntityType>
+ <EntityType Name="OrderDetail">
+ <Key>
+ <PropertyRef Name="OrderID"/>
+ <PropertyRef Name="ProductID"/>
+ </Key>
+ <Property Name="OrderID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="OrderPlaced" Type="Edm.DateTimeOffset" Nullable="false"/>
+ <Property Name="Quantity" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="UnitPrice" Type="Edm.Single" Nullable="false"/>
+ <NavigationProperty Name="ProductOrdered" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)"/>
+ <NavigationProperty Name="AssociatedOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Order" Nullable="false"/>
+ </EntityType>
+ <EntityType Name="Department">
+ <Key>
+ <PropertyRef Name="DepartmentID"/>
+ </Key>
+ <Property Name="DepartmentID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="Name" Type="Edm.String" Nullable="false"/>
+ <Property Name="DepartmentNO" Type="Edm.String"/>
+ <NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Departments"/>
+ </EntityType>
+ <EntityType Name="Company" OpenType="true">
+ <Key>
+ <PropertyRef Name="CompanyID"/>
+ </Key>
+ <Property Name="CompanyID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="CompanyCategory" Type="Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory"/>
+ <Property Name="Revenue" Type="Edm.Int64" Nullable="false"/>
+ <Property Name="Name" Type="Edm.String"/>
+ <Property Name="Address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address"/>
+ <NavigationProperty Name="Employees" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Employee)" Partner="Company"/>
+ <NavigationProperty Name="VipCustomer" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false" Partner="Company"/>
+ <NavigationProperty Name="Departments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Department)" Partner="Company"/>
+ <NavigationProperty Name="CoreDepartment" Type="Microsoft.Test.OData.Services.ODataWCFService.Department" Nullable="false"/>
+ </EntityType>
+ <EntityType Name="PublicCompany" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Company" OpenType="true">
+ <Property Name="StockExchange" Type="Edm.String"/>
+ <NavigationProperty Name="Assets" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Asset)" ContainsTarget="true"/>
+ <NavigationProperty Name="Club" Type="Microsoft.Test.OData.Services.ODataWCFService.Club" Nullable="false" ContainsTarget="true"/>
+ <NavigationProperty Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion" Nullable="false"/>
+ </EntityType>
+ <EntityType Name="Asset">
+ <Key>
+ <PropertyRef Name="AssetID"/>
+ </Key>
+ <Property Name="AssetID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="Name" Type="Edm.String"/>
+ <Property Name="Number" Type="Edm.Int32" Nullable="false"/>
+ </EntityType>
+ <EntityType Name="Club">
+ <Key>
+ <PropertyRef Name="ClubID"/>
+ </Key>
+ <Property Name="ClubID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="Name" Type="Edm.String"/>
+ </EntityType>
+ <EntityType Name="LabourUnion">
+ <Key>
+ <PropertyRef Name="LabourUnionID"/>
+ </Key>
+ <Property Name="LabourUnionID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="Name" Type="Edm.String"/>
+ </EntityType>
+ <Action Name="AddAccessRight" IsBound="true">
+ <Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false"/>
+ <Parameter Name="accessRight" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel"/>
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel"/>
+ </Action>
+ <Action Name="IncreaseRevenue" IsBound="true">
+ <Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false"/>
+ <Parameter Name="IncreaseValue" Type="Edm.Int64"/>
+ <ReturnType Type="Edm.Int64" Nullable="false"/>
+ </Action>
+ <Action Name="ResetAddress" IsBound="true" EntitySetPath="person">
+ <Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
+ <Parameter Name="addresses" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Address)" Nullable="false"/>
+ <Parameter Name="index" Type="Edm.Int32" Nullable="false"/>
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
+ </Action>
+ <Action Name="Discount" IsBound="true" EntitySetPath="products">
+ <Parameter Name="products" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false"/>
+ <Parameter Name="percentage" Type="Edm.Int32" Nullable="false"/>
+ <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false"/>
+ </Action>
+ <Action Name="Discount">
+ <Parameter Name="percentage" Type="Edm.Int32" Nullable="false"/>
+ </Action>
+ <Action Name="ResetBossEmail">
+ <Parameter Name="emails" Type="Collection(Edm.String)" Nullable="false"/>
+ <ReturnType Type="Collection(Edm.String)" Nullable="false"/>
+ </Action>
+ <Action Name="ResetBossAddress">
+ <Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false"/>
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false"/>
+ </Action>
+ <Action Name="ResetDataSource"/>
+ <Function Name="GetEmployeesCount" IsBound="true">
+ <Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false"/>
+ <ReturnType Type="Edm.Int32" Nullable="false"/>
+ </Function>
+ <Function Name="GetProductDetails" IsBound="true" EntitySetPath="product/Details" IsComposable="true">
+ <Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false"/>
+ <Parameter Name="count" Type="Edm.Int32"/>
+ <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)" Nullable="false"/>
+ </Function>
+ <Function Name="GetRelatedProduct" IsBound="true" EntitySetPath="productDetail/RelatedProduct" IsComposable="true">
+ <Parameter Name="productDetail" Type="Microsoft.Test.OData.Services.ODataWCFService.ProductDetail" Nullable="false"/>
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false"/>
+ </Function>
+ <Function Name="GetDefaultColor" IsComposable="true">
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Color"/>
+ </Function>
+ <Function Name="GetPerson" IsComposable="true">
+ <Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false"/>
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
+ </Function>
+ <Function Name="GetPerson2" IsComposable="true">
+ <Parameter Name="city" Type="Edm.String" Nullable="false"/>
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
+ </Function>
+ <Function Name="GetAllProducts" IsComposable="true">
+ <ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false"/>
+ </Function>
+ <Function Name="GetBossEmails">
+ <Parameter Name="start" Type="Edm.Int32" Nullable="false"/>
+ <Parameter Name="count" Type="Edm.Int32" Nullable="false"/>
+ <ReturnType Type="Collection(Edm.String)" Nullable="false"/>
+ </Function>
+ <Function Name="GetProductsByAccessLevel">
+ <Parameter Name="accessLevel" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" Nullable="false"/>
+ <ReturnType Type="Collection(Edm.String)" Nullable="false"/>
+ </Function>
+ <Function Name="GetActualAmount" IsBound="true">
+ <Parameter Name="giftcard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" Nullable="false"/>
+ <Parameter Name="bonusRate" Type="Edm.Double"/>
+ <ReturnType Type="Edm.Double" Nullable="false"/>
+ </Function>
+ <Function Name="GetDefaultPI" IsBound="true" EntitySetPath="account/MyPaymentInstruments">
+ <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false"/>
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument"/>
+ </Function>
+ <Action Name="RefreshDefaultPI" IsBound="true" EntitySetPath="account/MyPaymentInstruments">
+ <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false"/>
+ <Parameter Name="newDate" Type="Edm.DateTimeOffset"/>
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument"/>
+ </Action>
+ <Function Name="GetHomeAddress" IsBound="true" IsComposable="true">
+ <Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.HomeAddress" Nullable="false"/>
+ </Function>
+ <Function Name="GetAccountInfo" IsBound="true" IsComposable="true">
+ <Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false"/>
+ <ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo" Nullable="false"/>
+ </Function>
+ <ComplexType Name="AccountInfo" OpenType="true">
+ <Property Name="FirstName" Type="Edm.String" Nullable="false"/>
+ <Property Name="LastName" Type="Edm.String" Nullable="false"/>
+ </ComplexType>
+ <EntityType Name="Account">
+ <Key>
+ <PropertyRef Name="AccountID"/>
+ </Key>
+ <Property Name="AccountID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="Country" Type="Edm.String" Nullable="false"/>
+ <Property Name="AccountInfo" Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo"/>
+ <NavigationProperty Name="MyGiftCard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" ContainsTarget="true"/>
+ <NavigationProperty Name="MyPaymentInstruments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument)" ContainsTarget="true"/>
+ <NavigationProperty Name="ActiveSubscriptions" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)" ContainsTarget="true"/>
+ <NavigationProperty Name="AvailableSubscriptionTemplatess" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)"/>
+ </EntityType>
+ <EntityType Name="GiftCard">
+ <Key>
+ <PropertyRef Name="GiftCardID"/>
+ </Key>
+ <Property Name="GiftCardID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="GiftCardNO" Type="Edm.String" Nullable="false"/>
+ <Property Name="Amount" Type="Edm.Double" Nullable="false"/>
+ <Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+ <Property Name="OwnerName" Type="Edm.String"/>
+ </EntityType>
+ <EntityType Name="PaymentInstrument">
+ <Key>
+ <PropertyRef Name="PaymentInstrumentID"/>
+ </Key>
+ <Property Name="PaymentInstrumentID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="FriendlyName" Type="Edm.String" Nullable="false"/>
+ <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+ <NavigationProperty Name="TheStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false"/>
+ <NavigationProperty Name="BillingStatements" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Statement)" ContainsTarget="true"/>
+ <NavigationProperty Name="BackupStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false"/>
+ </EntityType>
+ <EntityType Name="CreditCardPI" BaseType="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument">
+ <Property Name="CardNumber" Type="Edm.String" Nullable="false"/>
+ <Property Name="CVV" Type="Edm.String" Nullable="false"/>
+ <Property Name="HolderName" Type="Edm.String" Nullable="false"/>
+ <Property Name="Balance" Type="Edm.Double" Nullable="false"/>
+ <Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+ <NavigationProperty Name="CreditRecords" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.CreditRecord)" ContainsTarget="true"/>
+ </EntityType>
+ <EntityType Name="StoredPI">
+ <Key>
+ <PropertyRef Name="StoredPIID"/>
+ </Key>
+ <Property Name="StoredPIID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="PIName" Type="Edm.String" Nullable="false"/>
+ <Property Name="PIType" Type="Edm.String" Nullable="false"/>
+ <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+ </EntityType>
+ <EntityType Name="Statement">
+ <Key>
+ <PropertyRef Name="StatementID"/>
+ </Key>
+ <Property Name="StatementID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="TransactionType" Type="Edm.String" Nullable="false"/>
+ <Property Name="TransactionDescription" Type="Edm.String" Nullable="false"/>
+ <Property Name="Amount" Type="Edm.Double" Nullable="false"/>
+ </EntityType>
+ <EntityType Name="CreditRecord">
+ <Key>
+ <PropertyRef Name="CreditRecordID"/>
+ </Key>
+ <Property Name="CreditRecordID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="IsGood" Type="Edm.Boolean" Nullable="false"/>
+ <Property Name="Reason" Type="Edm.String" Nullable="false"/>
+ <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+ </EntityType>
+ <EntityType Name="Subscription">
+ <Key>
+ <PropertyRef Name="SubscriptionID"/>
+ </Key>
+ <Property Name="SubscriptionID" Type="Edm.Int32" Nullable="false"/>
+ <Property Name="TemplateGuid" Type="Edm.String" Nullable="false"/>
+ <Property Name="Title" Type="Edm.String" Nullable="false"/>
+ <Property Name="Category" Type="Edm.String" Nullable="false"/>
+ <Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
+ </EntityType>
+ <EntityContainer Name="InMemoryEntities">
+ <EntitySet Name="People" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Person">
+ <NavigationPropertyBinding Path="Parent" Target="People"/>
+ </EntitySet>
+ <Singleton Name="Boss" Type="Microsoft.Test.OData.Services.ODataWCFService.Person">
+ <NavigationPropertyBinding Path="Parent" Target="People"/>
+ </Singleton>
+ <EntitySet Name="Customers" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Customer">
+ <NavigationPropertyBinding Path="Orders" Target="Orders"/>
+ <NavigationPropertyBinding Path="Parent" Target="People"/>
+ </EntitySet>
+ <Singleton Name="VipCustomer" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer">
+ <NavigationPropertyBinding Path="Orders" Target="Orders"/>
+ <NavigationPropertyBinding Path="Parent" Target="People"/>
+ <NavigationPropertyBinding Path="Company" Target="Company"/>
+ </Singleton>
+ <EntitySet Name="Employees" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Employee">
+ <NavigationPropertyBinding Path="Parent" Target="People"/>
+ <NavigationPropertyBinding Path="Company" Target="Company"/>
+ </EntitySet>
+ <EntitySet Name="Products" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Product">
+ <NavigationPropertyBinding Path="Details" Target="ProductDetails"/>
+ </EntitySet>
+ <EntitySet Name="ProductDetails" EntityType="Microsoft.Test.OData.Services.ODataWCFService.ProductDetail">
+ <NavigationPropertyBinding Path="RelatedProduct" Target="Products"/>
+ <NavigationPropertyBinding Path="Reviews" Target="ProductReviews"/>
+ </EntitySet>
+ <EntitySet Name="ProductReviews" EntityType="Microsoft.Test.OData.Services.ODataWCFService.ProductReview"/>
+ <EntitySet Name="Orders" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Order">
+ <NavigationPropertyBinding Path="LoggedInEmployee" Target="Employees"/>
+ <NavigationPropertyBinding Path="CustomerForOrder" Target="Customers"/>
+ <NavigationPropertyBinding Path="OrderDetails" Target="OrderDetails"/>
+ <Annotation Term="Core.ChangeTracking">
+ <Record>
+ <PropertyValue Property="Supported" Bool="true"/>
+ <PropertyValue Property="FilterableProperties">
+ <Collection>
+ <PropertyPath>OrderID</PropertyPath>
+ </Collection>
+ </PropertyValue>
+ <PropertyValue Property="ExpandableProperties">
+ <Collection>
+ <PropertyPath>OrderDetails</PropertyPath>
+ </Collection>
+ </PropertyValue>
+ </Record>
+ </Annotation>
+ </EntitySet>
+ <EntitySet Name="OrderDetails" EntityType="Microsoft.Test.OData.Services.ODataWCFService.OrderDetail">
+ <NavigationPropertyBinding Path="AssociatedOrder" Target="Orders"/>
+ <NavigationPropertyBinding Path="ProductOrdered" Target="Products"/>
+ </EntitySet>
+ <EntitySet Name="Departments" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Department">
+ <NavigationPropertyBinding Path="Company" Target="Company"/>
+ </EntitySet>
+ <Singleton Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company">
+ <NavigationPropertyBinding Path="Employees" Target="Employees"/>
+ <NavigationPropertyBinding Path="VipCustomer" Target="VipCustomer"/>
+ <NavigationPropertyBinding Path="Departments" Target="Departments"/>
+ <NavigationPropertyBinding Path="CoreDepartment" Target="Departments"/>
+ </Singleton>
+ <Singleton Name="PublicCompany" Type="Microsoft.Test.OData.Services.ODataWCFService.Company">
+ <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PublicCompany/LabourUnion" Target="LabourUnion"/>
+ </Singleton>
+ <Singleton Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion"/>
+ <ActionImport Name="Discount" Action="Microsoft.Test.OData.Services.ODataWCFService.Discount"/>
+ <ActionImport Name="ResetBossEmail" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossEmail"/>
+ <ActionImport Name="ResetBossAddress" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossAddress"/>
+ <ActionImport Name="ResetDataSource" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetDataSource"/>
+ <FunctionImport Name="GetDefaultColor" Function="Microsoft.Test.OData.Services.ODataWCFService.GetDefaultColor" IncludeInServiceDocument="true"/>
+ <FunctionImport Name="GetPerson" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson" EntitySet="People" IncludeInServiceDocument="true"/>
+ <FunctionImport Name="GetPerson2" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson2" EntitySet="People" IncludeInServiceDocument="true"/>
+ <FunctionImport Name="GetAllProducts" Function="Microsoft.Test.OData.Services.ODataWCFService.GetAllProducts" EntitySet="Products" IncludeInServiceDocument="true"/>
+ <FunctionImport Name="GetBossEmails" Function="Microsoft.Test.OData.Services.ODataWCFService.GetBossEmails" IncludeInServiceDocument="true"/>
+ <FunctionImport Name="GetProductsByAccessLevel" Function="Microsoft.Test.OData.Services.ODataWCFService.GetProductsByAccessLevel" IncludeInServiceDocument="true"/>
+ <EntitySet Name="Accounts" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Account">
+ <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/TheStoredPI" Target="StoredPIs"/>
+ <NavigationPropertyBinding Path="AvailableSubscriptionTemplatess" Target="SubscriptionTemplates"/>
+ <NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/BackupStoredPI" Target="DefaultStoredPI"/>
+ </EntitySet>
+ <EntitySet Name="StoredPIs" EntityType="Microsoft.Test.OData.Services.ODataWCFService.StoredPI"/>
+ <EntitySet Name="SubscriptionTemplates" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Subscription"/>
+ <Singleton Name="DefaultStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI"/>
+ </EntityContainer>
+ </Schema>
+ </edmx:DataServices>
+</edmx:Edmx>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/288bbb72/ext/pojogen-maven-plugin/src/it/v4Sample/verify.groovy
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/it/v4Sample/verify.groovy b/ext/pojogen-maven-plugin/src/it/v4Sample/verify.groovy
new file mode 100644
index 0000000..02f0407
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/it/v4Sample/verify.groovy
@@ -0,0 +1,20 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+File basepkg = new File( basedir, "target/generated-sources/ojc-plugin/org/apache/olingo/fit/proxy/v4" );
+assert basepkg.isDirectory() && basepkg.listFiles().length>0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/288bbb72/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractMetadataMojo.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractMetadataMojo.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractMetadataMojo.java
deleted file mode 100644
index 065e172..0000000
--- a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractMetadataMojo.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.ext.pojogen;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.Parameter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.velocity.Template;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.Velocity;
-
-public abstract class AbstractMetadataMojo extends AbstractMojo {
-
- /**
- * Generated files base root.
- */
- @Parameter(property = "outputDirectory", required = true)
- protected String outputDirectory;
-
- /**
- * OData service root URL.
- */
- @Parameter(property = "serviceRootURL", required = true)
- protected String serviceRootURL;
-
- /**
- * Base package.
- */
- @Parameter(property = "basePackage", required = true)
- protected String basePackage;
-
- protected final Set<String> namespaces = new HashSet<String>();
-
- protected static String TOOL_DIR = "ojc-plugin";
-
- protected AbstractUtility utility;
-
- protected abstract AbstractUtility getUtility();
-
- protected abstract String getVersion();
-
- protected File mkdir(final String path) {
- final File dir = new File(outputDirectory + File.separator + TOOL_DIR + File.separator + path);
-
- if (dir.exists()) {
- if (!dir.isDirectory()) {
- throw new IllegalArgumentException("Invalid path '" + path + "': it is not a directory");
- }
- } else {
- dir.mkdirs();
- }
-
- return dir;
- }
-
- protected File mkPkgDir(final String path) {
- return mkdir(basePackage.replace('.', File.separatorChar) + File.separator + path);
- }
-
- protected void writeFile(final String name, final File path, final VelocityContext ctx, final Template template,
- final boolean append) throws MojoExecutionException {
-
- if (!path.exists()) {
- throw new IllegalArgumentException("Invalid base path '" + path.getAbsolutePath() + "'");
- }
-
- FileWriter writer = null;
- try {
- final File toBeWritten = new File(path, name);
- if (!append && toBeWritten.exists()) {
- throw new IllegalStateException("File '" + toBeWritten.getAbsolutePath() + "' already exists");
- }
- writer = new FileWriter(toBeWritten, append);
- template.merge(ctx, writer);
- } catch (IOException e) {
- throw new MojoExecutionException("Error creating file '" + name + "'", e);
- } finally {
- IOUtils.closeQuietly(writer);
- }
- }
-
- protected VelocityContext newContext() {
- final VelocityContext ctx = new VelocityContext();
-
- ctx.put("utility", getUtility());
- ctx.put("basePackage", basePackage);
- ctx.put("schemaName", getUtility().getSchemaName());
- ctx.put("namespace", getUtility().getNamespace());
- ctx.put("namespaces", namespaces);
- ctx.put("odataVersion", getVersion());
-
- return ctx;
- }
-
- protected void parseObj(final File base, final String pkg, final String name, final String out)
- throws MojoExecutionException {
-
- parseObj(base, false, pkg, name, out, Collections.<String, Object>emptyMap());
- }
-
- protected void parseObj(
- final File base,
- final String pkg,
- final String name,
- final String out,
- final Map<String, Object> objs)
- throws MojoExecutionException {
-
- parseObj(base, false, pkg, name, out, objs);
- }
-
- protected void parseObj(
- final File base,
- final boolean append,
- final String pkg,
- final String name,
- final String out,
- final Map<String, Object> objs)
- throws MojoExecutionException {
-
- final VelocityContext ctx = newContext();
- ctx.put("package", pkg);
-
- if (objs != null) {
- for (Map.Entry<String, Object> obj : objs.entrySet()) {
- if (StringUtils.isNotBlank(obj.getKey()) && obj.getValue() != null) {
- ctx.put(obj.getKey(), obj.getValue());
- }
- }
- }
-
- final Template template = Velocity.getTemplate(name + ".vm");
- writeFile(out, base, ctx, template, append);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/288bbb72/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
new file mode 100644
index 0000000..b2023a7
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractPOJOGenMojo.java
@@ -0,0 +1,340 @@
+/*
+ * 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.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+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.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.olingo.client.api.CommonODataClient;
+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.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.Velocity;
+import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
+import org.codehaus.plexus.util.FileUtils;
+
+public abstract class AbstractPOJOGenMojo extends AbstractMojo {
+
+ /**
+ * Generated files base root.
+ */
+ @Parameter(property = "outputDirectory", required = true)
+ protected String outputDirectory;
+
+ /**
+ * OData service root URL.
+ */
+ @Parameter(property = "serviceRootURL", required = false)
+ protected String serviceRootURL;
+
+ /**
+ * Local file from which Edm information can be loaded.
+ */
+ @Parameter(property = "localEdm", required = false)
+ protected String localEdm;
+
+ /**
+ * 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 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);
+ }
+
+ protected abstract void createUtility(Edm edm, EdmSchema schema, String basePackage);
+
+ protected abstract AbstractUtility getUtility();
+
+ protected abstract CommonODataClient<?> getClient();
+
+ private Edm getEdm() throws FileNotFoundException {
+ if (StringUtils.isEmpty(serviceRootURL) && StringUtils.isEmpty(localEdm)) {
+ throw new IllegalArgumentException("Must provide either serviceRootURL or localEdm");
+ }
+ if (StringUtils.isNotEmpty(serviceRootURL) && StringUtils.isNotEmpty(localEdm)) {
+ throw new IllegalArgumentException("Must provide either serviceRootURL or localEdm, not both");
+ }
+
+ Edm edm = null;
+ if (StringUtils.isNotEmpty(serviceRootURL)) {
+ edm = getClient().getRetrieveRequestFactory().getMetadataRequest(serviceRootURL).execute().getBody();
+ } else if (StringUtils.isNotEmpty(localEdm)) {
+ final FileInputStream fis = new FileInputStream(FileUtils.getFile(localEdm));
+ try {
+ edm = getClient().getReader().readMetadata(fis);
+ } finally {
+ IOUtils.closeQuietly(fis);
+ }
+ }
+
+ if (edm == null) {
+ throw new IllegalStateException("Metadata not found");
+ }
+ return edm;
+ }
+
+ @Override
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ if (new File(outputDirectory + File.separator + TOOL_DIR).exists()) {
+ getLog().info("Nothing to do because " + TOOL_DIR + " directory already exists. Clean to update.");
+ return;
+ }
+
+ Velocity.addProperty(Velocity.RESOURCE_LOADER, "class");
+ Velocity.addProperty("class.resource.loader.class", ClasspathResourceLoader.class.getName());
+
+ try {
+ final Edm edm = getEdm();
+
+ for (EdmSchema schema : edm.getSchemas()) {
+ namespaces.add(schema.getNamespace().toLowerCase());
+ }
+
+ final Set<String> complexTypeNames = new HashSet<String>();
+ final File services = mkdir("META-INF/services");
+
+ for (EdmSchema schema : edm.getSchemas()) {
+ createUtility(edm, 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);
+ objs.put("namespace", schema.getNamespace());
+
+ 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);
+ }
+
+ if (ODataServiceVersion.valueOf(getVersion().toUpperCase()).compareTo(ODataServiceVersion.V40) >= 0) {
+ 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) {
+ getLog().error(t);
+
+ throw (t instanceof MojoExecutionException)
+ ? (MojoExecutionException) t
+ : new MojoExecutionException("While executin mojo", t);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/288bbb72/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
index 2930ace..32bfc6b 100644
--- a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java
@@ -206,15 +206,15 @@ public abstract class AbstractUtility {
return result;
}
-
- public List<EdmOperation> justInheritedOperationsBoundTo(final EdmEntityType entity){
+
+ public List<EdmOperation> justInheritedOperationsBoundTo(final EdmEntityType entity) {
final List<EdmOperation> result = new ArrayList<EdmOperation>();
- if(entity.getBaseType()!=null){
+ if (entity.getBaseType() != null) {
result.addAll(getFunctionsBoundTo(entity.getBaseType().getName(), false));
result.addAll(getActionsBoundTo(entity.getBaseType().getName(), false));
result.addAll(justInheritedOperationsBoundTo(entity.getBaseType()));
}
-
+
return result;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/288bbb72/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V3MetadataMojo.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V3MetadataMojo.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V3MetadataMojo.java
deleted file mode 100644
index 9ab6f48..0000000
--- a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V3MetadataMojo.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.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);
- objs.put("namespace", schema.getNamespace());
- 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 executing mojo", t);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/288bbb72/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V3POJOGenMojo.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V3POJOGenMojo.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V3POJOGenMojo.java
new file mode 100644
index 0000000..ead9a7c
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V3POJOGenMojo.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.ext.pojogen;
+
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+/**
+ * POJOs generator.
+ */
+@Mojo(name = "v3pojoGen", defaultPhase = LifecyclePhase.PROCESS_SOURCES)
+public class V3POJOGenMojo extends AbstractPOJOGenMojo {
+
+ @Override
+ protected void createUtility(final Edm edm, final EdmSchema schema, final String basePackage) {
+ utility = new V3Utility(edm, schema, basePackage);
+ }
+
+ @Override
+ protected V3Utility getUtility() {
+ return (V3Utility) utility;
+ }
+
+ @Override
+ protected String getVersion() {
+ return ODataServiceVersion.V30.name().toLowerCase();
+ }
+
+ @Override
+ protected CommonODataClient<?> getClient() {
+ return ODataClientFactory.getV3();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/288bbb72/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4MetadataMojo.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4MetadataMojo.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4MetadataMojo.java
deleted file mode 100644
index 2751726..0000000
--- a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4MetadataMojo.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.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);
- objs.put("namespace", schema.getNamespace());
-
- parseObj(base, pkg, "container",
- utility.capitalize(container.getName()) + ".java", objs);
-
- for (EdmEntitySet entitySet : container.getEntitySets()) {
- objs.clear();
- objs.put("entitySet", entitySet);
- parseObj(base, pkg, "entitySet",
- utility.capitalize(entitySet.getName()) + ".java", objs);
- }
-
- for (EdmSingleton singleton : container.getSingletons()) {
- objs.clear();
- objs.put("singleton", singleton);
- parseObj(base, pkg, "singleton",
- utility.capitalize(singleton.getName()) + ".java", objs);
- }
- }
-
- parseObj(services, true, null, "services", "org.apache.olingo.ext.proxy.api.AbstractComplexType",
- Collections.singletonMap("services", (Object) complexTypeNames));
- }
- } catch (Exception t) {
- final StringWriter stringWriter = new StringWriter();
- final PrintWriter printWriter = new PrintWriter(stringWriter);
- t.printStackTrace(printWriter);
- getLog().error(stringWriter.toString());
-
- throw (t instanceof MojoExecutionException)
- ? (MojoExecutionException) t
- : new MojoExecutionException("While executin mojo", t);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/288bbb72/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4POJOGenMojo.java
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4POJOGenMojo.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4POJOGenMojo.java
new file mode 100644
index 0000000..13d97b7
--- /dev/null
+++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/V4POJOGenMojo.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.ext.pojogen;
+
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmSchema;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+/**
+ * POJOs generator.
+ */
+@Mojo(name = "v4pojoGen", defaultPhase = LifecyclePhase.PROCESS_SOURCES)
+public class V4POJOGenMojo extends AbstractPOJOGenMojo {
+
+ @Override
+ protected void createUtility(final Edm edm, final EdmSchema schema, final String basePackage) {
+ utility = new V4Utility(edm, schema, basePackage);
+ }
+
+ @Override
+ protected V4Utility getUtility() {
+ return (V4Utility) utility;
+ }
+
+ @Override
+ protected String getVersion() {
+ return ODataServiceVersion.V40.name().toLowerCase();
+ }
+
+ @Override
+ protected ODataClient getClient() {
+ return ODataClientFactory.getV4();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/288bbb72/ext/pojogen-maven-plugin/src/main/resources/entityType.vm
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/src/main/resources/entityType.vm b/ext/pojogen-maven-plugin/src/main/resources/entityType.vm
index 82ef821..1114445 100644
--- a/ext/pojogen-maven-plugin/src/main/resources/entityType.vm
+++ b/ext/pojogen-maven-plugin/src/main/resources/entityType.vm
@@ -126,10 +126,10 @@ public interface $utility.capitalize($entityType.Name)
#set( $functions = $utility.getFunctionsBoundTo($entityType.Name, false) )
#set( $actions = $utility.getActionsBoundTo($entityType.Name, false) )
-#set( $inherited = $utility.justInheritedOperationsBoundTo($entityType).size())
+#set( $inherited = $utility.justInheritedOperationsBoundTo($entityType) )
#if( $inherited.size() > 0 || $functions.size() > 0 || $actions.size() > 0 )
#if($inherited.size() > 0)
- @Overide
+ @Override
#end
Operations operations();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/288bbb72/fit/pom.xml
----------------------------------------------------------------------
diff --git a/fit/pom.xml b/fit/pom.xml
index 905f1cf..20081de 100644
--- a/fit/pom.xml
+++ b/fit/pom.xml
@@ -34,11 +34,6 @@
<relativePath>..</relativePath>
</parent>
- <properties>
- <war.maven.plugin.version>2.4</war.maven.plugin.version>
- <invoker.maven.plugin.version>1.8</invoker.maven.plugin.version>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.apache.olingo</groupId>
@@ -48,7 +43,7 @@
<dependency>
<groupId>org.apache.olingo</groupId>
- <artifactId>client-proxy</artifactId>
+ <artifactId>olingo-client-proxy</artifactId>
<version>${project.version}</version>
</dependency>
@@ -115,7 +110,6 @@
<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>
@@ -143,7 +137,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
- <version>${war.maven.plugin.version}</version>
+ <inherited>true</inherited>
<configuration>
<webResources>
<resource>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/288bbb72/fit/src/it/staticServiceV3/pom.xml
----------------------------------------------------------------------
diff --git a/fit/src/it/staticServiceV3/pom.xml b/fit/src/it/staticServiceV3/pom.xml
index 8e8c38b..cd27520 100644
--- a/fit/src/it/staticServiceV3/pom.xml
+++ b/fit/src/it/staticServiceV3/pom.xml
@@ -42,7 +42,7 @@
</dependency>
<dependency>
- <artifactId>client-proxy</artifactId>
+ <artifactId>olingo-client-proxy</artifactId>
<groupId>org.apache.olingo</groupId>
<version>@project.version@</version>
</dependency>
@@ -80,10 +80,10 @@
<serviceRootURL>http://localhost:9080/stub/StaticService/V30/Static.svc</serviceRootURL>
<basePackage>org.apache.olingo.fit.proxy.v3.staticservice</basePackage>
</configuration>
- <id>pojosV3</id>
+ <id>v3pojoGen</id>
<phase>generate-sources</phase>
<goals>
- <goal>pojosV3</goal>
+ <goal>v3pojoGen</goal>
</goals>
</execution>
</executions>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/288bbb72/fit/src/it/staticServiceV4/pom.xml
----------------------------------------------------------------------
diff --git a/fit/src/it/staticServiceV4/pom.xml b/fit/src/it/staticServiceV4/pom.xml
index 31a7ae2..5917364 100644
--- a/fit/src/it/staticServiceV4/pom.xml
+++ b/fit/src/it/staticServiceV4/pom.xml
@@ -42,7 +42,7 @@
</dependency>
<dependency>
- <artifactId>client-proxy</artifactId>
+ <artifactId>olingo-client-proxy</artifactId>
<groupId>org.apache.olingo</groupId>
<version>@project.version@</version>
</dependency>
@@ -80,10 +80,10 @@
<serviceRootURL>http://localhost:9080/stub/StaticService/V40/Static.svc</serviceRootURL>
<basePackage>org.apache.olingo.fit.proxy.v4.staticservice</basePackage>
</configuration>
- <id>pojosV4</id>
+ <id>v4pojoGen</id>
<phase>generate-sources</phase>
<goals>
- <goal>pojosV4</goal>
+ <goal>v4pojoGen</goal>
</goals>
</execution>
</executions>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/288bbb72/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 761127a..97615c8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -351,6 +351,18 @@
<artifactId>jarjar-maven-plugin</artifactId>
<version>1.8</version>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.8</version>
+ </plugin>
</plugins>
</pluginManagement>