Skip to content

Commit

Permalink
Merge branch '1.9.x' of https://github.com/wso2/product-apim into 1.9.x
Browse files Browse the repository at this point in the history
  • Loading branch information
tharindu1st committed Aug 15, 2015
2 parents f9634bc + f591ec0 commit 73f2895
Show file tree
Hide file tree
Showing 111 changed files with 14,056 additions and 694 deletions.
54 changes: 27 additions & 27 deletions config/api-manager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,6 @@
<!-- This parameter is used to enable the securevault support when try to publish endpoint secured APIs. Values should be "true" or "false".
By default secure vault is disabled.-->
<EnableSecureVault>false</EnableSecureVault>
<!--
Database configuration used by API publisher, API store and API key manager.
When these components are deployed separately, each of them should have
separate database configurations pointing to the same physical database.
-->
<!--Database-->
<!--
JDBC connection string for the database.
-->
<!--<URL>jdbc:h2:repository/database/WSO2AM_DB</URL> -->

<!--
JDBC username for the database.
-->
<!--<Username>wso2carbon</Username>-->

<!--
JDBC password for the database.
-->
<!--<Password>wso2carbon</Password>
JDBC driver for the database.
-->
<!--<Driver>org.h2.Driver</Driver>
</Database>-->

<!--
Authentication manager configuration for API publisher and API store. This is
Expand Down Expand Up @@ -181,6 +155,8 @@
-->
<APIUsageTracking>

<Enabled>false</Enabled>

<!--
Below property is used to skip trying to connect to event receiver nodes when publishing events even if
the stats enabled flag is set to true.
Expand All @@ -192,6 +168,30 @@
-->
<PublisherClass>org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageDataBridgeDataPublisher</PublisherClass>


<!--
Server URL of the remote BAM/CEP server used to collect statistics. Must
be specified in protocol://hostname:port/ format.
An event can also be published to multiple Receiver Groups each having 1 or more receivers. Receiver
Groups are delimited by curly braces whereas receivers are delimited by commas.
Ex - Multiple Receivers within a single group
tcp://localhost:7612/,tcp://localhost:7613/,tcp://localhost:7614/
Ex - Multiple Receiver Groups with two receivers each
{tcp://localhost:7612/,tcp://localhost:7613},{tcp://localhost:7712/,tcp://localhost:7713/}
-->
<BAMServerURL>{tcp://localhost:7612/}</BAMServerURL>

<!--
Administrator username to login to the remote BAM server.
-->
<BAMUsername>admin</BAMUsername>

<!--
Administrator password to login to the remote BAM server.
-->
<BAMPassword>admin</BAMPassword>

<!--
If below property set to true,then the response message size will be calculated and publish
with each successful API invocation event.
Expand Down Expand Up @@ -373,7 +373,7 @@
<!--
Uncomment this to limit the number of APIs in api the API Store
-->
<!--APIsPerPage>5</APIsPerPage-->
<!--APIsPerPage>30</APIsPerPage-->

<!--
This parameter specifies whether to display the comment editing facility or not.
Expand Down
80 changes: 80 additions & 0 deletions modules/api-import-export/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
API Import Export
=================

This tool is used to import and export APIs from WSO2 API Manager.

Main functionality of API Export is to retrieve all the required meta information and registry
resources for the requested API and generate a zipped archive.

Zipped archive consists of the following structure

<APIName>-<version>
|_ Meta Information
|_ api.json
|_ swagger.json
|_ Documents
|_ docs.json
|_ documents with type 'file'
|_ Image
|_ icon.<extension>
|_ WSDL
|_ <ApiName>-<version>.wsdl
|_ Sequences
|_ In Sequence
|_<Sequence Name>.xml
|_ Out Sequence
|_<Sequence Name>.xml
|_ Fault Sequence
|_<Sequence Name>.xml

API Import accepts the exported zipped archive and creates an API in the imported environment.

This feature has been implemented as a RESTful API.

RESTful API is protected with basic authentication.

Usage
-----


A WAR(Web Archive) can be generated by building this source.

### API Import Export among cross tenants


Place the api-import-export.war under repository -> deployment -> server -> webapps in WSO2 APi Manager 1.9.0 .

### API Import Export for a single tenant


Log in to API Management console for the required tenant domain and deploy the WAR file.

* Once the web archive is deployed, API Import and Export can be done via invoking RESTful apis.

Samples
-------

### Sample cURL command for API export with super tenant


curl -H "Authorization:Basic YWRtaW46YWRtaW4=" -X GET "https://10.100.7.39:9443/api-import-export/export-api?name=test&version=1.0.0&provider=admin" -k > exportedApi.zip

### Sample cURL command for API export with a tenant

curl -H "Authorization:Basic YWRtaW46YWRtaW4taWSt34=" -X GET "https://10.100.7.39:9443/api-import-export/export-api?name=test&version=1.0.0&provider=admin@tenantdomain.com" -k > exportedApi.zip


### Sample cURL command for API import

curl -H "Authorization:Basic YWRtaW46YWRtaW4=" -F file=@"full/path/to/the/zip/file" -k -X POST "https://10.100.7.40:9443/api-import-export/import-api"

The above command will keep the original provider of the API.

curl -H "Authorization:Basic YWRtaW46YWRtaW4=" -F file=@"full/path/to/the/zip/file" -k -X POST "https://10.100.7.40:9443/api-import-export/import-api?preserveProvider=false"

If there is a need to change the provider as the current logged in user, please use the above format.

Important Note :
When importing APIs across different tenants (Eg - API has been exported in super tenant and imported to another tenant domain),
value of the "preserveProvider" query parameter must always set to "false".

201 changes: 201 additions & 0 deletions modules/api-import-export/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ /*
~ * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ *
~ * Licensed under the Apache License, Version 2.0 (the "License");
~ * you may not use this file except in compliance with the License.
~ * You may obtain a copy of the License at
~ *
~ * http://www.apache.org/licenses/LICENSE-2.0
~ *
~ * Unless required by applicable law or agreed to in writing, software
~ * distributed under the License is distributed on an "AS IS" BASIS,
~ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ * See the License for the specific language governing permissions and
~ * limitations under the License.
~ */
-->

<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.wso2.carbon.apimgt</groupId>
<artifactId>api-import-export</artifactId>
<version>1.0-SNAPSHOT</version>

<description>JAX-RS API Import Export</description>
<packaging>war</packaging>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
<version>2.3.2</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
<warName>${project.artifactId}</warName>
</configuration>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<buildcommands>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
</buildcommands>
<projectnatures>
<projectnature>org.wso2.developerstudio.eclipse.jaxrs.project.nature</projectnature>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
</projectnatures>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>deploy</id>
<build>
<defaultGoal>compile</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy todir="${basedir}/../../../repository/deployment/server/webapps" overwrite="true">
<fileset dir="${basedir}/target">
<include name="${project.artifactId}.war"/>
</fileset>
</copy>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>client</id>
<build>
<defaultGoal>test</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>demo.jaxrs.client.Client</mainClass>
<!--send the EPR as an argument-->
<arguments>
<argument>http://localhost:9763/services</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<dependencies>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.impl</artifactId>
<version>1.2.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.api</artifactId>
<version>1.2.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.8.5</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>codehaus</id>
<url>http://repository.codehaus.org/org/codehaus</url>
</repository>
<repository>
<id>wso2-nexus</id>
<name>WSO2 internal Repository</name>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
</repository>
<repository>
<id>wso2.releases</id>
<name>WSO2 internal Repository</name>
<url>http://maven.wso2.org/nexus/content/repositories/releases/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
</repository>
</repositories>
</project>
Loading

0 comments on commit 73f2895

Please sign in to comment.