Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/wso2/carbon-apimgt
Browse files Browse the repository at this point in the history
  • Loading branch information
malinthaprasan committed Sep 2, 2019
2 parents ac6d2c6 + 916f0e5 commit 656e6ca
Show file tree
Hide file tree
Showing 201 changed files with 7,243 additions and 2,660 deletions.
2 changes: 1 addition & 1 deletion components/apimgt/org.wso2.carbon.apimgt.api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>6.5.70-SNAPSHOT</version>
<version>6.5.72-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ Application[] getApplicationsWithPagination(Subscriber subscriber, String groupi
* @throws APIManagementException
*/
Set<SubscribedAPI> getSubscribedIdentifiers(Subscriber subscriber,
APIIdentifier identifier, String groupingId) throws APIManagementException;
Identifier identifier, String groupingId) throws APIManagementException;

Set<APIIdentifier> getAPIByConsumerKey(String accessToken) throws APIManagementException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public abstract class APIDefinition {


private static final Pattern CURLY_BRACES_PATTERN = Pattern.compile("(?<=\\{)(?!\\s*\\{)[^{}]+");
private static final String KEEP_LEGACY_EXTENSION_PROP = "preserveLegacyExtensions";

/**
* This method extracts the URI templates from the API definition
Expand All @@ -58,15 +59,6 @@ public abstract class APIDefinition {
*/
public abstract Set<Scope> getScopes(String resourceConfigsJSON) throws APIManagementException;

/**
* This method saves the API definition
*
* @param api API to be saved
* @param apiDefinitionJSON API definition as JSON string
* @param registry user registry
*/
public abstract void saveAPIDefinition(API api, String apiDefinitionJSON, Registry registry) throws APIManagementException;

/**
* This method saves the APIProduct definition
*
Expand All @@ -77,15 +69,6 @@ public abstract class APIDefinition {
public abstract void saveAPIDefinition(APIProduct apiProduct, String apiDefinitionJSON, Registry registry)
throws APIManagementException;

/**
* This method reads the API definition from registry
*
* @param apiIdentifier api identifier
* @param registry user registry
* @return API definition
*/
public abstract String getAPIDefinition(APIIdentifier apiIdentifier, Registry registry) throws APIManagementException;

/**
* This method generates API definition to the given api
*
Expand Down Expand Up @@ -123,15 +106,6 @@ public abstract void saveAPIDefinition(APIProduct apiProduct, String apiDefiniti
public abstract String generateAPIDefinition(API api, String swagger, boolean syncOperations)
throws APIManagementException;

/**
* This method returns the timestamps for a given API
* @param apiIdentifier
* @param registry
* @return
* @throws APIManagementException
*/
public abstract Map<String ,String> getAPIOpenAPIDefinitionTimeStamps(APIIdentifier apiIdentifier, Registry registry) throws APIManagementException;

/**
* Extract and return path parameters in the given URI template
*
Expand Down Expand Up @@ -181,13 +155,22 @@ public abstract APIDefinitionValidationResponse validateAPIDefinition(String api
boolean returnJsonContent) throws APIManagementException;

/**
* This method validates the given OpenAPI definition by URL
* Populate definition with wso2 APIM specific information
*
* @param url URL of the API definition
* @param returnJsonContent whether to return the converted json form of the
* @return APIDefinitionValidationResponse object with validation information
* @param oasDefinition OAS definition
* @param api API
* @return Generated OAS definition
* @throws APIManagementException If an error occurred
*/
public abstract APIDefinitionValidationResponse validateAPIDefinitionByURL(String url, boolean returnJsonContent)
throws APIManagementException;
public abstract String populateCustomManagementInfo(String oasDefinition, API api) throws APIManagementException;

/**
* Check extension migration is disabled
*
* @return boolean
*/
protected boolean isLegacyExtensionsPreserved() {
String keepLegacyExtension = System.getProperty(KEEP_LEGACY_EXTENSION_PROP);
return Boolean.parseBoolean(keepLegacyExtension);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@
*/
public class APIDefinitionValidationResponse {
private boolean isValid = false;

private String content;
private String jsonContent;
private Info info;

private APIDefinition parser;
private ArrayList<ErrorHandler> errorItems = new ArrayList<>();

public boolean isValid() {
Expand Down Expand Up @@ -120,4 +119,12 @@ public void setContext(String context) {
this.context = context;
}
}

public APIDefinition getParser() {
return parser;
}

public void setParser(APIDefinition parser) {
this.parser = parser;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ public enum ExceptionCodes implements ErrorHandler {
OPENAPI_NOT_FOUND(900755, "OpenAPI definition not found", 404, "OpenAPI definition not found"),
OPENAPI_URL_MALFORMED(900756, "OpenAPI definition retrieval from URL failed", 400, "Exception occurred while retrieving the OpenAPI definition from URL"),
OPENAPI_URL_NO_200(900757, "OpenAPI definition retrieval from URL failed", 400, "Response didn't return a 200 OK status"),
INVALID_OAS2_FOUND(900761, "Invalid OpenAPI V2 definition found", 400, "Invalid OpenAPI V2 definition found"),
INVALID_OAS3_FOUND(900762, "Invalid OpenAPI V3 definition found", 400, "Invalid OpenAPI V3 definition found"),


// REST API related codes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public boolean equals(Object o) {
@Override
public int hashCode() {
int result = subscriber.hashCode();
result = 31 * result + apiId.hashCode();
result = (31 * result) + ((apiId == null) ? productId.hashCode() : apiId.hashCode());
result = 31 * result + application.hashCode();
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>apimgt</artifactId>
<groupId>org.wso2.carbon.apimgt</groupId>
<version>6.5.70-SNAPSHOT</version>
<version>6.5.72-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
8 changes: 4 additions & 4 deletions components/apimgt/org.wso2.carbon.apimgt.core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>6.5.70-SNAPSHOT</version>
<version>6.5.72-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -75,9 +75,9 @@
org.wso2.carbon.throttle.*; version="${imp.pkg.version.carbon.throttle}",
org.apache.axis2.*; version="${imp.pkg.version.axis2}",
org.apache.commons.*,
org.osgi.framework.*,
org.osgi.util.*,
org.osgi.service.*,
org.osgi.framework.*;version="${imp.package.version.osgi.framework}",
org.osgi.util.*;version="${imp.package.version.osgi.util}",
org.osgi.service.*;version="${imp.package.version.osgi.service}",
javax.cache.*,
org.apache.synapse.commons.*,
org.wso2.carbon.apimgt.api.*;version="${carbon.apimgt.imp.pkg.version}",
Expand Down
6 changes: 3 additions & 3 deletions components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>6.5.70-SNAPSHOT</version>
<version>6.5.72-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -391,11 +391,11 @@
org.apache.neethi.*; version="2.0.4.wso2v4",
org.wso2.carbon.registry.core.*; version="${carbon.registry.imp.pkg.version}",
org.wso2.carbon.utils; version="${carbon.platform.package.import.version.range}",
org.osgi.service.component,
org.slf4j,
org.wso2.carbon.apimgt.keymgt.stub.validator; version="${carbon.apimgt.imp.pkg.version}",
org.wso2.carbon.base.*; version="${imp.pkg.version.carbon.base}",
org.osgi.framework.*,
org.osgi.framework.*;version="${imp.package.version.osgi.framework}",
org.osgi.service.*;version="${imp.package.version.osgi.service}",
org.wso2.carbon.rest.api.stub.*,
org.wso2.carbon.sequences.stub.types,
org.wso2.carbon.localentry.stub.*,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>apimgt</artifactId>
<version>6.5.70-SNAPSHOT</version>
<version>6.5.72-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
import org.wso2.carbon.apimgt.impl.UserAwareAPIProvider;
import org.wso2.carbon.apimgt.impl.certificatemgt.ResponseCode;
import org.wso2.carbon.apimgt.impl.definitions.APIDefinitionFromOpenAPISpec;
import org.wso2.carbon.apimgt.impl.definitions.OAS2Parser;
import org.wso2.carbon.apimgt.impl.definitions.OASParserUtil;
import org.wso2.carbon.apimgt.impl.dto.Environment;
import org.wso2.carbon.apimgt.impl.dto.TierPermissionDTO;
import org.wso2.carbon.apimgt.impl.factory.KeyManagerHolder;
Expand Down Expand Up @@ -1147,7 +1149,7 @@ public static NativeObject jsFunction_getOpenAPIDefinitionResource(Context cx, S
tenantId = ServiceReferenceHolder.getInstance().getRealmService().getTenantManager().getTenantId(tenantDomain);
registry = registryService.getGovernanceSystemRegistry(tenantId);

apiJSON = definitionFromOpenAPISpec.getAPIDefinition(apiId, registry); //apiProvider.getSwagger12Definition(apiId);
apiJSON = OASParserUtil.getAPIDefinition(apiId, registry); //apiProvider.getSwagger12Definition(apiId);
} catch (RegistryException e) {
handleException("Error when create registry instance ", e);
} catch (UserStoreException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ public static NativeObject jsFunction_searchPaginatedAPIs(Context cx, Scriptable
inputSearchQuery = inputSearchQuery.trim();
// sub context and doc content doesn't support AND search
if (inputSearchQuery != null && inputSearchQuery.contains(" ") && !inputSearchQuery
.contains(APIConstants.TAG_SEARCH_TYPE_PREFIX4) && !inputSearchQuery
.contains(APIConstants.TAG_COLON_SEARCH_TYPE_PREFIX) && !inputSearchQuery
.contains(APIConstants.CONTENT_SEARCH_TYPE_PREFIX)) {
if (inputSearchQuery.split(" ").length > 1) {
String[] searchCriterias = inputSearchQuery.split(" ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.hybrid.gateway</artifactId>
<version>6.5.70-SNAPSHOT</version>
<version>6.5.72-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -176,15 +176,15 @@
</Private-Package>
<Import-Package>
org.wso2.carbon.utils.*; version="${carbon.kernel.package.import.version.range}",
org.osgi.service.component.*,
org.apache.commons.logging; version="${commons.logging.imp.pkg.version}",
org.wso2.carbon.tenant.mgt.services.*; version="${carbon.multitenancy.version}",
org.wso2.carbon.context.*; version="${carbon.kernel.package.import.version.range}",
org.wso2.carbon.core.multitenancy.*;
version="${carbon.kernel.package.import.version.range}",
org.wso2.carbon.stratos.common.*; version="${carbon.commons.imp.pkg.version}",
org.wso2.carbon.core.*; version="${carbon.kernel.package.import.version.range}",
org.osgi.framework.*,
org.osgi.framework.*;version="${imp.package.version.osgi.framework}",
org.osgi.service.*;version="${imp.package.version.osgi.service}",
org.json.*,
org.wso2.carbon.registry.*; version="${carbon.registry.imp.pkg.version}",
org.wso2.carbon.user.core.*; version="${carbon.platform.package.import.version.range}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.hybrid.gateway</artifactId>
<version>6.5.70-SNAPSHOT</version>
<version>6.5.72-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -159,8 +159,8 @@
org.wso2.carbon.apimgt.hybrid.gateway.common.*;version="${project.version}"
</Export-Package>
<Import-Package>
org.osgi.framework.*,
org.osgi.service.component.*,
org.osgi.framework.*;version="${imp.package.version.osgi.framework}",
org.osgi.service.*;version="${imp.package.version.osgi.service}",
org.apache.commons.codec.binary.*,
org.apache.commons.io.*; version="${commons-io.version}",
org.apache.commons.logging.*; version="${import.package.version.commons.logging}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<artifactId>org.wso2.carbon.apimgt.hybrid.gateway</artifactId>
<groupId>org.wso2.carbon.apimgt</groupId>
<version>6.5.70-SNAPSHOT</version>
<version>6.5.72-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>org.wso2.carbon.apimgt.hybrid.gateway</artifactId>
<groupId>org.wso2.carbon.apimgt</groupId>
<version>6.5.70-SNAPSHOT</version>
<version>6.5.72-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>org.wso2.carbon.apimgt.hybrid.gateway</artifactId>
<groupId>org.wso2.carbon.apimgt</groupId>
<version>6.5.70-SNAPSHOT</version>
<version>6.5.72-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -119,8 +119,9 @@
org.wso2.carbon.core; version="${carbon.kernel.package.import.version.range}",
org.apache.commons.logging.*; version="${import.package.version.commons.logging}",
org.apache.commons.lang3; version="${org.apache.commons.lang3.version}",
org.osgi.service.component; version="${org.osgi.service.version}",
org.osgi.framework; version="${org.osgi.framework.version}",
org.osgi.framework.*;version="${imp.package.version.osgi.framework}",
org.osgi.util.*;version="${imp.package.version.osgi.util}",
org.osgi.service.*;version="${imp.package.version.osgi.service}",
com.fasterxml.jackson.databind; version="${com.fasterxml.jackson.databind.version}",
org.apache.commons.codec.binary; version="${org.apache.commons.codec.binary.version}",
org.wso2.carbon.apimgt.impl.*; version="${carbon.apimgt.imp.pkg.version}",
Expand Down Expand Up @@ -153,8 +154,6 @@

<properties>
<org.apache.commons.lang3.version>[3.8.1,4)</org.apache.commons.lang3.version>
<org.osgi.service.version>[1.2,2)</org.osgi.service.version>
<org.osgi.framework.version>[1.7,2)</org.osgi.framework.version>
<com.fasterxml.jackson.databind.version>[2.9,3)</com.fasterxml.jackson.databind.version>
<org.apache.commons.codec.binary.version>[1.4,2)</org.apache.commons.codec.binary.version>
<org.apache.version>[4.3,5)</org.apache.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.hybrid.gateway</artifactId>
<version>6.5.70-SNAPSHOT</version>
<version>6.5.72-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -145,8 +145,8 @@
org.wso2.carbon.core.multitenancy.*;
version="${carbon.kernel.package.import.version.range}",
org.wso2.carbon.core.*; version="${carbon.kernel.package.import.version.range}",
org.osgi.framework.*,
org.osgi.service.component.*,
org.osgi.framework.*;version="${imp.package.version.osgi.framework}",
org.osgi.service.*;version="${imp.package.version.osgi.service}",
org.wso2.carbon.stratos.common.*; version="${carbon.commons.imp.pkg.version}",
org.wso2.carbon.apimgt.api.*; version="${carbon.apimgt.imp.pkg.version}",
org.wso2.carbon.apimgt.impl.*; version="${carbon.apimgt.imp.pkg.version}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>org.wso2.carbon.apimgt.hybrid.gateway</artifactId>
<groupId>org.wso2.carbon.apimgt</groupId>
<version>6.5.70-SNAPSHOT</version>
<version>6.5.72-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -144,8 +144,8 @@
org.wso2.carbon.apimgt.hybrid.gateway.throttling.synchronizer.*;version="${project.version}"
</Export-Package>
<Import-Package>
org.osgi.framework.*,
org.osgi.service.component.*,
org.osgi.framework.*;version="${imp.package.version.osgi.framework}",
org.osgi.service.*;version="${imp.package.version.osgi.service}",
org.wso2.carbon.apimgt.api.*;version="${carbon.apimgt.imp.pkg.version}",
org.wso2.carbon.apimgt.impl.*;version="${carbon.apimgt.imp.pkg.version}",
org.wso2.carbon.apimgt.hybrid.gateway.common.*;version="${carbon.apimgt.imp.pkg.version}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>org.wso2.carbon.apimgt.hybrid.gateway</artifactId>
<groupId>org.wso2.carbon.apimgt</groupId>
<version>6.5.70-SNAPSHOT</version>
<version>6.5.72-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -160,8 +160,8 @@
org.wso2.carbon.apimgt.hybrid.gateway.usage.publisher.*;version="${project.version}"
</Export-Package>
<Import-Package>
org.osgi.framework.*,
org.osgi.service.component.*,
org.osgi.framework.*;version="${imp.package.version.osgi.framework}",
org.osgi.service.*;version="${imp.package.version.osgi.service}",
com.lmax.disruptor.*;version="${lmax.disruptor.version.range}",
org.wso2.carbon.apimgt.api;version="${carbon.apimgt.imp.pkg.version}",
org.wso2.carbon.apimgt.impl.*;version="${carbon.apimgt.imp.pkg.version}",
Expand Down
Loading

0 comments on commit 656e6ca

Please sign in to comment.