initial check-in of prototype
* working API commander * adding XSLT for EDMX -> OAI * moved sample metadata files to their own directory. * improvements to readability and handling * working serializer * build producing working JAR in /out/artifacts/... * added saveRawGetRequest and fixed readEntities * added support for filter expressions in readEntities, which was also re-written * adding more correct command line handling * adding README and ready for PR * added further exception handling to validateMetadata
This commit is contained in:
commit
d1a804fa91
|
@ -0,0 +1,4 @@
|
||||||
|
*.iml
|
||||||
|
target/
|
||||||
|
.idea/
|
||||||
|
classes/
|
|
@ -0,0 +1,177 @@
|
||||||
|
# RESO Web API Commander
|
||||||
|
|
||||||
|
[![CodeFactor](https://www.codefactor.io/repository/github/darnjo/web-api-commander/badge)](https://www.codefactor.io/repository/github/darnjo/web-api-commander)
|
||||||
|
|
||||||
|
The RESO Web API Commander is a command line Java application that uses
|
||||||
|
the Apache Olingo library to provide the following functionality:
|
||||||
|
|
||||||
|
* Get Metadata
|
||||||
|
* Validate Metadata
|
||||||
|
* Get Entity data from a Web API URL
|
||||||
|
* Save raw responses from a WEB API URL
|
||||||
|
* Read all Entities up to a given limit
|
||||||
|
* Convert EDMX to Swagger / OAI
|
||||||
|
|
||||||
|
The Web API Commander currently supports Bearer Tokens for authentication.
|
||||||
|
Additional methods of authentication will be added through subsequent updates.
|
||||||
|
|
||||||
|
Help is available from the command line by passing `--help`, which displays
|
||||||
|
the following information:
|
||||||
|
|
||||||
|
```
|
||||||
|
usage: java -jar web-api-commander
|
||||||
|
--bearerToken <b> Bearer token to be used with the request.
|
||||||
|
--contentType <t> Results format: JSON (default),
|
||||||
|
JSON_NO_METADATA, JSON_FULL_METADATA, XML.
|
||||||
|
--convertEDMXtoOAI converts EDMX in <inputFile> to OAI, saving it
|
||||||
|
in <inputFile>.swagger.json
|
||||||
|
--entityName <n> The name of the entity to fetch, e.g.
|
||||||
|
Property.
|
||||||
|
--filter <f> If <filter> is passed, then readEntities will
|
||||||
|
use it.
|
||||||
|
--getEntitySet executes GET on <uri> using the given
|
||||||
|
<bearerToken> and <outputFile>.
|
||||||
|
--getMetadata fetches metadata from <serviceRoot> using
|
||||||
|
<bearerToken> and saves results in
|
||||||
|
<outputFile>.
|
||||||
|
--help print help
|
||||||
|
--inputFile <i> Path to input file.
|
||||||
|
--limit <l> The number of records to fetch, or -1 to fetch
|
||||||
|
all.
|
||||||
|
--outputFile <o> Path to output file.
|
||||||
|
--readEntities reads <entityName> from <serviceRoot> using
|
||||||
|
<bearerToken> and saves results in
|
||||||
|
<outputFile>.
|
||||||
|
--saveRawGetRequest performs GET from <requestURI> using the
|
||||||
|
given <bearerToken> and saves the output to <outputFile>.
|
||||||
|
--serviceRoot <s> Service root URL on the host.
|
||||||
|
--uri <u> URI for raw request.
|
||||||
|
--useEdmEnabledClient present if an EdmEnabledClient should be used.
|
||||||
|
--validateMetadata validates previously-fetched metadata in the
|
||||||
|
<inputFile> path.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
## 1. Getting Metadata
|
||||||
|
|
||||||
|
To get metadata, use the `--getMetadata` argument with the following options:
|
||||||
|
|
||||||
|
```
|
||||||
|
java -jar web-api-commander.jar --getMetadata --serviceRoot <s> --bearerToken <b> --outputFile <o>
|
||||||
|
```
|
||||||
|
|
||||||
|
where `serviceRoot` is the path to the root of the OData WebAPI server.
|
||||||
|
|
||||||
|
Assuming everything goes well, metadata will be retrieved from the host and written to the provided `--outputFile`.
|
||||||
|
|
||||||
|
**Note**: additional validation is done after metadata have been received. Errors in metadata
|
||||||
|
won't cause the program to terminate, but validation information will be displayed.
|
||||||
|
|
||||||
|
## 2. Validating Metadata stored in an EDMX file
|
||||||
|
Sometimes it's useful to validate an already-downloaded EDMX file.
|
||||||
|
|
||||||
|
Since parsing EDMX is an incremental process, validation terminates _each time_ invalid
|
||||||
|
items are encountered. Therefore, the workflow for correcting an EDMX document that contains errors
|
||||||
|
would be to run the Commander repeatedly, fixing errors that are encountered along the way.
|
||||||
|
|
||||||
|
To validate metadata, call the Web API Commander with the following options:
|
||||||
|
|
||||||
|
```
|
||||||
|
java -jar web-api-commander.jar --validateMetadata --inputFile <i>
|
||||||
|
```
|
||||||
|
|
||||||
|
where `inputFile` is the path to your EDMX file. Errors will be logged according to the `log4j.properties` file
|
||||||
|
used at runtime.
|
||||||
|
|
||||||
|
## 3. Getting results from a given `uri` using OData
|
||||||
|
|
||||||
|
OData offers additional options for requesting data from a WebAPI server beyond just receiving the
|
||||||
|
raw server response (shown in the next example).
|
||||||
|
|
||||||
|
In this case, the appropriate action is: `--getEntitySet`, which can be called as follows:
|
||||||
|
|
||||||
|
```
|
||||||
|
java -jar web-api-commander.jar --getEntitySet --uri <u> --bearerToken <b> --outputFile <o>
|
||||||
|
```
|
||||||
|
|
||||||
|
When using the `--useEdmEnabledClient` option, results will be verified against Server metadata
|
||||||
|
after being downloaded. If this option is chosen, then `--serviceRoot` is required so that the Web API
|
||||||
|
Commander can pull the Server's metadata in addition to the results from the given `--uri`
|
||||||
|
|
||||||
|
The `getEntitySet` action also supports the `--contentType` option, which will change how results are
|
||||||
|
written. Currently supported options are: `JSON`, `JSON_NO_METADATA`, `JSON_FULL_METADATA`, and `XML`.
|
||||||
|
|
||||||
|
## 4. Getting raw results from a given `uri` using `saveGetRawRequest`
|
||||||
|
|
||||||
|
If additional processing using the OData Olingo library is not needed, raw requests may be issued
|
||||||
|
against the server instead.
|
||||||
|
|
||||||
|
The `--saveGetRawRequest` action writes the raw response from a GET request to the given `--uri`
|
||||||
|
from the Web API server directly to the given `--outputFile`.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```
|
||||||
|
java -jar web-api-commander.jar --uri <u> --bearerToken <b> --outputFile <o>
|
||||||
|
```
|
||||||
|
|
||||||
|
Results are not checked against Server Metadata and are not written in any specific OData format.
|
||||||
|
|
||||||
|
|
||||||
|
## 5. Reading all Entities up to `limit` using `readEntities`
|
||||||
|
|
||||||
|
The `readEntities` action takes an `entityName` and reads all items up until `limit` on a given
|
||||||
|
`serverRoot`. Paging is done behind the scenes by computing skips for each page of results.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```
|
||||||
|
java -jar web-api-commander.jar --readEntities --inputFile <i> --outputFile <o> --limit 101 --serviceRoot --serviceRoot <s> --bearerToken <b> --entityName Property --filter "ListPrice gt 1000000" --useEdmEnabledClient
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Once results are fetched, they're written to the given `outputFile`. Additional options are supported
|
||||||
|
as well, such as `useEdmEnabledClient`, which also requires that `serviceRoot` be passed. The EDM-enabled
|
||||||
|
client will check results against server metadata once they're downloaded.
|
||||||
|
|
||||||
|
This action also supports serialization in different formats using the `contentType` option. The
|
||||||
|
Content Types currently supported are: `JSON`, `JSON_NO_METADATA`, `JSON_FULL_METADATA`, and `XML`.
|
||||||
|
|
||||||
|
`readEntities` also supports `filter` expressions, as it may sometimes be useful to filter the entities
|
||||||
|
being fetched. While most command line arguments don't need to be quoted, `filter` expressions are the exception.
|
||||||
|
See above example.
|
||||||
|
|
||||||
|
**Note**: passing `--limit -1` as an option will fetch _all_ Entities from the given `serviceRoot`.
|
||||||
|
|
||||||
|
|
||||||
|
Additional query options will eventually be added, such as `$select` and `$order`. Planned
|
||||||
|
functionality includes a `parallel` option which will fetch multiple pages simultaneously up to `numThreads` workers.
|
||||||
|
|
||||||
|
|
||||||
|
## 6. Converting metadata from EDMX format to Open API / Swagger 2.0 format
|
||||||
|
|
||||||
|
The WebAPI Commander also supports converting files in EDMX format to Open API / Swagger 2.0 format. This
|
||||||
|
gives servers an alternative representation besides the OData-specific representation used by EDMX.
|
||||||
|
|
||||||
|
It's worth mentioning that translation from EDMX to OAI/Swagger is _lossy_, meaning that some EDMX elements
|
||||||
|
will not be translated. This is due to the fact that EDMX is more specific than OAI, for instance with type
|
||||||
|
representations like Integers.
|
||||||
|
|
||||||
|
The EDMX converter may be called as follows:
|
||||||
|
|
||||||
|
```
|
||||||
|
java -jar web-api-commander.jar --convertEDMXtoOAI --inputFile <i>
|
||||||
|
```
|
||||||
|
|
||||||
|
Any errors will be displayed, and the output file is automatically created by appending `.swagger.json` to
|
||||||
|
the given EDMX `inputFile` name.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Please contact [josh@reso.org](mailto:josh@reso.org) with any questions, bug reports, or feature requests.
|
||||||
|
|
||||||
|
**Coming Soon**: support for authentication options in addition to Bearer tokens.
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -0,0 +1,134 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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.reso</groupId>
|
||||||
|
<artifactId>web-api-commander</artifactId>
|
||||||
|
<contributors>
|
||||||
|
<contributor>
|
||||||
|
<name>Josh Darnell</name>
|
||||||
|
<email>josh@reso.org</email>
|
||||||
|
<organization>RESO</organization>
|
||||||
|
</contributor>
|
||||||
|
</contributors>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.0</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<!-- Build an executable JAR -->
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>3.1.1</version>
|
||||||
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<mainClass>org.reso.Main</mainClass>
|
||||||
|
</manifest>
|
||||||
|
</archive>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.olingo</groupId>
|
||||||
|
<artifactId>odata-commons-core</artifactId>
|
||||||
|
<version>4.5.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.olingo</groupId>
|
||||||
|
<artifactId>odata-client-core</artifactId>
|
||||||
|
<version>4.5.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.olingo</groupId>
|
||||||
|
<artifactId>odata-client-proxy</artifactId>
|
||||||
|
<version>4.5.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.olingo</groupId>
|
||||||
|
<artifactId>odata-server-api</artifactId>
|
||||||
|
<version>4.5.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.olingo</groupId>
|
||||||
|
<artifactId>odata-server-core</artifactId>
|
||||||
|
<version>4.5.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-cli</groupId>
|
||||||
|
<artifactId>commons-cli</artifactId>
|
||||||
|
<version>LATEST</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.pac4j</groupId>
|
||||||
|
<artifactId>pac4j-oidc</artifactId>
|
||||||
|
<version>3.6.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.pac4j</groupId>
|
||||||
|
<artifactId>pac4j-http</artifactId>
|
||||||
|
<version>3.6.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
|
<version>1.7.26</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<version>1.7.26</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-vfs2</artifactId>
|
||||||
|
<version>RELEASE</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>RELEASE</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-rs-security-oauth2</artifactId>
|
||||||
|
<version>3.1.7</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.apache.olingo/odata-commons-api -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.olingo</groupId>
|
||||||
|
<artifactId>odata-commons-api</artifactId>
|
||||||
|
<version>4.5.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,365 @@
|
||||||
|
package org.reso;
|
||||||
|
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.apache.olingo.client.api.ODataClient;
|
||||||
|
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.domain.ClientEntity;
|
||||||
|
import org.apache.olingo.client.api.domain.ClientEntitySet;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
|
||||||
|
import org.apache.olingo.client.api.uri.URIBuilder;
|
||||||
|
import org.apache.olingo.client.core.ODataClientFactory;
|
||||||
|
import org.apache.olingo.client.core.domain.ClientEntitySetImpl;
|
||||||
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
|
import org.apache.olingo.commons.api.format.ContentType;
|
||||||
|
import org.apache.olingo.commons.api.http.HttpStatusCode;
|
||||||
|
|
||||||
|
import javax.xml.transform.Source;
|
||||||
|
import javax.xml.transform.Transformer;
|
||||||
|
import javax.xml.transform.TransformerFactory;
|
||||||
|
import javax.xml.transform.stream.StreamResult;
|
||||||
|
import javax.xml.transform.stream.StreamSource;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Most of the work done by the WebAPI commander is done by this class. Its public methods are, therefore,
|
||||||
|
* the ones the Client programmer is expected to use.
|
||||||
|
*/
|
||||||
|
public class Commander {
|
||||||
|
private ODataClient client;
|
||||||
|
private String serviceRoot;
|
||||||
|
private String bearerToken;
|
||||||
|
private boolean useEdmEnabledClient;
|
||||||
|
|
||||||
|
private static final Logger log = Logger.getLogger(Commander.class);
|
||||||
|
|
||||||
|
public static int NOT_OK = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Commander instance that uses the given Bearer token for authentication and allows the Client
|
||||||
|
* to specify whether to use an EdmEnabledClient or normal OData client.
|
||||||
|
*
|
||||||
|
* NOTE: serviceRoot can sometimes be null, but is required if useEdmEnabledClient is true.
|
||||||
|
* A check has been added for this condition.
|
||||||
|
**
|
||||||
|
* @param serviceRoot the service root of the WebAPI server.
|
||||||
|
* @param bearerToken the bearer token to use to authenticate with the given serviceRoot.
|
||||||
|
* @param useEdmEnabledClient
|
||||||
|
*/
|
||||||
|
public Commander(String serviceRoot, String bearerToken, boolean useEdmEnabledClient) {
|
||||||
|
this(serviceRoot, useEdmEnabledClient);
|
||||||
|
this.bearerToken = bearerToken;
|
||||||
|
client.getConfiguration().setHttpClientFactory(new TokenHttpClientFactory(bearerToken));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private constructor for internal use.
|
||||||
|
*
|
||||||
|
* Creates a Commander instance that allows the caller to use an EdmEnabledClient,
|
||||||
|
* meaning that all payloads will be verified against the metadata published at serviceRoot.
|
||||||
|
* @param serviceRoot the service root of the WebAPI server.
|
||||||
|
*/
|
||||||
|
private Commander(String serviceRoot, boolean useEdmEnabledClient) {
|
||||||
|
this.useEdmEnabledClient = useEdmEnabledClient;
|
||||||
|
|
||||||
|
this.serviceRoot = serviceRoot;
|
||||||
|
log.debug("\nUsing EdmEnabledClient: " + useEdmEnabledClient);
|
||||||
|
if (useEdmEnabledClient) {
|
||||||
|
client = ODataClientFactory.getEdmEnabledClient(serviceRoot);
|
||||||
|
} else {
|
||||||
|
client = ODataClientFactory.getClient();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets server metadata in EDMX format.
|
||||||
|
*
|
||||||
|
* TODO: add optional validation upon fetch
|
||||||
|
*
|
||||||
|
* @return Edm representation of the server metadata.
|
||||||
|
*/
|
||||||
|
public Edm getMetadata(String outputFileName) {
|
||||||
|
XMLMetadataRequest request = client.getRetrieveRequestFactory().getXMLMetadataRequest(serviceRoot);
|
||||||
|
|
||||||
|
try {
|
||||||
|
log.info("Fetching Metadata from " + serviceRoot + "...");
|
||||||
|
byte[] buffer = IOUtils.toByteArray(request.rawExecute());
|
||||||
|
log.info("Transfer complete! Bytes received: " + buffer.length);
|
||||||
|
|
||||||
|
// copy response to given output file
|
||||||
|
FileUtils.writeByteArrayToFile(new File(outputFileName), buffer);
|
||||||
|
log.info("Wrote metadata to: " + outputFileName);
|
||||||
|
|
||||||
|
// read metadata from binary to ensure it deserializes properly and return
|
||||||
|
return client.getReader().readMetadata(new ByteArrayInputStream(buffer));
|
||||||
|
} catch (Exception ex) {
|
||||||
|
System.err.println(ex.toString());
|
||||||
|
System.exit(NOT_OK);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates given XMLMetadata
|
||||||
|
* @param metadata the XMLMetadata to be validated
|
||||||
|
* @return true if the metadata is valid, meaning that it's also a valid OData 4 Service Document
|
||||||
|
*/
|
||||||
|
public boolean validateMetadata(XMLMetadata metadata) {
|
||||||
|
try {
|
||||||
|
// call the probably-useless metadata validator. can't hurt though
|
||||||
|
// SEE: https://github.com/apache/olingo-odata4/blob/master/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataMetadataValidationImpl.java#L77-L116
|
||||||
|
client.metadataValidation().validateMetadata(metadata);
|
||||||
|
|
||||||
|
// also check whether metadata contains a valid service document in OData v4 format
|
||||||
|
return client.metadataValidation().isServiceDocument(metadata)
|
||||||
|
&& client.metadataValidation().isV4Metadata(metadata);
|
||||||
|
} catch (NullPointerException nex) {
|
||||||
|
log.error("ERROR: null pointer exception while trying to validate metadata. Validation failed!");
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("ERROR: " + ex.getMessage());
|
||||||
|
if (ex.getCause() != null) {
|
||||||
|
log.error("ERROR: " + ex.getCause().getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the given metadata contained in the given file path.
|
||||||
|
* @param pathToEdmx the path to look for metadata in. Assumes metadata is stored as XML.
|
||||||
|
* @return true if the metadata is valid and false otherwise.
|
||||||
|
*/
|
||||||
|
public boolean validateMetadata(String pathToEdmx) {
|
||||||
|
try {
|
||||||
|
// deserialize metadata from given file
|
||||||
|
XMLMetadata metadata =
|
||||||
|
client.getDeserializer(ContentType.APPLICATION_XML).toMetadata(new FileInputStream(pathToEdmx));
|
||||||
|
|
||||||
|
return validateMetadata(metadata);
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("ERROR: " + ex.getMessage() + "\n");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a client entity set using the given requestURI, but doesn't perform automatic paging
|
||||||
|
* in the way that readEntitySet does. If the Commander has been instantiated with an EdmEnabledClient,
|
||||||
|
* results will be validated against server metadata while being fetched.
|
||||||
|
*
|
||||||
|
* @param requestURI the full OData WebAPI URI used to fetch records. requestURI is expected to be URL Encoded.
|
||||||
|
* @return a ClientEntitySet containing the requested records, or null if nothing was found.
|
||||||
|
*/
|
||||||
|
public ClientEntitySet getEntitySet(URI requestURI) {
|
||||||
|
try {
|
||||||
|
ODataRetrieveResponse<ClientEntitySet> response
|
||||||
|
= client.getRetrieveRequestFactory().getEntitySetRequest(requestURI).execute();
|
||||||
|
|
||||||
|
if (response.getStatusCode() == HttpStatusCode.OK.getStatusCode()) {
|
||||||
|
return response.getBody();
|
||||||
|
} else {
|
||||||
|
log.error("ERROR:getEntitySet received a response status other than OK (200)!");
|
||||||
|
System.exit(NOT_OK);
|
||||||
|
}
|
||||||
|
} catch (IllegalArgumentException iaex) {
|
||||||
|
if (useEdmEnabledClient) {
|
||||||
|
log.error("\nError encountered while using the EdmEnabledClient. This usually means metadata were invalid!");
|
||||||
|
}
|
||||||
|
log.error(iaex.getMessage());
|
||||||
|
System.exit(NOT_OK);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex.toString());
|
||||||
|
System.exit(NOT_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes a get request on URI and saves raw response to outputFilePath.
|
||||||
|
* @param requestURI the URI to make the request against
|
||||||
|
* @param outputFilePath the outputFilePath to write the response to
|
||||||
|
*/
|
||||||
|
public void saveRawGetRequest(URI requestURI, String outputFilePath) {
|
||||||
|
try {
|
||||||
|
FileUtils.copyInputStreamToFile(
|
||||||
|
client.getRetrieveRequestFactory().getRawRequest(requestURI).rawExecute(), new File(outputFilePath));
|
||||||
|
|
||||||
|
log.info("Request complete... Response written to file: " + outputFilePath);
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("ERROR: exception occurred in writeRawResponse. " + ex.getMessage());
|
||||||
|
System.exit(NOT_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads entities from a given
|
||||||
|
* TODO: add a function that can write a page at a time.
|
||||||
|
* TODO: add a parallel function which can create n queries at a time and download their results
|
||||||
|
*
|
||||||
|
* @param resourceName the name of the resource.
|
||||||
|
* @param limit the limit for the number of records to read from the Server. Use -1 to fetch all.
|
||||||
|
* @return a ClientEntitySet containing any entities found.
|
||||||
|
*/
|
||||||
|
public ClientEntitySet readEntities(String resourceName, String filter, int limit) {
|
||||||
|
|
||||||
|
List<ClientEntity> result = new ArrayList<>();
|
||||||
|
ODataRetrieveResponse<ClientEntitySet> entitySetResponse = null;
|
||||||
|
ClientEntitySet results = new ClientEntitySetImpl();
|
||||||
|
|
||||||
|
try {
|
||||||
|
URIBuilder uriBuilder = client.newURIBuilder(serviceRoot).appendEntitySetSegment(resourceName);
|
||||||
|
|
||||||
|
//add filter if present
|
||||||
|
if (filter != null) {
|
||||||
|
uriBuilder.filter(filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
entitySetResponse = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).execute();
|
||||||
|
|
||||||
|
result.addAll(entitySetResponse.getBody().getEntities());
|
||||||
|
|
||||||
|
//some of the next links don't currently work, so we can't use getNext() reliably.
|
||||||
|
//we can, however, use the results of what we've downloaded previously to inform the skip.
|
||||||
|
uriBuilder.skip(result.size()).build();
|
||||||
|
|
||||||
|
} while (entitySetResponse.getBody().getNext() != null && (limit == -1 || result.size() < limit));
|
||||||
|
|
||||||
|
results.getEntities().addAll(result.subList(0, limit == -1 ? result.size() : Math.min(limit, result.size())));
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("ERROR: readEntities could not continue. " + ex.toString());
|
||||||
|
System.exit(NOT_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts metadata in EDMX format to metadata in Swagger 2.0 format.
|
||||||
|
* Converted file will have the same name as the input file, with .swagger.json appended to the name.
|
||||||
|
* @param pathToEDMX the metadata file to convert.
|
||||||
|
*/
|
||||||
|
public void convertMetadata(String pathToEDMX) {
|
||||||
|
try {
|
||||||
|
TransformerFactory factory = TransformerFactory.newInstance();
|
||||||
|
Source xslt = new StreamSource(new File("./V4-CSDL-to-OpenAPI.xslt"));
|
||||||
|
Transformer transformer = factory.newTransformer(xslt);
|
||||||
|
|
||||||
|
Source text = new StreamSource(new File(pathToEDMX));
|
||||||
|
transformer.transform(text, new StreamResult(new File(pathToEDMX + ".swagger.json")));
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("ERROR: convertMetadata failed. " + ex.toString());
|
||||||
|
System.exit(NOT_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes an Entity Set to the given outputFilePath.
|
||||||
|
* @param entitySet - the ClientEntitySet to serialize.
|
||||||
|
* @param outputFilePath - the path to write the file to.
|
||||||
|
* @param contentType - the OData content type to write with. Currently supported options are
|
||||||
|
* JSON, JSON_NO_METADATA, JSON_FULL_METADATA, and XML.
|
||||||
|
*/
|
||||||
|
public void serializeEntitySet(ClientEntitySet entitySet, String outputFilePath, ContentType contentType) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
log.info("Serializing " + entitySet.getEntities().size() + " item(s) to " + outputFilePath);
|
||||||
|
client.getSerializer(contentType).write(new FileWriter(outputFilePath), client.getBinder().getEntitySet(entitySet));
|
||||||
|
} catch (Exception ex) {
|
||||||
|
System.out.println(ex.getMessage());
|
||||||
|
System.exit(NOT_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the given entitySet to the given outputFilePath.
|
||||||
|
* Writes in JSON format.
|
||||||
|
*
|
||||||
|
* @param entitySet the ClientEntitySet to serialize.
|
||||||
|
* @param outputFilePath the outputFilePath used to write to.
|
||||||
|
*/
|
||||||
|
public void serializeEntitySet(ClientEntitySet entitySet, String outputFilePath) {
|
||||||
|
//JSON is the default format, though other formats like JSON_FULL_METADATA and XML are supported as well
|
||||||
|
serializeEntitySet(entitySet, outputFilePath, ContentType.JSON);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builder pattern implemented for creating Commander instances
|
||||||
|
*/
|
||||||
|
public static class Builder {
|
||||||
|
String serviceRoot;
|
||||||
|
String bearerToken;
|
||||||
|
boolean useEdmEnabledClient;
|
||||||
|
|
||||||
|
public Builder() {}
|
||||||
|
|
||||||
|
public Builder serviceRoot(String serviceRoot) {
|
||||||
|
this.serviceRoot = serviceRoot;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder bearerToken(String bearerToken) {
|
||||||
|
this.bearerToken = bearerToken;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder useEdmEnabledClient() {
|
||||||
|
this.useEdmEnabledClient = true;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder useEdmEnabledClient(boolean useEdmEnabledClient) {
|
||||||
|
this.useEdmEnabledClient = useEdmEnabledClient;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Commander build() {
|
||||||
|
return new Commander(serviceRoot, bearerToken, useEdmEnabledClient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translates supported string formats into those of ContentType.
|
||||||
|
*
|
||||||
|
* See: https://olingo.apache.org/javadoc/odata4/org/apache/olingo/commons/api/format/ContentType.html#TEXT_HTML
|
||||||
|
*
|
||||||
|
* @param contentType the string representation of the requested content type.
|
||||||
|
* @return one of ContentType if a match is found, or ContentType.JSON if no other format is available.
|
||||||
|
*/
|
||||||
|
public static ContentType getContentType(String contentType) {
|
||||||
|
String JSON = "JSON", JSON_NO_METADATA = "JSON_NO_METADATA", JSON_FULL_METADATA = "JSON_FULL_METADATA", XML = "XML";
|
||||||
|
ContentType defaultType = ContentType.JSON;
|
||||||
|
ContentType type;
|
||||||
|
|
||||||
|
if (contentType == null) {
|
||||||
|
return defaultType;
|
||||||
|
} else {
|
||||||
|
if (contentType.matches(JSON)) {
|
||||||
|
type = ContentType.JSON;
|
||||||
|
} else if (contentType.matches(JSON_NO_METADATA)) {
|
||||||
|
type = ContentType.JSON_NO_METADATA;
|
||||||
|
} else if (contentType.matches(JSON_FULL_METADATA)) {
|
||||||
|
type = ContentType.JSON_FULL_METADATA;
|
||||||
|
} else if (contentType.matches(XML)) {
|
||||||
|
type = ContentType.APPLICATION_XML;
|
||||||
|
} else {
|
||||||
|
type = ContentType.JSON;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,389 @@
|
||||||
|
package org.reso;
|
||||||
|
|
||||||
|
import org.apache.commons.cli.*;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.apache.olingo.client.api.domain.ClientEntitySet;
|
||||||
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
|
import org.apache.olingo.commons.api.format.ContentType;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entry point of the RESO Web API Commander, which is a command line OData client that uses the Java Olingo
|
||||||
|
* Client Library to handle OData and the Apache CXF library to handle Auth. Currently, the following forms
|
||||||
|
* of Auth are supported:
|
||||||
|
*
|
||||||
|
* - Bearer Tokens
|
||||||
|
*
|
||||||
|
* Exposes several different actions for working with OData-based WebAPI servers.
|
||||||
|
* This application is structured so that the Main class is an OData WebAPI consumer
|
||||||
|
* using the Commander class, which contains the actual methods for working with OData.
|
||||||
|
*
|
||||||
|
* For usage, see README.
|
||||||
|
*
|
||||||
|
* TODO: add better handling for required parameters, currently just checks if they're there and prints help if not
|
||||||
|
*/
|
||||||
|
public class Main {
|
||||||
|
|
||||||
|
private static final Logger log = Logger.getLogger(Main.class);
|
||||||
|
|
||||||
|
public static void main(String[] params) {
|
||||||
|
|
||||||
|
// create the command line parser
|
||||||
|
CommandLineParser parser = new DefaultParser();
|
||||||
|
Edm metadata;
|
||||||
|
Commander commander;
|
||||||
|
|
||||||
|
String serviceRoot, bearerToken;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// parse the command line arguments
|
||||||
|
CommandLine cmd = parser.parse(APP_OPTIONS.getOptions(), params);
|
||||||
|
|
||||||
|
serviceRoot = cmd.getOptionValue(APP_OPTIONS.SERVICE_ROOT, null);
|
||||||
|
|
||||||
|
// only bearer token support for now
|
||||||
|
// TODO: apache CXF for other forms of auth
|
||||||
|
bearerToken = cmd.getOptionValue(APP_OPTIONS.BEARER_TOKEN, null);
|
||||||
|
|
||||||
|
boolean useEdmEnabledClient = cmd.hasOption(APP_OPTIONS.USE_EDM_ENABLED_CLIENT);
|
||||||
|
|
||||||
|
// using the edmEnabledClient requires the serviceRoot for schema validation, which is performed
|
||||||
|
// against the payload each time the request is made when enabled.
|
||||||
|
if (useEdmEnabledClient && !cmd.hasOption(APP_OPTIONS.SERVICE_ROOT)) {
|
||||||
|
printErrorMsgAndExit("\nERROR: --" + APP_OPTIONS.SERVICE_ROOT
|
||||||
|
+ " is required with the --" + APP_OPTIONS.USE_EDM_ENABLED_CLIENT + " option!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// pre-load options for later use
|
||||||
|
String inputFile = cmd.getOptionValue(APP_OPTIONS.INPUT_FILE, null);
|
||||||
|
String outputFile = cmd.getOptionValue(APP_OPTIONS.OUTPUT_FILE, null);
|
||||||
|
String entityName = cmd.getOptionValue(APP_OPTIONS.ENTITY_NAME, null);
|
||||||
|
String uri = cmd.getOptionValue(APP_OPTIONS.URI, null);
|
||||||
|
String filter = cmd.getOptionValue(APP_OPTIONS.FILTER, null);
|
||||||
|
ContentType contentType = Commander.getContentType(cmd.getOptionValue(APP_OPTIONS.CONTENT_TYPE, null));
|
||||||
|
|
||||||
|
//pass -1 to get all pages, default is 10
|
||||||
|
int limit = Integer.parseInt(cmd.getOptionValue(APP_OPTIONS.LIMIT, "10"));
|
||||||
|
|
||||||
|
// create a new Web API Commander
|
||||||
|
commander = new Commander.Builder()
|
||||||
|
.serviceRoot(serviceRoot)
|
||||||
|
.bearerToken(bearerToken)
|
||||||
|
.useEdmEnabledClient(useEdmEnabledClient)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
if (cmd.hasOption(APP_OPTIONS.ACTIONS.GET_METADATA)) {
|
||||||
|
APP_OPTIONS.validateAction(cmd, APP_OPTIONS.ACTIONS.GET_METADATA);
|
||||||
|
|
||||||
|
log.info("\nGetting metadata from " + serviceRoot + "...");
|
||||||
|
metadata = commander.getMetadata(outputFile);
|
||||||
|
|
||||||
|
log.info("\nThe metadata contains the following items:");
|
||||||
|
prettyPrint(metadata);
|
||||||
|
|
||||||
|
log.info("\nChecking Metadata for validity...");
|
||||||
|
if (commander.validateMetadata(outputFile)) {
|
||||||
|
log.info("--> Valid Metadata!");
|
||||||
|
} else {
|
||||||
|
log.error("--> Invalid Metadata!");
|
||||||
|
System.exit(Commander.NOT_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (cmd.hasOption(APP_OPTIONS.ACTIONS.VALIDATE_METADATA)) {
|
||||||
|
APP_OPTIONS.validateAction(cmd, APP_OPTIONS.ACTIONS.VALIDATE_METADATA);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the metadata in inputFile in three ways:
|
||||||
|
* - deserializes it into a native Edm object, which will fail if given metadata isn't valid
|
||||||
|
* - verifies whether the given EDMX file is a valid service document
|
||||||
|
* - verifies whether the given EDMX file is in version 4 format
|
||||||
|
*/
|
||||||
|
if (commander.validateMetadata(inputFile)) {
|
||||||
|
log.info("Valid Metadata!");
|
||||||
|
} else {
|
||||||
|
log.error("ERROR: Invalid Metadata!\n");
|
||||||
|
System.exit(Commander.NOT_OK);
|
||||||
|
}
|
||||||
|
} else if (cmd.hasOption(APP_OPTIONS.ACTIONS.GET_ENTITY_SET)) {
|
||||||
|
APP_OPTIONS.validateAction(cmd, APP_OPTIONS.ACTIONS.GET_ENTITY_SET);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a ClientEntitySet from the given uri. If the useEdmEnabledClient option was passed,
|
||||||
|
* then serviceRoot is required, and results fetched from uri are validated against the server's
|
||||||
|
* published metadata.
|
||||||
|
*
|
||||||
|
* Results are written to outputFile.
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
ClientEntitySet results = commander.getEntitySet(URI.create(uri));
|
||||||
|
|
||||||
|
if (results != null) {
|
||||||
|
commander.serializeEntitySet(results, outputFile, contentType);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
System.exit(Commander.NOT_OK);
|
||||||
|
log.error(ex.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (cmd.hasOption(APP_OPTIONS.ACTIONS.READ_ENTITIES)) {
|
||||||
|
APP_OPTIONS.validateAction(cmd, APP_OPTIONS.ACTIONS.READ_ENTITIES);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read entities up to limit number of records and writes the results to outputFile.
|
||||||
|
* Optionally takes a filter to be used with the query.
|
||||||
|
*
|
||||||
|
* @see Commander.readEntities()
|
||||||
|
*/
|
||||||
|
|
||||||
|
//NOTE: pass -1 to get all entities
|
||||||
|
log.info("Reading entities for the given resource: " + entityName);
|
||||||
|
ClientEntitySet entities = commander.readEntities(entityName, filter, limit);
|
||||||
|
|
||||||
|
log.info(entities.getCount() + " entities fetched: ");
|
||||||
|
entities.getEntities().stream().forEach(entity -> log.info(entity.toString()));
|
||||||
|
|
||||||
|
log.info("Saving to file: " + outputFile);
|
||||||
|
commander.serializeEntitySet(entities, outputFile, contentType);
|
||||||
|
|
||||||
|
} else if (cmd.hasOption(APP_OPTIONS.ACTIONS.SAVE_RAW_GET_REQUEST)) {
|
||||||
|
APP_OPTIONS.validateAction(cmd, APP_OPTIONS.ACTIONS.SAVE_RAW_GET_REQUEST);
|
||||||
|
|
||||||
|
commander.saveRawGetRequest(URI.create(uri), outputFile);
|
||||||
|
|
||||||
|
} else if (cmd.hasOption(APP_OPTIONS.ACTIONS.CONVERT_EDMX_TO_OAI)) {
|
||||||
|
APP_OPTIONS.validateAction(cmd, APP_OPTIONS.ACTIONS.CONVERT_EDMX_TO_OAI);
|
||||||
|
|
||||||
|
//converts metadata in input source file to output file
|
||||||
|
commander.convertMetadata(inputFile);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
printHelp(APP_OPTIONS.getOptions());
|
||||||
|
}
|
||||||
|
} catch (ParseException exp) {
|
||||||
|
log.error("\nERROR: Parse Exception, Commander cannot continue! " + exp.getMessage());
|
||||||
|
System.exit(Commander.NOT_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints an error message and the help for the application, then exits with 1.
|
||||||
|
* @param msg the message to print
|
||||||
|
*/
|
||||||
|
private static void printErrorMsgAndExit(String msg) {
|
||||||
|
log.error("\n\n" + msg + "\n");
|
||||||
|
printHelp(APP_OPTIONS.getOptions());
|
||||||
|
System.exit(Commander.NOT_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints help
|
||||||
|
* @param options the options to print help for.
|
||||||
|
*/
|
||||||
|
private static void printHelp(Options options) {
|
||||||
|
new HelpFormatter().printHelp("java -jar web-api-commander", options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Metadata Pretty Printer
|
||||||
|
*
|
||||||
|
* @param metadata any metadata in Edm format
|
||||||
|
*/
|
||||||
|
private static void prettyPrint(Edm metadata) {
|
||||||
|
|
||||||
|
//Note: other treatments may be added to this summary info
|
||||||
|
metadata.getSchemas().stream().forEach(schema -> {
|
||||||
|
log.info("\nNamespace: " + schema.getNamespace());
|
||||||
|
log.info("=============================================================");
|
||||||
|
|
||||||
|
schema.getTypeDefinitions().stream().forEach(a ->
|
||||||
|
log.info("\tType Definition:" + a.getFullQualifiedName().getFullQualifiedNameAsString()));
|
||||||
|
|
||||||
|
schema.getEnumTypes().stream().forEach(a ->
|
||||||
|
log.info("\tEnum Type: " + a.getFullQualifiedName().getFullQualifiedNameAsString()));
|
||||||
|
|
||||||
|
schema.getEntityTypes().stream().forEach(a ->
|
||||||
|
log.info("\tEntity Type: " + a.getFullQualifiedName().getFullQualifiedNameAsString()));
|
||||||
|
|
||||||
|
schema.getComplexTypes().stream().forEach(a ->
|
||||||
|
log.info("\tComplex Entity Type: " + a.getFullQualifiedName().getFullQualifiedNameAsString()));
|
||||||
|
|
||||||
|
schema.getAnnotationGroups().stream().forEach(a ->
|
||||||
|
log.info("\tAnnotations: " + a.getQualifier() + ", Target Path: " + a.getTargetPath()));
|
||||||
|
|
||||||
|
schema.getTerms().stream().forEach(a ->
|
||||||
|
log.info(a.getFullQualifiedName().getFullQualifiedNameAsString()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helps with various app options used by the main application when processing input from the command line.
|
||||||
|
*/
|
||||||
|
private static class APP_OPTIONS {
|
||||||
|
|
||||||
|
//parameter names
|
||||||
|
public static String SERVICE_ROOT = "serviceRoot";
|
||||||
|
public static String BEARER_TOKEN = "bearerToken";
|
||||||
|
public static String INPUT_FILE = "inputFile";
|
||||||
|
public static String OUTPUT_FILE = "outputFile";
|
||||||
|
public static String URI = "uri";
|
||||||
|
public static String LIMIT = "limit";
|
||||||
|
public static String ENTITY_NAME = "entityName";
|
||||||
|
public static String USE_EDM_ENABLED_CLIENT = "useEdmEnabledClient";
|
||||||
|
public static String FILTER = "filter";
|
||||||
|
public static String CONTENT_TYPE = "contentType";
|
||||||
|
public static String HELP = "help";
|
||||||
|
|
||||||
|
public static class ACTIONS {
|
||||||
|
//actions
|
||||||
|
public static String GET_METADATA = "getMetadata";
|
||||||
|
public static String VALIDATE_METADATA = "validateMetadata";
|
||||||
|
public static String GET_ENTITY_SET = "getEntitySet";
|
||||||
|
public static String READ_ENTITIES = "readEntities";
|
||||||
|
public static String SAVE_RAW_GET_REQUEST = "saveRawGetRequest";
|
||||||
|
public static String CONVERT_EDMX_TO_OAI = "convertEDMXtoOAI";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates options for the various actions exposed in Main.
|
||||||
|
*
|
||||||
|
* TODO: determine if there's a way this can be handled using Commons Command.
|
||||||
|
*
|
||||||
|
* @param cmd a reference to the current Command instance
|
||||||
|
* @param action one of APP_OPTIONS.ACTIONS, representing the action to be performed
|
||||||
|
*
|
||||||
|
* If the given action doesn't validate, then an error message will be printed and the application will exit.
|
||||||
|
*/
|
||||||
|
public static void validateAction(CommandLine cmd, String action) {
|
||||||
|
String validationResponse = null;
|
||||||
|
|
||||||
|
if (action.matches(ACTIONS.GET_METADATA)) {
|
||||||
|
validationResponse = validateOptions(cmd, SERVICE_ROOT, BEARER_TOKEN, OUTPUT_FILE);
|
||||||
|
} else if (action.matches(ACTIONS.VALIDATE_METADATA)) {
|
||||||
|
validationResponse = validateOptions(cmd, INPUT_FILE);
|
||||||
|
} else if (action.matches(ACTIONS.GET_ENTITY_SET)) {
|
||||||
|
validationResponse = validateOptions(cmd, BEARER_TOKEN, URI, OUTPUT_FILE);
|
||||||
|
} else if (action.matches(ACTIONS.READ_ENTITIES)) {
|
||||||
|
validationResponse = validateOptions(cmd, SERVICE_ROOT, BEARER_TOKEN, ENTITY_NAME, LIMIT, OUTPUT_FILE);
|
||||||
|
} else if (action.matches(ACTIONS.SAVE_RAW_GET_REQUEST)) {
|
||||||
|
validationResponse = validateOptions(cmd, SERVICE_ROOT, BEARER_TOKEN, URI, OUTPUT_FILE);
|
||||||
|
} else if (action.matches(ACTIONS.CONVERT_EDMX_TO_OAI)) {
|
||||||
|
validationResponse = validateOptions(cmd, INPUT_FILE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (validationResponse != null) {
|
||||||
|
printErrorMsgAndExit("ERROR: the following options are required when using " + APP_OPTIONS.ACTIONS.GET_METADATA
|
||||||
|
+ "\n" + validationResponse + "\n\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates options passed to the command line
|
||||||
|
* @param cmd a reference to the command line instance
|
||||||
|
* @param options a list of options to validate
|
||||||
|
* @return an error string containing a formatted message when validation fails, otherwise null (valid)
|
||||||
|
*/
|
||||||
|
private static String validateOptions(CommandLine cmd, String... options) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
Arrays.stream(options).forEach(option -> {
|
||||||
|
if (!cmd.hasOption(option)) {
|
||||||
|
sb.append("\t --");
|
||||||
|
sb.append(option);
|
||||||
|
sb.append(" is required!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return sb.length() == 0 ? null : sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the set of supported application options.
|
||||||
|
* @return the options to be used within the application.
|
||||||
|
*/
|
||||||
|
public static Options getOptions() {
|
||||||
|
// create Options
|
||||||
|
Option hostNameOption = Option.builder()
|
||||||
|
.argName("s").longOpt(SERVICE_ROOT).hasArg()
|
||||||
|
.desc("Service root URL on the host.")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Option bearerTokenOption = Option.builder()
|
||||||
|
.argName("b").longOpt(BEARER_TOKEN).hasArg()
|
||||||
|
.desc("Bearer token to be used with the request.")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Option inputFileOption = Option.builder()
|
||||||
|
.argName("i").longOpt(INPUT_FILE).hasArg()
|
||||||
|
.desc("Path to input file.")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Option outputFileOption = Option.builder()
|
||||||
|
.argName("o").longOpt(OUTPUT_FILE).hasArg()
|
||||||
|
.desc("Path to output file.")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Option uriOption = Option.builder()
|
||||||
|
.argName("u").longOpt(URI).hasArg()
|
||||||
|
.desc("URI for raw request.")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Option filterOption = Option.builder()
|
||||||
|
.argName("f").longOpt(FILTER).hasArg()
|
||||||
|
.desc("If <filter> is passed, then readEntities will use it.")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Option limit = Option.builder()
|
||||||
|
.argName("l").longOpt(LIMIT).hasArg()
|
||||||
|
.desc("The number of records to fetch, or -1 to fetch all.")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Option entityName = Option.builder()
|
||||||
|
.argName("n").longOpt(ENTITY_NAME).hasArg()
|
||||||
|
.desc("The name of the entity to fetch, e.g. Property.")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Option contentType = Option.builder()
|
||||||
|
.argName("t").longOpt(CONTENT_TYPE).hasArg()
|
||||||
|
.desc("Results format: JSON (default), JSON_NO_METADATA, JSON_FULL_METADATA, XML.")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Option useEdmEnabledClient = Option.builder()
|
||||||
|
.argName("e").longOpt(USE_EDM_ENABLED_CLIENT)
|
||||||
|
.desc("present if an EdmEnabledClient should be used.")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Option helpOption = Option.builder()
|
||||||
|
.argName("?").longOpt(HELP).hasArg(false)
|
||||||
|
.desc("print help")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
OptionGroup actions = new OptionGroup()
|
||||||
|
.addOption(Option.builder().argName("m").longOpt(ACTIONS.GET_METADATA)
|
||||||
|
.desc("fetches metadata from <serviceRoot> using <bearerToken> and saves results in <outputFile>.").build())
|
||||||
|
.addOption(Option.builder().argName("r").longOpt(ACTIONS.READ_ENTITIES)
|
||||||
|
.desc("reads <entityName> from <serviceRoot> using <bearerToken> and saves results in <outputFile>.").build())
|
||||||
|
.addOption(Option.builder().argName("g").longOpt(ACTIONS.GET_ENTITY_SET)
|
||||||
|
.desc("executes GET on <uri> using the given <serviceRoot> and <bearerToken>.").build())
|
||||||
|
.addOption(Option.builder().argName("v").longOpt(ACTIONS.VALIDATE_METADATA)
|
||||||
|
.desc("validates previously-fetched metadata in the <inputFile> path.").build())
|
||||||
|
.addOption(Option.builder().argName("w").longOpt(ACTIONS.SAVE_RAW_GET_REQUEST)
|
||||||
|
.desc("performs GET from <requestURI> using the given <bearerToken> and saves output to <outputFile>.").build())
|
||||||
|
.addOption(Option.builder().argName("c").longOpt(ACTIONS.CONVERT_EDMX_TO_OAI)
|
||||||
|
.desc("converts EDMX in <inputFile> to OAI, saving it in <inputFile>.swagger.json").build());
|
||||||
|
|
||||||
|
return new Options()
|
||||||
|
.addOption(helpOption)
|
||||||
|
.addOption(hostNameOption)
|
||||||
|
.addOption(bearerTokenOption)
|
||||||
|
.addOption(inputFileOption)
|
||||||
|
.addOption(outputFileOption)
|
||||||
|
.addOption(limit)
|
||||||
|
.addOption(entityName)
|
||||||
|
.addOption(useEdmEnabledClient)
|
||||||
|
.addOption(uriOption)
|
||||||
|
.addOption(filterOption)
|
||||||
|
.addOption(contentType)
|
||||||
|
.addOptionGroup(actions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package org.reso;
|
||||||
|
|
||||||
|
import org.apache.http.client.HttpClient;
|
||||||
|
import org.apache.http.impl.client.DefaultHttpClient;
|
||||||
|
import org.apache.http.params.CoreProtocolPNames;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.apache.olingo.client.core.http.DefaultHttpClientFactory;
|
||||||
|
import org.apache.olingo.commons.api.http.HttpMethod;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
public class TokenHttpClientFactory extends DefaultHttpClientFactory {
|
||||||
|
String token;
|
||||||
|
|
||||||
|
private static final Logger log = Logger.getLogger(TokenHttpClientFactory.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for use with tokens.
|
||||||
|
* @param token the token to be used for server requests.
|
||||||
|
*/
|
||||||
|
public TokenHttpClientFactory(String token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DefaultHttpClient create(final HttpMethod method, final URI uri) {
|
||||||
|
final DefaultHttpClient client = new DefaultHttpClient();
|
||||||
|
client.getParams().setParameter(CoreProtocolPNames.USER_AGENT, USER_AGENT);
|
||||||
|
|
||||||
|
// add auth token using the vendor's bearer token
|
||||||
|
client.addRequestInterceptor((request, context) ->
|
||||||
|
request.addHeader("Authorization", "Bearer " + token));
|
||||||
|
|
||||||
|
return client;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close(final HttpClient httpClient) {
|
||||||
|
try {
|
||||||
|
httpClient.getConnectionManager().shutdown();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
Manifest-Version: 1.0
|
||||||
|
Main-Class: org.reso.Main
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
log4j.rootLogger = ALL, Console
|
||||||
|
log4j.appender.Console=org.apache.log4j.ConsoleAppender
|
||||||
|
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.Console.layout.conversionPattern=%m%n
|
|
@ -0,0 +1,683 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project name="web-api-commander" default="all">
|
||||||
|
|
||||||
|
|
||||||
|
<property file="web-api-commander.properties"/>
|
||||||
|
<!-- Uncomment the following property if no tests compilation is needed -->
|
||||||
|
<!--
|
||||||
|
<property name="skip.tests" value="true"/>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- Compiler options -->
|
||||||
|
|
||||||
|
<property name="compiler.debug" value="on"/>
|
||||||
|
<property name="compiler.generate.no.warnings" value="off"/>
|
||||||
|
<property name="compiler.args" value=""/>
|
||||||
|
<property name="compiler.max.memory" value="700m"/>
|
||||||
|
<patternset id="ignored.files">
|
||||||
|
<exclude name="**/*.hprof/**"/>
|
||||||
|
<exclude name="**/*.pyc/**"/>
|
||||||
|
<exclude name="**/*.pyo/**"/>
|
||||||
|
<exclude name="**/*.rbc/**"/>
|
||||||
|
<exclude name="**/*.yarb/**"/>
|
||||||
|
<exclude name="**/*~/**"/>
|
||||||
|
<exclude name="**/.DS_Store/**"/>
|
||||||
|
<exclude name="**/.git/**"/>
|
||||||
|
<exclude name="**/.hg/**"/>
|
||||||
|
<exclude name="**/.svn/**"/>
|
||||||
|
<exclude name="**/CVS/**"/>
|
||||||
|
<exclude name="**/__pycache__/**"/>
|
||||||
|
<exclude name="**/_svn/**"/>
|
||||||
|
<exclude name="**/vssver.scc/**"/>
|
||||||
|
<exclude name="**/vssver2.scc/**"/>
|
||||||
|
</patternset>
|
||||||
|
<patternset id="library.patterns">
|
||||||
|
<include name="*.war"/>
|
||||||
|
<include name="*.swc"/>
|
||||||
|
<include name="*.zip"/>
|
||||||
|
<include name="*.egg"/>
|
||||||
|
<include name="*.ane"/>
|
||||||
|
<include name="*.jar"/>
|
||||||
|
<include name="*.ear"/>
|
||||||
|
<include name="*.klib"/>
|
||||||
|
</patternset>
|
||||||
|
<patternset id="compiler.resources">
|
||||||
|
<exclude name="**/?*.java"/>
|
||||||
|
<exclude name="**/?*.form"/>
|
||||||
|
<exclude name="**/?*.class"/>
|
||||||
|
<exclude name="**/?*.groovy"/>
|
||||||
|
<exclude name="**/?*.scala"/>
|
||||||
|
<exclude name="**/?*.flex"/>
|
||||||
|
<exclude name="**/?*.kt"/>
|
||||||
|
<exclude name="**/?*.clj"/>
|
||||||
|
<exclude name="**/?*.aj"/>
|
||||||
|
</patternset>
|
||||||
|
|
||||||
|
<!-- JDK definitions -->
|
||||||
|
|
||||||
|
<property name="jdk.bin.1.8" value="${jdk.home.1.8}/bin"/>
|
||||||
|
<path id="jdk.classpath.1.8">
|
||||||
|
<fileset dir="${jdk.home.1.8}">
|
||||||
|
<include name="../java-1.8.0-openjdk-amd64/jre/lib/charsets.jar"/>
|
||||||
|
<include name="../java-1.8.0-openjdk-amd64/jre/lib/ext/cldrdata.jar"/>
|
||||||
|
<include name="../java-1.8.0-openjdk-amd64/jre/lib/ext/dnsns.jar"/>
|
||||||
|
<include name="../java-1.8.0-openjdk-amd64/jre/lib/ext/icedtea-sound.jar"/>
|
||||||
|
<include name="../java-1.8.0-openjdk-amd64/jre/lib/ext/jaccess.jar"/>
|
||||||
|
<include name="../java-1.8.0-openjdk-amd64/jre/lib/ext/java-atk-wrapper.jar"/>
|
||||||
|
<include name="../java-1.8.0-openjdk-amd64/jre/lib/ext/localedata.jar"/>
|
||||||
|
<include name="../java-1.8.0-openjdk-amd64/jre/lib/ext/nashorn.jar"/>
|
||||||
|
<include name="../java-1.8.0-openjdk-amd64/jre/lib/ext/sunec.jar"/>
|
||||||
|
<include name="../java-1.8.0-openjdk-amd64/jre/lib/ext/sunjce_provider.jar"/>
|
||||||
|
<include name="../java-1.8.0-openjdk-amd64/jre/lib/ext/sunpkcs11.jar"/>
|
||||||
|
<include name="../java-1.8.0-openjdk-amd64/jre/lib/ext/zipfs.jar"/>
|
||||||
|
<include name="../java-1.8.0-openjdk-amd64/jre/lib/jce.jar"/>
|
||||||
|
<include name="../java-1.8.0-openjdk-amd64/jre/lib/jsse.jar"/>
|
||||||
|
<include name="../java-1.8.0-openjdk-amd64/jre/lib/management-agent.jar"/>
|
||||||
|
<include name="../java-1.8.0-openjdk-amd64/jre/lib/resources.jar"/>
|
||||||
|
<include name="../java-1.8.0-openjdk-amd64/jre/lib/rt.jar"/>
|
||||||
|
</fileset>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<property name="project.jdk.home" value="${jdk.home.1.8}"/>
|
||||||
|
<property name="project.jdk.bin" value="${jdk.bin.1.8}"/>
|
||||||
|
<property name="project.jdk.classpath" value="jdk.classpath.1.8"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Project Libraries -->
|
||||||
|
|
||||||
|
<path id="library.maven:_com.fasterxml.jackson.core:jackson-annotations:2.7.8.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/com/fasterxml/jackson/core/jackson-annotations/2.7.8/jackson-annotations-2.7.8.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_com.fasterxml.jackson.core:jackson-core:2.7.8.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/com/fasterxml/jackson/core/jackson-core/2.7.8/jackson-core-2.7.8.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_com.fasterxml.jackson.core:jackson-databind:2.7.8.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/com/fasterxml/jackson/core/jackson-databind/2.7.8/jackson-databind-2.7.8.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.7.8.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/com/fasterxml/jackson/dataformat/jackson-dataformat-xml/2.7.8/jackson-dataformat-xml-2.7.8.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.7.8.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.7.8/jackson-module-jaxb-annotations-2.7.8.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_com.fasterxml:aalto-xml:0.9.10.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/com/fasterxml/aalto-xml/0.9.10/aalto-xml-0.9.10.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_com.github.stephenc.jcip:jcip-annotations:1.0-1.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/com/github/stephenc/jcip/jcip-annotations/1.0-1/jcip-annotations-1.0-1.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_com.nimbusds:lang-tag:1.4.4.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/com/nimbusds/lang-tag/1.4.4/lang-tag-1.4.4.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_com.nimbusds:nimbus-jose-jwt:6.0.2.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/com/nimbusds/nimbus-jose-jwt/6.0.2/nimbus-jose-jwt-6.0.2.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_com.nimbusds:oauth2-oidc-sdk:6.5.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/com/nimbusds/oauth2-oidc-sdk/6.5/oauth2-oidc-sdk-6.5.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_com.sun.mail:javax.mail:1.6.1.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/com/sun/mail/javax.mail/1.6.1/javax.mail-1.6.1.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_commons-cli:commons-cli:1.4.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/commons-cli/commons-cli/1.4/commons-cli-1.4.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_commons-codec:commons-codec:1.9.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/commons-codec/commons-codec/1.9/commons-codec-1.9.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_commons-io:commons-io:2.4.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/commons-io/commons-io/2.4/commons-io-2.4.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_commons-logging:commons-logging:1.2.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/commons-logging/commons-logging/1.2/commons-logging-1.2.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_io.netty:netty-all:4.1.16.final.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/io/netty/netty-all/4.1.16.Final/netty-all-4.1.16.Final.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_javax.activation:activation:1.1.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/javax/activation/activation/1.1/activation-1.1.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_javax.annotation:javax.annotation-api:1.2.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_javax.ws.rs:javax.ws.rs-api:2.0.1.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/javax/ws/rs/javax.ws.rs-api/2.0.1/javax.ws.rs-api-2.0.1.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_junit:junit:4.13-beta-2.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/junit/junit/4.13-beta-2/junit-4.13-beta-2.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_log4j:log4j:1.2.17.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/log4j/log4j/1.2.17/log4j-1.2.17.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_net.bytebuddy:byte-buddy-agent:1.7.9.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/net/bytebuddy/byte-buddy-agent/1.7.9/byte-buddy-agent-1.7.9.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_net.bytebuddy:byte-buddy:1.7.9.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/net/bytebuddy/byte-buddy/1.7.9/byte-buddy-1.7.9.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_net.minidev:accessors-smart:1.2.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/net/minidev/accessors-smart/1.2/accessors-smart-1.2.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_net.minidev:json-smart:2.3.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/net/minidev/json-smart/2.3/json-smart-2.3.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.commons:commons-lang3:3.3.2.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.commons:commons-vfs2:2.3.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/commons/commons-vfs2/2.3/commons-vfs2-2.3.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.cxf:cxf-core:3.1.7.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/cxf/cxf-core/3.1.7/cxf-core-3.1.7.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.cxf:cxf-rt-frontend-jaxrs:3.1.7.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/cxf/cxf-rt-frontend-jaxrs/3.1.7/cxf-rt-frontend-jaxrs-3.1.7.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.cxf:cxf-rt-rs-client:3.1.7.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/cxf/cxf-rt-rs-client/3.1.7/cxf-rt-rs-client-3.1.7.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.cxf:cxf-rt-rs-json-basic:3.1.7.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/cxf/cxf-rt-rs-json-basic/3.1.7/cxf-rt-rs-json-basic-3.1.7.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.cxf:cxf-rt-rs-security-jose-jaxrs:3.1.7.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/cxf/cxf-rt-rs-security-jose-jaxrs/3.1.7/cxf-rt-rs-security-jose-jaxrs-3.1.7.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.cxf:cxf-rt-rs-security-jose:3.1.7.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/cxf/cxf-rt-rs-security-jose/3.1.7/cxf-rt-rs-security-jose-3.1.7.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.cxf:cxf-rt-rs-security-oauth2:3.1.7.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/cxf/cxf-rt-rs-security-oauth2/3.1.7/cxf-rt-rs-security-oauth2-3.1.7.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.cxf:cxf-rt-security:3.1.7.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/cxf/cxf-rt-security/3.1.7/cxf-rt-security-3.1.7.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.cxf:cxf-rt-transports-http:3.1.7.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/cxf/cxf-rt-transports-http/3.1.7/cxf-rt-transports-http-3.1.7.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.httpcomponents:httpclient:4.2.6.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/httpcomponents/httpclient/4.2.6/httpclient-4.2.6.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.httpcomponents:httpcore:4.2.5.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/httpcomponents/httpcore/4.2.5/httpcore-4.2.5.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.olingo:odata-client-api:4.5.0.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/olingo/odata-client-api/4.5.0/odata-client-api-4.5.0.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.olingo:odata-client-core:4.5.0.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/olingo/odata-client-core/4.5.0/odata-client-core-4.5.0.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.olingo:odata-client-proxy:4.5.0.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/olingo/odata-client-proxy/4.5.0/odata-client-proxy-4.5.0.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.olingo:odata-commons-api:4.5.0.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/olingo/odata-commons-api/4.5.0/odata-commons-api-4.5.0.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.olingo:odata-commons-core:4.5.0.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/olingo/odata-commons-core/4.5.0/odata-commons-core-4.5.0.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.olingo:odata-server-api:4.5.0.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/olingo/odata-server-api/4.5.0/odata-server-api-4.5.0.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.olingo:odata-server-core:4.5.0.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/olingo/odata-server-core/4.5.0/odata-server-core-4.5.0.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.apache.ws.xmlschema:xmlschema-core:2.2.1.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/apache/ws/xmlschema/xmlschema-core/2.2.1/xmlschema-core-2.2.1.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.codehaus.woodstox:stax2-api:3.1.4.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/codehaus/woodstox/stax2-api/3.1.4/stax2-api-3.1.4.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.codehaus.woodstox:woodstox-core-asl:4.4.1.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/codehaus/woodstox/woodstox-core-asl/4.4.1/woodstox-core-asl-4.4.1.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.hamcrest:hamcrest-core:1.3.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.mockito:mockito-core:2.13.0.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/mockito/mockito-core/2.13.0/mockito-core-2.13.0.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.objenesis:objenesis:2.6.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/objenesis/objenesis/2.6/objenesis-2.6.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.ow2.asm:asm:5.0.4.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/ow2/asm/asm/5.0.4/asm-5.0.4.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.pac4j:pac4j-core:3.6.1.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/pac4j/pac4j-core/3.6.1/pac4j-core-3.6.1.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.pac4j:pac4j-http:3.6.1.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/pac4j/pac4j-http/3.6.1/pac4j-http-3.6.1.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.pac4j:pac4j-oidc:3.6.1.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/pac4j/pac4j-oidc/3.6.1/pac4j-oidc-3.6.1.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.slf4j:slf4j-api:1.7.26.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="library.maven:_org.slf4j:slf4j-log4j12:1.7.26.classpath">
|
||||||
|
<pathelement location="${path.variable.maven_repository}/org/slf4j/slf4j-log4j12/1.7.26/slf4j-log4j12-1.7.26.jar"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Global Libraries -->
|
||||||
|
<!-- Register Custom Compiler Taskdefs -->
|
||||||
|
<property name="javac2.home" value="${idea.home}/lib"/>
|
||||||
|
<path id="javac2.classpath">
|
||||||
|
<fileset dir="${javac2.home}">
|
||||||
|
<include name="javac2.jar"/>
|
||||||
|
<include name="jdom.jar"/>
|
||||||
|
<include name="asm-all*.jar"/>
|
||||||
|
<include name="forms-*.jar"/>
|
||||||
|
</fileset>
|
||||||
|
</path>
|
||||||
|
<target name="register.custom.compilers">
|
||||||
|
<taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="javac2.classpath"/>
|
||||||
|
<taskdef name="instrumentIdeaExtensions" classname="com.intellij.ant.InstrumentIdeaExtensions" classpathref="javac2.classpath"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- Modules -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Module web-api-commander -->
|
||||||
|
|
||||||
|
<dirname property="module.web-api-commander.basedir" file="${ant.file}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<property name="module.jdk.home.web-api-commander" value="${project.jdk.home}"/>
|
||||||
|
<property name="module.jdk.bin.web-api-commander" value="${project.jdk.bin}"/>
|
||||||
|
<property name="module.jdk.classpath.web-api-commander" value="${project.jdk.classpath}"/>
|
||||||
|
|
||||||
|
<property name="compiler.args.web-api-commander" value="-encoding UTF-8 -source 8 -target 1.8 ${compiler.args}"/>
|
||||||
|
|
||||||
|
<property name="web-api-commander.output.dir" value="${module.web-api-commander.basedir}/target/classes"/>
|
||||||
|
<property name="web-api-commander.testoutput.dir" value="${module.web-api-commander.basedir}/target/test-classes"/>
|
||||||
|
|
||||||
|
<path id="web-api-commander.module.bootclasspath">
|
||||||
|
<!-- Paths to be included in compilation bootclasspath -->
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="web-api-commander.module.production.classpath">
|
||||||
|
<path refid="${module.jdk.classpath.web-api-commander}"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-commons-core:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_commons-codec:commons-codec:1.9.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-client-core:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-client-api:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_commons-io:commons-io:2.4.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.httpcomponents:httpclient:4.2.6.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.httpcomponents:httpcore:4.2.5.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.core:jackson-core:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.core:jackson-databind:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.core:jackson-annotations:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_org.codehaus.woodstox:stax2-api:3.1.4.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml:aalto-xml:0.9.10.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-client-proxy:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.commons:commons-lang3:3.3.2.classpath"/>
|
||||||
|
<path refid="library.maven:_commons-logging:commons-logging:1.2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-server-api:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_io.netty:netty-all:4.1.16.final.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-server-core:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_commons-cli:commons-cli:1.4.classpath"/>
|
||||||
|
<path refid="library.maven:_org.pac4j:pac4j-oidc:3.6.1.classpath"/>
|
||||||
|
<path refid="library.maven:_org.pac4j:pac4j-core:3.6.1.classpath"/>
|
||||||
|
<path refid="library.maven:_com.nimbusds:oauth2-oidc-sdk:6.5.classpath"/>
|
||||||
|
<path refid="library.maven:_com.sun.mail:javax.mail:1.6.1.classpath"/>
|
||||||
|
<path refid="library.maven:_javax.activation:activation:1.1.classpath"/>
|
||||||
|
<path refid="library.maven:_com.github.stephenc.jcip:jcip-annotations:1.0-1.classpath"/>
|
||||||
|
<path refid="library.maven:_net.minidev:json-smart:2.3.classpath"/>
|
||||||
|
<path refid="library.maven:_net.minidev:accessors-smart:1.2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.ow2.asm:asm:5.0.4.classpath"/>
|
||||||
|
<path refid="library.maven:_com.nimbusds:lang-tag:1.4.4.classpath"/>
|
||||||
|
<path refid="library.maven:_com.nimbusds:nimbus-jose-jwt:6.0.2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.mockito:mockito-core:2.13.0.classpath"/>
|
||||||
|
<path refid="library.maven:_net.bytebuddy:byte-buddy:1.7.9.classpath"/>
|
||||||
|
<path refid="library.maven:_net.bytebuddy:byte-buddy-agent:1.7.9.classpath"/>
|
||||||
|
<path refid="library.maven:_org.objenesis:objenesis:2.6.classpath"/>
|
||||||
|
<path refid="library.maven:_org.pac4j:pac4j-http:3.6.1.classpath"/>
|
||||||
|
<path refid="library.maven:_org.slf4j:slf4j-log4j12:1.7.26.classpath"/>
|
||||||
|
<path refid="library.maven:_log4j:log4j:1.2.17.classpath"/>
|
||||||
|
<path refid="library.maven:_org.slf4j:slf4j-api:1.7.26.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.commons:commons-vfs2:2.3.classpath"/>
|
||||||
|
<path refid="library.maven:_junit:junit:4.13-beta-2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.hamcrest:hamcrest-core:1.3.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-security-oauth2:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-frontend-jaxrs:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-core:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.codehaus.woodstox:woodstox-core-asl:4.4.1.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.ws.xmlschema:xmlschema-core:2.2.1.classpath"/>
|
||||||
|
<path refid="library.maven:_javax.ws.rs:javax.ws.rs-api:2.0.1.classpath"/>
|
||||||
|
<path refid="library.maven:_javax.annotation:javax.annotation-api:1.2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-transports-http:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-security-jose-jaxrs:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-security:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-security-jose:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-json-basic:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-client:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-commons-api:4.5.0.classpath"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="web-api-commander.runtime.production.module.classpath">
|
||||||
|
<pathelement location="${web-api-commander.output.dir}"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-commons-core:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_commons-codec:commons-codec:1.9.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-client-core:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-client-api:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_commons-io:commons-io:2.4.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.httpcomponents:httpclient:4.2.6.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.httpcomponents:httpcore:4.2.5.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.core:jackson-core:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.core:jackson-databind:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.core:jackson-annotations:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_org.codehaus.woodstox:stax2-api:3.1.4.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml:aalto-xml:0.9.10.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-client-proxy:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.commons:commons-lang3:3.3.2.classpath"/>
|
||||||
|
<path refid="library.maven:_commons-logging:commons-logging:1.2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-server-api:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_io.netty:netty-all:4.1.16.final.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-server-core:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_commons-cli:commons-cli:1.4.classpath"/>
|
||||||
|
<path refid="library.maven:_org.pac4j:pac4j-oidc:3.6.1.classpath"/>
|
||||||
|
<path refid="library.maven:_org.pac4j:pac4j-core:3.6.1.classpath"/>
|
||||||
|
<path refid="library.maven:_com.nimbusds:oauth2-oidc-sdk:6.5.classpath"/>
|
||||||
|
<path refid="library.maven:_com.sun.mail:javax.mail:1.6.1.classpath"/>
|
||||||
|
<path refid="library.maven:_javax.activation:activation:1.1.classpath"/>
|
||||||
|
<path refid="library.maven:_com.github.stephenc.jcip:jcip-annotations:1.0-1.classpath"/>
|
||||||
|
<path refid="library.maven:_net.minidev:json-smart:2.3.classpath"/>
|
||||||
|
<path refid="library.maven:_net.minidev:accessors-smart:1.2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.ow2.asm:asm:5.0.4.classpath"/>
|
||||||
|
<path refid="library.maven:_com.nimbusds:lang-tag:1.4.4.classpath"/>
|
||||||
|
<path refid="library.maven:_com.nimbusds:nimbus-jose-jwt:6.0.2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.mockito:mockito-core:2.13.0.classpath"/>
|
||||||
|
<path refid="library.maven:_net.bytebuddy:byte-buddy:1.7.9.classpath"/>
|
||||||
|
<path refid="library.maven:_net.bytebuddy:byte-buddy-agent:1.7.9.classpath"/>
|
||||||
|
<path refid="library.maven:_org.objenesis:objenesis:2.6.classpath"/>
|
||||||
|
<path refid="library.maven:_org.pac4j:pac4j-http:3.6.1.classpath"/>
|
||||||
|
<path refid="library.maven:_org.slf4j:slf4j-log4j12:1.7.26.classpath"/>
|
||||||
|
<path refid="library.maven:_log4j:log4j:1.2.17.classpath"/>
|
||||||
|
<path refid="library.maven:_org.slf4j:slf4j-api:1.7.26.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.commons:commons-vfs2:2.3.classpath"/>
|
||||||
|
<path refid="library.maven:_junit:junit:4.13-beta-2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.hamcrest:hamcrest-core:1.3.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-security-oauth2:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-frontend-jaxrs:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-core:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.codehaus.woodstox:woodstox-core-asl:4.4.1.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.ws.xmlschema:xmlschema-core:2.2.1.classpath"/>
|
||||||
|
<path refid="library.maven:_javax.ws.rs:javax.ws.rs-api:2.0.1.classpath"/>
|
||||||
|
<path refid="library.maven:_javax.annotation:javax.annotation-api:1.2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-transports-http:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-security-jose-jaxrs:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-security:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-security-jose:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-json-basic:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-client:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-commons-api:4.5.0.classpath"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="web-api-commander.module.classpath">
|
||||||
|
<path refid="${module.jdk.classpath.web-api-commander}"/>
|
||||||
|
<pathelement location="${web-api-commander.output.dir}"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-commons-core:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_commons-codec:commons-codec:1.9.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-client-core:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-client-api:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_commons-io:commons-io:2.4.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.httpcomponents:httpclient:4.2.6.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.httpcomponents:httpcore:4.2.5.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.core:jackson-core:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.core:jackson-databind:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.core:jackson-annotations:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_org.codehaus.woodstox:stax2-api:3.1.4.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml:aalto-xml:0.9.10.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-client-proxy:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.commons:commons-lang3:3.3.2.classpath"/>
|
||||||
|
<path refid="library.maven:_commons-logging:commons-logging:1.2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-server-api:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_io.netty:netty-all:4.1.16.final.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-server-core:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_commons-cli:commons-cli:1.4.classpath"/>
|
||||||
|
<path refid="library.maven:_org.pac4j:pac4j-oidc:3.6.1.classpath"/>
|
||||||
|
<path refid="library.maven:_org.pac4j:pac4j-core:3.6.1.classpath"/>
|
||||||
|
<path refid="library.maven:_com.nimbusds:oauth2-oidc-sdk:6.5.classpath"/>
|
||||||
|
<path refid="library.maven:_com.sun.mail:javax.mail:1.6.1.classpath"/>
|
||||||
|
<path refid="library.maven:_javax.activation:activation:1.1.classpath"/>
|
||||||
|
<path refid="library.maven:_com.github.stephenc.jcip:jcip-annotations:1.0-1.classpath"/>
|
||||||
|
<path refid="library.maven:_net.minidev:json-smart:2.3.classpath"/>
|
||||||
|
<path refid="library.maven:_net.minidev:accessors-smart:1.2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.ow2.asm:asm:5.0.4.classpath"/>
|
||||||
|
<path refid="library.maven:_com.nimbusds:lang-tag:1.4.4.classpath"/>
|
||||||
|
<path refid="library.maven:_com.nimbusds:nimbus-jose-jwt:6.0.2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.mockito:mockito-core:2.13.0.classpath"/>
|
||||||
|
<path refid="library.maven:_net.bytebuddy:byte-buddy:1.7.9.classpath"/>
|
||||||
|
<path refid="library.maven:_net.bytebuddy:byte-buddy-agent:1.7.9.classpath"/>
|
||||||
|
<path refid="library.maven:_org.objenesis:objenesis:2.6.classpath"/>
|
||||||
|
<path refid="library.maven:_org.pac4j:pac4j-http:3.6.1.classpath"/>
|
||||||
|
<path refid="library.maven:_org.slf4j:slf4j-log4j12:1.7.26.classpath"/>
|
||||||
|
<path refid="library.maven:_log4j:log4j:1.2.17.classpath"/>
|
||||||
|
<path refid="library.maven:_org.slf4j:slf4j-api:1.7.26.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.commons:commons-vfs2:2.3.classpath"/>
|
||||||
|
<path refid="library.maven:_junit:junit:4.13-beta-2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.hamcrest:hamcrest-core:1.3.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-security-oauth2:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-frontend-jaxrs:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-core:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.codehaus.woodstox:woodstox-core-asl:4.4.1.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.ws.xmlschema:xmlschema-core:2.2.1.classpath"/>
|
||||||
|
<path refid="library.maven:_javax.ws.rs:javax.ws.rs-api:2.0.1.classpath"/>
|
||||||
|
<path refid="library.maven:_javax.annotation:javax.annotation-api:1.2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-transports-http:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-security-jose-jaxrs:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-security:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-security-jose:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-json-basic:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-client:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-commons-api:4.5.0.classpath"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
<path id="web-api-commander.runtime.module.classpath">
|
||||||
|
<pathelement location="${web-api-commander.testoutput.dir}"/>
|
||||||
|
<pathelement location="${web-api-commander.output.dir}"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-commons-core:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_commons-codec:commons-codec:1.9.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-client-core:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-client-api:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_commons-io:commons-io:2.4.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.httpcomponents:httpclient:4.2.6.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.httpcomponents:httpcore:4.2.5.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.core:jackson-core:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.core:jackson-databind:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.core:jackson-annotations:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.7.8.classpath"/>
|
||||||
|
<path refid="library.maven:_org.codehaus.woodstox:stax2-api:3.1.4.classpath"/>
|
||||||
|
<path refid="library.maven:_com.fasterxml:aalto-xml:0.9.10.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-client-proxy:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.commons:commons-lang3:3.3.2.classpath"/>
|
||||||
|
<path refid="library.maven:_commons-logging:commons-logging:1.2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-server-api:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_io.netty:netty-all:4.1.16.final.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-server-core:4.5.0.classpath"/>
|
||||||
|
<path refid="library.maven:_commons-cli:commons-cli:1.4.classpath"/>
|
||||||
|
<path refid="library.maven:_org.pac4j:pac4j-oidc:3.6.1.classpath"/>
|
||||||
|
<path refid="library.maven:_org.pac4j:pac4j-core:3.6.1.classpath"/>
|
||||||
|
<path refid="library.maven:_com.nimbusds:oauth2-oidc-sdk:6.5.classpath"/>
|
||||||
|
<path refid="library.maven:_com.sun.mail:javax.mail:1.6.1.classpath"/>
|
||||||
|
<path refid="library.maven:_javax.activation:activation:1.1.classpath"/>
|
||||||
|
<path refid="library.maven:_com.github.stephenc.jcip:jcip-annotations:1.0-1.classpath"/>
|
||||||
|
<path refid="library.maven:_net.minidev:json-smart:2.3.classpath"/>
|
||||||
|
<path refid="library.maven:_net.minidev:accessors-smart:1.2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.ow2.asm:asm:5.0.4.classpath"/>
|
||||||
|
<path refid="library.maven:_com.nimbusds:lang-tag:1.4.4.classpath"/>
|
||||||
|
<path refid="library.maven:_com.nimbusds:nimbus-jose-jwt:6.0.2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.mockito:mockito-core:2.13.0.classpath"/>
|
||||||
|
<path refid="library.maven:_net.bytebuddy:byte-buddy:1.7.9.classpath"/>
|
||||||
|
<path refid="library.maven:_net.bytebuddy:byte-buddy-agent:1.7.9.classpath"/>
|
||||||
|
<path refid="library.maven:_org.objenesis:objenesis:2.6.classpath"/>
|
||||||
|
<path refid="library.maven:_org.pac4j:pac4j-http:3.6.1.classpath"/>
|
||||||
|
<path refid="library.maven:_org.slf4j:slf4j-log4j12:1.7.26.classpath"/>
|
||||||
|
<path refid="library.maven:_log4j:log4j:1.2.17.classpath"/>
|
||||||
|
<path refid="library.maven:_org.slf4j:slf4j-api:1.7.26.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.commons:commons-vfs2:2.3.classpath"/>
|
||||||
|
<path refid="library.maven:_junit:junit:4.13-beta-2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.hamcrest:hamcrest-core:1.3.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-security-oauth2:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-frontend-jaxrs:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-core:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.codehaus.woodstox:woodstox-core-asl:4.4.1.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.ws.xmlschema:xmlschema-core:2.2.1.classpath"/>
|
||||||
|
<path refid="library.maven:_javax.ws.rs:javax.ws.rs-api:2.0.1.classpath"/>
|
||||||
|
<path refid="library.maven:_javax.annotation:javax.annotation-api:1.2.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-transports-http:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-security-jose-jaxrs:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-security:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-security-jose:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-json-basic:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.cxf:cxf-rt-rs-client:3.1.7.classpath"/>
|
||||||
|
<path refid="library.maven:_org.apache.olingo:odata-commons-api:4.5.0.classpath"/>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
|
||||||
|
<patternset id="excluded.from.module.web-api-commander">
|
||||||
|
<patternset refid="ignored.files"/>
|
||||||
|
</patternset>
|
||||||
|
|
||||||
|
<patternset id="excluded.from.compilation.web-api-commander">
|
||||||
|
<patternset refid="excluded.from.module.web-api-commander"/>
|
||||||
|
</patternset>
|
||||||
|
|
||||||
|
<path id="web-api-commander.module.sourcepath">
|
||||||
|
<dirset dir="${module.web-api-commander.basedir}">
|
||||||
|
<include name="src/main/java"/>
|
||||||
|
<include name="src/main/resources"/>
|
||||||
|
</dirset>
|
||||||
|
</path>
|
||||||
|
|
||||||
|
|
||||||
|
<target name="compile.module.web-api-commander" depends="compile.module.web-api-commander.production,compile.module.web-api-commander.tests" description="Compile module web-api-commander"/>
|
||||||
|
|
||||||
|
<target name="compile.module.web-api-commander.production" depends="register.custom.compilers" description="Compile module web-api-commander; production classes">
|
||||||
|
<mkdir dir="${web-api-commander.output.dir}"/>
|
||||||
|
<javac2 destdir="${web-api-commander.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true" executable="${module.jdk.bin.web-api-commander}/javac">
|
||||||
|
<compilerarg line="${compiler.args.web-api-commander}"/>
|
||||||
|
<bootclasspath refid="web-api-commander.module.bootclasspath"/>
|
||||||
|
<classpath refid="web-api-commander.module.production.classpath"/>
|
||||||
|
<src refid="web-api-commander.module.sourcepath"/>
|
||||||
|
<patternset refid="excluded.from.compilation.web-api-commander"/>
|
||||||
|
</javac2>
|
||||||
|
|
||||||
|
<copy todir="${web-api-commander.output.dir}">
|
||||||
|
<fileset dir="${module.web-api-commander.basedir}/src/main/java">
|
||||||
|
<patternset refid="compiler.resources"/>
|
||||||
|
<type type="file"/>
|
||||||
|
</fileset>
|
||||||
|
<fileset dir="${module.web-api-commander.basedir}/src/main/resources">
|
||||||
|
<patternset refid="compiler.resources"/>
|
||||||
|
<type type="file"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="compile.module.web-api-commander.tests" depends="register.custom.compilers,compile.module.web-api-commander.production" description="compile module web-api-commander; test classes" unless="skip.tests"/>
|
||||||
|
|
||||||
|
<target name="clean.module.web-api-commander" description="cleanup module">
|
||||||
|
<delete dir="${web-api-commander.output.dir}"/>
|
||||||
|
<delete dir="${web-api-commander.testoutput.dir}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="init" description="Build initialization">
|
||||||
|
<!-- Perform any build initialization in this target -->
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="clean" depends="clean.module.web-api-commander" description="cleanup all"/>
|
||||||
|
|
||||||
|
<target name="build.modules" depends="init, clean, compile.module.web-api-commander" description="build all modules"/>
|
||||||
|
|
||||||
|
<target name="init.artifacts">
|
||||||
|
<property name="artifacts.temp.dir" value="${basedir}/__artifacts_temp"/>
|
||||||
|
<property name="artifact.output.web-api-commander" value="${basedir}/classes/artifacts/web_api_commander"/>
|
||||||
|
<mkdir dir="${artifacts.temp.dir}"/>
|
||||||
|
<property name="temp.jar.path.web-api-commander.jar" value="${artifacts.temp.dir}/web-api-commander.jar"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="artifact.web-api-commander" depends="init.artifacts" description="Build 'web-api-commander' artifact">
|
||||||
|
<property name="artifact.temp.output.web-api-commander" value="${artifacts.temp.dir}/web_api_commander"/>
|
||||||
|
<mkdir dir="${artifact.temp.output.web-api-commander}"/>
|
||||||
|
<jar destfile="${temp.jar.path.web-api-commander.jar}" duplicate="preserve" filesetmanifest="mergewithoutmain">
|
||||||
|
<zipfileset file="/MANIFEST.MF" prefix="META-INF"/>
|
||||||
|
</jar>
|
||||||
|
<copy file="${temp.jar.path.web-api-commander.jar}" tofile="${artifact.temp.output.web-api-commander}/web-api-commander.jar"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="build.all.artifacts" depends="artifact.web-api-commander" description="Build all artifacts">
|
||||||
|
<mkdir dir="${artifact.output.web-api-commander}"/>
|
||||||
|
<copy todir="${artifact.output.web-api-commander}">
|
||||||
|
<fileset dir="${artifact.temp.output.web-api-commander}"/>
|
||||||
|
</copy>
|
||||||
|
|
||||||
|
<!-- Delete temporary files -->
|
||||||
|
<delete dir="${artifacts.temp.dir}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="all" depends="build.modules, build.all.artifacts" description="build all"/>
|
||||||
|
</project>
|
Loading…
Reference in New Issue