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 --- .../wso2bpel-core/BPEL4RESTLight/pom.xml | 181 ++ .../Bpel4RestLightExtensionBundle.java | 48 + .../bpel4restlight/Bpel4RestLightOperation.java | 147 + .../bpel4restlight/EPRDemoOperation.java | 74 + .../extensions/bpel4restlight/MethodAttribute.java | 17 + .../bpel4restlight/util/Bpel4RestLightUtil.java | 113 + .../iaas/bpel/util/BPELVariableInjectionUtil.java | 149 + .../de/unistuttgart/iaas/bpel/util/BpelUtil.java | 102 + .../de/unistuttgart/iaas/xml/DomXmlConverter.java | 179 ++ .../de/unistuttgart/iaas/xml/XPathEvaluator.java | 34 + .../bpel4restlight/rest/HighLevelRestApi.java | 178 ++ .../opentosca/bpel4restlight/rest/HttpMethod.java | 20 + .../bpel4restlight/rest/HttpResponseMessage.java | 53 + .../bpel4restlight/rest/LowLevelRestApi.java | 182 ++ .../wso2bpel-core/distribution/pom.xml | 34 + .../wso2bpel-core/distribution/standalone/pom.xml | 401 +++ .../standalone/src/main/assembly/initDB.sh | 53 + .../standalone/src/main/assembly/run.bat | 32 + .../standalone/src/main/assembly/run.sh | 32 + .../standalone/src/main/assembly/stop.bat | 28 + .../standalone/src/main/assembly/stop.sh | 30 + .../assembly/wso2bps-ext/bin/find_kill_process.bat | 24 + .../src/main/assembly/wso2bps-ext/bin/shutdown.bat | 34 + .../src/main/assembly/wso2bps-ext/bin/shutdown.sh | 61 + .../src/main/assembly/wso2bps-ext/bin/startup.bat | 42 + .../src/main/assembly/wso2bps-ext/bin/startup.sh | 36 + .../main/assembly/wso2bps-ext/conf/wso2bpel.yml | 73 + .../assembly/wso2bps/bin/find_kill_process.bat | 23 + .../src/main/assembly/wso2bps/bin/shutdown.bat | 34 + .../src/main/assembly/wso2bps/bin/shutdown.sh | 44 + .../wso2bps/dbscripts/bps/bpel/create/mysql.sql | 170 + .../bps/bpel/create/wso-bpel-mysql-createdb.sql | 31 + .../main/assembly/wso2bps/repository/conf/bps.xml | 174 + .../wso2bps/repository/conf/carbon/bps.xml | 174 + .../wso2bps/repository/conf/carbon/carbon.xml | 683 ++++ .../conf/datasources/activiti-datasources.xml | 32 + .../conf/datasources/bps-datasources.xml | 32 + .../conf/datasources/master-datasources.xml | 68 + .../main/assembly/wso2bps/wso2bps-ext.properties | 1 + wso2/wso2bpel-ext/wso2bpel-core/pom.xml | 36 + .../wso2bpel-core/wso2bpel-mgr/pom.xml | 453 +++ .../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 + 99 files changed, 19584 insertions(+) create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/pom.xml create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/Bpel4RestLightExtensionBundle.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/Bpel4RestLightOperation.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/EPRDemoOperation.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/MethodAttribute.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/util/Bpel4RestLightUtil.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/util/BPELVariableInjectionUtil.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/util/BpelUtil.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/xml/DomXmlConverter.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/xml/XPathEvaluator.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/HighLevelRestApi.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/HttpMethod.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/HttpResponseMessage.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/LowLevelRestApi.java create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/pom.xml create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/pom.xml create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/initDB.sh create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/run.bat create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/run.sh create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/stop.bat create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/stop.sh create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/find_kill_process.bat create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/shutdown.bat create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/shutdown.sh create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/startup.bat create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/startup.sh create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/conf/wso2bpel.yml create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/bin/find_kill_process.bat create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/bin/shutdown.bat create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/bin/shutdown.sh create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/dbscripts/bps/bpel/create/mysql.sql create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/dbscripts/bps/bpel/create/wso-bpel-mysql-createdb.sql create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/bps.xml create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/carbon/bps.xml create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/carbon/carbon.xml create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/datasources/activiti-datasources.xml create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/datasources/bps-datasources.xml create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/datasources/master-datasources.xml create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/wso2bps-ext.properties create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/pom.xml create mode 100644 wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/pom.xml 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') diff --git a/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/pom.xml b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/pom.xml new file mode 100644 index 0000000..3f81980 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/pom.xml @@ -0,0 +1,181 @@ + + + + 4.0.0 + + + org.openo.common-services.common-utilities.wso2bpel-ext + wso2bpel-core-parent + 1.1.0-SNAPSHOT + + + BPEL4RESTLight + common-services-common-utilities/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight + + jar + + + 4.4.1 + + + + + wso2-nexus + http://dist.wso2.org/maven2 + + true + + + false + + + + + + + bpel4rest + + + + com.mycila + license-maven-plugin + + + ** + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + false + + ** + + + + + + + + + + commons-codec + commons-codec + 1.3 + compile + + + commons-httpclient + commons-httpclient + 3.0-rc4 + + + commons-logging + commons-logging + 1.0.3 + + + org.apache.httpcomponents + httpcore + ${httpclient.version} + + + + + org.wso2.bpel + ode-bpel-api + 1.3.5-wso2v4 + + + + org.wso2.bpel + ode-bpel-obj + 1.3.5-wso2v4 + + + + org.wso2.bpel + ode-bpel-runtime + 1.3.5-wso2v4 + + + + + com.googlecode.json-simple + json-simple + 1.1.1 + + + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/Bpel4RestLightExtensionBundle.java b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/Bpel4RestLightExtensionBundle.java new file mode 100644 index 0000000..88ac53e --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/Bpel4RestLightExtensionBundle.java @@ -0,0 +1,48 @@ +/** + * Copyright 2011 IAAS University of Stuttgart
+ *
+ * + * @author uwe.breitenbuecher@iaas.uni-stuttgart.de + * + */ +/** + * 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 de.unistuttgart.iaas.bpel.extensions.bpel4restlight; + +import org.apache.ode.bpel.runtime.extension.AbstractExtensionBundle; + + +public class Bpel4RestLightExtensionBundle extends AbstractExtensionBundle { + + public static final String NAMESPACE = "http://iaas.uni-stuttgart.de/bpel/extensions/bpel4restlight"; + + + /** {@inheritDoc} */ + @Override + public String getNamespaceURI() { + return NAMESPACE; + } + + /** {@inheritDoc} */ + @Override + public void registerExtensionActivities() { + super.registerExtensionOperation("logNodes", EPRDemoOperation.class); + super.registerExtensionOperation("PUT", Bpel4RestLightOperation.class); + super.registerExtensionOperation("GET", Bpel4RestLightOperation.class); + super.registerExtensionOperation("POST", Bpel4RestLightOperation.class); + super.registerExtensionOperation("DELETE", Bpel4RestLightOperation.class); + } +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/Bpel4RestLightOperation.java b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/Bpel4RestLightOperation.java new file mode 100644 index 0000000..2335f49 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/Bpel4RestLightOperation.java @@ -0,0 +1,147 @@ +package de.unistuttgart.iaas.bpel.extensions.bpel4restlight; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.Properties; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.ode.bpel.common.FaultException; +import org.apache.ode.bpel.runtime.extension.AbstractSyncExtensionOperation; +import org.apache.ode.bpel.runtime.extension.ExtensionContext; +import org.opentosca.bpel4restlight.rest.HighLevelRestApi; +import org.opentosca.bpel4restlight.rest.HttpMethod; +import org.opentosca.bpel4restlight.rest.HttpResponseMessage; +/** + * + * Copyright 2011 IAAS University of Stuttgart
+ *
+ * + * This class provides 4 BPEL4RestLight ExtensionActivity-operations which + * correspond to the 4 typical REST-Operations GET, PUT, POST and Delete. + * + * @author uwe.breitenbuecher@iaas.uni-stuttgart.de + * + */ +import org.w3c.dom.Element; + +import de.unistuttgart.iaas.bpel.extensions.bpel4restlight.util.Bpel4RestLightUtil; +import de.unistuttgart.iaas.bpel.util.BPELVariableInjectionUtil; +import de.unistuttgart.iaas.bpel.util.BpelUtil; + + +public class Bpel4RestLightOperation extends AbstractSyncExtensionOperation { + protected static final Log log = LogFactory.getLog(Bpel4RestLightOperation.class); + private static final String EXT_PROPERTIES = "wso2bps-ext.properties"; // extra properties setting + private static final String MSB_URL = "MSB_URL"; // http://msb:port, ext property msb url, if exist replace the request url + + + public static String wrapper = "temporary-simple-type-wrapper"; + private static String msbUrl = null; + + static { + + try { + File file = new File(EXT_PROPERTIES); + if(file.exists()) { + Properties p=new Properties(); + InputStream inputStream = new FileInputStream(file); + p.load(inputStream); + inputStream.close(); + msbUrl = p.getProperty(MSB_URL); + } + + } catch (Exception e) { + e.printStackTrace(); + } + + } + + + private void processResponseMessage(HttpResponseMessage responseMessage, ExtensionContext context, Element element) throws FaultException { + // Write responsePayload to designated variable + String responsePayloadVariableName = Bpel4RestLightUtil.getMethodAttributeValue(element, MethodAttribute.RESPONSEPAYLOADVARIABLE); + String statusCodeVariableName = Bpel4RestLightUtil.getMethodAttributeValue(element, MethodAttribute.STATUSCODEVARIABLE); + + if (responsePayloadVariableName != null && !responsePayloadVariableName.equals("")) { + BpelUtil.writeResponsePayloadToVariable(context, responseMessage.getResponseBody(), responsePayloadVariableName, Bpel4RestLightOperation.wrapper); + } + + if (statusCodeVariableName != null && !statusCodeVariableName.equals("")) { + String StatusCode = "" + responseMessage.getStatusCode(); // int can not be casted to String + + BpelUtil.writeResponsePayloadToVariable(context, StatusCode, statusCodeVariableName, Bpel4RestLightOperation.wrapper); + + } + } + + /** {@inheritDoc} */ + @Override + protected void runSync(ExtensionContext context, Element element) throws FaultException { + element = BPELVariableInjectionUtil.replaceExtensionVariables(context, element); + log.debug("LocalName of edited element: " + element.getLocalName()); + String httpMethod = element.getLocalName(); + + // Extract requestUri + String requestUri = getRequestUrl(element); + + HttpResponseMessage responseMessage = null; + String acceptHeader = Bpel4RestLightUtil.extractAcceptHeader(context, element); + String contentTypeHeader = Bpel4RestLightUtil.extractContentTypeHeader(context, element); + String requestPayload = Bpel4RestLightUtil.extractRequestPayload(context, element); + + // Execute corresponding HttpMethod via the HighLevelRestApi + switch (HttpMethod.valueOf(httpMethod)) { + + case PUT: { + responseMessage = HighLevelRestApi.Put(requestUri, requestPayload, acceptHeader, contentTypeHeader); + break; + } + + case POST: { + responseMessage = HighLevelRestApi.Post(requestUri, requestPayload, acceptHeader, contentTypeHeader); + break; + } + + case GET: { + responseMessage = HighLevelRestApi.Get(requestUri, acceptHeader, contentTypeHeader); + break; + } + + case DELETE: { + responseMessage = HighLevelRestApi.Delete(requestUri, acceptHeader, contentTypeHeader); + break; + } + } + + processResponseMessage(responseMessage, context, element); + // Bpel4RestLightOperation.wrapper = null; + } + + + /** + * getRequestUrl + * get request url from element, if exists msbUrl property, then replace the ip and port + * @param element + * @return + */ + private String getRequestUrl(Element element) { + String requestUri = Bpel4RestLightUtil.getMethodAttributeValue(element, MethodAttribute.REQUESTURI); + log.debug("original url:" + requestUri); + if(msbUrl == null || "".equals(msbUrl) || "http://msb:port".equals(msbUrl)) { + return requestUri; + } else { + requestUri = requestUri.substring(requestUri.indexOf("//") + 2); + int index = requestUri.indexOf("/"); + if(index == -1) { + + } else { + requestUri = requestUri.substring(index); + } + requestUri = msbUrl + requestUri; + log.debug("changed url:" + requestUri); + return requestUri; + } + } +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/EPRDemoOperation.java b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/EPRDemoOperation.java new file mode 100644 index 0000000..fd7b4b3 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/EPRDemoOperation.java @@ -0,0 +1,74 @@ +/** + * + * Copyright 2011 IAAS University of Stuttgart
+ *
+ * + * THIS CLASS IS USED FOR TEST PURPOSES! + * + * @author uwe.breitenbuecher@iaas.uni-stuttgart.de + * + */ +package de.unistuttgart.iaas.bpel.extensions.bpel4restlight; + +import java.net.HttpURLConnection; +import java.net.URL; + +import org.apache.ode.bpel.common.FaultException; +import org.apache.ode.bpel.o.OPartnerLink; +import org.apache.ode.bpel.runtime.PartnerLinkInstance; +import org.apache.ode.bpel.runtime.extension.AbstractSyncExtensionOperation; +import org.apache.ode.bpel.runtime.extension.ExtensionContext; +import org.w3c.dom.Element; + +import de.unistuttgart.iaas.xml.DomXmlConverter; + + +public class EPRDemoOperation extends AbstractSyncExtensionOperation { + + /** {@inheritDoc} */ + @Override + protected void runSync(ExtensionContext context, Element element) throws FaultException { + System.out.println("bin hier"); + try { + for (OPartnerLink l : context.getInternalInstance().getProcessModel().allPartnerLinks) { + + PartnerLinkInstance pli = context.getPartnerLinkInstance(l); + + Element epr = context.getInternalInstance().fetchPartnerRoleEndpointReferenceData(pli); + System.out.println("EPR|||"); + System.out.println(DomXmlConverter.nodeToString(epr, null)); + + System.out.println(epr.getChildNodes().item(0).getChildNodes().item(1).getNodeName()); + System.out.println(epr.getChildNodes().item(0).getChildNodes().item(1).getTextContent()); + System.out.println(".."); + System.out.println(epr.getChildNodes().item(0).getChildNodes().item(1).getChildNodes().item(0).getTextContent()); + + epr.getChildNodes().item(0).getChildNodes().item(1).getChildNodes().item(0).setTextContent("http://localhost:8084/FRP/rrr"); + + System.out.println(epr.getChildNodes().item(0).getChildNodes().item(1).getChildNodes().item(0).getTextContent()); + + System.out.println(context.getDUDir().toString()); + + } + + } catch (Exception e) { + e.printStackTrace(); + } + + System.out.println("ich bin hiiiiiiiiiier!!"); + + try { + URL url = new URL("http://localhost:8084/FRP/rrr"); + + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setRequestMethod("PUT"); + + int responseCode = connection.getResponseCode(); + System.out.println(responseCode); + + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/MethodAttribute.java b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/MethodAttribute.java new file mode 100644 index 0000000..ce80c16 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/MethodAttribute.java @@ -0,0 +1,17 @@ +/** + * + * Copyright 2011 IAAS University of Stuttgart
+ *
+ * + * This enum is used to decouple DOM-Attribute names from their + * String-representation within a certain library (for portability issues) + * + * @author uwe.breitenbuecher@iaas.uni-stuttgart.de + * + */ +package de.unistuttgart.iaas.bpel.extensions.bpel4restlight; + + +public enum MethodAttribute { + REQUESTURI, REQUESTPAYLOADVARIABLE, RESPONSEPAYLOADVARIABLE, STATUSCODEVARIABLE, ACCEPTHEADER, CONTENTTYPE; +} \ No newline at end of file diff --git a/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/util/Bpel4RestLightUtil.java b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/util/Bpel4RestLightUtil.java new file mode 100644 index 0000000..1c9d7d1 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/util/Bpel4RestLightUtil.java @@ -0,0 +1,113 @@ +/** + * Copyright 2011 IAAS University of Stuttgart
+ *
+ * + * @author uwe.breitenbuecher@iaas.uni-stuttgart.de + * + */ +package de.unistuttgart.iaas.bpel.extensions.bpel4restlight.util; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.ode.bpel.common.FaultException; +import org.apache.ode.bpel.runtime.extension.ExtensionContext; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +import de.unistuttgart.iaas.bpel.extensions.bpel4restlight.Bpel4RestLightOperation; +import de.unistuttgart.iaas.bpel.extensions.bpel4restlight.MethodAttribute; +import de.unistuttgart.iaas.xml.DomXmlConverter; + + +public class Bpel4RestLightUtil { + protected static final Log log = LogFactory.getLog(Bpel4RestLightUtil.class); + /** + * This function extracts the requestPayload specified in the passed + * element. This requestPayload is either the content contained in a special + * BPEL-Variable which is referenced by name by a special attribute of the + * passed element or the content contained in the first child node of the + * passed element + * + * @param context ExtensionContext + * @param element Element from which the requestPayload has to be extracted + * @return RequestPayload as String + * @throws FaultException + */ + public static String extractRequestPayload(ExtensionContext context, Element element) throws FaultException { + + String requestPayload = ""; + + String requestPayloadVariableName = getMethodAttributeValue(element, MethodAttribute.REQUESTPAYLOADVARIABLE); + + if (requestPayloadVariableName != null && requestPayloadVariableName != "") { + Node requestVariableNode = context.readVariable(requestPayloadVariableName); + if (requestVariableNode.getLocalName().equals("temporary-simple-type-wrapper")) { + Bpel4RestLightOperation.wrapper = "temporary-simple-type-wrapper"; + requestPayload = DomXmlConverter.nodeToString(requestVariableNode, "temporary-simple-type-wrapper"); + } else { + requestPayload = DomXmlConverter.nodeToString(requestVariableNode, null); + } + log.debug("The pure request variable as String: \n" + DomXmlConverter.nodeToString(requestVariableNode, null) + "\n"); + } + + return requestPayload; + } + + public static String extractAcceptHeader(ExtensionContext context, Element element) throws FaultException { + return getMethodAttributeValue(element, MethodAttribute.ACCEPTHEADER); + } + + public static String extractContentTypeHeader(ExtensionContext context, Element element) throws FaultException { + return getMethodAttributeValue(element, MethodAttribute.CONTENTTYPE); + } + + /** + * This function extracts special predefined attributes (see + * {@link MethodAttribute}) from a passed DOM-Element + * + * @param element Element containing the requested Attribute-Value + * @param methodAttribute Attribute whose content has to be returned + * @return Value / Content of the attribute + */ + public static String getMethodAttributeValue(Element element, MethodAttribute methodAttribute) { + + String result = ""; + + switch (methodAttribute) { + + case REQUESTURI: + result = element.getAttribute("uri"); + + if (result == null || "".equals(result)) { + result = element.getAttribute("requestUri"); + } + break; + case REQUESTPAYLOADVARIABLE: + result = element.getAttribute("request"); + + if (result == null || "".equals(result)) { + result = element.getAttribute("requestPayload"); + } + break; + case RESPONSEPAYLOADVARIABLE: + result = element.getAttribute("response"); + + if (result == null || "".equals(result)) { + result = element.getAttribute("responsePayload"); + } + break; + case STATUSCODEVARIABLE: + result = element.getAttribute("statusCode"); + break; + case ACCEPTHEADER: + result = element.getAttribute("accept"); + break; + case CONTENTTYPE: + result = element.getAttribute("contentType"); + break; + } + + return result; + } + +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/util/BPELVariableInjectionUtil.java b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/util/BPELVariableInjectionUtil.java new file mode 100644 index 0000000..2298bf1 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/util/BPELVariableInjectionUtil.java @@ -0,0 +1,149 @@ +/** + * Copyright 2011 + * + * @author Uwe Breitenbuecher + * + * This class provides some methods for BPEL-Variable-Injection + */ + package de.unistuttgart.iaas.bpel.util; + +import java.io.IOException; +import java.io.StringReader; +import java.io.StringWriter; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.apache.ode.bpel.common.FaultException; +import org.apache.ode.bpel.runtime.extension.ExtensionContext; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + + +public class BPELVariableInjectionUtil { + + /** + * This method serializes a Node into a String + * + * @param node + * @return String representation of the node + */ + public static String nodeToString(Node node) { + try { + + if (node != null && node.getLocalName().equals("temporary-simple-type-wrapper")) { + // this is a temporary hack for string variables and the likes, + // as you may see ODE wrappes simpletypes in wrapper-elements, + // but this isn't great here + return node.getTextContent(); + } + + // Create transformer + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + Transformer transformer = transformerFactory.newTransformer(); + + // Transform Node into a String representation by regarding some + // formatting rules + StringWriter stringWriter = new StringWriter(); + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "3"); + transformer.transform(new DOMSource(node), new StreamResult(stringWriter)); + + // Return build string + return stringWriter.toString(); + } catch (Exception e) { + e.printStackTrace(); + } + + // If any error occurs, return empty string + return ""; + } + + /** + * This method executes the BPEL-Variable-Injection. It replaces referenced + * BPEL-Variables with corresponding content + * + * @param context ExtensionContext of process + * @param element DOM-Representation of the BPEL-Code in which the + * Variable-Injection has to be done + * @return modified BPEL-Code as DOM-Representation + */ + public static Element replaceExtensionVariables(ExtensionContext context, Element element) { + + try { + String BPELCodeAsString; + + // Transform BPEL-Code (DOM-Representation) into a String + BPELCodeAsString = nodeToString(element); + + // Find and replace referenced BPEL-Variables + int startIndex = BPELCodeAsString.indexOf("$bpelvar["); + if (startIndex != -1) { + while (startIndex != -1) { + int endIndex = startIndex; + while (BPELCodeAsString.charAt(endIndex) != ']') { + endIndex++; + } + + // Extract name of referenced variable + String variableName = BPELCodeAsString.substring(startIndex + 9, endIndex); + + // Extract content of referenced variable + Node variableContent = context.readVariable(variableName); + + System.out.println("Replacing variable " + variableName + "(" + variableContent.getNamespaceURI() + " " + variableContent.getLocalName() + ") with content: \n"); + System.out.println("NodeValue(): " + variableContent.getNodeValue() + "\n"); + System.out.println("TextContent(): " + variableContent.getTextContent()); + System.out.println("The full bpel script (before change) as string: \n" + BPELCodeAsString + "\n"); + + // Replace variable-reference with corresponding content + BPELCodeAsString = BPELCodeAsString.replace("$bpelvar[" + variableName + "]", nodeToString(variableContent)); + + System.out.println("The full bpel script as string: \n" + BPELCodeAsString + "\n"); + startIndex = BPELCodeAsString.indexOf("$bpelvar["); + } + + // Transform modified code (String) into DOM-Representation + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + DocumentBuilder builder = factory.newDocumentBuilder(); + + InputSource inputSource = new InputSource(); + inputSource.setCharacterStream(new StringReader(BPELCodeAsString)); + Document newDocument = builder.parse(inputSource); + + // Return first child (because Document root is not needed) + return (Element) newDocument.getFirstChild(); + + } else { + + // If no referenced variables are found, return original code + return element; + } + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } catch (SAXException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (FaultException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return null; + } + +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/util/BpelUtil.java b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/util/BpelUtil.java new file mode 100644 index 0000000..33c0d54 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/util/BpelUtil.java @@ -0,0 +1,102 @@ +/** + * Copyright 2011 IAAS University of Stuttgart
+ *
+ * + * @author uwe.breitenbuecher@iaas.uni-stuttgart.de + * + */ +package de.unistuttgart.iaas.bpel.util; + +import java.io.IOException; +import java.io.StringReader; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.ode.bpel.common.FaultException; +import org.apache.ode.bpel.evar.ExternalVariableModuleException; +import org.apache.ode.bpel.o.OScope.Variable; +import org.apache.ode.bpel.runtime.extension.ExtensionContext; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + + +public class BpelUtil { + + /** + * This function writes a passed content to a specified processVariable + * (referenced by name). The content will be converted into its + * DOM-Representation for overwriting the processVariableContent (therefore + * it has to be XML-serializable, e.g. for complex data types there have to + * be JAX-B Annotations within the corresponding Class) + * + * @param context ExtensionContext needed to access the processVariable + * @param content New content for the specified processVariable + * @param processVariableName Variable whose content has to be overwritten + * @throws FaultException + */ + public static void writeContentToBPELVariable(ExtensionContext context, Object content, String processVariableName, String wrapper) throws FaultException { + // check the node + System.out.println("The content object: " + content + "\n"); + // small hack for test + Node hackNode = null; + System.out.println("Trying to parse string to dom: " + ((String) content) + "\n"); + + if (wrapper != null) { + // a hack for simple type wrapper + content = "<" + wrapper + ">" + (String) content + ""; + } + try { + hackNode = stringToDom((String) content); + } catch (ParserConfigurationException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (SAXException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + + Variable bpelVariable = context.getVisibleVariables().get(processVariableName); + if (hackNode == null) { + System.out.println("hackNode is null! \n"); + } + if (bpelVariable == null) { + System.out.println("bpelVariable is null! \n"); + } + try { + // replaced responseAsNode to hackNode + context.writeVariable(bpelVariable, hackNode); + } catch (ExternalVariableModuleException e) { + e.printStackTrace(); + } + + } + + /** + * This function writes a String to a BPEL Variable of type XSD-String + * + * @param context ExtensionContext + * @param responsePayload ResponsePayload as String + * @param processVariableName Name of the target BPEL variable + * @throws FaultException + */ + public static void writeResponsePayloadToVariable(ExtensionContext context, Object responsePayload, String processVariableName, String wrapper) throws FaultException { + BpelUtil.writeContentToBPELVariable(context, responsePayload, processVariableName, wrapper); + } + + private static Node stringToDom(String xmlString) throws ParserConfigurationException, SAXException, IOException { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + DocumentBuilder builder = factory.newDocumentBuilder(); + InputSource is = new InputSource(new StringReader(xmlString)); + Document d = builder.parse(is); + return d.getFirstChild(); + } + +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/xml/DomXmlConverter.java b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/xml/DomXmlConverter.java new file mode 100644 index 0000000..cbce6e8 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/xml/DomXmlConverter.java @@ -0,0 +1,179 @@ +/** + * + * Copyright 2011 IAAS University of Stuttgart
+ *
+ * + * @author uwe.breitenbuecher@iaas.uni-stuttgart.de + * + */ +package de.unistuttgart.iaas.xml; + +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + + +public class DomXmlConverter { + + // Single instance of transformer + private static Transformer xmlTransformer; + + + /** + * Converts a Node to its String-representation + * + * @param node Node which has to be converted + * @return String representation of the passed node + */ + public static String nodeToString(Node node, String wrapperElement) { + try { + System.out.println("\n\n\n"); + System.out.println("check if node got a namespace: " + node.getNamespaceURI()); + if (wrapperElement != null) { + // this hack is need as ODE wrapps simpletypes in such elements + return node.getTextContent(); + } + + Source source = new DOMSource(node); + + StringWriter writer = new StringWriter(); + Result result = new StreamResult(writer); + + Transformer transformer = DomXmlConverter.getTransformer(); + transformer.transform(source, result); + + return writer.toString(); + } catch (Exception e) { + e.printStackTrace(); + } + return "Parsing error"; + } + + /** + * Singleton implementation of transformer access + * + * @return Transformer + * @throws Exception + */ + private static synchronized Transformer getTransformer() throws Exception { + if (DomXmlConverter.xmlTransformer == null) { + DomXmlConverter.xmlTransformer = TransformerFactory.newInstance().newTransformer(); + DomXmlConverter.xmlTransformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); + DomXmlConverter.xmlTransformer.setOutputProperty(OutputKeys.INDENT, "yes"); + DomXmlConverter.xmlTransformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); + } + return DomXmlConverter.xmlTransformer; + } + + /** + * This method converts a NodeList into a List of Strings. Each string + * represents the TextContent of each Node contained in the NodeList + * + * @param nodeList which contains the Nodes + * @return List of TextContents of each node + */ + public static List convertNodeListToStringList(NodeList nodeList) { + List resultList = new ArrayList(); + + for (int i = 0; i < nodeList.getLength(); i++) { + resultList.add(nodeList.item(i).getTextContent()); + } + + return resultList; + } + + /** + * This method converts a NodeList into a List of Nodes + * + * @param nodeList + * @return List of Nodes + */ + public static List convertNodeListToList(NodeList nodeList) { + List resultList = new ArrayList(nodeList.getLength()); + for (int i = 0; i < nodeList.getLength(); i++) { + resultList.add(nodeList.item(i)); + } + return resultList; + } + + + /** + * Helper-Class for converting an Object into its DOM-Representation. The + * SerializingContainer is a Wrapper to enable the serialization of any + * object via JAXB. + */ + @XmlRootElement + private static class SerializingContainer { + + Object object; + + + public Object getObject() { + return this.object; + } + + public void setObject(Object object) { + this.object = object; + } + + } + + + /** + * This methods converts an Object into its DOM-Representation + * + * @param object which have to be converted + * @return DOM-Representation of the object + */ + public static Node convertObjectToDom(Object object) { + try { + + // Create new SerializingContainer and pack the object, which has to + // be serialized, into it. This has to be done, because JAXB + // only marshalls objects of classes annotated with the + // @XmlRootElement-Annotation. + SerializingContainer container = new SerializingContainer(); + container.setObject(object); + + // Create empty Document + Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + + // Create JAXBContext and bind classes + Class[] classesToBeBound = new Class[] {SerializingContainer.class, container.getObject().getClass()}; + JAXBContext jaxbContext = JAXBContext.newInstance(classesToBeBound, null); + + Marshaller marshaller = jaxbContext.createMarshaller(); + + // Set some properties + marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE); + marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); + + // Marshall container into document. + marshaller.marshal(container, document); + + // Extract only the contained information in the serialized + // DOM-Representation of the SerializingContainer + return document.getFirstChild().getFirstChild(); + + } catch (Exception e) { + return null; + } + } + +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/xml/XPathEvaluator.java b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/xml/XPathEvaluator.java new file mode 100644 index 0000000..0ae6b2c --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/xml/XPathEvaluator.java @@ -0,0 +1,34 @@ +/** + * + * Copyright 2011 IAAS University of Stuttgart
+ *
+ * + * @author uwe.breitenbuecher@iaas.uni-stuttgart.de + * + */ +package de.unistuttgart.iaas.xml; + +import javax.xml.namespace.QName; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathFactory; + + +public class XPathEvaluator { + + public static XPath xpath = XPathFactory.newInstance().newXPath(); + + + @SuppressWarnings("unchecked") + public static t evaluate(String expression, Object source, QName returnType) { + + Object resultAsObject = null; + try { + resultAsObject = xpath.evaluate(expression, source, returnType); + + } catch (Exception e) { + e.printStackTrace(); + } + return (t) resultAsObject; + } + +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/HighLevelRestApi.java b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/HighLevelRestApi.java new file mode 100644 index 0000000..ec10959 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/HighLevelRestApi.java @@ -0,0 +1,178 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + *******************************************************************************/ +/* + * Modifications Copyright 2016-2017 ZTE Corporation. + */ +/** + * This class wraps HTTP-Method functionality and thereby abstracts from low + * level code to simplify the usage. + */ +package org.opentosca.bpel4restlight.rest; + +import org.apache.commons.httpclient.HttpMethodBase; +import org.apache.commons.httpclient.NameValuePair; +import org.apache.commons.httpclient.methods.DeleteMethod; +import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.methods.PutMethod; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.http.HttpHeaders; + + +public class HighLevelRestApi { + protected static final Log log = LogFactory.getLog(HighLevelRestApi.class); + /** + * This method implements the HTTP Put Method + * + * @param uri + * Resource URI + * @param requestPayload + * Content which has to be put into the Resource + * @return ResponseCode of HTTP Interaction + */ + @SuppressWarnings("deprecation") + public static HttpResponseMessage Put(String uri, String requestPayload, String acceptHeaderValue, String contentTypeHeader) { + + PutMethod method = new PutMethod(uri); + // requestPayload = "" + + // requestPayload; + + HighLevelRestApi.setHeader(method, acceptHeaderValue, contentTypeHeader); + method.setRequestBody(requestPayload); + + HttpResponseMessage responseMessage = LowLevelRestApi.executeHttpMethod(method); + + // kill ", ""); + responseMessage.setResponseBody(temp); + } + } + +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/HttpMethod.java b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/HttpMethod.java new file mode 100644 index 0000000..209cca3 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/HttpMethod.java @@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + *******************************************************************************/ +/* + * Modifications Copyright 2016-2017 ZTE Corporation. + */ +/** + * This enum is intended to simplify identifying different HTTP-methods + */ +package org.opentosca.bpel4restlight.rest; + + +public enum HttpMethod { + PUT, POST, GET, DELETE +} \ No newline at end of file diff --git a/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/HttpResponseMessage.java b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/HttpResponseMessage.java new file mode 100644 index 0000000..07198d8 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/HttpResponseMessage.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + *******************************************************************************/ +/* + * Modifications Copyright 2016-2017 ZTE Corporation. + */ +/** + * This enum is intended to simplify identifying different HTTP-methods + */ +package org.opentosca.bpel4restlight.rest; + +/** + */ +public class HttpResponseMessage { + + private int statusCode; + private String responseBody; + + + /** + * @return the statusCode + */ + public int getStatusCode() { + return this.statusCode; + } + + /** + * @param statusCode the statusCode to set + */ + protected void setStatusCode(int statusCode) { + this.statusCode = statusCode; + } + + /** + * @return the responseBody + */ + public String getResponseBody() { + return this.responseBody; + } + + /** + * @param responseBody the responseBody to set + */ + protected void setResponseBody(String responseBody) { + this.responseBody = responseBody; + } + +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/LowLevelRestApi.java b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/LowLevelRestApi.java new file mode 100644 index 0000000..c522ca9 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/LowLevelRestApi.java @@ -0,0 +1,182 @@ +/******************************************************************************* + * Copyright (c) 2012-2013 University of Stuttgart. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + *******************************************************************************/ +/* + * Modifications Copyright 2016-2017 ZTE Corporation. + */ + /** + * This static-class eases HTTP-method execution by self-managed fault-handling + * and automated Response-information processing + */ +package org.opentosca.bpel4restlight.rest; + +import java.io.IOException; +import java.util.Map; +import java.util.Set; + +import org.apache.commons.httpclient.Header; +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpMethod; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; + + +public class LowLevelRestApi { + + protected static final Log log = LogFactory.getLog(LowLevelRestApi.class); + // Local HttpClient used for every communication (Singleton implementation) +// private static HttpClient httpClient = new HttpClient(); + + /** + * Executes a passed HttpMethod (Method type is either PUT, POST, GET or + * DELETE) and returns a HttpResponseMessage + * + * @param method Method to execute + * @return HttpResponseMessage which contains all information about the + * execution + */ + public static HttpResponseMessage executeHttpMethod(HttpMethod method) { + + HttpResponseMessage responseMessage = null; + + try { + log.debug("Method invocation on URI: \n"); + log.debug(method.getURI().toString()); + + // Execute Request + HttpClient httpClient = new HttpClient(); + httpClient.executeMethod(method); + responseMessage = LowLevelRestApi.extractResponseInformation(method); + + } catch (Exception e) { + log.error("call rest error:", e); + } finally { + // Release Connection anyway + method.releaseConnection(); + } + + // Extract response information and return + return responseMessage; + } + + /** + * Extracts the response information from an executed HttpMethod + * + * @param method Executed Method + * @return Packaged response information + */ + private static HttpResponseMessage extractResponseInformation(HttpMethod method) { + // Create and return HttpResponseMethod + HttpResponseMessage responseMessage = new HttpResponseMessage(); + responseMessage.setStatusCode(method.getStatusCode()); + try { + responseMessage.setResponseBody(getResponseBody(method)); + } catch (Exception e) { + log.error(e); + } + return responseMessage; + + } + + /** + * getResponseBody + * + * get response body info, if response body is a json object, then translate json object to xml + * if the rest request failed, i.e. the response body is a 404 error page, then response the body with header + * @param method + * @return + * @throws ParseException + */ + private static String getResponseBody(HttpMethod method) throws ParseException + { + String result = null; + try { + result = method.getResponseBodyAsString(); + log.debug("result:"); + log.debug(result); + } catch (IOException e) { + log.error(e); + } + + Header header = method.getRequestHeader("Accept"); + if ("application/json".equals(header.getValue())) { + StringBuilder sb = new StringBuilder(); + sb.append(""); + sb.append(""); + if(result != null && !"".equals(result)) { + /** + if(result.startsWith("")) { + sb.append(""); + } else { + Object json = new JSONParser().parse(result); + json2Xml(sb, "obj", json); + } + */ + + try { + Object json = new JSONParser().parse(result); + json2Xml(sb, "obj", json); + } catch (Exception e) { + log.error(e); + sb.append(""); + } + } + sb.append(""); + + log.debug("responseBody:"); + log.debug(sb.toString()); + return sb.toString(); + } + return result; + } + + + @SuppressWarnings("unchecked") + public static void json2Xml(StringBuilder sb, String key, Object jsonObject) { + if(jsonObject == null) { + sb.append("empty"); + return; + } + + if(jsonObject instanceof JSONArray) { + JSONArray array = (JSONArray) jsonObject; + sb.append("<").append(key).append("s").append(">"); + for(int i=0, len=array.size(); i"); + + return; + } else if(jsonObject instanceof JSONObject) { + sb.append("<").append(key).append(">"); + JSONObject json = (JSONObject) jsonObject; + for(Map.Entry entry : (Set>)json.entrySet()) { + json2Xml(sb, entry.getKey(), entry.getValue()); + } + sb.append(""); + return; + } else { + sb.append("<").append(key).append(">"); + sb.append(""); + sb.append(""); + + return; + } + } + +} diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/pom.xml b/wso2/wso2bpel-ext/wso2bpel-core/distribution/pom.xml new file mode 100644 index 0000000..fd6c48c --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/pom.xml @@ -0,0 +1,34 @@ + + + + + org.openo.common-services.common-utilities.wso2bpel-ext + wso2bpel-core-parent + 1.1.0-SNAPSHOT + + + 4.0.0 + distribution + common-services-common-utilities/wso2bpel-ext/wso2bpel-core/distribution + pom + + + standalone + + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/pom.xml b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/pom.xml new file mode 100644 index 0000000..1ec096d --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/pom.xml @@ -0,0 +1,401 @@ + + + + + org.openo.common-services.common-utilities.wso2bpel-ext + distribution + 1.1.0-SNAPSHOT + + + 4.0.0 + standalone + common-services-common-utilities/wso2bpel-ext/wso2bpel-core/distribution/standalone + pom + + + openo-commonservice-commonutilities-wso2bpel-ext + linux64 + win64 + target/assembly/${linux64id} + target/assembly/${win64id} + target/version + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-jar-${linux64id} + + copy + + prepare-package + + + + org.openo.common-services.common-utilities.wso2bpel-ext + wso2bpel-mgr + jar + true + ${linux64outputdir}/wso2bps-ext + wso2bpel-service.jar + + + + + + copy-jar-${win64id} + + copy + + prepare-package + + + + org.openo.common-services.common-utilities.wso2bpel-ext + wso2bpel-mgr + jar + true + ${win64outputdir}/wso2bps-ext + wso2bpel-service.jar + + + + + + unzip-wso2bps-${linux64id} + + unpack + + generate-resources + + + + com.wso2 + wso2bps + zip + true + target/assembly/wso2bps + + + + + + unzip-wso2bps-${win64id} + + unpack + + generate-resources + + + + com.wso2 + wso2bps + zip + true + target/assembly/wso2bps + + + + + + + + maven-resources-plugin + + + copy-resources-${linux64id} + process-resources + + copy-resources + + + ${linux64outputdir} + + + src/main/assembly/ + false + + **/* + + + **/*.bat + + + + true + + + + copy-resources-${win64id} + process-resources + + copy-resources + + + ${win64outputdir} + + + src/main/assembly/ + false + + **/* + + + **/*.sh + + + + true + + + + copy-ext-resources-${linux64id} + process-resources + + copy-resources + + + ${linux64outputdir}/wso2bps + + + target/assembly/wso2bps/wso2bps-3.5.0 + false + + **/*.bat + + + + true + + + + copy-ext-resources-${win64id} + process-resources + + copy-resources + + + ${win64outputdir}/wso2bps + + + target/assembly/wso2bps/wso2bps-3.5.0 + false + + **/*.sh + + + + true + + + + + copy-config-resources-linux + process-resources + + copy-resources + + + ${linux64outputdir}/wso2bps/repository/conf + + + src/main/assembly/wso2bps/repository/conf/carbon + false + + **/* + + + + true + + + + copy-config-resources-win + process-resources + + copy-resources + + + ${win64outputdir}/wso2bps/repository/conf + + + src/main/assembly/wso2bps/repository/conf/carbon + false + + **/* + + + + true + + + + copy-bpel4rest-resources-linux + process-resources + + copy-resources + + + ${linux64outputdir}/wso2bps/repository/components/lib + + + ../../BPEL4RESTLight/target + false + + **/bpel4rest.jar + + + + true + + + + copy-bpel4rest-resources-win + process-resources + + copy-resources + + + ${win64outputdir}/wso2bps/repository/components/lib + + + ../../BPEL4RESTLight/target + false + + **/bpel4rest.jar + + + + true + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + distribution + package + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.openo.common-services.common-utilities.wso2bpel-ext + wso2bpel-mgr + ${project.version} + + + com.wso2 + wso2bps + 3.5.0 + zip + + + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/initDB.sh b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/initDB.sh new file mode 100644 index 0000000..eacbaf2 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/initDB.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# +# 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. +# + +DIRNAME=`dirname $0` +HOME=`cd $DIRNAME/; pwd` +user=$1 +password=$2 +port=$3 +host=$4 + + +echo "start to change db ip and port" +sed -i "s|localhost|$host|" wso2bps/repository/conf/datasources/bps-datasources.xml +sed -i "s|3306|$port|" wso2bps/repository/conf/datasources/bps-datasources.xml +cat wso2bps/repository/conf/datasources/bps-datasources.xml +echo "end of change db ip and port" +echo "" + +echo "start create wso2 bpel db" +mysql -u$user -p$password -P$port -h$host <$HOME/wso2bps/dbscripts/bps/bpel/create/wso-bpel-mysql-createdb.sql +sql_result=$? +if [ $sql_result != 0 ] ; then + echo "failed to create wso2 bpel database" + exit 1 +fi + + +echo "start create wso2 bpel table" +mysql -u$user -p$password -P$port -h$host -Dwso_bpel <$HOME/wso2bps/dbscripts/bps/bpel/create/mysql.sql +sql_result=$? +if [ $sql_result != 0 ] ; then + echo "failed to create wso2 bpel table" + exit 1 +fi + +echo "init wso2 bpel database success!" +exit 0 + + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/run.bat b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/run.bat new file mode 100644 index 0000000..752c415 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/run.bat @@ -0,0 +1,32 @@ +@REM +@REM Copyright 2016-2017 ZTE Corporation. +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM + +@echo off +title wso2 + +set RUNHOME=%~dp0 +echo ##RUNHOME %RUNHOME% + + +echo ### Starting wso2bps +start /D %RUNHOME%wso2bps bin\wso2server.bat +cd /D %RUNHOME%wso2bps-ext\bin + +echo ### Starting wso2bps-ext +start startup.bat + +cd /D %RUNHOME% + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/run.sh b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/run.sh new file mode 100644 index 0000000..a57d017 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/run.sh @@ -0,0 +1,32 @@ +# +# 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. +# + + +DIRNAME=`dirname $0` +RUNHOME=`cd $DIRNAME/; pwd` +echo @RUNHOME@ $RUNHOME + +echo "### Starting wso2bps"; +cd wso2bps +$RUNHOME/wso2bps/bin/wso2server.sh & +cd $RUNHOME + + +echo "\n\n### Starting wso2bps-ext" +cd wso2bps-ext +$RUNHOME/wso2bps-ext/bin/startup.sh & +echo "### Starting wso2 end..."; + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/stop.bat b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/stop.bat new file mode 100644 index 0000000..60ebad4 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/stop.bat @@ -0,0 +1,28 @@ +@REM +@REM Copyright 2016 ZTE Corporation. +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM + +@echo off +title wso2 + +set RUNHOME=%~dp0 +echo ##RUNHOME %RUNHOME% + + +echo ### Starting wso2bps +start /D %RUNHOME%wso2bps bin\shutdown.bat + +echo ### Starting wso2bps-ext +start /D %RUNHOME%wso2bps-ext bin\shutdown.bat diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/stop.sh b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/stop.sh new file mode 100644 index 0000000..29e23f5 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/stop.sh @@ -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. +# + +DIRNAME=`dirname $0` +RUNHOME=`cd $DIRNAME/; pwd` +echo @RUNHOME@ $RUNHOME + +echo "### Shutdown wso2bps"; +cd wso2bps +$RUNHOME/wso2bps/bin/shutdown.sh & +cd $RUNHOME + + +echo "\n\n### Shutdown wso2bps-ext" +cd wso2bps-ext +$RUNHOME/wso2bps-ext/bin/shutdown.sh & +echo "### Shutdown wso2 end..."; diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/find_kill_process.bat b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/find_kill_process.bat new file mode 100644 index 0000000..a4a2f06 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/find_kill_process.bat @@ -0,0 +1,24 @@ +@REM +@REM Copyright 2016 ZTE Corporation. +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM + +echo %1 | findstr %2 >NUL +echo ERRORLEVEL=%ERRORLEVEL% +IF ERRORLEVEL 1 goto findend +for /f "tokens=1" %%a in (%1) do ( + echo kill %1 + taskkill /F /pid %%a +) +:findend \ No newline at end of file diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/shutdown.bat b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/shutdown.bat new file mode 100644 index 0000000..76b2f58 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/shutdown.bat @@ -0,0 +1,34 @@ +@REM +@REM Copyright 2016 ZTE Corporation. +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM + +@echo off +title stopping wso2bpel-service + +set HOME=%~dp0 +set Main_Class="org.openo.carbon.bpel.Wso2BpelApplication" + +echo ================== wso2bpel-service info ============================================= +echo HOME=$HOME +echo Main_Class=%Main_Class% +echo =============================================================================== + +echo ### Stopping wso2bpel-service +cd /d %HOME% + +for /f "delims=" %%i in ('"%JAVA_HOME%\bin\jcmd"') do ( + call find_kill_process "%%i" %Main_Class% +) +exit \ No newline at end of file diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/shutdown.sh b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/shutdown.sh new file mode 100644 index 0000000..6d5d93f --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/shutdown.sh @@ -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. +# + +#!/bin/bash +# +# +# Copyright 2016 [ZTE] and others. +# +# 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. +# + +DIRNAME=`dirname $0` +HOME=`cd $DIRNAME/; pwd` +Main_Class="org.openo.carbon.bpel.Wso2BpelApplication" + +echo ================== wso2bpel-service info ============================================= +echo HOME=$HOME +echo Main_Class=$Main_Class +echo =============================================================================== +cd $HOME; pwd + +echo @WORK_DIR@ $HOME + +function save_service_pid(){ + service_pid=`ps -ef | grep $Main_Class | grep -v grep | awk '{print $2}'` + echo @service_pid@ $service_pid +} + +function kill_service_process(){ + ps -p $service_pid + if [ $? == 0 ]; then + kill -9 $service_pid + fi +} + +save_service_pid; +echo @C_CMD@ kill -9 $service_pid +kill_service_process; diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/startup.bat b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/startup.bat new file mode 100644 index 0000000..95c0b59 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/startup.bat @@ -0,0 +1,42 @@ +@REM +@REM Copyright 2016 ZTE Corporation. +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM + +@echo off +title wso2bpel-service + +set RUNHOME=%~dp0 +echo ### RUNHOME: %RUNHOME% +echo ### Starting wso2bpel-service +set WSO2_EXT_HOME=%RUNHOME%\.. + +set JAVA="%JAVA_HOME%\bin\java.exe" +set port=8312 +set jvm_opts=-Xms50m -Xmx128m +rem set jvm_opts=%jvm_opts% -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=%port%,server=y,suspend=n +set jvm_opts=%jvm_opts% -DWSO2_EXT_HOME=%WSO2_EXT_HOME% +set class_path=%RUNHOME%;%WSO2_EXT_HOME%\lib\*;%WSO2_EXT_HOME%\wso2bpel-service.jar +echo ### jvm_opts: %jvm_opts% +echo ### class_path: %class_path% + +%JAVA% -classpath %class_path% %jvm_opts% org.openo.carbon.bpel.Wso2BpelApplication server %WSO2_EXT_HOME%/conf/wso2bpel.yml + +IF ERRORLEVEL 1 goto showerror +exit +:showerror +echo WARNING: Error occurred during startup or Server abnormally stopped by way of killing the process,Please check! +echo After checking, press any key to close +pause +exit \ No newline at end of file diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/startup.sh b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/startup.sh new file mode 100644 index 0000000..c8ea31a --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/startup.sh @@ -0,0 +1,36 @@ +# +# 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. +# + +DIRNAME=`dirname $0` +RUNHOME=`cd $DIRNAME/; pwd` +WSO_EXT_HOME=${RUNHOME}/.. +echo @RUNHOME@ $RUNHOME + +echo @JAVA_HOME@ $JAVA_HOME +JAVA="$JAVA_HOME/bin/java" +echo @JAVA@ $JAVA + +JAVA_OPTS="-Xms50m -Xmx128m -Djava.awt.headless=true" +port=8312 +# JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=$port,server=y,suspend=n" +JAVA_OPTS="$JAVA_OPTS -DWSO2_EXT_HOME=${WSO_EXT_HOME}" +echo @JAVA_OPTS@ $JAVA_OPTS + +class_path="$RUNHOME/:$RUNHOME/../lib/*:$RUNHOME/../wso2bpel-service.jar" +echo @class_path@ $class_path + +"$JAVA" $JAVA_OPTS -classpath "$class_path" org.openo.carbon.bpel.Wso2BpelApplication server "$RUNHOME/../conf/wso2bpel.yml" + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/conf/wso2bpel.yml b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/conf/wso2bpel.yml new file mode 100644 index 0000000..b56bb5a --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/conf/wso2bpel.yml @@ -0,0 +1,73 @@ +# +# 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. +# + +template: Hello, %s! + +# defaultName: ${DW_DEFAULT_NAME:-Stranger} +# the micro service ip +serviceIp: +msbServerAddr: http://127.0.0.1:80 + +wso2Host: localhost +wso2HostPort: 9443 +wso2AuthUserName: admin +wso2AuthPassword: admin +wso2Path: ../wso2bps +wso2UploadFilePath: ../wso2bps/tmp/bpeluploads +wso2SslJksFile: ../wso2bps/repository/resources/security/wso2carbon.jks +wso2SslJksPassword: wso2carbon + + +# use the simple server factory if you only want to run on a single port +#server: +# type: simple +# connector: +# type: http +# port: 8080 +server: + type: simple + rootPath: '/openoapi/wso2bpel/v1/*' + applicationContextPath: / + adminContextPath: /admin + connector: + type: http + port: 8101 + +# Logging settings. +logging: + + # The default level of all loggers. Can be OFF, ERROR, WARN, INFO, DEBUG, TRACE, or ALL. + level: ALL + + # Logger-specific levels. + loggers: + + # Sets the level for 'com.example.app' to DEBUG. + org.openo.carbon.bpel.Wso2BpelApplication: INFO + + appenders: + - type: console + threshold: INFO + timeZone: UTC + logFormat: "%d{yyyy-MM-dd HH:mm:ss SSS} %-5p [%c][%t] - %m%n" + - type: file + threshold: INFO + logFormat: "%d{yyyy-MM-dd HH:mm:ss SSS} %-5p [%c][%t] - %m%n" + currentLogFilename: ./logs/wso2bpel-ext.log + archivedLogFilenamePattern: ./logs/zip/wso2bpel-ext-%d{yyyy-MM-dd}.log.gz + archivedFileCount: 7 + timeZone: UTC + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/bin/find_kill_process.bat b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/bin/find_kill_process.bat new file mode 100644 index 0000000..d89cf27 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/bin/find_kill_process.bat @@ -0,0 +1,23 @@ +@REM +@REM Copyright (C) 2015 ZTE, Inc. and others. All rights reserved. (ZTE) +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM +echo %1 | findstr %2 >NUL +echo ERRORLEVEL=%ERRORLEVEL% +IF ERRORLEVEL 1 goto findend +for /f "tokens=1" %%a in (%1) do ( + echo kill %1 + taskkill /F /pid %%a +) +:findend \ No newline at end of file diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/bin/shutdown.bat b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/bin/shutdown.bat new file mode 100644 index 0000000..d932cb7 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/bin/shutdown.bat @@ -0,0 +1,34 @@ +@REM +@REM Copyright (C) 2015 ZTE, Inc. and others. All rights reserved. (ZTE) +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM +@echo off +title stopping WSO2 + +set HOME=%~dp0 +set Main_Class="org.wso2.carbon.bootstrap.Bootstrap" + +echo ================== WSO2 info ============================================= +echo HOME=$HOME +echo Main_Class=%Main_Class% +echo =============================================================================== + +echo ### Stopping WSO2 +cd /d %HOME% + +rem set JAVA_HOME=D:\WorkSoftware\jdk1.7.0_60 +for /f "delims=" %%i in ('"%JAVA_HOME%\bin\jcmd"') do ( + call find_kill_process "%%i" %Main_Class% +) +exit diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/bin/shutdown.sh b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/bin/shutdown.sh new file mode 100644 index 0000000..06a0950 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/bin/shutdown.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# +# Copyright (C) 2015 ZTE, Inc. and others. All rights reserved. (ZTE) +# +# 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. +# + +DIRNAME=`dirname $0` +HOME=`cd $DIRNAME/; pwd` +Main_Class="org.wso2.carbon.bootstrap.Bootstrap" + +echo ================== umc-service info ============================================= +echo HOME=$HOME +echo Main_Class=$Main_Class +echo =============================================================================== +cd $HOME; pwd + +echo @WORK_DIR@ $HOME + +function save_service_pid(){ + service_pid=`ps -ef | grep $Main_Class | grep -v grep | awk '{print $2}'` + echo @service_pid@ $service_pid +} + +function kill_service_process(){ + ps -p $service_pid + if [ $? == 0 ]; then + kill -9 $service_pid + fi +} + +save_service_pid; +echo @C_CMD@ kill -9 $service_pid +kill_service_process; \ No newline at end of file diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/dbscripts/bps/bpel/create/mysql.sql b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/dbscripts/bps/bpel/create/mysql.sql new file mode 100644 index 0000000..c12bbfb --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/dbscripts/bps/bpel/create/mysql.sql @@ -0,0 +1,170 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you under the Apache License, Version 2.0 (the +-- "License"); you may not use this file except in compliance +-- with the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, +-- software distributed under the License is distributed on an +-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +-- KIND, either express or implied. See the License for the +-- specific language governing permissions and limitations +-- under the License. +-- + +-- +-- BPEL Related SQL Scripts +-- + + +create table ODE_SCHEMA_VERSION (VERSION integer); +insert into ODE_SCHEMA_VERSION values (6); +-- Apache ODE - SimpleScheduler Database Schema +-- +-- MySQL scripts by Maciej Szefler. +-- +-- +DROP TABLE IF EXISTS ODE_JOB; + +CREATE TABLE ODE_JOB ( + jobid CHAR(64) NOT NULL DEFAULT '', + ts BIGINT NOT NULL DEFAULT 0, + nodeid char(64) NULL, + scheduled int NOT NULL DEFAULT 0, + transacted int NOT NULL DEFAULT 0, + + instanceId BIGINT, + mexId varchar(255), + processId varchar(255), + type varchar(255), + channel varchar(255), + correlatorId varchar(255), + correlationKeySet varchar(255), + retryCount int, + inMem int, + detailsExt blob(4096), + + PRIMARY KEY(jobid), + INDEX IDX_ODE_JOB_TS(ts), + INDEX IDX_ODE_JOB_NODEID(nodeid) +) +ENGINE=innodb; + +COMMIT; + +CREATE TABLE TASK_ATTACHMENT (ATTACHMENT_ID BIGINT NOT NULL, MESSAGE_EXCHANGE_ID VARCHAR(255), PRIMARY KEY (ATTACHMENT_ID)) ENGINE=innodb; +CREATE TABLE ODE_ACTIVITY_RECOVERY (ID BIGINT NOT NULL, ACTIONS VARCHAR(255), ACTIVITY_ID BIGINT, CHANNEL VARCHAR(255), DATE_TIME DATETIME, DETAILS TEXT, INSTANCE_ID BIGINT, REASON VARCHAR(255), RETRIES INTEGER, PRIMARY KEY (ID)) ENGINE=innodb; +CREATE TABLE ODE_CORRELATION_SET (CORRELATION_SET_ID BIGINT NOT NULL, CORRELATION_KEY VARCHAR(255), NAME VARCHAR(255), SCOPE_ID BIGINT, PRIMARY KEY (CORRELATION_SET_ID)) ENGINE=innodb; +CREATE TABLE ODE_CORRELATOR (CORRELATOR_ID BIGINT NOT NULL, CORRELATOR_KEY VARCHAR(255), PROC_ID BIGINT, PRIMARY KEY (CORRELATOR_ID)) ENGINE=innodb; +CREATE TABLE ODE_CORSET_PROP (ID BIGINT NOT NULL, CORRSET_ID BIGINT, PROP_KEY VARCHAR(255), PROP_VALUE VARCHAR(255), PRIMARY KEY (ID)) ENGINE=innodb; +CREATE TABLE ODE_EVENT (EVENT_ID BIGINT NOT NULL, DETAIL VARCHAR(255), DATA BLOB, SCOPE_ID BIGINT, TSTAMP DATETIME, TYPE VARCHAR(255), INSTANCE_ID BIGINT, PROCESS_ID BIGINT, PRIMARY KEY (EVENT_ID)) ENGINE=innodb; +CREATE TABLE ODE_FAULT (FAULT_ID BIGINT NOT NULL, ACTIVITY_ID INTEGER, DATA TEXT, MESSAGE VARCHAR(4000), LINE_NUMBER INTEGER, NAME VARCHAR(255), PRIMARY KEY (FAULT_ID)) ENGINE=innodb; +CREATE TABLE ODE_MESSAGE (MESSAGE_ID BIGINT NOT NULL, DATA TEXT, HEADER TEXT, TYPE VARCHAR(255), MESSAGE_EXCHANGE_ID VARCHAR(255), PRIMARY KEY (MESSAGE_ID)) ENGINE=innodb; +CREATE TABLE ODE_MESSAGE_EXCHANGE (MESSAGE_EXCHANGE_ID VARCHAR(255) NOT NULL, CALLEE VARCHAR(255), CHANNEL VARCHAR(255), CORRELATION_ID VARCHAR(255), CORRELATION_KEYS VARCHAR(255), CORRELATION_STATUS VARCHAR(255), CREATE_TIME DATETIME, DIRECTION INTEGER, EPR TEXT, FAULT VARCHAR(255), FAULT_EXPLANATION VARCHAR(255), OPERATION VARCHAR(255), PARTNER_LINK_MODEL_ID INTEGER, PATTERN VARCHAR(255), PIPED_ID VARCHAR(255), PORT_TYPE VARCHAR(255), PROPAGATE_TRANS BIT, STATUS VARCHAR(255), SUBSCRIBER_COUNT INTEGER, CORR_ID BIGINT, PARTNER_LINK_ID BIGINT, PROCESS_ID BIGINT, PROCESS_INSTANCE_ID BIGINT, REQUEST_MESSAGE_ID BIGINT, RESPONSE_MESSAGE_ID BIGINT, PRIMARY KEY (MESSAGE_EXCHANGE_ID)) ENGINE=innodb; +CREATE TABLE ODE_MESSAGE_ROUTE (MESSAGE_ROUTE_ID BIGINT NOT NULL, CORRELATION_KEY VARCHAR(255), GROUP_ID VARCHAR(255), ROUTE_INDEX INTEGER, PROCESS_INSTANCE_ID INTEGER, ROUTE_POLICY VARCHAR(16), CORR_ID BIGINT, PRIMARY KEY (MESSAGE_ROUTE_ID)) ENGINE=innodb; +CREATE TABLE ODE_MEX_PROP (ID BIGINT NOT NULL, MEX_ID VARCHAR(255), PROP_KEY VARCHAR(255), PROP_VALUE VARCHAR(2000), PRIMARY KEY (ID)) ENGINE=innodb; +CREATE TABLE ODE_PARTNER_LINK (PARTNER_LINK_ID BIGINT NOT NULL, MY_EPR TEXT, MY_ROLE_NAME VARCHAR(255), MY_ROLE_SERVICE_NAME VARCHAR(255), MY_SESSION_ID VARCHAR(255), PARTNER_EPR TEXT, PARTNER_LINK_MODEL_ID INTEGER, PARTNER_LINK_NAME VARCHAR(255), PARTNER_ROLE_NAME VARCHAR(255), PARTNER_SESSION_ID VARCHAR(255), SCOPE_ID BIGINT, PRIMARY KEY (PARTNER_LINK_ID)) ENGINE=innodb; +CREATE TABLE ODE_PROCESS (ID BIGINT NOT NULL, GUID VARCHAR(255), PROCESS_ID VARCHAR(255), PROCESS_TYPE VARCHAR(255), VERSION BIGINT, PRIMARY KEY (ID)) ENGINE=innodb; +CREATE TABLE ODE_PROCESS_INSTANCE (ID BIGINT NOT NULL, DATE_CREATED DATETIME, EXECUTION_STATE BLOB, FAULT_ID BIGINT, LAST_ACTIVE_TIME DATETIME, LAST_RECOVERY_DATE DATETIME, PREVIOUS_STATE SMALLINT, SEQUENCE BIGINT, INSTANCE_STATE SMALLINT, INSTANTIATING_CORRELATOR_ID BIGINT, PROCESS_ID BIGINT, ROOT_SCOPE_ID BIGINT, PRIMARY KEY (ID)) ENGINE=innodb; +CREATE TABLE ODE_SCOPE (SCOPE_ID BIGINT NOT NULL, MODEL_ID INTEGER, SCOPE_NAME VARCHAR(255), SCOPE_STATE VARCHAR(255), PROCESS_INSTANCE_ID BIGINT, PARENT_SCOPE_ID BIGINT, PRIMARY KEY (SCOPE_ID)) ENGINE=innodb; +CREATE TABLE ODE_XML_DATA (XML_DATA_ID BIGINT NOT NULL, DATA TEXT, IS_SIMPLE_TYPE BIT, NAME VARCHAR(255), SCOPE_ID BIGINT, PRIMARY KEY (XML_DATA_ID)) ENGINE=innodb; +CREATE TABLE ODE_XML_DATA_PROP (ID BIGINT NOT NULL, XML_DATA_ID BIGINT, PROP_KEY VARCHAR(255), PROP_VALUE VARCHAR(255), PRIMARY KEY (ID)) ENGINE=innodb; +CREATE TABLE OPENJPA_SEQUENCE_TABLE (ID TINYINT NOT NULL, SEQUENCE_VALUE BIGINT, PRIMARY KEY (ID)) ENGINE=innodb; +CREATE TABLE STORE_DU (NAME VARCHAR(255) NOT NULL, DEPLOYDT DATETIME, DEPLOYER VARCHAR(255), DIR VARCHAR(255), PRIMARY KEY (NAME)) ENGINE=innodb; +CREATE TABLE STORE_PROCESS (PID VARCHAR(255) NOT NULL, STATE VARCHAR(255), TYPE VARCHAR(255), VERSION BIGINT, DU VARCHAR(255), PRIMARY KEY (PID)) ENGINE=innodb; +CREATE TABLE STORE_PROCESS_PROP (id BIGINT NOT NULL, PROP_KEY VARCHAR(255), PROP_VAL VARCHAR(255), PRIMARY KEY (id)) ENGINE=innodb; +CREATE TABLE STORE_PROC_TO_PROP (PROCESSCONFDAOIMPL_PID VARCHAR(255), ELEMENT_ID BIGINT) ENGINE=innodb; +CREATE TABLE STORE_VERSIONS (id BIGINT NOT NULL, VERSION BIGINT, PRIMARY KEY (id)) ENGINE=innodb; +CREATE INDEX I_D_TASK_ATTACMENT ON TASK_ATTACHMENT (MESSAGE_EXCHANGE_ID); +CREATE INDEX I_D_CTVRY_INSTANCE ON ODE_ACTIVITY_RECOVERY (INSTANCE_ID); +CREATE INDEX I_D_CR_ST_SCOPE ON ODE_CORRELATION_SET (SCOPE_ID); +CREATE INDEX I_D_CRLTR_PROCESS ON ODE_CORRELATOR (PROC_ID); +CREATE INDEX I_D_CRPRP_CORRSET ON ODE_CORSET_PROP (CORRSET_ID); +CREATE INDEX I_OD_VENT_INSTANCE ON ODE_EVENT (INSTANCE_ID); +CREATE INDEX I_OD_VENT_PROCESS ON ODE_EVENT (PROCESS_ID); +CREATE INDEX I_OD_MSSG_MESSAGEEXCHANGE ON ODE_MESSAGE (MESSAGE_EXCHANGE_ID); +CREATE INDEX I_D_MSHNG_CORRELATOR ON ODE_MESSAGE_EXCHANGE (CORR_ID); +CREATE INDEX I_D_MSHNG_PARTNERLINK ON ODE_MESSAGE_EXCHANGE (PARTNER_LINK_ID); +CREATE INDEX I_D_MSHNG_PROCESS ON ODE_MESSAGE_EXCHANGE (PROCESS_ID); +CREATE INDEX I_D_MSHNG_PROCESSINST ON ODE_MESSAGE_EXCHANGE (PROCESS_INSTANCE_ID); +CREATE INDEX I_D_MSHNG_REQUEST ON ODE_MESSAGE_EXCHANGE (REQUEST_MESSAGE_ID); +CREATE INDEX I_D_MSHNG_RESPONSE ON ODE_MESSAGE_EXCHANGE (RESPONSE_MESSAGE_ID); +CREATE INDEX I_D_MS_RT_CORRELATOR ON ODE_MESSAGE_ROUTE (CORR_ID); +CREATE INDEX I_D_MS_RT_PROCESSINST ON ODE_MESSAGE_ROUTE (PROCESS_INSTANCE_ID); +CREATE INDEX I_D_MXPRP_MEX ON ODE_MEX_PROP (MEX_ID); +CREATE INDEX I_D_PRLNK_SCOPE ON ODE_PARTNER_LINK (SCOPE_ID); +CREATE INDEX I_D_PRTNC_FAULT ON ODE_PROCESS_INSTANCE (FAULT_ID); +CREATE INDEX I_D_PRTNC_INSTANTIATINGCORRELATOR ON ODE_PROCESS_INSTANCE (INSTANTIATING_CORRELATOR_ID); +CREATE INDEX I_D_PRTNC_PROCESS ON ODE_PROCESS_INSTANCE (PROCESS_ID); +CREATE INDEX I_D_PRTNC_ROOTSCOPE ON ODE_PROCESS_INSTANCE (ROOT_SCOPE_ID); +CREATE INDEX I_OD_SCOP_PARENTSCOPE ON ODE_SCOPE (PARENT_SCOPE_ID); +CREATE INDEX I_OD_SCOP_PROCESSINSTANCE ON ODE_SCOPE (PROCESS_INSTANCE_ID); +CREATE INDEX I_D_XM_DT_SCOPE ON ODE_XML_DATA (SCOPE_ID); +CREATE INDEX I_D_XMPRP_XMLDATA ON ODE_XML_DATA_PROP (XML_DATA_ID); +CREATE INDEX I_STR_CSS_DU ON STORE_PROCESS (DU); +CREATE INDEX I_STR_PRP_ELEMENT ON STORE_PROC_TO_PROP (ELEMENT_ID); +CREATE INDEX I_STR_PRP_PROCESSCONFDAOIMPL_PID ON STORE_PROC_TO_PROP (PROCESSCONFDAOIMPL_PID); + + + +-- +-- Human Task Related SQL Scripts +-- + + +CREATE TABLE HT_DEADLINE (id BIGINT NOT NULL, DEADLINE_DATE DATETIME NOT NULL, DEADLINE_NAME VARCHAR(255) NOT NULL, STATUS_TOBE_ACHIEVED VARCHAR(255) NOT NULL, TASK_ID BIGINT, PRIMARY KEY (id)) ENGINE = innodb; +CREATE TABLE HT_DEPLOYMENT_UNIT (id BIGINT NOT NULL, CHECKSUM VARCHAR(255) NOT NULL, DEPLOYED_ON DATETIME, DEPLOY_DIR VARCHAR(255) NOT NULL, NAME VARCHAR(255) NOT NULL, PACKAGE_NAME VARCHAR(255) NOT NULL, STATUS VARCHAR(255) NOT NULL, TENANT_ID BIGINT NOT NULL, VERSION BIGINT NOT NULL, PRIMARY KEY (id)) ENGINE = innodb; +CREATE TABLE HT_EVENT (id BIGINT NOT NULL, EVENT_DETAILS VARCHAR(255), NEW_STATE VARCHAR(255), OLD_STATE VARCHAR(255), EVENT_TIMESTAMP DATETIME NOT NULL, EVENT_TYPE VARCHAR(255) NOT NULL, EVENT_USER VARCHAR(255) NOT NULL, TASK_ID BIGINT, PRIMARY KEY (id)) ENGINE = innodb; +CREATE TABLE HT_GENERIC_HUMAN_ROLE (GHR_ID BIGINT NOT NULL, GHR_TYPE VARCHAR(255), TASK_ID BIGINT, PRIMARY KEY (GHR_ID)) ENGINE = innodb; +CREATE TABLE HT_HUMANROLE_ORGENTITY (HUMANROLE_ID BIGINT, ORGENTITY_ID BIGINT) ENGINE = innodb; +CREATE TABLE HT_JOB (id BIGINT NOT NULL, JOB_DETAILS VARCHAR(4000), JOB_NAME VARCHAR(255), NODEID VARCHAR(255), SCHEDULED VARCHAR(1) NOT NULL, TASKID BIGINT NOT NULL, JOB_TIME BIGINT NOT NULL, TRANSACTED VARCHAR(1) NOT NULL, JOB_TYPE VARCHAR(255) NOT NULL, PRIMARY KEY (id)) ENGINE = innodb; +CREATE TABLE HT_MESSAGE (MESSAGE_ID BIGINT NOT NULL, MESSAGE_DATA LONGTEXT, MESSAGE_HEADER LONGTEXT, MESSAGE_TYPE VARCHAR(255), MESSAGE_NAME VARCHAR(512), TASK_ID BIGINT, PRIMARY KEY (MESSAGE_ID)) ENGINE = innodb; +CREATE TABLE HT_ORG_ENTITY (ORG_ENTITY_ID BIGINT NOT NULL, ORG_ENTITY_NAME VARCHAR(255), ORG_ENTITY_TYPE VARCHAR(255), PRIMARY KEY (ORG_ENTITY_ID)) ENGINE = innodb; +CREATE TABLE HT_PRESENTATION_ELEMENT (id BIGINT NOT NULL, PE_CONTENT VARCHAR(2000), XML_LANG VARCHAR(255), PE_TYPE VARCHAR(31), CONTENT_TYPE VARCHAR(255), TASK_ID BIGINT, PRIMARY KEY (id)) ENGINE = innodb; +CREATE TABLE HT_PRESENTATION_PARAM (id BIGINT NOT NULL, PARAM_NAME VARCHAR(255), PARAM_TYPE VARCHAR(255), PARAM_VALUE VARCHAR(2000), TASK_ID BIGINT, PRIMARY KEY (id)) ENGINE = innodb; +CREATE TABLE HT_TASK (id BIGINT NOT NULL, ACTIVATION_TIME DATETIME, COMPLETE_BY_TIME DATETIME, CREATED_ON DATETIME, ESCALATED VARCHAR(1), EXPIRATION_TIME DATETIME, TASK_NAME VARCHAR(255) NOT NULL, PACKAGE_NAME VARCHAR(255) NOT NULL, PRIORITY INTEGER NOT NULL, SKIPABLE VARCHAR(1), START_BY_TIME DATETIME, STATUS VARCHAR(255) NOT NULL, STATUS_BEFORE_SUSPENSION VARCHAR(255), TASK_DEF_NAME VARCHAR(255) NOT NULL, TASK_VERSION BIGINT NOT NULL, TENANT_ID INTEGER NOT NULL, TASK_TYPE VARCHAR(255) NOT NULL, UPDATED_ON DATETIME, FAILURE_MESSAGE BIGINT, INPUT_MESSAGE BIGINT, OUTPUT_MESSAGE BIGINT, PARENTTASK_ID BIGINT, PRIMARY KEY (id)) ENGINE = innodb; +CREATE TABLE HT_TASK_ATTACHMENT (id BIGINT NOT NULL, ACCESS_TYPE VARCHAR(255), ATTACHED_AT DATETIME, CONTENT_TYPE VARCHAR(255), ATTACHMENT_NAME VARCHAR(255), ATTACHMENT_VALUE VARCHAR(255), TASK_ID BIGINT, ATTACHED_BY BIGINT, PRIMARY KEY (id)) ENGINE = innodb; +CREATE TABLE HT_TASK_COMMENT (id BIGINT NOT NULL, COMMENT_TEXT VARCHAR(4000), COMMENTED_BY VARCHAR(100), COMMENTED_ON DATETIME, MODIFIED_BY VARCHAR(100), MODIFIED_ON DATETIME, TASK_ID BIGINT, PRIMARY KEY (id)) ENGINE = innodb; +CREATE TABLE HT_VERSIONS (id BIGINT NOT NULL, TASK_VERSION BIGINT NOT NULL, PRIMARY KEY (id)) ENGINE = innodb; +CREATE INDEX I_HT_DDLN_TASK ON HT_DEADLINE (TASK_ID); +CREATE INDEX I_HT_VENT_TASK ON HT_EVENT (TASK_ID); +CREATE INDEX I_HT_G_RL_TASK ON HT_GENERIC_HUMAN_ROLE (TASK_ID); +CREATE INDEX I_HT_HTTY_ELEMENT ON HT_HUMANROLE_ORGENTITY (ORGENTITY_ID); +CREATE INDEX I_HT_HTTY_HUMANROLE_ID ON HT_HUMANROLE_ORGENTITY (HUMANROLE_ID); +CREATE INDEX I_HT_MSSG_TASK ON HT_MESSAGE (TASK_ID); +CREATE INDEX I_HT_PMNT_DTYPE ON HT_PRESENTATION_ELEMENT (PE_TYPE); +CREATE INDEX I_HT_PMNT_TASK ON HT_PRESENTATION_ELEMENT (TASK_ID); +CREATE INDEX I_HT_PPRM_TASK ON HT_PRESENTATION_PARAM (TASK_ID); +CREATE INDEX I_HT_TASK_FAILUREMESSAGE ON HT_TASK (FAILURE_MESSAGE); +CREATE INDEX I_HT_TASK_INPUTMESSAGE ON HT_TASK (INPUT_MESSAGE); +CREATE INDEX I_HT_TASK_OUTPUTMESSAGE ON HT_TASK (OUTPUT_MESSAGE); +CREATE INDEX I_HT_TASK_PARENTTASK ON HT_TASK (PARENTTASK_ID); +CREATE INDEX I_HT_TMNT_ATTACHEDBY ON HT_TASK_ATTACHMENT (ATTACHED_BY); +CREATE INDEX I_HT_TMNT_TASK ON HT_TASK_ATTACHMENT (TASK_ID); +CREATE INDEX I_HT_TMNT_TASK1 ON HT_TASK_COMMENT (TASK_ID); + +-- +-- Attachment Management Related SQL Scripts +-- +CREATE TABLE ATTACHMENT ( + id BIGINT NOT NULL AUTO_INCREMENT, + CREATED_TIME TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + ATTACHMENT_NAME VARCHAR(255) NOT NULL, + CREATED_BY VARCHAR(255) NOT NULL, + CONTENT_TYPE VARCHAR(255) NOT NULL, + ATTACHMENT_URL VARCHAR(2048) NOT NULL, + ATTACHMENT_CONTENT BLOB, + PRIMARY KEY (id)); + +-- CREATE INDEX I_ATTACHMENT_URL ON ATTACHMENT (ATTACHMENT_URL); + + +-- +-- B4P Related SQL Scripts +-- +CREATE TABLE HT_COORDINATION_DATA (MESSAGE_ID VARCHAR(255) NOT NULL, PROCESS_INSTANCE_ID VARCHAR(255), PROTOCOL_HANDlER_URL VARCHAR(255) NOT NULL, TASK_ID VARCHAR(255), PRIMARY KEY (MESSAGE_ID)) ENGINE = innodb; diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/dbscripts/bps/bpel/create/wso-bpel-mysql-createdb.sql b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/dbscripts/bps/bpel/create/wso-bpel-mysql-createdb.sql new file mode 100644 index 0000000..16dca47 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/dbscripts/bps/bpel/create/wso-bpel-mysql-createdb.sql @@ -0,0 +1,31 @@ +-- +-- 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. +-- + +/******************drop old database and user***************************/ +use mysql; +drop database IF EXISTS wso_bpel; +delete from user where User='wso_bpel'; +FLUSH PRIVILEGES; + +/******************create new database and user***************************/ +create database wso_bpel CHARACTER SET utf8; + +GRANT ALL PRIVILEGES ON wso_bpel.* TO 'wso_bpel'@'%' IDENTIFIED BY 'wso_bpel' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON mysql.* TO 'wso_bpel'@'%' IDENTIFIED BY 'wso_bpel' WITH GRANT OPTION; + +GRANT ALL PRIVILEGES ON wso_bpel.* TO 'wso_bpel'@'localhost' IDENTIFIED BY 'wso_bpel' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON mysql.* TO 'wso_bpel'@'localhost' IDENTIFIED BY 'wso_bpel' WITH GRANT OPTION; +FLUSH PRIVILEGES; \ No newline at end of file diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/bps.xml b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/bps.xml new file mode 100644 index 0000000..1e09356 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/bps.xml @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 50 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + + + + + + + + + + + + + + + + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/carbon/bps.xml b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/carbon/bps.xml new file mode 100644 index 0000000..1e09356 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/carbon/bps.xml @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 50 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + + + + + + + + + + + + + + + + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/carbon/carbon.xml b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/carbon/carbon.xml new file mode 100644 index 0000000..6973b7c --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/carbon/carbon.xml @@ -0,0 +1,683 @@ + + + + + + + + + WSO2 Business Process Server + + + BPS + + + 3.5.0 + + + + + + + + + local:/${carbon.context}/services/ + + + + + + + BusinessProcessServer + + + + + + + org.wso2.carbon + + + / + + + + + + + + + 15 + + + + + + + + + 0 + + + + + 9999 + + 11111 + + + + + + 10389 + + 8000 + + + + + + 10500 + + + + + + + org.wso2.carbon.tomcat.jndi.CarbonJavaURLContextFactory + + + + + + + + + java + + + + + + + + + + false + + + false + + + 600 + + + + false + + + + + + + + 30 + + + + + + + + + 15 + + + + + + ${carbon.home}/repository/deployment/server/ + + + 15 + + + ${carbon.home}/repository/conf/axis2/axis2.xml + + + 30000 + + + ${carbon.home}/repository/deployment/client/ + + ${carbon.home}/repository/conf/axis2/axis2_client.xml + + false + + + + + + + + + + admin + Default Administrator Role + + + user + Default User Role + + + + + + + + + + + + ${carbon.home}/repository/resources/security/wso2carbon.jks + + JKS + + wso2carbon + + wso2carbon + + wso2carbon + + + + + + ${carbon.home}/repository/resources/security/client-truststore.jks + + JKS + + wso2carbon + + + + + + + + + + + + + + + + + + + UserManager + + + false + + + + + + + + + + ${carbon.home}/tmp/work + + + + + + true + + + 10 + + + 30 + + + + + + 100 + + + + keystore + certificate + * + + org.wso2.carbon.ui.transports.fileupload.AnyFileUploadExecutor + + + + + jarZip + + org.wso2.carbon.ui.transports.fileupload.JarZipUploadExecutor + + + + dbs + + org.wso2.carbon.ui.transports.fileupload.DBSFileUploadExecutor + + + + tools + + org.wso2.carbon.ui.transports.fileupload.ToolsFileUploadExecutor + + + + toolsAny + + org.wso2.carbon.ui.transports.fileupload.ToolsAnyFileUploadExecutor + + + + + + + info + org.wso2.carbon.core.transports.util.InfoProcessor + + + wsdl + org.wso2.carbon.core.transports.util.Wsdl11Processor + + + wsdl2 + org.wso2.carbon.core.transports.util.Wsdl20Processor + + + xsd + org.wso2.carbon.core.transports.util.XsdProcessor + + + + + + false + false + true + svn + http://svnrepo.example.com/repos/ + username + password + true + + + + + + + + + + + + + + + ${require.carbon.servlet} + + + + + true + + + + + + + default repository + http://dist.wso2.org/p2/carbon/releases/4.4.1-SNAPSHOT + + + + + + + + true + + + + + + true + + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/datasources/activiti-datasources.xml b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/datasources/activiti-datasources.xml new file mode 100644 index 0000000..f95cb87 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/datasources/activiti-datasources.xml @@ -0,0 +1,32 @@ + + + + org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader + + + + + + ACTIVITI_DB + The datasource used for activiti engine + + jdbc/ActivitiDB + + + + jdbc:h2:repository/database/activiti;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000 + wso2carbon + wso2carbon + org.h2.Driver + 50 + 60000 + true + SELECT 1 + 30000 + + + + + + + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/datasources/bps-datasources.xml b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/datasources/bps-datasources.xml new file mode 100644 index 0000000..22f79f7 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/datasources/bps-datasources.xml @@ -0,0 +1,32 @@ + + + + org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader + + + + + BPS_DS + + + bpsds + + + + jdbc:mysql://localhost:3306/wso_bpel + wso_bpel + wso_bpel + com.mysql.jdbc.Driver + true + SELECT 1 + 30000 + false + true + 100 + 20 + 10000 + + + + + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/datasources/master-datasources.xml b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/datasources/master-datasources.xml new file mode 100644 index 0000000..897e335 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/datasources/master-datasources.xml @@ -0,0 +1,68 @@ + + + + org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader + + + + + + WSO2_CARBON_DB + The datasource used for registry and user manager + + jdbc/WSO2CarbonDB + + + + jdbc:h2:repository/database/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000 + wso2carbon + wso2carbon + org.h2.Driver + 50 + 60000 + true + SELECT 1 + 30000 + false + + + + + + + + + + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/wso2bps-ext.properties b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/wso2bps-ext.properties new file mode 100644 index 0000000..02d1b6d --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/wso2bps-ext.properties @@ -0,0 +1 @@ +MSB_URL=http://127.0.0.1:80 \ No newline at end of file diff --git a/wso2/wso2bpel-ext/wso2bpel-core/pom.xml b/wso2/wso2bpel-ext/wso2bpel-core/pom.xml new file mode 100644 index 0000000..144066e --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/pom.xml @@ -0,0 +1,36 @@ + + + + + org.openo.common-services.common-utilities.wso2bpel-ext + wso2bpel-root + 1.1.0-SNAPSHOT + + + 4.0.0 + wso2bpel-core-parent + common-services-common-utilities/wso2bpel-ext/wso2bpel-core + pom + + + BPEL4RESTLight + wso2bpel-mgr + distribution + + diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/pom.xml b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/pom.xml new file mode 100644 index 0000000..5a7eac8 --- /dev/null +++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/pom.xml @@ -0,0 +1,453 @@ + + + + + + org.openo.common-services.common-utilities.wso2bpel-ext + wso2bpel-core-parent + 1.1.0-SNAPSHOT + + + 4.0.0 + wso2bpel-mgr + common-services-common-utilities/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr + jar + + true + + + + + wso2-nexus + http://dist.wso2.org/maven2 + + true + + + false + + + + smartbearsoftware + http://smartbearsoftware.com/repository/maven2/ + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + UTF-8 + + -verbose + -Xlint:unchecked + -Xlint:deprecation + -bootclasspath + ${env.JAVA_HOME}/jre/lib/rt.jar + + + + + org.eclipse.m2e + lifecycle-mapping + + + + + + org.apache.maven.plugins + maven-dependency-plugin + [2.0,) + + copy-dependencies + + + + + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + + + + + + org.apache.maven.plugins + maven-shade-plugin + + true + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + + package + + shade + + + + + + org.openo.carbon.bpel.Wso2BpelApplication + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-dependencies + package + + copy-dependencies + + + + + io.dropwizard + dropwizard-core + ${dropwizard.version} + true + + + + + + + + + + + + io.dropwizard + dropwizard-core + + + io.dropwizard + dropwizard-assets + + + io.dropwizard + dropwizard-hibernate + + + + org.projectlombok + lombok + + + io.swagger + swagger-jersey2-jaxrs + + + + org.glassfish.jersey.core + jersey-server + + + org.glassfish.jersey.media + jersey-media-multipart + + + org.glassfish.jersey.containers + jersey-container-servlet-core + + + + com.eclipsesource.jaxrs + consumer + + + com.eclipsesource.jaxrs + jersey-all + + + + + + com.google.code.gson + gson + + + + junit + junit + test + + + org.powermock + powermock-module-junit4 + test + + + org.powermock + powermock-api-mockito + test + + + org.apache.ant + ant + test + + + + + + org.apache.ws.commons.axiom.wso2 + axiom + 1.2.11.wso2v4 + + + axion.wso2 + axion + 1.0.0.M3-dev-wso2v1 + + + org.apache.axis2.wso2 + axis2 + 1.6.1.wso2v10 + + + org.apache.axis2.wso2 + axis2-jaxbri + 1.6.1.wso2v10 + + + org.apache.axis2.wso2 + axis2-json + 1.6.1.wso2v10 + + + org.apache.axis2 + axis2-transport-jms + 1.0.0 + + + org.apache.axis2 + axis2-transport-mail + 1.0.0 + + + org.apache.axis2 + axis2-transport-sms + 1.0.0 + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-log4j12 + + + + + commons-beanutils + commons-beanutils + 1.9.2 + + + commons-codec.wso2 + commons-codec + 1.4.0.wso2v1 + + + commons-collections + commons-collections + 3.2.1 + + + commons-fileupload.wso2 + commons-fileupload + 1.2.2.wso2v1 + + + commons-httpclient.wso2 + commons-httpclient + 3.1.0.wso2v2 + + + commons-io.wso2 + commons-io + 2.0.0.wso2v2 + + + commons-lang + commons-lang + 2.5 + + + org.apache.commons + commons-lang3 + 3.2 + + + commons-logging + commons-logging + 1.0.4 + + + net.sf.ezmorph + ezmorph + 1.0.6 + + + org.apache.httpcomponents.wso2 + httpclient + 4.2.5.wso2v1 + + + org.apache.httpcomponents.wso2 + httpcore + 4.3.0.wso2v1 + + + org.apache.httpcomponents + httpmime + 4.3.1 + + + com.fasterxml.jackson.core + jackson-annotations + 2.5.0 + + + javassist + javassist + 3.3.GA + + + javax.annotation + javax.annotation-api + 1.2 + + + javax.ws.rs + javax.ws.rs-api + 2.0.1 + + + jdom + jdom + 0.7 + + + org.glassfish.jersey.media + jersey-media-jaxb + 2.25 + + + org.glassfish.jersey.media + jersey-media-multipart + 2.22.2 + + + net.sf.json-lib + json-lib + 2.4 + jdk15 + + + log4j + log4j + 1.2.16 + + + com.jgoodies + looks + 2.2.1 + + + org.jvnet.mimepull + mimepull + 1.9.3 + + + org.apache.neethi.wso2 + neethi + 2.0.4.wso2v4 + + + org.wso2.carbon + org.wso2.carbon.bpel.stub + 4.2.1 + + + org.wso2.securevault + org.wso2.securevault + 1.0.0-wso2v2 + + + wsdl4j.wso2 + wsdl4j + 1.6.2.wso2v4 + + + org.apache.xmlbeans + xmlbeans + 2.4.0 + + + org.apache.ws.commons.schema.wso2 + XmlSchema + 1.4.7.wso2v2 + + + + eviware + soapui + 1.7.5 + + + eviware + soapui-xmlbeans + 1.7.5 + + + + 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.$('