[OLINGO-353] fixed + merge
This commit is contained in:
commit
5b3c3d3403
|
@ -0,0 +1,202 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed 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.
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
Apache Olingo
|
||||
Copyright 2013-2014 The Apache Software Foundation
|
||||
|
||||
This product includes software developed at
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
==========================
|
||||
Apache Olingo
|
||||
==========================
|
||||
|
||||
Apache Olingo is a Java library and extensions around
|
||||
the OData specification.
|
||||
|
||||
Apache Olingo supports the specification versions
|
||||
- OData 4.0 <http://www.odata.org/documentation/odata-version-4-0/>
|
||||
|
||||
Building Apache Olingo
|
||||
======================
|
||||
|
||||
You can build Apache Olingo like this:
|
||||
|
||||
mvn clean install
|
||||
|
||||
You need Maven 3 with Java 6 (or higher) for the build.
|
||||
Set the environment variable MAVEN_OPTS to
|
||||
'-Xmx1024m -XX:MaxPermSize=256m' to give Maven more memory.
|
||||
|
||||
Documentation
|
||||
=============
|
||||
|
||||
The project documentation is available here:
|
||||
|
||||
http://olingo.apache.org/
|
||||
|
||||
License (see also package specific LICENSE files)
|
||||
=================================================
|
||||
|
||||
Collective work: Copyright 2014 The Apache Software Foundation.
|
||||
|
||||
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.
|
||||
|
||||
Dependencies with "Weak Copyleft" or dual licenses
|
||||
==================================================
|
||||
|
||||
Apache Olingo uses some libraries with open source licenses that require reciprocal
|
||||
licensing when modified. These libraries are included in unmodified binary
|
||||
form and can be redistributed under terms that are compatible with the
|
||||
Apache License.
|
||||
|
||||
Some libraries used by Apache Olingo are dual-licensed under different open source
|
||||
licenses. These libraries are redistributed under the license whose terms
|
||||
are compatible with the Apache License.
|
||||
|
||||
See LICENSE file included in all Apache Olingo packages for
|
||||
full licensing details.
|
||||
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
<?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</groupId>
|
||||
<artifactId>olingo-dist-android-lib</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
|
||||
<parent>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-dist</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>apache-release</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<inherited>false</inherited>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>package-assemblies</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<attach>true</attach>
|
||||
<appendAssemblyId>true</appendAssemblyId>
|
||||
<descriptors>
|
||||
<descriptor>
|
||||
src/main/assembly/lib-assembly.xml
|
||||
</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-client-core-android</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-client-proxy-android</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,44 @@
|
|||
<?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. -->
|
||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||
<id>lib</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<useProjectArtifact>false</useProjectArtifact>
|
||||
<outputDirectory></outputDirectory>
|
||||
<outputFileNameMapping>${artifact.groupId}-${artifact.artifactId}-${artifact.version}.${artifact.extension}</outputFileNameMapping>
|
||||
<unpack>false</unpack>
|
||||
<useTransitiveDependencies>true</useTransitiveDependencies>
|
||||
<useTransitiveFiltering>true</useTransitiveFiltering>
|
||||
<scope>compile</scope>
|
||||
<includes>
|
||||
<include>org.apache.olingo:olingo-client-core-android</include>
|
||||
<include>org.apache.olingo:olingo-client-proxy-android</include>
|
||||
</includes>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${project.build.directory}/maven-shared-archive-resources/META-INF</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<excludes>
|
||||
<exclude>LICENSE</exclude>
|
||||
</excludes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>src/main/resources</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
|
@ -0,0 +1 @@
|
|||
licenses for android distribution
|
|
@ -0,0 +1,123 @@
|
|||
<?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</groupId>
|
||||
<artifactId>olingo-dist-client-lib</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
|
||||
<parent>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-dist</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>apache-release</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<inherited>false</inherited>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>package-assemblies</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<attach>true</attach>
|
||||
<appendAssemblyId>true</appendAssemblyId>
|
||||
<descriptors>
|
||||
<descriptor>
|
||||
src/main/assembly/lib-assembly.xml
|
||||
</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-commons-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-commons-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-client-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-client-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-client-proxy</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,47 @@
|
|||
<?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. -->
|
||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||
<id>lib</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<useProjectArtifact>false</useProjectArtifact>
|
||||
<outputDirectory></outputDirectory>
|
||||
<outputFileNameMapping>${artifact.groupId}-${artifact.artifactId}-${artifact.version}.${artifact.extension}</outputFileNameMapping>
|
||||
<unpack>false</unpack>
|
||||
<useTransitiveDependencies>true</useTransitiveDependencies>
|
||||
<useTransitiveFiltering>true</useTransitiveFiltering>
|
||||
<scope>compile</scope>
|
||||
<includes>
|
||||
<include>org.apache.olingo:olingo-commons-api</include>
|
||||
<include>org.apache.olingo:olingo-commons-core</include>
|
||||
<include>org.apache.olingo:olingo-client-api</include>
|
||||
<include>org.apache.olingo:olingo-client-core</include>
|
||||
<include>org.apache.olingo:olingo-client-proxy</include>
|
||||
</includes>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${project.build.directory}/maven-shared-archive-resources/META-INF</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<excludes>
|
||||
<exclude>LICENSE</exclude>
|
||||
</excludes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>src/main/resources</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
|
@ -0,0 +1,271 @@
|
|||
licenses for client distribution
|
||||
|
||||
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed 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.
|
||||
|
||||
|
||||
|
||||
From: 'fasterxml.com' (http://fasterxml.com) - Stax2 API
|
||||
(http://wiki.fasterxml.com/WoodstoxStax2)
|
||||
org.codehaus.woodstox:stax2-api:bundle:3.1.4 License: The BSD License
|
||||
(http://www.opensource.org/licenses/bsd-license.php)
|
||||
|
||||
Copyright (c) 2004-2010, Woodstox Project (http://woodstox.codehaus.org/)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
3. Neither the name of the Woodstox XML Processor nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
From: 'QOS.ch' (http://www.qos.ch)
|
||||
- SLF4J API Module (http://www.slf4j.org) org.slf4j:slf4j-api:jar:1.7.7
|
||||
License: MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
- SLF4J Simple Binding (http://www.slf4j.org) org.slf4j:slf4j-simple:jar:1.7.7
|
||||
License: MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
|
||||
|
||||
Copyright (c) 2004-2013 QOS.ch
|
||||
|
||||
All rights reserved. Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom
|
||||
the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
<?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</groupId>
|
||||
<artifactId>olingo-dist-javadoc</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
|
||||
<parent>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-dist</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>target/maven-shared-archive-resources</directory>
|
||||
<includes>
|
||||
<include>META-INF/*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>apache-release</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<inherited>false</inherited>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>package-assemblies</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<attach>true</attach>
|
||||
<appendAssemblyId>true</appendAssemblyId>
|
||||
<descriptors>
|
||||
<descriptor>
|
||||
src/main/assembly/javadoc-assembly.xml
|
||||
</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Lice nsed 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. -->
|
||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||
<id>javadoc</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<directory>${project.parent.parent.build.directory}/apidocs</directory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.build.directory}/maven-shared-archive-resources/META-INF</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<excludes>
|
||||
<exclude>DEPENDENCIES</exclude>
|
||||
</excludes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
|
@ -0,0 +1,58 @@
|
|||
<?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</groupId>
|
||||
<artifactId>olingo-dist</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
|
||||
<parent>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-parent</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
<module>android-lib</module>
|
||||
<module>client-lib</module>
|
||||
<module>server-lib</module>
|
||||
<module>javadoc</module>
|
||||
</modules>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,115 @@
|
|||
<?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</groupId>
|
||||
<artifactId>olingo-dist-server-lib</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
|
||||
<parent>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-dist</artifactId>
|
||||
<version>0.1.0-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>apache-release</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<inherited>false</inherited>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>package-assemblies</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<attach>true</attach>
|
||||
<appendAssemblyId>true</appendAssemblyId>
|
||||
<descriptors>
|
||||
<descriptor>
|
||||
src/main/assembly/lib-assembly.xml
|
||||
</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-commons-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-commons-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-server-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-server-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,46 @@
|
|||
<?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. -->
|
||||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
|
||||
<id>lib</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<useProjectArtifact>false</useProjectArtifact>
|
||||
<outputDirectory></outputDirectory>
|
||||
<outputFileNameMapping>${artifact.groupId}-${artifact.artifactId}-${artifact.version}.${artifact.extension}</outputFileNameMapping>
|
||||
<unpack>false</unpack>
|
||||
<useTransitiveDependencies>true</useTransitiveDependencies>
|
||||
<useTransitiveFiltering>true</useTransitiveFiltering>
|
||||
<scope>compile</scope>
|
||||
<includes>
|
||||
<include>org.apache.olingo:olingo-commons-api</include>
|
||||
<include>org.apache.olingo:olingo-commons-core</include>
|
||||
<include>org.apache.olingo:olingo-server-api</include>
|
||||
<include>org.apache.olingo:olingo-server-core</include>
|
||||
</includes>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${project.build.directory}/maven-shared-archive-resources/META-INF</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<excludes>
|
||||
<exclude>LICENSE</exclude>
|
||||
</excludes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>src/main/resources</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
|
@ -0,0 +1,337 @@
|
|||
licenses for server distribution
|
||||
|
||||
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed 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.
|
||||
|
||||
|
||||
From: 'abego Software GmbH, Germany' (http://abego-software.de) - abego
|
||||
TreeLayout Core (http://code.google.com/p/treelayout/)
|
||||
org.abego.treelayout:org.abego.treelayout.core:jar:1.0.1 License: BSD 3-Clause
|
||||
"New" or "Revised" License (BSD-3-Clause)
|
||||
(http://treelayout.googlecode.com/files/LICENSE.TXT)
|
||||
|
||||
[The "BSD license"]
|
||||
Copyright (c) 2011, abego Software GmbH, Germany (http://www.abego.org)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
3. Neither the name of the abego Software GmbH nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
|
||||
From: 'ANTLR' (http://www.antlr.org) - ANTLR 4 Runtime
|
||||
(http://www.antlr.org/antlr4-runtime) org.antlr:antlr4-runtime:jar:4.1 License:
|
||||
The BSD License (http://www.antlr.org/license.html)
|
||||
|
||||
[The BSD License]
|
||||
Copyright (c) 2012 Terence Parr and Sam Harwell
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer. Redistributions in binary
|
||||
form must reproduce the above copyright notice, this list of conditions and
|
||||
the following disclaimer in the documentation and/or other materials
|
||||
provided with the distribution. Neither the name of the author nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
From: 'fasterxml.com' (http://fasterxml.com) - Stax2 API
|
||||
(http://wiki.fasterxml.com/WoodstoxStax2)
|
||||
org.codehaus.woodstox:stax2-api:bundle:3.1.4 License: The BSD License
|
||||
(http://www.opensource.org/licenses/bsd-license.php)
|
||||
|
||||
Copyright (c) 2004-2010, Woodstox Project (http://woodstox.codehaus.org/)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
3. Neither the name of the Woodstox XML Processor nor the names
|
||||
of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
From: 'QOS.ch' (http://www.qos.ch)
|
||||
- SLF4J API Module (http://www.slf4j.org) org.slf4j:slf4j-api:jar:1.7.7
|
||||
License: MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
- SLF4J Simple Binding (http://www.slf4j.org) org.slf4j:slf4j-simple:jar:1.7.7
|
||||
License: MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
|
||||
|
||||
Copyright (c) 2004-2013 QOS.ch
|
||||
|
||||
All rights reserved. Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated documentation files
|
||||
(the "Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom
|
||||
the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
|
||||
|
|
@ -39,7 +39,12 @@
|
|||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-client-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<optional>true</optional>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.android</groupId>
|
||||
<artifactId>android</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -65,7 +70,6 @@
|
|||
<include>org.apache.commons:commons-lang3</include>
|
||||
<include>org.slf4j:slf4j-api</include>
|
||||
<include>commons-io:commons-io</include>
|
||||
<include>org.apache.httpcomponents:httpcore</include>
|
||||
<include>com.fasterxml.jackson.core:jackson-core</include>
|
||||
<include>com.fasterxml.jackson.core:jackson-databind</include>
|
||||
<include>com.fasterxml.jackson.core:jackson-annotations</include>
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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.client.core.android.http;
|
||||
|
||||
import android.net.http.AndroidHttpClient;
|
||||
import java.net.URI;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.olingo.client.api.http.HttpMethod;
|
||||
import org.apache.olingo.client.core.http.AbstractHttpClientFactory;
|
||||
|
||||
public class AndroidHttpClientFactory extends AbstractHttpClientFactory {
|
||||
|
||||
private static final long serialVersionUID = -5224104561624556177L;
|
||||
|
||||
@Override
|
||||
public AndroidHttpClient create(final HttpMethod method, final URI uri) {
|
||||
return AndroidHttpClient.newInstance(USER_AGENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close(final HttpClient httpClient) {
|
||||
if (httpClient instanceof AndroidHttpClient) {
|
||||
((AndroidHttpClient) httpClient).close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -39,12 +39,37 @@
|
|||
<groupId>org.apache.olingo</groupId>
|
||||
<artifactId>olingo-client-proxy</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<optional>true</optional>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.android</groupId>
|
||||
<artifactId>android</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<inherited>true</inherited>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-client-core-proxy-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>${basedir}/../client-core-android/src/main/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>jarjar-maven-plugin</artifactId>
|
||||
|
@ -67,7 +92,6 @@
|
|||
<include>org.apache.commons:commons-lang3</include>
|
||||
<include>org.slf4j:slf4j-api</include>
|
||||
<include>commons-io:commons-io</include>
|
||||
<include>org.apache.httpcomponents:httpcore</include>
|
||||
<include>com.fasterxml.jackson.core:jackson-core</include>
|
||||
<include>com.fasterxml.jackson.core:jackson-databind</include>
|
||||
<include>com.fasterxml.jackson.core:jackson-annotations</include>
|
||||
|
|
|
@ -23,13 +23,13 @@ import java.util.concurrent.ExecutionException;
|
|||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import org.apache.olingo.client.api.CommonConfiguration;
|
||||
import org.apache.olingo.client.api.Configuration;
|
||||
|
||||
public abstract class AsyncCall<V> implements Future<V> {
|
||||
|
||||
private final Future<V> future;
|
||||
|
||||
public AsyncCall(final CommonConfiguration configuration) {
|
||||
public AsyncCall(final Configuration configuration) {
|
||||
this.future = configuration.getExecutor().submit(new Callable<V>() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -54,8 +54,8 @@ public class TransactionalPersistenceManagerImpl extends AbstractPersistenceMana
|
|||
protected void doFlush(final PersistenceChanges changes, final TransactionItems items) {
|
||||
final CommonODataBatchRequest request =
|
||||
factory.getClient().getBatchRequestFactory().getBatchRequest(factory.getClient().getServiceRoot());
|
||||
String accept = factory.getClient().getConfiguration().getDefaultBatchAcceptFormat().toContentTypeString();
|
||||
((ODataRequest) request).setAccept(accept);
|
||||
((ODataRequest) request).setAccept(
|
||||
factory.getClient().getConfiguration().getDefaultBatchAcceptFormat().toContentTypeString());
|
||||
|
||||
final BatchManager streamManager = (BatchManager) ((ODataStreamedRequest) request).payloadManager();
|
||||
|
||||
|
@ -105,5 +105,6 @@ public class TransactionalPersistenceManagerImpl extends AbstractPersistenceMana
|
|||
}
|
||||
}
|
||||
}
|
||||
response.close();
|
||||
}
|
||||
}
|
||||
|
|
46
fit/pom.xml
46
fit/pom.xml
|
@ -20,7 +20,7 @@
|
|||
|
||||
-->
|
||||
<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">
|
||||
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>olingo-fit</artifactId>
|
||||
|
@ -48,10 +48,31 @@
|
|||
</dependency>
|
||||
|
||||
<!-- REST services CXF -->
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-javamail_1.4_spec</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-rs-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-rs-security-oauth2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-rs-extension-providers</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jettison</groupId>
|
||||
<artifactId>jettison</artifactId>
|
||||
<version>1.3.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
|
@ -113,6 +134,17 @@
|
|||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>target/maven-shared-archive-resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -149,9 +181,9 @@
|
|||
<webResources>
|
||||
<resource>
|
||||
<directory>${project.build.outputDirectory}</directory>
|
||||
<includes>
|
||||
<!--<includes>
|
||||
<include>META-INF/DEPENDENCIES*</include>
|
||||
</includes>
|
||||
</includes>-->
|
||||
</resource>
|
||||
</webResources>
|
||||
<packagingExcludes>WEB-INF/classes/esigate.properties,WEB-INF/classes/META-INF/LICENSE*,WEB-INF/classes/META-INF/DEPENDENCIES*</packagingExcludes>
|
||||
|
@ -182,7 +214,7 @@
|
|||
<cargo.tomcat.ajp.port>${cargo.tomcat.ajp.port}</cargo.tomcat.ajp.port>
|
||||
<cargo.rmi.port>${cargo.rmi.port}</cargo.rmi.port>
|
||||
|
||||
<!--<cargo.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n-->
|
||||
<!--<cargo.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -->
|
||||
<cargo.jvmargs>-noverify -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=256m</cargo.jvmargs>
|
||||
</properties>
|
||||
<files>
|
||||
|
@ -239,11 +271,5 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -127,7 +127,6 @@ public abstract class AbstractServices {
|
|||
protected static final String BOUNDARY = "batch_243234_25424_ef_892u748";
|
||||
|
||||
protected static final String MULTIPART_MIXED = "multipart/mixed";
|
||||
// ContentType.MULTIPART_MIXED.toContentTypeString();
|
||||
|
||||
protected static final String APPLICATION_OCTET_STREAM = "application/octet-stream";
|
||||
|
||||
|
@ -147,7 +146,7 @@ public abstract class AbstractServices {
|
|||
|
||||
protected final JSONUtilities json;
|
||||
|
||||
public AbstractServices(final ODataServiceVersion version, final Metadata metadata) throws Exception {
|
||||
public AbstractServices(final ODataServiceVersion version, final Metadata metadata) throws IOException {
|
||||
this.version = version;
|
||||
this.metadata = metadata;
|
||||
|
||||
|
@ -264,7 +263,6 @@ public abstract class AbstractServices {
|
|||
return xml.createFaultResponse(Accept.JSON_FULLMETA.toString(version), new Exception("Non nullable properties"));
|
||||
}
|
||||
// ----------------------------------------------
|
||||
|
||||
protected Response bodyPartRequest(final MimeBodyPart body) throws Exception {
|
||||
return bodyPartRequest(body, Collections.<String, String>emptyMap());
|
||||
}
|
||||
|
@ -329,7 +327,8 @@ public abstract class AbstractServices {
|
|||
}
|
||||
}
|
||||
|
||||
client.close();
|
||||
// When updating to CXF 3.0.1, uncomment the following line, see CXF-5865
|
||||
//client.close();
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -636,8 +635,11 @@ public abstract class AbstractServices {
|
|||
prop.setName(id.getKey());
|
||||
prop.setType(id.getValue().toString());
|
||||
prop.setValue(ValueType.PRIMITIVE,
|
||||
id.getValue() == EdmPrimitiveTypeKind.Int32 ? Integer.parseInt(entityKey) : id.getValue()
|
||||
== EdmPrimitiveTypeKind.Guid ? UUID.fromString(entityKey) : entityKey);
|
||||
id.getValue() == EdmPrimitiveTypeKind.Int32
|
||||
? Integer.parseInt(entityKey)
|
||||
: id.getValue() == EdmPrimitiveTypeKind.Guid
|
||||
? UUID.fromString(entityKey)
|
||||
: entityKey);
|
||||
entry.getProperties().add(prop);
|
||||
}
|
||||
|
||||
|
@ -677,7 +679,7 @@ public abstract class AbstractServices {
|
|||
ResWrap<Entity> result = atomDeserializer.toEntity(serialization);
|
||||
result = new ResWrap<Entity>(
|
||||
URI.create(Constants.get(version, ConstantKey.ODATA_METADATA_PREFIX)
|
||||
+ entitySetName + Constants.get(version, ConstantKey.ODATA_METADATA_ENTITY_SUFFIX)),
|
||||
+ entitySetName + Constants.get(version, ConstantKey.ODATA_METADATA_ENTITY_SUFFIX)),
|
||||
null, result.getPayload());
|
||||
|
||||
final String path = Commons.getEntityBasePath(entitySetName, entityKey);
|
||||
|
@ -752,7 +754,7 @@ public abstract class AbstractServices {
|
|||
final FSManager fsManager = FSManager.instance(version);
|
||||
fsManager.putInMemory(xml.writeEntity(Accept.ATOM, container),
|
||||
fsManager.getAbsolutePath(Commons.getEntityBasePath("Person", entityId) + Constants.get(version,
|
||||
ConstantKey.ENTITY), Accept.ATOM));
|
||||
ConstantKey.ENTITY), Accept.ATOM));
|
||||
|
||||
return utils.getValue().createResponse(null, null, null, utils.getKey(), Response.Status.NO_CONTENT);
|
||||
} catch (Exception e) {
|
||||
|
@ -846,7 +848,7 @@ public abstract class AbstractServices {
|
|||
final FSManager fsManager = FSManager.instance(version);
|
||||
fsManager.putInMemory(xml.writeEntity(Accept.ATOM, container),
|
||||
fsManager.getAbsolutePath(Commons.getEntityBasePath("Product", entityId) + Constants.get(version,
|
||||
ConstantKey.ENTITY), Accept.ATOM));
|
||||
ConstantKey.ENTITY), Accept.ATOM));
|
||||
|
||||
return utils.getValue().createResponse(null, null, null, utils.getKey(), Response.Status.NO_CONTENT);
|
||||
} catch (Exception e) {
|
||||
|
@ -884,7 +886,7 @@ public abstract class AbstractServices {
|
|||
final FSManager fsManager = FSManager.instance(version);
|
||||
fsManager.putInMemory(xml.writeEntity(Accept.ATOM, container),
|
||||
fsManager.getAbsolutePath(Commons.getEntityBasePath("ComputerDetail", entityId) + Constants.get(version,
|
||||
ConstantKey.ENTITY), Accept.ATOM));
|
||||
ConstantKey.ENTITY), Accept.ATOM));
|
||||
|
||||
return utils.getValue().createResponse(null, null, null, utils.getKey(), Response.Status.NO_CONTENT);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -23,15 +23,15 @@ public class UnsupportedMediaTypeException extends RuntimeException {
|
|||
private static final long serialVersionUID = 9076398602010056960L;
|
||||
|
||||
/**
|
||||
* Creates a new instance of
|
||||
* <code>UnsupportedMediaTypeException</code> without detail message.
|
||||
* Creates a new instance of <code>UnsupportedMediaTypeException</code> without detail message.
|
||||
*/
|
||||
public UnsupportedMediaTypeException() {}
|
||||
public UnsupportedMediaTypeException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an instance of
|
||||
* <code>UnsupportedMediaTypeException</code> with the specified detail message.
|
||||
*
|
||||
* Constructs an instance of <code>UnsupportedMediaTypeException</code> with the specified detail message.
|
||||
*
|
||||
* @param msg the detail message.
|
||||
*/
|
||||
public UnsupportedMediaTypeException(final String msg) {
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit;
|
|||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -52,16 +53,16 @@ import org.springframework.stereotype.Service;
|
|||
@Path("/V30/ActionOverloading.svc")
|
||||
public class V3ActionOverloading extends V3Services {
|
||||
|
||||
public V3ActionOverloading() throws Exception {
|
||||
public V3ActionOverloading() throws IOException {
|
||||
super(new Metadata(FSManager.instance(ODataServiceVersion.V30).readRes(
|
||||
"actionOverloading" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)),
|
||||
Accept.XML), ODataServiceVersion.V30));
|
||||
"actionOverloading" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)),
|
||||
Accept.XML), ODataServiceVersion.V30));
|
||||
}
|
||||
|
||||
private Response replaceServiceName(final Response response) {
|
||||
try {
|
||||
final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
|
||||
replaceAll("Static\\.svc", "ActionOverloading.svc");
|
||||
replaceAll("Static\\.svc", "ActionOverloading.svc");
|
||||
|
||||
final Response.ResponseBuilder builder = Response.status(response.getStatus());
|
||||
for (String headerName : response.getHeaders().keySet()) {
|
||||
|
@ -90,15 +91,15 @@ public class V3ActionOverloading extends V3Services {
|
|||
@Override
|
||||
public Response getMetadata() {
|
||||
return super.getMetadata("actionOverloading"
|
||||
+ StringUtils.capitalize(Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)));
|
||||
+ StringUtils.capitalize(Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)));
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/RetrieveProduct")
|
||||
public Response unboundRetrieveProduct(
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType) {
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType) {
|
||||
|
||||
final Accept acceptType;
|
||||
if (StringUtils.isNotBlank(format)) {
|
||||
|
@ -112,7 +113,7 @@ public class V3ActionOverloading extends V3Services {
|
|||
|
||||
try {
|
||||
final InputStream result = FSManager.instance(ODataServiceVersion.V30).
|
||||
readFile("actionOverloadingRetrieveProduct", acceptType);
|
||||
readFile("actionOverloadingRetrieveProduct", acceptType);
|
||||
return replaceServiceName(xml.createResponse(result, null, acceptType));
|
||||
} catch (Exception e) {
|
||||
return replaceServiceName(xml.createFaultResponse(accept, e));
|
||||
|
@ -123,10 +124,10 @@ public class V3ActionOverloading extends V3Services {
|
|||
@Path("/Product({entityId})")
|
||||
@Override
|
||||
public Response getProduct(
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
|
||||
final Map.Entry<Accept, AbstractUtilities> utils = super.getUtilities(accept, format);
|
||||
|
||||
|
@ -140,12 +141,12 @@ public class V3ActionOverloading extends V3Services {
|
|||
try {
|
||||
if (utils.getKey() == Accept.JSON_FULLMETA || utils.getKey() == Accept.ATOM) {
|
||||
entity = utils.getValue().addOperation(entity, "RetrieveProduct", "#DefaultContainer.RetrieveProduct",
|
||||
uriInfo.getAbsolutePath().toASCIIString()
|
||||
uriInfo.getAbsolutePath().toASCIIString()
|
||||
+ "/RetrieveProduct");
|
||||
}
|
||||
|
||||
return replaceServiceName(utils.getValue().createResponse(
|
||||
entity, Commons.getETag(entityInfo.getKey(), ODataServiceVersion.V30), utils.getKey()));
|
||||
entity, Commons.getETag(entityInfo.getKey(), ODataServiceVersion.V30), utils.getKey()));
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error retrieving entity", e);
|
||||
return replaceServiceName(xml.createFaultResponse(accept, e));
|
||||
|
@ -155,9 +156,9 @@ public class V3ActionOverloading extends V3Services {
|
|||
@POST
|
||||
@Path("/Product({entityId})/{path:.*RetrieveProduct}")
|
||||
public Response productBoundRetrieveProduct(
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType) {
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType) {
|
||||
|
||||
return unboundRetrieveProduct(accept, format, contentType);
|
||||
}
|
||||
|
@ -165,11 +166,11 @@ public class V3ActionOverloading extends V3Services {
|
|||
@GET
|
||||
@Path("/OrderLine(OrderId={orderId},ProductId={productId})")
|
||||
public Response getOrderLine(
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@PathParam("orderId") final String orderId,
|
||||
@PathParam("productId") final String productId,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@PathParam("orderId") final String orderId,
|
||||
@PathParam("productId") final String productId,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
|
||||
final Map.Entry<Accept, AbstractUtilities> utils = super.getUtilities(accept, format);
|
||||
|
||||
|
@ -178,18 +179,18 @@ public class V3ActionOverloading extends V3Services {
|
|||
}
|
||||
|
||||
final Map.Entry<String, InputStream> entityInfo = utils.getValue().
|
||||
readEntity("OrderLine", orderId + " " + productId, utils.getKey());
|
||||
readEntity("OrderLine", orderId + " " + productId, utils.getKey());
|
||||
|
||||
InputStream entity = entityInfo.getValue();
|
||||
try {
|
||||
if (utils.getKey() == Accept.JSON_FULLMETA || utils.getKey() == Accept.ATOM) {
|
||||
entity = utils.getValue().addOperation(entity, "RetrieveProduct", "#DefaultContainer.RetrieveProduct",
|
||||
uriInfo.getAbsolutePath().toASCIIString()
|
||||
uriInfo.getAbsolutePath().toASCIIString()
|
||||
+ "/RetrieveProduct");
|
||||
}
|
||||
|
||||
return replaceServiceName(utils.getValue().createResponse(
|
||||
entity, Commons.getETag(entityInfo.getKey(), ODataServiceVersion.V30), utils.getKey()));
|
||||
entity, Commons.getETag(entityInfo.getKey(), ODataServiceVersion.V30), utils.getKey()));
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error retrieving entity", e);
|
||||
return replaceServiceName(xml.createFaultResponse(accept, e));
|
||||
|
@ -199,9 +200,9 @@ public class V3ActionOverloading extends V3Services {
|
|||
@POST
|
||||
@Path("/OrderLine(OrderId={orderId},ProductId={productId})/{path:.*RetrieveProduct}")
|
||||
public Response orderLineBoundRetrieveProduct(
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType) {
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType) {
|
||||
|
||||
return unboundRetrieveProduct(accept, format, contentType);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit;
|
|||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
|
@ -49,7 +50,7 @@ import org.springframework.stereotype.Service;
|
|||
@Path("/V30/KeyAsSegment.svc")
|
||||
public class V3KeyAsSegment extends V3Services {
|
||||
|
||||
public V3KeyAsSegment() throws Exception {
|
||||
public V3KeyAsSegment() throws IOException {
|
||||
super();
|
||||
}
|
||||
|
||||
|
@ -109,6 +110,7 @@ public class V3KeyAsSegment extends V3Services {
|
|||
@Path("/{entitySetName}/{entityId}")
|
||||
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
|
||||
@Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
|
||||
|
||||
@Override
|
||||
public Response mergeEntity(
|
||||
@Context final UriInfo uriInfo,
|
||||
|
@ -128,6 +130,7 @@ public class V3KeyAsSegment extends V3Services {
|
|||
@Path("/{entitySetName}/{entityId}")
|
||||
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
|
||||
@Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
|
||||
|
||||
@Override
|
||||
public Response patchEntity(
|
||||
@Context final UriInfo uriInfo,
|
||||
|
@ -164,6 +167,7 @@ public class V3KeyAsSegment extends V3Services {
|
|||
@Path("/{entitySetName}")
|
||||
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
|
||||
@Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM})
|
||||
|
||||
@Override
|
||||
public Response postNewEntity(
|
||||
@Context final UriInfo uriInfo,
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit;
|
|||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -55,16 +56,16 @@ public class V3OpenType extends V3Services {
|
|||
|
||||
private static final Pattern GUID = Pattern.compile("guid'(.*)'");
|
||||
|
||||
public V3OpenType() throws Exception {
|
||||
public V3OpenType() throws IOException {
|
||||
super(new Metadata(FSManager.instance(ODataServiceVersion.V30).
|
||||
readRes("openType" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)),
|
||||
Accept.XML), ODataServiceVersion.V30));
|
||||
readRes("openType" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)),
|
||||
Accept.XML), ODataServiceVersion.V30));
|
||||
}
|
||||
|
||||
private Response replaceServiceName(final Response response) {
|
||||
try {
|
||||
final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
|
||||
replaceAll("Static\\.svc", "OpenType.svc");
|
||||
replaceAll("Static\\.svc", "OpenType.svc");
|
||||
|
||||
final Response.ResponseBuilder builder = Response.status(response.getStatus());
|
||||
for (String headerName : response.getHeaders().keySet()) {
|
||||
|
@ -89,7 +90,7 @@ public class V3OpenType extends V3Services {
|
|||
|
||||
/**
|
||||
* Provide sample large metadata.
|
||||
*
|
||||
*
|
||||
* @return metadata.
|
||||
*/
|
||||
@GET
|
||||
|
@ -98,20 +99,20 @@ public class V3OpenType extends V3Services {
|
|||
@Override
|
||||
public Response getMetadata() {
|
||||
return super.getMetadata("openType" + StringUtils.capitalize(
|
||||
Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)));
|
||||
Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)));
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{entitySetName}({entityId})")
|
||||
@Override
|
||||
public Response getEntity(
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
@QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
|
||||
@QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
@QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
|
||||
@QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
|
||||
|
||||
final Matcher matcher = GUID.matcher(entityId);
|
||||
return replaceServiceName(super.getEntityInternal(
|
||||
|
@ -121,16 +122,16 @@ public class V3OpenType extends V3Services {
|
|||
|
||||
@POST
|
||||
@Path("/{entitySetName}")
|
||||
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
|
||||
@Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
|
||||
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
|
||||
@Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM})
|
||||
@Override
|
||||
public Response postNewEntity(
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
final String entity) {
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
final String entity) {
|
||||
|
||||
return replaceServiceName(super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
|
||||
}
|
||||
|
@ -139,11 +140,11 @@ public class V3OpenType extends V3Services {
|
|||
@Path("/{entitySetName}({entityId})")
|
||||
@Override
|
||||
public Response removeEntity(
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId) {
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId) {
|
||||
|
||||
final Matcher matcher = GUID.matcher(entityId);
|
||||
return replaceServiceName(super.removeEntity(entitySetName,
|
||||
matcher.matches() ? matcher.group(1) : entityId));
|
||||
matcher.matches() ? matcher.group(1) : entityId));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.apache.olingo.fit;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
@ -32,15 +33,10 @@ import org.springframework.stereotype.Service;
|
|||
@Path("/V30/PrimitiveKeys.svc")
|
||||
public class V3PrimitiveKeys extends V3Services {
|
||||
|
||||
public V3PrimitiveKeys() throws Exception {
|
||||
public V3PrimitiveKeys() throws IOException {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide sample large metadata.
|
||||
*
|
||||
* @return metadata.
|
||||
*/
|
||||
@GET
|
||||
@Path("/$metadata")
|
||||
@Produces(MediaType.APPLICATION_XML)
|
||||
|
@ -48,7 +44,7 @@ public class V3PrimitiveKeys extends V3Services {
|
|||
public Response getMetadata() {
|
||||
try {
|
||||
return xml.createResponse(
|
||||
null, FSManager.instance(version).readRes("primitiveKeysMetadata", Accept.XML), null, Accept.XML);
|
||||
null, FSManager.instance(version).readRes("primitiveKeysMetadata", Accept.XML), null, Accept.XML);
|
||||
} catch (Exception e) {
|
||||
return xml.createFaultResponse(Accept.XML.toString(version), e);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ import org.apache.olingo.fit.utils.ConstantKey;
|
|||
import org.apache.olingo.fit.utils.Constants;
|
||||
import org.apache.olingo.fit.utils.FSManager;
|
||||
import org.apache.olingo.fit.utils.LinkInfo;
|
||||
import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
|
||||
import org.apache.olingo.fit.rest.XHTTPMethodInterceptor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
|
@ -70,19 +70,19 @@ import org.springframework.stereotype.Service;
|
|||
@InInterceptors(classes = XHTTPMethodInterceptor.class)
|
||||
public class V3Services extends AbstractServices {
|
||||
|
||||
public V3Services() throws Exception {
|
||||
public V3Services() throws IOException {
|
||||
super(ODataServiceVersion.V30, Commons.getMetadata(ODataServiceVersion.V30));
|
||||
}
|
||||
|
||||
protected V3Services(final Metadata metadata) throws Exception {
|
||||
protected V3Services(final Metadata metadata) throws IOException {
|
||||
super(ODataServiceVersion.V30, metadata);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/InStreamErrorGetCustomer")
|
||||
public Response instreamErrorGetCustomer(
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
|
||||
final Accept acceptType;
|
||||
if (StringUtils.isNotBlank(format)) {
|
||||
|
@ -95,9 +95,9 @@ public class V3Services extends AbstractServices {
|
|||
final InputStream error = FSManager.instance(version).readFile("InStreamErrorGetCustomer", acceptType);
|
||||
|
||||
return Response.ok(error).
|
||||
header(Constants.get(version, ConstantKey.ODATA_SERVICE_VERSION), version + ";").
|
||||
header("Content-Type", acceptType.toString(version)).
|
||||
build();
|
||||
header(Constants.get(version, ConstantKey.ODATA_SERVICE_VERSION), version + ";").
|
||||
header("Content-Type", acceptType.toString(version)).
|
||||
build();
|
||||
} catch (Exception e) {
|
||||
if (acceptType == Accept.XML || acceptType == Accept.TEXT) {
|
||||
throw new UnsupportedMediaTypeException("Unsupported media type");
|
||||
|
@ -109,7 +109,7 @@ public class V3Services extends AbstractServices {
|
|||
|
||||
/**
|
||||
* Provide sample large metadata.
|
||||
*
|
||||
*
|
||||
* @return metadata.
|
||||
*/
|
||||
@GET
|
||||
|
@ -128,8 +128,9 @@ public class V3Services extends AbstractServices {
|
|||
|
||||
@Override
|
||||
public InputStream exploreMultipart(
|
||||
final List<Attachment> attachments, final String boundary, final boolean contineOnError)
|
||||
throws IOException {
|
||||
final List<Attachment> attachments, final String boundary, final boolean contineOnError)
|
||||
throws IOException {
|
||||
|
||||
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
|
||||
Response res = null;
|
||||
|
@ -197,7 +198,6 @@ public class V3Services extends AbstractServices {
|
|||
|
||||
addSingleBatchResponse(res, bos);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
if (res == null || res.getStatus() < 400) {
|
||||
addErrorBatchResponse(e, bos);
|
||||
|
@ -215,15 +215,15 @@ public class V3Services extends AbstractServices {
|
|||
@GET
|
||||
@Path("/Car/{type:[a-zA-Z].*}")
|
||||
public Response filterCar(
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@QueryParam("$top") @DefaultValue(StringUtils.EMPTY) final String top,
|
||||
@QueryParam("$skip") @DefaultValue(StringUtils.EMPTY) final String skip,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
@QueryParam("$inlinecount") @DefaultValue(StringUtils.EMPTY) final String count,
|
||||
@QueryParam("$filter") @DefaultValue(StringUtils.EMPTY) final String filter,
|
||||
@QueryParam("$orderby") @DefaultValue(StringUtils.EMPTY) final String orderby,
|
||||
@QueryParam("$skiptoken") @DefaultValue(StringUtils.EMPTY) final String skiptoken) {
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@QueryParam("$top") @DefaultValue(StringUtils.EMPTY) final String top,
|
||||
@QueryParam("$skip") @DefaultValue(StringUtils.EMPTY) final String skip,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
@QueryParam("$inlinecount") @DefaultValue(StringUtils.EMPTY) final String count,
|
||||
@QueryParam("$filter") @DefaultValue(StringUtils.EMPTY) final String filter,
|
||||
@QueryParam("$orderby") @DefaultValue(StringUtils.EMPTY) final String orderby,
|
||||
@QueryParam("$skiptoken") @DefaultValue(StringUtils.EMPTY) final String skiptoken) {
|
||||
|
||||
return super.getEntitySet(uriInfo, accept, "Car", top, skip, format, count, filter, orderby, skiptoken);
|
||||
}
|
||||
|
@ -231,12 +231,12 @@ public class V3Services extends AbstractServices {
|
|||
@GET
|
||||
@Path("/Login({entityId})")
|
||||
public Response getLogin(
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
@QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
|
||||
@QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
@QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
|
||||
@QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
|
||||
|
||||
return super.getEntityInternal(uriInfo.getRequestUri().toASCIIString(), accept,
|
||||
"Login", StringUtils.remove(entityId, "'"), format, expand, select);
|
||||
|
@ -244,14 +244,14 @@ public class V3Services extends AbstractServices {
|
|||
|
||||
@POST
|
||||
@Path("/Login")
|
||||
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
|
||||
@Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
|
||||
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
|
||||
@Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM})
|
||||
public Response postLogin(
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
|
||||
final String entity) {
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
|
||||
final String entity) {
|
||||
|
||||
if ("{\"odata.type\":\"Microsoft.Test.OData.Services.AstoriaDefaultService.Login\"}".equals(entity)) {
|
||||
return xml.createFaultResponse(accept, new BadRequestException());
|
||||
|
@ -263,14 +263,14 @@ public class V3Services extends AbstractServices {
|
|||
@DELETE
|
||||
@Path("/Login({entityId})")
|
||||
public Response removeLogin(
|
||||
@PathParam("entityId") final String entityId) {
|
||||
@PathParam("entityId") final String entityId) {
|
||||
|
||||
return super.removeEntity("Login", StringUtils.remove(entityId, "'"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve links sample.
|
||||
*
|
||||
*
|
||||
* @param accept Accept header.
|
||||
* @param entitySetName Entity set name.
|
||||
* @param entityId entity id.
|
||||
|
@ -281,11 +281,11 @@ public class V3Services extends AbstractServices {
|
|||
@GET
|
||||
@Path("/{entitySetName}({entityId})/$links/{linkName}")
|
||||
public Response getLinks(
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@PathParam("linkName") final String linkName,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@PathParam("linkName") final String linkName,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
try {
|
||||
final Accept acceptType;
|
||||
if (StringUtils.isNotBlank(format)) {
|
||||
|
@ -301,9 +301,9 @@ public class V3Services extends AbstractServices {
|
|||
final LinkInfo links = xml.readLinks(entitySetName, entityId, linkName, acceptType);
|
||||
|
||||
return xml.createResponse(
|
||||
links.getLinks(),
|
||||
links.getEtag(),
|
||||
acceptType);
|
||||
links.getLinks(),
|
||||
links.getEtag(),
|
||||
acceptType);
|
||||
} catch (Exception e) {
|
||||
return xml.createFaultResponse(accept, e);
|
||||
}
|
||||
|
@ -312,13 +312,13 @@ public class V3Services extends AbstractServices {
|
|||
@POST
|
||||
@Path("/{entitySetName}({entityId})/$links/{linkName}")
|
||||
public Response postLink(
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@PathParam("linkName") final String linkName,
|
||||
final String link,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@PathParam("linkName") final String linkName,
|
||||
final String link,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
try {
|
||||
final Accept acceptType;
|
||||
if (StringUtils.isNotBlank(format)) {
|
||||
|
@ -348,11 +348,11 @@ public class V3Services extends AbstractServices {
|
|||
}
|
||||
|
||||
utils.putLinksInMemory(
|
||||
Commons.getEntityBasePath(entitySetName, entityId),
|
||||
entitySetName,
|
||||
entityId,
|
||||
linkName,
|
||||
links);
|
||||
Commons.getEntityBasePath(entitySetName, entityId),
|
||||
entitySetName,
|
||||
entityId,
|
||||
linkName,
|
||||
links);
|
||||
|
||||
return xml.createResponse(null, null, null, Response.Status.NO_CONTENT);
|
||||
} catch (Exception e) {
|
||||
|
@ -363,39 +363,39 @@ public class V3Services extends AbstractServices {
|
|||
@MERGE
|
||||
@Path("/{entitySetName}({entityId})/$links/{linkName}")
|
||||
public Response mergeLink(
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@PathParam("linkName") final String linkName,
|
||||
final String link,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@PathParam("linkName") final String linkName,
|
||||
final String link,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
return putLink(accept, contentType, entitySetName, entityId, linkName, link, format);
|
||||
}
|
||||
|
||||
@PATCH
|
||||
@Path("/{entitySetName}({entityId})/$links/{linkName}")
|
||||
public Response patchLink(
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@PathParam("linkName") final String linkName,
|
||||
final String link,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@PathParam("linkName") final String linkName,
|
||||
final String link,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
return putLink(accept, contentType, entitySetName, entityId, linkName, link, format);
|
||||
}
|
||||
|
||||
@PUT
|
||||
@Path("/{entitySetName}({entityId})/$links/{linkName}")
|
||||
public Response putLink(
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@PathParam("linkName") final String linkName,
|
||||
final String link,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@PathParam("linkName") final String linkName,
|
||||
final String link,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
try {
|
||||
final Accept acceptType;
|
||||
if (StringUtils.isNotBlank(format)) {
|
||||
|
@ -425,10 +425,10 @@ public class V3Services extends AbstractServices {
|
|||
}
|
||||
|
||||
utils.putLinksInMemory(
|
||||
Commons.getEntityBasePath(entitySetName, entityId),
|
||||
entitySetName,
|
||||
linkName,
|
||||
links);
|
||||
Commons.getEntityBasePath(entitySetName, entityId),
|
||||
entitySetName,
|
||||
linkName,
|
||||
links);
|
||||
|
||||
return xml.createResponse(null, null, null, Response.Status.NO_CONTENT);
|
||||
} catch (Exception e) {
|
||||
|
@ -439,13 +439,13 @@ public class V3Services extends AbstractServices {
|
|||
@DELETE
|
||||
@Path("/{entitySetName}({entityId})/$links/{linkName}({linkId})")
|
||||
public Response deleteLink(
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@PathParam("linkName") final String linkName,
|
||||
@PathParam("linkId") final String linkId,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@PathParam("linkName") final String linkName,
|
||||
@PathParam("linkId") final String linkId,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
|
||||
try {
|
||||
final Accept acceptType;
|
||||
if (StringUtils.isNotBlank(format)) {
|
||||
|
@ -461,19 +461,19 @@ public class V3Services extends AbstractServices {
|
|||
final AbstractUtilities utils = getUtilities(acceptType);
|
||||
|
||||
final Map.Entry<String, List<String>> currents = json.extractLinkURIs(utils.readLinks(
|
||||
entitySetName, entityId, linkName, Accept.JSON_FULLMETA).getLinks());
|
||||
entitySetName, entityId, linkName, Accept.JSON_FULLMETA).getLinks());
|
||||
|
||||
final Map.Entry<String, List<String>> toBeRemoved = json.extractLinkURIs(utils.readLinks(
|
||||
entitySetName, entityId, linkName + "(" + linkId + ")", Accept.JSON_FULLMETA).getLinks());
|
||||
entitySetName, entityId, linkName + "(" + linkId + ")", Accept.JSON_FULLMETA).getLinks());
|
||||
|
||||
final List<String> remains = currents.getValue();
|
||||
remains.removeAll(toBeRemoved.getValue());
|
||||
|
||||
utils.putLinksInMemory(
|
||||
Commons.getEntityBasePath(entitySetName, entityId),
|
||||
entitySetName,
|
||||
linkName,
|
||||
remains);
|
||||
Commons.getEntityBasePath(entitySetName, entityId),
|
||||
entitySetName,
|
||||
linkName,
|
||||
remains);
|
||||
|
||||
return xml.createResponse(null, null, null, Response.Status.NO_CONTENT);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit;
|
|||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
|
@ -52,16 +53,16 @@ import org.springframework.stereotype.Service;
|
|||
@Path("/V40/Demo.svc")
|
||||
public class V4Demo extends V4Services {
|
||||
|
||||
public V4Demo() throws Exception {
|
||||
public V4Demo() throws IOException {
|
||||
super(new Metadata(FSManager.instance(ODataServiceVersion.V40).
|
||||
readRes("demo" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)),
|
||||
Accept.XML), ODataServiceVersion.V40));
|
||||
readRes("demo" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)),
|
||||
Accept.XML), ODataServiceVersion.V40));
|
||||
}
|
||||
|
||||
private Response replaceServiceName(final Response response) {
|
||||
try {
|
||||
final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
|
||||
replaceAll("Static\\.svc", "Demo.svc");
|
||||
replaceAll("Static\\.svc", "Demo.svc");
|
||||
|
||||
final Response.ResponseBuilder builder = Response.status(response.getStatus());
|
||||
for (String headerName : response.getHeaders().keySet()) {
|
||||
|
@ -90,20 +91,20 @@ public class V4Demo extends V4Services {
|
|||
@Override
|
||||
public Response getMetadata() {
|
||||
return super.getMetadata(
|
||||
"demo" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)));
|
||||
"demo" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)));
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{entitySetName}({entityId})")
|
||||
@Override
|
||||
public Response getEntity(
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
@QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
|
||||
@QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
@QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
|
||||
@QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
|
||||
|
||||
return replaceServiceName(super.getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
|
||||
accept, entitySetName, entityId, format, expand, select));
|
||||
|
@ -113,61 +114,61 @@ public class V4Demo extends V4Services {
|
|||
@Path("/{entitySetName}({entityId})/$value")
|
||||
@Override
|
||||
public Response getMediaEntity(
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId) {
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId) {
|
||||
|
||||
return super.getMediaEntity(uriInfo, accept, entitySetName, entityId);
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/{entitySetName}")
|
||||
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
|
||||
@Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
|
||||
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
|
||||
@Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM})
|
||||
@Override
|
||||
public Response postNewEntity(
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
final String entity) {
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
final String entity) {
|
||||
|
||||
return replaceServiceName(super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
|
||||
}
|
||||
|
||||
@PATCH
|
||||
@Path("/{entitySetName}({entityId})")
|
||||
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
|
||||
@Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
|
||||
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
|
||||
@Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
|
||||
@Override
|
||||
public Response patchEntity(
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
|
||||
@HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) final String ifMatch,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
final String changes) {
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
|
||||
@HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) final String ifMatch,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
final String changes) {
|
||||
|
||||
return replaceServiceName(super.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId,
|
||||
changes));
|
||||
changes));
|
||||
}
|
||||
|
||||
@PUT
|
||||
@Produces({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
|
||||
@Consumes({ MediaType.WILDCARD, MediaType.APPLICATION_OCTET_STREAM })
|
||||
@Produces({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
|
||||
@Consumes({MediaType.WILDCARD, MediaType.APPLICATION_OCTET_STREAM})
|
||||
@Path("/{entitySetName}({entityId})/$value")
|
||||
@Override
|
||||
public Response replaceMediaEntity(
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
final String value) {
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
final String value) {
|
||||
|
||||
return super.replaceMediaEntity(uriInfo, prefer, entitySetName, entityId, format, value);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit;
|
|||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
|
@ -48,7 +49,7 @@ import org.springframework.stereotype.Service;
|
|||
@Path("/V40/KeyAsSegment.svc")
|
||||
public class V4KeyAsSegment extends V4Services {
|
||||
|
||||
public V4KeyAsSegment() throws Exception {
|
||||
public V4KeyAsSegment() throws IOException {
|
||||
super();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,13 +18,14 @@
|
|||
*/
|
||||
package org.apache.olingo.fit;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.apache.cxf.interceptor.InInterceptors;
|
||||
import org.apache.olingo.fit.utils.ConstantKey;
|
||||
import org.apache.olingo.fit.utils.Constants;
|
||||
import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
|
||||
import org.apache.olingo.fit.rest.XHTTPMethodInterceptor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
|
@ -32,7 +33,7 @@ import org.springframework.stereotype.Service;
|
|||
@InInterceptors(classes = XHTTPMethodInterceptor.class)
|
||||
public class V4NorthWind extends V4Services {
|
||||
|
||||
public V4NorthWind() throws Exception {
|
||||
public V4NorthWind() throws IOException {
|
||||
super();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,22 +18,23 @@
|
|||
*/
|
||||
package org.apache.olingo.fit;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.apache.cxf.interceptor.InInterceptors;
|
||||
import org.apache.olingo.fit.utils.ConstantKey;
|
||||
import org.apache.olingo.fit.utils.Constants;
|
||||
import org.apache.olingo.fit.utils.ResolvingReferencesInterceptor;
|
||||
import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
|
||||
import org.apache.olingo.fit.rest.ResolvingReferencesInterceptor;
|
||||
import org.apache.olingo.fit.rest.XHTTPMethodInterceptor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Path("/V40/NorthWindExt.svc")
|
||||
@InInterceptors(classes = { XHTTPMethodInterceptor.class, ResolvingReferencesInterceptor.class })
|
||||
@InInterceptors(classes = {XHTTPMethodInterceptor.class, ResolvingReferencesInterceptor.class})
|
||||
public class V4NorthWindExt extends V4Services {
|
||||
|
||||
public V4NorthWindExt() throws Exception {
|
||||
public V4NorthWindExt() throws IOException {
|
||||
super();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,22 +16,22 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.commons.api;
|
||||
package org.apache.olingo.fit;
|
||||
|
||||
public class ODataApplicationException extends Exception {
|
||||
import java.io.IOException;
|
||||
|
||||
private static final long serialVersionUID = 5358683245923127425L;
|
||||
import javax.ws.rs.Path;
|
||||
import org.apache.cxf.interceptor.InInterceptors;
|
||||
import org.apache.olingo.fit.rest.OAuth2InInterceptor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
public ODataApplicationException(final String msg) {
|
||||
super(msg);
|
||||
}
|
||||
@Service
|
||||
@Path("/V40/OAuth2.svc")
|
||||
@InInterceptors(classes = {OAuth2InInterceptor.class})
|
||||
public class V4OAuth2 extends V4Services {
|
||||
|
||||
public ODataApplicationException(final String msg, final Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
public ODataApplicationException(final Throwable cause) {
|
||||
super(cause);
|
||||
public V4OAuth2() throws IOException {
|
||||
super();
|
||||
}
|
||||
|
||||
}
|
|
@ -20,6 +20,7 @@ package org.apache.olingo.fit;
|
|||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
|
@ -51,16 +52,16 @@ import org.springframework.stereotype.Service;
|
|||
@Path("/V40/OpenType.svc")
|
||||
public class V4OpenType extends V4Services {
|
||||
|
||||
public V4OpenType() throws Exception {
|
||||
public V4OpenType() throws IOException {
|
||||
super(new Metadata(FSManager.instance(ODataServiceVersion.V40).
|
||||
readRes("openType" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)),
|
||||
Accept.XML), ODataServiceVersion.V40));
|
||||
readRes("openType" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)),
|
||||
Accept.XML), ODataServiceVersion.V40));
|
||||
}
|
||||
|
||||
private Response replaceServiceName(final Response response) {
|
||||
try {
|
||||
final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
|
||||
replaceAll("Static\\.svc", "OpenType.svc");
|
||||
replaceAll("Static\\.svc", "OpenType.svc");
|
||||
|
||||
final Response.ResponseBuilder builder = Response.status(response.getStatus());
|
||||
for (String headerName : response.getHeaders().keySet()) {
|
||||
|
@ -85,7 +86,7 @@ public class V4OpenType extends V4Services {
|
|||
|
||||
/**
|
||||
* Provide sample large metadata.
|
||||
*
|
||||
*
|
||||
* @return metadata.
|
||||
*/
|
||||
@GET
|
||||
|
@ -94,20 +95,20 @@ public class V4OpenType extends V4Services {
|
|||
@Override
|
||||
public Response getMetadata() {
|
||||
return super.getMetadata("openType" + StringUtils.capitalize(
|
||||
Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)));
|
||||
Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)));
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{entitySetName}({entityId})")
|
||||
@Override
|
||||
public Response getEntity(
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
@QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
|
||||
@QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId,
|
||||
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
|
||||
@QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
|
||||
@QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
|
||||
|
||||
return replaceServiceName(super.getEntityInternal(
|
||||
uriInfo.getRequestUri().toASCIIString(), accept, entitySetName, entityId, format, expand, select));
|
||||
|
@ -115,16 +116,16 @@ public class V4OpenType extends V4Services {
|
|||
|
||||
@POST
|
||||
@Path("/{entitySetName}")
|
||||
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
|
||||
@Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
|
||||
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
|
||||
@Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM})
|
||||
@Override
|
||||
public Response postNewEntity(
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
final String entity) {
|
||||
@Context final UriInfo uriInfo,
|
||||
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
|
||||
@HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
|
||||
@HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
final String entity) {
|
||||
|
||||
return replaceServiceName(super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
|
||||
}
|
||||
|
@ -133,8 +134,8 @@ public class V4OpenType extends V4Services {
|
|||
@Path("/{entitySetName}({entityId})")
|
||||
@Override
|
||||
public Response removeEntity(
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId) {
|
||||
@PathParam("entitySetName") final String entitySetName,
|
||||
@PathParam("entityId") final String entityId) {
|
||||
|
||||
return replaceServiceName(super.removeEntity(entitySetName, entityId));
|
||||
}
|
||||
|
|
|
@ -83,8 +83,8 @@ import org.apache.olingo.fit.utils.ConstantKey;
|
|||
import org.apache.olingo.fit.utils.Constants;
|
||||
import org.apache.olingo.fit.utils.FSManager;
|
||||
import org.apache.olingo.fit.utils.LinkInfo;
|
||||
import org.apache.olingo.fit.utils.ResolvingReferencesInterceptor;
|
||||
import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
|
||||
import org.apache.olingo.fit.rest.ResolvingReferencesInterceptor;
|
||||
import org.apache.olingo.fit.rest.XHTTPMethodInterceptor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
|
@ -104,11 +104,11 @@ public class V4Services extends AbstractServices {
|
|||
|
||||
private final Map<String, String> providedAsync = new HashMap<String, String>();
|
||||
|
||||
public V4Services() throws Exception {
|
||||
public V4Services() throws IOException {
|
||||
super(ODataServiceVersion.V40, Commons.getMetadata(ODataServiceVersion.V40));
|
||||
}
|
||||
|
||||
protected V4Services(final Metadata metadata) throws Exception {
|
||||
protected V4Services(final Metadata metadata) throws IOException {
|
||||
super(ODataServiceVersion.V40, metadata);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.apache.olingo.fit;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
|
@ -42,10 +43,10 @@ public class V4Vocabularies {
|
|||
|
||||
private final XMLUtilities xml;
|
||||
|
||||
public V4Vocabularies() throws Exception {
|
||||
public V4Vocabularies() throws IOException {
|
||||
metadata = new Metadata(FSManager.instance(ODataServiceVersion.V40).readRes(
|
||||
"vocabularies-" + Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA), Accept.XML),
|
||||
ODataServiceVersion.V40);
|
||||
"vocabularies-" + Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA), Accept.XML),
|
||||
ODataServiceVersion.V40);
|
||||
xml = new XMLUtilities(ODataServiceVersion.V40, metadata);
|
||||
}
|
||||
|
||||
|
@ -55,11 +56,11 @@ public class V4Vocabularies {
|
|||
public Response getMetadata() {
|
||||
try {
|
||||
return xml.createResponse(
|
||||
null,
|
||||
FSManager.instance(ODataServiceVersion.V40).readRes(
|
||||
"vocabularies-" + Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA), Accept.XML),
|
||||
null,
|
||||
Accept.XML);
|
||||
null,
|
||||
FSManager.instance(ODataServiceVersion.V40).readRes(
|
||||
"vocabularies-" + Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA), Accept.XML),
|
||||
null,
|
||||
Accept.XML);
|
||||
} catch (Exception e) {
|
||||
return xml.createFaultResponse(Accept.XML.toString(ODataServiceVersion.V40), e);
|
||||
}
|
||||
|
@ -71,10 +72,10 @@ public class V4Vocabularies {
|
|||
public Response getVocabulary(@PathParam("vocabulary") final String vocabulary) {
|
||||
try {
|
||||
return xml.createResponse(
|
||||
null,
|
||||
FSManager.instance(ODataServiceVersion.V40).readFile(vocabulary, null),
|
||||
null,
|
||||
Accept.XML);
|
||||
null,
|
||||
FSManager.instance(ODataServiceVersion.V40).readFile(vocabulary, null),
|
||||
null,
|
||||
Accept.XML);
|
||||
} catch (Exception e) {
|
||||
return xml.createFaultResponse(Accept.XML.toString(ODataServiceVersion.V40), e);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* 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.fit.rest;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.cxf.interceptor.Fault;
|
||||
import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
|
||||
import org.apache.cxf.jaxrs.client.WebClient;
|
||||
import org.apache.cxf.message.Message;
|
||||
import org.apache.cxf.phase.AbstractPhaseInterceptor;
|
||||
import org.apache.cxf.phase.Phase;
|
||||
import org.apache.cxf.rs.security.oauth2.client.OAuthClientUtils;
|
||||
import org.apache.cxf.rs.security.oauth2.common.ClientAccessToken;
|
||||
import org.apache.cxf.rs.security.oauth2.grants.code.AuthorizationCodeGrant;
|
||||
import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
|
||||
import org.apache.cxf.transport.http.AbstractHTTPDestination;
|
||||
|
||||
public class OAuth2InInterceptor extends AbstractPhaseInterceptor<Message> {
|
||||
|
||||
private static final OAuthClientUtils.Consumer OAUTH2_CONSUMER =
|
||||
new OAuthClientUtils.Consumer(OAuth2Provider.CLIENT_ID, OAuth2Provider.CLIENT_SECRET);
|
||||
|
||||
public OAuth2InInterceptor() {
|
||||
super(Phase.PRE_INVOKE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(final Message message) throws Fault {
|
||||
final String requestURL = (String) message.get(Message.REQUEST_URL);
|
||||
if (requestURL.contains("V40/OAuth2.svc")) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Map<String, List<String>> headers = (Map<String, List<String>>) message.get(Message.PROTOCOL_HEADERS);
|
||||
final List<String> oauth2CodeHeader = headers.get(OAuth2Provider.OAUTH2_CODE_HEADER);
|
||||
if (oauth2CodeHeader == null || oauth2CodeHeader.isEmpty()) {
|
||||
message.put(AbstractHTTPDestination.REQUEST_REDIRECTED, Boolean.TRUE);
|
||||
|
||||
final HttpServletResponse response = (HttpServletResponse) message.get(AbstractHTTPDestination.HTTP_RESPONSE);
|
||||
try {
|
||||
final String authorizationServiceURI =
|
||||
StringUtils.substringBefore(requestURL, "V40/OAuth2.svc") + "oauth/authorize";
|
||||
|
||||
final URI authorizationURI = OAuthClientUtils.getAuthorizationURI(
|
||||
authorizationServiceURI,
|
||||
OAuth2Provider.CLIENT_ID,
|
||||
OAuth2Provider.REDIRECT_URI,
|
||||
null,
|
||||
null);
|
||||
response.addHeader("Location", authorizationURI.toASCIIString());
|
||||
response.sendError(303);
|
||||
} catch (Exception e) {
|
||||
throw new Fault(e);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
final JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
|
||||
bean.setAddress(StringUtils.substringBefore(requestURL, "V40/OAuth2.svc") + "oauth/token");
|
||||
bean.setUsername("odatajclient");
|
||||
bean.setPassword("odatajclient");
|
||||
final WebClient accessTokenService = bean.createWebClient().
|
||||
type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).
|
||||
accept(MediaType.APPLICATION_JSON_TYPE);
|
||||
|
||||
final AuthorizationCodeGrant codeGrant = new AuthorizationCodeGrant(oauth2CodeHeader.get(0));
|
||||
final ClientAccessToken accessToken =
|
||||
OAuthClientUtils.getAccessToken(accessTokenService, OAUTH2_CONSUMER, codeGrant);
|
||||
if (accessToken == null) {
|
||||
throw new WebApplicationException("No OAuth2 access token");
|
||||
}
|
||||
} catch (OAuthServiceException e) {
|
||||
throw new Fault(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
* 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.fit.rest;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.apache.cxf.rs.security.oauth2.common.AccessTokenRegistration;
|
||||
import org.apache.cxf.rs.security.oauth2.common.Client;
|
||||
import org.apache.cxf.rs.security.oauth2.common.OAuthPermission;
|
||||
import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
|
||||
import org.apache.cxf.rs.security.oauth2.common.UserSubject;
|
||||
import org.apache.cxf.rs.security.oauth2.grants.code.AuthorizationCodeDataProvider;
|
||||
import org.apache.cxf.rs.security.oauth2.grants.code.AuthorizationCodeRegistration;
|
||||
import org.apache.cxf.rs.security.oauth2.grants.code.ServerAuthorizationCodeGrant;
|
||||
import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
|
||||
import org.apache.cxf.rs.security.oauth2.tokens.bearer.BearerAccessToken;
|
||||
|
||||
public class OAuth2Provider implements AuthorizationCodeDataProvider {
|
||||
|
||||
public static final String CLIENT_ID = "odataOAuth2SVC";
|
||||
|
||||
public static final String CLIENT_SECRET = "1234567890";
|
||||
|
||||
public static final String REDIRECT_URI = "/stub/StaticService/V40/OAuth2.svc/";
|
||||
|
||||
public static final String OAUTH2_CODE_HEADER = "oauth2.token";
|
||||
|
||||
private Client client;
|
||||
|
||||
private ServerAuthorizationCodeGrant grant;
|
||||
|
||||
private ServerAccessToken token;
|
||||
|
||||
@Override
|
||||
public Client getClient(final String string) throws OAuthServiceException {
|
||||
if (client == null) {
|
||||
client = new Client(CLIENT_ID, CLIENT_SECRET, true);
|
||||
client.getRedirectUris().add(REDIRECT_URI);
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerAccessToken getPreauthorizedToken(
|
||||
final Client client, final List<String> list, final UserSubject us, final String string)
|
||||
throws OAuthServiceException {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OAuthPermission> convertScopeToPermissions(final Client client, final List<String> list) {
|
||||
return Collections.singletonList(new OAuthPermission());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerAuthorizationCodeGrant createCodeGrant(final AuthorizationCodeRegistration acr)
|
||||
throws OAuthServiceException {
|
||||
|
||||
grant = new ServerAuthorizationCodeGrant(client, 3600L);
|
||||
grant.setRedirectUri(acr.getRedirectUri());
|
||||
grant.setSubject(acr.getSubject());
|
||||
final List<String> scope = acr.getApprovedScope().isEmpty()
|
||||
? acr.getRequestedScope()
|
||||
: acr.getApprovedScope();
|
||||
grant.setApprovedScopes(scope);
|
||||
|
||||
return grant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerAuthorizationCodeGrant removeCodeGrant(final String code) throws OAuthServiceException {
|
||||
return grant == null || !grant.getCode().equals(code)
|
||||
? null
|
||||
: grant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerAccessToken createAccessToken(final AccessTokenRegistration atr) throws OAuthServiceException {
|
||||
token = new BearerAccessToken(atr.getClient(), 3600L);
|
||||
|
||||
final List<String> scope = atr.getApprovedScope().isEmpty()
|
||||
? atr.getRequestedScope()
|
||||
: atr.getApprovedScope();
|
||||
token.setScopes(convertScopeToPermissions(atr.getClient(), scope));
|
||||
token.setSubject(atr.getSubject());
|
||||
token.setGrantType(atr.getGrantType());
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerAccessToken getAccessToken(final String tokenId) throws OAuthServiceException {
|
||||
return token == null || token.getTokenKey().equals(tokenId) ? token : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerAccessToken refreshAccessToken(
|
||||
final Client client, final String string, final List<String> list)
|
||||
throws OAuthServiceException {
|
||||
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAccessToken(final ServerAccessToken sat) throws OAuthServiceException {
|
||||
if (token != null && token.getTokenKey().equals(sat.getTokenKey())) {
|
||||
token = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revokeToken(final Client client, final String string, final String string1) throws OAuthServiceException {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.fit.utils;
|
||||
package org.apache.olingo.fit.rest;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URI;
|
||||
|
@ -41,7 +41,8 @@ public class ResolvingReferencesInterceptor extends AbstractPhaseInterceptor<Mes
|
|||
|
||||
try {
|
||||
if (path.endsWith("$entity") && StringUtils.isNotBlank(query)
|
||||
&& URLDecoder.decode(query, "UTF-8").contains("$id=")) {
|
||||
&& URLDecoder.decode(query, "UTF-8").contains("$id=")) {
|
||||
|
||||
final String id = URLDecoder.decode(query, "UTF-8");
|
||||
final String newURL = id.substring(id.indexOf("$id=") + 4);
|
||||
|
||||
|
@ -51,7 +52,8 @@ public class ResolvingReferencesInterceptor extends AbstractPhaseInterceptor<Mes
|
|||
message.put(Message.REQUEST_URI, uri.getPath());
|
||||
message.put(Message.PATH_INFO, uri.getPath());
|
||||
}
|
||||
|
||||
} catch (UnsupportedEncodingException ignore) {}
|
||||
} catch (UnsupportedEncodingException ignore) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* 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.fit.rest;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import javax.ws.rs.container.ContainerRequestContext;
|
||||
import javax.ws.rs.container.ContainerResponseContext;
|
||||
import javax.ws.rs.container.ContainerResponseFilter;
|
||||
import javax.ws.rs.ext.Provider;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.olingo.fit.utils.Constants;
|
||||
|
||||
@Provider
|
||||
public class ServiceNameResponseFilter implements ContainerResponseFilter {
|
||||
|
||||
@Override
|
||||
public void filter(final ContainerRequestContext requestContext, final ContainerResponseContext responseContext)
|
||||
throws IOException {
|
||||
|
||||
final String svcName =
|
||||
StringUtils.substringBefore(StringUtils.substringAfter(requestContext.getUriInfo().getPath(), "/"), "/");
|
||||
|
||||
if ("OAuth2.svc".equals(svcName) && responseContext.getEntity() != null) {
|
||||
final String content = IOUtils.toString((InputStream) responseContext.getEntity(), Constants.ENCODING).
|
||||
replaceAll("Static\\.svc", svcName);
|
||||
|
||||
final InputStream toBeStreamedBack = IOUtils.toInputStream(content, Constants.ENCODING);
|
||||
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
IOUtils.copy(toBeStreamedBack, baos);
|
||||
IOUtils.closeQuietly(toBeStreamedBack);
|
||||
|
||||
responseContext.setEntity(new ByteArrayInputStream(baos.toByteArray()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* 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.fit.rest;
|
||||
|
||||
import java.security.Principal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.cxf.common.security.SimplePrincipal;
|
||||
import org.apache.cxf.interceptor.Fault;
|
||||
import org.apache.cxf.message.Message;
|
||||
import org.apache.cxf.phase.AbstractPhaseInterceptor;
|
||||
import org.apache.cxf.phase.Phase;
|
||||
import org.apache.cxf.security.SecurityContext;
|
||||
import org.apache.geronimo.mail.util.Base64;
|
||||
|
||||
public class StaticSecurityInterceptor extends AbstractPhaseInterceptor<Message> {
|
||||
|
||||
private static final String AUTHORIZATION_PROPERTY = "Authorization";
|
||||
|
||||
private static final String AUTHENTICATION_SCHEME = "Basic";
|
||||
|
||||
public StaticSecurityInterceptor() {
|
||||
super(Phase.PRE_PROTOCOL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(final Message message) throws Fault {
|
||||
final SecurityContext sc = message.get(SecurityContext.class);
|
||||
if (sc == null || sc.getUserPrincipal() == null) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Map<String, List<String>> headers = (Map<String, List<String>>) message.get(Message.PROTOCOL_HEADERS);
|
||||
|
||||
final List<String> auth = headers.get(AUTHORIZATION_PROPERTY);
|
||||
if (auth == null || auth.isEmpty()) {
|
||||
throw new WebApplicationException(Response.Status.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
final String encodedUserPassword = auth.get(0).replaceFirst(AUTHENTICATION_SCHEME + " ", "");
|
||||
final String usernameAndPassword = new String(Base64.decode(encodedUserPassword));
|
||||
|
||||
//Split username and password tokens
|
||||
final StringTokenizer tokenizer = new StringTokenizer(usernameAndPassword, ":");
|
||||
final String username = tokenizer.nextToken();
|
||||
final String password = tokenizer.nextToken();
|
||||
|
||||
if (!"odatajclient".equals(username) || !"odatajclient".equals(password)) {
|
||||
throw new WebApplicationException(Response.Status.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
final SecurityContext newSc = new SecurityContext() {
|
||||
|
||||
@Override
|
||||
public Principal getUserPrincipal() {
|
||||
return new SimplePrincipal("odatajclient");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUserInRole(final String role) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
message.put(SecurityContext.class, newSc);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.fit.utils;
|
||||
package org.apache.olingo.fit.rest;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -25,6 +25,8 @@ import org.apache.cxf.interceptor.Fault;
|
|||
import org.apache.cxf.message.Message;
|
||||
import org.apache.cxf.phase.AbstractPhaseInterceptor;
|
||||
import org.apache.cxf.phase.Phase;
|
||||
import org.apache.olingo.fit.utils.ConstantKey;
|
||||
import org.apache.olingo.fit.utils.Constants;
|
||||
|
||||
public class XHTTPMethodInterceptor extends AbstractPhaseInterceptor<Message> {
|
||||
|
||||
|
@ -38,8 +40,8 @@ public class XHTTPMethodInterceptor extends AbstractPhaseInterceptor<Message> {
|
|||
final Map<String, List<String>> headers = (Map<String, List<String>>) message.get(Message.PROTOCOL_HEADERS);
|
||||
|
||||
if (headers.containsKey(Constants.get(ConstantKey.XHTTP_HEADER_NAME))) {
|
||||
message.put(Message.HTTP_REQUEST_METHOD, headers.get(Constants.get(ConstantKey.XHTTP_HEADER_NAME))
|
||||
.iterator().next());
|
||||
message.put(Message.HTTP_REQUEST_METHOD,
|
||||
headers.get(Constants.get(ConstantKey.XHTTP_HEADER_NAME)).iterator().next());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -100,7 +100,7 @@ public abstract class AbstractUtilities {
|
|||
|
||||
protected final ODataSerializer jsonSerializer;
|
||||
|
||||
public AbstractUtilities(final ODataServiceVersion version, final Metadata metadata) throws Exception {
|
||||
public AbstractUtilities(final ODataServiceVersion version, final Metadata metadata) throws IOException {
|
||||
this.version = version;
|
||||
this.metadata = metadata;
|
||||
fsManager = FSManager.instance(version);
|
||||
|
|
|
@ -51,17 +51,17 @@ public class JSONUtilities extends AbstractUtilities {
|
|||
|
||||
private final ObjectMapper mapper;
|
||||
|
||||
public JSONUtilities(final ODataServiceVersion version, final Metadata metadata) throws Exception {
|
||||
public JSONUtilities(final ODataServiceVersion version, final Metadata metadata) throws IOException {
|
||||
super(version, metadata);
|
||||
|
||||
mapper = new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
mapper.setInjectableValues(new InjectableValues.Std()
|
||||
.addValue(Boolean.class, Boolean.TRUE)
|
||||
.addValue(ODataServiceVersion.class, version));
|
||||
mapper.setInjectableValues(new InjectableValues.Std().
|
||||
addValue(Boolean.class, Boolean.TRUE).
|
||||
addValue(ODataServiceVersion.class, version));
|
||||
mapper.setSerializerProvider(new InjectableSerializerProvider(mapper.getSerializerProvider(),
|
||||
mapper.getSerializationConfig()
|
||||
.withAttribute(ODataServiceVersion.class, version)
|
||||
.withAttribute(Boolean.class, Boolean.TRUE),
|
||||
mapper.getSerializationConfig().
|
||||
withAttribute(ODataServiceVersion.class, version).
|
||||
withAttribute(Boolean.class, Boolean.TRUE),
|
||||
mapper.getSerializerFactory()));
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ public class JSONUtilities extends AbstractUtilities {
|
|||
|
||||
srcNode.set(
|
||||
Constants.get(version, ConstantKey.JSON_EDITLINK_NAME), new TextNode(
|
||||
Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + entitySetName + "(" + entityKey + ")"));
|
||||
Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + entitySetName + "(" + entityKey + ")"));
|
||||
|
||||
return IOUtils.toInputStream(srcNode.toString(), Constants.ENCODING);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.olingo.fit.utils;
|
|||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
|
@ -65,7 +66,7 @@ public class XMLUtilities extends AbstractUtilities {
|
|||
|
||||
protected static XMLOutputFactory ofactory = null;
|
||||
|
||||
public XMLUtilities(final ODataServiceVersion version, final Metadata metadata) throws Exception {
|
||||
public XMLUtilities(final ODataServiceVersion version, final Metadata metadata) throws IOException {
|
||||
super(version, metadata);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -36,24 +36,33 @@
|
|||
<context:annotation-config/>
|
||||
<bean class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer"/>
|
||||
<bean class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer"/>
|
||||
|
||||
<jaxrs:server id="services" address="/">
|
||||
<jaxrs:serviceBeans>
|
||||
<bean class="org.apache.olingo.fit.V3Services"/>
|
||||
<bean class="org.apache.olingo.fit.V3KeyAsSegment"/>
|
||||
<bean class="org.apache.olingo.fit.V3ActionOverloading"/>
|
||||
<bean class="org.apache.olingo.fit.V3PrimitiveKeys"/>
|
||||
<bean class="org.apache.olingo.fit.V3OpenType"/>
|
||||
<bean class="org.apache.olingo.fit.V4Services"/>
|
||||
<bean class="org.apache.olingo.fit.V4KeyAsSegment"/>
|
||||
<bean class="org.apache.olingo.fit.V4NorthWind"/>
|
||||
<bean class="org.apache.olingo.fit.V4NorthWindExt"/>
|
||||
<bean class="org.apache.olingo.fit.V4OpenType"/>
|
||||
<bean class="org.apache.olingo.fit.V4Vocabularies"/>
|
||||
<bean class="org.apache.olingo.fit.V4Demo"/>
|
||||
</jaxrs:serviceBeans>
|
||||
|
||||
<jaxrs:server id="services" address="/" basePackages="org.apache.olingo.fit">
|
||||
<jaxrs:providers>
|
||||
<bean class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider"/>
|
||||
<bean class="org.apache.olingo.fit.rest.ServiceNameResponseFilter"/>
|
||||
</jaxrs:providers>
|
||||
</jaxrs:server>
|
||||
|
||||
<bean id="oauthProvider" class="org.apache.olingo.fit.rest.OAuth2Provider"/>
|
||||
<bean id="authorizationService" class="org.apache.cxf.rs.security.oauth2.services.AuthorizationCodeGrantService">
|
||||
<property name="dataProvider" ref="oauthProvider"/>
|
||||
</bean>
|
||||
<bean id="accessTokenService" class="org.apache.cxf.rs.security.oauth2.services.AccessTokenService">
|
||||
<property name="dataProvider" ref="oauthProvider"/>
|
||||
</bean>
|
||||
<bean id="oauthSecurityInterceptor" class="org.apache.olingo.fit.rest.StaticSecurityInterceptor"/>
|
||||
<jaxrs:server id="oauthServer" address="/oauth">
|
||||
<jaxrs:serviceBeans>
|
||||
<ref bean="authorizationService"/>
|
||||
<ref bean="accessTokenService"/>
|
||||
</jaxrs:serviceBeans>
|
||||
<jaxrs:inInterceptors>
|
||||
<ref bean="oauthSecurityInterceptor"/>
|
||||
</jaxrs:inInterceptors>
|
||||
<jaxrs:providers>
|
||||
<bean class="org.apache.cxf.jaxrs.provider.JAXBElementProvider"/>
|
||||
<bean class="org.apache.cxf.rs.security.oauth2.provider.OAuthJSONProvider"/>
|
||||
</jaxrs:providers>
|
||||
</jaxrs:server>
|
||||
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
* 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.fit;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import java.net.URI;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.Header;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpUriRequest;
|
||||
import org.apache.http.client.params.ClientPNames;
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.params.BasicHttpParams;
|
||||
import org.apache.http.params.HttpParams;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.apache.olingo.client.core.http.AbstractOAuth2HttpUriRequestFactory;
|
||||
import org.apache.olingo.client.core.http.OAuth2Exception;
|
||||
import org.apache.olingo.fit.rest.OAuth2Provider;
|
||||
|
||||
public class CXFOAuth2HttpUriRequestFactory extends AbstractOAuth2HttpUriRequestFactory {
|
||||
|
||||
private String code;
|
||||
|
||||
public CXFOAuth2HttpUriRequestFactory(final URI redirectURI) {
|
||||
super(redirectURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isInited() {
|
||||
return code != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() throws OAuth2Exception {
|
||||
// 1. Disable automatic redirects handling
|
||||
final HttpParams params = new BasicHttpParams();
|
||||
params.setParameter(ClientPNames.HANDLE_REDIRECTS, false);
|
||||
final DefaultHttpClient httpClient = new DefaultHttpClient(params);
|
||||
|
||||
// 2. Try to access the redirect URI without any special header: get redirected to the OAuth2 service
|
||||
URI location = null;
|
||||
try {
|
||||
final HttpResponse response = httpClient.execute(new HttpGet(redirectURI));
|
||||
|
||||
final Header locationHeader = response.getFirstHeader("Location");
|
||||
if (response.getStatusLine().getStatusCode() != 303 || locationHeader == null) {
|
||||
throw new IllegalStateException("OAuth flow is broken");
|
||||
}
|
||||
|
||||
location = new URI(locationHeader.getValue());
|
||||
|
||||
EntityUtils.consumeQuietly(response.getEntity());
|
||||
} catch (Exception e) {
|
||||
throw new OAuth2Exception(e);
|
||||
}
|
||||
|
||||
JsonNode oAuthAuthorizationData = null;
|
||||
String authenticityCookie = null;
|
||||
try {
|
||||
// 3. Need to (basic) authenticate against the OAuth2 service
|
||||
final HttpGet method = new HttpGet(location);
|
||||
method.addHeader("Authorization", "Basic " + Base64.encodeBase64String("odatajclient:odatajclient".getBytes()));
|
||||
final HttpResponse response = httpClient.execute(method);
|
||||
|
||||
// 4. Pull out OAuth2 authorization data and "authenticity" cookie (CXF specific)
|
||||
oAuthAuthorizationData = new XmlMapper().readTree(EntityUtils.toString(response.getEntity()));
|
||||
|
||||
final Header setCookieHeader = response.getFirstHeader("Set-Cookie");
|
||||
if (setCookieHeader == null) {
|
||||
throw new IllegalStateException("OAuth flow is broken");
|
||||
}
|
||||
authenticityCookie = setCookieHeader.getValue();
|
||||
} catch (Exception e) {
|
||||
throw new OAuth2Exception(e);
|
||||
}
|
||||
|
||||
try {
|
||||
// 5. Submit the HTTP form for allowing access to the application
|
||||
location = new URIBuilder(oAuthAuthorizationData.get("replyTo").asText()).
|
||||
addParameter("session_authenticity_token", oAuthAuthorizationData.get("authenticityToken").asText()).
|
||||
addParameter("client_id", oAuthAuthorizationData.get("clientId").asText()).
|
||||
addParameter("redirect_uri", oAuthAuthorizationData.get("redirectUri").asText()).
|
||||
addParameter("oauthDecision", "allow").
|
||||
build();
|
||||
final HttpGet method = new HttpGet(location);
|
||||
method.addHeader("Authorization", "Basic " + Base64.encodeBase64String("odatajclient:odatajclient".getBytes()));
|
||||
method.addHeader("Cookie", authenticityCookie);
|
||||
|
||||
final HttpResponse response = httpClient.execute(method);
|
||||
|
||||
final Header locationHeader = response.getFirstHeader("Location");
|
||||
if (response.getStatusLine().getStatusCode() != 303 || locationHeader == null) {
|
||||
throw new IllegalStateException("OAuth flow is broken");
|
||||
}
|
||||
|
||||
// 6. Finally get the code value out of this last redirect
|
||||
code = StringUtils.substringAfterLast(locationHeader.getValue(), "=");
|
||||
|
||||
EntityUtils.consumeQuietly(response.getEntity());
|
||||
} catch (Exception e) {
|
||||
throw new OAuth2Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sign(final HttpUriRequest request) {
|
||||
request.addHeader(OAuth2Provider.OAUTH2_CODE_HEADER, code);
|
||||
}
|
||||
|
||||
}
|
|
@ -51,7 +51,7 @@ import org.junit.Test;
|
|||
public class ErrorTestITCase extends AbstractTestITCase {
|
||||
|
||||
private class ErrorGeneratingRequest
|
||||
extends AbstractODataBasicRequest<ODataEntityCreateResponse<ODataEntity>> {
|
||||
extends AbstractODataBasicRequest<ODataEntityCreateResponse<ODataEntity>> {
|
||||
|
||||
public ErrorGeneratingRequest(final HttpMethod method, final URI uri) {
|
||||
super(client, method, uri);
|
||||
|
@ -75,16 +75,13 @@ public class ErrorTestITCase extends AbstractTestITCase {
|
|||
|
||||
private class ErrorResponseImpl extends AbstractODataResponse implements ODataEntityCreateResponse<ODataEntity> {
|
||||
|
||||
private final ODataClient odataClient;
|
||||
|
||||
public ErrorResponseImpl(final ODataClient odataClient, final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
this.odataClient = odataClient;
|
||||
super(odataClient, client, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataEntity getBody() {
|
||||
return odataClient.getObjectFactory().newEntity(new FullQualifiedName("Invalid.Invalid"));
|
||||
return ((ODataClient) odataClient).getObjectFactory().newEntity(new FullQualifiedName("Invalid.Invalid"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -146,9 +143,9 @@ public class ErrorTestITCase extends AbstractTestITCase {
|
|||
|
||||
private void instreamError(final ODataFormat format) {
|
||||
final URIBuilder builder = client.newURIBuilder(testStaticServiceRootURL).
|
||||
appendOperationCallSegment("InStreamErrorGetCustomer");
|
||||
appendOperationCallSegment("InStreamErrorGetCustomer");
|
||||
final ODataInvokeRequest<ODataEntitySet> req =
|
||||
client.getInvokeRequestFactory().getFunctionInvokeRequest(builder.build(), ODataEntitySet.class);
|
||||
client.getInvokeRequestFactory().getFunctionInvokeRequest(builder.build(), ODataEntitySet.class);
|
||||
req.setFormat(format);
|
||||
|
||||
final ODataInvokeResponse<ODataEntitySet> res = req.execute();
|
||||
|
|
|
@ -69,6 +69,8 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase {
|
|||
|
||||
protected static String testAuthServiceRootURL;
|
||||
|
||||
protected static String testOAuth2ServiceRootURL;
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpODataServiceRoot() throws IOException {
|
||||
testStaticServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Static.svc";
|
||||
|
@ -79,6 +81,7 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase {
|
|||
testOpenTypeServiceRootURL = "http://localhost:9080/stub/StaticService/V40/OpenType.svc";
|
||||
testLargeModelServiceRootURL = "http://localhost:9080/stub/StaticService/V40/Static.svc/large";
|
||||
testAuthServiceRootURL = "http://localhost:9080/stub/DefaultService.svc/V40/Static.svc";
|
||||
testOAuth2ServiceRootURL = "http://localhost:9080/stub/StaticService/V40/OAuth2.svc";
|
||||
|
||||
edmClient = ODataClientFactory.getEdmEnabledV4(testStaticServiceRootURL);
|
||||
|
||||
|
@ -107,48 +110,46 @@ public abstract class AbstractTestITCase extends AbstractBaseTestITCase {
|
|||
return entity;
|
||||
}
|
||||
|
||||
protected void createAndDeleteOrder(final ODataFormat format, final int id) {
|
||||
protected void createAndDeleteOrder(final String serviceRoot, final ODataFormat format, final int id) {
|
||||
final ODataEntity order = new ODataEntityImpl(
|
||||
new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order"));
|
||||
new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Order"));
|
||||
|
||||
final ODataProperty orderId = getClient().getObjectFactory().newPrimitiveProperty("OrderID",
|
||||
getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id));
|
||||
getClient().getObjectFactory().newPrimitiveValueBuilder().buildInt32(id));
|
||||
order.getProperties().add(orderId);
|
||||
|
||||
Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
|
||||
dateTime.set(2011, 2, 4, 16, 3, 57);
|
||||
final ODataProperty orderDate = getClient().getObjectFactory().newPrimitiveProperty("OrderDate",
|
||||
getClient().getObjectFactory().newPrimitiveValueBuilder()
|
||||
getClient().getObjectFactory().newPrimitiveValueBuilder()
|
||||
.setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(dateTime).build());
|
||||
order.getProperties().add(orderDate);
|
||||
|
||||
final ODataProperty shelfLife = getClient().getObjectFactory().newPrimitiveProperty("ShelfLife",
|
||||
getClient().getObjectFactory().newPrimitiveValueBuilder().
|
||||
getClient().getObjectFactory().newPrimitiveValueBuilder().
|
||||
setType(EdmPrimitiveTypeKind.Duration).setValue(BigDecimal.TEN.scaleByPowerOfTen(7)).build());
|
||||
order.getProperties().add(shelfLife);
|
||||
|
||||
final ODataCollectionValue<ODataValue> orderShelfLifesValue = getClient().getObjectFactory().
|
||||
newCollectionValue("Collection(Duration)");
|
||||
newCollectionValue("Collection(Duration)");
|
||||
orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
|
||||
setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000001")).build());
|
||||
setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000001")).build());
|
||||
orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
|
||||
setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build());
|
||||
setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal("0.0000002")).build());
|
||||
final ODataProperty orderShelfLifes = getClient().getObjectFactory().
|
||||
newCollectionProperty("OrderShelfLifes", orderShelfLifesValue);
|
||||
newCollectionProperty("OrderShelfLifes", orderShelfLifesValue);
|
||||
order.getProperties().add(orderShelfLifes);
|
||||
|
||||
final ODataEntityCreateRequest<ODataEntity> req = getClient().getCUDRequestFactory().getEntityCreateRequest(
|
||||
getClient().newURIBuilder(testStaticServiceRootURL).
|
||||
getClient().newURIBuilder(serviceRoot).
|
||||
appendEntitySetSegment("Orders").build(), order);
|
||||
req.setFormat(format);
|
||||
final ODataEntity created = req.execute().getBody();
|
||||
assertNotNull(created);
|
||||
assertEquals(2, created.getProperty("OrderShelfLifes").getCollectionValue().size());
|
||||
|
||||
final URI deleteURI = created.getEditLink() == null
|
||||
? getClient().newURIBuilder(testStaticServiceRootURL).
|
||||
appendEntitySetSegment("Orders").appendKeySegment(id).build()
|
||||
: created.getEditLink();
|
||||
final URI deleteURI = getClient().newURIBuilder(serviceRoot).
|
||||
appendEntitySetSegment("Orders").appendKeySegment(id).build();
|
||||
final ODataDeleteRequest deleteReq = getClient().getCUDRequestFactory().getDeleteRequest(deleteURI);
|
||||
final ODataDeleteResponse deleteRes = deleteReq.execute();
|
||||
assertEquals(204, deleteRes.getStatusCode());
|
||||
|
|
|
@ -42,12 +42,12 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
|
|||
|
||||
@Test
|
||||
public void atomCreateAndDelete() {
|
||||
createAndDeleteOrder(ODataFormat.ATOM, 1000);
|
||||
createAndDeleteOrder(testStaticServiceRootURL, ODataFormat.ATOM, 1000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void jsonCreateAndDelete() {
|
||||
createAndDeleteOrder(ODataFormat.JSON, 1001);
|
||||
createAndDeleteOrder(testStaticServiceRootURL, ODataFormat.JSON, 1001);
|
||||
}
|
||||
|
||||
private void onContained(final ODataFormat format) {
|
||||
|
|
|
@ -52,7 +52,7 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
|
|||
|
||||
private void read(final ODataFormat format) {
|
||||
final URIBuilder uriBuilder = client.newURIBuilder(testKeyAsSegmentServiceRootURL).
|
||||
appendEntitySetSegment("Accounts").appendKeySegment(101);
|
||||
appendEntitySetSegment("Accounts").appendKeySegment(101);
|
||||
|
||||
final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
|
||||
req.setFormat(format);
|
||||
|
@ -80,25 +80,25 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
|
|||
|
||||
@Test
|
||||
public void atomCreateAndDelete() {
|
||||
createAndDeleteOrder(ODataFormat.ATOM, 1000);
|
||||
createAndDeleteOrder(testKeyAsSegmentServiceRootURL, ODataFormat.ATOM, 1000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void jsonCreateAndDelete() {
|
||||
createAndDeleteOrder(ODataFormat.JSON_FULL_METADATA, 1001);
|
||||
createAndDeleteOrder(testKeyAsSegmentServiceRootURL, ODataFormat.JSON_FULL_METADATA, 1001);
|
||||
}
|
||||
|
||||
private void update(final ODataFormat format) {
|
||||
final ODataEntity changes = getClient().getObjectFactory().newEntity(
|
||||
new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
|
||||
new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Customer"));
|
||||
final ODataProperty middleName = getClient().getObjectFactory().newPrimitiveProperty("MiddleName",
|
||||
getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("middle"));
|
||||
getClient().getObjectFactory().newPrimitiveValueBuilder().buildString("middle"));
|
||||
changes.getProperties().add(middleName);
|
||||
|
||||
final URI uri = getClient().newURIBuilder(testKeyAsSegmentServiceRootURL).
|
||||
appendEntitySetSegment("People").appendKeySegment(5).build();
|
||||
appendEntitySetSegment("People").appendKeySegment(5).build();
|
||||
final ODataEntityUpdateRequest<ODataEntity> req = getClient().getCUDRequestFactory().
|
||||
getEntityUpdateRequest(uri, UpdateType.PATCH, changes);
|
||||
getEntityUpdateRequest(uri, UpdateType.PATCH, changes);
|
||||
req.setFormat(format);
|
||||
|
||||
final ODataEntityUpdateResponse<ODataEntity> res = req.execute();
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
package org.apache.olingo.fit.v4;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.net.URI;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
|
||||
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
|
||||
import org.apache.olingo.client.api.uri.v4.URIBuilder;
|
||||
import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
|
||||
import org.apache.olingo.client.api.v4.ODataClient;
|
||||
import org.apache.olingo.client.core.ODataClientFactory;
|
||||
import org.apache.olingo.client.core.http.DefaultHttpUriRequestFactory;
|
||||
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.fit.CXFOAuth2HttpUriRequestFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
public class OAuth2TestITCase extends AbstractTestITCase {
|
||||
|
||||
private EdmEnabledODataClient _edmClient;
|
||||
|
||||
@BeforeClass
|
||||
public static void enableOAuth2() {
|
||||
client.getConfiguration().setHttpUriRequestFactory(
|
||||
new CXFOAuth2HttpUriRequestFactory(URI.create(testOAuth2ServiceRootURL)));
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void disableOAuth2() {
|
||||
client.getConfiguration().setHttpUriRequestFactory(new DefaultHttpUriRequestFactory());
|
||||
}
|
||||
|
||||
protected EdmEnabledODataClient getEdmClient() {
|
||||
if (_edmClient == null) {
|
||||
_edmClient = ODataClientFactory.getEdmEnabledV4(testOAuth2ServiceRootURL);
|
||||
_edmClient.getConfiguration().setHttpUriRequestFactory(
|
||||
new CXFOAuth2HttpUriRequestFactory(URI.create(testOAuth2ServiceRootURL)));
|
||||
}
|
||||
|
||||
return _edmClient;
|
||||
}
|
||||
|
||||
private void read(final ODataClient client, final ODataFormat format) {
|
||||
final URIBuilder uriBuilder =
|
||||
client.newURIBuilder(testOAuth2ServiceRootURL).appendEntitySetSegment("Orders").appendKeySegment(8);
|
||||
|
||||
final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
|
||||
req.setFormat(format);
|
||||
|
||||
final ODataRetrieveResponse<ODataEntity> res = req.execute();
|
||||
assertEquals(200, res.getStatusCode());
|
||||
|
||||
final String etag = res.getETag();
|
||||
assertTrue(StringUtils.isNotBlank(etag));
|
||||
|
||||
final ODataEntity order = res.getBody();
|
||||
assertEquals(etag, order.getETag());
|
||||
assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Order", order.getTypeName().toString());
|
||||
assertEquals("Edm.Int32", order.getProperty("OrderID").getPrimitiveValue().getTypeName());
|
||||
assertEquals("Edm.DateTimeOffset", order.getProperty("OrderDate").getPrimitiveValue().getTypeName());
|
||||
assertEquals("Edm.Duration", order.getProperty("ShelfLife").getPrimitiveValue().getTypeName());
|
||||
assertEquals("Collection(Edm.Duration)", order.getProperty("OrderShelfLifes").getCollectionValue().getTypeName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void readAsAtom() {
|
||||
read(client, ODataFormat.ATOM);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void readAsFullJSON() {
|
||||
read(client, ODataFormat.JSON_FULL_METADATA);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void readAsJSON() {
|
||||
read(getEdmClient(), ODataFormat.JSON);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createAndDelete() {
|
||||
createAndDeleteOrder(testOAuth2ServiceRootURL, ODataFormat.JSON, 1002);
|
||||
}
|
||||
|
||||
}
|
|
@ -47,7 +47,7 @@ public interface CommonODataClient<UT extends CommonUpdateType> {
|
|||
|
||||
ODataHeaders newVersionHeaders();
|
||||
|
||||
CommonConfiguration getConfiguration();
|
||||
Configuration getConfiguration();
|
||||
|
||||
ODataPreferences newPreferences();
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.olingo.commons.api.format.ODataFormat;
|
|||
/**
|
||||
* Configuration wrapper.
|
||||
*/
|
||||
public interface CommonConfiguration {
|
||||
public interface Configuration {
|
||||
|
||||
/**
|
||||
* Gets the configured default <tt>Accept</tt> header value format for a batch request.
|
|
@ -50,11 +50,11 @@ public interface ODataBatchResponseItem extends Iterator<ODataResponse> {
|
|||
boolean isChangeset();
|
||||
|
||||
/**
|
||||
* Checks if the current item is a braking item like as error item or asynchronous response part.
|
||||
* Checks if the current item is a breaking item like as error item or asynchronous response part.
|
||||
*
|
||||
* @return 'TRUE' if breaking; 'FALSE' otherwise.
|
||||
*/
|
||||
boolean isBreakingitem();
|
||||
boolean isBreaking();
|
||||
|
||||
/**
|
||||
* Closes the current batch responses item including all wrapped OData responses.
|
||||
|
|
|
@ -26,5 +26,7 @@ import org.apache.http.client.HttpClient;
|
|||
*/
|
||||
public interface HttpClientFactory {
|
||||
|
||||
HttpClient createHttpClient(HttpMethod method, URI uri);
|
||||
HttpClient create(HttpMethod method, URI uri);
|
||||
|
||||
void close(HttpClient httpClient);
|
||||
}
|
||||
|
|
|
@ -26,5 +26,5 @@ import org.apache.http.client.methods.HttpUriRequest;
|
|||
*/
|
||||
public interface HttpUriRequestFactory {
|
||||
|
||||
HttpUriRequest createHttpUriRequest(HttpMethod method, URI uri);
|
||||
HttpUriRequest create(HttpMethod method, URI uri);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.apache.olingo.client.api.v3;
|
||||
|
||||
import org.apache.olingo.client.api.CommonConfiguration;
|
||||
import org.apache.olingo.client.api.CommonODataClient;
|
||||
import org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory;
|
||||
import org.apache.olingo.client.api.communication.request.cud.v3.CUDRequestFactory;
|
||||
|
@ -34,9 +33,6 @@ import org.apache.olingo.commons.api.format.ODataFormat;
|
|||
|
||||
public interface ODataClient extends CommonODataClient<UpdateType> {
|
||||
|
||||
@Override
|
||||
CommonConfiguration getConfiguration();
|
||||
|
||||
@Override
|
||||
ODataDeserializer getDeserializer(ODataFormat format);
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.apache.olingo.client.api.v4;
|
||||
|
||||
import org.apache.olingo.client.api.CommonConfiguration;
|
||||
import org.apache.olingo.client.api.CommonODataClient;
|
||||
import org.apache.olingo.client.api.communication.request.batch.v4.BatchRequestFactory;
|
||||
import org.apache.olingo.client.api.communication.request.cud.v4.CUDRequestFactory;
|
||||
|
@ -36,9 +35,6 @@ import org.apache.olingo.commons.api.format.ODataFormat;
|
|||
|
||||
public interface ODataClient extends CommonODataClient<UpdateType> {
|
||||
|
||||
@Override
|
||||
CommonConfiguration getConfiguration();
|
||||
|
||||
@Override
|
||||
ODataDeserializer getDeserializer(ODataFormat format);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.apache.olingo.client.core;
|
||||
|
||||
import org.apache.olingo.client.api.CommonODataClient;
|
||||
import org.apache.olingo.client.api.Configuration;
|
||||
import org.apache.olingo.client.api.communication.header.ODataPreferences;
|
||||
import org.apache.olingo.client.api.communication.request.cud.CommonUpdateType;
|
||||
import org.apache.olingo.client.api.serialization.ODataWriter;
|
||||
|
@ -26,8 +27,15 @@ import org.apache.olingo.client.core.serialization.ODataWriterImpl;
|
|||
|
||||
public abstract class AbstractODataClient<UT extends CommonUpdateType> implements CommonODataClient<UT> {
|
||||
|
||||
protected final Configuration configuration = new ConfigurationImpl();
|
||||
|
||||
private final ODataWriter writer = new ODataWriterImpl(this);
|
||||
|
||||
@Override
|
||||
public Configuration getConfiguration() {
|
||||
return configuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataPreferences newPreferences() {
|
||||
return new ODataPreferences(getServiceVersion());
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.Map;
|
|||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import org.apache.olingo.client.api.CommonConfiguration;
|
||||
import org.apache.olingo.client.api.Configuration;
|
||||
import org.apache.olingo.client.api.http.HttpClientFactory;
|
||||
import org.apache.olingo.client.api.http.HttpUriRequestFactory;
|
||||
import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
|
||||
|
@ -31,7 +31,7 @@ import org.apache.olingo.client.core.http.DefaultHttpUriRequestFactory;
|
|||
import org.apache.olingo.commons.api.format.ContentType;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
|
||||
public class Configuration implements CommonConfiguration {
|
||||
public class ConfigurationImpl implements Configuration {
|
||||
|
||||
private static final String DEFAULT_PUB_FORMAT = "pubFormat";
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class Configuration implements CommonConfiguration {
|
|||
private static final String USE_XHTTP_METHOD = "useHTTPMethod";
|
||||
|
||||
private static final String KEY_AS_SEGMENT = "keyAsSegment";
|
||||
|
||||
|
||||
private static final String ADDRESS_DERIVED_TYPE = "addressDerivedType";
|
||||
|
||||
private static final String USE_OPERATION_FQN_IN_URL = "useOperationFqnInUrl";
|
||||
|
@ -198,7 +198,7 @@ public class Configuration implements CommonConfiguration {
|
|||
public void setAddressingDerivedTypes(final boolean value) {
|
||||
setProperty(ADDRESS_DERIVED_TYPE, value);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isUseUrlOperationFQN() {
|
||||
return (Boolean) getProperty(USE_OPERATION_FQN_IN_URL, true);
|
||||
|
@ -208,7 +208,7 @@ public class Configuration implements CommonConfiguration {
|
|||
public void setUseUrlOperationFQN(final boolean value) {
|
||||
setProperty(USE_OPERATION_FQN_IN_URL, value);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ExecutorService getExecutor() {
|
||||
return executor;
|
|
@ -20,7 +20,6 @@ package org.apache.olingo.client.core;
|
|||
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
|
||||
|
||||
public final class ODataClientFactory {
|
||||
|
||||
public static org.apache.olingo.client.api.v3.ODataClient getV3() {
|
||||
|
|
|
@ -84,12 +84,13 @@ public abstract class AbstractODataRequest extends AbstractRequest implements OD
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param odataClient client instance getting this request
|
||||
* @param method HTTP request method. If configured X-HTTP-METHOD header will be used.
|
||||
* @param uri OData request URI.
|
||||
* @param odataClient client instance getting this request
|
||||
* @param method HTTP request method. If configured X-HTTP-METHOD header will be used.
|
||||
* @param uri OData request URI.
|
||||
*/
|
||||
protected AbstractODataRequest(final CommonODataClient<?> odataClient, final HttpMethod method, final URI uri) {
|
||||
|
||||
super();
|
||||
|
||||
this.odataClient = odataClient;
|
||||
this.method = method;
|
||||
|
||||
|
@ -99,15 +100,13 @@ public abstract class AbstractODataRequest extends AbstractRequest implements OD
|
|||
// target uri
|
||||
this.uri = uri;
|
||||
|
||||
HttpClient _httpClient = odataClient.getConfiguration().getHttpClientFactory().
|
||||
createHttpClient(this.method, this.uri);
|
||||
HttpClient _httpClient = odataClient.getConfiguration().getHttpClientFactory().create(this.method, this.uri);
|
||||
if (odataClient.getConfiguration().isGzipCompression()) {
|
||||
_httpClient = new DecompressingHttpClient(_httpClient);
|
||||
}
|
||||
this.httpClient = _httpClient;
|
||||
|
||||
this.request = odataClient.getConfiguration().getHttpUriRequestFactory().
|
||||
createHttpUriRequest(this.method, this.uri);
|
||||
this.request = odataClient.getConfiguration().getHttpUriRequestFactory().create(this.method, this.uri);
|
||||
}
|
||||
|
||||
public abstract ODataFormat getDefaultFormat();
|
||||
|
@ -184,9 +183,9 @@ public abstract class AbstractODataRequest extends AbstractRequest implements OD
|
|||
@Override
|
||||
public String getAccept() {
|
||||
final String acceptHead = odataHeaders.getHeader(HeaderName.accept);
|
||||
return StringUtils.isBlank(acceptHead) ?
|
||||
getDefaultFormat().getContentType(odataClient.getServiceVersion()).toContentTypeString() :
|
||||
acceptHead;
|
||||
return StringUtils.isBlank(acceptHead)
|
||||
? getDefaultFormat().getContentType(odataClient.getServiceVersion()).toContentTypeString()
|
||||
: acceptHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -207,9 +206,9 @@ public abstract class AbstractODataRequest extends AbstractRequest implements OD
|
|||
@Override
|
||||
public String getContentType() {
|
||||
final String contentTypeHead = odataHeaders.getHeader(HeaderName.contentType);
|
||||
return StringUtils.isBlank(contentTypeHead) ?
|
||||
getDefaultFormat().getContentType(odataClient.getServiceVersion()).toContentTypeString() :
|
||||
contentTypeHead;
|
||||
return StringUtils.isBlank(contentTypeHead)
|
||||
? getDefaultFormat().getContentType(odataClient.getServiceVersion()).toContentTypeString()
|
||||
: contentTypeHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -326,21 +325,21 @@ public abstract class AbstractODataRequest extends AbstractRequest implements OD
|
|||
|
||||
/**
|
||||
* Gets an empty response that can be initialized by a stream.
|
||||
* <p>
|
||||
* <br/>
|
||||
* This method has to be used to build response items about a batch request.
|
||||
*
|
||||
* @param <V> ODataResppnse type.
|
||||
* @param <V> ODataResponse type.
|
||||
* @return empty OData response instance.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V extends ODataResponse> V getResponseTemplate() {
|
||||
|
||||
for (Class<?> clazz : this.getClass().getDeclaredClasses()) {
|
||||
if (ODataResponse.class.isAssignableFrom(clazz)) {
|
||||
try {
|
||||
final Constructor<?> constructor = clazz.getDeclaredConstructor(this.getClass());
|
||||
final Constructor<?> constructor = clazz.getDeclaredConstructor(
|
||||
this.getClass(), CommonODataClient.class, HttpClient.class, HttpResponse.class);
|
||||
constructor.setAccessible(true);
|
||||
return (V) constructor.newInstance(this);
|
||||
return (V) constructor.newInstance(this, odataClient, httpClient, null);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error retrieving response class template instance", e);
|
||||
}
|
||||
|
|
|
@ -48,18 +48,18 @@ public abstract class AbstractRequest {
|
|||
protected void checkRequest(final CommonODataClient<?> odataClient, final HttpUriRequest request) {
|
||||
// If using and Edm enabled client, checks that the cached service root matches the request URI
|
||||
if (odataClient instanceof CommonEdmEnabledODataClient
|
||||
&& !request.getURI().toASCIIString().startsWith(
|
||||
((CommonEdmEnabledODataClient<?>) odataClient).getServiceRoot())) {
|
||||
&& !request.getURI().toASCIIString().startsWith(
|
||||
((CommonEdmEnabledODataClient<?>) odataClient).getServiceRoot())) {
|
||||
|
||||
throw new IllegalArgumentException(
|
||||
String.format("The current request URI %s does not match the configured service root %s",
|
||||
request.getURI().toASCIIString(),
|
||||
((CommonEdmEnabledODataClient<?>) odataClient).getServiceRoot()));
|
||||
String.format("The current request URI %s does not match the configured service root %s",
|
||||
request.getURI().toASCIIString(),
|
||||
((CommonEdmEnabledODataClient<?>) odataClient).getServiceRoot()));
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkResponse(
|
||||
final CommonODataClient<?> odataClient, final HttpResponse response, final String accept) {
|
||||
final CommonODataClient<?> odataClient, final HttpResponse response, final String accept) {
|
||||
|
||||
if (response.getStatusLine().getStatusCode() >= 400) {
|
||||
try {
|
||||
|
@ -67,7 +67,7 @@ public abstract class AbstractRequest {
|
|||
if (httpEntity == null) {
|
||||
throw new ODataClientErrorException(response.getStatusLine());
|
||||
} else {
|
||||
ODataFormat format = accept.contains("xml") ? ODataFormat.XML : ODataFormat.JSON;
|
||||
final ODataFormat format = accept.contains("xml") ? ODataFormat.XML : ODataFormat.JSON;
|
||||
|
||||
ODataError error;
|
||||
try {
|
||||
|
@ -75,13 +75,13 @@ public abstract class AbstractRequest {
|
|||
} catch (final RuntimeException e) {
|
||||
LOG.warn("Error deserializing error response", e);
|
||||
error = getGenericError(
|
||||
response.getStatusLine().getStatusCode(),
|
||||
response.getStatusLine().getReasonPhrase());
|
||||
response.getStatusLine().getStatusCode(),
|
||||
response.getStatusLine().getReasonPhrase());
|
||||
} catch (final ODataDeserializerException e) {
|
||||
LOG.warn("Error deserializing error response", e);
|
||||
error = getGenericError(
|
||||
response.getStatusLine().getStatusCode(),
|
||||
response.getStatusLine().getReasonPhrase());
|
||||
response.getStatusLine().getStatusCode(),
|
||||
response.getStatusLine().getReasonPhrase());
|
||||
}
|
||||
|
||||
if (response.getStatusLine().getStatusCode() >= 500) {
|
||||
|
@ -92,7 +92,7 @@ public abstract class AbstractRequest {
|
|||
}
|
||||
} catch (IOException e) {
|
||||
throw new HttpClientException(
|
||||
"Received '" + response.getStatusLine() + "' but could not extract error body", e);
|
||||
"Received '" + response.getStatusLine() + "' but could not extract error body", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,10 +49,6 @@ public abstract class AbstractODataBatchRequest<V extends ODataResponse, T exten
|
|||
*/
|
||||
protected final List<ODataBatchResponseItem> expectedResItems = new ArrayList<ODataBatchResponseItem>();
|
||||
|
||||
protected void addExpectedResItem(ODataBatchResponseItem item) {
|
||||
expectedResItems.add(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -69,6 +65,10 @@ public abstract class AbstractODataBatchRequest<V extends ODataResponse, T exten
|
|||
setContentType(ContentType.MULTIPART_MIXED + ";" + ODataBatchConstants.BOUNDARY + "=" + boundary);
|
||||
}
|
||||
|
||||
protected void addExpectedResItem(final ODataBatchResponseItem item) {
|
||||
expectedResItems.add(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc }
|
||||
*/
|
||||
|
@ -78,11 +78,11 @@ public abstract class AbstractODataBatchRequest<V extends ODataResponse, T exten
|
|||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p>
|
||||
* <br/>
|
||||
* This operation is unsupported by a batch request.
|
||||
*/
|
||||
@Override
|
||||
public void batch(CommonODataBatchRequest req) {
|
||||
public void batch(final CommonODataBatchRequest req) {
|
||||
throw new UnsupportedOperationException("A batch request is not batchable");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public abstract class AbstractODataBatchResponseItem implements ODataBatchRespon
|
|||
*/
|
||||
protected ODataResponse current;
|
||||
|
||||
protected boolean breakingitem = false;
|
||||
protected boolean breaking = false;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -143,15 +143,15 @@ public abstract class AbstractODataBatchResponseItem implements ODataBatchRespon
|
|||
expectedItemsIterator = responses.values().iterator();
|
||||
}
|
||||
|
||||
return !breakingitem && expectedItemsIterator.hasNext();
|
||||
return !breaking && expectedItemsIterator.hasNext();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc }
|
||||
*/
|
||||
@Override
|
||||
public boolean isBreakingitem() {
|
||||
return breakingitem;
|
||||
public boolean isBreaking() {
|
||||
return breaking;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -63,7 +63,7 @@ public class ODataChangesetResponseItem extends AbstractODataBatchResponseItem {
|
|||
}
|
||||
|
||||
if (unexpected) {
|
||||
breakingitem = true;
|
||||
breaking = true;
|
||||
return nextUnexpected();
|
||||
} else {
|
||||
return nextExpected();
|
||||
|
@ -107,7 +107,7 @@ public class ODataChangesetResponseItem extends AbstractODataBatchResponseItem {
|
|||
|
||||
if (current.getStatusCode() >= 400) {
|
||||
// found error ....
|
||||
breakingitem = true;
|
||||
breaking = true;
|
||||
}
|
||||
|
||||
return current;
|
||||
|
|
|
@ -27,8 +27,7 @@ import org.apache.olingo.client.core.communication.request.AbstractODataRequest;
|
|||
/**
|
||||
* Retrieve request wrapper for the corresponding batch item.
|
||||
*/
|
||||
public class ODataSingleRequestImpl extends AbstractODataBatchRequestItem
|
||||
implements ODataSingleRequest {
|
||||
public class ODataSingleRequestImpl extends AbstractODataBatchRequestItem implements ODataSingleRequest {
|
||||
|
||||
private final ODataSingleResponseItem expectedResItem;
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.Collection;
|
|||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import org.apache.olingo.client.api.communication.response.ODataResponse;
|
||||
import static org.apache.olingo.client.core.communication.request.batch.AbstractODataBatchResponseItem.LOG;
|
||||
import org.apache.olingo.client.core.communication.response.batch.ODataBatchErrorResponse;
|
||||
import org.apache.olingo.client.core.communication.response.v4.AsyncResponseImpl;
|
||||
|
||||
|
@ -62,11 +61,11 @@ public class ODataSingleResponseItem extends AbstractODataBatchResponseItem {
|
|||
if (responseLine.getKey() == 202) {
|
||||
// generate async response
|
||||
current = new AsyncResponseImpl(responseLine, headers, batchLineIterator, boundary);
|
||||
breakingitem = true;
|
||||
breaking = true;
|
||||
} else if (responseLine.getKey() >= 400) {
|
||||
// generate error response
|
||||
current = new ODataBatchErrorResponse(responseLine, headers, batchLineIterator, boundary);
|
||||
breakingitem = true;
|
||||
breaking = true;
|
||||
} else {
|
||||
if (!hasNext()) {
|
||||
throw new NoSuchElementException("No item found");
|
||||
|
@ -84,4 +83,13 @@ public class ODataSingleResponseItem extends AbstractODataBatchResponseItem {
|
|||
public void remove() {
|
||||
throw new UnsupportedOperationException("Operation not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
super.close();
|
||||
if (current != null && !(current instanceof AsyncResponseImpl) && !(current instanceof ODataBatchErrorResponse)) {
|
||||
current.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Iterator;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.olingo.client.api.CommonODataClient;
|
||||
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
|
||||
import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
|
||||
import org.apache.olingo.client.api.communication.request.batch.BatchManager;
|
||||
|
@ -89,7 +90,7 @@ public class ODataBatchRequestImpl
|
|||
|
||||
@Override
|
||||
protected ODataBatchResponse getResponseInstance(final long timeout, final TimeUnit unit) {
|
||||
return new ODataBatchResponseImpl(httpClient, getHttpResponse(timeout, unit));
|
||||
return new ODataBatchResponseImpl(odataClient, httpClient, getHttpResponse(timeout, unit));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -107,14 +108,10 @@ public class ODataBatchRequestImpl
|
|||
*/
|
||||
protected class ODataBatchResponseImpl extends AbstractODataResponse implements ODataBatchResponse {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
protected ODataBatchResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
protected ODataBatchResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,5 +121,13 @@ public class ODataBatchRequestImpl
|
|||
public Iterator<ODataBatchResponseItem> getBody() {
|
||||
return new ODataBatchResponseManager(this, expectedResItems);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
for (ODataBatchResponseItem resItem : expectedResItems) {
|
||||
resItem.close();
|
||||
}
|
||||
super.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Iterator;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.olingo.client.api.CommonODataClient;
|
||||
import org.apache.olingo.client.api.communication.header.HeaderName;
|
||||
import org.apache.olingo.client.api.communication.header.ODataPreferences;
|
||||
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
|
||||
|
@ -95,7 +96,7 @@ public class ODataBatchRequestImpl
|
|||
|
||||
@Override
|
||||
protected ODataBatchResponse getResponseInstance(final long timeout, final TimeUnit unit) {
|
||||
return new ODataBatchResponseImpl(httpClient, getHttpResponse(timeout, unit));
|
||||
return new ODataBatchResponseImpl(odataClient, httpClient, getHttpResponse(timeout, unit));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -110,17 +111,10 @@ public class ODataBatchRequestImpl
|
|||
*/
|
||||
protected class ODataBatchResponseImpl extends AbstractODataResponse implements ODataBatchResponse {
|
||||
|
||||
private ODataBatchResponseImpl() {
|
||||
}
|
||||
protected ODataBatchResponseImpl(
|
||||
final CommonODataClient<?> odataClient, final HttpClient httpClient, final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
protected ODataBatchResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,5 +124,14 @@ public class ODataBatchRequestImpl
|
|||
public Iterator<ODataBatchResponseItem> getBody() {
|
||||
return new ODataBatchResponseManager(this, expectedResItems, continueOnError);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
for (ODataBatchResponseItem resItem : expectedResItems) {
|
||||
resItem.close();
|
||||
}
|
||||
super.close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,15 +35,8 @@ import org.apache.olingo.commons.api.format.ODataFormat;
|
|||
* This class implements an OData delete request.
|
||||
*/
|
||||
public class ODataDeleteRequestImpl extends AbstractODataBasicRequest<ODataDeleteResponse>
|
||||
implements ODataDeleteRequest {
|
||||
implements ODataDeleteRequest {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param odataClient client instance getting this request
|
||||
* @param method HTTP method to be used
|
||||
* @param uri URI of the entity to be deleted.
|
||||
*/
|
||||
ODataDeleteRequestImpl(final CommonODataClient<?> odataClient, final HttpMethod method, final URI uri) {
|
||||
super(odataClient, method, uri);
|
||||
}
|
||||
|
@ -63,7 +56,7 @@ public class ODataDeleteRequestImpl extends AbstractODataBasicRequest<ODataDelet
|
|||
|
||||
@Override
|
||||
public ODataDeleteResponse execute() {
|
||||
return new ODataDeleteResponseImpl(httpClient, doExecute());
|
||||
return new ODataDeleteResponseImpl(odataClient, httpClient, doExecute());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,22 +64,10 @@ public class ODataDeleteRequestImpl extends AbstractODataBasicRequest<ODataDelet
|
|||
*/
|
||||
private class ODataDeleteResponseImpl extends AbstractODataResponse implements ODataDeleteResponse {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <p>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataDeleteResponseImpl() {
|
||||
}
|
||||
private ODataDeleteResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataDeleteResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ public class ODataEntityCreateRequestImpl<E extends CommonODataEntity>
|
|||
((HttpPost) request).setEntity(URIUtils.buildInputStreamEntity(odataClient, input));
|
||||
|
||||
try {
|
||||
return new ODataEntityCreateResponseImpl(httpClient, doExecute());
|
||||
return new ODataEntityCreateResponseImpl(odataClient, httpClient, doExecute());
|
||||
} finally {
|
||||
IOUtils.closeQuietly(input);
|
||||
}
|
||||
|
@ -98,23 +98,10 @@ public class ODataEntityCreateRequestImpl<E extends CommonODataEntity>
|
|||
|
||||
private E entity = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <p>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataEntityCreateResponseImpl() {
|
||||
super();
|
||||
}
|
||||
private ODataEntityCreateResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataEntityCreateResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -125,9 +112,9 @@ public class ODataEntityCreateRequestImpl<E extends CommonODataEntity>
|
|||
public E getBody() {
|
||||
if (entity == null) {
|
||||
try {
|
||||
final ResWrap<Entity> resource = odataClient.getDeserializer(ODataFormat.fromString(getAccept()))
|
||||
.toEntity(getRawResponse());
|
||||
|
||||
final ResWrap<Entity> resource = odataClient.getDeserializer(ODataFormat.fromString(getAccept())).
|
||||
toEntity(getRawResponse());
|
||||
|
||||
entity = (E) odataClient.getBinder().getODataEntity(resource);
|
||||
} catch (final ODataDeserializerException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
|
|
|
@ -45,8 +45,8 @@ import org.apache.olingo.commons.api.serialization.ODataSerializerException;
|
|||
* @param <E> concrete ODataEntity implementation
|
||||
*/
|
||||
public class ODataEntityUpdateRequestImpl<E extends CommonODataEntity>
|
||||
extends AbstractODataBasicRequest<ODataEntityUpdateResponse<E>>
|
||||
implements ODataEntityUpdateRequest<E> {
|
||||
extends AbstractODataBasicRequest<ODataEntityUpdateResponse<E>>
|
||||
implements ODataEntityUpdateRequest<E> {
|
||||
|
||||
/**
|
||||
* Changes to be applied.
|
||||
|
@ -62,7 +62,7 @@ public class ODataEntityUpdateRequestImpl<E extends CommonODataEntity>
|
|||
* @param changes changes to be applied.
|
||||
*/
|
||||
public ODataEntityUpdateRequestImpl(final CommonODataClient<?> odataClient,
|
||||
final HttpMethod method, final URI uri, final E changes) {
|
||||
final HttpMethod method, final URI uri, final E changes) {
|
||||
|
||||
super(odataClient, method, uri);
|
||||
this.changes = changes;
|
||||
|
@ -73,18 +73,6 @@ public class ODataEntityUpdateRequestImpl<E extends CommonODataEntity>
|
|||
return odataClient.getConfiguration().getDefaultPubFormat();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataEntityUpdateResponse<E> execute() {
|
||||
final InputStream input = getPayload();
|
||||
((HttpEntityEnclosingRequestBase) request).setEntity(URIUtils.buildInputStreamEntity(odataClient, input));
|
||||
|
||||
try {
|
||||
return new ODataEntityUpdateResponseImpl(httpClient, doExecute());
|
||||
} finally {
|
||||
IOUtils.closeQuietly(input);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InputStream getPayload() {
|
||||
try {
|
||||
|
@ -94,6 +82,18 @@ public class ODataEntityUpdateRequestImpl<E extends CommonODataEntity>
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataEntityUpdateResponse<E> execute() {
|
||||
final InputStream input = getPayload();
|
||||
((HttpEntityEnclosingRequestBase) request).setEntity(URIUtils.buildInputStreamEntity(odataClient, input));
|
||||
|
||||
try {
|
||||
return new ODataEntityUpdateResponseImpl(odataClient, httpClient, doExecute());
|
||||
} finally {
|
||||
IOUtils.closeQuietly(input);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Response class about an ODataEntityUpdateRequest.
|
||||
*/
|
||||
|
@ -104,21 +104,10 @@ public class ODataEntityUpdateRequestImpl<E extends CommonODataEntity>
|
|||
*/
|
||||
private E entity = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <p>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataEntityUpdateResponseImpl() {}
|
||||
private ODataEntityUpdateResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataEntityUpdateResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -126,8 +115,8 @@ public class ODataEntityUpdateRequestImpl<E extends CommonODataEntity>
|
|||
public E getBody() {
|
||||
if (entity == null) {
|
||||
try {
|
||||
final ResWrap<Entity> resource = odataClient.getDeserializer(ODataFormat.fromString(getAccept()))
|
||||
.toEntity(getRawResponse());
|
||||
final ResWrap<Entity> resource = odataClient.getDeserializer(ODataFormat.fromString(getAccept())).
|
||||
toEntity(getRawResponse());
|
||||
|
||||
entity = (E) odataClient.getBinder().getODataEntity(resource);
|
||||
} catch (final ODataDeserializerException e) {
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.apache.olingo.commons.api.serialization.ODataSerializerException;
|
|||
* This class implements an OData update entity property request.
|
||||
*/
|
||||
public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest<ODataPropertyUpdateResponse>
|
||||
implements ODataPropertyUpdateRequest {
|
||||
implements ODataPropertyUpdateRequest {
|
||||
|
||||
/**
|
||||
* Value to be created.
|
||||
|
@ -77,7 +77,7 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest<OD
|
|||
((HttpEntityEnclosingRequestBase) request).setEntity(URIUtils.buildInputStreamEntity(odataClient, input));
|
||||
|
||||
try {
|
||||
return new ODataPropertyUpdateResponseImpl(httpClient, doExecute());
|
||||
return new ODataPropertyUpdateResponseImpl(odataClient, httpClient, doExecute());
|
||||
} finally {
|
||||
IOUtils.closeQuietly(input);
|
||||
}
|
||||
|
@ -99,30 +99,18 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest<OD
|
|||
|
||||
private CommonODataProperty property = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <p>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataPropertyUpdateResponseImpl() {
|
||||
}
|
||||
private ODataPropertyUpdateResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataPropertyUpdateResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonODataProperty getBody() {
|
||||
if (property == null) {
|
||||
try {
|
||||
final ResWrap<Property> resource = odataClient.getDeserializer(ODataFormat.fromString(getAccept()))
|
||||
.toProperty(getRawResponse());
|
||||
final ResWrap<Property> resource = odataClient.getDeserializer(ODataFormat.fromString(getAccept())).
|
||||
toProperty(getRawResponse());
|
||||
|
||||
property = odataClient.getBinder().getODataProperty(resource);
|
||||
} catch (final ODataDeserializerException e) {
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.apache.olingo.commons.api.format.ODataFormat;
|
|||
* This class implements an OData update entity property value request.
|
||||
*/
|
||||
public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<ODataValueUpdateResponse>
|
||||
implements ODataValueUpdateRequest {
|
||||
implements ODataValueUpdateRequest {
|
||||
|
||||
/**
|
||||
* Value to be created.
|
||||
|
@ -75,7 +75,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
|
|||
((HttpEntityEnclosingRequestBase) request).setEntity(URIUtils.buildInputStreamEntity(odataClient, input));
|
||||
|
||||
try {
|
||||
return new ODataValueUpdateResponseImpl(httpClient, doExecute());
|
||||
return new ODataValueUpdateResponseImpl(odataClient, httpClient, doExecute());
|
||||
} finally {
|
||||
IOUtils.closeQuietly(input);
|
||||
}
|
||||
|
@ -96,23 +96,10 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
|
|||
|
||||
private ODataPrimitiveValue value = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <p>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataValueUpdateResponseImpl() {
|
||||
super();
|
||||
}
|
||||
private ODataValueUpdateResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataValueUpdateResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -123,7 +110,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
|
|||
try {
|
||||
value = odataClient.getObjectFactory().newPrimitiveValueBuilder().
|
||||
setType(format == ODataFormat.TEXT_PLAIN
|
||||
? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
|
||||
? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
|
||||
setValue(getRawResponse()).
|
||||
build();
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -71,7 +71,7 @@ public class ODataLinkCreateRequestImpl extends AbstractODataBasicRequest<ODataL
|
|||
((HttpPost) request).setEntity(URIUtils.buildInputStreamEntity(odataClient, input));
|
||||
|
||||
try {
|
||||
return new ODataLinkCreateResponseImpl(httpClient, doExecute());
|
||||
return new ODataLinkCreateResponseImpl(odataClient, httpClient, doExecute());
|
||||
} finally {
|
||||
IOUtils.closeQuietly(input);
|
||||
}
|
||||
|
@ -91,22 +91,10 @@ public class ODataLinkCreateRequestImpl extends AbstractODataBasicRequest<ODataL
|
|||
*/
|
||||
private class ODataLinkCreateResponseImpl extends AbstractODataResponse implements ODataLinkOperationResponse {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <p>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataLinkCreateResponseImpl() {
|
||||
}
|
||||
private ODataLinkCreateResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataLinkCreateResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ import org.apache.olingo.commons.api.serialization.ODataSerializerException;
|
|||
* This class implements an update link OData request.
|
||||
*/
|
||||
public class ODataLinkUpdateRequestImpl extends AbstractODataBasicRequest<ODataLinkOperationResponse>
|
||||
implements ODataLinkUpdateRequest {
|
||||
implements ODataLinkUpdateRequest {
|
||||
|
||||
/**
|
||||
* Entity to be linked.
|
||||
|
@ -73,7 +73,7 @@ public class ODataLinkUpdateRequestImpl extends AbstractODataBasicRequest<ODataL
|
|||
((HttpEntityEnclosingRequestBase) request).setEntity(URIUtils.buildInputStreamEntity(odataClient, input));
|
||||
|
||||
try {
|
||||
return new ODataLinkUpdateResponseImpl(httpClient, doExecute());
|
||||
return new ODataLinkUpdateResponseImpl(odataClient, httpClient, doExecute());
|
||||
} finally {
|
||||
IOUtils.closeQuietly(input);
|
||||
}
|
||||
|
@ -93,14 +93,10 @@ public class ODataLinkUpdateRequestImpl extends AbstractODataBasicRequest<ODataL
|
|||
*/
|
||||
public class ODataLinkUpdateResponseImpl extends AbstractODataResponse implements ODataLinkOperationResponse {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
public ODataLinkUpdateResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
public ODataLinkUpdateResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ public abstract class AbstractODataInvokeRequest<T extends ODataInvokeResult>
|
|||
}
|
||||
|
||||
try {
|
||||
return new ODataInvokeResponseImpl(httpClient, doExecute());
|
||||
return new ODataInvokeResponseImpl(odataClient, httpClient, doExecute());
|
||||
} finally {
|
||||
IOUtils.closeQuietly(input);
|
||||
}
|
||||
|
@ -184,23 +184,10 @@ public abstract class AbstractODataInvokeRequest<T extends ODataInvokeResult>
|
|||
|
||||
private T invokeResult = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <p>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataInvokeResponseImpl() {
|
||||
super();
|
||||
}
|
||||
private ODataInvokeResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataInvokeResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -213,19 +200,19 @@ public abstract class AbstractODataInvokeRequest<T extends ODataInvokeResult>
|
|||
if (ODataNoContent.class.isAssignableFrom(reference)) {
|
||||
invokeResult = reference.cast(new ODataNoContent());
|
||||
} else {
|
||||
// avoid getContent() twice:IllegalStateException: Content has been consumed
|
||||
InputStream responseStream = this.payload == null ? res.getEntity().getContent() : this.payload;
|
||||
if (CommonODataEntitySet.class.isAssignableFrom(reference)) {
|
||||
invokeResult = reference.cast(odataClient.getReader().readEntitySet(responseStream,
|
||||
ODataFormat.fromString(getContentType())));
|
||||
} else if (CommonODataEntity.class.isAssignableFrom(reference)) {
|
||||
invokeResult = reference.cast(odataClient.getReader().readEntity(responseStream,
|
||||
ODataFormat.fromString(getContentType())));
|
||||
} else if (CommonODataProperty.class.isAssignableFrom(reference)) {
|
||||
invokeResult = reference.cast(odataClient.getReader().readProperty(responseStream,
|
||||
ODataFormat.fromString(getContentType())));
|
||||
}
|
||||
}
|
||||
// avoid getContent() twice:IllegalStateException: Content has been consumed
|
||||
final InputStream responseStream = this.payload == null ? res.getEntity().getContent() : this.payload;
|
||||
if (CommonODataEntitySet.class.isAssignableFrom(reference)) {
|
||||
invokeResult = reference.cast(odataClient.getReader().readEntitySet(responseStream,
|
||||
ODataFormat.fromString(getContentType())));
|
||||
} else if (CommonODataEntity.class.isAssignableFrom(reference)) {
|
||||
invokeResult = reference.cast(odataClient.getReader().readEntity(responseStream,
|
||||
ODataFormat.fromString(getContentType())));
|
||||
} else if (CommonODataProperty.class.isAssignableFrom(reference)) {
|
||||
invokeResult = reference.cast(odataClient.getReader().readProperty(responseStream,
|
||||
ODataFormat.fromString(getContentType())));
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new HttpClientException(e);
|
||||
} catch (final ODataDeserializerException e) {
|
||||
|
|
|
@ -19,17 +19,17 @@
|
|||
package org.apache.olingo.client.core.communication.request.retrieve;
|
||||
|
||||
import java.net.URI;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.olingo.client.api.CommonODataClient;
|
||||
import org.apache.olingo.client.api.communication.request.ODataRequest;
|
||||
import org.apache.olingo.commons.api.format.ContentType;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
|
||||
public abstract class AbstractMetadataRequestImpl<V> extends AbstractODataRetrieveRequest<V> {
|
||||
|
||||
public AbstractMetadataRequestImpl(final CommonODataClient<?> odataClient, final URI query) {
|
||||
super(odataClient, query);
|
||||
super.setAccept(ContentType.APPLICATION_XML.getMimeType());
|
||||
super.setContentType(ContentType.APPLICATION_XML.getMimeType());
|
||||
super.setAccept(ContentType.APPLICATION_XML.toContentTypeString());
|
||||
super.setContentType(ContentType.APPLICATION_XML.toContentTypeString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.apache.olingo.client.core.communication.request.retrieve;
|
|||
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.olingo.client.api.CommonODataClient;
|
||||
|
@ -64,23 +63,10 @@ public abstract class AbstractODataRetrieveRequest<T>
|
|||
protected abstract class AbstractODataRetrieveResponse
|
||||
extends AbstractODataResponse implements ODataRetrieveResponse<T> {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <p>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
protected AbstractODataRetrieveResponse() {
|
||||
super();
|
||||
}
|
||||
protected AbstractODataRetrieveResponse(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
protected AbstractODataRetrieveResponse(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -49,11 +49,12 @@ class EdmMetadataRequestImpl extends AbstractMetadataRequestImpl<Edm> implements
|
|||
final ODataRetrieveResponse<Map<String, Schema>> xmlMetadataResponse =
|
||||
odataClient.getRetrieveRequestFactory().getXMLMetadataRequest(serviceRoot).execute();
|
||||
|
||||
return new AbstractODataRetrieveResponse() {
|
||||
return new AbstractODataRetrieveResponse(odataClient, httpClient, null) {
|
||||
private Edm metadata = null;
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
super.close();
|
||||
xmlMetadataResponse.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public class ODataEntityRequestImpl<E extends CommonODataEntity>
|
|||
|
||||
@Override
|
||||
public ODataRetrieveResponse<E> execute() {
|
||||
return new ODataEntityResponseImpl(httpClient, doExecute());
|
||||
return new ODataEntityResponseImpl(odataClient, httpClient, doExecute());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -64,23 +64,10 @@ public class ODataEntityRequestImpl<E extends CommonODataEntity>
|
|||
|
||||
private E entity = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <br/>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataEntityResponseImpl() {
|
||||
super();
|
||||
}
|
||||
private ODataEntityResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataEntityResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -88,11 +75,11 @@ public class ODataEntityRequestImpl<E extends CommonODataEntity>
|
|||
public E getBody() {
|
||||
if (entity == null) {
|
||||
try {
|
||||
final ResWrap<Entity> resource = odataClient.getDeserializer(ODataFormat.fromString(getContentType()))
|
||||
.toEntity(getRawResponse());
|
||||
final ResWrap<Entity> resource = odataClient.getDeserializer(ODataFormat.fromString(getContentType())).
|
||||
toEntity(getRawResponse());
|
||||
|
||||
entity = (E) odataClient.getBinder().getODataEntity(resource);
|
||||
} catch (final ODataDeserializerException e) {
|
||||
} catch (ODataDeserializerException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
} finally {
|
||||
this.close();
|
||||
|
|
|
@ -57,7 +57,7 @@ public class ODataEntitySetIteratorRequestImpl<ES extends CommonODataEntitySet,
|
|||
@Override
|
||||
public ODataRetrieveResponse<ODataEntitySetIterator<ES, E>> execute() {
|
||||
final HttpResponse res = doExecute();
|
||||
return new ODataEntitySetIteratorResponseImpl(httpClient, res);
|
||||
return new ODataEntitySetIteratorResponseImpl(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,14 +65,10 @@ public class ODataEntitySetIteratorRequestImpl<ES extends CommonODataEntitySet,
|
|||
*/
|
||||
protected class ODataEntitySetIteratorResponseImpl extends AbstractODataRetrieveResponse {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataEntitySetIteratorResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
private ODataEntitySetIteratorResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -59,7 +59,7 @@ public class ODataEntitySetRequestImpl<ES extends CommonODataEntitySet>
|
|||
@Override
|
||||
public ODataRetrieveResponse<ES> execute() {
|
||||
final HttpResponse res = doExecute();
|
||||
return new ODataEntitySetResponseImpl(httpClient, res);
|
||||
return new ODataEntitySetResponseImpl(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -67,23 +67,10 @@ public class ODataEntitySetRequestImpl<ES extends CommonODataEntitySet>
|
|||
*/
|
||||
protected class ODataEntitySetResponseImpl extends AbstractODataRetrieveResponse {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <p>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataEntitySetResponseImpl() {
|
||||
super();
|
||||
}
|
||||
private ODataEntitySetResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataEntitySetResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -91,8 +78,8 @@ public class ODataEntitySetRequestImpl<ES extends CommonODataEntitySet>
|
|||
public ES getBody() {
|
||||
if (entitySet == null) {
|
||||
try {
|
||||
final ResWrap<EntitySet> resource = odataClient.getDeserializer(ODataFormat.fromString(getContentType()))
|
||||
.toEntitySet(getRawResponse());
|
||||
final ResWrap<EntitySet> resource = odataClient.getDeserializer(ODataFormat.fromString(getContentType())).
|
||||
toEntitySet(getRawResponse());
|
||||
|
||||
entitySet = (ES) odataClient.getBinder().getODataEntitySet(resource);
|
||||
} catch (final ODataDeserializerException e) {
|
||||
|
|
|
@ -61,7 +61,7 @@ public class ODataMediaRequestImpl extends AbstractODataRetrieveRequest<InputStr
|
|||
@Override
|
||||
public ODataRetrieveResponse<InputStream> execute() {
|
||||
final HttpResponse res = doExecute();
|
||||
return new ODataMediaResponseImpl(httpClient, res);
|
||||
return new ODataMediaResponseImpl(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,23 +71,10 @@ public class ODataMediaRequestImpl extends AbstractODataRetrieveRequest<InputStr
|
|||
|
||||
private InputStream input = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <p>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataMediaResponseImpl() {
|
||||
super();
|
||||
}
|
||||
private ODataMediaResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataMediaResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
|||
* This class implements an OData entity property query request.
|
||||
*/
|
||||
public class ODataPropertyRequestImpl<T extends CommonODataProperty>
|
||||
extends AbstractODataRetrieveRequest<T> implements ODataPropertyRequest<T> {
|
||||
extends AbstractODataRetrieveRequest<T> implements ODataPropertyRequest<T> {
|
||||
|
||||
/**
|
||||
* Private constructor.
|
||||
|
@ -57,29 +57,17 @@ public class ODataPropertyRequestImpl<T extends CommonODataProperty>
|
|||
@Override
|
||||
public ODataRetrieveResponse<T> execute() {
|
||||
final HttpResponse res = doExecute();
|
||||
return new ODataPropertyResponseImpl(httpClient, res);
|
||||
return new ODataPropertyResponseImpl(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
protected class ODataPropertyResponseImpl extends AbstractODataRetrieveResponse {
|
||||
|
||||
private T property = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <p>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataPropertyResponseImpl() {
|
||||
}
|
||||
private ODataPropertyResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataPropertyResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -88,7 +76,7 @@ public class ODataPropertyRequestImpl<T extends CommonODataProperty>
|
|||
if (property == null) {
|
||||
try {
|
||||
final ResWrap<Property> resource = odataClient.getDeserializer(ODataFormat.fromString(getContentType()))
|
||||
.toProperty(res.getEntity().getContent());
|
||||
.toProperty(res.getEntity().getContent());
|
||||
|
||||
property = (T) odataClient.getBinder().getODataProperty(resource);
|
||||
} catch (IOException e) {
|
||||
|
|
|
@ -63,29 +63,17 @@ public class ODataRawRequestImpl extends AbstractODataRequest implements ODataRa
|
|||
|
||||
@Override
|
||||
public ODataRawResponse execute() {
|
||||
return new ODataRawResponseImpl(httpClient, doExecute());
|
||||
return new ODataRawResponseImpl(odataClient, httpClient, doExecute());
|
||||
}
|
||||
|
||||
private class ODataRawResponseImpl extends AbstractODataResponse implements ODataRawResponse {
|
||||
|
||||
private byte[] obj = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <br/>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataRawResponseImpl() {
|
||||
}
|
||||
private ODataRawResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataRawResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,8 +89,7 @@ public class ODataRawRequestImpl extends AbstractODataRequest implements ODataRa
|
|||
}
|
||||
|
||||
try {
|
||||
return odataClient.getReader().
|
||||
read(new ByteArrayInputStream(obj), getContentType(), reference);
|
||||
return odataClient.getReader().read(new ByteArrayInputStream(obj), getContentType(), reference);
|
||||
} catch (final ODataDeserializerException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
|||
* This class implements an OData service document request.
|
||||
*/
|
||||
public class ODataServiceDocumentRequestImpl extends AbstractODataRetrieveRequest<ODataServiceDocument>
|
||||
implements ODataServiceDocumentRequest {
|
||||
implements ODataServiceDocumentRequest {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -55,7 +55,7 @@ public class ODataServiceDocumentRequestImpl extends AbstractODataRetrieveReques
|
|||
@Override
|
||||
public ODataRetrieveResponse<ODataServiceDocument> execute() {
|
||||
final HttpResponse res = doExecute();
|
||||
return new ODataServiceResponseImpl(httpClient, res);
|
||||
return new ODataServiceResponseImpl(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,30 +65,18 @@ public class ODataServiceDocumentRequestImpl extends AbstractODataRetrieveReques
|
|||
|
||||
private ODataServiceDocument serviceDocument = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <p>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataServiceResponseImpl() {}
|
||||
private ODataServiceResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataServiceResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataServiceDocument getBody() {
|
||||
if (serviceDocument == null) {
|
||||
try {
|
||||
final ResWrap<ServiceDocument> resource =
|
||||
odataClient.getDeserializer(ODataFormat.fromString(getContentType()))
|
||||
.toServiceDocument(getRawResponse());
|
||||
final ResWrap<ServiceDocument> resource = odataClient.
|
||||
getDeserializer(ODataFormat.fromString(getContentType())).toServiceDocument(getRawResponse());
|
||||
|
||||
serviceDocument = odataClient.getBinder().getODataServiceDocument(resource.getPayload());
|
||||
} catch (final ODataDeserializerException e) {
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.apache.olingo.commons.api.format.ODataFormat;
|
|||
* This class implements an OData entity property value query request.
|
||||
*/
|
||||
public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataPrimitiveValue>
|
||||
implements ODataValueRequest {
|
||||
implements ODataValueRequest {
|
||||
|
||||
/**
|
||||
* Private constructor.
|
||||
|
@ -55,7 +55,7 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataPri
|
|||
@Override
|
||||
public ODataRetrieveResponse<ODataPrimitiveValue> execute() {
|
||||
final HttpResponse res = doExecute();
|
||||
return new ODataValueResponseImpl(httpClient, res);
|
||||
return new ODataValueResponseImpl(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,23 +65,10 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataPri
|
|||
|
||||
private ODataPrimitiveValue value = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <p>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataValueResponseImpl() {
|
||||
super();
|
||||
}
|
||||
private ODataValueResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataValueResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -91,8 +78,8 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataPri
|
|||
|
||||
try {
|
||||
value = odataClient.getObjectFactory().newPrimitiveValueBuilder().
|
||||
setType(format == ODataFormat.TEXT_PLAIN ?
|
||||
EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
|
||||
setType(format == ODataFormat.TEXT_PLAIN
|
||||
? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
|
||||
setValue(IOUtils.toString(getRawResponse())).build();
|
||||
} catch (Exception e) {
|
||||
throw new HttpClientException(e);
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.net.URI;
|
|||
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.olingo.client.api.CommonODataClient;
|
||||
import org.apache.olingo.client.api.v3.ODataClient;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.v3.ODataLinkCollectionRequest;
|
||||
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
|
||||
|
@ -36,7 +37,7 @@ import org.apache.olingo.client.core.communication.request.retrieve.AbstractODat
|
|||
* This class implements an OData link query request.
|
||||
*/
|
||||
public class ODataLinkCollectionRequestImpl extends AbstractODataRetrieveRequest<ODataLinkCollection>
|
||||
implements ODataLinkCollectionRequest {
|
||||
implements ODataLinkCollectionRequest {
|
||||
|
||||
/**
|
||||
* Private constructor.
|
||||
|
@ -47,7 +48,7 @@ public class ODataLinkCollectionRequestImpl extends AbstractODataRetrieveRequest
|
|||
*/
|
||||
ODataLinkCollectionRequestImpl(final ODataClient odataClient, final URI targetURI, final String linkName) {
|
||||
super(odataClient,
|
||||
odataClient.newURIBuilder(targetURI.toASCIIString()).appendLinksSegment(linkName).build());
|
||||
odataClient.newURIBuilder(targetURI.toASCIIString()).appendLinksSegment(linkName).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,29 +58,17 @@ public class ODataLinkCollectionRequestImpl extends AbstractODataRetrieveRequest
|
|||
|
||||
@Override
|
||||
public ODataRetrieveResponse<ODataLinkCollection> execute() {
|
||||
return new ODataLinkCollectionResponseImpl(httpClient, doExecute());
|
||||
return new ODataLinkCollectionResponseImpl(odataClient, httpClient, doExecute());
|
||||
}
|
||||
|
||||
protected class ODataLinkCollectionResponseImpl extends AbstractODataRetrieveResponse {
|
||||
|
||||
private ODataLinkCollection links = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <p>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataLinkCollectionResponseImpl() {
|
||||
}
|
||||
private ODataLinkCollectionResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataLinkCollectionResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Map;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.olingo.client.api.CommonODataClient;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
|
||||
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
|
||||
import org.apache.olingo.client.api.edm.xml.Schema;
|
||||
|
@ -42,30 +43,17 @@ public class XMLMetadataRequestImpl extends AbstractMetadataRequestImpl<Map<Stri
|
|||
|
||||
@Override
|
||||
public ODataRetrieveResponse<Map<String, Schema>> execute() {
|
||||
return new XMLMetadataResponseImpl(httpClient, doExecute());
|
||||
return new XMLMetadataResponseImpl(odataClient, httpClient, doExecute());
|
||||
}
|
||||
|
||||
public class XMLMetadataResponseImpl extends AbstractODataRetrieveResponse {
|
||||
|
||||
private Map<String, Schema> schemas;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <br/>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private XMLMetadataResponseImpl() {
|
||||
super();
|
||||
}
|
||||
private XMLMetadataResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private XMLMetadataResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,8 +61,7 @@ public class XMLMetadataRequestImpl extends AbstractMetadataRequestImpl<Map<Stri
|
|||
if (schemas == null) {
|
||||
schemas = new HashMap<String, Schema>();
|
||||
try {
|
||||
final XMLMetadata metadata = odataClient.getDeserializer(ODataFormat.XML)
|
||||
.toMetadata(getRawResponse());
|
||||
final XMLMetadata metadata = odataClient.getDeserializer(ODataFormat.XML).toMetadata(getRawResponse());
|
||||
for (Schema schema : metadata.getSchemas()) {
|
||||
schemas.put(schema.getNamespace(), schema);
|
||||
if (StringUtils.isNotBlank(schema.getAlias())) {
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.olingo.commons.api.format.ODataFormat;
|
|||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
|
||||
public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest<ODataDelta>
|
||||
implements ODataDeltaRequest {
|
||||
implements ODataDeltaRequest {
|
||||
|
||||
public ODataDeltaRequestImpl(final CommonODataClient<?> odataClient, final URI query) {
|
||||
super(odataClient, query);
|
||||
|
@ -50,30 +50,26 @@ public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest<ODataDel
|
|||
@Override
|
||||
public ODataRetrieveResponse<ODataDelta> execute() {
|
||||
final HttpResponse res = doExecute();
|
||||
return new ODataDeltaResponseImpl(httpClient, res);
|
||||
return new ODataDeltaResponseImpl(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
protected class ODataDeltaResponseImpl extends AbstractODataRetrieveResponse {
|
||||
|
||||
private ODataDelta delta = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataDeltaResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
private ODataDeltaResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataDelta getBody() {
|
||||
if (delta == null) {
|
||||
try {
|
||||
final ResWrap<Delta> resource = ((ODataClient) odataClient)
|
||||
.getDeserializer(ODataFormat.fromString(getContentType()))
|
||||
.toDelta(res.getEntity().getContent());
|
||||
final ResWrap<Delta> resource = ((ODataClient) odataClient).
|
||||
getDeserializer(ODataFormat.fromString(getContentType())).
|
||||
toDelta(res.getEntity().getContent());
|
||||
|
||||
delta = ((ODataClient) odataClient).getBinder().getODataDelta(resource);
|
||||
} catch (IOException e) {
|
||||
|
|
|
@ -24,6 +24,8 @@ import java.util.Map;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.olingo.client.api.CommonODataClient;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
|
||||
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
|
||||
import org.apache.olingo.client.api.edm.xml.Schema;
|
||||
|
@ -51,7 +53,8 @@ public class XMLMetadataRequestImpl extends AbstractMetadataRequestImpl<Map<Stri
|
|||
final SingleXMLMetadatRequestImpl rootReq = new SingleXMLMetadatRequestImpl((ODataClient) odataClient, uri);
|
||||
final ODataRetrieveResponse<XMLMetadata> rootRes = rootReq.execute();
|
||||
|
||||
final XMLMetadataResponseImpl response = new XMLMetadataResponseImpl(rootReq.getHttpResponse());
|
||||
final XMLMetadataResponseImpl response =
|
||||
new XMLMetadataResponseImpl(odataClient, httpClient, rootReq.getHttpResponse());
|
||||
|
||||
final XMLMetadata rootMetadata = rootRes.getBody();
|
||||
for (Schema schema : rootMetadata.getSchemas()) {
|
||||
|
@ -137,7 +140,7 @@ public class XMLMetadataRequestImpl extends AbstractMetadataRequestImpl<Map<Stri
|
|||
@Override
|
||||
public ODataRetrieveResponse<XMLMetadata> execute() {
|
||||
httpResponse = doExecute();
|
||||
return new AbstractODataRetrieveResponse(httpClient, httpResponse) {
|
||||
return new AbstractODataRetrieveResponse(odataClient, httpClient, httpResponse) {
|
||||
|
||||
@Override
|
||||
public XMLMetadata getBody() {
|
||||
|
@ -155,8 +158,10 @@ public class XMLMetadataRequestImpl extends AbstractMetadataRequestImpl<Map<Stri
|
|||
|
||||
private final Map<String, Schema> schemas = new HashMap<String, Schema>();
|
||||
|
||||
private XMLMetadataResponseImpl(final HttpResponse res) {
|
||||
super();
|
||||
private XMLMetadataResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
super(odataClient, httpClient, null);
|
||||
|
||||
statusCode = res.getStatusLine().getStatusCode();
|
||||
statusMessage = res.getStatusLine().getReasonPhrase();
|
||||
|
@ -164,11 +169,6 @@ public class XMLMetadataRequestImpl extends AbstractMetadataRequestImpl<Map<Stri
|
|||
hasBeenInitialized = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
// just do nothing, this is a placeholder response
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Schema> getBody() {
|
||||
return schemas;
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.apache.commons.io.IOUtils;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.olingo.client.api.CommonODataClient;
|
||||
import org.apache.olingo.client.api.ODataBatchConstants;
|
||||
import org.apache.olingo.client.api.communication.request.ODataPayloadManager;
|
||||
|
@ -40,6 +39,7 @@ import org.apache.olingo.client.api.http.HttpMethod;
|
|||
import org.apache.olingo.client.core.communication.request.AbstractODataRequest;
|
||||
import org.apache.olingo.client.core.communication.request.Wrapper;
|
||||
import org.apache.olingo.client.core.uri.URIUtils;
|
||||
import org.apache.olingo.commons.api.format.ContentType;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
|
||||
/**
|
||||
|
@ -73,8 +73,8 @@ public abstract class AbstractODataStreamedRequest<V extends ODataResponse, T ex
|
|||
final HttpMethod method, final URI uri) {
|
||||
|
||||
super(odataClient, method, uri);
|
||||
setAccept(ContentType.APPLICATION_OCTET_STREAM.getMimeType());
|
||||
setContentType(ContentType.APPLICATION_OCTET_STREAM.getMimeType());
|
||||
setAccept(ContentType.APPLICATION_OCTET_STREAM.toContentTypeString());
|
||||
setContentType(ContentType.APPLICATION_OCTET_STREAM.toContentTypeString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -87,7 +87,7 @@ public class ODataMediaEntityCreateRequestImpl<E extends CommonODataEntity>
|
|||
@Override
|
||||
protected ODataMediaEntityCreateResponse<E> getResponse(final long timeout, final TimeUnit unit) {
|
||||
finalizeBody();
|
||||
return new ODataMediaEntityCreateResponseImpl(httpClient, getHttpResponse(timeout, unit));
|
||||
return new ODataMediaEntityCreateResponseImpl(odataClient, httpClient, getHttpResponse(timeout, unit));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,22 +99,10 @@ public class ODataMediaEntityCreateRequestImpl<E extends CommonODataEntity>
|
|||
|
||||
private E entity = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <p>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataMediaEntityCreateResponseImpl() {
|
||||
}
|
||||
private ODataMediaEntityCreateResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataMediaEntityCreateResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -122,8 +110,7 @@ public class ODataMediaEntityCreateRequestImpl<E extends CommonODataEntity>
|
|||
public E getBody() {
|
||||
if (entity == null) {
|
||||
try {
|
||||
final ResWrap<Entity> resource = odataClient.getDeserializer(getFormat())
|
||||
.toEntity(getRawResponse());
|
||||
final ResWrap<Entity> resource = odataClient.getDeserializer(getFormat()).toEntity(getRawResponse());
|
||||
|
||||
entity = (E) odataClient.getBinder().getODataEntity(resource);
|
||||
} catch (final ODataDeserializerException e) {
|
||||
|
|
|
@ -88,7 +88,7 @@ public class ODataMediaEntityUpdateRequestImpl<E extends CommonODataEntity>
|
|||
@Override
|
||||
protected ODataMediaEntityUpdateResponse<E> getResponse(final long timeout, final TimeUnit unit) {
|
||||
finalizeBody();
|
||||
return new ODataMediaEntityUpdateResponseImpl(httpClient, getHttpResponse(timeout, unit));
|
||||
return new ODataMediaEntityUpdateResponseImpl(odataClient, httpClient, getHttpResponse(timeout, unit));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,23 +100,10 @@ public class ODataMediaEntityUpdateRequestImpl<E extends CommonODataEntity>
|
|||
|
||||
private E entity = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <br/>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataMediaEntityUpdateResponseImpl() {
|
||||
super();
|
||||
}
|
||||
private ODataMediaEntityUpdateResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataMediaEntityUpdateResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -85,7 +85,7 @@ public class ODataStreamUpdateRequestImpl
|
|||
@Override
|
||||
protected ODataStreamUpdateResponse getResponse(final long timeout, final TimeUnit unit) {
|
||||
finalizeBody();
|
||||
return new ODataStreamUpdateResponseImpl(httpClient, getHttpResponse(timeout, unit));
|
||||
return new ODataStreamUpdateResponseImpl(odataClient, httpClient, getHttpResponse(timeout, unit));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,22 +96,10 @@ public class ODataStreamUpdateRequestImpl
|
|||
|
||||
private InputStream input = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* <p>
|
||||
* Just to create response templates to be initialized from batch.
|
||||
*/
|
||||
private ODataStreamUpdateResponseImpl() {
|
||||
}
|
||||
private ODataStreamUpdateResponseImpl(final CommonODataClient<?> odataClient, final HttpClient httpClient,
|
||||
final HttpResponse res) {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param client HTTP client.
|
||||
* @param res HTTP response.
|
||||
*/
|
||||
private ODataStreamUpdateResponseImpl(final HttpClient client, final HttpResponse res) {
|
||||
super(client, res);
|
||||
super(odataClient, httpClient, res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -85,13 +85,13 @@ public class AsyncRequestWrapperImpl<R extends ODataResponse> extends AbstractRe
|
|||
// target uri
|
||||
this.uri = odataRequest.getURI();
|
||||
|
||||
HttpClient _httpClient = odataClient.getConfiguration().getHttpClientFactory().createHttpClient(method, this.uri);
|
||||
HttpClient _httpClient = odataClient.getConfiguration().getHttpClientFactory().create(method, this.uri);
|
||||
if (odataClient.getConfiguration().isGzipCompression()) {
|
||||
_httpClient = new DecompressingHttpClient(_httpClient);
|
||||
}
|
||||
this.httpClient = _httpClient;
|
||||
|
||||
this.request = odataClient.getConfiguration().getHttpUriRequestFactory().createHttpUriRequest(method, this.uri);
|
||||
this.request = odataClient.getConfiguration().getHttpUriRequestFactory().create(method, this.uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -292,7 +292,7 @@ public class AsyncRequestWrapperImpl<R extends ODataResponse> extends AbstractRe
|
|||
}
|
||||
|
||||
final HttpUriRequest monitor = odataClient.getConfiguration().getHttpUriRequestFactory().
|
||||
createHttpUriRequest(HttpMethod.GET, location);
|
||||
create(HttpMethod.GET, location);
|
||||
|
||||
return executeHttpRequest(httpClient, monitor);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue