From c0604184b2aa8cff924ca783ec6b36f1f5988775 Mon Sep 17 00:00:00 2001 From: Zhaoxing Date: Tue, 8 Aug 2017 14:02:53 +0800 Subject: init code Change-Id: Icd0948118397b256da70dfbcbbec5520dc5eafd4 Signed-off-by: Zhaoxing --- .../org/openo/carbon/bpel/Wso2BpelApplication.java | 106 + .../openo/carbon/bpel/Wso2BpelConfiguration.java | 200 ++ .../java/org/openo/carbon/bpel/common/Config.java | 30 + .../openo/carbon/bpel/common/ServiceRegistrer.java | 70 + .../bpel/externalservice/entity/ServiceNode.java | 33 + .../entity/ServiceRegisterEntity.java | 57 + .../msb/MicroserviceBusConsumer.java | 48 + .../externalservice/msb/MicroserviceBusRest.java | 39 + .../openo/carbon/bpel/resources/BpsPackage.java | 632 ++++ .../openo/carbon/bpel/resources/BpsProcess.java | 544 ++++ .../carbon/bpel/resources/BpsServiceException.java | 30 + .../openo/carbon/bpel/resources/RestAppConfig.java | 37 + .../openo/carbon/bpel/util/ClientWsdlLoader.java | 82 + .../java/org/openo/carbon/bpel/util/JsonUtil.java | 61 + .../openo/carbon/bpel/util/LRULinkedHashMap.java | 106 + .../java/org/openo/carbon/bpel/util/SoapUtil.java | 156 + .../org/openo/carbon/bpel/util/Xml2JsonUtil.java | 141 + .../main/resources/api-doc/META-INF/MANIFEST.MF | 3 + .../src/main/resources/api-doc/WEB-INF/web.xml | 41 + .../src/main/resources/api-doc/css/reset.css | 140 + .../src/main/resources/api-doc/css/screen.css | 1271 ++++++++ .../src/main/resources/api-doc/css/typography.css | 41 + .../api-doc/fonts/droid-sans-v6-latin-700.eot | Bin 0 -> 22924 bytes .../api-doc/fonts/droid-sans-v6-latin-700.svg | 411 +++ .../api-doc/fonts/droid-sans-v6-latin-700.ttf | Bin 0 -> 40516 bytes .../api-doc/fonts/droid-sans-v6-latin-700.woff | Bin 0 -> 25992 bytes .../api-doc/fonts/droid-sans-v6-latin-700.woff2 | Bin 0 -> 11480 bytes .../api-doc/fonts/droid-sans-v6-latin-regular.eot | Bin 0 -> 22008 bytes .../api-doc/fonts/droid-sans-v6-latin-regular.svg | 403 +++ .../api-doc/fonts/droid-sans-v6-latin-regular.ttf | Bin 0 -> 39072 bytes .../api-doc/fonts/droid-sans-v6-latin-regular.woff | Bin 0 -> 24868 bytes .../fonts/droid-sans-v6-latin-regular.woff2 | Bin 0 -> 11304 bytes .../resources/api-doc/images/explorer_icons.png | Bin 0 -> 5763 bytes .../main/resources/api-doc/images/logo_small.png | Bin 0 -> 770 bytes .../resources/api-doc/images/pet_store_api.png | Bin 0 -> 824 bytes .../src/main/resources/api-doc/images/throbber.gif | Bin 0 -> 9257 bytes .../main/resources/api-doc/images/wordnik_api.png | Bin 0 -> 980 bytes .../src/main/resources/api-doc/index.html | 115 + .../src/main/resources/api-doc/lib/backbone-min.js | 30 + .../main/resources/api-doc/lib/handlebars-2.0.0.js | 43 + .../resources/api-doc/lib/highlight.7.3.pack.js | 16 + .../main/resources/api-doc/lib/jquery-1.8.0.min.js | 17 + .../resources/api-doc/lib/jquery.ba-bbq.min.js | 25 + .../resources/api-doc/lib/jquery.slideto.min.js | 16 + .../resources/api-doc/lib/jquery.wiggle.min.js | 23 + .../src/main/resources/api-doc/lib/marked.js | 1281 ++++++++ .../src/main/resources/api-doc/lib/shred.bundle.js | 2780 ++++++++++++++++ .../main/resources/api-doc/lib/shred/content.js | 208 ++ .../main/resources/api-doc/lib/swagger-client.js | 3309 ++++++++++++++++++++ .../main/resources/api-doc/lib/swagger-oauth.js | 294 ++ .../main/resources/api-doc/lib/underscore-min.js | 21 + .../src/main/resources/api-doc/o2c.html | 37 + .../src/main/resources/api-doc/swagger-ui.js | 2255 +++++++++++++ .../src/main/resources/api-doc/swagger-ui.min.js | 17 + .../wso2bpel-mgr/src/main/resources/banner.txt | 25 + .../src/main/resources/config.properties | 16 + .../wso2bpel-mgr/src/main/resources/migrations.xml | 38 + .../src/main/resources/wso2-config.properties | 24 + 58 files changed, 15272 insertions(+) create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/Wso2BpelApplication.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/Wso2BpelConfiguration.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/common/Config.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/common/ServiceRegistrer.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/entity/ServiceNode.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/entity/ServiceRegisterEntity.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/msb/MicroserviceBusConsumer.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/msb/MicroserviceBusRest.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/BpsPackage.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/BpsProcess.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/BpsServiceException.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/RestAppConfig.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/ClientWsdlLoader.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/JsonUtil.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/LRULinkedHashMap.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/SoapUtil.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/Xml2JsonUtil.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/META-INF/MANIFEST.MF create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/WEB-INF/web.xml create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/css/reset.css create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/css/screen.css create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/css/typography.css create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.eot create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.svg create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.ttf create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.woff create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.woff2 create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.eot create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.svg create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.ttf create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.woff create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.woff2 create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/explorer_icons.png create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/logo_small.png create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/pet_store_api.png create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/throbber.gif create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/wordnik_api.png create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/index.html create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/backbone-min.js create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/handlebars-2.0.0.js create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/highlight.7.3.pack.js create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery-1.8.0.min.js create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery.ba-bbq.min.js create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery.slideto.min.js create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery.wiggle.min.js create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/marked.js create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/shred.bundle.js create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/shred/content.js create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/swagger-client.js create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/swagger-oauth.js create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/underscore-min.js create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/o2c.html create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/swagger-ui.js create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/swagger-ui.min.js create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/banner.txt create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/config.properties create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/migrations.xml create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/wso2-config.properties (limited to 'wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main') diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/Wso2BpelApplication.java b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/Wso2BpelApplication.java new file mode 100644 index 0000000..5cec239 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/Wso2BpelApplication.java @@ -0,0 +1,106 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +package org.openo.carbon.bpel; + +import io.dropwizard.Application; +import io.dropwizard.assets.AssetsBundle; +import io.dropwizard.configuration.EnvironmentVariableSubstitutor; +import io.dropwizard.configuration.SubstitutingSourceProvider; +import io.dropwizard.server.SimpleServerFactory; +import io.dropwizard.setup.Bootstrap; +import io.dropwizard.setup.Environment; +import io.swagger.jaxrs.config.BeanConfig; +import io.swagger.jaxrs.listing.ApiListingResource; + +import org.glassfish.jersey.media.multipart.MultiPartFeature; +import org.openo.carbon.bpel.common.Config; +import org.openo.carbon.bpel.common.ServiceRegistrer; +import org.openo.carbon.bpel.resources.BpsPackage; +import org.openo.carbon.bpel.resources.BpsProcess; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.annotation.JsonInclude; + + + +public class Wso2BpelApplication extends Application { + private static final Logger LOGGER = LoggerFactory.getLogger(Wso2BpelApplication.class); + private static final String API_RESOURCE = "org.openo.carbon.bpel.resources"; + + public static void main(String[] args) throws Exception { + new Wso2BpelApplication().run(args); + } + + + @Override + public String getName() { + return "hello-wso2bpel"; + } + + @Override + public void initialize(Bootstrap bootstrap) { + bootstrap.setConfigurationSourceProvider(new SubstitutingSourceProvider( + bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor(false))); + // binding jar static resource + bootstrap.addBundle(new AssetsBundle("/api-doc", "/api-doc", "index.html", "api-doc")); + } + + private void initService() { + Thread registerWso2bpelService = new Thread(new ServiceRegistrer()); + registerWso2bpelService.setName("register wso2bpel service to Microservice Bus"); + registerWso2bpelService.start(); + } + + + + @Override + public void run(Wso2BpelConfiguration configuration, Environment environment) { + environment.jersey().register(MultiPartFeature.class); + environment.jersey().register(new BpsPackage()); + environment.jersey().register(new BpsProcess()); + // init Swagger conf + initSwaggerConfig(environment, configuration); + Config.setConfigration(configuration); + initService(); + } + + private void initSwaggerConfig(Environment environment, Wso2BpelConfiguration configuration) { + // register swagger scan class + environment.jersey().register(new ApiListingResource()); + environment.getObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL); + + BeanConfig config = new BeanConfig(); + config.setTitle(configuration.getApiDescription()); + config.setVersion("1.0"); + config.setResourcePackage(API_RESOURCE); + + // read rootPath config from yml + SimpleServerFactory simpleServerFactory = + (SimpleServerFactory) configuration.getServerFactory(); + String basePath = simpleServerFactory.getApplicationContextPath(); + String rootPath = simpleServerFactory.getJerseyRootPath(); + + // set basepath for rest api + rootPath = rootPath.substring(0, rootPath.indexOf("/*")); + basePath = basePath.equals("/") ? rootPath + : (new StringBuilder()).append(basePath).append(rootPath).toString(); + + LOGGER.info("getApplicationContextPath:" + basePath); + config.setBasePath(basePath); + config.setScan(true); + } +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/Wso2BpelConfiguration.java b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/Wso2BpelConfiguration.java new file mode 100644 index 0000000..953a919 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/Wso2BpelConfiguration.java @@ -0,0 +1,200 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +package org.openo.carbon.bpel; + +import io.dropwizard.Configuration; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.dropwizard.db.DataSourceFactory; +import org.hibernate.validator.constraints.NotEmpty; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + +public class Wso2BpelConfiguration extends Configuration { + @NotEmpty + private String template; + @NotEmpty + private String apiDescription = "Wso2bps REST API"; + @NotNull + private DataSourceFactory database = new DataSourceFactory(); + + @NotEmpty + private String msbServerAddr; + + @NotEmpty + private String wso2Host; + + @NotEmpty + private String wso2HostPort; + + @NotEmpty + private String wso2AuthUserName; + + @NotEmpty + private String wso2AuthPassword; + + @NotEmpty + private String wso2Path; + + @NotEmpty + private String wso2UploadFilePath; + + @NotEmpty + private String wso2SslJksFile; + + @NotEmpty + private String wso2SslJksPassword; + + @Valid + private String serviceIp; + + @JsonProperty + public String getTemplate() { + return template; + } + + @JsonProperty + public String getApiDescription() { + return apiDescription; + } + + @JsonProperty("database") + public DataSourceFactory getDataSourceFactory() { + return database; + } + + @JsonProperty + public DataSourceFactory getDatabase() { + return database; + } + + @JsonProperty + public void setDatabase(DataSourceFactory database) { + this.database = database; + } + + @JsonProperty + public String getMsbServerAddr() { + return msbServerAddr; + } + + @JsonProperty + public void setMsbServerAddr(String msbServerAddr) { + this.msbServerAddr = msbServerAddr; + } + + @JsonProperty + public String getWso2Host() { + return wso2Host; + } + + @JsonProperty + public void setWso2Host(String wso2Host) { + this.wso2Host = wso2Host; + } + + @JsonProperty + public String getWso2HostPort() { + return wso2HostPort; + } + + @JsonProperty + public void setWso2HostPort(String wso2HostPort) { + this.wso2HostPort = wso2HostPort; + } + + @JsonProperty + public String getWso2AuthUserName() { + return wso2AuthUserName; + } + + @JsonProperty + public void setWso2AuthUserName(String wso2AuthUserName) { + this.wso2AuthUserName = wso2AuthUserName; + } + + @JsonProperty + public String getWso2AuthPassword() { + return wso2AuthPassword; + } + + @JsonProperty + public void setWso2AuthPassword(String wso2AuthPassword) { + this.wso2AuthPassword = wso2AuthPassword; + } + + @JsonProperty + public String getWso2Path() { + return wso2Path; + } + + @JsonProperty + public void setWso2Path(String wso2Path) { + if (wso2Path.startsWith("/") == false) { + this.wso2Path = System.getProperty("WSO2_EXT_HOME") + "/" + wso2Path; + } else { + this.wso2Path = wso2Path; + } + } + + @JsonProperty + public String getWso2UploadFilePath() { + return wso2UploadFilePath; + } + + @JsonProperty + public void setWso2UploadFilePath(String wso2UploadFilePath) { + if (wso2UploadFilePath.startsWith("/") == false) { + this.wso2UploadFilePath = System.getProperty("WSO2_EXT_HOME") + "/" + wso2UploadFilePath; + } else { + this.wso2UploadFilePath = wso2UploadFilePath; + } + } + + @JsonProperty + public String getWso2SslJksFile() { + return wso2SslJksFile; + } + + @JsonProperty + public void setWso2SslJksFile(String wso2SslJksFile) { + if (wso2SslJksFile.startsWith("/") == false) { + this.wso2SslJksFile = System.getProperty("WSO2_EXT_HOME") + "/" + wso2SslJksFile; + } else { + this.wso2SslJksFile = wso2SslJksFile; + } + } + + @JsonProperty + public String getWso2SslJksPassword() { + return wso2SslJksPassword; + } + + @JsonProperty + public void setWso2SslJksPassword(String wso2SslJksPassword) { + this.wso2SslJksPassword = wso2SslJksPassword; + } + + @JsonProperty + public String getServiceIp() { + return serviceIp; + } + + @JsonProperty + public void setServiceIp(String serviceIp) { + this.serviceIp = serviceIp; + } +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/common/Config.java b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/common/Config.java new file mode 100644 index 0000000..f3e83cf --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/common/Config.java @@ -0,0 +1,30 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +package org.openo.carbon.bpel.common; + +import org.openo.carbon.bpel.Wso2BpelConfiguration; + +public class Config { + private static Wso2BpelConfiguration configration; + + public static Wso2BpelConfiguration getConfigration() { + return configration; + } + + public static void setConfigration(Wso2BpelConfiguration config) { + configration = config; + } +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/common/ServiceRegistrer.java b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/common/ServiceRegistrer.java new file mode 100644 index 0000000..03d88aa --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/common/ServiceRegistrer.java @@ -0,0 +1,70 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +package org.openo.carbon.bpel.common; + +import org.openo.carbon.bpel.externalservice.entity.ServiceRegisterEntity; +import org.openo.carbon.bpel.externalservice.msb.MicroserviceBusConsumer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ServiceRegistrer implements Runnable { + private static final Logger LOG = LoggerFactory.getLogger(ServiceRegistrer.class); + private final ServiceRegisterEntity wso2bpelEntity = new ServiceRegisterEntity(); + + public ServiceRegistrer() { + initServiceEntity(); + } + + @Override + public void run() { + LOG.info("start wso2bpelEntity microservice register"); + boolean flag = false; + int retry = 0; + while (!flag && retry < 1000) { + LOG.info("wso2bpel microservice register.retry:" + retry); + retry++; + flag = MicroserviceBusConsumer.registerService(wso2bpelEntity); + if (flag == false) { + LOG.warn("microservice register failed, sleep 30S and try again."); + threadSleep(30000); + } else { + LOG.info("microservice register success!"); + break; + } + } + LOG.info("wso2bpel microservice register end."); + } + + private void threadSleep(int second) { + LOG.info("start sleep ...."); + try { + Thread.sleep(second); + } catch (InterruptedException error) { + LOG.error("thread sleep error.errorMsg:" + error.getMessage()); + } + LOG.info("sleep end ."); + } + + private void initServiceEntity() { + wso2bpelEntity.setServiceName("wso2bpel"); + wso2bpelEntity.setProtocol("REST"); + wso2bpelEntity.setVersion("v1"); + wso2bpelEntity.setUrl("/openoapi/wso2bpel/v1"); + wso2bpelEntity.setSingleNode(Config.getConfigration().getServiceIp(), "8101", 0); + wso2bpelEntity.setVisualRange("1"); + } + +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/entity/ServiceNode.java b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/entity/ServiceNode.java new file mode 100644 index 0000000..5f0d3bb --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/entity/ServiceNode.java @@ -0,0 +1,33 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +package org.openo.carbon.bpel.externalservice.entity; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@JsonIgnoreProperties(ignoreUnknown = true) +public class ServiceNode { + private String ip; + private String port; + private int ttl; +} + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/entity/ServiceRegisterEntity.java b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/entity/ServiceRegisterEntity.java new file mode 100644 index 0000000..3dd336d --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/entity/ServiceRegisterEntity.java @@ -0,0 +1,57 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +package org.openo.carbon.bpel.externalservice.entity; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.ArrayList; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@JsonIgnoreProperties(ignoreUnknown = true) +public class ServiceRegisterEntity { + private String serviceName; + private String version; + private String url; + private String protocol; + private String visualRange; + private ArrayList nodes = new ArrayList(); + + /** + * set service entity. + * + * @param ip node ip. can be null + * @param port service port + * @param ttl service survival time + */ + public void setSingleNode(String ip, String port, int ttl) { + ServiceNode node = new ServiceNode(); + if (ip != null && ip.length() > 0) { + node.setIp(ip); + } else { + node.setIp(null); + } + node.setPort(port); + node.setTtl(ttl); + nodes.add(node); + } + +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/msb/MicroserviceBusConsumer.java b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/msb/MicroserviceBusConsumer.java new file mode 100644 index 0000000..b5086e8 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/msb/MicroserviceBusConsumer.java @@ -0,0 +1,48 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +package org.openo.carbon.bpel.externalservice.msb; + +import com.eclipsesource.jaxrs.consumer.ConsumerFactory; + +import org.glassfish.jersey.client.ClientConfig; +import org.openo.carbon.bpel.common.Config; +import org.openo.carbon.bpel.externalservice.entity.ServiceRegisterEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + + + +public class MicroserviceBusConsumer { + private static final Logger LOG = LoggerFactory.getLogger(MicroserviceBusConsumer.class); + + /** + * @param entity service entity + * @return register service to msb success return true, else return false. + */ + public static boolean registerService(ServiceRegisterEntity entity) { + ClientConfig config = new ClientConfig(); + try { + MicroserviceBusRest resourceserviceproxy = ConsumerFactory.createConsumer( + Config.getConfigration().getMsbServerAddr(), config, MicroserviceBusRest.class); + resourceserviceproxy.registerServce("false", entity); + } catch (Exception error) { + LOG.error("microservice register failed!" + error.getMessage()); + return false; + } + return true; + } +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/msb/MicroserviceBusRest.java b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/msb/MicroserviceBusRest.java new file mode 100644 index 0000000..83a6941 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/msb/MicroserviceBusRest.java @@ -0,0 +1,39 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +package org.openo.carbon.bpel.externalservice.msb; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import org.openo.carbon.bpel.externalservice.entity.ServiceRegisterEntity; + + + + +@Path("/openoapi/microservices/v1/services") +// @Path("/api/microservices/v1/services") +public interface MicroserviceBusRest { + @Path("") + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public ServiceRegisterEntity registerServce(@QueryParam("createOrUpdate") String createOrUpdate, + ServiceRegisterEntity entity)throws Exception; +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/BpsPackage.java b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/BpsPackage.java new file mode 100644 index 0000000..e11c1eb --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/BpsPackage.java @@ -0,0 +1,632 @@ +/** + * Copyright 2016-2017 ZTE Corporation. + * + * 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. + */ +package org.openo.carbon.bpel.resources; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.atomic.AtomicLong; + +import javax.activation.DataHandler; +import javax.activation.DataSource; +import javax.activation.FileDataSource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.QueryParam; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNamespace; +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.Options; +import org.apache.axis2.rpc.client.RPCServiceClient; +import org.apache.axis2.transport.http.HTTPConstants; +import org.apache.axis2.transport.http.HttpTransportProperties; +import org.apache.axis2.transport.http.HttpTransportProperties.Authenticator; +import org.apache.commons.io.FileUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataMultiPart; +import org.glassfish.jersey.media.multipart.FormDataParam; +import org.glassfish.jersey.media.multipart.MultiPartFeature; +import org.glassfish.jersey.media.multipart.file.FileDataBodyPart; +import org.wso2.carbon.bpel.stub.upload.types.UploadedFileItem; +import org.openo.carbon.bpel.common.Config; +import org.openo.carbon.bpel.util.JsonUtil; +import org.openo.carbon.bpel.util.Xml2JsonUtil; + +import com.codahale.metrics.annotation.Timed; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +@Path("/") +@Api(tags = {"wso2 bpel api"}) +public class BpsPackage { + + private static final Log log = LogFactory.getLog(BpsPackage.class); + + public static final int STATUS_SUCCESS = 1; + public static final int STATUS_FAIL = 0; + /** + * 无错误 + */ + public static final int ERROR_CODE_NOERROR = 0; + /** + * 不支持的文件类型 + */ + public static final int ERROR_CODE_PACKAGE_UNSUPPORED_FILE = 10001; + /** + * 同名的包正在操作中 + */ + public static final int ERROR_CODE_PACKAGE_STATUS_BUSY = 10002; + /** + * 包名重复 + */ + public static final int ERROR_CODE_PACKAGE_DUPLICATED_NAME = 10003; + /** + * 未获取到包部署的信息 + */ + public static final int ERROR_CODE_PACKAGE_DEPLOY_INFORMATION_IS_LOST = 10004; + /** + * 卸载包失败 + */ + public static final int ERROR_CODE_PACKAGE_UNDEPLOY_FAILED = 10005; + /** + * 包不存在 + */ + public static final int ERROR_CODE_PACKAGE_NOTEXISTS = 10006; + /** + * 服务运行时异常 + */ + public static final int ERROR_CODE_RUNTIME_EXCEPTION = 20001; + /** + * Axis运行时异常 + */ + public static final int ERROR_CODE_RUNTIME_EXCEPTION_AXIS = 20002; + /** + * IO运行时异常 + */ + public static final int ERROR_CODE_RUNTIME_EXCEPTION_IO = 20003; + + public static Set packageNameSet = new HashSet(); + + private Map configMap = null; + + @SuppressWarnings("unused") + private final AtomicLong counter; + + public BpsPackage() { + this.counter = new AtomicLong(); + } + + private synchronized String getConfig(String key) { + if (configMap == null) { + configMap = new HashMap(); + String uploadFilePath = Config.getConfigration().getWso2UploadFilePath(); + String jksFile = Config.getConfigration().getWso2SslJksFile(); + String trustStorePassword = Config.getConfigration().getWso2SslJksPassword(); + String httpUsername = Config.getConfigration().getWso2AuthUserName(); + String httpPassword = Config.getConfigration().getWso2AuthPassword(); + String host = Config.getConfigration().getWso2Host(); + String port = Config.getConfigration().getWso2HostPort(); + configMap.put("uploadFilePath", uploadFilePath); + configMap.put("jksFile", jksFile); + configMap.put("trustStorePassword", trustStorePassword); + configMap.put("httpUsername", httpUsername); + configMap.put("httpPassword", httpPassword); + configMap.put("host", host); + configMap.put("port", port); + } + if (configMap.containsKey(key)) { + return configMap.get(key); + } else { + return ""; + } + } + + public static boolean lockPackageName(String packageName) { + boolean succeed = false; + synchronized (packageNameSet) { + if (!packageNameSet.contains(packageName)) { + packageNameSet.add(packageName); + succeed = true; + } + } + return succeed; + } + + public static boolean unlockPackageName(String packageName) { + boolean succeed = false; + synchronized (packageNameSet) { + if (packageNameSet.contains(packageName)) { + packageNameSet.remove(packageName); + succeed = true; + } + } + return succeed; + } + + @POST + @Path(value = "package") + @Consumes(MediaType.MULTIPART_FORM_DATA) + @Produces(value = MediaType.APPLICATION_JSON) + @ApiOperation(value = "package process", response = Map.class) + @Timed + public Map uploadFile(@FormDataParam("filename") String filename, + @FormDataParam("file") InputStream fileInputStream, + @FormDataParam("file") FormDataContentDisposition fileDetail, + @Context HttpServletRequest request, @Context HttpServletResponse response) + throws IOException { + Map map = new LinkedHashMap(); + String errorMessage = "unkown"; + int errorCode = ERROR_CODE_NOERROR; + + String fileName = fileDetail.getFileName(); + String fullName = getConfig("uploadFilePath") + "/" + fileName; + File file = new File(fullName); + String packageName = null; + try { + if (fileName.endsWith(".zip")) { + packageName = fileName.substring(0, fileName.length() - 4); + } else { + errorCode = ERROR_CODE_PACKAGE_UNSUPPORED_FILE; + throw new Exception("Only support *.zip file."); + } + if (!lockPackageName(packageName)) { + errorCode = ERROR_CODE_PACKAGE_STATUS_BUSY; + throw new Exception("Package " + packageName + " is operating."); + } + FileUtils.copyInputStreamToFile(fileInputStream, file); + System.setProperty("javax.net.ssl.trustStore", "*.keystore"); + System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); + System.setProperty("javax.net.ssl.trustStore", getConfig("jksFile")); + System.setProperty("javax.net.ssl.trustStorePassword", getConfig("trustStorePassword")); + + HttpTransportProperties.Authenticator authenticator = + new HttpTransportProperties.Authenticator(); + List auth = new ArrayList(); + auth.add(Authenticator.BASIC); + authenticator.setAuthSchemes(auth); + authenticator.setUsername(getConfig("httpUsername")); + authenticator.setPassword(getConfig("httpPassword")); + authenticator.setPreemptiveAuthentication(true); + + map.putAll(bpsDeployPackage(fileName, fullName, packageName, authenticator)); + map.put("status", STATUS_SUCCESS); + map.put("message", "success"); + return map; + } catch (AxisFault e) { + errorMessage = e.getLocalizedMessage(); + errorCode = ERROR_CODE_RUNTIME_EXCEPTION_AXIS; + log.error(e.getMessage(), e); + e.printStackTrace(); + } catch (IOException e) { + errorMessage = e.getLocalizedMessage(); + errorCode = ERROR_CODE_RUNTIME_EXCEPTION_IO; + log.error(e.getMessage(), e); + e.printStackTrace(); + } catch (Throwable e) { + errorMessage = e.getLocalizedMessage(); + if (e instanceof BpsServiceException) { + errorCode = ((BpsServiceException) e).getErrorCode(); + } else { + errorCode = ERROR_CODE_RUNTIME_EXCEPTION; + } + log.error(e.getMessage(), e); + e.printStackTrace(); + } finally { + if (packageName != null) { + unlockPackageName(packageName); + } + } + map.put("errorCode", errorCode); + map.put("status", STATUS_FAIL); + map.put("message", errorMessage); + return map; + } + + @SuppressWarnings("rawtypes") + private Map bpsDeployPackage(String fileName, String fullName, String packageName, + HttpTransportProperties.Authenticator authenticator) + throws JsonParseException, JsonMappingException, IOException, AxisFault, Exception { + Map map = new HashMap(); + Map deployedPackageInfoMap = getDeployedPackageInfo(authenticator, packageName, ""); + if (deployedPackageInfoMap.get("packageName") != null) { + throw new BpsServiceException(ERROR_CODE_PACKAGE_DUPLICATED_NAME,"Package " + deployedPackageInfoMap.get("packageName") + + " exist, please undeploy it first."); + } + OMElement element = deployPackage(fileName, fullName, authenticator); + System.out.println(Xml2JsonUtil.xml2JSON(element.toString())); + + long timeout = 60 * 1000L; + long timeStart = System.currentTimeMillis(); + while (System.currentTimeMillis() - timeStart < timeout) { + deployedPackageInfoMap = getDeployedPackageInfo(authenticator, packageName, ""); + if (deployedPackageInfoMap.get("packageName") == null) { + Thread.sleep(2000); + } else { + break; + } + } + if (deployedPackageInfoMap.get("packageName") == null) { + throw new BpsServiceException(ERROR_CODE_PACKAGE_DEPLOY_INFORMATION_IS_LOST, + "Package " + packageName + " deploy failed or deploy information is lost."); + } + map.put("packageName", deployedPackageInfoMap.get("packageName")); + map.put("processId", deployedPackageInfoMap.get("pid")); + return map; + } + + private OMElement deployPackage(String fileName, String fullName, + HttpTransportProperties.Authenticator authenticator) throws AxisFault { + String url = + "https://" + getConfig("host") + ":" + getConfig("port") + "/services/BPELUploader?wsdl"; + RPCServiceClient serviceClient = new RPCServiceClient(); + EndpointReference targetEPR = new EndpointReference(url); + Options options = serviceClient.getOptions(); + options.setTo(targetEPR); + options.setAction("urn:uploadService"); + options.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(300000)); + options.setProperty(HTTPConstants.AUTHENTICATE, authenticator); + serviceClient.setOptions(options); + + QName qname = new QName("http://services.deployer.bpel.carbon.wso2.org", "uploadService"); + UploadedFileItem fileItem = new UploadedFileItem(); + fileItem.setFileName(fileName); + fileItem.setFileType("zip"); + + DataSource dataSource = new FileDataSource(fullName); + fileItem.setDataHandler(new DataHandler(dataSource)); + UploadedFileItem[] parameters = new UploadedFileItem[] {fileItem}; + OMElement element = serviceClient.invokeBlocking(qname, parameters); + return element; + } + + @Path(value = "package/{packageName}") + @DELETE + @Produces(value = MediaType.APPLICATION_JSON) + @ApiOperation(value = "delete", response = Map.class) + @Timed + public Map delete(@PathParam("packageName") String packageName, + @Context HttpServletRequest request) { + Map map = new LinkedHashMap(); + String errorMessage = "unkown"; + int errorCode = ERROR_CODE_NOERROR; + try { + if (!lockPackageName(packageName)) { + throw new Exception("Package " + packageName + " is operating."); + } + System.setProperty("javax.net.ssl.trustStore", "*.keystore"); + System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); + System.setProperty("javax.net.ssl.trustStore", getConfig("jksFile")); + System.setProperty("javax.net.ssl.trustStorePassword", getConfig("trustStorePassword")); + + HttpTransportProperties.Authenticator authenticator = + new HttpTransportProperties.Authenticator(); + List auth = new ArrayList(); + auth.add(Authenticator.BASIC); + authenticator.setAuthSchemes(auth); + authenticator.setUsername(getConfig("httpUsername")); + authenticator.setPassword(getConfig("httpPassword")); + authenticator.setPreemptiveAuthentication(true); + + map.putAll(bpsUndeployPackage(packageName, authenticator)); + + return map; + } catch (AxisFault e) { + errorMessage = e.getLocalizedMessage(); + errorCode = ERROR_CODE_RUNTIME_EXCEPTION_AXIS; + log.error(e.getMessage(), e); + e.printStackTrace(); + } catch (Throwable e) { + errorMessage = e.getLocalizedMessage(); + if (e instanceof BpsServiceException) { + errorCode = ((BpsServiceException) e).getErrorCode(); + } else { + errorCode = ERROR_CODE_RUNTIME_EXCEPTION; + } + log.error(e.getMessage(), e); + e.printStackTrace(); + } finally { + if (packageName != null) { + unlockPackageName(packageName); + } + } + map.put("errorCode", errorCode); + map.put("status", STATUS_FAIL); + map.put("message", errorMessage); + return map; + } + + @SuppressWarnings({"rawtypes", "unused"}) + private Map bpsUndeployPackage(String packageName, + HttpTransportProperties.Authenticator authenticator) + throws JsonParseException, JsonMappingException, IOException, AxisFault, Exception { + Map map = new HashMap(); + Map deployedPackageInfoMap = getDeployedPackageInfo(authenticator, packageName, ""); + if (deployedPackageInfoMap.get("packageName") == null) { + throw new BpsServiceException(ERROR_CODE_PACKAGE_NOTEXISTS,"Package " + deployedPackageInfoMap.get("packageName") + + " does not exist, please deploy it first."); + } + OMElement element = undeployPackage(authenticator, packageName); + deployedPackageInfoMap = getDeployedPackageInfo(authenticator, packageName, ""); + if (deployedPackageInfoMap.get("packageName") != null) { + throw new BpsServiceException(ERROR_CODE_PACKAGE_UNDEPLOY_FAILED, + "Package " + deployedPackageInfoMap.get("packageName") + " undeploy failed."); + } + map.put("status", STATUS_SUCCESS); + map.put("message", "success"); + + return map; + } + + private OMElement undeployPackage(HttpTransportProperties.Authenticator authenticator, + String packageName) throws AxisFault { + String url = "https://" + getConfig("host") + ":" + getConfig("port") + + "/services/BPELPackageManagementService?wsdl"; + RPCServiceClient serviceClient = new RPCServiceClient(); + EndpointReference targetEPR = new EndpointReference(url); + Options options = serviceClient.getOptions(); + options.setTo(targetEPR); + options.setAction("sch:undeployBPELPackage"); + options.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(300000)); + options.setProperty(HTTPConstants.AUTHENTICATE, authenticator); + serviceClient.setOptions(options); + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("http://wso2.org/bps/management/schema", "sch"); + OMElement method = fac.createOMElement("undeployBPELPackage", omNs); + OMElement content = fac.createOMElement("package", omNs); + content.addChild(fac.createOMText(content, packageName)); + method.addChild(content); + method.build(); + OMElement res = serviceClient.sendReceive(method); + return res; + } + + @SuppressWarnings({"rawtypes", "unchecked"}) + private Map getFullDeployedPackageInfo(HttpTransportProperties.Authenticator authenticator, + String packageName, String page) throws Exception { + String result; + String jsonTemplate = + "{'listDeployedPackagesPaginated':{'page':'${page}','packageSearchString':'${searchString}'}}"; + Map jsonParamMap = new HashMap(); + jsonParamMap.put("page", page); + jsonParamMap.put("searchString", packageName); + Object params = getParams(jsonTemplate, jsonParamMap); + result = BpsProcess.invokeWsdl("https://" + getConfig("host") + ":" + getConfig("port") + + "/services/BPELPackageManagementService?wsdl", params, authenticator); + Map processMap = JsonUtil.json2Bean(result, Map.class); + return processMap; + } + + @SuppressWarnings({"rawtypes", "unchecked"}) + private Map getDeployedPackageInfo(HttpTransportProperties.Authenticator authenticator, + String packageName, String page) throws Exception { + Map resultMap = new HashMap(); + Map processMap = getFullDeployedPackageInfo(authenticator, packageName, page); + Object packages = ((Map) processMap.get("deployedPackagesPaginated")).get("package"); + Map deployedPackage = null; + if (packages instanceof List) { + for (Iterator iter = ((List) packages).iterator(); iter.hasNext();) { + Map packageMap = (Map) iter.next(); + String deployedPackageName = (String) packageMap.get("name"); + if (deployedPackageName.equals(packageName)) { + deployedPackage = packageMap; + break; + } + } + } else if (packages instanceof Map) { + String deployedPackageName = (String) ((Map) packages).get("name"); + if (deployedPackageName.equals(packageName)) { + deployedPackage = (Map) packages; + } + } + if (deployedPackage != null) { + String fullPackageName = null; + String pid = null; + Object versions = ((Map) deployedPackage.get("versions")).get("version"); + Map lastestVersion = null; + if (versions instanceof List) { + for (Iterator iter = ((List) versions).iterator(); iter.hasNext();) { + Map version = (Map) iter.next(); + if (version.get("isLatest").equals("true")) { + lastestVersion = version; + } + } + } else if (versions instanceof Map) { + lastestVersion = (Map) versions; + } + fullPackageName = (String) ((Map) ((Map) lastestVersion.get("processes")).get("process")) + .get("packageName"); + pid = (String) ((Map) ((Map) lastestVersion.get("processes")).get("process")).get("pid"); + resultMap.put("packageName", fullPackageName); + resultMap.put("pid", pid); + } + return resultMap; +} + + + @SuppressWarnings({"rawtypes", "unchecked"}) + public static Map getParams(String jsonTemplate, Map paramMap) + throws JsonParseException, JsonMappingException, IOException { + String json = jsonTemplate.replaceAll("'", "\""); + for (Iterator iter = paramMap.keySet().iterator(); iter.hasNext();) { + String key = (String) iter.next(); + String value = ""; + if (paramMap.get(key) != null) { + value = paramMap.get(key).toString().replaceAll("\"", "\\\\\""); + } + json = json.replaceAll("\\$\\{" + key + "\\}", value); + } + return JsonUtil.json2Bean(json, Map.class); + } + + @GET + @Path(value = "listPackages") + @Produces(value = MediaType.APPLICATION_JSON) + @ApiOperation(value = "list packages", response = Map.class) + @Timed + public Map listPackages(@QueryParam("page") String page, + @QueryParam("searchString") String searchString, @Context HttpServletRequest request) + throws IOException { + Map map = new LinkedHashMap(); + String errorMessage = "unkown"; + int errorCode = ERROR_CODE_NOERROR; + String packageName = null; + try { + System.setProperty("javax.net.ssl.trustStore", "*.keystore"); + System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); + System.setProperty("javax.net.ssl.trustStore", getConfig("jksFile")); + System.setProperty("javax.net.ssl.trustStorePassword", getConfig("trustStorePassword")); + + HttpTransportProperties.Authenticator authenticator = + new HttpTransportProperties.Authenticator(); + List auth = new ArrayList(); + auth.add(Authenticator.BASIC); + authenticator.setAuthSchemes(auth); + authenticator.setUsername(getConfig("httpUsername")); + authenticator.setPassword(getConfig("httpPassword")); + authenticator.setPreemptiveAuthentication(true); + + map.putAll(getFullDeployedPackageInfo(authenticator,searchString,page)); + + map.put("status", STATUS_SUCCESS); + map.put("message", "success"); + return map; + } catch (AxisFault e) { + errorMessage = e.getLocalizedMessage(); + errorCode = ERROR_CODE_RUNTIME_EXCEPTION_AXIS; + log.error(e.getMessage(), e); + e.printStackTrace(); + } catch (IOException e) { + errorMessage = e.getLocalizedMessage(); + errorCode = ERROR_CODE_RUNTIME_EXCEPTION_IO; + log.error(e.getMessage(), e); + e.printStackTrace(); + } catch (Throwable e) { + if (e instanceof BpsServiceException) { + errorCode = ((BpsServiceException) e).getErrorCode(); + } else { + errorCode = ERROR_CODE_RUNTIME_EXCEPTION; + } + errorMessage = e.getLocalizedMessage(); + log.error(e.getMessage(), e); + e.printStackTrace(); + } finally { + if (packageName != null) { + unlockPackageName(packageName); + } + } + map.put("errorCode", errorCode); + map.put("status", STATUS_FAIL); + map.put("message", errorMessage); + return map; + } + + @SuppressWarnings("rawtypes") + public static void main(String[] args) { + try { + + boolean remoteDebug = true; + boolean localDebug = false; + if (remoteDebug) { + Client client = ClientBuilder.newBuilder().register(MultiPartFeature.class).build(); + WebTarget target = client.target("http://localhost:8101/openoapi/wso2bpel/v1/package"); + FileDataBodyPart bodyPart = new FileDataBodyPart("file", + new File("F:\\wso2bps-3.5.1\\wso2bps-3.5.1\\repository\\samples\\bpel\\Alarm.zip")); + FormDataMultiPart formDataMultiPart = new FormDataMultiPart(); + formDataMultiPart.field("fileName", "Alarm.zip").bodyPart(bodyPart); + String result = target.request(MediaType.APPLICATION_JSON) + .post(Entity.entity(formDataMultiPart, formDataMultiPart.getMediaType()), String.class); + System.out.println(result); + } + // + // System.out.println("************************************************************************"); + // + // bodyPart = new FileDataBodyPart("file", new + // File("D:\\temp\\bpel-sample\\AssignDate\\AssignDate.zip")); + // formDataMultiPart = new FormDataMultiPart(); + // formDataMultiPart.field("fileName", + // "AssignDate.zip").bodyPart(bodyPart); + // result = target.request(MediaType.APPLICATION_JSON) + // .post(Entity.entity(formDataMultiPart, + // formDataMultiPart.getMediaType()), String.class); + // System.out.println(result); + // + if (localDebug) { + System.setProperty("javax.net.ssl.trustStore", "*.keystore"); + System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); + System.setProperty("javax.net.ssl.trustStore", + "D:\\software\\WSO2\\wso2bps-3.5.1\\repository\\resources\\security\\wso2carbon.jks"); + System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon"); + HttpTransportProperties.Authenticator authenticator = + new HttpTransportProperties.Authenticator(); + List auth = new ArrayList(); + auth.add(Authenticator.BASIC); + authenticator.setAuthSchemes(auth); + authenticator.setUsername("admin"); + authenticator.setPassword("admin"); + authenticator.setPreemptiveAuthentication(true); + // + // String packageName = "RESTProcess"; + // Map deployedPackageInfoMap = + // getDeployedPackageInfo(authenticator, packageName); + + BpsPackage packageTest = new BpsPackage(); + Map map; + // map = packageTest.bpsUndeployPackage("AssignDate", + // authenticator); + // System.out.println(JsonUtil.bean2Json(map)); + map = packageTest.bpsDeployPackage("AssignDate.zip", + "D:\\temp\\bpel-sample\\AssignDate\\AssignDate.zip", "AssignDate", authenticator); + System.out.println(JsonUtil.bean2Json(map)); + map = packageTest.bpsUndeployPackage("AssignDate", authenticator); + System.out.println(JsonUtil.bean2Json(map)); + } + + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/BpsProcess.java b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/BpsProcess.java new file mode 100644 index 0000000..148e309 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/BpsProcess.java @@ -0,0 +1,544 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +package org.openo.carbon.bpel.resources; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.atomic.AtomicLong; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMAttribute; +import org.apache.axiom.om.OMDocument; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNamespace; +import org.apache.axiom.om.OMText; +import org.apache.axiom.om.OMXMLBuilderFactory; +import org.apache.axiom.om.OMXMLParserWrapper; +import org.apache.axiom.om.util.StAXParserConfiguration; +import org.apache.axis2.AxisFault; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; +import org.apache.axis2.rpc.client.RPCServiceClient; +import org.apache.axis2.transport.http.HTTPConstants; +import org.apache.axis2.transport.http.HttpTransportProperties; +import org.apache.axis2.transport.http.HttpTransportProperties.Authenticator; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.glassfish.jersey.media.multipart.MultiPartFeature; +import org.openo.carbon.bpel.common.Config; +import org.openo.carbon.bpel.util.JsonUtil; +import org.openo.carbon.bpel.util.SoapUtil; +import org.openo.carbon.bpel.util.Xml2JsonUtil; + +import com.codahale.metrics.annotation.Timed; +import com.eviware.soapui.model.iface.MessagePart; +import com.eviware.soapui.model.iface.Request; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +@Path("/") +@Api(tags = {"wso2 bpel api"}) +public class BpsProcess { + + private static final Log log = LogFactory.getLog(BpsProcess.class); + + public static final int STATUS_SUCCESS = 1; + public static final int STATUS_FAIL = 0; + + private Map configMap = null; + + @SuppressWarnings("unused") + private final AtomicLong counter; + + public BpsProcess() { + this.counter = new AtomicLong(); + } + + private synchronized String getConfig(String key) { + if (configMap == null) { + configMap = new HashMap(); + //Config.getConfigration().getMsbServerAddr(); + /* String uploadFilePath = ConfigManager.getInstance().getProperty("wso2.uploadfile.path"); + String jksFile = ConfigManager.getInstance().getProperty("wso2.ssl.jks.file"); + String trustStorePassword = + ConfigManager.getInstance().getProperty("wso2.ssl.trustStorePassword"); + String httpUsername = + ConfigManager.getInstance().getProperty("wso2.http.authenticator.username"); + String httpPassword = + ConfigManager.getInstance().getProperty("wso2.http.authenticator.password"); + String host = ConfigManager.getInstance().getProperty("wso2.host"); + String port = ConfigManager.getInstance().getProperty("wso2.http.port");*/ + String uploadFilePath = Config.getConfigration().getWso2UploadFilePath(); + String jksFile = Config.getConfigration().getWso2SslJksFile(); + String trustStorePassword = Config.getConfigration().getWso2SslJksPassword(); + String httpUsername = Config.getConfigration().getWso2AuthUserName(); + String httpPassword = Config.getConfigration().getWso2AuthPassword(); + String host = Config.getConfigration().getWso2Host(); + String port = Config.getConfigration().getWso2HostPort(); + configMap.put("uploadFilePath", uploadFilePath); + configMap.put("jksFile", jksFile); + configMap.put("trustStorePassword", trustStorePassword); + configMap.put("httpUsername", httpUsername); + configMap.put("httpPassword", httpPassword); + configMap.put("host", host); + configMap.put("port", port); + } + if (configMap.containsKey(key)) { + return configMap.get(key); + } else { + return ""; + } + } + + @SuppressWarnings("unchecked") + @POST + @Path("process/instance") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(value = MediaType.APPLICATION_JSON) + @ApiOperation(value = "startProcess", response = Map.class) + @Timed + public Map startProcess(JsonNode jsonObj, @Context HttpServletRequest request) { + Map map = new LinkedHashMap(); + String errorMessage = "unkown"; + + Map paramMap = new HashMap(); + try { + paramMap = JsonUtil.json2Bean(jsonObj.toString(), Map.class); + String processId = (String) paramMap.get("processId"); + + Object params = paramMap.get("params"); + + String wsdlUrl = getWsdlUrl(processId); + String response = invokeWsdl(wsdlUrl, params); + + map.put("status", STATUS_SUCCESS); + map.put("message", "success"); + // map.put("wsdl", wsdlUrl); + map.put("response", response); + return map; + } catch (JsonParseException e) { + errorMessage = e.getLocalizedMessage(); + log.error(e.getMessage(), e); + e.printStackTrace(); + } catch (JsonMappingException e) { + errorMessage = e.getLocalizedMessage(); + log.error(e.getMessage(), e); + e.printStackTrace(); + } catch (IOException e) { + errorMessage = e.getLocalizedMessage(); + log.error(e.getMessage(), e); + e.printStackTrace(); + } catch (Exception e) { + errorMessage = e.getLocalizedMessage(); + log.error(e.getMessage(), e); + e.printStackTrace(); + } + + map.put("status", STATUS_FAIL); + map.put("message", errorMessage); + return map; + } + + public static String invokeWsdl(String wsdlUrl, Object params) throws Exception { + return invokeWsdl(wsdlUrl, params, null); + } + + @SuppressWarnings({"unused", "rawtypes"}) + public static String invokeWsdl(String wsdlUrl, Object params, + HttpTransportProperties.Authenticator authenticator) throws Exception { + SoapUtil soapUtil = new SoapUtil(); + Request[] requestTemplates = soapUtil.getRequestTemplate(wsdlUrl); + String requestTemplate = null; + Request invokeRequest = null; + for (Request requestXML : requestTemplates) { + + InputStream is = new ByteArrayInputStream(requestXML.getRequestContent().getBytes()); + OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder( + OMAbstractFactory.getOMFactory(), StAXParserConfiguration.STANDALONE, is); + OMElement root = builder.getDocumentElement(); + OMDocument omDocument = builder.getDocument(); + Iterator iter = omDocument.getChildren(); + OMElement bodyElement = null; + while (iter.hasNext()) { + OMElement node = (OMElement) iter.next(); + String nodeName = node.getLocalName(); + if (nodeName.equals("Envelope")) { + Iterator envChildren = node.getChildElements(); + while (envChildren.hasNext()) { + Object childNode = envChildren.next(); + if (childNode instanceof OMElement) { + if (((OMElement) childNode).getLocalName().equals("Body")) { + bodyElement = (OMElement) childNode; + } + } + } + } + } + Set paramSet = new HashSet(); + Iterator bodyIter = bodyElement.getChildElements(); + while (bodyIter.hasNext()) { + Object obj = bodyIter.next(); + OMElement requestBody = (OMElement) obj; + paramSet.add(requestBody.getLocalName()); + } + if (params instanceof Map) { + Set paramKeySet = ((Map) params).keySet(); + boolean matched = true; + for (Object key : paramKeySet) { + if (!paramSet.contains(key)) { + matched = false; + continue; + } + } + if (matched) { + invokeRequest = requestXML; + requestTemplate = requestXML.getRequestContent(); + break; + } + } + } + if (requestTemplate == null) { + throw new Exception("Invalid param."); + } + + InputStream is = new ByteArrayInputStream(requestTemplate.getBytes()); + OMXMLParserWrapper builder = OMXMLBuilderFactory + .createOMBuilder(OMAbstractFactory.getOMFactory(), StAXParserConfiguration.STANDALONE, is); + OMElement root = builder.getDocumentElement(); + OMDocument omDocument = builder.getDocument(); + Iterator iter = omDocument.getChildren(); + OMElement bodyElement = null; + while (iter.hasNext()) { + OMElement node = (OMElement) iter.next(); + String nodeName = node.getLocalName(); + if (nodeName.equals("Envelope")) { + Iterator envChildren = node.getChildElements(); + while (envChildren.hasNext()) { + Object childNode = envChildren.next(); + if (childNode instanceof OMElement) { + if (((OMElement) childNode).getLocalName().equals("Body")) { + bodyElement = (OMElement) childNode; + } + } + } + } + } + + Options options = new Options(); + EndpointReference targetEPR = new EndpointReference(wsdlUrl); + options.setTo(targetEPR); + if (authenticator != null) { + options.setProperty(HTTPConstants.AUTHENTICATE, authenticator); + } + ServiceClient sender = new ServiceClient(); + sender.setOptions(options); + OMFactory factory = OMAbstractFactory.getOMFactory(); + OMElement requestBody = null; + Iterator bodyIter = bodyElement.getChildElements(); + while (bodyIter.hasNext()) { + Object obj = bodyIter.next(); + requestBody = (OMElement) obj; + } + + // Iterator requestBodyIter = requestBody.getChildElements(); + setParams(requestBody, params); + + requestBody.build(); + OMElement result = null; + boolean needResponse = false; + try { + MessagePart[] parts = invokeRequest.getResponseParts(); + if (parts != null && parts.length > 0) { + needResponse = true; + } + } catch (RuntimeException e) { + e.printStackTrace(); + } catch (Throwable e) { + e.printStackTrace(); + } + if (needResponse) { + result = sender.sendReceive(requestBody); + return Xml2JsonUtil.xml2JSON(result.toString()); + } else { + sender.sendRobust(requestBody); + return ""; + } + } + + @SuppressWarnings({"rawtypes", "unchecked"}) + private static void setParams(OMElement requestBody, Object params) { + Object currentParams = null; + if (params instanceof Map) { + currentParams = ((Map) params).get((requestBody).getLocalName()); + Object obj = requestBody.getFirstElement(); + if (obj == null) { + if (currentParams instanceof String) { + requestBody.setText((String) currentParams); + } + } else { + Iterator iter = requestBody.getChildElements(); + while (iter.hasNext()) { + OMElement child = iter.next(); + setParams((OMElement) child, currentParams); + } + } + } + } + + @SuppressWarnings("unchecked") + public String getWsdlUrl(String pid) { + log.warn("rest begin..."); + String wsdlUrl = null; + try { + System.setProperty("javax.net.ssl.trustStore", "*.keystore"); + + System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); + + System.setProperty("javax.net.ssl.trustStore", getConfig("jksFile")); + System.setProperty("javax.net.ssl.trustStorePassword", getConfig("trustStorePassword")); + + String url = "https://" + getConfig("host") + ":" + getConfig("port") + + "/services/ProcessManagementService?wsdl"; + RPCServiceClient serviceClient = new RPCServiceClient(); + EndpointReference targetEPR = new EndpointReference(url); + Options options = serviceClient.getOptions(); + options.setTo(targetEPR); + // options.setAction("sch:undeployBPELPackage"); + + options.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(300000)); + HttpTransportProperties.Authenticator authenticator = + new HttpTransportProperties.Authenticator(); + List auth = new ArrayList(); + auth.add(Authenticator.BASIC); + authenticator.setAuthSchemes(auth); + authenticator.setUsername(getConfig("httpUsername")); + authenticator.setPassword(getConfig("httpPassword")); + authenticator.setPreemptiveAuthentication(true); + options.setProperty(HTTPConstants.AUTHENTICATE, authenticator); + + serviceClient.setOptions(options); + + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace omNs = fac.createOMNamespace("http://wso2.org/bps/management/schema", "sch"); + + OMElement method = fac.createOMElement("getProcessInfoIn", omNs); + QName pidQName = QName.valueOf(pid); + OMElement pidElement = fac.createOMElement("pid", omNs); + + pidElement.addChild(fac.createOMText(pidElement, pidQName)); + method.addChild(pidElement); + + method.build(); + + OMElement res = serviceClient.sendReceive(method); + res.getFirstElement().getText(); + + // System.out.println(JsonUtil.bean2Json(parse(res))); + + Iterator iter = res.getChildrenWithLocalName("endpoints"); + if (iter.hasNext()) { + OMElement endPoints = (OMElement) iter.next(); + Iterator endPointIter = endPoints.getChildrenWithLocalName("endpointRef"); + if (endPointIter.hasNext()) { + OMElement endpointRef = (OMElement) endPointIter.next(); + Iterator endpointRefIter = + endpointRef.getChildrenWithLocalName("serviceLocations"); + if (endpointRefIter.hasNext()) { + OMElement serviceLocations = (OMElement) endpointRefIter.next(); + Iterator serviceLocationsIter = + serviceLocations.getChildrenWithLocalName("serviceLocation"); + while (serviceLocationsIter.hasNext()) { + OMElement serviceLocation = (OMElement) serviceLocationsIter.next(); + String sUrl = serviceLocation.getText(); + if (sUrl.endsWith("wsdl")) { + wsdlUrl = sUrl; + break; + } + } + } + } + } + + } catch (AxisFault e) { + log.error(e.getMessage(), e); + e.printStackTrace(); + } catch (Throwable e) { + log.error(e.getMessage(), e); + e.printStackTrace(); + } finally { + log.warn("invoke finally..."); + } + return wsdlUrl; + } + + @SuppressWarnings({"unused", "rawtypes", "unchecked"}) + private Map parse(OMElement node) { + Map resultMap = new HashMap(); + Iterator attrIter = node.getAllAttributes(); + while (attrIter.hasNext()) { + OMAttribute attr = (OMAttribute) attrIter.next(); + resultMap.put(attr.getLocalName(), attr.getAttributeValue()); + } + boolean hasChild = false; + List childList = new ArrayList(); + Iterator childIter = node.getChildren();// getChildElements(); + while (childIter.hasNext()) { + hasChild = true; + Object child = childIter.next(); + if (child instanceof OMText) { + resultMap.put(node.getLocalName(), ((OMText) child).getText()); + } else if (child instanceof OMElement) { + childList.add(parse((OMElement) child)); + resultMap.put(node.getLocalName(), childList); + } + } + return resultMap; + } + + public static void main1(String[] args) { + Client client = ClientBuilder.newBuilder().register(MultiPartFeature.class).build(); + WebTarget target = client.target("http://127.0.0.1:8080/wso2bpel/v1/process/instance"); + String jsonObj = + "{\"processId\":\"{http://ode/bpel/unit-test}HelloWorld2-18\",\"params\": {\"hello\":{\"TestPart\":\"AAA\"}}}"; + Response response = target.request(MediaType.APPLICATION_JSON) + .post(Entity.entity(jsonObj, MediaType.APPLICATION_JSON)); + int responseCode = response.getStatus(); + if (responseCode == 200) { + String excuteRespJson = response.readEntity(String.class); + // context.setExcuteRespJson(excuteRespJson); + // System.out.println("excute responseJson=====" + + // context.getExcuteRespJson()); + System.out.println(excuteRespJson); + } + + System.out.println("************************************************************************"); + jsonObj = + "{\"processId\":\"{http://ode/bpel/unit-test}HelloWorld2-18\",\"params\": {\"hello\":{\"TestPart\":\"AAA\"}}}"; + BpsProcess process = new BpsProcess(); + try { + Map resultMap = process.startProcess(JsonUtil.getJsonNode(jsonObj), null); + System.out.println(JsonUtil.bean2Json(resultMap)); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + System.out.println("************************************************************************"); + jsonObj = + "{\"processId\":\"{http://ode/bpel/unit-test}HelloXslWorld-3\",\"params\": {\"helloXsl\":{\"TestPart\":{\"content\":\"AAA\"}}}}"; + process = new BpsProcess(); + try { + Map resultMap = process.startProcess(JsonUtil.getJsonNode(jsonObj), null); + System.out.println(JsonUtil.bean2Json(resultMap)); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + System.out.println("************************************************************************"); + jsonObj = + "{\"processId\":\"{http://wso2.org/bps/samples/While}While-5\",\"params\": {\"WhileRequest\":{\"input\":\"365\"}}}"; + process = new BpsProcess(); + try { + Map resultMap = process.startProcess(JsonUtil.getJsonNode(jsonObj), null); + System.out.println(JsonUtil.bean2Json(resultMap)); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } catch (IOException e) { + } + + } + + @SuppressWarnings("unchecked") + public static void main(String[] args) { + + Map map = new LinkedHashMap(); + String errorMessage = "unkown"; + + Map paramMap = new HashMap(); + try { + String param = + "{\"planInput\":{\"sfc_count\":\"2\",\"nsInstanceId\":\"223\",\"vnfmId\":\"112\",\"instanceId\":\"334\",\"object_context\":\"{\\\"e\\\":{\\\"f\\\":\\\"4\\\"}}\",\"vnf_count\":\"2\",\"serviceTemplateId\":\"?\",\"vl_count\":\"2\",\"containerapiUrl\":\"?\",\"object_additionalParamForVnf\":\"[{\\\"b\\\":1},{\\\"c\\\":{\\\"d\\\":\\\"2\\\"}}}]\",\"object_additionalParamForNs\":\"[{\\\"a\\\":3},{\\\"e\\\":{\\\"f\\\":\\\"4\\\"}}}]\"}}"; + String jsonObj = + "{\"processId\":\"{http://wso2.org/bps/samples/While}While-5\",\"params\":" + param + "}"; + paramMap = JsonUtil.json2Bean(jsonObj.toString(), Map.class); + Object params = paramMap.get("params"); + String wsdlUrl = "http://10.74.151.36:9763/services/initService?wsdl"; + String response = invokeWsdl(wsdlUrl, params); + map.put("status", STATUS_SUCCESS); + map.put("message", "success"); + map.put("response", response); + System.out.println(JsonUtil.bean2Json(map)); + } catch (JsonParseException e) { + errorMessage = e.getLocalizedMessage(); + log.error(e.getMessage(), e); + e.printStackTrace(); + } catch (JsonMappingException e) { + errorMessage = e.getLocalizedMessage(); + log.error(e.getMessage(), e); + e.printStackTrace(); + } catch (IOException e) { + errorMessage = e.getLocalizedMessage(); + log.error(e.getMessage(), e); + e.printStackTrace(); + } catch (Exception e) { + errorMessage = e.getLocalizedMessage(); + log.error(e.getMessage(), e); + e.printStackTrace(); + } + + map.put("status", STATUS_FAIL); + map.put("message", errorMessage); + try { + System.out.println(JsonUtil.bean2Json(map)); + } catch (IOException e) { + errorMessage = e.getLocalizedMessage(); + log.error(e.getMessage(), e); + e.printStackTrace(); + } + + } +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/BpsServiceException.java b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/BpsServiceException.java new file mode 100644 index 0000000..bd05a95 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/BpsServiceException.java @@ -0,0 +1,30 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.openo.carbon.bpel.resources; + +public class BpsServiceException extends Exception { + + int errorCode = 0; + + public int getErrorCode() { + return errorCode; + } + + public BpsServiceException(int errorCode, String message) { + super(message); + this.errorCode = errorCode; + } +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/RestAppConfig.java b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/RestAppConfig.java new file mode 100644 index 0000000..b81fbe9 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/RestAppConfig.java @@ -0,0 +1,37 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +package org.openo.carbon.bpel.resources; + +import javax.ws.rs.ApplicationPath; + +import org.glassfish.jersey.filter.LoggingFilter; +import org.glassfish.jersey.media.multipart.MultiPartFeature; +import org.glassfish.jersey.server.ResourceConfig; + +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + +@ApplicationPath("/v1") +public class RestAppConfig extends ResourceConfig { + + public RestAppConfig() { + packages("org.wso2.carbon.bpel.rest.ext.v1"); + register(JacksonJsonProvider.class); + register(MultiPartFeature.class); + // register(MultiPartResource.class); + register(LoggingFilter.class); + } + +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/ClientWsdlLoader.java b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/ClientWsdlLoader.java new file mode 100644 index 0000000..70a9588 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/ClientWsdlLoader.java @@ -0,0 +1,82 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +package org.openo.carbon.bpel.util; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.net.URL; +import org.apache.log4j.Logger; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.methods.GetMethod; + +import com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader; + +public class ClientWsdlLoader extends WsdlLoader { + private static Logger logger = Logger.getLogger(ClientWsdlLoader.class); + + private boolean isAborted = false; + private HttpClient httpClient; + + public ClientWsdlLoader(String url, HttpClient httpClient) { + super(url); + this.httpClient = httpClient; + } + + public InputStream load(String url) throws Exception { + GetMethod httpGetMethod; + + if (url.startsWith("file")) { + return new URL(url).openStream(); + } + + // Authentication is not being overridden on the method. It needs + // to be present on the supplied HttpClient instance! + httpGetMethod = new GetMethod(url); + httpGetMethod.setDoAuthentication(true); + + try { + int result = httpClient.executeMethod(httpGetMethod); + + if (result != HttpStatus.SC_OK) { + if (result < 200 || result > 299) { + throw new HttpException( + "Received status code '" + result + "' on WSDL HTTP (GET) request: '" + url + "'."); + } else { + logger.warn( + "Received status code '" + result + "' on WSDL HTTP (GET) request: '" + url + "'."); + } + } + + return new ByteArrayInputStream(httpGetMethod.getResponseBody()); + } finally { + httpGetMethod.releaseConnection(); + } + } + + public boolean abort() { + isAborted = true; + return true; + } + + public boolean isAborted() { + return isAborted; + } + + public void close() {} +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/JsonUtil.java b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/JsonUtil.java new file mode 100644 index 0000000..f2a4d97 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/JsonUtil.java @@ -0,0 +1,61 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +package org.openo.carbon.bpel.util; + +import java.io.IOException; +import java.io.StringWriter; + +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class JsonUtil { + + @SuppressWarnings("deprecation") + public static String bean2Json(Object obj) throws IOException { + ObjectMapper mapper = new ObjectMapper(); + StringWriter sw = new StringWriter(); + JsonGenerator gen = new JsonFactory().createJsonGenerator(sw); + mapper.writeValue(gen, obj); + gen.close(); + return sw.toString(); + } + + public static T json2Bean(String jsonStr, Class objClass) + throws JsonParseException, JsonMappingException, IOException { + ObjectMapper mapper = new ObjectMapper(); + return mapper.readValue(jsonStr, objClass); + } + + @SuppressWarnings("deprecation") + public static T readJson(String jsonStr, Class collectionClass, Class... elementClasses) + throws Exception { + ObjectMapper mapper = new ObjectMapper(); + JavaType javaType = + mapper.getTypeFactory().constructParametricType(collectionClass, elementClasses); + return mapper.readValue(jsonStr, javaType); + } + + public static JsonNode getJsonNode(String json) throws JsonProcessingException, IOException { + return new ObjectMapper().readTree(json); + } + +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/LRULinkedHashMap.java b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/LRULinkedHashMap.java new file mode 100644 index 0000000..deb07c6 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/LRULinkedHashMap.java @@ -0,0 +1,106 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +package org.openo.carbon.bpel.util; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +/** + * + * @author bsli + * + * @param + * @param + */ +@SuppressWarnings("serial") +public class LRULinkedHashMap extends LinkedHashMap { + private final int maxCapacity; + + private static final float DEFAULT_LOAD_FACTOR = 0.75f; + + private final Lock lock = new ReentrantLock(); + + public LRULinkedHashMap(int maxCapacity) { + super(maxCapacity, DEFAULT_LOAD_FACTOR, true); + this.maxCapacity = maxCapacity; + } + + @Override + protected boolean removeEldestEntry(java.util.Map.Entry eldest) { + return size() > maxCapacity; + } + + @Override + public boolean containsKey(Object key) { + try { + lock.lock(); + return super.containsKey(key); + } finally { + lock.unlock(); + } + } + + @Override + public V get(Object key) { + try { + lock.lock(); + return super.get(key); + } finally { + lock.unlock(); + } + } + + @Override + public V put(K key, V value) { + try { + lock.lock(); + return super.put(key, value); + } finally { + lock.unlock(); + } + } + + public int size() { + try { + lock.lock(); + return super.size(); + } finally { + lock.unlock(); + } + } + + public void clear() { + try { + lock.lock(); + super.clear(); + } finally { + lock.unlock(); + } + } + + public Collection> getAll() { + try { + lock.lock(); + return new ArrayList>(super.entrySet()); + } finally { + lock.unlock(); + } + } +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/SoapUtil.java b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/SoapUtil.java new file mode 100644 index 0000000..6f7bf0d --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/SoapUtil.java @@ -0,0 +1,156 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +package org.openo.carbon.bpel.util; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.naming.ConfigurationException; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.log4j.Logger; + +import com.eviware.soapui.impl.wsdl.WsdlInterface; +import com.eviware.soapui.impl.wsdl.WsdlProject; +import com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader; +import com.eviware.soapui.model.iface.Operation; +import com.eviware.soapui.model.iface.Request; + +public class SoapUtil { + private static final Logger log = Logger.getLogger(SoapUtil.class); + + private DocumentBuilderFactory docBuilderFactory; + private Map wsdls = new LRULinkedHashMap(256); + + public SoapUtil() { + docBuilderFactory = DocumentBuilderFactory.newInstance(); + docBuilderFactory.setNamespaceAware(true); + } + + public Request[] getRequestTemplate(String wsdlUrl) + throws UnsupportedOperationException, IOException { + Request[] requests = new Request[0]; + List requestList = new ArrayList(); + Operation operationInst = null; + WsdlInterface[] wsdlInterfaces = getWsdlInterfaces(wsdlUrl, null); + for (WsdlInterface wsdlInterface : wsdlInterfaces) { + Operation opr = wsdlInterface.getOperationAt(0); + if (opr != null) { + operationInst = opr; + String requestTemplate = operationInst.getRequestAt(0).getRequestContent(); + requestList.add(operationInst.getRequestAt(0)); + } + } + requests = requestList.toArray(new Request[0]); + return requests; + } + + /** + * + * @param wsdl + * @param operation + * @param httpClientProps + * @return + * @throws IOException + * @throws UnsupportedOperationException + */ + private Operation getOperation(String wsdl, String operation, Properties httpClientProps) + throws IOException, UnsupportedOperationException { + WsdlInterface[] wsdlInterfaces = getWsdlInterfaces(wsdl, httpClientProps); + for (WsdlInterface wsdlInterface : wsdlInterfaces) { + Operation operationInst = wsdlInterface.getOperationByName(operation); + + if (operationInst != null) { + return operationInst; + } + } + wsdls.remove(wsdl); + wsdlInterfaces = getWsdlInterfaces(wsdl, httpClientProps); + for (WsdlInterface wsdlInterface : wsdlInterfaces) { + Operation operationInst = wsdlInterface.getOperationByName(operation); + if (operationInst != null) { + return operationInst; + } + } + + throw new UnsupportedOperationException( + "Operation '" + operation + "' not supported by WSDL '" + wsdl + "'."); + } + + /** + * + * @param wsdl + * @param httpClientProps + * @return + * @throws IOException + */ + private WsdlInterface[] getWsdlInterfaces(String wsdl, Properties httpClientProps) + throws IOException { + try { + WsdlInterface[] wsdlInterfaces = wsdls.get(wsdl); + if (wsdlInterfaces == null) { + WsdlProject wsdlProject = new WsdlProject(); + WsdlLoader wsdlLoader = createWsdlLoader(wsdl, httpClientProps); + + wsdlInterfaces = wsdlProject.importWsdl(wsdl, true, wsdlLoader); + + wsdls.put(wsdl, wsdlInterfaces); + } + return wsdlInterfaces; + } catch (Exception e) { + e.printStackTrace(); + log.error(e.getMessage()); + throw new RuntimeException("Failed to import WSDL '" + wsdl + "'."); + } + } + + /** + * + * @param wsdl + * @param httpClientProps + * @return + * @throws ConfigurationException + */ + private WsdlLoader createWsdlLoader(String wsdl, Properties httpClientProps) + throws ConfigurationException { + HttpClient httpClient = new HttpClient(); + return new ClientWsdlLoader(wsdl, httpClient); + } + + public static void main(String[] args) { + SoapUtil soapUtil = new SoapUtil(); + + try { + String url = "http://10.74.151.36:9763/services/initService?wsdl"; + Request[] requestXMLs = soapUtil.getRequestTemplate(url); + + for (Request requestXML : requestXMLs) { + String requestJson = Xml2JsonUtil.xml2JSON(requestXML.getRequestContent()); + System.out.println("===================================="); + System.out.println(requestJson); + } + + } catch (UnsupportedOperationException e1) { + e1.printStackTrace(); + } catch (IOException e1) { + e1.printStackTrace(); + } + } +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/Xml2JsonUtil.java b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/Xml2JsonUtil.java new file mode 100644 index 0000000..7f05a84 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/Xml2JsonUtil.java @@ -0,0 +1,141 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +package org.openo.carbon.bpel.util; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.InputStream; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.sf.json.JSONObject; + +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.input.SAXBuilder; + +public class Xml2JsonUtil { + /** + * transform xml to json + * + * @param xml xml format string + * @return return json string when success; otherwise return null + */ + public static String xml2JSON(String xml) { + JSONObject obj = new JSONObject(); + try { + InputStream is = new ByteArrayInputStream(xml.getBytes("utf-8")); + SAXBuilder sb = new SAXBuilder(); + Document doc = sb.build(is); + Element root = doc.getRootElement(); + obj.put(root.getName(), iterateElement(root)); + return obj.toString(); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * transform xml file to json string + * + * @param file java.io.File is an effective xml file + * @return return json string when success; otherwise return null + */ + public static String xml2JSON(File file) { + JSONObject obj = new JSONObject(); + try { + SAXBuilder sb = new SAXBuilder(); + Document doc = sb.build(file); + Element root = doc.getRootElement(); + obj.put(root.getName(), iterateElement(root)); + return obj.toString(); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * an iteration function + * + * @param parentElement : org.jdom.Element + * @return java.util.Map + */ + @SuppressWarnings({"unchecked", "rawtypes"}) + private static Map iterateElement(Element parentElement) { + List node = parentElement.getChildren(); + Element element = null; + Map map = new HashMap(); + List list = null; + for (int i = 0; i < node.size(); i++) { + element = (Element) node.get(i); + if (element.getTextTrim().equals("")) { + if (element.getChildren().size() == 0) + continue; + if (map.containsKey(element.getName())) { + Object obj = map.get(element.getName()); + if (obj instanceof Map) { + list = new LinkedList(); + list.add(obj); + list.add(iterateElement(element)); + map.remove(element.getName()); + map.put(element.getName(), list); + } else if (obj instanceof List) { + list = (List) obj; + list.add(iterateElement(element)); + } + } else { + map.put(element.getName(), iterateElement(element)); + } + } else { + map.put(element.getName(), element.getTextTrim()); + } + } + return map; + } + + public static void main(String[] args) { + System.out.println(Xml2JsonUtil.xml2JSON("" + "" + "" + + "MapGuideddddddd" + "true" + "" + + "ddd" + "" + "" + "" + "ccc" + + "ggg" + "" + "aaa" + + "" + "" + "" + "" + "" + "33333333" + + "" + "" + "444" + "" + "")); + + String xml = + " fdsafasdfasdf "; + + System.out.println(Xml2JsonUtil.xml2JSON(xml)); + + xml = + " ? "; + + System.out.println(Xml2JsonUtil.xml2JSON(xml)); + + xml = + ""; + + System.out.println(Xml2JsonUtil.xml2JSON(xml)); + + xml = + " 2 112 {\"e\":{\"f\":\"4\"}} ? 2 ? 223 334 2 [{\"b\":1},{\"c\":{\"d\":\"2\"}}}] [{\"a\":3},{\"e\":{\"f\":\"4\"}}}] "; + + System.out.println(Xml2JsonUtil.xml2JSON(xml)); + } +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/META-INF/MANIFEST.MF b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/META-INF/MANIFEST.MF new file mode 100644 index 0000000..eaf90a9 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Created-By: 1.7.0_72 (Oracle Corporation) + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/WEB-INF/web.xml b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/WEB-INF/web.xml new file mode 100644 index 0000000..2a5346c --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + + ZENAP API-DOC. + + ZENAP API-DOC + + + + + index.html + index.xhtml + index.htm + index.jsp + + + + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/css/reset.css b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/css/reset.css new file mode 100644 index 0000000..2e11612 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/css/reset.css @@ -0,0 +1,140 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +/* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */ +html, +body, +div, +span, +applet, +object, +iframe, +h1, +h2, +h3, +h4, +h5, +h6, +p, +blockquote, +pre, +a, +abbr, +acronym, +address, +big, +cite, +code, +del, +dfn, +em, +img, +ins, +kbd, +q, +s, +samp, +small, +strike, +strong, +sub, +sup, +tt, +var, +b, +u, +i, +center, +dl, +dt, +dd, +ol, +ul, +li, +fieldset, +form, +label, +legend, +table, +caption, +tbody, +tfoot, +thead, +tr, +th, +td, +article, +aside, +canvas, +details, +embed, +figure, +figcaption, +footer, +header, +hgroup, +menu, +nav, +output, +ruby, +section, +summary, +time, +mark, +audio, +video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +menu, +nav, +section { + display: block; +} +body { + line-height: 1; +} +ol, +ul { + list-style: none; +} +blockquote, +q { + quotes: none; +} +blockquote:before, +blockquote:after, +q:before, +q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/css/screen.css b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/css/screen.css new file mode 100644 index 0000000..2b982c2 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/css/screen.css @@ -0,0 +1,1271 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +/* Original style from softwaremaniacs.org (c) Ivan Sagalaev */ +.swagger-section pre code { + display: block; + padding: 0.5em; + background: #F0F0F0; +} +.swagger-section pre code, +.swagger-section pre .subst, +.swagger-section pre .tag .title, +.swagger-section pre .lisp .title, +.swagger-section pre .clojure .built_in, +.swagger-section pre .nginx .title { + color: black; +} +.swagger-section pre .string, +.swagger-section pre .title, +.swagger-section pre .constant, +.swagger-section pre .parent, +.swagger-section pre .tag .value, +.swagger-section pre .rules .value, +.swagger-section pre .rules .value .number, +.swagger-section pre .preprocessor, +.swagger-section pre .ruby .symbol, +.swagger-section pre .ruby .symbol .string, +.swagger-section pre .aggregate, +.swagger-section pre .template_tag, +.swagger-section pre .django .variable, +.swagger-section pre .smalltalk .class, +.swagger-section pre .addition, +.swagger-section pre .flow, +.swagger-section pre .stream, +.swagger-section pre .bash .variable, +.swagger-section pre .apache .tag, +.swagger-section pre .apache .cbracket, +.swagger-section pre .tex .command, +.swagger-section pre .tex .special, +.swagger-section pre .erlang_repl .function_or_atom, +.swagger-section pre .markdown .header { + color: #800; +} +.swagger-section pre .comment, +.swagger-section pre .annotation, +.swagger-section pre .template_comment, +.swagger-section pre .diff .header, +.swagger-section pre .chunk, +.swagger-section pre .markdown .blockquote { + color: #888; +} +.swagger-section pre .number, +.swagger-section pre .date, +.swagger-section pre .regexp, +.swagger-section pre .literal, +.swagger-section pre .smalltalk .symbol, +.swagger-section pre .smalltalk .char, +.swagger-section pre .go .constant, +.swagger-section pre .change, +.swagger-section pre .markdown .bullet, +.swagger-section pre .markdown .link_url { + color: #080; +} +.swagger-section pre .label, +.swagger-section pre .javadoc, +.swagger-section pre .ruby .string, +.swagger-section pre .decorator, +.swagger-section pre .filter .argument, +.swagger-section pre .localvars, +.swagger-section pre .array, +.swagger-section pre .attr_selector, +.swagger-section pre .important, +.swagger-section pre .pseudo, +.swagger-section pre .pi, +.swagger-section pre .doctype, +.swagger-section pre .deletion, +.swagger-section pre .envvar, +.swagger-section pre .shebang, +.swagger-section pre .apache .sqbracket, +.swagger-section pre .nginx .built_in, +.swagger-section pre .tex .formula, +.swagger-section pre .erlang_repl .reserved, +.swagger-section pre .prompt, +.swagger-section pre .markdown .link_label, +.swagger-section pre .vhdl .attribute, +.swagger-section pre .clojure .attribute, +.swagger-section pre .coffeescript .property { + color: #8888ff; +} +.swagger-section pre .keyword, +.swagger-section pre .id, +.swagger-section pre .phpdoc, +.swagger-section pre .title, +.swagger-section pre .built_in, +.swagger-section pre .aggregate, +.swagger-section pre .css .tag, +.swagger-section pre .javadoctag, +.swagger-section pre .phpdoc, +.swagger-section pre .yardoctag, +.swagger-section pre .smalltalk .class, +.swagger-section pre .winutils, +.swagger-section pre .bash .variable, +.swagger-section pre .apache .tag, +.swagger-section pre .go .typename, +.swagger-section pre .tex .command, +.swagger-section pre .markdown .strong, +.swagger-section pre .request, +.swagger-section pre .status { + font-weight: bold; +} +.swagger-section pre .markdown .emphasis { + font-style: italic; +} +.swagger-section pre .nginx .built_in { + font-weight: normal; +} +.swagger-section pre .coffeescript .javascript, +.swagger-section pre .javascript .xml, +.swagger-section pre .tex .formula, +.swagger-section pre .xml .javascript, +.swagger-section pre .xml .vbscript, +.swagger-section pre .xml .css, +.swagger-section pre .xml .cdata { + opacity: 0.5; +} +.swagger-section .swagger-ui-wrap { + line-height: 1; + font-family: "Droid Sans", sans-serif; + max-width: 960px; + margin-left: auto; + margin-right: auto; +} +.swagger-section .swagger-ui-wrap b, +.swagger-section .swagger-ui-wrap strong { + font-family: "Droid Sans", sans-serif; + font-weight: bold; +} +.swagger-section .swagger-ui-wrap q, +.swagger-section .swagger-ui-wrap blockquote { + quotes: none; +} +.swagger-section .swagger-ui-wrap p { + line-height: 1.4em; + padding: 0 0 10px; + color: #333333; +} +.swagger-section .swagger-ui-wrap q:before, +.swagger-section .swagger-ui-wrap q:after, +.swagger-section .swagger-ui-wrap blockquote:before, +.swagger-section .swagger-ui-wrap blockquote:after { + content: none; +} +.swagger-section .swagger-ui-wrap .heading_with_menu h1, +.swagger-section .swagger-ui-wrap .heading_with_menu h2, +.swagger-section .swagger-ui-wrap .heading_with_menu h3, +.swagger-section .swagger-ui-wrap .heading_with_menu h4, +.swagger-section .swagger-ui-wrap .heading_with_menu h5, +.swagger-section .swagger-ui-wrap .heading_with_menu h6 { + display: block; + clear: none; + float: left; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + width: 60%; +} +.swagger-section .swagger-ui-wrap table { + border-collapse: collapse; + border-spacing: 0; +} +.swagger-section .swagger-ui-wrap table thead tr th { + padding: 5px; + font-size: 0.9em; + color: #666666; + border-bottom: 1px solid #999999; +} +.swagger-section .swagger-ui-wrap table tbody tr:last-child td { + border-bottom: none; +} +.swagger-section .swagger-ui-wrap table tbody tr.offset { + background-color: #f0f0f0; +} +.swagger-section .swagger-ui-wrap table tbody tr td { + padding: 6px; + font-size: 0.9em; + border-bottom: 1px solid #cccccc; + vertical-align: top; + line-height: 1.3em; +} +.swagger-section .swagger-ui-wrap ol { + margin: 0px 0 10px; + padding: 0 0 0 18px; + list-style-type: decimal; +} +.swagger-section .swagger-ui-wrap ol li { + padding: 5px 0px; + font-size: 0.9em; + color: #333333; +} +.swagger-section .swagger-ui-wrap ol, +.swagger-section .swagger-ui-wrap ul { + list-style: none; +} +.swagger-section .swagger-ui-wrap h1 a, +.swagger-section .swagger-ui-wrap h2 a, +.swagger-section .swagger-ui-wrap h3 a, +.swagger-section .swagger-ui-wrap h4 a, +.swagger-section .swagger-ui-wrap h5 a, +.swagger-section .swagger-ui-wrap h6 a { + text-decoration: none; +} +.swagger-section .swagger-ui-wrap h1 a:hover, +.swagger-section .swagger-ui-wrap h2 a:hover, +.swagger-section .swagger-ui-wrap h3 a:hover, +.swagger-section .swagger-ui-wrap h4 a:hover, +.swagger-section .swagger-ui-wrap h5 a:hover, +.swagger-section .swagger-ui-wrap h6 a:hover { + text-decoration: underline; +} +.swagger-section .swagger-ui-wrap h1 span.divider, +.swagger-section .swagger-ui-wrap h2 span.divider, +.swagger-section .swagger-ui-wrap h3 span.divider, +.swagger-section .swagger-ui-wrap h4 span.divider, +.swagger-section .swagger-ui-wrap h5 span.divider, +.swagger-section .swagger-ui-wrap h6 span.divider { + color: #aaaaaa; +} +.swagger-section .swagger-ui-wrap a { + color: #547f00; +} +.swagger-section .swagger-ui-wrap a img { + border: none; +} +.swagger-section .swagger-ui-wrap article, +.swagger-section .swagger-ui-wrap aside, +.swagger-section .swagger-ui-wrap details, +.swagger-section .swagger-ui-wrap figcaption, +.swagger-section .swagger-ui-wrap figure, +.swagger-section .swagger-ui-wrap footer, +.swagger-section .swagger-ui-wrap header, +.swagger-section .swagger-ui-wrap hgroup, +.swagger-section .swagger-ui-wrap menu, +.swagger-section .swagger-ui-wrap nav, +.swagger-section .swagger-ui-wrap section, +.swagger-section .swagger-ui-wrap summary { + display: block; +} +.swagger-section .swagger-ui-wrap pre { + font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace; + background-color: #fcf6db; + border: 1px solid #e5e0c6; + padding: 10px; +} +.swagger-section .swagger-ui-wrap pre code { + line-height: 1.6em; + background: none; +} +.swagger-section .swagger-ui-wrap .content > .content-type > div > label { + clear: both; + display: block; + color: #0F6AB4; + font-size: 1.1em; + margin: 0; + padding: 15px 0 5px; +} +.swagger-section .swagger-ui-wrap .content pre { + font-size: 12px; + margin-top: 5px; + padding: 5px; +} +.swagger-section .swagger-ui-wrap .icon-btn { + cursor: pointer; +} +.swagger-section .swagger-ui-wrap .info_title { + padding-bottom: 10px; + font-weight: bold; + font-size: 25px; +} +.swagger-section .swagger-ui-wrap p.big, +.swagger-section .swagger-ui-wrap div.big p { + font-size: 1em; + margin-bottom: 10px; +} +.swagger-section .swagger-ui-wrap form.fullwidth ol li.string input, +.swagger-section .swagger-ui-wrap form.fullwidth ol li.url input, +.swagger-section .swagger-ui-wrap form.fullwidth ol li.text textarea, +.swagger-section .swagger-ui-wrap form.fullwidth ol li.numeric input { + width: 500px !important; +} +.swagger-section .swagger-ui-wrap .info_license { + padding-bottom: 5px; +} +.swagger-section .swagger-ui-wrap .info_tos { + padding-bottom: 5px; +} +.swagger-section .swagger-ui-wrap .message-fail { + color: #cc0000; +} +.swagger-section .swagger-ui-wrap .info_url { + padding-bottom: 5px; +} +.swagger-section .swagger-ui-wrap .info_email { + padding-bottom: 5px; +} +.swagger-section .swagger-ui-wrap .info_name { + padding-bottom: 5px; +} +.swagger-section .swagger-ui-wrap .info_description { + padding-bottom: 10px; + font-size: 15px; +} +.swagger-section .swagger-ui-wrap .markdown ol li, +.swagger-section .swagger-ui-wrap .markdown ul li { + padding: 3px 0px; + line-height: 1.4em; + color: #333333; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.string input, +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.url input, +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.numeric input { + display: block; + padding: 4px; + width: auto; + clear: both; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.string input.title, +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.url input.title, +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.numeric input.title { + font-size: 1.3em; +} +.swagger-section .swagger-ui-wrap table.fullwidth { + width: 100%; +} +.swagger-section .swagger-ui-wrap .model-signature { + font-family: "Droid Sans", sans-serif; + font-size: 1em; + line-height: 1.5em; +} +.swagger-section .swagger-ui-wrap .model-signature .signature-nav a { + text-decoration: none; + color: #AAA; +} +.swagger-section .swagger-ui-wrap .model-signature .signature-nav a:hover { + text-decoration: underline; + color: black; +} +.swagger-section .swagger-ui-wrap .model-signature .signature-nav .selected { + color: black; + text-decoration: none; +} +.swagger-section .swagger-ui-wrap .model-signature .propType { + color: #5555aa; +} +.swagger-section .swagger-ui-wrap .model-signature pre:hover { + background-color: #ffffdd; +} +.swagger-section .swagger-ui-wrap .model-signature pre { + font-size: .85em; + line-height: 1.2em; + overflow: auto; + max-height: 200px; + cursor: pointer; +} +.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav { + display: block; + margin: 0; + padding: 0; +} +.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav li:last-child { + padding-right: 0; + border-right: none; +} +.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav li { + float: left; + margin: 0 5px 5px 0; + padding: 2px 5px 2px 0; + border-right: 1px solid #ddd; +} +.swagger-section .swagger-ui-wrap .model-signature .propOpt { + color: #555; +} +.swagger-section .swagger-ui-wrap .model-signature .snippet small { + font-size: 0.75em; +} +.swagger-section .swagger-ui-wrap .model-signature .propOptKey { + font-style: italic; +} +.swagger-section .swagger-ui-wrap .model-signature .description .strong { + font-weight: bold; + color: #000; + font-size: .9em; +} +.swagger-section .swagger-ui-wrap .model-signature .description div { + font-size: 0.9em; + line-height: 1.5em; + margin-left: 1em; +} +.swagger-section .swagger-ui-wrap .model-signature .description .stronger { + font-weight: bold; + color: #000; +} +.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper { + border-spacing: 0; + position: absolute; + background-color: #ffffff; + border: 1px solid #bbbbbb; + display: none; + font-size: 11px; + max-width: 400px; + line-height: 30px; + color: black; + padding: 5px; + margin-left: 10px; +} +.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper th { + text-align: center; + background-color: #eeeeee; + border: 1px solid #bbbbbb; + font-size: 11px; + color: #666666; + font-weight: bold; + padding: 5px; + line-height: 15px; +} +.swagger-section .swagger-ui-wrap .model-signature .description .propWrap .optionsWrapper .optionName { + font-weight: bold; +} +.swagger-section .swagger-ui-wrap .model-signature .propName { + font-weight: bold; +} +.swagger-section .swagger-ui-wrap .model-signature .signature-container { + clear: both; +} +.swagger-section .swagger-ui-wrap .body-textarea { + width: 300px; + height: 100px; + border: 1px solid #aaa; +} +.swagger-section .swagger-ui-wrap .markdown p code, +.swagger-section .swagger-ui-wrap .markdown li code { + font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace; + background-color: #f0f0f0; + color: black; + padding: 1px 3px; +} +.swagger-section .swagger-ui-wrap .required { + font-weight: bold; +} +.swagger-section .swagger-ui-wrap input.parameter { + width: 300px; + border: 1px solid #aaa; +} +.swagger-section .swagger-ui-wrap h1 { + color: black; + font-size: 1.5em; + line-height: 1.3em; + padding: 10px 0 10px 0; + font-family: "Droid Sans", sans-serif; + font-weight: bold; +} +.swagger-section .swagger-ui-wrap .heading_with_menu { + float: none; + clear: both; + overflow: hidden; + display: block; +} +.swagger-section .swagger-ui-wrap .heading_with_menu ul { + display: block; + clear: none; + float: right; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + margin-top: 10px; +} +.swagger-section .swagger-ui-wrap h2 { + color: black; + font-size: 1.3em; + padding: 10px 0 10px 0; +} +.swagger-section .swagger-ui-wrap h2 a { + color: black; +} +.swagger-section .swagger-ui-wrap h2 span.sub { + font-size: 0.7em; + color: #999999; + font-style: italic; +} +.swagger-section .swagger-ui-wrap h2 span.sub a { + color: #777777; +} +.swagger-section .swagger-ui-wrap span.weak { + color: #666666; +} +.swagger-section .swagger-ui-wrap .message-success { + color: #89BF04; +} +.swagger-section .swagger-ui-wrap caption, +.swagger-section .swagger-ui-wrap th, +.swagger-section .swagger-ui-wrap td { + text-align: left; + font-weight: normal; + vertical-align: middle; +} +.swagger-section .swagger-ui-wrap .code { + font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.text textarea { + font-family: "Droid Sans", sans-serif; + height: 250px; + padding: 4px; + display: block; + clear: both; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.select select { + display: block; + clear: both; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean { + float: none; + clear: both; + overflow: hidden; + display: block; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean label { + display: block; + float: left; + clear: none; + margin: 0; + padding: 0; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.boolean input { + display: block; + float: left; + clear: none; + margin: 0 5px 0 0; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li.required label { + color: black; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li label { + display: block; + clear: both; + width: auto; + padding: 0 0 3px; + color: #666666; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li label abbr { + padding-left: 3px; + color: #888888; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.inputs ol li p.inline-hints { + margin-left: 0; + font-style: italic; + font-size: 0.9em; + margin: 0; +} +.swagger-section .swagger-ui-wrap form.formtastic fieldset.buttons { + margin: 0; + padding: 0; +} +.swagger-section .swagger-ui-wrap span.blank, +.swagger-section .swagger-ui-wrap span.empty { + color: #888888; + font-style: italic; +} +.swagger-section .swagger-ui-wrap .markdown h3 { + color: #547f00; +} +.swagger-section .swagger-ui-wrap .markdown h4 { + color: #666666; +} +.swagger-section .swagger-ui-wrap .markdown pre { + font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace; + background-color: #fcf6db; + border: 1px solid #e5e0c6; + padding: 10px; + margin: 0 0 10px 0; +} +.swagger-section .swagger-ui-wrap .markdown pre code { + line-height: 1.6em; +} +.swagger-section .swagger-ui-wrap div.gist { + margin: 20px 0 25px 0 !important; +} +.swagger-section .swagger-ui-wrap ul#resources { + font-family: "Droid Sans", sans-serif; + font-size: 0.9em; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource { + border-bottom: 1px solid #dddddd; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource:hover div.heading h2 a, +.swagger-section .swagger-ui-wrap ul#resources li.resource.active div.heading h2 a { + color: black; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource:hover div.heading ul.options li a, +.swagger-section .swagger-ui-wrap ul#resources li.resource.active div.heading ul.options li a { + color: #555555; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource:last-child { + border-bottom: none; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading { + border: 1px solid transparent; + float: none; + clear: both; + overflow: hidden; + display: block; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options { + overflow: hidden; + padding: 0; + display: block; + clear: none; + float: right; + margin: 14px 10px 0 0; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li { + float: left; + clear: none; + margin: 0; + padding: 2px 10px; + border-right: 1px solid #dddddd; + color: #666666; + font-size: 0.9em; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a { + color: #aaaaaa; + text-decoration: none; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:hover { + text-decoration: underline; + color: black; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:hover, +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a:active, +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li a.active { + text-decoration: underline; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li:first-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li.first { + padding-left: 0; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li:last-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options li.last { + padding-right: 0; + border-right: none; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options:first-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading ul.options.first { + padding-left: 0; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 { + color: #999999; + padding-left: 0; + display: block; + clear: none; + float: left; + font-family: "Droid Sans", sans-serif; + font-weight: bold; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a { + color: #999999; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource div.heading h2 a:hover { + color: black; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation { + float: none; + clear: both; + overflow: hidden; + display: block; + margin: 0 0 10px; + padding: 0; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading { + float: none; + clear: both; + overflow: hidden; + display: block; + margin: 0; + padding: 0; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 { + display: block; + clear: none; + float: left; + width: auto; + margin: 0; + padding: 0; + line-height: 1.1em; + color: black; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path { + padding-left: 10px; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a { + color: black; + text-decoration: none; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a:hover { + text-decoration: underline; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.http_method a { + text-transform: uppercase; + text-decoration: none; + color: white; + display: inline-block; + width: 50px; + font-size: 0.7em; + text-align: center; + padding: 7px 0 4px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + -o-border-radius: 2px; + -ms-border-radius: 2px; + -khtml-border-radius: 2px; + border-radius: 2px; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span { + margin: 0; + padding: 0; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options { + overflow: hidden; + padding: 0; + display: block; + clear: none; + float: right; + margin: 6px 10px 0 0; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li { + float: left; + clear: none; + margin: 0; + padding: 2px 10px; + font-size: 0.9em; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li a { + text-decoration: none; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading ul.options li.access { + color: black; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content { + border-top: none; + padding: 10px; + -moz-border-radius-bottomleft: 6px; + -webkit-border-bottom-left-radius: 6px; + -o-border-bottom-left-radius: 6px; + -ms-border-bottom-left-radius: 6px; + -khtml-border-bottom-left-radius: 6px; + border-bottom-left-radius: 6px; + -moz-border-radius-bottomright: 6px; + -webkit-border-bottom-right-radius: 6px; + -o-border-bottom-right-radius: 6px; + -ms-border-bottom-right-radius: 6px; + -khtml-border-bottom-right-radius: 6px; + border-bottom-right-radius: 6px; + margin: 0 0 20px; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content h4 { + font-size: 1.1em; + margin: 0; + padding: 15px 0 5px; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header { + float: none; + clear: both; + overflow: hidden; + display: block; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header a { + padding: 4px 0 0 10px; + display: inline-block; + font-size: 0.9em; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header input.submit { + display: block; + clear: none; + float: left; + padding: 6px 8px; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.sandbox_header span.response_throbber { + background-image: url('../images/throbber.gif'); + width: 128px; + height: 16px; + display: block; + clear: none; + float: right; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content form input[type='text'].error { + outline: 2px solid black; + outline-color: #cc0000; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.content div.response div.block pre { + font-family: "Anonymous Pro", "Menlo", "Consolas", "Bitstream Vera Sans Mono", "Courier New", monospace; + padding: 10px; + font-size: 0.9em; + max-height: 400px; + overflow-y: auto; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading { + background-color: #f9f2e9; + border: 1px solid #f0e0ca; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading h3 span.http_method a { + background-color: #c5862b; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li { + border-right: 1px solid #dddddd; + border-right-color: #f0e0ca; + color: #c5862b; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li a { + color: #c5862b; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content { + background-color: #faf5ee; + border: 1px solid #f0e0ca; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content h4 { + color: #c5862b; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content div.sandbox_header a { + color: #dcb67f; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading { + background-color: #fcffcd; + border: 1px solid black; + border-color: #ffd20f; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading h3 span.http_method a { + text-transform: uppercase; + background-color: #ffd20f; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li { + border-right: 1px solid #dddddd; + border-right-color: #ffd20f; + color: #ffd20f; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li a { + color: #ffd20f; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content { + background-color: #fcffcd; + border: 1px solid black; + border-color: #ffd20f; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content h4 { + color: #ffd20f; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content div.sandbox_header a { + color: #6fc992; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading { + background-color: #f5e8e8; + border: 1px solid #e8c6c7; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading h3 span.http_method a { + text-transform: uppercase; + background-color: #a41e22; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li { + border-right: 1px solid #dddddd; + border-right-color: #e8c6c7; + color: #a41e22; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li a { + color: #a41e22; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content { + background-color: #f7eded; + border: 1px solid #e8c6c7; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content h4 { + color: #a41e22; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content div.sandbox_header a { + color: #c8787a; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading { + background-color: #e7f6ec; + border: 1px solid #c3e8d1; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading h3 span.http_method a { + background-color: #10a54a; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li { + border-right: 1px solid #dddddd; + border-right-color: #c3e8d1; + color: #10a54a; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li a { + color: #10a54a; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content { + background-color: #ebf7f0; + border: 1px solid #c3e8d1; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content h4 { + color: #10a54a; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content div.sandbox_header a { + color: #6fc992; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading { + background-color: #FCE9E3; + border: 1px solid #F5D5C3; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading h3 span.http_method a { + background-color: #D38042; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li { + border-right: 1px solid #dddddd; + border-right-color: #f0cecb; + color: #D38042; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li a { + color: #D38042; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content { + background-color: #faf0ef; + border: 1px solid #f0cecb; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content h4 { + color: #D38042; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content div.sandbox_header a { + color: #dcb67f; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading { + background-color: #e7f0f7; + border: 1px solid #c3d9ec; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading h3 span.http_method a { + background-color: #0f6ab4; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li { + border-right: 1px solid #dddddd; + border-right-color: #c3d9ec; + color: #0f6ab4; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li a { + color: #0f6ab4; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content { + background-color: #ebf3f9; + border: 1px solid #c3d9ec; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content h4 { + color: #0f6ab4; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content div.sandbox_header a { + color: #6fa5d2; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading { + background-color: #e7f0f7; + border: 1px solid #c3d9ec; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading h3 span.http_method a { + background-color: #0f6ab4; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading ul.options li { + border-right: 1px solid #dddddd; + border-right-color: #c3d9ec; + color: #0f6ab4; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.heading ul.options li a { + color: #0f6ab4; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content { + background-color: #ebf3f9; + border: 1px solid #c3d9ec; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content h4 { + color: #0f6ab4; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.options div.content div.sandbox_header a { + color: #6fa5d2; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.content, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.content, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.content, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.content, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.content, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.content { + border-top: none; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li:last-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li:last-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li:last-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li:last-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li:last-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li:last-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.get div.heading ul.options li.last, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.post div.heading ul.options li.last, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.head div.heading ul.options li.last, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.put div.heading ul.options li.last, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.patch div.heading ul.options li.last, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation.delete div.heading ul.options li.last { + padding-right: 0; + border-right: none; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:hover, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a:active, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li a.active { + text-decoration: underline; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li:first-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations ul.options li.first { + padding-left: 0; +} +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations:first-child, +.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations.first { + padding-left: 0; +} +.swagger-section .swagger-ui-wrap p#colophon { + margin: 0 15px 40px 15px; + padding: 10px 0; + font-size: 0.8em; + border-top: 1px solid #dddddd; + font-family: "Droid Sans", sans-serif; + color: #999999; + font-style: italic; +} +.swagger-section .swagger-ui-wrap p#colophon a { + text-decoration: none; + color: #547f00; +} +.swagger-section .swagger-ui-wrap h3 { + color: black; + font-size: 1.1em; + padding: 10px 0 10px 0; +} +.swagger-section .swagger-ui-wrap .markdown ol, +.swagger-section .swagger-ui-wrap .markdown ul { + font-family: "Droid Sans", sans-serif; + margin: 5px 0 10px; + padding: 0 0 0 18px; + list-style-type: disc; +} +.swagger-section .swagger-ui-wrap form.form_box { + background-color: #ebf3f9; + border: 1px solid #c3d9ec; + padding: 10px; +} +.swagger-section .swagger-ui-wrap form.form_box label { + color: #0f6ab4 !important; +} +.swagger-section .swagger-ui-wrap form.form_box input[type=submit] { + display: block; + padding: 10px; +} +.swagger-section .swagger-ui-wrap form.form_box p.weak { + font-size: 0.8em; +} +.swagger-section .swagger-ui-wrap form.form_box p { + font-size: 0.9em; + padding: 0 0 15px; + color: #7e7b6d; +} +.swagger-section .swagger-ui-wrap form.form_box p a { + color: #646257; +} +.swagger-section .swagger-ui-wrap form.form_box p strong { + color: black; +} +.swagger-section .title { + font-style: bold; +} +.swagger-section .secondary_form { + display: none; +} +.swagger-section .main_image { + display: block; + margin-left: auto; + margin-right: auto; +} +.swagger-section .oauth_body { + margin-left: 100px; + margin-right: 100px; +} +.swagger-section .oauth_submit { + text-align: center; +} +.swagger-section .api-popup-dialog { + z-index: 10000; + position: absolute; + width: 500px; + background: #FFF; + padding: 20px; + border: 1px solid #ccc; + border-radius: 5px; + display: none; + font-size: 13px; + color: #777; +} +.swagger-section .api-popup-dialog .api-popup-title { + font-size: 24px; + padding: 10px 0; +} +.swagger-section .api-popup-dialog .api-popup-title { + font-size: 24px; + padding: 10px 0; +} +.swagger-section .api-popup-dialog p.error-msg { + padding-left: 5px; + padding-bottom: 5px; +} +.swagger-section .api-popup-dialog button.api-popup-authbtn { + height: 30px; +} +.swagger-section .api-popup-dialog button.api-popup-cancel { + height: 30px; +} +.swagger-section .api-popup-scopes { + padding: 10px 20px; +} +.swagger-section .api-popup-scopes li { + padding: 5px 0; + line-height: 20px; +} +.swagger-section .api-popup-scopes .api-scope-desc { + padding-left: 20px; + font-style: italic; +} +.swagger-section .api-popup-scopes li input { + position: relative; + top: 2px; +} +.swagger-section .api-popup-actions { + padding-top: 10px; +} +.swagger-section .access { + float: right; +} +.swagger-section .auth { + float: right; +} +.swagger-section #api_information_panel { + position: absolute; + background: #FFF; + border: 1px solid #ccc; + border-radius: 5px; + display: none; + font-size: 13px; + max-width: 300px; + line-height: 30px; + color: black; + padding: 5px; +} +.swagger-section #api_information_panel p .api-msg-enabled { + color: green; +} +.swagger-section #api_information_panel p .api-msg-disabled { + color: red; +} +.swagger-section .api-ic { + height: 18px; + vertical-align: middle; + display: inline-block; + background: url(../images/explorer_icons.png) no-repeat; +} +.swagger-section .ic-info { + background-position: 0 0; + width: 18px; + margin-top: -7px; + margin-left: 4px; +} +.swagger-section .ic-warning { + background-position: -60px 0; + width: 18px; + margin-top: -7px; + margin-left: 4px; +} +.swagger-section .ic-error { + background-position: -30px 0; + width: 18px; + margin-top: -7px; + margin-left: 4px; +} +.swagger-section .ic-off { + background-position: -90px 0; + width: 58px; + margin-top: -4px; + cursor: pointer; +} +.swagger-section .ic-on { + background-position: -160px 0; + width: 58px; + margin-top: -4px; + cursor: pointer; +} +.swagger-section #header { + background-color: #89bf04; + padding: 14px; +} +.swagger-section #header a#logo { + font-size: 1.5em; + font-weight: bold; + text-decoration: none; + background: transparent url(../images/logo_small.png) no-repeat left center; + padding: 20px 0 20px 40px; + color: white; +} +.swagger-section #header form#api_selector { + display: block; + clear: none; + float: right; +} +.swagger-section #header form#api_selector .input { + display: block; + clear: none; + float: left; + margin: 0 10px 0 0; +} +.swagger-section #header form#api_selector .input input#input_apiKey { + width: 200px; +} +.swagger-section #header form#api_selector .input input#input_baseUrl { + width: 400px; +} +.swagger-section #header form#api_selector .input a#explore { + display: block; + text-decoration: none; + font-weight: bold; + padding: 6px 8px; + font-size: 0.9em; + color: white; + background-color: #547f00; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + -o-border-radius: 4px; + -ms-border-radius: 4px; + -khtml-border-radius: 4px; + border-radius: 4px; +} +.swagger-section #header form#api_selector .input a#explore:hover { + background-color: #547f00; +} +.swagger-section #header form#api_selector .input input { + font-size: 0.9em; + padding: 3px; + margin: 0; +} +.swagger-section #content_message { + margin: 10px 15px; + font-style: italic; + color: #999999; +} +.swagger-section #message-bar { + min-height: 30px; + text-align: center; + padding-top: 10px; +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/css/typography.css b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/css/typography.css new file mode 100644 index 0000000..991427a --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/css/typography.css @@ -0,0 +1,41 @@ +/** + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +/* droid-sans-regular - latin */ +@font-face { + font-family: 'Droid Sans'; + font-style: normal; + font-weight: 400; + src: url('../fonts/droid-sans-v6-latin-regular.eot'); /* IE9 Compat Modes */ + src: local('Droid Sans'), local('DroidSans'), + url('../fonts/droid-sans-v6-latin-regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ + url('../fonts/droid-sans-v6-latin-regular.woff2') format('woff2'), /* Super Modern Browsers */ + url('../fonts/droid-sans-v6-latin-regular.woff') format('woff'), /* Modern Browsers */ + url('../fonts/droid-sans-v6-latin-regular.ttf') format('truetype'), /* Safari, Android, iOS */ + url('../fonts/droid-sans-v6-latin-regular.svg#DroidSans') format('svg'); /* Legacy iOS */ +} +/* droid-sans-700 - latin */ +@font-face { + font-family: 'Droid Sans'; + font-style: normal; + font-weight: 700; + src: url('../fonts/droid-sans-v6-latin-700.eot'); /* IE9 Compat Modes */ + src: local('Droid Sans Bold'), local('DroidSans-Bold'), + url('../fonts/droid-sans-v6-latin-700.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ + url('../fonts/droid-sans-v6-latin-700.woff2') format('woff2'), /* Super Modern Browsers */ + url('../fonts/droid-sans-v6-latin-700.woff') format('woff'), /* Modern Browsers */ + url('../fonts/droid-sans-v6-latin-700.ttf') format('truetype'), /* Safari, Android, iOS */ + url('../fonts/droid-sans-v6-latin-700.svg#DroidSans') format('svg'); /* Legacy iOS */ +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.eot b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.eot new file mode 100644 index 0000000..2250b71 Binary files /dev/null and b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.eot differ diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.svg b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.svg new file mode 100644 index 0000000..a54bbbb --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.svg @@ -0,0 +1,411 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.ttf b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.ttf new file mode 100644 index 0000000..523cb92 Binary files /dev/null and b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.ttf differ diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.woff b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.woff new file mode 100644 index 0000000..67e3e25 Binary files /dev/null and b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.woff differ diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.woff2 b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.woff2 new file mode 100644 index 0000000..1e726a7 Binary files /dev/null and b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.woff2 differ diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.eot b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.eot new file mode 100644 index 0000000..ac2698e Binary files /dev/null and b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.eot differ diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.svg b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.svg new file mode 100644 index 0000000..d9f2a21 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.svg @@ -0,0 +1,403 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.ttf b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.ttf new file mode 100644 index 0000000..76aede2 Binary files /dev/null and b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.ttf differ diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.woff b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.woff new file mode 100644 index 0000000..abf1989 Binary files /dev/null and b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.woff differ diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.woff2 b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.woff2 new file mode 100644 index 0000000..9f93f74 Binary files /dev/null and b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.woff2 differ diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/explorer_icons.png b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/explorer_icons.png new file mode 100644 index 0000000..ed9d2ff Binary files /dev/null and b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/explorer_icons.png differ diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/logo_small.png b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/logo_small.png new file mode 100644 index 0000000..5496a65 Binary files /dev/null and b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/logo_small.png differ diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/pet_store_api.png b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/pet_store_api.png new file mode 100644 index 0000000..f9f9cd4 Binary files /dev/null and b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/pet_store_api.png differ diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/throbber.gif b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/throbber.gif new file mode 100644 index 0000000..0639388 Binary files /dev/null and b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/throbber.gif differ diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/wordnik_api.png b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/wordnik_api.png new file mode 100644 index 0000000..dca4f14 Binary files /dev/null and b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/wordnik_api.png differ diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/index.html b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/index.html new file mode 100644 index 0000000..b195a05 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/index.html @@ -0,0 +1,115 @@ + + + + + Swagger UI + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
+
+ + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/backbone-min.js b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/backbone-min.js new file mode 100644 index 0000000..c66d3a5 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/backbone-min.js @@ -0,0 +1,30 @@ +/* + * Copyright 2016 ZTE Corporation. + * + * 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. + */ +// Backbone.js 1.1.2 + +(function(t,e){if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,r,s){t.Backbone=e(t,s,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore");e(t,exports,i)}else{t.Backbone=e(t,{},t._,t.jQuery||t.Zepto||t.ender||t.$)}})(this,function(t,e,i,r){var s=t.Backbone;var n=[];var a=n.push;var o=n.slice;var h=n.splice;e.VERSION="1.1.2";e.$=r;e.noConflict=function(){t.Backbone=s;return this};e.emulateHTTP=false;e.emulateJSON=false;var u=e.Events={on:function(t,e,i){if(!c(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);r.push({callback:e,context:i,ctx:i||this});return this},once:function(t,e,r){if(!c(this,"once",t,[e,r])||!e)return this;var s=this;var n=i.once(function(){s.off(t,n);e.apply(this,arguments)});n._callback=e;return this.on(t,n,r)},off:function(t,e,r){var s,n,a,o,h,u,l,f;if(!this._events||!c(this,"off",t,[e,r]))return this;if(!t&&!e&&!r){this._events=void 0;return this}o=t?[t]:i.keys(this._events);for(h=0,u=o.length;h").attr(t);this.setElement(r,false)}else{this.setElement(i.result(this,"el"),false)}}});e.sync=function(t,r,s){var n=T[t];i.defaults(s||(s={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:n,dataType:"json"};if(!s.url){a.url=i.result(r,"url")||M()}if(s.data==null&&r&&(t==="create"||t==="update"||t==="patch")){a.contentType="application/json";a.data=JSON.stringify(s.attrs||r.toJSON(s))}if(s.emulateJSON){a.contentType="application/x-www-form-urlencoded";a.data=a.data?{model:a.data}:{}}if(s.emulateHTTP&&(n==="PUT"||n==="DELETE"||n==="PATCH")){a.type="POST";if(s.emulateJSON)a.data._method=n;var o=s.beforeSend;s.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",n);if(o)return o.apply(this,arguments)}}if(a.type!=="GET"&&!s.emulateJSON){a.processData=false}if(a.type==="PATCH"&&k){a.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}var h=s.xhr=e.ajax(i.extend(a,s));r.trigger("request",r,h,s);return h};var k=typeof window!=="undefined"&&!!window.ActiveXObject&&!(window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent);var T={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var $=e.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var S=/\((.*?)\)/g;var H=/(\(\?)?:\w+/g;var A=/\*\w+/g;var I=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend($.prototype,u,{initialize:function(){},route:function(t,r,s){if(!i.isRegExp(t))t=this._routeToRegExp(t);if(i.isFunction(r)){s=r;r=""}if(!s)s=this[r];var n=this;e.history.route(t,function(i){var a=n._extractParameters(t,i);n.execute(s,a);n.trigger.apply(n,["route:"+r].concat(a));n.trigger("route",r,a);e.history.trigger("route",n,r,a)});return this},execute:function(t,e){if(t)t.apply(this,e)},navigate:function(t,i){e.history.navigate(t,i);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=i.result(this,"routes");var t,e=i.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(I,"\\$&").replace(S,"(?:$1)?").replace(H,function(t,e){return e?t:"([^/?]+)"}).replace(A,"([^?]*?)");return new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var r=t.exec(e).slice(1);return i.map(r,function(t,e){if(e===r.length-1)return t||null;return t?decodeURIComponent(t):null})}});var N=e.History=function(){this.handlers=[];i.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var R=/^[#\/]|\s+$/g;var O=/^\/+|\/+$/g;var P=/msie [\w.]+/;var C=/\/$/;var j=/#.*$/;N.started=false;i.extend(N.prototype,u,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(t==null){if(this._hasPushState||!this._wantsHashChange||e){t=decodeURI(this.location.pathname+this.location.search);var i=this.root.replace(C,"");if(!t.indexOf(i))t=t.slice(i.length)}else{t=this.getHash()}}return t.replace(R,"")},start:function(t){if(N.started)throw new Error("Backbone.history has already been started");N.started=true;this.options=i.extend({root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var r=this.getFragment();var s=document.documentMode;var n=P.exec(navigator.userAgent.toLowerCase())&&(!s||s<=7);this.root=("/"+this.root+"/").replace(O,"/");if(n&&this._wantsHashChange){var a=e.$('