summaryrefslogtreecommitdiffstats
path: root/wso2
diff options
context:
space:
mode:
Diffstat (limited to 'wso2')
-rw-r--r--wso2/.gitattributes2
-rw-r--r--wso2/.gitignore8
-rw-r--r--wso2/.gitreview4
-rw-r--r--wso2/License.txt473
-rw-r--r--wso2/baseservice-i18n/pom.xml66
-rw-r--r--wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/DefaultErrorCodeI18n.java278
-rw-r--r--wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/DefaultI18nService.java59
-rw-r--r--wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/ErrorCodeException.java53
-rw-r--r--wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/ErrorCodeI18n.java151
-rw-r--r--wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18n.java132
-rw-r--r--wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nContainer.java148
-rw-r--r--wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nImpl.java137
-rw-r--r--wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nItem.java53
-rw-r--r--wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nJsonUtil.java170
-rw-r--r--wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nService.java38
-rw-r--r--wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/JsonResourceScanner.java81
-rw-r--r--wso2/common-util/.gitignore5
-rw-r--r--wso2/common-util/pom.xml142
-rw-r--r--wso2/common-util/src/main/java/org/openo/baseservice/bus/util/BusConstant.java48
-rw-r--r--wso2/common-util/src/main/java/org/openo/baseservice/bus/util/RegisterService.java177
-rw-r--r--wso2/common-util/src/main/java/org/openo/baseservice/bus/util/RegisterServiceListener.java70
-rw-r--r--wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/CipherCreator.java95
-rw-r--r--wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/impl/AesCipher.java132
-rw-r--r--wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/impl/AesCipherFactory.java54
-rw-r--r--wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/inf/AbstractCipher.java50
-rw-r--r--wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/inf/AbstractCipherFactory.java45
-rw-r--r--wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/sha/Sha256.java110
-rw-r--r--wso2/common-util/src/main/java/org/openo/baseservice/util/RestUtils.java82
-rw-r--r--wso2/common-util/src/main/java/org/openo/baseservice/util/impl/SystemEnvVariablesDefImpl.java68
-rw-r--r--wso2/common-util/src/main/java/org/openo/baseservice/util/impl/SystemEnvVariablesFactory.java55
-rw-r--r--wso2/common-util/src/main/java/org/openo/baseservice/util/inf/SystemEnvVariables.java35
-rw-r--r--wso2/common-util/src/test/java/org/openo/baseservice/bus/util/TestRegisterService.java66
-rw-r--r--wso2/common-util/src/test/java/org/openo/baseservice/bus/util/TestRegisterServiceListener.java60
-rw-r--r--wso2/common-util/src/test/java/org/openo/baseservice/encrypt/cbb/impl/AesCipherTest.java210
-rw-r--r--wso2/common-util/src/test/java/org/openo/baseservice/encrypt/cbb/sha/Sha256Test.java193
-rw-r--r--wso2/common-util/src/test/java/org/openo/baseservice/util/RestUtilsTest.java190
-rw-r--r--wso2/common-util/src/test/java/org/openo/baseservice/util/impl/SystemEnvVariablesDefImplTest.java113
-rw-r--r--wso2/dropwizard-ioc-container/pom.xml80
-rw-r--r--wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/BaseService.java34
-rw-r--r--wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/Lazy.java34
-rw-r--r--wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/PostBaseService.java34
-rw-r--r--wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/PreBaseService.java34
-rw-r--r--wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/PreLoad.java34
-rw-r--r--wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/PreServiceLoad.java35
-rw-r--r--wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/bundle/AutoConfigBundle.java430
-rw-r--r--wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/bundle/AutoConfigBundleBuider.java42
-rw-r--r--wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/bundle/IOCApplication.java42
-rw-r--r--wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/bundle/ServiceLocatorManaged.java51
-rw-r--r--wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/utils/ServiceBinder.java52
-rw-r--r--wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/utils/ServiceLocatorHolder.java36
-rw-r--r--wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/IOCBundleTest.java49
-rw-r--r--wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/PreTestService.java33
-rw-r--r--wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/TestService.java41
-rw-r--r--wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/app/ExampleApp.java35
-rw-r--r--wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/conf/TestConfiguration.java26
-rw-r--r--wso2/dropwizard-ioc-container/src/test/resources/example.yml8
-rw-r--r--wso2/logging-sdk/pom.xml85
-rw-r--r--wso2/logging-sdk/src/main/java/org/openo/log/api/LogMessage.java132
-rw-r--r--wso2/logging-sdk/src/main/java/org/openo/log/api/LogService.java140
-rw-r--r--wso2/logging-sdk/src/main/java/org/openo/log/api/OperLogMessage.java286
-rw-r--r--wso2/logging-sdk/src/main/java/org/openo/log/api/SecLogMessage.java146
-rw-r--r--wso2/logging-sdk/src/main/java/org/openo/log/api/SysLogMessage.java180
-rw-r--r--wso2/logging-sdk/src/main/java/org/openo/log/impl/Facitility.java137
-rw-r--r--wso2/logging-sdk/src/main/java/org/openo/log/impl/InsertLogHandler.java265
-rw-r--r--wso2/logging-sdk/src/main/java/org/openo/log/impl/LogConst.java37
-rw-r--r--wso2/logging-sdk/src/main/java/org/openo/log/impl/LogIdTool.java67
-rw-r--r--wso2/logging-sdk/src/main/java/org/openo/log/test/TestLogback2Logstash.java58
-rw-r--r--wso2/logging-sdk/src/main/java/org/openo/log/test/logback.xml22
-rw-r--r--wso2/pom.xml332
-rw-r--r--wso2/rest-client/.gitignore1
-rw-r--r--wso2/rest-client/pom.xml88
-rw-r--r--wso2/rest-client/src/main/java/org/openo/baseservice/remoteservice/exception/ExceptionArgs.java110
-rw-r--r--wso2/rest-client/src/main/java/org/openo/baseservice/remoteservice/exception/ServiceException.java269
-rw-r--r--wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/ReaderHelper.java61
-rw-r--r--wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/DefaultAsyncCallback.java37
-rw-r--r--wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/HttpBaseRest.java273
-rw-r--r--wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/HttpRest.java254
-rw-r--r--wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestHttpContentExchange.java234
-rw-r--r--wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/Restful.java298
-rw-r--r--wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulAsyncCallback.java43
-rw-r--r--wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulClientConst.java63
-rw-r--r--wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulConfigure.java162
-rw-r--r--wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulFactory.java95
-rw-r--r--wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulOptions.java170
-rw-r--r--wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulParametes.java155
-rw-r--r--wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulResponse.java144
-rw-r--r--wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/ReaderHelperTest.java116
-rw-r--r--wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/TestServiceUtil.java92
-rw-r--r--wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestHttpRest.java1179
-rw-r--r--wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestHttpContentExchange.java592
-rw-r--r--wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulConfigure.java238
-rw-r--r--wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulFactory.java109
-rw-r--r--wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulOptions.java288
-rw-r--r--wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulParametes.java229
-rw-r--r--wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulResponse.java273
-rw-r--r--wso2/rest-client/src/test/resources/etc/conf/restclient.json11
-rw-r--r--wso2/rest-client/src/test/resources/rest-client-test.json11
-rw-r--r--wso2/wso2bpel-ext/pom.xml45
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/pom.xml181
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/Bpel4RestLightExtensionBundle.java48
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/Bpel4RestLightOperation.java147
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/EPRDemoOperation.java74
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/MethodAttribute.java17
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/extensions/bpel4restlight/util/Bpel4RestLightUtil.java113
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/util/BPELVariableInjectionUtil.java149
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/bpel/util/BpelUtil.java102
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/xml/DomXmlConverter.java179
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/de/unistuttgart/iaas/xml/XPathEvaluator.java34
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/HighLevelRestApi.java178
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/HttpMethod.java20
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/HttpResponseMessage.java53
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight/src/main/java/org/opentosca/bpel4restlight/rest/LowLevelRestApi.java182
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/pom.xml34
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/pom.xml401
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/initDB.sh53
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/run.bat32
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/run.sh32
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/stop.bat28
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/stop.sh30
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/find_kill_process.bat24
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/shutdown.bat34
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/shutdown.sh61
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/startup.bat42
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/bin/startup.sh36
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps-ext/conf/wso2bpel.yml73
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/bin/find_kill_process.bat23
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/bin/shutdown.bat34
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/bin/shutdown.sh44
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/dbscripts/bps/bpel/create/mysql.sql170
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/dbscripts/bps/bpel/create/wso-bpel-mysql-createdb.sql31
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/bps.xml174
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/carbon/bps.xml174
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/carbon/carbon.xml683
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/datasources/activiti-datasources.xml32
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/datasources/bps-datasources.xml32
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/repository/conf/datasources/master-datasources.xml68
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/distribution/standalone/src/main/assembly/wso2bps/wso2bps-ext.properties1
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/pom.xml36
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/pom.xml453
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/Wso2BpelApplication.java106
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/Wso2BpelConfiguration.java200
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/common/Config.java30
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/common/ServiceRegistrer.java70
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/entity/ServiceNode.java33
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/entity/ServiceRegisterEntity.java57
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/msb/MicroserviceBusConsumer.java48
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/externalservice/msb/MicroserviceBusRest.java39
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/BpsPackage.java632
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/BpsProcess.java544
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/BpsServiceException.java30
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/resources/RestAppConfig.java37
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/ClientWsdlLoader.java82
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/JsonUtil.java61
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/LRULinkedHashMap.java106
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/SoapUtil.java156
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/java/org/openo/carbon/bpel/util/Xml2JsonUtil.java141
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/META-INF/MANIFEST.MF3
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/WEB-INF/web.xml41
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/css/reset.css140
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/css/screen.css1271
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/css/typography.css41
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.eotbin0 -> 22924 bytes
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.svg411
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.ttfbin0 -> 40516 bytes
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.woffbin0 -> 25992 bytes
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.woff2bin0 -> 11480 bytes
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.eotbin0 -> 22008 bytes
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.svg403
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.ttfbin0 -> 39072 bytes
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.woffbin0 -> 24868 bytes
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.woff2bin0 -> 11304 bytes
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/explorer_icons.pngbin0 -> 5763 bytes
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/logo_small.pngbin0 -> 770 bytes
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/pet_store_api.pngbin0 -> 824 bytes
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/throbber.gifbin0 -> 9257 bytes
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/wordnik_api.pngbin0 -> 980 bytes
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/index.html115
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/backbone-min.js30
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/handlebars-2.0.0.js43
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/highlight.7.3.pack.js16
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery-1.8.0.min.js17
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery.ba-bbq.min.js25
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery.slideto.min.js16
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery.wiggle.min.js23
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/marked.js1281
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/shred.bundle.js2780
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/shred/content.js208
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/swagger-client.js3309
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/swagger-oauth.js294
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/underscore-min.js21
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/o2c.html37
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/swagger-ui.js2255
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/swagger-ui.min.js17
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/banner.txt25
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/config.properties16
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/migrations.xml38
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/wso2-config.properties24
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-parent/pom.xml36
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-parent/wso2bpelparent-lite/pom.xml120
-rw-r--r--wso2/wso2bpel-ext/wso2bpel-parent/wso2bpelparent/pom.xml124
200 files changed, 32374 insertions, 0 deletions
diff --git a/wso2/.gitattributes b/wso2/.gitattributes
new file mode 100644
index 0000000..13e92ef
--- /dev/null
+++ b/wso2/.gitattributes
@@ -0,0 +1,2 @@
+*.java text eol=lf
+*.xml text eol=lf
diff --git a/wso2/.gitignore b/wso2/.gitignore
new file mode 100644
index 0000000..7020020
--- /dev/null
+++ b/wso2/.gitignore
@@ -0,0 +1,8 @@
+target
+# Eclipse
+.settings/
+.classpath
+.project
+.idea
+*.iml
+dependency-reduced-pom.xml
diff --git a/wso2/.gitreview b/wso2/.gitreview
new file mode 100644
index 0000000..f21a39a
--- /dev/null
+++ b/wso2/.gitreview
@@ -0,0 +1,4 @@
+[gerrit]
+host=gerrit.open-o.org
+port=29418
+project=common-services-common-utilities.git
diff --git a/wso2/License.txt b/wso2/License.txt
new file mode 100644
index 0000000..dd08487
--- /dev/null
+++ b/wso2/License.txt
@@ -0,0 +1,473 @@
+THIS LICENSE FILE CONTAINS THE LICENSE APPLICABLE DEPENDING ON THE TYPE OF CONTRIBUTIONS.
+
+APACHE LICENSE 2 IS APPLICABLE FOR SOURCE CODE, CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL FOR DOCUMENTATION
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+
+Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License.
+
+Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License.
+
+Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution.
+
+You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
+You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions.
+
+Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks.
+
+This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty.
+
+Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability.
+
+In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability.
+
+While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+Attribution 4.0 International
+
+https://creativecommons.org/licenses/by/4.0/legalcode
+
+---------------------------------------------------------------------------------------
+
+Creative Commons Corporation ("Creative Commons") is not a law firm and
+does not provide legal services or legal advice. Distribution of
+Creative Commons public licenses does not create a lawyer-client or
+other relationship. Creative Commons makes its licenses and related
+information available on an "as-is" basis. Creative Commons gives no
+warranties regarding its licenses, any material licensed under their
+terms and conditions, or any related information. Creative Commons
+disclaims all liability for damages resulting from their use to the
+fullest extent possible.
+
+Using Creative Commons Public Licenses
+
+Creative Commons public licenses provide a standard set of terms and
+conditions that creators and other rights holders may use to share
+original works of authorship and other material subject to copyright
+and certain other rights specified in the public license below. The
+following considerations are for informational purposes only, are not
+exhaustive, and do not form part of our licenses.
+
+ Considerations for licensors: Our public licenses are
+ intended for use by those authorized to give the public
+ permission to use material in ways otherwise restricted by
+ copyright and certain other rights. Our licenses are
+ irrevocable. Licensors should read and understand the terms
+ and conditions of the license they choose before applying it.
+ Licensors should also secure all rights necessary before
+ applying our licenses so that the public can reuse the
+ material as expected. Licensors should clearly mark any
+ material not subject to the license. This includes other CC-
+ licensed material, or material used under an exception or
+ limitation to copyright. More considerations for licensors:
+ wiki.creativecommons.org/Considerations_for_licensors
+
+ Considerations for the public: By using one of our public
+ licenses, a licensor grants the public permission to use the
+ licensed material under specified terms and conditions. If
+ the licensor's permission is not necessary for any reason--for
+ example, because of any applicable exception or limitation to
+ copyright--then that use is not regulated by the license. Our
+ licenses grant only permissions under copyright and certain
+ other rights that a licensor has authority to grant. Use of
+ the licensed material may still be restricted for other
+ reasons, including because others have copyright or other
+ rights in the material. A licensor may make special requests,
+ such as asking that all changes be marked or described.
+ Although not required by our licenses, you are encouraged to
+ respect those requests where reasonable. More_considerations
+ for the public:
+ wiki.creativecommons.org/Considerations_for_licensees
+
+---------------------------------------------------------------------------------------
+
+Creative Commons Attribution 4.0 International Public License
+
+By exercising the Licensed Rights (defined below), You accept and agree
+to be bound by the terms and conditions of this Creative Commons
+Attribution 4.0 International Public License ("Public License"). To the
+extent this Public License may be interpreted as a contract, You are
+granted the Licensed Rights in consideration of Your acceptance of
+these terms and conditions, and the Licensor grants You such rights in
+consideration of benefits the Licensor receives from making the
+Licensed Material available under these terms and conditions.
+
+
+Section 1 -- Definitions.
+
+ a. Adapted Material means material subject to Copyright and Similar
+ Rights that is derived from or based upon the Licensed Material
+ and in which the Licensed Material is translated, altered,
+ arranged, transformed, or otherwise modified in a manner requiring
+ permission under the Copyright and Similar Rights held by the
+ Licensor. For purposes of this Public License, where the Licensed
+ Material is a musical work, performance, or sound recording,
+ Adapted Material is always produced where the Licensed Material is
+ synched in timed relation with a moving image.
+
+ b. Adapter's License means the license You apply to Your Copyright
+ and Similar Rights in Your contributions to Adapted Material in
+ accordance with the terms and conditions of this Public License.
+
+ c. Copyright and Similar Rights means copyright and/or similar rights
+ closely related to copyright including, without limitation,
+ performance, broadcast, sound recording, and Sui Generis Database
+ Rights, without regard to how the rights are labeled or
+ categorized. For purposes of this Public License, the rights
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
+ Rights.
+
+ d. Effective Technological Measures means those measures that, in the
+ absence of proper authority, may not be circumvented under laws
+ fulfilling obligations under Article 11 of the WIPO Copyright
+ Treaty adopted on December 20, 1996, and/or similar international
+ agreements.
+
+ e. Exceptions and Limitations means fair use, fair dealing, and/or
+ any other exception or limitation to Copyright and Similar Rights
+ that applies to Your use of the Licensed Material.
+
+ f. Licensed Material means the artistic or literary work, database,
+ or other material to which the Licensor applied this Public
+ License.
+
+ g. Licensed Rights means the rights granted to You subject to the
+ terms and conditions of this Public License, which are limited to
+ all Copyright and Similar Rights that apply to Your use of the
+ Licensed Material and that the Licensor has authority to license.
+
+ h. Licensor means the individual(s) or entity(ies) granting rights
+ under this Public License.
+
+ i. Share means to provide material to the public by any means or
+ process that requires permission under the Licensed Rights, such
+ as reproduction, public display, public performance, distribution,
+ dissemination, communication, or importation, and to make material
+ available to the public including in ways that members of the
+ public may access the material from a place and at a time
+ individually chosen by them.
+
+ j. Sui Generis Database Rights means rights other than copyright
+ resulting from Directive 96/9/EC of the European Parliament and of
+ the Council of 11 March 1996 on the legal protection of databases,
+ as amended and/or succeeded, as well as other essentially
+ equivalent rights anywhere in the world.
+
+ k. You means the individual or entity exercising the Licensed Rights
+ under this Public License. Your has a corresponding meaning.
+
+
+Section 2 -- Scope.
+
+ a. License grant.
+
+ 1. Subject to the terms and conditions of this Public License,
+ the Licensor hereby grants You a worldwide, royalty-free,
+ non-sublicensable, non-exclusive, irrevocable license to
+ exercise the Licensed Rights in the Licensed Material to:
+
+ a. reproduce and Share the Licensed Material, in whole or
+ in part; and
+
+ b. produce, reproduce, and Share Adapted Material.
+
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
+ Exceptions and Limitations apply to Your use, this Public
+ License does not apply, and You do not need to comply with
+ its terms and conditions.
+
+ 3. Term. The term of this Public License is specified in Section
+ 6(a).
+
+ 4. Media and formats; technical modifications allowed. The
+ Licensor authorizes You to exercise the Licensed Rights in
+ all media and formats whether now known or hereafter created,
+ and to make technical modifications necessary to do so. The
+ Licensor waives and/or agrees not to assert any right or
+ authority to forbid You from making technical modifications
+ necessary to exercise the Licensed Rights, including
+ technical modifications necessary to circumvent Effective
+ Technological Measures. For purposes of this Public License,
+ simply making modifications authorized by this Section 2(a)
+ (4) never produces Adapted Material.
+
+ 5. Downstream recipients.
+
+ a. Offer from the Licensor -- Licensed Material. Every
+ recipient of the Licensed Material automatically
+ receives an offer from the Licensor to exercise the
+ Licensed Rights under the terms and conditions of this
+ Public License.
+
+ b. No downstream restrictions. You may not offer or impose
+ any additional or different terms or conditions on, or
+ apply any Effective Technological Measures to, the
+ Licensed Material if doing so restricts exercise of the
+ Licensed Rights by any recipient of the Licensed
+ Material.
+
+ 6. No endorsement. Nothing in this Public License constitutes or
+ may be construed as permission to assert or imply that You
+ are, or that Your use of the Licensed Material is, connected
+ with, or sponsored, endorsed, or granted official status by,
+ the Licensor or others designated to receive attribution as
+ provided in Section 3(a)(1)(A)(i).
+
+ b. Other rights.
+
+ 1. Moral rights, such as the right of integrity, are not
+ licensed under this Public License, nor are publicity,
+ privacy, and/or other similar personality rights; however, to
+ the extent possible, the Licensor waives and/or agrees not to
+ assert any such rights held by the Licensor to the limited
+ extent necessary to allow You to exercise the Licensed
+ Rights, but not otherwise.
+
+ 2. Patent and trademark rights are not licensed under this
+ Public License.
+
+ 3. To the extent possible, the Licensor waives any right to
+ collect royalties from You for the exercise of the Licensed
+ Rights, whether directly or through a collecting society
+ under any voluntary or waivable statutory or compulsory
+ licensing scheme. In all other cases the Licensor expressly
+ reserves any right to collect such royalties.
+
+
+Section 3 -- License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the
+following conditions.
+
+ a. Attribution.
+
+ 1. If You Share the Licensed Material (including in modified
+ form), You must:
+
+ a. retain the following if it is supplied by the Licensor
+ with the Licensed Material:
+
+ i. identification of the creator(s) of the Licensed
+ Material and any others designated to receive
+ attribution, in any reasonable manner requested by
+ the Licensor (including by pseudonym if
+ designated);
+
+ ii. a copyright notice;
+
+ iii. a notice that refers to this Public License;
+
+ iv. a notice that refers to the disclaimer of
+ warranties;
+
+ v. a URI or hyperlink to the Licensed Material to the
+ extent reasonably practicable;
+
+ b. indicate if You modified the Licensed Material and
+ retain an indication of any previous modifications; and
+
+ c. indicate the Licensed Material is licensed under this
+ Public License, and include the text of, or the URI or
+ hyperlink to, this Public License.
+
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
+ reasonable manner based on the medium, means, and context in
+ which You Share the Licensed Material. For example, it may be
+ reasonable to satisfy the conditions by providing a URI or
+ hyperlink to a resource that includes the required
+ information.
+
+ 3. If requested by the Licensor, You must remove any of the
+ information required by Section 3(a)(1)(A) to the extent
+ reasonably practicable.
+
+ 4. If You Share Adapted Material You produce, the Adapter's
+ License You apply must not prevent recipients of the Adapted
+ Material from complying with this Public License.
+
+
+Section 4 -- Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that
+apply to Your use of the Licensed Material:
+
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
+ to extract, reuse, reproduce, and Share all or a substantial
+ portion of the contents of the database;
+
+ b. if You include all or a substantial portion of the database
+ contents in a database in which You have Sui Generis Database
+ Rights, then the database in which You have Sui Generis Database
+ Rights (but not its individual contents) is Adapted Material; and
+
+ c. You must comply with the conditions in Section 3(a) if You Share
+ all or a substantial portion of the contents of the database.
+
+For the avoidance of doubt, this Section 4 supplements and does not
+replace Your obligations under this Public License where the Licensed
+Rights include other Copyright and Similar Rights.
+
+
+Section 5 -- Disclaimer of Warranties and Limitation of Liability.
+
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
+
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
+
+ c. The disclaimer of warranties and limitation of liability provided
+ above shall be interpreted in a manner that, to the extent
+ possible, most closely approximates an absolute disclaimer and
+ waiver of all liability.
+
+
+Section 6 -- Term and Termination.
+
+ a. This Public License applies for the term of the Copyright and
+ Similar Rights licensed here. However, if You fail to comply with
+ this Public License, then Your rights under this Public License
+ terminate automatically.
+
+ b. Where Your right to use the Licensed Material has terminated under
+ Section 6(a), it reinstates:
+
+ 1. automatically as of the date the violation is cured, provided
+ it is cured within 30 days of Your discovery of the
+ violation; or
+
+ 2. upon express reinstatement by the Licensor.
+
+ For the avoidance of doubt, this Section 6(b) does not affect any
+ right the Licensor may have to seek remedies for Your violations
+ of this Public License.
+
+ c. For the avoidance of doubt, the Licensor may also offer the
+ Licensed Material under separate terms or conditions or stop
+ distributing the Licensed Material at any time; however, doing so
+ will not terminate this Public License.
+
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
+ License.
+
+
+Section 7 -- Other Terms and Conditions.
+
+ a. The Licensor shall not be bound by any additional or different
+ terms or conditions communicated by You unless expressly agreed.
+
+ b. Any arrangements, understandings, or agreements regarding the
+ Licensed Material not stated herein are separate from and
+ independent of the terms and conditions of this Public License.
+
+
+Section 8 -- Interpretation.
+
+ a. For the avoidance of doubt, this Public License does not, and
+ shall not be interpreted to, reduce, limit, restrict, or impose
+ conditions on any use of the Licensed Material that could lawfully
+ be made without permission under this Public License.
+
+ b. To the extent possible, if any provision of this Public License is
+ deemed unenforceable, it shall be automatically reformed to the
+ minimum extent necessary to make it enforceable. If the provision
+ cannot be reformed, it shall be severed from this Public License
+ without affecting the enforceability of the remaining terms and
+ conditions.
+
+ c. No term or condition of this Public License will be waived and no
+ failure to comply consented to unless expressly agreed to by the
+ Licensor.
+
+ d. Nothing in this Public License constitutes or may be interpreted
+ as a limitation upon, or waiver of, any privileges and immunities
+ that apply to the Licensor or You, including from the legal
+ processes of any jurisdiction or authority.
+
+---------------------------------------------------------------------------------------
+
+Creative Commons is not a party to its public
+licenses. Notwithstanding, Creative Commons may elect to apply one of
+its public licenses to material it publishes and in those instances
+will be considered the "Licensor." The text of the Creative Commons
+public licenses is dedicated to the public domain under the CC0 Public
+Domain Dedication. Except for the limited purpose of indicating that
+material is shared under a Creative Commons public license or as
+otherwise permitted by the Creative Commons policies published at
+creativecommons.org/policies, Creative Commons does not authorize the
+use of the trademark "Creative Commons" or any other trademark or logo
+of Creative Commons without its prior written consent including,
+without limitation, in connection with any unauthorized modifications
+to any of its public licenses or any other arrangements,
+understandings, or agreements concerning use of licensed material. For
+the avoidance of doubt, this paragraph does not form part of the
+public licenses.
+
+Creative Commons may be contacted at creativecommons.org.
diff --git a/wso2/baseservice-i18n/pom.xml b/wso2/baseservice-i18n/pom.xml
new file mode 100644
index 0000000..d110db3
--- /dev/null
+++ b/wso2/baseservice-i18n/pom.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openo.common-services.common-utilities</groupId>
+ <artifactId>common-setting</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>baseservice-i18n</artifactId>
+ <name>common-services-common-utilities/baseservice-i18n</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.reflections</groupId>
+ <artifactId>reflections</artifactId>
+ <version>0.9.10</version>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-core</artifactId>
+ <version>0.8.0</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ <version>4.8.2</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.3</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/DefaultErrorCodeI18n.java b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/DefaultErrorCodeI18n.java
new file mode 100644
index 0000000..d225e1b
--- /dev/null
+++ b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/DefaultErrorCodeI18n.java
@@ -0,0 +1,278 @@
+/**
+ * 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.baseservice.i18n;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public final class DefaultErrorCodeI18n implements ErrorCodeI18n {
+
+ static final Logger logger = LoggerFactory.getLogger(DefaultErrorCodeI18n.class);
+ private static DefaultErrorCodeI18n singleton;
+ private static final Lock lock = new ReentrantLock();
+ private Map<Integer, ErrorItemImpl> errorItems;
+
+ private DefaultErrorCodeI18n() {
+ try {
+ init();
+ } catch (Exception e) {
+ logger.error("init ErrorCodeI18n failed.", e);
+ }
+ }
+
+ private void init() throws Exception {
+ final ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
+ final Map<Integer, ErrorItemImpl> errorItems = new HashMap<Integer, DefaultErrorCodeI18n.ErrorItemImpl>();
+ JsonResourceScanner.findErrorCodePaths().forEach(path -> {
+ HashMap<String, Object> fileValues = null;
+ try (InputStream ins = systemClassLoader.getResourceAsStream(path)) {
+ fileValues = I18nJsonUtil.getInstance().readFromJson(ins, HashMap.class);
+ logger.info("load errorcode file success: " + path);
+ } catch (IOException ex) {
+ logger.info("load errorcode file failed: " + path);
+ logger.info(
+ "load errorcode file failed: " + systemClassLoader.getResource(path).toString(),
+ ex);
+ return;
+ }
+ List<?> errcodes = (List<?>) fileValues.get("errcodes");
+ if (errcodes == null) {
+ logger.info("none errcodes field in: " + path);
+ return;
+ }
+
+ String fileName = null;
+ int i = path.lastIndexOf("/");
+ if (i > -1) {
+ fileName = path.substring(i + 1);
+ } else {
+ fileName = path;
+ }
+ i = fileName.indexOf("-errorcode-");
+ String localeSrc = fileName.substring(i + 11, fileName.lastIndexOf("."));
+ if (localeSrc.isEmpty()) {
+ logger.info("parse errorcode file failed: locale is null");
+ return;
+ }
+
+ String[] ss = localeSrc.replace("-", "_").split("_");
+ String tempLocale = null;
+ if (ss.length == 1) {
+ tempLocale = new Locale(ss[0]).toString();
+ } else if (ss.length == 2) {
+ tempLocale = new Locale(ss[0], ss[1]).toString();
+ } else {
+ logger.info("parse i18n file failed: locale is error \"" + localeSrc + "\"");
+ return;
+ }
+ String locale = tempLocale;
+ errcodes.forEach(errorcode -> {
+ Map<String, String> errorConfig = (Map<String, String>) errorcode;
+ Integer code = Integer.valueOf(errorConfig.get("code"));
+ String level = errorConfig.get("level");
+ String label = errorConfig.get("label");
+
+ ErrorItemImpl errorItem = errorItems.get(Integer.valueOf(code));
+ if (errorItem == null) {
+ errorItem = new ErrorItemImpl();
+ errorItem.errorCode = code.intValue();
+ errorItem.level = ErrorCodeLevelUtil.transfer2Int(level);
+ errorItems.put(code, errorItem);
+ }
+ errorItem.addLabel(locale, label);
+ });
+ });
+
+ errorItems.forEach((code, errorItem) -> {
+ errorItem.unmodifiable();
+ });
+ this.errorItems = Collections.unmodifiableMap(errorItems);
+ }
+
+
+ static DefaultErrorCodeI18n getInstance() {
+ if (singleton == null) {
+ lock.lock();
+ try {
+ if (singleton == null) {
+ singleton = new DefaultErrorCodeI18n();
+ }
+ } finally {
+ lock.unlock();
+ }
+ }
+ return singleton;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.zte.ums.zenap.i18n.ErrorCodeI18n#getErrorItem(int)
+ */
+ @Override
+ public Optional<ErrorItem> getErrorItem(int errorCode) {
+ return Optional.ofNullable(errorItems.get(Integer.valueOf(errorCode)));
+ }
+
+
+ public static class ErrorItemImpl implements ErrorItem {
+
+ private int errorCode;
+
+ private int level;
+
+ private Map<String, String> labels = new HashMap<String, String>();
+
+ private String jsonString = null;
+
+ @Override
+ public int getErrorCode() {
+ return errorCode;
+ }
+
+ @Override
+ public int getLevel() {
+ return level;
+ }
+
+ public Map<String, String> getLabels() {
+ return labels;
+ }
+
+ private void unmodifiable() {
+ if (labels != null) {
+ labels = Collections.unmodifiableMap(labels);
+ }
+ }
+
+ private synchronized void addLabel(String locale, String label) {
+ labels.put(locale, label);
+ }
+
+ @Override
+ public String getLabel(Locale theLocale) {
+ if (theLocale == null) {
+ return null;
+ }
+ return labels.get(I18nLocaleTransfer.transfer(theLocale, labels.keySet()));
+ }
+
+ @Override
+ public String getCanonicalLabels(int errorCode) {
+ String jsonString = this.jsonString;
+ if (jsonString == null) {
+ ErrorItem2 errorItem2 = new ErrorItem2();
+ errorItem2.setErrorCode(this.errorCode);
+ errorItem2.setLevel(ErrorCodeLevelUtil.transfer2String(this.errorCode));
+ errorItem2.setErrlabels(labels);
+ try {
+ jsonString = I18nJsonUtil.getInstance().writeToJson(errorItem2);
+ } catch (Exception e) {
+ logger.info("getCanonicalLabels failed from with param errorCode " + errorCode
+ + " and this errorCode " + this.errorCode, e);
+ return null;
+ }
+ this.jsonString = jsonString;
+ }
+ return jsonString;
+ }
+
+ }
+
+ protected static class ErrorItem2 {
+
+ private int errorCode;
+
+ private String level;
+
+ private Map<String, String> errlabels;
+
+ public ErrorItem2() {
+
+ }
+
+ public int getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(int errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ public String getLevel() {
+ return level;
+ }
+
+ public void setLevel(String level) {
+ this.level = level;
+ }
+
+ public Map<String, String> getErrlabels() {
+ return errlabels;
+ }
+
+ public void setErrlabels(Map<String, String> errlabels) {
+ this.errlabels = errlabels;
+ }
+ }
+
+ protected static class ErrorCodeLevelUtil {
+
+ public static final int ERROR_LEVEL = javax.swing.JOptionPane.ERROR_MESSAGE;
+
+ public static final int WARN_LEVEL = javax.swing.JOptionPane.WARNING_MESSAGE;
+
+ public static final int INFO_LEVEL = javax.swing.JOptionPane.INFORMATION_MESSAGE;
+
+ protected static String transfer2String(int errorCode) {
+ switch (errorCode) {
+ case ERROR_LEVEL:
+ return "ERROR";
+ case INFO_LEVEL:
+ return "INFO";
+ case WARN_LEVEL:
+ return "WARN";
+ }
+ return null;
+ }
+
+ protected static int transfer2Int(String level) {
+ switch (level) {
+ case "ERROR":
+ return ERROR_LEVEL;
+ case "INFO":
+ return INFO_LEVEL;
+ case "WARN":
+ return WARN_LEVEL;
+ }
+ return -1;
+ }
+
+ }
+
+}
diff --git a/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/DefaultI18nService.java b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/DefaultI18nService.java
new file mode 100644
index 0000000..820478c
--- /dev/null
+++ b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/DefaultI18nService.java
@@ -0,0 +1,59 @@
+/**
+ * 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.baseservice.i18n;
+
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.util.Optional;
+import javax.inject.Inject;
+import org.jvnet.hk2.annotations.Service;
+import org.openo.baseservice.i18n.ErrorCodeI18n.ErrorItem;
+
+@Service
+public final class DefaultI18nService implements I18nService {
+
+ /**
+ * Get the corresponding examples of international documents (all languages), <br>
+ *
+ * for the above example topology (for example, the Chinese definition: topo-i18n-zh-CN.json, English definition
+ * Topo -i18n-en-US.json), into the reference into the "TOPO" can be <br>
+ *
+ * (i.e. except "-i18n-*.json" after the exact match).
+ *
+ * @param i18nFilePrefix International file prefix (-i18n-*.json front part)
+ * @return Optional<I18n>
+ */
+ public Optional<I18n> getI18n(String i18nFilePrefix) {
+ return I18nContainer.getInstance().getI18n(i18nFilePrefix);
+ }
+
+ /**
+ * Gets the corresponding error item based on the error code (including the error description information for all
+ * languages)
+ *
+ * @param errorCode
+ * @return Optional<ErrorItem>
+ */
+ public Optional<ErrorItem> getErrorItem(int errorCode) {
+ return ErrorCodeI18n.getInstance().getErrorItem(errorCode);
+ }
+
+ @Inject
+ public void setObjectMapper(ObjectMapper objectMapper) {
+ I18nJsonUtil.getInstance(objectMapper);
+ }
+
+}
diff --git a/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/ErrorCodeException.java b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/ErrorCodeException.java
new file mode 100644
index 0000000..fb470ab
--- /dev/null
+++ b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/ErrorCodeException.java
@@ -0,0 +1,53 @@
+/**
+ * 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.baseservice.i18n;
+
+public class ErrorCodeException extends Exception {
+
+ private static final long serialVersionUID = 5522808473663280894L;
+
+ private int errorCode;
+
+ /**
+ * Error definition placeholder replacement
+ */
+ private String[] arguments;
+
+ /**
+ * According to the original exception, error code, debug print information and construct a new anomaly placeholder
+ *
+ * @param source
+ * @param errorCode
+ * @param debugMessage
+ * @param arguments
+ */
+ public ErrorCodeException(Throwable source, int errorCode, String debugMessage, String[] arguments) {
+ super(debugMessage, source);
+
+ this.errorCode = errorCode;
+
+ this.arguments = arguments;
+ }
+
+ public int getErrorCode() {
+ return errorCode;
+ }
+
+ public String[] getArguments() {
+ return arguments;
+ }
+
+}
diff --git a/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/ErrorCodeI18n.java b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/ErrorCodeI18n.java
new file mode 100644
index 0000000..39738b5
--- /dev/null
+++ b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/ErrorCodeI18n.java
@@ -0,0 +1,151 @@
+/**
+ * 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.baseservice.i18n;
+
+import org.openo.baseservice.i18n.DefaultErrorCodeI18n.ErrorCodeLevelUtil;
+import org.openo.baseservice.i18n.DefaultErrorCodeI18n.ErrorItem2;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Locale;
+import java.util.Map;
+import java.util.Optional;
+
+public interface ErrorCodeI18n {
+
+ static final Logger logger = LoggerFactory.getLogger(ErrorCodeI18n.class);
+
+ /**
+ * Access to the internationalization of the error code examples, scanning the process of all
+ * classes load path, loading all the *-errorcode-*.json files, and load all the international
+ * language information
+ *
+ * @return
+ */
+ static ErrorCodeI18n getInstance() {
+ return DefaultErrorCodeI18n.getInstance();
+ }
+
+ /**
+ * Gets the corresponding error item based on the error code (including the error description
+ * information for all languages)
+ *
+ * @param errorCode
+ * @return Optional<ErrorItem>
+ */
+ public Optional<ErrorItem> getErrorItem(int errorCode);
+
+ public static interface ErrorItem {
+
+ public int getErrorCode();
+
+ public int getLevel();
+
+ public Map<String, String> getLabels();
+
+ public String getLabel(Locale theLocale);
+
+ /**
+ * All language error information description of assembly. <br>
+ *
+ * some modules to store all the error information description or transfer, and finally the time
+ * to choose the appropriate value according to the locale presentation. <br>
+ *
+ * it is not necessary to pass the error code (code), but in order to take into account the
+ * subsequent scalability, so also passed, the general module does not need this information.
+ * Similar form:<br>
+ * { "code":53501, "level":"INFO", "errlabels":{"zh_CN":"拓扑定制文件无效。","en_US":"The topology
+ * customized file is invalid.","ru_RU":"Топология настроенный файл недействительно."} }
+ *
+ * @param errorCode
+ * @return
+ */
+ public String getCanonicalLabels(int errorCode);
+
+ /**
+ * With the use of the above interface, it is possible to obtain an international string
+ * corresponding to a specific language from the combination of all error messages
+ *
+ * @param labels Error message description string (Return value of the getCanonicalLabels
+ * method)
+ * @param theLocale
+ * @return
+ */
+ public static String getLabelFromCanonicalLabels(String labels, Locale theLocale) {
+ if (labels == null || theLocale == null) {
+ return null;
+ }
+ try {
+ ErrorItem2 errorItem2 = I18nJsonUtil.getInstance().readFromJson(labels, ErrorItem2.class);
+ Map<String, String> errlabels = errorItem2.getErrlabels();
+ return errlabels.get(I18nLocaleTransfer.transfer(theLocale, errlabels.keySet()));
+ } catch (Exception e) {
+ logger.info(
+ "getLabelFromCanonicalLabels failed from " + labels + " with local " + theLocale, e);
+ return null;
+ }
+ }
+
+ /**
+ * With the use of the above interface, we can get the error code corresponding to the specific
+ * language from all the error information
+ *
+ * @param labels Error message description string (Return value of the getCanonicalLabels
+ * method)
+ * @param theLocale
+ * @return errorCode
+ */
+ public static int getErrorcodeFromCanonicalLabels(String labels, Locale theLocale) {
+ if (labels == null) {
+ return -1;
+ }
+ try {
+ ErrorItem2 errorItem2 = I18nJsonUtil.getInstance().readFromJson(labels, ErrorItem2.class);
+ return errorItem2.getErrorCode();
+ } catch (Exception e) {
+ logger.info(
+ "getErrorcodeFromCanonicalLabels failed from " + labels + " with local " + theLocale,
+ e);
+ return -1;
+ }
+ }
+
+ /**
+ * With the above interface, the error level of the corresponding string is obtained from all
+ * the error messages
+ *
+ * @param labels Error message description string (Return value of the getCanonicalLabels
+ * method)
+ * @param theLocale
+ * @return error level
+ */
+ public static int getLevelFromCanonicalLabels(String labels, Locale theLocale) {
+ if (labels == null) {
+ return -1;
+ }
+ try {
+ ErrorItem2 errorItem2 = I18nJsonUtil.getInstance().readFromJson(labels, ErrorItem2.class);
+ return ErrorCodeLevelUtil.transfer2Int(errorItem2.getLevel());
+ } catch (Exception e) {
+ logger.info(
+ "getErrorcodeFromCanonicalLabels failed from " + labels + " with local " + theLocale,
+ e);
+ return -1;
+ }
+ }
+ }
+
+}
diff --git a/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18n.java b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18n.java
new file mode 100644
index 0000000..ec9197b
--- /dev/null
+++ b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18n.java
@@ -0,0 +1,132 @@
+/**
+ * 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.baseservice.i18n;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Optional;
+
+public interface I18n {
+ static final Logger logger = LoggerFactory.getLogger(I18n.class);
+
+ /**
+ * Get the corresponding examples of international documents (all languages), <br>
+ *
+ * for the above example topology (for example, the Chinese definition: topo-i18n-zh-CN.json,
+ * English definition Topo -i18n-en-US.json), into the reference into the "TOPO" can be <br>
+ *
+ * (i.e. except "-i18n-*.json" after the exact match).
+ *
+ * @param i18nFilePrefix
+ * @return Optional<I18n>
+ */
+ public static Optional<I18n> getInstance(String i18nFilePrefix) {
+ return I18nContainer.getInstance().getI18n(i18nFilePrefix);
+ }
+
+ /**
+ * According to key, the internationalization of all languages is described (Map<locale,value>)
+ *
+ * @param labelKey key
+ * @return Map<locale,value>
+ */
+ public Map<String, String> getLabelValues(String labelKey);
+
+ /**
+ * According to key, the internationalization of all languages is described
+ *
+ * @param labelKey
+ * @param theLocale
+ * @return
+ */
+ public String getLabelValue(String labelKey, Locale theLocale);
+
+ /**
+ * According to key, the internationalization of all languages is described
+ *
+ * @param labelKey
+ * @param theLocale
+ * @param arguments
+ * @return
+ */
+ public String getLabelValue(String labelKey, Locale theLocale, String[] arguments);
+
+ /**
+ * Replace the placeholder that is defined in the internationalization description, as shown in
+ * the following example, <br>
+ *
+ * {0} represents first bits, which will be replaced by a specific number of days. : <br>
+ *
+ * {"col_dir_file_time_table": "save days {0} days"}
+ *
+ * @param labelKey
+ * @param arguments
+ * @return Map<locale,value>
+ */
+ public Map<String, String> getLabelValues(String labelKey, String[] arguments);
+
+ /**
+ * According to the key to get all the international description of the language, and the results
+ * will be combined into a Json string, used in the log module scene, <br>
+ *
+ * it is necessary to store all of the international information or transfer, and finally show the
+ * time according to locale to choose the appropriate value. <br>
+ *
+ * (here in order to form similar to read, plus a newline) <br>
+ * {"zh_CN":"统一公共应用","en_US":" Unified common application ","ru_RU":"Единый общий приложений"}
+ *
+ * @param labelKey key
+ * @return
+ */
+ public String getCanonicalLabelValues(String labelKey);
+
+ /**
+ * With the use of getCanonicalLabelValues interface, from all the international description of
+ * the combination of string and specific language corresponding to the international string. The
+ * return value of the getCanonicalLabelValues method
+ *
+ * @param values
+ * @param theLocale
+ * @return value
+ */
+ public static String getValuefromCanonicalValues(String values, Locale theLocale) {
+ try {
+ @SuppressWarnings("unchecked")
+ HashMap<String, String> map = I18nJsonUtil.getInstance().readFromJson(values, HashMap.class);
+
+ return map.get(I18nLocaleTransfer.transfer(theLocale, map.keySet()));
+ } catch (Exception e) {
+ logger.error("get i18n value failed by locale:" + theLocale + " from " + values, e);
+ return null;
+ }
+ }
+
+ /**
+ * According to the value to find the corresponding key, such as a module in accordance with
+ * international content filtering, search, database storage is key, then the front pass query is
+ * a kind of language corresponding to the value, to get the corresponding international key to
+ * the database query.
+ *
+ * @param value
+ * @return
+ */
+ public String getKeyFromValue(String value);
+
+}
diff --git a/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nContainer.java b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nContainer.java
new file mode 100644
index 0000000..95ae105
--- /dev/null
+++ b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nContainer.java
@@ -0,0 +1,148 @@
+/**
+ * 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.baseservice.i18n;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Optional;
+
+final class I18nContainer {
+
+ private static Logger logger = LoggerFactory.getLogger(I18nContainer.class);
+
+ private Map<String, I18n> i18ns;
+
+ private I18nContainer() {
+ init();
+ }
+
+
+ private void init() {
+ Map<String, Map<String, I18nItem>> i18nTemps = generateI18ns();
+
+ i18ns = new HashMap<String, I18n>();
+ for (Entry<String, Map<String, I18nItem>> entry : i18nTemps.entrySet()) {
+ String name = entry.getKey();
+ Map<String, I18nItem> items = entry.getValue();
+ for (Entry<String, I18nItem> i18nItemEntry : items.entrySet()) {
+ i18nItemEntry.getValue().unmodifiable();
+ }
+
+ I18n i18n = new I18nImpl(name, items);
+ i18ns.put(name, i18n);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private Map<String, Map<String, I18nItem>> generateI18ns() {
+ Map<String, Map<String, I18nItem>> i18nTemps = new HashMap<String, Map<String, I18nItem>>();
+
+ ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
+ JsonResourceScanner.findI18nPaths().forEach((path) -> {
+ HashMap<String, String> fileValues = null;
+ try (InputStream ins = systemClassLoader.getResourceAsStream(path)) {
+ fileValues = I18nJsonUtil.getInstance().readFromJson(ins, HashMap.class);
+ logger.info("load i18n file success: " + path);
+ } catch (IOException ex) {
+ logger.info("load i18n file failed: " + path);
+ logger.info("load i18n file failed: " + systemClassLoader.getResource(path).toString(), ex);
+ return;
+ }
+
+ if (!validateI18nFileValues(fileValues, path)) {
+ return;
+ }
+
+ String fileName = null;
+ int i = path.lastIndexOf("/");
+ if (i > -1) {
+ fileName = path.substring(i + 1);
+ } else {
+ fileName = path;
+ }
+ i = fileName.indexOf("-i18n-");
+ String name = fileName.substring(0, i);
+ String localeSrc = fileName.substring(i + 6, fileName.lastIndexOf("."));
+ if (name.isEmpty()) {
+ logger.info("parse i18n file failed: name is null");
+ return;
+ } else if (localeSrc.isEmpty()) {
+ logger.info("parse i18n file failed: locale is null");
+ return;
+ }
+
+ String[] ss = localeSrc.replace("-", "_").split("_");
+ String locale = null;
+ if (ss.length == 1) {
+ locale = new Locale(ss[0]).toString();
+ } else if (ss.length == 2) {
+ locale = new Locale(ss[0], ss[1]).toString();
+ } else {
+ logger.info("parse i18n file failed: locale is error \"" + localeSrc + "\"");
+ return;
+ }
+
+ Map<String, I18nItem> i18nItems = i18nTemps.get(name);
+ if (i18nItems == null) {
+ i18nItems = new HashMap<String, I18nItem>();
+ i18nTemps.put(name, i18nItems);
+ }
+
+ for (Entry<String, String> entry : fileValues.entrySet()) {
+ String label = entry.getKey();
+
+ I18nItem i18nItem = i18nItems.get(label);
+ if (i18nItem == null) {
+ i18nItem = new I18nItem(label);
+ i18nItems.put(label, i18nItem);
+ }
+
+ i18nItem.addValue(locale, entry.getValue());
+ }
+ });
+ return i18nTemps;
+ }
+
+ private boolean validateI18nFileValues(HashMap<String, String> fileValues, String path) {
+ for (Entry<String, String> entry : fileValues.entrySet()) {
+ if (entry.getValue() != null && !String.class.isInstance(entry.getValue())) {
+ logger.info("parse i18n file failed: " + path + " field's[" + entry.getKey()
+ + "] value is not string type");
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected static I18nContainer getInstance() {
+ return I18nContainerSingleton.singleton;
+ }
+
+ Optional<I18n> getI18n(String name) {
+ return Optional.ofNullable(this.i18ns.get(name));
+ }
+
+ static class I18nContainerSingleton {
+ private static final I18nContainer singleton = new I18nContainer();
+ }
+}
diff --git a/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nImpl.java b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nImpl.java
new file mode 100644
index 0000000..bda6f2d
--- /dev/null
+++ b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nImpl.java
@@ -0,0 +1,137 @@
+/**
+ * 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.baseservice.i18n;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+
+public class I18nImpl implements I18n {
+ private static Logger logger = LoggerFactory.getLogger(I18nImpl.class);
+
+ private String name;
+
+ private Map<String, I18nItem> items;
+
+ private Map<String, String> keyToValueMap;
+
+ private Map<String, String> valueToKeyMap;
+
+
+ public I18nImpl(String name, Map<String, I18nItem> items) {
+ this.name = name;
+ this.items = Collections.unmodifiableMap(items);
+
+ keyToValueMap = new HashMap<>(items.size());
+ valueToKeyMap = new HashMap<>(items.size() * 3);
+
+ try {
+ for (Entry<String, I18nItem> entry : items.entrySet()) {
+ String key = entry.getKey();
+ I18nItem item = entry.getValue();
+ String value = I18nJsonUtil.getInstance().writeToJson(item.getValues());
+
+ keyToValueMap.put(key, value);
+ for (Entry<String, String> valueEntry : item.getValues().entrySet()) {
+ valueToKeyMap.put(valueEntry.getValue(), key);
+ }
+ }
+ } catch (Exception e) {
+ logger.error("new I18nImpl failed:" + name, e);
+ }
+
+ keyToValueMap = Collections.unmodifiableMap(keyToValueMap);
+ valueToKeyMap = Collections.unmodifiableMap(valueToKeyMap);
+ }
+
+ @Override
+ public Map<String, String> getLabelValues(String labelKey) {
+ I18nItem item = items.get(labelKey);
+ if (item != null) {
+ return item.getValues();
+ }
+ return null;
+ }
+
+ @Override
+ public String getLabelValue(String labelKey, Locale theLocale) {
+ I18nItem item = items.get(labelKey);
+ if (item != null) {
+ Map<String, String> values = item.getValues();
+ return values.get(I18nLocaleTransfer.transfer(theLocale, values.keySet()));
+ }
+ return null;
+ }
+
+ @Override
+ public String getLabelValue(String labelKey, Locale theLocale, String[] arguments) {
+ I18nItem item = items.get(labelKey);
+ if (item != null) {
+ Map<String, String> values = item.getValues();
+ String value = values.get(I18nLocaleTransfer.transfer(theLocale, values.keySet()));
+ return replaceArguments(value, arguments);
+ }
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getLabelValues(String labelKey, String[] arguments) {
+ I18nItem item = items.get(labelKey);
+ if (item != null) {
+ Map<String, String> map = new HashMap<String, String>();
+ for (Entry<String, String> entry : item.getValues().entrySet()) {
+ String value = entry.getValue();
+ map.put(entry.getKey(), replaceArguments(value, arguments));
+ }
+ return map;
+ }
+ return null;
+ }
+
+ @Override
+ public String getCanonicalLabelValues(String labelKey) {
+ return keyToValueMap.get(labelKey);
+ }
+
+ @Override
+ public String getKeyFromValue(String aValue) {
+ return valueToKeyMap.get(aValue);
+ }
+
+ private String replaceArguments(String value, String[] arguments) {
+ if (value == null) {
+ return null;
+ }
+ if (arguments != null) {
+ int i = 0;
+ for (String argument : arguments) {
+ if (argument == null) {
+ value = value.replaceAll("\\{\\s*" + i + "\\s*\\}", "");
+ } else {
+ value = value.replaceAll("\\{\\s*" + i + "\\s*\\}", argument);
+ }
+ i++;
+ }
+ }
+ return value.replaceAll("\\{\\s*\\d+\\s*\\}", "");
+ }
+
+}
diff --git a/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nItem.java b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nItem.java
new file mode 100644
index 0000000..1aaaf6f
--- /dev/null
+++ b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nItem.java
@@ -0,0 +1,53 @@
+/**
+ * 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.baseservice.i18n;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+public class I18nItem {
+
+ private String lable;
+
+ private Map<String, String> values;
+
+ public I18nItem(String lable) {
+ this.lable = lable;
+ values = new HashMap<String, String>();
+ }
+
+ public I18nItem(String lable, Map<String, String> values) {
+ this.lable = lable;
+ this.values = values;
+ }
+
+ public String getLable() {
+ return lable;
+ }
+
+ public Map<String, String> getValues() {
+ return values;
+ }
+
+ public void addValue(String locale, String value) {
+ values.put(locale, value);
+ }
+
+ public void unmodifiable() {
+ values = Collections.unmodifiableMap(values);
+ }
+}
diff --git a/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nJsonUtil.java b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nJsonUtil.java
new file mode 100644
index 0000000..e3746dc
--- /dev/null
+++ b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nJsonUtil.java
@@ -0,0 +1,170 @@
+/**
+ * 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.baseservice.i18n;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Locale;
+import java.util.Set;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+final class I18nJsonUtil {
+
+ private static I18nJsonUtil util;
+ private static Lock lock = new ReentrantLock();
+ private ObjectMapper objectMapper;
+
+ public I18nJsonUtil(ObjectMapper objectMapper) {
+ this.objectMapper = objectMapper;
+ }
+
+ <T extends Object> T readFromJson(InputStream ins, Class<T> clazz)
+ throws JsonParseException, JsonMappingException, IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ byte[] bs = new byte[1024 * 10];
+ int length = -1;
+ while ((length = ins.read(bs)) > 0) {
+ baos.write(bs, 0, length);
+ }
+ bs = baos.toByteArray();
+
+ byte[] ubs = null;
+ if (bs.length > 3) {
+ // 删除bom头 -17, -69, -65
+ if (bs[0] == -17 && bs[1] == -69 && bs[2] == -65) {
+ ubs = new byte[bs.length - 3];
+ System.arraycopy(bs, 3, ubs, 0, ubs.length);
+ }
+ }
+ if (ubs == null) {
+ ubs = bs;
+ }
+ return objectMapper.readValue(ubs, clazz);
+ }
+
+ <T extends Object> T readFromJson(String str, Class<T> clazz)
+ throws JsonParseException, JsonMappingException, IOException {
+ return objectMapper.readValue(str, clazz);
+ }
+
+ String writeToJson(Object obj) throws JsonProcessingException {
+ return objectMapper.writeValueAsString(obj);
+ }
+
+ static I18nJsonUtil getInstance(ObjectMapper objectMapper) {
+ if (util == null) {
+ lock.lock();
+ try {
+ if (util == null) {
+ if (objectMapper == null) {
+ objectMapper = new ObjectMapper();
+ }
+ util = new I18nJsonUtil(objectMapper);
+ }
+ } finally {
+ lock.unlock();
+ }
+ }
+ return util;
+ }
+
+ static I18nJsonUtil getInstance() {
+ return getInstance(null);
+ }
+}
+
+
+/**
+ * 国际化转换工具
+ *
+ * @author 10163976
+ */
+class I18nLocaleTransfer {
+
+ private static Logger LOG = LoggerFactory.getLogger(I18nLocaleTransfer.class);
+
+ /**
+ * 方言转换<br> 如果存在直接返回<br> 如果不存在,则获取语言进行模糊匹配,未匹配上则返回默认方言<br>
+ *
+ * @param theLocale 待转换方言
+ * @param locales 存在的方言
+ * @return 转换后的方言
+ */
+ public static String transfer(Locale theLocale, Set<String> locales) {
+ if (locales == null || locales.isEmpty()) {
+ LOG.debug("locales is NULL or empty");
+ return null;
+ }
+ if (theLocale == null) {
+ String result = fetchDefault(locales);
+ LOG.debug("transfer NULL --> " + result + " in " + locales);
+ return result;
+ }
+ String locale = theLocale.toString();
+ if (locale.isEmpty()) {
+ String result = fetchDefault(locales);
+ LOG.debug("transfer EMPTY --> " + result + " in " + locales);
+ return result;
+ }
+ // 精确匹配
+ if (locales.contains(locale)) {
+ return locale;
+ }
+
+ // 根据语言模糊匹配
+ String language = theLocale.getLanguage();
+ if (locales.contains(language)) {
+ LOG.debug("transfer " + locale + " --> " + language + " in " + locales);
+ return language;
+ }
+
+ language = language + "_";
+ for (String temp : locales) {
+ if (temp.startsWith(language)) {
+ LOG.debug("transfer " + locale + " --> " + temp + " in " + locales);
+ return temp;
+ }
+ }
+ String result = fetchDefault(locales);
+ LOG.debug("transfer " + locale + " --> " + result + " in " + locales);
+ return result;
+ }
+
+ /**
+ * 返回默认方言,优先级为en,en_US,zh,zh_CN,如果都不存在,则随机返回一个
+ */
+ private static String fetchDefault(Set<String> locales) {
+ if (locales.contains("en")) {
+ return "en";
+ } else if (locales.contains("en_US")) {
+ return "en_US";
+ }
+ if (locales.contains("zh")) {
+ return "zh";
+ } else if (locales.contains("zh_CN")) {
+ return "zh_CN";
+ }
+ return locales.iterator().next();
+ }
+}
diff --git a/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nService.java b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nService.java
new file mode 100644
index 0000000..a643356
--- /dev/null
+++ b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/I18nService.java
@@ -0,0 +1,38 @@
+/**
+ * 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.baseservice.i18n;
+
+
+import java.util.Optional;
+import org.jvnet.hk2.annotations.Contract;
+import org.openo.baseservice.i18n.ErrorCodeI18n.ErrorItem;
+
+@Contract
+public interface I18nService {
+
+ /**
+ * Get the corresponding examples of international documents (all languages), <br> for the above
+ * example topology (for example, the Chinese definition: topo-i18n-zh-CN.json, English
+ * definition Topo -i18n-en-US.json), into the reference into the "TOPO" can be <br> (i.e.
+ * except "-i18n-*.json" after the exact match).
+ *
+ * @return Optional<I18n>
+ */
+ public Optional<I18n> getI18n(String i18nFilePrefix);
+
+ public Optional<ErrorItem> getErrorItem(int errorCode);
+
+}
diff --git a/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/JsonResourceScanner.java b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/JsonResourceScanner.java
new file mode 100644
index 0000000..9f5ef3a
--- /dev/null
+++ b/wso2/baseservice-i18n/src/main/java/org/openo/baseservice/i18n/JsonResourceScanner.java
@@ -0,0 +1,81 @@
+/**
+ * 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.baseservice.i18n;
+
+import org.reflections.Reflections;
+import org.reflections.scanners.ResourcesScanner;
+import org.reflections.util.ClasspathHelper;
+import org.reflections.util.ConfigurationBuilder;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+final class JsonResourceScanner {
+ private static final org.slf4j.Logger LOG =
+ org.slf4j.LoggerFactory.getLogger(JsonResourceScanner.class);
+ private static final Pattern PATTERN_OF_I18N_FILE_NAME =
+ Pattern.compile(".*?\\-i18n\\-.*?\\.json");
+ private static final Pattern PATTERN_OF_ERROR_CODE_FILE_NAME =
+ Pattern.compile(".*?\\-errorcode\\-.*?\\.json");
+
+ private static Collection<String> findFromClassPath(Pattern pattern) {
+ ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
+ Collection<URL> urls = ClasspathHelper.forJavaClassPath();
+
+ for (Iterator<URL> iter = urls.iterator(); iter.hasNext();) {
+ URL url = iter.next();
+ boolean exist = false;
+ try {
+ exist = new File(url.getFile()).exists();
+ if (!exist) {
+ LOG.info("class path url ignored for not exists: " + url.toString());
+ }
+ } catch (Exception e) {
+ LOG.info("class path url ignored for exception: " + url.toString(), e);
+ exist = false;
+ }
+ if (!exist) {
+ iter.remove();
+ }
+ }
+ for (URL url : urls) {
+ LOG.info("class path url:" + url.toString());
+ }
+ configurationBuilder.addUrls(urls);
+ configurationBuilder.setScanners(new ResourcesScanner());
+ configurationBuilder.useParallelExecutor();
+ Reflections reflections = new Reflections(configurationBuilder);
+ Set<String> results = reflections.getResources(pattern);
+ if (results == null) {
+ return Collections.emptySet();
+ } else {
+ return results;
+ }
+ }
+
+ static Collection<String> findI18nPaths() {
+ return findFromClassPath(PATTERN_OF_I18N_FILE_NAME);
+ }
+
+ static Collection<String> findErrorCodePaths() {
+ return findFromClassPath(PATTERN_OF_ERROR_CODE_FILE_NAME);
+ }
+}
diff --git a/wso2/common-util/.gitignore b/wso2/common-util/.gitignore
new file mode 100644
index 0000000..be68b59
--- /dev/null
+++ b/wso2/common-util/.gitignore
@@ -0,0 +1,5 @@
+/target/
+# Eclipse
+.settings/
+.classpath
+.project
diff --git a/wso2/common-util/pom.xml b/wso2/common-util/pom.xml
new file mode 100644
index 0000000..074cf13
--- /dev/null
+++ b/wso2/common-util/pom.xml
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2016 Huawei Technologies Co., Ltd.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openo.common-services.common-utilities</groupId>
+ <artifactId>common-setting</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>commonlib-cbb</artifactId>
+ <packaging>jar</packaging>
+ <properties>
+ <cxf.version>3.1.6</cxf.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>com.googlecode.jmockit</groupId>
+ <artifactId>jmockit</artifactId>
+ <scope>test</scope>
+ <version>1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ <version>4.8.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.json-lib</groupId>
+ <artifactId>json-lib</artifactId>
+ <classifier>jdk15</classifier>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.github.stephenc.jcip</groupId>
+ <artifactId>jcip-annotations</artifactId>
+ <version>1.0-1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-client</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-transports-http-hc</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-jaxrs</artifactId>
+ <version>1.9.2</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.5.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-XX:-UseSplitVerifier</argLine>
+ <skip>${maven.test.skip}</skip>
+ <testFailureIgnore>${maven.test.failure.ignore}</testFailureIgnore>
+ <excludes>
+ <exclude>${excludesFile}</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <formats>
+ <format>xml</format>
+ <format>html</format>
+ </formats>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>cobertura</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+
+<name>common-services-common-utilities/common-util</name></project>
diff --git a/wso2/common-util/src/main/java/org/openo/baseservice/bus/util/BusConstant.java b/wso2/common-util/src/main/java/org/openo/baseservice/bus/util/BusConstant.java
new file mode 100644
index 0000000..ab2bcd1
--- /dev/null
+++ b/wso2/common-util/src/main/java/org/openo/baseservice/bus/util/BusConstant.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.bus.util;
+
+/**
+ * <p>
+ * An class which holds the all the constant values for the Bus register CBB.
+ * </p>
+ * <br/>
+ *
+ * @author
+ * @version
+ */
+public final class BusConstant {
+
+ public static final String JSON = "json";
+
+ public static final String BUS_CONFIGURE_FILE = "/etc/microservice.ini";
+
+ public static final String BUS_SERVICE_URL = "/openoapi/microservices/v1/services";
+
+ public static final String BUS_ADDRESS_KEY = "msb.address";
+
+ public static final String APPLICATION_JSON_HEADER = "application/json";
+
+ public static final String CREATE_OR_UPDATE = "createOrUpdate";
+
+ public static final String MICROSERVICE_DEFAULT = "msb.openo.org:80";
+
+ public static final String MICROSERVICE_PATH = "/etc/microservice";
+
+ public static final String POST_METHOD = "POST";
+
+ public static final String HTTP_HEAD = "http://";
+}
diff --git a/wso2/common-util/src/main/java/org/openo/baseservice/bus/util/RegisterService.java b/wso2/common-util/src/main/java/org/openo/baseservice/bus/util/RegisterService.java
new file mode 100644
index 0000000..d1926c7
--- /dev/null
+++ b/wso2/common-util/src/main/java/org/openo/baseservice/bus/util/RegisterService.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.bus.util;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import javax.ws.rs.core.Response;
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.codehaus.jackson.jaxrs.JacksonJsonProvider;
+import org.openo.baseservice.util.impl.SystemEnvVariablesFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Provide the service register cbb for common use. <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version
+ */
+public class RegisterService {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(RegisterService.class);
+
+ private static String busPath = null;
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @throws IOException
+ *
+ * @since
+ */
+ private RegisterService() {
+ }
+
+ /**
+ * register the micro service. <br/>
+ *
+ * @param jsonPath:
+ * the service json object to register to the bus.
+ * @param createOrUpdate:
+ * true, create and update the old ip port. false, create and
+ * delete the old one;
+ * @return
+ * @throws IOException
+ * @since
+ */
+ public static Response registerService(String jsonPath, boolean createOrUpdate) throws IOException {
+
+ String serviceInfo = getServiceModel(jsonPath);
+
+ WebClient client = initializeClient();
+
+ client.type(BusConstant.APPLICATION_JSON_HEADER);
+
+ client.accept(BusConstant.APPLICATION_JSON_HEADER);
+
+ client.path(BusConstant.BUS_SERVICE_URL);
+
+ client.query(BusConstant.CREATE_OR_UPDATE, createOrUpdate);
+
+ LOGGER.info("Connecting bus address : " + busPath + BusConstant.BUS_SERVICE_URL);
+
+ return client.invoke(BusConstant.POST_METHOD, serviceInfo);
+
+ }
+
+ /**
+ * get the service's model. and return it as a string ; <br/>
+ *
+ * @param jsonPath
+ * @return
+ * @since
+ */
+ private static String getServiceModel(String jsonPath) {
+
+ String serviceInfo = "";
+
+ try {
+ LOGGER.info("begin to read file micro service json " + jsonPath);
+
+ FileInputStream busFile = new FileInputStream(jsonPath);
+
+ int size = busFile.available();
+
+ byte[] buffer = new byte[size];
+
+ busFile.read(buffer);
+
+ busFile.close();
+
+ serviceInfo = new String(buffer);
+ LOGGER.info("finished to read micro service json file. ");
+ } catch (Exception ex) {
+ LOGGER.error("Read the micro service json file error :", ex);
+ }
+ return serviceInfo;
+ }
+
+ /**
+ * initialize the bus ip and port. <br/>
+ *
+ * @return
+ * @throws IOException
+ * @since
+ */
+ private static String getBusAddress() throws IOException {
+
+ LOGGER.info("begin to get the bus baseurl.");
+ FileInputStream busFile = null;
+ String url = BusConstant.MICROSERVICE_DEFAULT;
+
+ String filePath = SystemEnvVariablesFactory.getInstance().getAppRoot() + BusConstant.BUS_CONFIGURE_FILE;
+ LOGGER.info("bus base url file:" + filePath);
+
+ Properties properties = new Properties();
+
+ try {
+ busFile = new FileInputStream(filePath);
+ properties.load(busFile);
+ url = properties.getProperty(BusConstant.BUS_ADDRESS_KEY);
+ } catch (IOException e) {
+ if (busFile != null) {
+ busFile.close();
+ }
+ LOGGER.error("Read the bus url failed: ", e);
+ }
+
+ LOGGER.info("initialize the bus baseurl is: " + url);
+ return BusConstant.HTTP_HEAD + url;
+ }
+
+ /**
+ * get the bus's client's address. and initialize the web client. <br/>
+ *
+ * @return
+ * @throws IOException
+ * @since
+ */
+ private static WebClient initializeClient() throws IOException {
+
+ final List<Object> providers = new ArrayList<Object>();
+
+ JacksonJsonProvider jacksonJsonProvider = new JacksonJsonProvider();
+
+ providers.add(jacksonJsonProvider);
+
+ if (busPath == null) {
+ busPath = getBusAddress();
+ }
+
+ return WebClient.create(busPath, providers);
+ }
+}
diff --git a/wso2/common-util/src/main/java/org/openo/baseservice/bus/util/RegisterServiceListener.java b/wso2/common-util/src/main/java/org/openo/baseservice/bus/util/RegisterServiceListener.java
new file mode 100644
index 0000000..c4e1417
--- /dev/null
+++ b/wso2/common-util/src/main/java/org/openo/baseservice/bus/util/RegisterServiceListener.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.bus.util;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import org.openo.baseservice.util.impl.SystemEnvVariablesFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Initialize the service register listener. <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version
+ */
+public class RegisterServiceListener implements ServletContextListener {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(RegisterServiceListener.class);
+
+ @Override
+ public void contextInitialized(ServletContextEvent sce) {
+
+ String servicePath = SystemEnvVariablesFactory.getInstance().getAppRoot() + BusConstant.MICROSERVICE_PATH;
+ LOGGER.info("microservices json file path is" + servicePath);
+
+ File file = new File(servicePath);
+
+ File[] fileList = file.listFiles();
+
+ for (File tempFile : fileList) {
+ String fileName = tempFile.getName();
+ if (fileName.substring(fileName.lastIndexOf('.') + 1).equalsIgnoreCase(BusConstant.JSON)) {
+ LOGGER.info("begin to initialize the service file" + tempFile.getAbsolutePath());
+
+ try {
+ RegisterService.registerService(tempFile.getAbsolutePath(), true);
+ } catch (IOException e) {
+ LOGGER.error("Faile to register the service file :" + tempFile.getPath() + ", exception:" + e);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent sce) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/CipherCreator.java b/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/CipherCreator.java
new file mode 100644
index 0000000..d964cbc
--- /dev/null
+++ b/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/CipherCreator.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.encrypt.cbb;
+
+import org.openo.baseservice.encrypt.cbb.impl.AesCipherFactory;
+import org.openo.baseservice.encrypt.cbb.inf.AbstractCipher;
+import org.openo.baseservice.encrypt.cbb.inf.AbstractCipherFactory;
+
+/**
+ * Helps create cipher instances from factory.<br/>
+ * <p>
+ * Creates the cipher instances using cipher factory. By default it uses AesCipherFactory.
+ * Can be changed through spring.
+ * </p>
+ *
+ * @author
+ * @version 08-Jun-2016
+ */
+public final class CipherCreator {
+
+ private static CipherCreator instance = new CipherCreator();
+
+ private AbstractCipherFactory factory = new AesCipherFactory();
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * private
+ * </p>
+ *
+ * @since
+ */
+ private CipherCreator() {
+
+ }
+
+ /**
+ * Singleton instance.
+ * <br/>
+ *
+ * @return
+ * @since
+ */
+ public static CipherCreator instance() {
+ return instance;
+ }
+
+ /**
+ * Creates cipher with default key.
+ * <br/>
+ *
+ * @return cipher instance with default key.
+ * @since
+ */
+ public AbstractCipher create() {
+ return factory.createCipherManager();
+ }
+
+ /**
+ * Creates cipher instance with a key.
+ * <br/>
+ *
+ * @param key the key to be used for encryption and decryption.
+ * @return cipher instance with specified key.
+ * @since
+ */
+ public AbstractCipher create(final String key) {
+ return factory.createCipherManager(key);
+ }
+
+ /**
+ * Sets the cipher factory instance.
+ * <br/>
+ *
+ * @param factory cipher factory.
+ * @since
+ */
+ public void setFactory(final AbstractCipherFactory factory) {
+ this.factory = factory;
+ }
+
+}
diff --git a/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/impl/AesCipher.java b/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/impl/AesCipher.java
new file mode 100644
index 0000000..f117269
--- /dev/null
+++ b/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/impl/AesCipher.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.encrypt.cbb.impl;
+
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.KeySpec;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.PBEKeySpec;
+import javax.crypto.spec.SecretKeySpec;
+import javax.xml.bind.DatatypeConverter;
+
+import org.openo.baseservice.encrypt.cbb.inf.AbstractCipher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * CipherManager implement<br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 31-May-2016
+ */
+public class AesCipher implements AbstractCipher {
+
+ private static final Logger LOG = LoggerFactory.getLogger(AesCipher.class);
+
+ private static final byte[] DEFAULT_IV = {2, 1, 4, 8, 0, 3, 2, 0, 7, 9, 2, 8, 5, 11, 6, 1};
+
+ private static final IvParameterSpec IV_PARAMETER_SPEC = new IvParameterSpec(DEFAULT_IV);
+
+ protected final SecretKey secretKey;
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * Creates default key.
+ * </p>
+ *
+ * @since
+ */
+ public AesCipher() {
+ super();
+ secretKey = createSecretKey("default");
+ }
+
+ /**
+ *
+ * Constructor<br/>
+ * <p>
+ * </p>
+ * Creates key.
+ * @param key
+ * @since
+ */
+ public AesCipher(final String key) {
+ super();
+ secretKey = createSecretKey(key);
+ }
+
+ private SecretKey createSecretKey(final String key) {
+ SecretKey secretKey = null;
+ try {
+ final SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
+ final KeySpec keySpec = new PBEKeySpec(key.toCharArray(), DEFAULT_IV, 30000, 128);
+
+ secretKey = keyFactory.generateSecret(keySpec);
+ return new SecretKeySpec(secretKey.getEncoded(), "AES");
+ } catch(InvalidKeySpecException e) {
+ LOG.error("Invalid KeySpec ", e);
+ } catch(NoSuchAlgorithmException e) {
+ LOG.error("Algorithm do not support: ", e);
+ }
+ return null;
+ }
+
+ @Override
+ public String encrypt(final String plain) {
+ try {
+ final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+ cipher.init(Cipher.ENCRYPT_MODE, secretKey, IV_PARAMETER_SPEC);
+ final byte[] encryptToBytes = cipher.doFinal(plain.getBytes());
+ return DatatypeConverter.printBase64Binary(encryptToBytes);
+ } catch(final Exception e) {
+ LOG.error("Encrypt the plain error:", e);
+ return null;
+ }
+ }
+
+ @Override
+ public String decrypt(final String encrypted) {
+
+ if(encrypted == null || encrypted.length() == 0) {
+ return null;
+ }
+
+ if(secretKey == null) {
+ return null;
+ }
+
+ try {
+ final Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+ cipher.init(Cipher.DECRYPT_MODE, secretKey, IV_PARAMETER_SPEC);
+ final byte[] tempBytes = DatatypeConverter.parseBase64Binary(encrypted);
+ final byte[] decrypTobytes = cipher.doFinal(tempBytes);
+ return new String(decrypTobytes);
+ } catch(final Exception e) {
+ LOG.error("decrypt the plain error:", e);
+ return null;
+ }
+ }
+
+}
diff --git a/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/impl/AesCipherFactory.java b/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/impl/AesCipherFactory.java
new file mode 100644
index 0000000..95e7336
--- /dev/null
+++ b/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/impl/AesCipherFactory.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.encrypt.cbb.impl;
+
+import org.openo.baseservice.encrypt.cbb.inf.AbstractCipher;
+import org.openo.baseservice.encrypt.cbb.inf.AbstractCipherFactory;
+
+/**
+ * Factory class to create CipherManager instances.<br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 03-Jun-2016
+ */
+public class AesCipherFactory implements AbstractCipherFactory {
+
+ /**
+ * Creates new CipherManager instance.<br/>
+ *
+ * @return new cipher manager instance.
+ * @since
+ */
+ @Override
+ public AbstractCipher createCipherManager() {
+ return new AesCipher();
+ }
+
+ /**
+ * Creates new CipherManager instance.<br/>
+ *
+ * @param key new cipher manager instance.
+ * @return
+ * @since
+ */
+ @Override
+ public AbstractCipher createCipherManager(final String key) {
+ return new AesCipher(key);
+ }
+
+}
diff --git a/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/inf/AbstractCipher.java b/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/inf/AbstractCipher.java
new file mode 100644
index 0000000..608dd82
--- /dev/null
+++ b/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/inf/AbstractCipher.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.encrypt.cbb.inf;
+
+/**
+ * Cipher Manager, provides the encrypt/decrypt interface
+ * <br/>
+ * <p>
+ * It provides bi-directional encryption api.
+ * </p>
+ *
+ * @author
+ * @version 31-May-2016
+ */
+public interface AbstractCipher {
+
+ /**
+ * Encrypt a string.
+ * <br/>
+ *
+ * @param plain string to be encrypted.
+ * @return encrypted string.
+ * @since
+ */
+ String encrypt(String plain);
+
+ /**
+ * Decrypt a string.
+ * <br/>
+ *
+ * @param encrypted String is encrypted by AES 128
+ * @return plain after decrypt
+ * @since
+ */
+ String decrypt(String encrypted);
+
+}
diff --git a/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/inf/AbstractCipherFactory.java b/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/inf/AbstractCipherFactory.java
new file mode 100644
index 0000000..e820250
--- /dev/null
+++ b/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/inf/AbstractCipherFactory.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.encrypt.cbb.inf;
+
+/**
+ * Factory class to create CipherManager instances.<br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 03-Jun-2016
+ */
+public interface AbstractCipherFactory {
+
+ /**
+ * Creates new CipherManager instance.<br/>
+ *
+ * @return new cipher manager instance.
+ * @since
+ */
+ AbstractCipher createCipherManager();
+
+ /**
+ * Creates new CipherManager instance.<br/>
+ *
+ * @param key new cipher manager instance.
+ * @return
+ * @since
+ */
+ AbstractCipher createCipherManager(final String key);
+
+}
diff --git a/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/sha/Sha256.java b/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/sha/Sha256.java
new file mode 100644
index 0000000..bbead3e
--- /dev/null
+++ b/wso2/common-util/src/main/java/org/openo/baseservice/encrypt/cbb/sha/Sha256.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.encrypt.cbb.sha;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.nio.charset.StandardCharsets;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+import javax.xml.bind.DatatypeConverter;
+
+/**
+ * Utility to generate SHA256 digest and HMAC.<br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 03-Jun-2016
+ */
+public final class Sha256 {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(Sha256.class);
+
+ private Sha256() {
+
+ }
+
+ /**
+ * Generates SHA256 digest.<br/>
+ *
+ * @param data: The data to be digested.
+ * @return Hex encoded digested data.
+ * @since
+ */
+ public static String digest(final String data) {
+ final byte[] dataBytes = data.getBytes(StandardCharsets.UTF_8);
+ MessageDigest md = null;
+ try {
+ md = MessageDigest.getInstance("SHA-256");
+ } catch(final NoSuchAlgorithmException e) {
+ LOGGER.error("No SHA-256 support ", e);
+ return "";
+ }
+ final byte[] digest = md.digest(dataBytes);
+ return DatatypeConverter.printHexBinary(digest);
+ }
+
+ /**
+ * Generates hmac signature using data and key.<br/>
+ *
+ * @param data: The data to be signed.
+ * @param key: The signing key.
+ * @return Hex encoded HMAC signature.
+ * @throws InvalidKeyException if the key is invalid.
+ * @since
+ */
+ public static String mac(final String data, final Key key) throws InvalidKeyException {
+ final byte[] dataBytes = data.getBytes(StandardCharsets.UTF_8);
+ Mac mac = null;
+ try {
+ mac = Mac.getInstance("HmacSHA256");
+ mac.init(key);
+ } catch(final NoSuchAlgorithmException e) {
+ LOGGER.error("SHA mac not supported", e);
+ return "";
+ }
+ final byte[] digest = mac.doFinal(dataBytes);
+ return DatatypeConverter.printHexBinary(digest);
+
+ }
+
+ /**
+ * Generates hmac with data and secret.
+ * <br/>
+ *
+ * @param data: The data to be signed.
+ * @param secret: The signing key.
+ * @return Hex encoded HMAC signature.
+ * @since
+ */
+ public static String mac(final String data, final byte[] secret) {
+ final Key key = new SecretKeySpec(secret, "HmacSHA256");
+ try {
+ return mac(data, key);
+ } catch(final InvalidKeyException e) {
+ LOGGER.error("Invalid key: ", e);
+ return "";
+ }
+ }
+
+}
diff --git a/wso2/common-util/src/main/java/org/openo/baseservice/util/RestUtils.java b/wso2/common-util/src/main/java/org/openo/baseservice/util/RestUtils.java
new file mode 100644
index 0000000..2661d69
--- /dev/null
+++ b/wso2/common-util/src/main/java/org/openo/baseservice/util/RestUtils.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.util;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * Utility functions for ROA.<br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 31-May-2016
+ */
+public final class RestUtils {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(RestUtils.class);
+
+ private RestUtils() {
+
+ }
+
+ /**
+ * To get body from http request<br/>
+ *
+ * @param request : request object.
+ * @return Request body as string.
+ * @since
+ */
+ public static String getRequestBody(final HttpServletRequest request) {
+ String body = null;
+ final StringBuilder stringBuilder = new StringBuilder();
+ BufferedReader bufferedReader = null;
+
+ try {
+ final InputStream inputStream = request.getInputStream();
+ if(inputStream != null) {
+ bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
+ final char[] charBuffer = new char[128];
+ int bytesRead = -1;
+ while((bytesRead = bufferedReader.read(charBuffer)) > 0) {
+ stringBuilder.append(charBuffer, 0, bytesRead);
+ }
+ }
+ } catch(final IOException ex) {
+ LOGGER.error("read inputStream buffer catch exception:", ex);
+ } finally {
+ if(bufferedReader != null) {
+ try {
+ bufferedReader.close();
+ } catch(final IOException ex) {
+ LOGGER.error("close buffer catch exception:", ex);
+ }
+ }
+ }
+
+ body = stringBuilder.toString();
+ return body;
+ }
+
+}
diff --git a/wso2/common-util/src/main/java/org/openo/baseservice/util/impl/SystemEnvVariablesDefImpl.java b/wso2/common-util/src/main/java/org/openo/baseservice/util/impl/SystemEnvVariablesDefImpl.java
new file mode 100644
index 0000000..0ac707b
--- /dev/null
+++ b/wso2/common-util/src/main/java/org/openo/baseservice/util/impl/SystemEnvVariablesDefImpl.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.util.impl;
+
+import org.openo.baseservice.util.inf.SystemEnvVariables;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * System environment variable helper implementation.<br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 24-Jun-2016
+ */
+public class SystemEnvVariablesDefImpl implements SystemEnvVariables {
+
+ private static final Logger LOG = LoggerFactory.getLogger(SystemEnvVariablesDefImpl.class);
+
+ @Override
+ public String getAppRoot() {
+ String appRoot = null;
+ appRoot = System.getProperty("catalina.base");
+ if(appRoot != null) {
+ appRoot = getCanonicalPath(appRoot);
+ }
+ return appRoot;
+ }
+
+ /**
+ * Gets the canonical path<br/>
+ *
+ * @param inPath input path
+ * @return the canonical path.
+ * @since
+ */
+ private String getCanonicalPath(final String inPath) {
+ String path = null;
+ try {
+ if(inPath != null) {
+ final File file = new File(inPath);
+ path = file.getCanonicalPath();
+ }
+ } catch(final IOException e) {
+ LOG.error("file.getCanonicalPath() IOException:", e);
+ }
+ return path;
+ }
+
+}
diff --git a/wso2/common-util/src/main/java/org/openo/baseservice/util/impl/SystemEnvVariablesFactory.java b/wso2/common-util/src/main/java/org/openo/baseservice/util/impl/SystemEnvVariablesFactory.java
new file mode 100644
index 0000000..e75c997
--- /dev/null
+++ b/wso2/common-util/src/main/java/org/openo/baseservice/util/impl/SystemEnvVariablesFactory.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.util.impl;
+
+import org.openo.baseservice.util.inf.SystemEnvVariables;
+
+/**
+ * SystemEnvVariables factory class
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version
+ */
+public class SystemEnvVariablesFactory {
+
+ private static SystemEnvVariables systemEnvVariablesInstance = new SystemEnvVariablesDefImpl();
+
+ /**
+ *
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @since
+ */
+ private SystemEnvVariablesFactory() {
+
+ }
+ /**
+ * get the SystemEnvVariables instance
+ * <br/>
+ *
+ * @return SystemEnvVariables instance
+ * @since
+ */
+ public static SystemEnvVariables getInstance() {
+ return systemEnvVariablesInstance;
+ }
+}
diff --git a/wso2/common-util/src/main/java/org/openo/baseservice/util/inf/SystemEnvVariables.java b/wso2/common-util/src/main/java/org/openo/baseservice/util/inf/SystemEnvVariables.java
new file mode 100644
index 0000000..cf0c182
--- /dev/null
+++ b/wso2/common-util/src/main/java/org/openo/baseservice/util/inf/SystemEnvVariables.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.util.inf;
+
+/**
+ * Dependency the system env<br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 31-May-2016
+ */
+public interface SystemEnvVariables {
+
+ /**
+ * Get application root path <br/>
+ *
+ * @return application root path.
+ * @since
+ */
+ String getAppRoot();
+}
diff --git a/wso2/common-util/src/test/java/org/openo/baseservice/bus/util/TestRegisterService.java b/wso2/common-util/src/test/java/org/openo/baseservice/bus/util/TestRegisterService.java
new file mode 100644
index 0000000..88f5ddd
--- /dev/null
+++ b/wso2/common-util/src/test/java/org/openo/baseservice/bus/util/TestRegisterService.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.bus.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import javax.ws.rs.core.Response;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.baseservice.util.impl.SystemEnvVariablesDefImpl;
+
+import junit.framework.Assert;
+import mockit.Mock;
+import mockit.MockUp;
+
+public class TestRegisterService {
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testregisterServce() throws IOException {
+
+ File file = new File("");
+ Response res = null;
+
+ final String path = file.getAbsolutePath();
+
+ new MockUp<SystemEnvVariablesDefImpl>() {
+ @Mock
+ public String getAppRoot() {
+ return path;
+ }
+ };
+
+ try {
+ res = RegisterService.registerService(path, true);
+ } catch(Exception e) {
+ Assert.assertNotNull(e);
+ }
+
+ }
+}
+
diff --git a/wso2/common-util/src/test/java/org/openo/baseservice/bus/util/TestRegisterServiceListener.java b/wso2/common-util/src/test/java/org/openo/baseservice/bus/util/TestRegisterServiceListener.java
new file mode 100644
index 0000000..429d986
--- /dev/null
+++ b/wso2/common-util/src/test/java/org/openo/baseservice/bus/util/TestRegisterServiceListener.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.bus.util;
+
+import java.io.File;
+
+import javax.servlet.ServletContextEvent;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import mockit.Mock;
+import mockit.MockUp;
+
+public class TestRegisterServiceListener {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void testRegisterServiceListener() {
+
+ RegisterServiceListener impl = new RegisterServiceListener();
+
+ ServletContextEvent sce = null;
+
+ new MockUp<File>() {
+ @Mock
+ public File[] listFiles() {
+ File file = new File("");
+ File[] filelist = new File[]{file};
+ return filelist;
+ }
+
+ };
+
+ impl.contextInitialized(sce);
+ }
+
+}
diff --git a/wso2/common-util/src/test/java/org/openo/baseservice/encrypt/cbb/impl/AesCipherTest.java b/wso2/common-util/src/test/java/org/openo/baseservice/encrypt/cbb/impl/AesCipherTest.java
new file mode 100644
index 0000000..c66e36a
--- /dev/null
+++ b/wso2/common-util/src/test/java/org/openo/baseservice/encrypt/cbb/impl/AesCipherTest.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.encrypt.cbb.impl;
+
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.InvalidKeySpecException;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKeyFactory;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openo.baseservice.encrypt.cbb.CipherCreator;
+import org.openo.baseservice.encrypt.cbb.inf.AbstractCipher;
+
+import junit.framework.Assert;
+import mockit.Mocked;
+import mockit.NonStrictExpectations;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 02-Jun-2016
+ */
+public class AesCipherTest {
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ CipherCreator.instance().setFactory(new AesCipherFactory());
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for
+ * {@link org.openo.baseservice.encrypt.cbb.impl.AesCipher#encrypt(java.lang.String)}.
+ */
+ @Test
+ public void testEncrypt() {
+ final AbstractCipher cipherManager = CipherCreator.instance().create();
+ final String encrypted = cipherManager.encrypt("test-encrypt");
+ final String decrypted = cipherManager.decrypt(encrypted);
+
+ Assert.assertEquals("test-encrypt", decrypted);
+ }
+
+ @Test
+ public void testEncryptException() throws Exception {
+ new NonStrictExpectations() {
+
+ @Mocked
+ Cipher cipher;
+
+ {
+ cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
+ result = new InvalidKeySpecException();
+ }
+ };
+ final AbstractCipher cipherManager = CipherCreator.instance().create();
+ final String encrypted = cipherManager.encrypt("test-encrypt");
+
+ Assert.assertEquals(null, encrypted);
+ }
+
+ /**
+ * Test method for
+ * {@link org.openo.baseservice.encrypt.cbb.impl.AesCipher#decrypt(java.lang.String)}.
+ */
+ @Test
+ public void testDecrypt() {
+ final AbstractCipher cipherManager = CipherCreator.instance().create();
+ final String encrypted = cipherManager.encrypt("test-encrypt");
+ final String decrypted = cipherManager.decrypt(encrypted);
+
+ Assert.assertEquals("test-encrypt", decrypted);
+ }
+
+ @Test
+ public void testDecryptNull() {
+ final AbstractCipher cipherManager = CipherCreator.instance().create();
+ String decrypted = cipherManager.decrypt(null);
+ Assert.assertEquals(null, decrypted);
+
+ decrypted = cipherManager.decrypt("");
+
+ Assert.assertEquals(null, decrypted);
+ }
+
+ /**
+ * Test method for
+ * {@link
+ * org.openo.baseservice.encrypt.cbb.impl.AesCipher#CipherManagerImpl(java.lang.String)}
+ * .
+ */
+ @Test
+ public void testCipherManagerImplString() {
+ final AbstractCipher cipherManager = CipherCreator.instance().create("secret-key");
+ final String encrypted = cipherManager.encrypt("test-encrypt");
+ final String decrypted = cipherManager.decrypt(encrypted);
+
+ Assert.assertEquals("test-encrypt", decrypted);
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testCipherManagerImplStringDiffKey() {
+ final String encrypted = CipherCreator.instance().create("secret-key").encrypt("test-encrypt");
+ final String decrypted = CipherCreator.instance().create("wrong-key").decrypt(encrypted);
+
+ Assert.assertNotSame("test-encrypt", decrypted);
+
+ final String decrypt = CipherCreator.instance().create("secret-key").decrypt(encrypted);
+ Assert.assertEquals("test-encrypt", decrypt);
+ }
+
+ @Test
+ public void testCreateSecretKeyNoSuchAlgorithmException() throws Exception {
+ new NonStrictExpectations() {
+
+ @Mocked
+ SecretKeyFactory keyFactory;
+
+ {
+ keyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
+ result = new NoSuchAlgorithmException();
+ }
+ };
+
+ final AbstractCipher cipherManager = CipherCreator.instance().create("secret-key");
+ final String encrypted = cipherManager.encrypt("test-encrypt");
+ Assert.assertEquals(encrypted, null);
+
+ }
+
+ @Test
+ public void testCreateSecretKeyInvalidKeySpecException() throws Exception {
+ new NonStrictExpectations() {
+
+ @Mocked
+ SecretKeyFactory keyFactory;
+
+ {
+ keyFactory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
+ result = new InvalidKeySpecException();
+ }
+ };
+
+ final AbstractCipher cipherManager = CipherCreator.instance().create("secret-key");
+ final String decrypted = cipherManager.decrypt("test-encrypt");
+ Assert.assertEquals(decrypted, null);
+
+ }
+}
diff --git a/wso2/common-util/src/test/java/org/openo/baseservice/encrypt/cbb/sha/Sha256Test.java b/wso2/common-util/src/test/java/org/openo/baseservice/encrypt/cbb/sha/Sha256Test.java
new file mode 100644
index 0000000..f7eaf23
--- /dev/null
+++ b/wso2/common-util/src/test/java/org/openo/baseservice/encrypt/cbb/sha/Sha256Test.java
@@ -0,0 +1,193 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.encrypt.cbb.sha;
+
+import static org.junit.Assert.fail;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.security.InvalidKeyException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import javax.crypto.Mac;
+import javax.crypto.spec.SecretKeySpec;
+
+import mockit.Mocked;
+import mockit.NonStrictExpectations;
+import mockit.integration.junit4.JMockit;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 03-Jun-2016
+ */
+@RunWith(JMockit.class)
+public class Sha256Test {
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for {@link org.openo.baseservice.encrypt.cbb.sha.Sha256#digest(java.lang.String)}
+ * .
+ */
+ @Test
+ public void testDigest() {
+ String plain = "";
+ String expected = "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855";
+ Assert.assertEquals(expected, Sha256.digest(plain));
+
+ expected = "D7A8FBB307D7809469CA9ABCB0082E4F8D5651E46D3CDB762D02D0BF37C9E592";
+ plain = "The quick brown fox jumps over the lazy dog";
+ Assert.assertEquals(expected, Sha256.digest(plain));
+ }
+
+ @Test
+ public void testDigestException() throws Exception {
+ new NonStrictExpectations() {
+
+ @Mocked
+ MessageDigest md;
+
+ {
+ md = MessageDigest.getInstance("SHA-256");
+ result = new NoSuchAlgorithmException();
+ }
+ };
+ final String plain = "";
+ final String expected = "";
+ Assert.assertEquals(expected, Sha256.digest(plain));
+
+ }
+
+ /**
+ * Test method for
+ * {@link org.openo.baseservice.encrypt.cbb.sha.Sha256#mac(java.lang.String, java.security.Key)}
+ * .
+ *
+ * @throws InvalidKeyException
+ */
+ @Test
+ public void testMacStringKey() {
+ final String expected = "F7BC83F430538424B13298E6AA6FB143EF4D59A14946175997479DBC2D1A3CD8";
+ final String plain = "The quick brown fox jumps over the lazy dog";
+ try {
+ Assert.assertEquals(expected, Sha256.mac(plain, new SecretKeySpec("key".getBytes(), "HmacSHA256")));
+ } catch(final InvalidKeyException e) {
+ e.printStackTrace();
+ fail("testMacStringKey failed" + e.getMessage());
+ }
+ try {
+ Assert.assertEquals(expected, Sha256.mac(plain, new SecretKeySpec("key".getBytes(), "AES")));
+ } catch(final InvalidKeyException e) {
+ e.printStackTrace();
+ fail("testMacStringKey failed" + e.getMessage());
+ }
+
+ }
+
+ @Test
+ public void testMacStringKeyException() throws Exception {
+ new NonStrictExpectations() {
+
+ @Mocked
+ Mac mac;
+
+ {
+ mac = Mac.getInstance("HmacSHA256");
+ result = new NoSuchAlgorithmException();
+ }
+ };
+ Sha256.mac("dummy", new SecretKeySpec("key".getBytes(), "AES"));
+ }
+
+ /**
+ * Test method for
+ * {@link org.openo.baseservice.encrypt.cbb.sha.Sha256#mac(java.lang.String, byte[])}.
+ */
+ @Test
+ public void testMacStringByteArray() {
+ final String expected = "F7BC83F430538424B13298E6AA6FB143EF4D59A14946175997479DBC2D1A3CD8";
+ final String plain = "The quick brown fox jumps over the lazy dog";
+ Assert.assertEquals(expected, Sha256.mac(plain, "key".getBytes()));
+ }
+
+ @Test
+ public void testMacStringByteArrayInvalidKeyException() throws Exception {
+ final String key = "key";
+ new NonStrictExpectations() {
+
+ @Mocked
+ Mac mac;
+
+ {
+ mac = Mac.getInstance("HmacSHA256");
+ result = new InvalidKeyException();
+ }
+ };
+ final String expected = "";
+ final String plain = "The quick brown fox jumps over the lazy dog";
+ Assert.assertEquals(expected, Sha256.mac(plain, key.getBytes()));
+ }
+
+}
diff --git a/wso2/common-util/src/test/java/org/openo/baseservice/util/RestUtilsTest.java b/wso2/common-util/src/test/java/org/openo/baseservice/util/RestUtilsTest.java
new file mode 100644
index 0000000..56b6eee
--- /dev/null
+++ b/wso2/common-util/src/test/java/org/openo/baseservice/util/RestUtilsTest.java
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.util;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServletRequest;
+
+import junit.framework.Assert;
+import mockit.Expectations;
+import mockit.Mocked;
+import mockit.integration.junit4.JMockit;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 08-Jun-2016
+ */
+@RunWith(JMockit.class)
+public class RestUtilsTest {
+
+ @Mocked
+ HttpServletRequest mockHttpServletRequest;
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for
+ * {@link org.openo.baseservice.util.RestUtils#getRequestBody(javax.servlet.http.HttpServletRequest)}
+ * .
+ *
+ * @throws IOException
+ */
+ @Test
+ public void testGetRequestBody() throws IOException {
+ final String dummy = "this is a dummy data to test request body";
+ final ServletInputStream inputStream = new ServletInputStream() {
+
+ final ByteArrayInputStream stream = new ByteArrayInputStream(dummy.getBytes());
+
+ @Override
+ public int read() throws IOException {
+ return stream.read();
+ }
+
+ };
+
+ new Expectations() {
+
+ {
+ mockHttpServletRequest.getInputStream();
+ returns(inputStream);
+ }
+ };
+ final String body = RestUtils.getRequestBody(mockHttpServletRequest);
+
+ Assert.assertEquals(dummy, body);
+ }
+
+ @Test
+ public void testGetRequestBodyNull() throws IOException {
+ final ServletInputStream inputStream = null;
+ new Expectations() {
+
+ {
+ mockHttpServletRequest.getInputStream();
+ returns(inputStream);
+ }
+ };
+ final String body = RestUtils.getRequestBody(mockHttpServletRequest);
+
+ Assert.assertEquals("", body);
+ }
+
+ @Test
+ public void testGetRequestBodyIOException() throws IOException {
+ final ServletInputStream inputStream = new ServletInputStream() {
+
+ @Override
+ public int read() throws IOException {
+ throw new IOException();
+ }
+
+ };
+
+ new Expectations() {
+
+ {
+ mockHttpServletRequest.getInputStream();
+ returns(inputStream);
+ }
+ };
+ final String body = RestUtils.getRequestBody(mockHttpServletRequest);
+
+ Assert.assertEquals("", body);
+ }
+
+ @Test
+ public void testGetRequestBodyCloseIOException() throws IOException {
+ final ServletInputStream inputStream = new ServletInputStream() {
+
+ final ByteArrayInputStream stream = new ByteArrayInputStream("dummy".getBytes());
+
+ @Override
+ public int read() throws IOException {
+ return stream.read();
+ }
+
+ @Override
+ public void close() throws IOException {
+ throw new IOException();
+ }
+ };
+
+ new Expectations() {
+
+ {
+ mockHttpServletRequest.getInputStream();
+ returns(inputStream);
+ }
+ };
+ final String body = RestUtils.getRequestBody(mockHttpServletRequest);
+
+ Assert.assertEquals("dummy", body);
+ }
+
+}
diff --git a/wso2/common-util/src/test/java/org/openo/baseservice/util/impl/SystemEnvVariablesDefImplTest.java b/wso2/common-util/src/test/java/org/openo/baseservice/util/impl/SystemEnvVariablesDefImplTest.java
new file mode 100644
index 0000000..83414a2
--- /dev/null
+++ b/wso2/common-util/src/test/java/org/openo/baseservice/util/impl/SystemEnvVariablesDefImplTest.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.util.impl;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openo.baseservice.util.inf.SystemEnvVariables;
+
+import junit.framework.Assert;
+import mockit.Mocked;
+import mockit.NonStrictExpectations;
+import mockit.integration.junit4.JMockit;
+import net.jcip.annotations.NotThreadSafe;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 08-Jun-2016
+ */
+@RunWith(JMockit.class)
+@NotThreadSafe
+public class SystemEnvVariablesDefImplTest {
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @Test
+ public void testGetAppRootException() throws Exception {
+ new NonStrictExpectations() {
+
+ @Mocked
+ File file;
+
+ {
+ file = new File(".");
+ file.getCanonicalPath();
+ result = new IOException();
+ }
+
+ };
+ final SystemEnvVariables envVars =new SystemEnvVariablesDefImpl();
+ System.setProperty("catalina.base", ".");
+ final String actual = envVars.getAppRoot();
+ Assert.assertEquals(null, actual);
+ }
+
+
+ /**
+ * Test method for
+ * {@link org.openo.baseservice.util.impl.SystemEnvVariablesDefImpl#getAppRoot()}.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testGetAppRoot() throws Exception {
+ final SystemEnvVariables envVars = new SystemEnvVariablesDefImpl();
+ final File file = new File(".");
+ final String expected = file.getCanonicalPath();
+ System.setProperty("catalina.base", ".");
+ final String actual = envVars.getAppRoot();
+ Assert.assertEquals(expected, actual);
+ }
+
+}
diff --git a/wso2/dropwizard-ioc-container/pom.xml b/wso2/dropwizard-ioc-container/pom.xml
new file mode 100644
index 0000000..6223c7f
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/pom.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openo.common-services.common-utilities</groupId>
+ <artifactId>common-setting</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>dropwizard-ioc-container</artifactId>
+ <name>common-services-common-utilities/dropwizard-ioc-container</name>
+ <properties>
+ </properties>
+ <dependencies>
+
+ <dependency>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-core</artifactId>
+ <version>0.8.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.reflections</groupId>
+ <artifactId>reflections</artifactId>
+ <version>0.9.10</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ <version>4.8.2</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>always</forkMode>
+ <argLine>-XX:-UseSplitVerifier</argLine>
+ <skip>${maven.test.skip}</skip>
+ <testFailureIgnore>${maven.test.failure.ignore}</testFailureIgnore>
+ <excludes>
+ <exclude>${excludesFile}</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.5</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ <testSource>1.8</testSource>
+ <testTarget>1.8</testTarget>
+ </configuration>
+ </plugin>
+
+
+ </plugins>
+ </build>
+</project>
diff --git a/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/BaseService.java b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/BaseService.java
new file mode 100644
index 0000000..ac0bb47
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/BaseService.java
@@ -0,0 +1,34 @@
+/**
+ * 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.dropwizard.ioc.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * basic services for identification
+ * @author hu.rui
+ *
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface BaseService {
+
+}
diff --git a/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/Lazy.java b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/Lazy.java
new file mode 100644
index 0000000..40ce5af
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/Lazy.java
@@ -0,0 +1,34 @@
+/**
+ * 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.dropwizard.ioc.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * lazy loading of related services
+ * @author hu.rui
+ *
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface Lazy {
+
+}
diff --git a/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/PostBaseService.java b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/PostBaseService.java
new file mode 100644
index 0000000..a1a6d77
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/PostBaseService.java
@@ -0,0 +1,34 @@
+/**
+ * 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.dropwizard.ioc.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * load on after basic services
+ * @author hu.rui
+ *
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface PostBaseService {
+
+}
diff --git a/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/PreBaseService.java b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/PreBaseService.java
new file mode 100644
index 0000000..f579b9e
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/PreBaseService.java
@@ -0,0 +1,34 @@
+/**
+ * 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.dropwizard.ioc.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * prior to basic service loading
+ * @author hu.rui
+ *
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface PreBaseService {
+
+}
diff --git a/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/PreLoad.java b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/PreLoad.java
new file mode 100644
index 0000000..3131e8b
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/PreLoad.java
@@ -0,0 +1,34 @@
+/**
+ * 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.dropwizard.ioc.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * load before general service
+ * @author hu.rui
+ *
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface PreLoad {
+
+}
diff --git a/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/PreServiceLoad.java b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/PreServiceLoad.java
new file mode 100644
index 0000000..e0e3043
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/annotation/PreServiceLoad.java
@@ -0,0 +1,35 @@
+/**
+ * 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.dropwizard.ioc.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *
+ * load before general service,after PreLoad
+ * @author hu.rui
+ *
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface PreServiceLoad {
+
+}
diff --git a/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/bundle/AutoConfigBundle.java b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/bundle/AutoConfigBundle.java
new file mode 100644
index 0000000..4cb4008
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/bundle/AutoConfigBundle.java
@@ -0,0 +1,430 @@
+/**
+ * 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.dropwizard.ioc.bundle;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import javax.ws.rs.Path;
+import javax.ws.rs.ext.Provider;
+
+import org.eclipse.jetty.util.component.LifeCycle;
+import org.glassfish.hk2.api.ServiceLocator;
+import org.glassfish.hk2.api.ServiceLocatorFactory;
+import org.glassfish.hk2.utilities.ServiceLocatorUtilities;
+import org.glassfish.hk2.utilities.binding.AbstractBinder;
+import org.glassfish.jersey.servlet.ServletProperties;
+import org.jvnet.hk2.annotations.Service;
+import org.openo.dropwizard.ioc.annotation.BaseService;
+import org.openo.dropwizard.ioc.annotation.Lazy;
+import org.openo.dropwizard.ioc.annotation.PostBaseService;
+import org.openo.dropwizard.ioc.annotation.PreBaseService;
+import org.openo.dropwizard.ioc.annotation.PreLoad;
+import org.openo.dropwizard.ioc.annotation.PreServiceLoad;
+import org.openo.dropwizard.ioc.utils.ServiceBinder;
+import org.openo.dropwizard.ioc.utils.ServiceLocatorHolder;
+import org.reflections.Reflections;
+import org.reflections.scanners.SubTypesScanner;
+import org.reflections.scanners.TypeAnnotationsScanner;
+import org.reflections.util.ClasspathHelper;
+import org.reflections.util.ConfigurationBuilder;
+import org.reflections.util.FilterBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.codahale.metrics.health.HealthCheck;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.Lists;
+
+import io.dropwizard.Configuration;
+import io.dropwizard.ConfiguredBundle;
+import io.dropwizard.configuration.ConfigurationSourceProvider;
+import io.dropwizard.lifecycle.Managed;
+import io.dropwizard.lifecycle.ServerLifecycleListener;
+import io.dropwizard.servlets.tasks.Task;
+import io.dropwizard.setup.Bootstrap;
+import io.dropwizard.setup.Environment;
+
+/**
+ * complete the integration of hK2 container and dropwizard
+ *
+ * @author hu.rui
+ *
+ */
+
+public class AutoConfigBundle<T extends Configuration> implements ConfiguredBundle<T> {
+
+ private static final Logger LOG = LoggerFactory.getLogger(AutoConfigBundle.class);
+
+ private ServiceLocator locator;
+ private Reflections reflections;
+ private Set<Class<?>> services;
+
+ private Bootstrap<?> bootstrap;
+
+
+ AutoConfigBundle(final String packageName) {
+ this(Lists.newArrayList(packageName));
+ }
+
+ AutoConfigBundle(List<String> packageNames) {
+ FilterBuilder filterBuilder = new FilterBuilder();
+
+ packageNames.stream().forEach(packageName -> {
+ filterBuilder.include(FilterBuilder.prefix(packageName));
+ });
+ ConfigurationBuilder reflectionCfg = new ConfigurationBuilder();
+
+ packageNames.stream().forEach(packageName -> {
+ reflectionCfg.addUrls(ClasspathHelper.forPackage(packageName));
+ });
+
+ reflectionCfg.filterInputsBy(filterBuilder).setScanners(new SubTypesScanner(),
+ new TypeAnnotationsScanner());
+ reflections = new Reflections(reflectionCfg);
+
+ locator = ServiceLocatorFactory.getInstance().create("dw-hk2");
+
+ ServiceLocatorHolder.setLocator(locator);
+
+ }
+
+ public static <T extends Configuration> AutoConfigBundleBuider<T> newBuilder() {
+ return new AutoConfigBundleBuider<T>();
+ }
+
+ @Override
+ public void initialize(final Bootstrap<?> bootstrap) {
+
+ this.bootstrap = bootstrap;
+ registerPreLoadService();
+
+ LOG.debug("Intialzing auto config bundle.");
+ }
+
+ private void registerPreLoadService() {
+
+ registerService(PreLoad.class);
+
+ }
+
+
+ @Override
+ public void run(final T configuration, final Environment environment) throws Exception {
+
+ registerConfigurationProvider(configuration, environment);
+
+
+ registerEnvironment(environment);
+ registerObjectMapper(environment);
+
+ environment.getApplicationContext().getServletContext()
+ .setAttribute(ServletProperties.SERVICE_LOCATOR, locator);
+
+ registerService(PreBaseService.class);
+ registerService(BaseService.class);
+ registerService(PostBaseService.class);
+ this.registerService(PreServiceLoad.class);
+
+
+ registerServices();
+
+ // registerManaged(environment);
+ registerLifecycle(environment);
+ registerServerLifecycleListeners(environment);
+ registerJettyLifeCycleListener(environment);
+ registerTasks(environment);
+ registerHealthChecks(environment);
+ registerProviders(environment);
+ registerResources(environment);
+
+ environment.lifecycle().manage(new ServiceLocatorManaged(locator));
+
+ }
+
+
+
+ private void registerProviders(Environment environment) {
+ reflections.getSubTypesOf(Provider.class).stream().filter(services::contains)
+ .forEach(providerKlass -> {
+ try {
+ environment.jersey().register(locator.getService(providerKlass));
+ } catch (Exception e) {
+ LOG.warn("", e);
+ }
+
+ LOG.info("Registering Dropwizard Provider, class name : {}", providerKlass.getName());
+
+ });
+
+ }
+
+ private void registerTasks(Environment environment) {
+ reflections.getSubTypesOf(Task.class).stream().filter(services::contains).forEach(taskKlass -> {
+ try {
+ environment.admin().addTask(locator.getService(taskKlass));
+ } catch (Exception e) {
+ LOG.warn("", e);
+ }
+ LOG.info("Registering Dropwizard Task, class name : {}", taskKlass.getName());
+ });
+
+ }
+
+ private void registerJettyLifeCycleListener(Environment environment) {
+ reflections.getSubTypesOf(LifeCycle.Listener.class).stream().filter(services::contains)
+ .forEach(lifecycleListenerKlass -> {
+
+ try {
+ environment.lifecycle()
+ .addLifeCycleListener(locator.getService(lifecycleListenerKlass));
+ } catch (Exception e) {
+ LOG.warn("", e);
+ }
+ LOG.info("Registering Dropwizard lifecycleListener, class name : {}",
+ lifecycleListenerKlass.getName());
+ });
+
+ }
+
+ private void registerServerLifecycleListeners(Environment environment) {
+
+ reflections.getSubTypesOf(ServerLifecycleListener.class).stream().filter(services::contains)
+ .forEach(serverLifecycleListenerKlass -> {
+ try {
+ environment.lifecycle()
+ .addServerLifecycleListener(locator.getService(serverLifecycleListenerKlass));
+ } catch (Exception e) {
+ LOG.warn("", e);
+ }
+ LOG.info("Registering Dropwizard serverLifecycleListener, class name : {}",
+ serverLifecycleListenerKlass.getName());
+ });
+
+ }
+
+ private void registerLifecycle(Environment environment) {
+ reflections.getSubTypesOf(LifeCycle.class).stream().filter(services::contains)
+ .forEach(lifeCycleKlass -> {
+ try {
+ environment.lifecycle().manage(locator.getService(lifeCycleKlass));
+ } catch (Exception e) {
+ LOG.warn("", e);
+ }
+ LOG.info("Registering Dropwizard LifeCycle, class name : {}", lifeCycleKlass.getName());
+ });
+ }
+
+ /*
+ * private void registerManaged(Environment environment) {
+ *
+ * reflections.getSubTypesOf(Managed.class).stream().filter(services::contains)
+ * .forEach(managedKlass -> { try {
+ * environment.lifecycle().manage(locator.getService(managedKlass)); } catch (Exception e) {
+ * LOG.warn("", e); } LOG.info("Registering Dropwizard managed, class name : {}",
+ * managedKlass.getName()); });
+ *
+ * }
+ */
+
+ private void registerObjectMapper(Environment environment) {
+
+ final ObjectMapper objectMapper = environment.getObjectMapper();
+
+ ServiceLocatorUtilities.bind(locator, new AbstractBinder() {
+ @Override
+ protected void configure() {
+ bind(objectMapper).to(ObjectMapper.class);
+
+ LOG.info("Registering Dropwizard objectMapper, class name : {}",
+ objectMapper.getClass().getName());
+ }
+ });
+
+ }
+
+ private void registerEnvironment(final Environment environment) {
+
+ ServiceLocatorUtilities.bind(locator, new AbstractBinder() {
+ @Override
+ protected void configure() {
+ bind(environment).to(Environment.class);
+
+ LOG.info("Registering Dropwizard environment, class name : {}",
+ environment.getClass().getName());
+ }
+ });
+
+ }
+
+ private void registerConfigurationProvider(final T configuration, final Environment environment) {
+
+ ServiceLocatorUtilities.bind(locator, new AbstractBinder() {
+ @Override
+ protected void configure() {
+ bind(configuration);
+ LOG.info("Registering Dropwizard Configuration class name:{}",
+ configuration.getClass().getName());
+ if (configuration instanceof Configuration) {
+ bind((Configuration) configuration).to(Configuration.class);
+ LOG.info("Registering Dropwizard Configuration class name:{}",
+ Configuration.class.getName());
+ }
+
+ }
+ });
+
+ registerSubConfigure(configuration, environment);
+
+ }
+
+ private void registerSubConfigure(final T configuration, final Environment environment) {
+ final List<Field> subDeclaredFields =
+ Arrays.asList(configuration.getClass().getDeclaredFields());
+ List<Field> parentDeclaredFields = Arrays.asList(Configuration.class.getDeclaredFields());
+
+ List<Field> filtersubDeclaredFields = subDeclaredFields.stream()
+ .filter(subDeclaredField -> !subDeclaredField.getType().isPrimitive())
+ .filter(subDeclaredField -> !subDeclaredField.getType().equals(String.class))
+ .filter(subDeclaredField -> !parentDeclaredFields.contains(subDeclaredField))
+ .collect(Collectors.toList());
+
+ ServiceLocatorUtilities.bind(locator, new AbstractBinder() {
+ @Override
+ protected void configure() {
+ filtersubDeclaredFields.forEach(subField -> {
+ subField.setAccessible(true);
+ try {
+ Object subConfig = subField.get(configuration);
+ if (subConfig != null) {
+ bind(subConfig);
+ LOG.info("Registering Dropwizard Sub Configuration class name {}",
+ subConfig.getClass().getName());
+ }
+
+ } catch (Exception e) {
+ LOG.error("bind sub config:{} fail", subField);
+ }
+ });
+ }
+ });
+
+ }
+
+ private void registerServices() {
+ services = this.reflections.getTypesAnnotatedWith(Service.class, true);
+ if (!services.isEmpty()) {
+ ServiceLocatorUtilities.bind(locator, new ServiceBinder(services));
+
+ services.forEach(s -> {
+ LOG.info("Registering Dropwizard service, class name : {}", s.getName());
+ });
+
+ services.stream().filter(serviceClazz -> (serviceClazz.getAnnotation(Lazy.class) == null))
+ .peek(serviceClazz -> LOG.info("active service, class name : {}", serviceClazz.getName()))
+ .forEach(serviceClazz -> {
+ try {
+ long startTime = System.currentTimeMillis();
+ locator.getService(serviceClazz);
+ LOG.info("active service, class name : {},cost time:{}", serviceClazz.getName(),
+ (System.currentTimeMillis() - startTime));
+ } catch (Exception e) {
+ LOG.warn("", e);
+ }
+
+ });
+
+ } else {
+ LOG.warn("Registering Dropwizard service is empty");
+
+ }
+
+ }
+
+ private void registerResources(final Environment environment) {
+ reflections.getTypesAnnotatedWith(Path.class).stream().forEach(resourceClass -> {
+
+ LOG.info("begin Registering Dropwizard resource, class name : {}", resourceClass.getName());
+ try {
+ Object resourceObject = locator.getService(resourceClass);
+ if (resourceObject != null) {
+ environment.jersey().register(resourceObject);
+ LOG.info("Registering Dropwizard resource, class name : {}", resourceClass.getName());
+ } else {
+ LOG.warn(resourceClass.getName() + " not use Service annotation");
+ }
+ } catch (Exception e) {
+ LOG.error("", e);
+ }
+
+
+ });
+ }
+
+ private void registerHealthChecks(final Environment env) {
+
+ reflections.getSubTypesOf(HealthCheck.class).stream().filter(services::contains)
+ .forEach(healthCheckKlass -> {
+ try {
+ env.healthChecks().register(healthCheckKlass.getName(),
+ locator.getService(healthCheckKlass));
+ } catch (Exception e) {
+ LOG.warn("", e);
+ }
+ LOG.info("Registering Dropwizard healthCheck, class name : {}",
+ healthCheckKlass.getName());
+ });
+
+ }
+
+
+
+ private void registerService(Class<? extends Annotation> annotationClazz) {
+
+ Set<Class<?>> services = this.reflections.getTypesAnnotatedWith(annotationClazz, true);
+ if (!services.isEmpty()) {
+ ServiceLocatorUtilities.bind(locator, new ServiceBinder(services));
+
+ services.forEach(s -> {
+ LOG.info("{} Registering service, class name : {}", annotationClazz.getName(),
+ s.getName());
+ });
+
+ services.stream().filter(serviceClazz -> (serviceClazz.getAnnotation(Lazy.class) == null))
+ .peek(serviceClazz -> LOG.info("active service, class name : {}", serviceClazz.getName()))
+ .forEach(serviceClazz -> {
+ try {
+ long startTime = System.currentTimeMillis();
+ locator.getService(serviceClazz);
+ LOG.info("active service, class name : {},cost time:{}", serviceClazz.getName(),
+ (System.currentTimeMillis() - startTime));
+ } catch (Exception e) {
+ LOG.warn("", e);
+ }
+
+ });
+
+ } else {
+ LOG.warn("Registering {} service is empty", annotationClazz.getName());
+
+ }
+
+ }
+}
diff --git a/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/bundle/AutoConfigBundleBuider.java b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/bundle/AutoConfigBundleBuider.java
new file mode 100644
index 0000000..5e2cbc0
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/bundle/AutoConfigBundleBuider.java
@@ -0,0 +1,42 @@
+/**
+ * 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.dropwizard.ioc.bundle;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import io.dropwizard.Configuration;
+
+public class AutoConfigBundleBuider<T extends Configuration> {
+
+ private static final String DEFAULT_PACKAGE_NAME="org.openo";
+
+ private List<String> packageNames=new ArrayList<>();
+
+ public AutoConfigBundleBuider(){
+ packageNames.add( DEFAULT_PACKAGE_NAME);
+ }
+
+ public AutoConfigBundleBuider<T> addPackageName(String packageName) {
+ this.packageNames.add(packageName);
+ return this;
+ }
+
+
+ public AutoConfigBundle<T> build() {
+ return new AutoConfigBundle<T>(packageNames);
+ }
+}
diff --git a/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/bundle/IOCApplication.java b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/bundle/IOCApplication.java
new file mode 100644
index 0000000..9465b8e
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/bundle/IOCApplication.java
@@ -0,0 +1,42 @@
+/**
+ * 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.dropwizard.ioc.bundle;
+
+import io.dropwizard.Application;
+import io.dropwizard.Configuration;
+import io.dropwizard.setup.Bootstrap;
+import io.dropwizard.setup.Environment;
+
+/**
+ * complete IOC container startup
+ *
+ * @author hu.rui2
+ *
+ */
+public abstract class IOCApplication<T extends Configuration> extends Application<T> {
+
+
+ @Override
+ public void initialize(Bootstrap<T> bootstrap) {
+ super.initialize(bootstrap);
+ bootstrap.addBundle(new AutoConfigBundleBuider().build());
+ }
+
+ @Override
+ public void run(T configuration, Environment environment) throws Exception {
+
+ }
+}
diff --git a/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/bundle/ServiceLocatorManaged.java b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/bundle/ServiceLocatorManaged.java
new file mode 100644
index 0000000..4d33021
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/bundle/ServiceLocatorManaged.java
@@ -0,0 +1,51 @@
+/**
+ * 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.dropwizard.ioc.bundle;
+
+import org.glassfish.hk2.api.ServiceLocator;
+
+import io.dropwizard.lifecycle.Managed;
+
+/**
+ * Life cycle management for IOC containers
+ * @author hu.rui
+ *
+ */
+public class ServiceLocatorManaged implements Managed{
+
+
+
+ private ServiceLocator locator;
+
+
+
+ public ServiceLocatorManaged(ServiceLocator locator) {
+ super();
+ this.locator = locator;
+ }
+
+ @Override
+ public void start() throws Exception {
+
+
+ }
+
+ @Override
+ public void stop() throws Exception {
+ locator.shutdown();
+ }
+
+}
diff --git a/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/utils/ServiceBinder.java b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/utils/ServiceBinder.java
new file mode 100644
index 0000000..9ad984f
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/utils/ServiceBinder.java
@@ -0,0 +1,52 @@
+/**
+ * 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.dropwizard.ioc.utils;
+
+import java.util.Set;
+
+import org.glassfish.hk2.utilities.binding.AbstractBinder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author hu.rui
+ *
+ */
+public class ServiceBinder extends AbstractBinder {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ServiceBinder.class);
+
+ final Set<Class<?>> klasses;
+
+ public ServiceBinder(Set<Class<?>> services) {
+ this.klasses = services;
+ }
+
+ @Override
+ protected void configure() {
+ for (Class<?> klass : this.klasses) {
+
+ try{
+ LOG.info("start active class:"+klass.getName());
+ addActiveDescriptor(klass);
+ }catch(Exception e){
+ LOG.info("active class error:"+klass.getName(),e);
+ }
+
+
+ }
+ }
+}
diff --git a/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/utils/ServiceLocatorHolder.java b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/utils/ServiceLocatorHolder.java
new file mode 100644
index 0000000..46dcd4b
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/main/java/org/openo/dropwizard/ioc/utils/ServiceLocatorHolder.java
@@ -0,0 +1,36 @@
+/**
+ * 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.dropwizard.ioc.utils;
+
+import org.glassfish.hk2.api.ServiceLocator;
+
+/**
+ * @author hu.rui
+ *
+ */
+public class ServiceLocatorHolder {
+
+ private static ServiceLocator locator;
+
+ public static ServiceLocator getLocator() {
+ return locator;
+ }
+
+ public static void setLocator(ServiceLocator locator) {
+ ServiceLocatorHolder.locator = locator;
+ }
+
+}
diff --git a/wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/IOCBundleTest.java b/wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/IOCBundleTest.java
new file mode 100644
index 0000000..b0cac65
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/IOCBundleTest.java
@@ -0,0 +1,49 @@
+/**
+ * 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.dropwizard.ioc.test.service;
+
+import org.glassfish.hk2.api.ServiceLocator;
+import org.junit.Before;
+import org.junit.Test;
+import org.openo.dropwizard.ioc.test.service.app.ExampleApp;
+import org.openo.dropwizard.ioc.utils.ServiceLocatorHolder;
+
+import junit.framework.Assert;
+
+public class IOCBundleTest {
+
+
+
+ @Before
+ public void setUp() throws Exception {
+ ExampleApp.main(null);
+ }
+
+ @Test
+ public void test() {
+
+ ServiceLocator locator = ServiceLocatorHolder.getLocator();
+
+ TestService testService = locator.getService(TestService.class);
+
+ Assert.assertNotNull(testService);
+
+ Assert.assertEquals(TestService.HELLO, testService.sayHello());
+
+ Assert.assertEquals(PreTestService.HELLO, testService.sayHelloToPreTestService());
+ }
+
+}
diff --git a/wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/PreTestService.java b/wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/PreTestService.java
new file mode 100644
index 0000000..51cc386
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/PreTestService.java
@@ -0,0 +1,33 @@
+/**
+ * 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.dropwizard.ioc.test.service;
+
+import org.openo.dropwizard.ioc.annotation.PreServiceLoad;
+
+/**
+ * @author hu.rui
+ *
+ */
+@PreServiceLoad
+public class PreTestService {
+
+ public static final String HELLO = "hello Pre Service";
+
+ public String sayHello(){
+ return HELLO;
+ }
+
+}
diff --git a/wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/TestService.java b/wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/TestService.java
new file mode 100644
index 0000000..3d0f945
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/TestService.java
@@ -0,0 +1,41 @@
+/**
+ * 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.dropwizard.ioc.test.service;
+
+import javax.inject.Inject;
+
+import org.jvnet.hk2.annotations.Service;
+
+/**
+ * @author hu.rui
+ *
+ */
+@Service
+public class TestService {
+
+ @Inject
+ private PreTestService preTestService;
+
+ public static final String HELLO = "hello Service";
+
+ public String sayHello(){
+ return HELLO;
+ }
+
+ public String sayHelloToPreTestService(){
+ return preTestService.sayHello();
+ }
+}
diff --git a/wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/app/ExampleApp.java b/wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/app/ExampleApp.java
new file mode 100644
index 0000000..1e1f3ea
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/app/ExampleApp.java
@@ -0,0 +1,35 @@
+/**
+ * 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.dropwizard.ioc.test.service.app;
+
+import org.openo.dropwizard.ioc.bundle.IOCApplication;
+import org.openo.dropwizard.ioc.test.service.conf.TestConfiguration;
+
+public class ExampleApp extends IOCApplication<TestConfiguration>{
+
+ private static final String CONFIGURATION_FILE = "example.yml";
+
+ public static void main(String[] args) throws Exception {
+
+ String configFile = ExampleApp.class.getClassLoader().getResource(CONFIGURATION_FILE).getFile();
+
+ args = new String[]{"server",configFile};
+
+ new ExampleApp().run(args);
+ }
+
+
+}
diff --git a/wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/conf/TestConfiguration.java b/wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/conf/TestConfiguration.java
new file mode 100644
index 0000000..82c30cd
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/test/java/org/openo/dropwizard/ioc/test/service/conf/TestConfiguration.java
@@ -0,0 +1,26 @@
+/**
+ * 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.dropwizard.ioc.test.service.conf;
+
+import io.dropwizard.Configuration;
+
+/**
+ * @author hu.rui
+ *
+ */
+public class TestConfiguration extends Configuration {
+
+}
diff --git a/wso2/dropwizard-ioc-container/src/test/resources/example.yml b/wso2/dropwizard-ioc-container/src/test/resources/example.yml
new file mode 100644
index 0000000..c3ef0f0
--- /dev/null
+++ b/wso2/dropwizard-ioc-container/src/test/resources/example.yml
@@ -0,0 +1,8 @@
+server:
+ type: simple
+ rootPath: '/service/*'
+ applicationContextPath: /
+ connector:
+ type: http
+ port: 45673
+ \ No newline at end of file
diff --git a/wso2/logging-sdk/pom.xml b/wso2/logging-sdk/pom.xml
new file mode 100644
index 0000000..c616c74
--- /dev/null
+++ b/wso2/logging-sdk/pom.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openo.common-services.common-utilities</groupId>
+ <artifactId>common-setting</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>logging-sdk</artifactId>
+ <name>common-services-common-utilities/logging-sdk</name>
+ <properties>
+ </properties>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>2.7.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.7.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.7.3</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>1.1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-access</artifactId>
+ <version>1.1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>net.logstash.logback</groupId>
+ <artifactId>logstash-logback-encoder</artifactId>
+ <version>4.8</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/wso2/logging-sdk/src/main/java/org/openo/log/api/LogMessage.java b/wso2/logging-sdk/src/main/java/org/openo/log/api/LogMessage.java
new file mode 100644
index 0000000..4a21584
--- /dev/null
+++ b/wso2/logging-sdk/src/main/java/org/openo/log/api/LogMessage.java
@@ -0,0 +1,132 @@
+/**
+ * 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.log.api;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.slf4j.Logger;
+
+import org.openo.log.impl.Facitility;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ *
+ * @author Huabing Zhao
+ *
+ */
+
+public class LogMessage implements Serializable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(LogMessage.class.getName());
+
+ protected long id = -1;
+
+
+ protected String detail = null;
+
+ protected String hostname = "";
+
+
+
+ private String logType = "";
+
+
+ protected HashMap<String, Object> extendedFields = null;
+
+ private HashMap<String, String> localeMap = null;
+
+
+
+ private static final long serialVersionUID = 200408041651009L;
+
+ public String getDetail() {
+ return detail;
+ }
+
+
+ public long getId() {
+ return id;
+ }
+
+ public String getHostname() {
+ return hostname;
+ }
+
+
+
+ public LogMessage() {}
+
+
+
+ public String getLogType() {
+ return logType;
+ }
+
+ public void setLogType(String logType) {
+ this.logType = logType;
+ }
+
+ public HashMap<String, Object> getExtendedFields() {
+ return extendedFields;
+ }
+
+ public void setExtendedFields(HashMap<String, Object> extendedFields) {
+ this.extendedFields = extendedFields;
+ }
+
+ public HashMap<String, String> getLocaleMap() {
+ return this.localeMap;
+ }
+
+ public void setLocalMap(HashMap<String, String> localeMap) {
+ this.localeMap = localeMap;
+ }
+
+ protected void set(String condName, Object condValue) {
+ if (condValue != null && !"".equals(condValue)) {
+ if (localeMap == null) {
+ localeMap = new HashMap<String, String>();
+ }
+ localeMap.put(condName, condValue.toString());
+
+ }
+ }
+
+
+ protected void setLocale(String condName, String condValue) {
+
+ if (condValue != null && !"".equals(condValue)) {
+ if (localeMap == null) {
+ localeMap = new HashMap<String, String>();
+ }
+
+
+
+ Map<String, String> mapJson = Facitility.readJson2Map(condValue);
+ for (Entry<String, String> entry : mapJson.entrySet()) {
+ String key = entry.getKey();
+
+ String value = entry.getValue().replace("\"", "\'");
+ localeMap.put(condName + "_" + key, value);
+ }
+ }
+
+ }
+
+
+}
diff --git a/wso2/logging-sdk/src/main/java/org/openo/log/api/LogService.java b/wso2/logging-sdk/src/main/java/org/openo/log/api/LogService.java
new file mode 100644
index 0000000..a25e10a
--- /dev/null
+++ b/wso2/logging-sdk/src/main/java/org/openo/log/api/LogService.java
@@ -0,0 +1,140 @@
+/**
+ * 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.log.api;
+
+import org.openo.log.impl.InsertLogHandler;
+import org.openo.log.impl.LogConst;
+import org.openo.log.impl.LogIdTool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LogService {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(LogService.class.getName());
+
+
+ public static final String OPERLOG_SUCCESS = "log_success";
+
+ public static final String OPERLOG_ERROR = "log_fail";
+
+
+ public static final String OPERLOG_RANK_NORMAL = "operlog_rank_normal";
+
+ public static final String OPERLOG_RANK_NOTICE = "operlog_rank_notice";
+
+ public static final String OPERLOG_RANK_IMPORTANT = "operlog_rank_important";
+
+ public static final String OPERLOG_RANK_VERYIMPORTANT = " operlog_rank_veryimportant";
+
+
+ public static final String SYSLOG_RANK_INFORM = "syslog_rank_inform";
+
+ public static final String SYSLOG_RANK_NOTICE = "syslog_rank_notice";
+
+
+ public static final String SYSLOG_RANK_WARN = "syslog_rank_warn";
+
+ public static final String SYSLOG_RANK_ERROR = "syslog_rank_error";
+
+
+ public static final String SYSLOG_RANK_ALERT = "syslog_rank_alert";
+
+
+ public static final String SYSLOG_RANK_EMERG = "syslog_rank_emerg";
+
+
+ public static final String CONNECT_TYPE_WEB = "WEB";
+
+ public static final String CONNECT_TYPE_TELNET = "TELNET";
+
+ public static final String CONNECT_TYPE_SSH = "SSH";
+
+ public static final String CONNECT_TYPE_EM = "EM";
+
+ public static final short LOG_DISPLAY_NOT = 0;
+
+ public static final short LOG_DISPLAY = 1;
+
+ public static final int LOG_ROOT_LINK_ID = -1;
+
+ private static final int LOG_NO_LINK_ID = 0;
+
+ private static LogService recordLogHandler = null;
+
+ public static LogService getInstance() {
+ if (recordLogHandler == null) {
+ recordLogHandler = new LogService();
+ }
+ return recordLogHandler;
+ }
+
+ public long recordOperLog(OperLogMessage logMessage) {
+ // TODO Auto-generated method stub
+ LOGGER.info("receive a insert operLog message");
+ InsertLogHandler insertLogHandler = new InsertLogHandler();
+ if (insertLogHandler.checkCmdLog((OperLogMessage) logMessage)) {
+
+ long id =
+ LogIdTool.getRandomID(LogConst.CMD_LOG_FLAG, logMessage.getLogStartDate().getTime());
+ logMessage.setId(id);
+ insertLogHandler.insertLog(logMessage, LogConst.AUDITLOG_OPERATION, LogConst.OPERLOG_TYPE);
+
+ return logMessage.getId();
+ }
+
+ return 0;
+ }
+
+ public long recordSecLog(SecLogMessage logMessage) {
+ // TODO Auto-generated method stub
+ //LOGGER.info("receive a insert sec log message");
+ InsertLogHandler insertLogHandler = new InsertLogHandler();
+ if (insertLogHandler.checkSecLog((SecLogMessage) logMessage)) {
+
+ long id = LogIdTool.getRandomID(LogConst.SECRET_LOG_FLAG, logMessage.getLogDate().getTime());
+ logMessage.setId(id);
+
+ insertLogHandler.insertLog(logMessage, LogConst.AUDITLOG_SECURITY, LogConst.SERLOG_TYPE);
+
+ return logMessage.getId();
+ }
+ return 0;
+ }
+
+
+
+ public long recordSysLog(SysLogMessage logMessage) {
+ //LOGGER.info("receive a insert sys log message");
+ InsertLogHandler insertLogHandler = new InsertLogHandler();
+ if (insertLogHandler.checkSysLog((SysLogMessage) logMessage)) {
+
+ long id =
+ LogIdTool.getRandomID(LogConst.SYS_LOG_FLAG, logMessage.getLogStartDate().getTime());
+ logMessage.setId(id);
+ insertLogHandler.insertLog(logMessage, LogConst.AUDITLOG_SYSTEM, LogConst.SYSLOG_TYPE);
+ return logMessage.getId();
+ }
+ return 0;
+ }
+
+ public static void main(String[] args)
+ {
+ LogService service = new LogService();
+ OperLogMessage logMessage = new OperLogMessage();
+
+ service.recordOperLog(logMessage );
+ }
+}
diff --git a/wso2/logging-sdk/src/main/java/org/openo/log/api/OperLogMessage.java b/wso2/logging-sdk/src/main/java/org/openo/log/api/OperLogMessage.java
new file mode 100644
index 0000000..567cfd0
--- /dev/null
+++ b/wso2/logging-sdk/src/main/java/org/openo/log/api/OperLogMessage.java
@@ -0,0 +1,286 @@
+/**
+ * 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.log.api;
+
+import java.util.Date;
+
+import org.openo.log.impl.Facitility;
+import org.openo.log.impl.LogConst;
+
+
+
+public class OperLogMessage extends LogMessage {
+ private static final long serialVersionUID = 200408041704009L;
+
+
+ public OperLogMessage() {
+ super();
+ this.setLogType(LogConst.OPERLOG_TYPE);
+ }
+
+
+ public OperLogMessage(String userName, String operation, String descriptionInfo, String hostname,
+ String operateResult, String rank, Date logStartDate, Date logEndDate, String detail) {
+ super();
+ this.setLogType(LogConst.OPERLOG_TYPE);
+
+ this.userName = userName;
+ this.set("userName", userName);
+
+ this.descriptionInfo = descriptionInfo;
+ this.setLocale("descriptionInfo", descriptionInfo);
+
+ this.operation = operation;
+ this.setLocale("operation", operation);
+
+ this.logStartDate = logStartDate;
+ this.set("logStartDate", Facitility.dateFormat(logStartDate));
+
+ this.logEndDate = logEndDate;
+ this.set("logEndDate", Facitility.dateFormat(logEndDate));
+
+ this.hostname = hostname;
+ this.set("hostname", hostname);
+
+ this.operateResult = operateResult;
+ this.set("operateResult", operateResult);
+
+ this.rank = rank;
+ this.set("rank", rank);
+
+ this.detail = detail;
+ this.setLocale("detail", detail);
+ }
+
+
+ protected String userName = "";
+
+
+ protected String operation = null;
+
+
+ protected String descriptionInfo = null;
+
+
+ private String operationType = "other";
+
+ protected String failReason = null;
+
+
+ protected String operateResult = LogService.OPERLOG_SUCCESS;
+
+
+ protected String connectMode = LogService.CONNECT_TYPE_WEB;
+
+
+ protected String[] resourceIP;
+
+
+ protected Date logStartDate = null;
+
+
+ protected Date logEndDate = null;
+
+
+ protected long linkId = -100;
+
+ protected int isDisplay = LogService.LOG_DISPLAY;
+
+ protected String mac = "";
+
+ /**
+ * name(id)|name(id)
+ */
+ private String[] operateResource = null;
+
+
+ protected String rank = LogService.OPERLOG_RANK_NORMAL;
+
+ public String getMac() {
+ return mac;
+ }
+
+ public OperLogMessage setMac(String mac) {
+ this.set("mac", mac);
+ this.mac = mac;
+ return this;
+ }
+
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public OperLogMessage setUserName(String name) {
+ this.userName = name;
+ this.set("userName", name);
+ return this;
+ }
+
+ public String getFailReason() {
+ return failReason;
+ }
+
+ public OperLogMessage setFailReason(String reason) {
+ this.setLocale("failReason", reason);
+ this.failReason = reason;
+ return this;
+ }
+
+ public String getConnectMode() {
+ return connectMode;
+
+ }
+
+ public OperLogMessage setConnectMode(String mode) {
+ this.set("connectMode", mode);
+ this.connectMode = mode;
+ return this;
+ }
+
+ public long getLinkId() {
+ return linkId;
+ }
+
+ public OperLogMessage setLinkId(long linkId) {
+ this.set("linkId", linkId);
+ this.linkId = linkId;
+ return this;
+ }
+
+ public String getOperateResult() {
+ return operateResult;
+ }
+
+ public OperLogMessage setOperateResult(String operateResult) {
+ this.set("operateResult", operateResult);
+ this.operateResult = operateResult;
+ return this;
+ }
+
+ public String getRank() {
+ return rank;
+ }
+
+ public OperLogMessage setRank(String rank) {
+ this.set("rank", rank);
+ this.rank = rank;
+ return this;
+ }
+
+ public String getDescriptionInfo() {
+ return descriptionInfo;
+ }
+
+ public OperLogMessage setDescriptionInfo(String desc) {
+ this.setLocale("descriptionInfo", desc);
+ descriptionInfo = desc;
+ return this;
+ }
+
+ public String getOperation() {
+ return operation;
+ }
+
+ public OperLogMessage setOperation(String operation) {
+ this.setLocale("operation", operation);
+ this.operation = operation;
+ return this;
+ }
+
+ public String[] getResourceIP() {
+ return resourceIP;
+ }
+
+ public OperLogMessage setResourceIP(String[] resourceIP) {
+ this.set("resourceIP", resourceIP);
+ this.resourceIP = resourceIP;
+ return this;
+ }
+
+ public Date getLogStartDate() {
+ return logStartDate;
+ }
+
+ public OperLogMessage setLogStartDate(Date logStartDate) {
+ this.set("logStartDate", Facitility.dateFormat(logStartDate));
+ this.logStartDate = logStartDate;
+ return this;
+ }
+
+ public Date getLogEndDate() {
+ return logEndDate;
+ }
+
+ public OperLogMessage setLogEndDate(Date logEndDate) {
+ this.set("logEndDate", Facitility.dateFormat(logEndDate));
+ this.logEndDate = logEndDate;
+ return this;
+ }
+
+ public int getIsDisplay() {
+ return isDisplay;
+ }
+
+ public OperLogMessage setIsDisplay(int isDisplay) {
+ this.set("isDisplay", isDisplay);
+ this.isDisplay = isDisplay;
+ return this;
+ }
+
+ public String[] getOperateResource() {
+ return operateResource;
+ }
+
+ public OperLogMessage setOperateResource(String[] operateResource) {
+ this.set("operateResource", operateResource);
+ this.operateResource = operateResource;
+ return this;
+ }
+
+ public String getOperationType() {
+ return operationType;
+ }
+
+ public OperLogMessage setOperationType(String operationType) {
+
+ this.operationType = operationType;
+ return this;
+ }
+
+
+
+ public OperLogMessage setHostname(String hostname) {
+ this.set("hostname", hostname);
+ this.hostname = hostname;
+ return this;
+ }
+
+
+ public LogMessage setId(long id) {
+ this.set("id", id);
+ this.id = id;
+ return this;
+ }
+
+
+ public LogMessage setDetail(String detail) {
+ this.detail = detail;
+ this.setLocale("detail", detail);
+ return this;
+ }
+
+}
diff --git a/wso2/logging-sdk/src/main/java/org/openo/log/api/SecLogMessage.java b/wso2/logging-sdk/src/main/java/org/openo/log/api/SecLogMessage.java
new file mode 100644
index 0000000..7eafbf7
--- /dev/null
+++ b/wso2/logging-sdk/src/main/java/org/openo/log/api/SecLogMessage.java
@@ -0,0 +1,146 @@
+/**
+ * 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.log.api;
+
+import java.util.Date;
+
+import org.openo.log.impl.Facitility;
+import org.openo.log.impl.LogConst;
+
+public class SecLogMessage extends LogMessage {
+
+ private static final long serialVersionUID = 201603100924009L;
+
+
+ public SecLogMessage() {
+ super();
+ this.setLogType(LogConst.SERLOG_TYPE);
+ }
+
+
+ public SecLogMessage(String userName, String hostname, String detail, String logName,
+ Date logDate) {
+ super();
+ this.setLogType(LogConst.SERLOG_TYPE);
+
+ this.userName = userName;
+ this.set("userName", userName);
+
+ this.hostname = hostname;
+ this.set("hostname", hostname);
+
+ this.logName = logName;
+ this.setLocale("logName", logName);
+
+ this.detail = detail;
+ this.setLocale("detail", detail);
+
+ this.logDate = logDate;
+ this.set("logDate", Facitility.dateFormat(logDate));
+ }
+
+ protected String userName = "";
+
+
+ protected String logName = null;
+
+
+ protected String connectMode = "";
+
+
+ protected String systemID = "";
+
+ protected String mac = "";
+
+ public String getMac() {
+ return mac;
+ }
+
+ public SecLogMessage setMac(String mac) {
+ this.set("mac", mac);
+ this.mac = mac;
+ return this;
+ }
+
+
+ protected Date logDate = null;
+
+
+ public String getUserName() {
+
+ return userName;
+ }
+
+
+ public SecLogMessage setUserName(String userName) {
+ this.set("userName", userName);
+ this.userName = userName;
+ return this;
+ }
+
+
+ public String getConnectMode() {
+ return connectMode;
+ }
+
+
+ public SecLogMessage setConnectMode(String connectMode) {
+ this.set("connectMode", connectMode);
+ this.connectMode = connectMode;
+ return this;
+ }
+
+ public String getLogName() {
+ return logName;
+ }
+
+ public SecLogMessage setLogName(String logName) {
+ this.setLocale("logName", logName);
+ this.logName = logName;
+ return this;
+ }
+
+ public Date getLogDate() {
+ return logDate;
+ }
+
+ public SecLogMessage setLogDate(Date logDate) {
+ this.set("logDate", Facitility.dateFormat(logDate));
+ this.logDate = logDate;
+ return this;
+ }
+
+ public SecLogMessage setHostname(String hostname) {
+ this.set("hostname", hostname);
+ this.hostname = hostname;
+ return this;
+ }
+
+
+ public SecLogMessage setId(long id) {
+ this.set("id", id);
+ this.id = id;
+ return this;
+ }
+
+
+ public SecLogMessage setDetail(String detail) {
+ this.detail = detail;
+ this.setLocale("detail", detail);
+ return this;
+ }
+
+}
diff --git a/wso2/logging-sdk/src/main/java/org/openo/log/api/SysLogMessage.java b/wso2/logging-sdk/src/main/java/org/openo/log/api/SysLogMessage.java
new file mode 100644
index 0000000..5b1a6d9
--- /dev/null
+++ b/wso2/logging-sdk/src/main/java/org/openo/log/api/SysLogMessage.java
@@ -0,0 +1,180 @@
+/**
+ * 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.log.api;
+
+import java.util.Date;
+
+import org.openo.log.impl.Facitility;
+import org.openo.log.impl.LogConst;
+
+
+public class SysLogMessage extends LogMessage {
+ private static final long serialVersionUID = 200408041707009L;
+
+
+ protected String rank = LogService.SYSLOG_RANK_INFORM;
+
+ protected String source = null;
+
+ protected String sourceId = "";
+
+ protected String logName = null;
+
+
+ protected Date logStartDate = null;
+
+ protected Date logEndDate = null;
+
+ protected int isDisplay = LogService.LOG_DISPLAY;
+
+ protected long linkId = -100;
+
+
+ public SysLogMessage() {
+ super();
+ this.setLogType(LogConst.SYSLOG_TYPE);
+ }
+
+
+ public SysLogMessage(String logName, String hostname, String rank, String detail,
+ Date logStartDate, Date logEndDate) {
+ super();
+ this.setLogType(LogConst.SYSLOG_TYPE);
+
+ this.logName = logName;
+ this.set("logName", logName);
+
+ this.rank = rank;
+ this.set("rank", rank);
+
+ this.hostname = hostname;
+ this.set("hostname", hostname);
+
+ this.detail = detail;
+ this.set("detail", detail);
+
+ this.logStartDate = logStartDate;
+ this.set("logStartDate", Facitility.dateFormat(logStartDate));
+
+ this.logEndDate = logEndDate;
+ this.set("logEndDate", Facitility.dateFormat(logEndDate));
+ }
+
+ public Date getLogStartDate() {
+ return logStartDate;
+ }
+
+ public SysLogMessage setLogStartDate(Date logStartDate) {
+ this.set("logStartDate", Facitility.dateFormat(logStartDate));
+ this.logStartDate = logStartDate;
+ return this;
+ }
+
+ public Date getLogEndDate() {
+ return logEndDate;
+ }
+
+ public SysLogMessage setLogEndDate(Date logEndDate) {
+ this.set("logEndDate", Facitility.dateFormat(logEndDate));
+ this.logEndDate = logEndDate;
+ return this;
+ }
+
+ public String getRank() {
+ return rank;
+ }
+
+ public SysLogMessage setRank(String rank) {
+ this.set("rank", rank);
+ this.rank = rank;
+ return this;
+ }
+
+ public String getLogName() {
+ return logName;
+ }
+
+ public SysLogMessage setLogName(String logName) {
+ this.setLocale("logName", logName);
+ this.logName = logName;
+ return this;
+ }
+
+
+ public final String getSource() {
+ return source;
+ }
+
+
+ public SysLogMessage setSource(String source) {
+ this.setLocale("source", source);
+ this.source = source;
+ return this;
+ }
+
+ public int getIsDisplay() {
+ return isDisplay;
+ }
+
+ public SysLogMessage setIsDisplay(int isDisplay) {
+ this.set("isDisplay", isDisplay);
+ this.isDisplay = isDisplay;
+ return this;
+ }
+
+ public long getLinkId() {
+ return linkId;
+ }
+
+ public String getSourceId() {
+ return sourceId;
+ }
+
+ public SysLogMessage setSourceId(String sourceId) {
+ this.set("sourceId", sourceId);
+ this.sourceId = sourceId;
+ return this;
+ }
+
+ public SysLogMessage setLinkId(long linkId) {
+ this.set("linkId", linkId);
+ this.linkId = linkId;
+ return this;
+ }
+
+ public SysLogMessage setHostname(String hostname) {
+ this.set("hostname", hostname);
+ this.hostname = hostname;
+ return this;
+ }
+
+
+ public SysLogMessage setId(long id) {
+ this.set("id", id);
+ this.id = id;
+ return this;
+ }
+
+
+ public SysLogMessage setDetail(String detail) {
+ this.detail = detail;
+ this.setLocale("detail", detail);
+ return this;
+ }
+
+
+
+}
diff --git a/wso2/logging-sdk/src/main/java/org/openo/log/impl/Facitility.java b/wso2/logging-sdk/src/main/java/org/openo/log/impl/Facitility.java
new file mode 100644
index 0000000..82445bb
--- /dev/null
+++ b/wso2/logging-sdk/src/main/java/org/openo/log/impl/Facitility.java
@@ -0,0 +1,137 @@
+/**
+ * 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.log.impl;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class Facitility {
+ private static final Logger LOGGER = LoggerFactory.getLogger(Facitility.class.getName());
+
+ private Facitility() {
+
+ }
+
+ public static String oToJ(Object o) {
+ ObjectMapper om = new ObjectMapper();
+ Writer w = new StringWriter();
+ String json = null;
+ try {
+
+ om.setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"));
+ om.writeValue(w, o);
+ json = w.toString();
+ w.close();
+ } catch (IOException e) {
+ LOGGER.error("IOException", e);
+ }
+ return json;
+ }
+
+ public static Map<String, String> readJson2Map(String json) {
+ ObjectMapper objectMapper = new ObjectMapper();
+ try {
+ Map<String, String> maps = objectMapper.readValue(json, Map.class);
+ return maps;
+ } catch (Exception e) {
+ LOGGER.error("IOException", e);
+ return null;
+ }
+ }
+
+ public static String hashMapToJson(HashMap<String, String> map) {
+ String string = "{";
+ for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
+ Entry e = (Entry) it.next();
+ string += "\"" + e.getKey() + "\":";
+ string += "\"" + e.getValue() + "\",";
+ }
+ string = string.substring(0, string.lastIndexOf(","));
+ string += "}";
+ return string;
+ }
+
+ public static String dateFormat(Date date) {
+ SimpleDateFormat time = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
+ return time.format(date);
+ }
+
+ public static String checkRequiredParam(HashMap<String, Object> checkParamsMap) {
+ StringBuilder errMsg = new StringBuilder();
+ java.util.Iterator<String> hashMapIt = checkParamsMap.keySet().iterator();
+ int count = 0;
+ while (hashMapIt.hasNext()) {
+ String key = hashMapIt.next();
+ Object value = checkParamsMap.get(key);
+ if (value == null || "".equals(value)) {
+ errMsg.append(key);
+ count++;
+ if (count < checkParamsMap.size() - 1) {
+ errMsg.append(" and ");
+ }
+ }
+
+ }
+ if (count > 0) {
+ errMsg.append(" can't be null or \"\"!\n ");
+ }
+ return errMsg.toString();
+ }
+
+ public static String checkRequiredJsonParam(String jsonParam, String key) {
+ return "";
+// StringBuilder errMsg = new StringBuilder();
+// try {
+// ObjectMapper mapper = new ObjectMapper();
+// JsonNode jsonValue;
+//
+//
+// jsonValue = mapper.readTree(jsonParam.toString());
+// Iterator<Entry<String, JsonNode>> elements = jsonValue.fields();
+// while (elements.hasNext()) {
+// Entry<String, JsonNode> node = elements.next();
+// String childValue = node.getValue().asText();
+// if (childValue == null || "".equals(childValue)) {
+// errMsg.append(
+// "Both Chinese and English descriptions of this field cannot be empty: " + key + "/n");
+// break;
+// }
+// }
+//
+// return errMsg.toString();
+// } catch (JsonProcessingException e) {
+// // TODO Auto-generated catch block
+// LOGGER.error("JsonProcessingException" , e);
+// return errMsg.toString();
+// } catch (IOException e) {
+// // TODO Auto-generated catch block
+// LOGGER.error("IOException" , e);
+// return errMsg.toString();
+// }
+ }
+}
diff --git a/wso2/logging-sdk/src/main/java/org/openo/log/impl/InsertLogHandler.java b/wso2/logging-sdk/src/main/java/org/openo/log/impl/InsertLogHandler.java
new file mode 100644
index 0000000..ea5570f
--- /dev/null
+++ b/wso2/logging-sdk/src/main/java/org/openo/log/impl/InsertLogHandler.java
@@ -0,0 +1,265 @@
+/**
+ * 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.log.impl;
+
+import java.util.HashMap;
+import org.slf4j.Logger;
+
+import org.openo.log.api.LogMessage;
+import org.openo.log.api.LogService;
+import org.openo.log.api.OperLogMessage;
+import org.openo.log.api.SecLogMessage;
+import org.openo.log.api.SysLogMessage;
+import org.slf4j.LoggerFactory;
+
+
+
+public class InsertLogHandler {
+ private static final Logger LOGGER = LoggerFactory.getLogger(InsertLogHandler.class.getName());
+
+ public void insertLog(LogMessage msg, String logIndex, String logType) {
+ String logJson = Facitility.hashMapToJson(msg.getLocaleMap());
+ msg.setLocalMap(null);
+
+ if (msg.getExtendedFields() != null) {
+ String exendedFieldsJson = Facitility.oToJ(msg.getExtendedFields());
+ logJson = logJson.substring(0, logJson.lastIndexOf("}")) + ","
+ + exendedFieldsJson.substring(1) + "\n";
+ msg.setExtendedFields(null);
+ }
+ LOGGER.info(logJson, logIndex, logType);
+
+
+ }
+
+ public boolean checkCmdLog(OperLogMessage msg) {
+ StringBuilder errMsg = new StringBuilder();
+ boolean errFlag = false;
+ HashMap<String, Object> checkParamsMap = new HashMap<>();
+ checkParamsMap.put("userName", msg.getUserName());
+ checkParamsMap.put("operation", msg.getOperation());
+ checkParamsMap.put("descriptionInfo", msg.getDescriptionInfo());
+ checkParamsMap.put("hostname", msg.getHostname());
+ checkParamsMap.put("detail", msg.getDetail());
+ checkParamsMap.put("logStartDate", msg.getLogStartDate());
+ checkParamsMap.put("logEndDate", msg.getLogEndDate());
+ errMsg.append(Facitility.checkRequiredParam(checkParamsMap));
+
+
+ errMsg.append(checkCmdRank(msg.getRank()));
+ errMsg.append(checkConnectMode(msg.getConnectMode()));
+ errMsg.append(checkOperateResult(msg.getOperateResult()));
+ errMsg.append(checkIsDisplay(msg.getIsDisplay()));
+
+ if (msg.getOperation() != null && !("").equals(msg.getOperation())) {
+ errMsg.append(Facitility.checkRequiredJsonParam(msg.getOperation(), "operation"));
+ }
+ if (msg.getDescriptionInfo() != null && !("").equals(msg.getDescriptionInfo())) {
+ errMsg.append(Facitility.checkRequiredJsonParam(msg.getDescriptionInfo(), "descriptionInfo"));
+ }
+ if (msg.getDetail() != null && !("").equals(msg.getDetail())) {
+ errMsg.append(Facitility.checkRequiredJsonParam(msg.getDetail(), "detail"));
+ }
+ if (msg.getFailReason() != null && !("").equals(msg.getFailReason())) {
+ errMsg.append(Facitility.checkRequiredJsonParam(msg.getFailReason(), "failReason"));
+ }
+ if (!"".equals(errMsg.toString())) {
+ LOGGER.warn(errMsg.toString());
+ printCmdLog(msg);
+ errFlag = true;
+ }
+ return !errFlag;
+ }
+
+ private String checkIsDisplay(int isDisplay) {
+ StringBuilder errMsg = new StringBuilder();
+ if (isDisplay != LogService.LOG_DISPLAY && isDisplay != LogService.LOG_DISPLAY_NOT) {
+ errMsg.append("isDisplay must be 'LogService.LOG_DISPLAY'");
+ errMsg.append(" or 'LogService.LOG_DISPLAY_NOT'\n");
+
+ }
+ return errMsg.toString();
+ }
+
+ private String checkOperateResult(String operateResult) {
+ StringBuilder errMsg = new StringBuilder();
+ if ((operateResult != LogService.OPERLOG_SUCCESS)
+ && (operateResult != LogService.OPERLOG_ERROR)) {
+ errMsg.append("operateResult must be ' LogService.OPERLOG_ERROR'");
+ errMsg.append(" or 'LogService.OPERLOG_SUCCESS'\n");
+
+ }
+ return errMsg.toString();
+ }
+
+ private String checkConnectMode(String connectMode) {
+ StringBuilder errMsg = new StringBuilder();
+ if (!(connectMode.equals(LogService.CONNECT_TYPE_WEB)
+ || connectMode.equals(LogService.CONNECT_TYPE_TELNET)
+ || connectMode.equals(LogService.CONNECT_TYPE_SSH)
+ || connectMode.equals(LogService.CONNECT_TYPE_EM))) {
+ errMsg.append("connectMode must be 'LogService.CONNECT_TYPE_WEB'");
+ errMsg.append(" or 'LogService.CONNECT_TYPE_TELNET'");
+ errMsg.append(" or 'LogService.CONNECT_TYPE_SSH'");
+ errMsg.append(" or 'LogService.CONNECT_TYPE_EM'\n");
+
+ }
+
+ return errMsg.toString();
+ }
+
+ private String checkCmdRank(String rank) {
+ StringBuilder errMsg = new StringBuilder();
+ boolean isExist = false;
+ String[] ranks = {LogService.OPERLOG_RANK_NOTICE, LogService.OPERLOG_RANK_NORMAL,
+ LogService.OPERLOG_RANK_IMPORTANT, LogService.OPERLOG_RANK_VERYIMPORTANT};
+ for (int i = 0; i < ranks.length; i++) {
+ if (rank.equalsIgnoreCase(ranks[i])) {
+ isExist = true;
+ break;
+ }
+ }
+ if (!isExist) {
+ errMsg.append("rank must be 'LogService.OPERLOG_RANK_NORMAL'");
+ errMsg.append(" or 'LogService.OPERLOG_RANK_NOTICE'");
+ errMsg.append(" or 'LogService.OPERLOG_RANK_IMPORTANT'");
+ errMsg.append(" or 'LogService.OPERLOG_RANK_VERYIMPORTANT'\n");
+
+ }
+
+ return errMsg.toString();
+ }
+
+ public void printCmdLog(OperLogMessage msg) {
+ LOGGER.warn("CMD Log Error Detail msg");
+ LOGGER.warn("UserName :" + msg.getUserName());
+ LOGGER.warn("operation :" + msg.getOperation());
+ LOGGER.warn("hostname :" + msg.getHostname());
+ LOGGER.warn("descriptionInfo :" + msg.getDescriptionInfo());
+ LOGGER.warn("operateResult :" + msg.getOperateResult());
+ LOGGER.warn("FailReason :" + msg.getFailReason());
+ LOGGER.warn("detail :" + msg.getDetail());
+ LOGGER.warn("ConnectMode:" + msg.getConnectMode());
+ LOGGER.warn("OperateResource :" + msg.getOperateResource());
+ LOGGER.warn("logStartDate :" + msg.getOperateResource());
+ LOGGER.warn("logEndDate :" + msg.getLogEndDate());
+ LOGGER.warn("Rank :" + msg.getRank());
+ }
+
+ /**
+ * 检查日志�数是�符��求
+ *
+ * @return true
+ */
+ public boolean checkSecLog(SecLogMessage msg) {
+ StringBuilder errMsg = new StringBuilder();
+ boolean errFlag = false;
+ HashMap<String, Object> checkParamsMap = new HashMap<>();
+ checkParamsMap.put("userName", msg.getUserName());
+ checkParamsMap.put("logName", msg.getLogName());
+ checkParamsMap.put("hostname", msg.getHostname());
+ checkParamsMap.put("detail", msg.getDetail());
+ checkParamsMap.put("logDate", msg.getLogDate());
+ errMsg.append(Facitility.checkRequiredParam(checkParamsMap));
+ errMsg.append(checkConnectMode(msg.getConnectMode()));
+
+ if (msg.getLogName() != null && !("").equals(msg.getLogName())) {
+ errMsg.append(Facitility.checkRequiredJsonParam(msg.getLogName(), "logName"));
+ }
+ if (msg.getDetail() != null && !("").equals(msg.getDetail())) {
+ errMsg.append(Facitility.checkRequiredJsonParam(msg.getDetail(), "detail"));
+ }
+ if (!"".equals(errMsg.toString())) {
+ LOGGER.warn(errMsg.toString());
+ this.printSecLog(msg);
+ errFlag = true;
+ }
+ return !errFlag;
+ }
+
+ public void printSecLog(SecLogMessage secLog) {
+ LOGGER.warn("SCRT Log Error Detail msg");
+ LOGGER.warn("logDate :" + secLog.getLogDate());
+ LOGGER.warn("logName :" + secLog.getLogName());
+ LOGGER.warn("userName :" + secLog.getUserName());
+ LOGGER.warn("hostname :" + secLog.getHostname());
+ LOGGER.warn("connectMode:" + secLog.getConnectMode());
+ LOGGER.warn("detail :" + secLog.getDetail());
+ }
+
+ public boolean checkSysLog(SysLogMessage msg) {
+ StringBuilder errMsg = new StringBuilder();
+ boolean errFlag = false;
+ HashMap<String, Object> checkParamsMap = new HashMap<>();
+
+ checkParamsMap.put("logName", msg.getLogName());
+ checkParamsMap.put("logStartDate", msg.getLogStartDate());
+ checkParamsMap.put("logEndDate", msg.getLogEndDate());
+ checkParamsMap.put("hostname", msg.getHostname());
+ checkParamsMap.put("detail", msg.getDetail());
+ errMsg.append(Facitility.checkRequiredParam(checkParamsMap));
+ errMsg.append(checkSysRank(msg.getRank()));
+ if (msg.getLogName() != null && !("").equals(msg.getLogName())) {
+ errMsg.append(Facitility.checkRequiredJsonParam(msg.getLogName(), "logName"));
+ }
+ if (msg.getDetail() != null && !("").equals(msg.getDetail())) {
+ errMsg.append(Facitility.checkRequiredJsonParam(msg.getDetail(), "detail"));
+ }
+ if (!"".equals(errMsg.toString())) {
+ LOGGER.warn(errMsg.toString());
+ printSysLog(msg);
+ errFlag = true;
+ }
+ return !errFlag;
+ }
+
+ private String checkSysRank(String rank) {
+ StringBuilder errMsg = new StringBuilder();
+ boolean isExist = false;
+ String[] ranks = {LogService.SYSLOG_RANK_INFORM, LogService.SYSLOG_RANK_NOTICE,
+ LogService.SYSLOG_RANK_WARN, LogService.SYSLOG_RANK_ERROR, LogService.SYSLOG_RANK_ALERT,
+ LogService.SYSLOG_RANK_EMERG};
+ for (int i = 0; i < ranks.length; i++) {
+ if (rank.equalsIgnoreCase(ranks[i])) {
+ isExist = true;
+ break;
+ }
+ }
+ if (!isExist) {
+ errMsg.append("rank must be 'LogService.SYSLOG_INFORM'");
+ errMsg.append(" or 'LogService.SYSLOG_NOTICE'");
+ errMsg.append(" or 'LogService.SYSLOG_WARN'");
+ errMsg.append(" or 'LogService.SYSLOG_ERROR'");
+ errMsg.append(" or 'LogService.SYSLOG_ALTERT'");
+ errMsg.append(" or 'LogService.SYSLOG_EMERG'\n");
+
+ }
+
+ return errMsg.toString();
+ }
+
+ public void printSysLog(SysLogMessage msg) {
+ LOGGER.warn("System Log Error Detail msg");
+ LOGGER.warn("logName :" + msg.getLogName());
+ LOGGER.warn("rank :" + msg.getRank());
+ LOGGER.warn("source :" + msg.getSource());
+ LOGGER.warn("logStartDate :" + msg.getLogStartDate());
+ LOGGER.warn("logEndDate :" + msg.getLogEndDate());
+ LOGGER.warn("detail :" + msg.getDetail());
+ }
+
+}
+
diff --git a/wso2/logging-sdk/src/main/java/org/openo/log/impl/LogConst.java b/wso2/logging-sdk/src/main/java/org/openo/log/impl/LogConst.java
new file mode 100644
index 0000000..1e45313
--- /dev/null
+++ b/wso2/logging-sdk/src/main/java/org/openo/log/impl/LogConst.java
@@ -0,0 +1,37 @@
+/**
+ * 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.log.impl;
+
+public class LogConst {
+ private LogConst() {
+
+ }
+
+ public final static int CMD_LOG_FLAG = 1;
+ public final static int SYS_LOG_FLAG = 2;
+ public final static int SECRET_LOG_FLAG = 3;
+
+ public final static String AUDITLOG_OPERATION = "auditlog_operation";
+ public final static String AUDITLOG_SECURITY = "auditlog_security";
+ public final static String AUDITLOG_SYSTEM = "auditlog_system";
+
+ public final static String OPERLOG_TYPE = "operlog";
+ public final static String SERLOG_TYPE = "seclog";
+ public final static String SYSLOG_TYPE = "syslog";
+
+
+
+}
diff --git a/wso2/logging-sdk/src/main/java/org/openo/log/impl/LogIdTool.java b/wso2/logging-sdk/src/main/java/org/openo/log/impl/LogIdTool.java
new file mode 100644
index 0000000..4dea43b
--- /dev/null
+++ b/wso2/logging-sdk/src/main/java/org/openo/log/impl/LogIdTool.java
@@ -0,0 +1,67 @@
+/**
+ * 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.log.impl;
+
+import java.util.Date;
+import java.util.Random;
+
+
+
+public class LogIdTool {
+ private static Random cmdRand = new Random();
+
+ private static Random sysRand = new Random();
+
+ private static Random secRand = new Random();
+
+ private LogIdTool() {
+
+ }
+
+ public static long getRandomID(int logType, long startDate) {
+ String strCtime = "" + startDate;
+ if (strCtime.length() > 13) {
+ strCtime = strCtime.substring(strCtime.length() - 13);
+ }
+ int seed1;
+ if (logType == LogConst.CMD_LOG_FLAG) {
+ seed1 = cmdRand.nextInt(100000);
+ } else if (logType == LogConst.SYS_LOG_FLAG) {
+ seed1 = sysRand.nextInt(100000);
+ } else if (logType == LogConst.SECRET_LOG_FLAG) {
+ seed1 = secRand.nextInt(100000);
+ } else {
+ return 0;
+ }
+ String seed2 = "" + seed1;
+ int shouldFillLen = 5 - seed2.length();
+ for (int i = 0; i < shouldFillLen; i++) {
+ seed2 = "0" + seed2;
+ }
+ return Long.parseLong(strCtime + seed2);
+ }
+
+ public static long transTimeCond2ID(Date time, boolean isStart) {
+ long timeLong = time.getTime();
+ if (isStart) {
+ timeLong = timeLong * 100000;
+ } else {
+ timeLong = timeLong * 100000 + 99999;
+ }
+ return timeLong;
+
+ }
+}
diff --git a/wso2/logging-sdk/src/main/java/org/openo/log/test/TestLogback2Logstash.java b/wso2/logging-sdk/src/main/java/org/openo/log/test/TestLogback2Logstash.java
new file mode 100644
index 0000000..ed4993a
--- /dev/null
+++ b/wso2/logging-sdk/src/main/java/org/openo/log/test/TestLogback2Logstash.java
@@ -0,0 +1,58 @@
+/**
+ * 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.log.test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+
+import org.openo.log.api.LogService;
+import org.openo.log.api.SysLogMessage;
+import org.slf4j.LoggerFactory;
+
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.joran.JoranConfigurator;
+import ch.qos.logback.core.joran.spi.JoranException;
+
+/**
+ * @author Huabing Zhao
+ *
+ */
+public class TestLogback2Logstash {
+
+ /**
+ * @param args
+ * @throws JoranException
+ * @throws IOException
+ * @throws InterruptedException
+ */
+ public static void main(String[] args) throws JoranException, IOException, InterruptedException {
+ LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
+ loggerContext.reset();
+ JoranConfigurator configurator = new JoranConfigurator();
+ InputStream configStream = TestLogback2Logstash.class.getResourceAsStream("logback.xml");
+ configurator.setContext(loggerContext);
+ configurator.doConfigure(configStream); // loads logback file
+ configStream.close();
+
+ for (int i = 0; i < 10; i++) {
+ SysLogMessage sysLogMessage = new SysLogMessage("a sys log example", "www.open-o.org",
+ LogService.SYSLOG_RANK_WARN, "logdetails", new Date(), new Date());
+ LogService.getInstance().recordSysLog(sysLogMessage);
+ }
+ loggerContext.stop();
+ }
+}
diff --git a/wso2/logging-sdk/src/main/java/org/openo/log/test/logback.xml b/wso2/logging-sdk/src/main/java/org/openo/log/test/logback.xml
new file mode 100644
index 0000000..4c41c2a
--- /dev/null
+++ b/wso2/logging-sdk/src/main/java/org/openo/log/test/logback.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+ <appender name="stash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
+ <destination>127.0.0.1:4560</destination>
+
+ <!-- encoder is required -->
+ <encoder class="net.logstash.logback.encoder.LogstashEncoder" />
+ </appender>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <Pattern>
+ %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
+ </Pattern>
+ </layout>
+ </appender>
+
+ <root level="debug">
+ <appender-ref ref="stash" />
+ <appender-ref ref="STDOUT" />
+ </root>
+
+</configuration> \ No newline at end of file
diff --git a/wso2/pom.xml b/wso2/pom.xml
new file mode 100644
index 0000000..668c863
--- /dev/null
+++ b/wso2/pom.xml
@@ -0,0 +1,332 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2016 Huawei Technologies Co., Ltd.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openo.oparent</groupId>
+ <artifactId>oparent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../oparent</relativePath>
+ </parent>
+
+ <groupId>org.openo.common-services.common-utilities</groupId>
+ <artifactId>common-setting</artifactId>
+ <packaging>pom</packaging>
+ <name>common-services-common-utilities</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.test.skip>false</maven.test.skip>
+ <maven.test.failure.ignore>false</maven.test.failure.ignore>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+ <release.dir>${basedir}/target</release.dir>
+ <slf4j.version>1.6.1</slf4j.version>
+
+
+ <bundle.name>${project.artifactId}-${project.version}</bundle.name>
+ <pkgzip.dir>${basedir}/../release/pkgzip</pkgzip.dir>
+ <excludesFile>**/*$*</excludesFile>
+
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <nexusproxy>https://nexus.open-o.org/content</nexusproxy>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ </properties>
+
+ <scm>
+ <connection>scm:git:ssh://git.open-o.org:29418/common-services-common-utilities.git</connection>
+ <developerConnection>scm:git:ssh://git.open-o.org:29418/common-services-common-utilities.git</developerConnection>
+ <tag>HEAD</tag>
+ <url>https://wiki.open-o.orgiew/Common_Services</url>
+ </scm>
+
+ <modules>
+ <module>baseservice-i18n</module>
+ <module>common-util</module>
+ <module>dropwizard-ioc-container</module>
+ <module>logging-sdk</module>
+ <module>rest-client</module>
+ <module>wso2bpel-ext</module>
+ </modules>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>org.apache.commons.lang</artifactId>
+ <version>2.6.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>org.apache.commons.logging</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>org.apache.commons.codec</artifactId>
+ <version>1.9.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.16</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mybatis</groupId>
+ <artifactId>mybatis-spring</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mybatis</groupId>
+ <artifactId>mybatis</artifactId>
+ <version>3.2.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>1.9.2</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.json-lib</groupId>
+ <artifactId>json-lib</artifactId>
+ <version>2.4</version>
+ <classifier>jdk15</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty.aggregate</groupId>
+ <artifactId>jetty-all</artifactId>
+ <version>8.1.16.v20140903</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty.orbit</groupId>
+ <artifactId>javax.servlet</artifactId>
+ <version>3.0.0.v201112011016</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>redis.clients</groupId>
+ <artifactId>jedis</artifactId>
+ <version>2.8.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-dbcp2</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>1.9.2</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${resources.dir}</directory>
+ </resource>
+ <resource>
+ <directory>${project.build.directory}/generated-resources</directory>
+ </resource>
+ <resource>
+ <directory>${basedir}/src/main/java</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>${basedir}/src/main/resources</directory>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>${basedir}/src/test/java</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </testResource>
+ <testResource>
+ <directory>${basedir}/src/test/resources</directory>
+ </testResource>
+ </testResources>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.6</version>
+ <dependencies>
+ <dependency>
+ <groupId>ant-contrib</groupId>
+ <artifactId>ant-contrib</artifactId>
+ <version>1.0b3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.google.js</groupId>
+ <artifactId>closure-compiler</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.closure-stylesheets</groupId>
+ <artifactId>closure-stylesheets</artifactId>
+ <version>20140426</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>2.4.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.5.2</version>
+ <configuration>
+ <checkModificationExcludes>
+ <checkModificationExclude>**/*.java</checkModificationExclude>
+ </checkModificationExcludes>
+ <allowTimestampedSnapshots>true</allowTimestampedSnapshots>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <!--Release -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ </plugin>
+
+ <!--plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.4-fixed</version> <configuration> <srcLocation>${srcLocation}</srcLocation>
+ <classOutputDir>${classOutputDir}</classOutputDir> </configuration> </plugin -->
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.7</version>
+ <configuration>
+ <retryFailedDeploymentCount>2</retryFailedDeploymentCount>
+ </configuration>
+ </plugin>
+
+
+ <!-- javadoc -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.6.1</version>
+ <configuration>
+ <aggregate>true</aggregate>
+ <stylesheetfile>${javadoc.loc}/javadoc.css</stylesheetfile>
+ <overview>${javadoc.loc}/overview.html</overview>
+ <excludePackageNames>org.apache.*,*.impl</excludePackageNames>
+ <breakiterator>true</breakiterator>
+ <quiet>true</quiet>
+ <failOnError>false</failOnError>
+ <verbose>false</verbose>
+ <show>protected</show>
+ <source>1.5</source>
+ <charset>gb2312</charset>
+ <encoding>UTF-8</encoding>
+ <docencoding>gb2312</docencoding>
+ <maxmemory>256M</maxmemory>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.3</version>
+ <configuration>
+ <source>1.7</source>
+ <target>1.7</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <finalName>${bundle.name}</finalName>
+ <outputDirectory>${release.dir}</outputDirectory>
+ </configuration>
+ </plugin>
+ <!-- clean -->
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <failOnError>false</failOnError>
+ <filesets>
+ <fileset>
+ <directory>${release.dir}</directory>
+ <includes>
+ <include>${bundle.name}.${project.packaging}</include>
+ </includes>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.6.1</version>
+ <configuration>
+ <aggregate>true</aggregate>
+ <quiet>true</quiet>
+ <show>public</show>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
diff --git a/wso2/rest-client/.gitignore b/wso2/rest-client/.gitignore
new file mode 100644
index 0000000..b83d222
--- /dev/null
+++ b/wso2/rest-client/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/wso2/rest-client/pom.xml b/wso2/rest-client/pom.xml
new file mode 100644
index 0000000..de54805
--- /dev/null
+++ b/wso2/rest-client/pom.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2016 Huawei Technologies Co., Ltd.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openo.common-services.common-utilities</groupId>
+ <artifactId>common-setting</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>commonlib-restclient</artifactId>
+ <properties>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.openo.common-services.common-utilities</groupId>
+ <artifactId>commonlib-cbb</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty.aggregate</groupId>
+ <artifactId>jetty-all</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ <version>4.8.2</version>
+ </dependency>
+ <dependency>
+ <groupId>com.googlecode.jmockit</groupId>
+ <artifactId>jmockit</artifactId>
+ <scope>test</scope>
+ <version>1.1</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>always</forkMode>
+ <argLine>-XX:-UseSplitVerifier</argLine>
+ <skip>${maven.test.skip}</skip>
+ <testFailureIgnore>${maven.test.failure.ignore}</testFailureIgnore>
+ <excludes>
+ <exclude>${excludesFile}</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <formats>
+ <format>xml</format>
+ <format>html</format>
+ </formats>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>cobertura</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+<name>common-services-common-utilities/rest-client</name></project>
diff --git a/wso2/rest-client/src/main/java/org/openo/baseservice/remoteservice/exception/ExceptionArgs.java b/wso2/rest-client/src/main/java/org/openo/baseservice/remoteservice/exception/ExceptionArgs.java
new file mode 100644
index 0000000..6c92f23
--- /dev/null
+++ b/wso2/rest-client/src/main/java/org/openo/baseservice/remoteservice/exception/ExceptionArgs.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.remoteservice.exception;
+
+/**
+ * ROA exception handling parameters.
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 28-May-2016
+ */
+public class ExceptionArgs {
+
+ /**
+ * Exception descriptions.
+ */
+ private String[] descArgs = null;
+
+ /**
+ * Exception reasons.
+ */
+ private String[] reasonArgs = null;
+
+ /**
+ * Exception detals.
+ */
+ private String[] detailArgs = null;
+
+ /**
+ * Exception advices.
+ */
+ private String[] adviceArgs = null;
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @since
+ */
+ public ExceptionArgs() {
+ // default constructor.
+ }
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @since
+ * @param descArgs: descriptions.
+ * @param reasonArgs: reasons.
+ * @param detailArgs: details.
+ * @param adviceArgs: advices.
+ */
+ public ExceptionArgs(final String[] descArgs, final String[] reasonArgs, final String[] detailArgs,
+ final String[] adviceArgs) {
+ this.descArgs = descArgs;
+ this.reasonArgs = reasonArgs;
+ this.detailArgs = detailArgs;
+ this.adviceArgs = adviceArgs;
+ }
+
+ public String[] getDescArgs() {
+ return descArgs;
+ }
+
+ public void setDescArgs(final String[] descArgs) {
+ this.descArgs = descArgs;
+ }
+
+ public String[] getReasonArgs() {
+ return reasonArgs;
+ }
+
+ public void setReasonArgs(final String[] reasonArgs) {
+ this.reasonArgs = reasonArgs;
+ }
+
+ public String[] getDetailArgs() {
+ return detailArgs;
+ }
+
+ public void setDetailArgs(final String[] detailArgs) {
+ this.detailArgs = detailArgs;
+ }
+
+ public String[] getAdviceArgs() {
+ return adviceArgs;
+ }
+
+ public void setAdviceArgs(final String[] adviceArgs) {
+ this.adviceArgs = adviceArgs;
+ }
+}
diff --git a/wso2/rest-client/src/main/java/org/openo/baseservice/remoteservice/exception/ServiceException.java b/wso2/rest-client/src/main/java/org/openo/baseservice/remoteservice/exception/ServiceException.java
new file mode 100644
index 0000000..378fe9f
--- /dev/null
+++ b/wso2/rest-client/src/main/java/org/openo/baseservice/remoteservice/exception/ServiceException.java
@@ -0,0 +1,269 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.remoteservice.exception;
+
+import java.text.MessageFormat;
+
+/**
+ * The base class for all common exception.<br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 28-May-2016
+ */
+public class ServiceException extends Exception {
+
+ /**
+ * default exception id.
+ */
+ public static final String DEFAULT_ID = "framwork.remote.SystemError";
+
+ /**
+ * Serial number.
+ */
+ private static final long serialVersionUID = 5703294364555144738L;
+
+ /**
+ * Exception id.
+ */
+ private String id = DEFAULT_ID;
+
+ private Object[] args = null;
+
+ private int httpCode = 500;
+
+ private ExceptionArgs exceptionArgs = null;
+
+ /**
+ * The default constructor<br/>
+ * <p>
+ * This method is only used as deserialized, in other cases, use parameterized constructor.
+ * </p>
+ *
+ * @since
+ */
+ public ServiceException() {
+ super("");
+ }
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @since
+ * @param id: details.
+ * @param cause: reason.
+ */
+ public ServiceException(final String id, final Throwable cause) {
+ super(cause);
+ this.setId(id);
+ }
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @since
+ * @param message: details.
+ */
+ public ServiceException(final String message) {
+ super(message);
+ }
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @since
+ * @param id: exception id.
+ * @param message: details.
+ */
+ public ServiceException(final String id, final String message) {
+ super(message);
+ this.setId(id);
+ }
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @since
+ * @param id: exception id.
+ * @param httpCode: http status code.
+ */
+ public ServiceException(final String id, final int httpCode) {
+ super();
+ this.setId(id);
+ this.setHttpCode(httpCode);
+ }
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * the exception include the httpcode and message.
+ * </p>
+ *
+ * @since
+ * @param httpCode http code.
+ * @param message details.
+ */
+ public ServiceException(final int httpCode, final String message) {
+ super(message);
+ this.setHttpCode(httpCode);
+ }
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @since
+ * @param id: exception id.
+ * @param httpCode: http code.
+ * @param exceptionArgs: Exception handling frame parameters.
+ */
+ public ServiceException(final String id, final int httpCode, final ExceptionArgs exceptionArgs) {
+ super();
+ this.setId(id);
+ this.setHttpCode(httpCode);
+ this.setExceptionArgs(exceptionArgs);
+ }
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * Have a placeholder exception, use args formatted message.
+ * </p>
+ *
+ * @since
+ * @param id: exception id.
+ * @param message: details.
+ * @param args: Placeholders for parameters
+ */
+ public ServiceException(final String id, final String message, final Object... args) {
+ super(MessageFormat.format(message, args));
+ this.setId(id);
+ this.args = args;
+ }
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * Have a placeholder exception, use args formatted message
+ * </p>
+ *
+ * @since
+ * @param id: exception id.
+ * @param message: details.
+ * @param cause: reason.
+ * @param args: placeholder for parameters
+ */
+ public ServiceException(final String id, final String message, final Throwable cause, final Object... args) {
+ super(MessageFormat.format(message, args), cause);
+ this.setId(id);
+ this.args = args;
+ }
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @since
+ * @param id: exception id.
+ * @param message: details.
+ * @param cause: reason.
+ */
+ public ServiceException(final String id, final String message, final Throwable cause) {
+ super(message, cause);
+ this.setId(id);
+ }
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @since
+ * @param cause: reason.
+ */
+ public ServiceException(final Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Get exceptoin id.<br/>
+ *
+ * @return
+ * @since
+ */
+ public String getId() {
+ if(id == null || id.isEmpty()) {
+ return DEFAULT_ID;
+ }
+ return id;
+ }
+
+ public void setId(final String id) {
+ this.id = id;
+ }
+
+ public int getHttpCode() {
+ return this.httpCode;
+ }
+
+ public void setHttpCode(final int httpCode) {
+ this.httpCode = httpCode;
+ }
+
+ /**
+ * Obtain the ROA exception handling framework parameters<br/>
+ *
+ * @return exception args.
+ * @since
+ */
+ public ExceptionArgs getExceptionArgs() {
+ return exceptionArgs;
+ }
+
+ public void setExceptionArgs(final ExceptionArgs exceptionArgs) {
+ this.exceptionArgs = exceptionArgs;
+ }
+
+ /**
+ * Gets the parameter information<br/>
+ *
+ * @return parameter list.
+ * @since
+ */
+ protected Object[] getArgs() {
+ if(args == null || args.length == 0 || DEFAULT_ID.equals(getId())) {
+ return new Object[] {};
+ }
+ return args;
+ }
+
+ @Override
+ public String toString() {
+ return "exception.id: " + getId() + "; " + super.toString();
+ }
+
+}
diff --git a/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/ReaderHelper.java b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/ReaderHelper.java
new file mode 100644
index 0000000..85e4f56
--- /dev/null
+++ b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/ReaderHelper.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util;
+
+import org.apache.commons.io.LineIterator;
+
+import java.io.Reader;
+
+/**
+ * Helper for read line.<br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 31-May-2016
+ */
+public class ReaderHelper {
+
+ private LineIterator ite = null;
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @since
+ * @param reader
+ */
+ public ReaderHelper(final Reader reader) {
+ if(reader != null) {
+ ite = new LineIterator(reader);
+ }
+
+ }
+
+ /**
+ * Gets the next line.<br/>
+ *
+ * @return line if present else null.
+ * @since
+ */
+ public String getLine() {
+ if(ite != null && ite.hasNext()) {
+ return ite.nextLine();
+ }
+ return null;
+ }
+}
diff --git a/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/DefaultAsyncCallback.java b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/DefaultAsyncCallback.java
new file mode 100644
index 0000000..81adeb6
--- /dev/null
+++ b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/DefaultAsyncCallback.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+/**
+ * Restful Asynchronous call back implentation.<br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 28-May-2016
+ */
+public class DefaultAsyncCallback implements RestfulAsyncCallback {
+
+ @Override
+ public void callback(final RestfulResponse response) {
+ // default implementation.
+ }
+
+ @Override
+ public void handleExcepion(final Throwable e) {
+ // default implementation
+ }
+}
diff --git a/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/HttpBaseRest.java b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/HttpBaseRest.java
new file mode 100644
index 0000000..3e64937
--- /dev/null
+++ b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/HttpBaseRest.java
@@ -0,0 +1,273 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.eclipse.jetty.client.Address;
+import org.eclipse.jetty.client.HttpClient;
+import org.eclipse.jetty.client.HttpExchange;
+import org.eclipse.jetty.http.HttpMethods;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version Aug 9, 2016
+ */
+public abstract class HttpBaseRest implements Restful {
+
+ private static final Logger LOG = LoggerFactory.getLogger(HttpRest.class);
+
+ final AtomicInteger requestId = new AtomicInteger(0);
+
+ protected HttpClient client = null;
+
+ private static final String LOCAL_HOST = "127.0.0.1";
+
+ static final String HTTP_PATCH = "PATCH";
+
+ String defaultIP = LOCAL_HOST;
+
+ int defaultPort = -10000;
+
+ int defaultTimeout = 30000;
+
+ final String procenameRouteID = "RouteID-" + System.currentTimeMillis() + "-";
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @since
+ */
+ public HttpBaseRest() {
+ super();
+ }
+
+ protected void createHttpClient() {
+ client = new HttpClient();
+ }
+
+ protected RestHttpContentExchange createRestHttpContentExchange(final RestfulAsyncCallback callback) {
+ final RestHttpContentExchange exchange = new RestHttpContentExchange(true, callback);
+ exchange.setScheme("http");
+ return exchange;
+ }
+
+ private String encodeParams(final RestfulParametes restParametes) throws ServiceException {
+ final Map<String, String> parm = restParametes.getParamMap();
+ String value = null;
+ boolean bHasParma = false;
+ final StringBuilder builder = new StringBuilder();
+ try {
+ for(final String key : parm.keySet()) {
+ value = parm.get(key);
+ if(value == null) {
+ value = "";
+ }
+ String str;
+ if(bHasParma) {
+ str = String.format("&%s=%s", URLEncoder.encode(key, RestfulClientConst.ENCODING),
+ URLEncoder.encode(value, RestfulClientConst.ENCODING));
+ } else {
+ bHasParma = true;
+ str = String.format("%s=%s", URLEncoder.encode(key, RestfulClientConst.ENCODING),
+ URLEncoder.encode(value, RestfulClientConst.ENCODING));
+ }
+ builder.append(str);
+ }
+ } catch(final UnsupportedEncodingException ex) {
+ LOG.error("unsupported encoding: ", ex);
+ throw new ServiceException("Broken VM does not support UTF-8");
+ }
+ return builder.toString();
+ }
+
+ private void processHeader(final RestHttpContentExchange contentExchange, final Map<String, String> headerMap) {
+ for(final String key : headerMap.keySet()) {
+ final String value = headerMap.get(key);
+ contentExchange.addRequestHeader(key, value);
+ }
+
+ }
+
+ private void setContentExchangeParams(final RestHttpContentExchange contentExchange) {
+ final String contentType = contentExchange.getRequestFields().getStringField("Content-Type");
+ if(null == contentType || contentType.isEmpty()) {
+ // application/json;charset=utf-8
+ contentExchange.setRequestContentType(RestfulClientConst.APPLICATION_FORM_URLENCODED);
+ }
+ final String encoding = contentExchange.getRequestFields().getStringField("Accept-Encoding");
+ if(null == encoding || encoding.isEmpty()) {
+ // compress,gzip
+ contentExchange.setRequestHeader("Accept-Encoding", "*/*");
+ }
+ contentExchange.setVersion(11);
+ }
+
+ /**
+ * <br/>
+ *
+ * @param method
+ * @param servicePath
+ * @param restParametes
+ * @param options
+ * @param callback
+ * @return
+ * @throws ServiceException
+ * @since
+ */
+ protected RestfulResponse sendHttpRequest(final String method, final String servicePath,
+ final RestfulParametes restParametes, final RestfulOptions options, final RestfulAsyncCallback callback)
+ throws ServiceException {
+ final RestHttpContentExchange contentExchange = createRestHttpContentExchange(callback);
+ if(null == restParametes) {
+ return new RestfulResponse();
+ }
+ final String requestTrace = this.getReuqestIdString();
+ restParametes.putHttpContextHeader(RestfulClientConst.REQUEST_ID, requestTrace);
+
+ RestfulResponse rsp = null;
+ try {
+ contentExchange.setMethod(method);
+ final String str = encodeParams(restParametes);
+ final StringBuilder builder = new StringBuilder();
+ builder.append(servicePath);
+ if(str.length() > 0 && (method.equals(HttpMethods.GET) || method.equals(HttpMethods.DELETE)
+ || method.equals(HttpMethods.HEAD))) {
+ builder.append('?');
+ builder.append(str);
+ }
+ setDefaultUrl(contentExchange, options, builder);
+ processHeader(contentExchange, restParametes.getHeaderMap());
+ setContentExchangeParams(contentExchange);
+
+ setPostPutParam(method, restParametes, contentExchange, str);
+ setTimeout(options, contentExchange);
+
+ client.send(contentExchange);
+ rsp = callbackExecute(callback, contentExchange);
+ } catch(final Exception e) {
+ LOG.error("request reply message have exception:status is "
+ + RestHttpContentExchange.toState(contentExchange.getStatus()));
+ throw new ServiceException(e);
+ }
+ return rsp;
+ }
+
+ private void setDefaultUrl(final RestHttpContentExchange contentExchange, final RestfulOptions options,
+ final StringBuilder url) {
+ // server
+ if(url.toString().startsWith("http")) {
+ contentExchange.setURL(url.toString());
+ } else {
+ String host = defaultIP;
+ int iPort = defaultPort;
+ if(options != null) {
+ host = options.getHost();
+ if(host.isEmpty()) {
+ host = defaultIP;
+ }
+ iPort = options.getPort();
+ if(iPort == 0) {
+ iPort = defaultPort;
+ }
+ }
+ // Integer.getInteger(".http.client.maxThread",30)
+ contentExchange.setAddress(new Address(host, iPort));
+ contentExchange.setRequestURI(url.toString());
+ }
+ }
+
+ private String getReuqestIdString() {
+ if(this.requestId.get() == 0x7FFFFFFF) {
+ this.requestId.set(1);
+ }
+ final int reqId = this.requestId.getAndIncrement();
+ final StringBuilder builder = new StringBuilder(this.procenameRouteID);
+ // time
+ final SimpleDateFormat dateFormate = new SimpleDateFormat("yyMMdd");
+ final SimpleDateFormat timeFormate = new SimpleDateFormat("HHmmss");
+ final Date date = Calendar.getInstance().getTime();
+ builder.append(dateFormate.format(date) + timeFormate.format(date));
+ builder.append('-');
+ builder.append(reqId);
+ return builder.toString();
+ }
+
+ private void setPostPutParam(final String method, final RestfulParametes restParametes,
+ final RestHttpContentExchange contentExchange, final String str) throws UnsupportedEncodingException {
+ if(HttpMethods.POST.equals(method) || HttpMethods.PUT.equals(method) || HTTP_PATCH.equals(method)) {
+ ByteArrayInputStream buff;
+ final String tmpRaw = restParametes.getRawData();
+ if(tmpRaw == null) {
+ buff = new ByteArrayInputStream(str.getBytes(RestfulClientConst.ENCODING));
+ } else {
+ buff = new ByteArrayInputStream(tmpRaw.getBytes(RestfulClientConst.ENCODING));
+ }
+ final int len = buff.available();
+ contentExchange.setRequestContentSource(buff);
+ contentExchange.setRequestHeader("content-length", String.valueOf(len));
+ }
+ }
+
+ private void setTimeout(final RestfulOptions options, final RestHttpContentExchange contentExchange) {
+ if(options != null) {
+ final long timeout = options.getRestTimeout();
+ if(timeout != 0) {
+ contentExchange.setTimeout(timeout);
+ } else {
+ contentExchange.setTimeout(defaultTimeout);
+ }
+ } else {
+ contentExchange.setTimeout(defaultTimeout);
+ }
+ }
+
+ private RestfulResponse callbackExecute(final RestfulAsyncCallback callback,
+ final RestHttpContentExchange contentExchange) throws InterruptedException, IOException, ServiceException {
+ if(callback == null) {
+ final int exchangeState = contentExchange.waitForDone();
+ if(exchangeState == HttpExchange.STATUS_COMPLETED) {
+ return contentExchange.getResponse();
+ } else if(exchangeState == HttpExchange.STATUS_EXCEPTED) {
+ throw new ServiceException(
+ "request is exception: " + RestHttpContentExchange.toState(HttpExchange.STATUS_EXCEPTED));
+ } else if(exchangeState == HttpExchange.STATUS_EXPIRED) {
+ throw new ServiceException(
+ "request is expierd: " + RestHttpContentExchange.toState(HttpExchange.STATUS_EXPIRED));
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/HttpRest.java b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/HttpRest.java
new file mode 100644
index 0000000..047f20e
--- /dev/null
+++ b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/HttpRest.java
@@ -0,0 +1,254 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+import org.eclipse.jetty.client.HttpClient;
+import org.eclipse.jetty.http.HttpMethods;
+import org.eclipse.jetty.util.thread.QueuedThreadPool;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version Aug 9, 2016
+ */
+public class HttpRest extends HttpBaseRest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(HttpRest.class);
+
+ /**
+ * Initializing Rest options.<br/>
+ *
+ * @param options: rest options.
+ * @throws ServiceException
+ * @since
+ */
+ public void initHttpRest(final RestfulOptions option) throws ServiceException {
+ if(option == null) {
+ client = null;
+ throw new ServiceException("option is null.");
+ }
+ createHttpClient();
+ try {
+ int iValue;
+ iValue = option.getIntOption(RestfulClientConst.MAX_CONN_PER_ADDR_KEY_NAME);
+ // max 200 concurrent,connections to every address
+ client.setMaxConnectionsPerAddress(iValue);
+
+ iValue = option.getIntOption(RestfulClientConst.THREAD_KEY_NAME);
+ // max threads
+ client.setThreadPool(new QueuedThreadPool(iValue));
+ iValue = option.getIntOption(RestfulClientConst.CONN_TIMEOUT_KEY_NAME);
+ client.setConnectTimeout(iValue);
+ iValue = option.getRestTimeout();
+ defaultTimeout = iValue;
+ client.setTimeout(iValue);
+
+ iValue = option.getIntOption(RestfulClientConst.IDLE_TIMEOUT_KEY_NAME);
+ client.setIdleTimeout(iValue);
+ iValue = option.getIntOption(RestfulClientConst.MAX_RESPONSE_HEADER_SIZE);
+ client.setResponseHeaderSize(iValue);
+ iValue = option.getIntOption(RestfulClientConst.MAX_REQUEST_HEADER_SIZE);
+ client.setRequestHeaderSize(iValue);
+ // HttpClient.CONNECTOR_SOCKET
+ client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
+ client.start();
+ defaultIP = option.getStringOption(RestfulClientConst.HOST_KEY_NAME);
+ defaultPort = option.getIntOption(RestfulClientConst.PORT_KEY_NAME);
+ } catch(final Exception e) {
+ LOG.error("start httpclient error", e);
+ client = null;
+ throw new ServiceException("http client init failed.");
+ }
+ }
+
+ @Override
+ public RestfulResponse get(final String servicePath, final RestfulParametes restParametes) throws ServiceException {
+ return this.sendHttpRequest(HttpMethods.GET, servicePath, restParametes, null, null);
+ }
+
+ @Override
+ public RestfulResponse get(final String servicePath, final RestfulParametes restParametes,
+ final RestfulOptions option) throws ServiceException {
+ return this.sendHttpRequest(HttpMethods.GET, servicePath, restParametes, option, null);
+ }
+
+ @Override
+ public RestfulResponse head(final String servicePath, final RestfulParametes restParametes)
+ throws ServiceException {
+ return this.sendHttpRequest(HttpMethods.HEAD, servicePath, restParametes, null, null);
+ }
+
+ @Override
+ public RestfulResponse head(final String servicePath, final RestfulParametes restParametes,
+ final RestfulOptions option) throws ServiceException {
+ return this.sendHttpRequest(HttpMethods.HEAD, servicePath, restParametes, option, null);
+ }
+
+ @Override
+ public void asyncGet(final String servicePath, final RestfulParametes restParametes,
+ final RestfulAsyncCallback callback) throws ServiceException {
+ if(callback == null) {
+ this.sendHttpRequest(HttpMethods.GET, servicePath, restParametes, null, new DefaultAsyncCallback());
+ } else {
+ this.sendHttpRequest(HttpMethods.GET, servicePath, restParametes, null, callback);
+ }
+ }
+
+ @Override
+ public void asyncGet(final String servicePath, final RestfulParametes restParametes, final RestfulOptions option,
+ final RestfulAsyncCallback callback) throws ServiceException {
+ if(callback == null) {
+ this.sendHttpRequest(HttpMethods.GET, servicePath, restParametes, option, new DefaultAsyncCallback());
+ } else {
+ this.sendHttpRequest(HttpMethods.GET, servicePath, restParametes, option, callback);
+ }
+ }
+
+ @Override
+ public RestfulResponse put(final String servicePath, final RestfulParametes restParametes) throws ServiceException {
+ return this.sendHttpRequest(HttpMethods.PUT, servicePath, restParametes, null, null);
+ }
+
+ @Override
+ public RestfulResponse put(final String servicePath, final RestfulParametes restParametes,
+ final RestfulOptions option) throws ServiceException {
+ return this.sendHttpRequest(HttpMethods.PUT, servicePath, restParametes, option, null);
+ }
+
+ @Override
+ public void asyncPut(final String servicePath, final RestfulParametes restParametes,
+ final RestfulAsyncCallback callback) throws ServiceException {
+ if(callback == null) {
+ this.sendHttpRequest(HttpMethods.PUT, servicePath, restParametes, null, new DefaultAsyncCallback());
+ } else {
+ this.sendHttpRequest(HttpMethods.PUT, servicePath, restParametes, null, callback);
+ }
+ }
+
+ @Override
+ public void asyncPut(final String servicePath, final RestfulParametes restParametes, final RestfulOptions option,
+ final RestfulAsyncCallback callback) throws ServiceException {
+ if(callback == null) {
+ this.sendHttpRequest(HttpMethods.PUT, servicePath, restParametes, option, new DefaultAsyncCallback());
+ } else {
+ this.sendHttpRequest(HttpMethods.PUT, servicePath, restParametes, option, callback);
+ }
+ }
+
+ @Override
+ public RestfulResponse post(final String servicePath, final RestfulParametes restParametes)
+ throws ServiceException {
+ return this.sendHttpRequest(HttpMethods.POST, servicePath, restParametes, null, null);
+ }
+
+ @Override
+ public RestfulResponse post(final String servicePath, final RestfulParametes restParametes,
+ final RestfulOptions option) throws ServiceException {
+ return this.sendHttpRequest(HttpMethods.POST, servicePath, restParametes, option, null);
+ }
+
+ @Override
+ public void asyncPost(final String servicePath, final RestfulParametes restParametes,
+ final RestfulAsyncCallback callback) throws ServiceException {
+ if(callback == null) {
+ this.sendHttpRequest(HttpMethods.POST, servicePath, restParametes, null, new DefaultAsyncCallback());
+ } else {
+ this.sendHttpRequest(HttpMethods.POST, servicePath, restParametes, null, callback);
+ }
+ }
+
+ @Override
+ public void asyncPost(final String servicePath, final RestfulParametes restParametes, final RestfulOptions option,
+ final RestfulAsyncCallback callback) throws ServiceException {
+ if(callback == null) {
+ this.sendHttpRequest(HttpMethods.POST, servicePath, restParametes, option, new DefaultAsyncCallback());
+ } else {
+ this.sendHttpRequest(HttpMethods.POST, servicePath, restParametes, option, callback);
+ }
+ }
+
+ @Override
+ public RestfulResponse delete(final String servicePath, final RestfulParametes restParametes)
+ throws ServiceException {
+ return this.sendHttpRequest(HttpMethods.DELETE, servicePath, restParametes, null, null);
+ }
+
+ @Override
+ public RestfulResponse delete(final String servicePath, final RestfulParametes restParametes,
+ final RestfulOptions option) throws ServiceException {
+ return this.sendHttpRequest(HttpMethods.DELETE, servicePath, restParametes, option, null);
+ }
+
+ @Override
+ public void asyncDelete(final String servicePath, final RestfulParametes restParametes,
+ final RestfulAsyncCallback callback) throws ServiceException {
+ if(callback == null) {
+ this.sendHttpRequest(HttpMethods.DELETE, servicePath, restParametes, null, new DefaultAsyncCallback());
+ } else {
+ this.sendHttpRequest(HttpMethods.DELETE, servicePath, restParametes, null, callback);
+ }
+ }
+
+ @Override
+ public void asyncDelete(final String servicePath, final RestfulParametes restParametes, final RestfulOptions option,
+ final RestfulAsyncCallback callback) throws ServiceException {
+ if(callback == null) {
+ this.sendHttpRequest(HttpMethods.DELETE, servicePath, restParametes, option, new DefaultAsyncCallback());
+ } else {
+ this.sendHttpRequest(HttpMethods.DELETE, servicePath, restParametes, option, callback);
+ }
+ }
+
+ @Override
+ public RestfulResponse patch(final String servicePath, final RestfulParametes restParametes)
+ throws ServiceException {
+ return this.sendHttpRequest(HTTP_PATCH, servicePath, restParametes, null, null);
+ }
+
+ @Override
+ public RestfulResponse patch(final String servicePath, final RestfulParametes restParametes,
+ final RestfulOptions option) throws ServiceException {
+ return this.sendHttpRequest(HTTP_PATCH, servicePath, restParametes, option, null);
+ }
+
+ @Override
+ public void asyncPatch(final String servicePath, final RestfulParametes restParametes,
+ final RestfulAsyncCallback callback) throws ServiceException {
+ if(callback == null) {
+ this.sendHttpRequest(HTTP_PATCH, servicePath, restParametes, null, new DefaultAsyncCallback());
+ } else {
+ this.sendHttpRequest(HTTP_PATCH, servicePath, restParametes, null, callback);
+ }
+ }
+
+ @Override
+ public void asyncPatch(final String servicePath, final RestfulParametes restParametes, final RestfulOptions option,
+ final RestfulAsyncCallback callback) throws ServiceException {
+ if(callback == null) {
+ this.sendHttpRequest(HTTP_PATCH, servicePath, restParametes, option, new DefaultAsyncCallback());
+ } else {
+ this.sendHttpRequest(HTTP_PATCH, servicePath, restParametes, option, callback);
+ }
+ }
+
+}
diff --git a/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestHttpContentExchange.java b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestHttpContentExchange.java
new file mode 100644
index 0000000..99328a7
--- /dev/null
+++ b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestHttpContentExchange.java
@@ -0,0 +1,234 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.jetty.client.ContentExchange;
+import org.eclipse.jetty.client.HttpDestination;
+import org.eclipse.jetty.http.HttpFields;
+import org.eclipse.jetty.http.HttpHeaders;
+import org.eclipse.jetty.io.Buffer;
+import org.eclipse.jetty.util.StringUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.charset.Charset;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.zip.GZIPInputStream;
+
+/**
+ * ContentExchange implementation classe to provide access to response.
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 28-May-2016
+ */
+public class RestHttpContentExchange extends ContentExchange {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(RestHttpContentExchange.class);
+
+ private boolean gzip = false;
+
+ private RestfulAsyncCallback callback = null;
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * </p>
+ *
+ * @since
+ * @param cacheFields whether to cache response header.
+ * @param asyncCallback callback method.
+ */
+ RestHttpContentExchange(final boolean cacheFields, final RestfulAsyncCallback asyncCallback) {
+ super(cacheFields);
+ this.callback = asyncCallback;
+ }
+
+ /**
+ * Extract message.
+ * <br/>
+ *
+ * @param data GZipped data.
+ * @return Uncompressed data.
+ * @throws IOException
+ * @since
+ */
+ public String decompressGzipToStr(final byte[] data) throws IOException {
+ if(data == null) {
+ return "";
+ }
+ ByteArrayInputStream input = null;
+ GZIPInputStream gzis = null;
+ InputStreamReader reader = null;
+ final StringBuilder out = new StringBuilder();
+ try {
+ input = new ByteArrayInputStream(data);
+ gzis = new GZIPInputStream(input);
+ reader = new InputStreamReader(gzis, Charset.forName(RestfulClientConst.ENCODING));
+ final char[] buff = new char[1024];
+ for(int n; (n = reader.read(buff)) != -1;) {
+ out.append(new String(buff, 0, n));
+ }
+ } finally {
+ if(reader != null) {
+ try {
+ reader.close();
+ } catch(final IOException e) {
+ LOGGER.error("decompress Gzip reader exception:", e);
+ }
+ }
+ if(gzis != null) {
+ try {
+ gzis.close();
+ } catch(final IOException e) {
+ LOGGER.error("decompress Gzip exception:", e);
+ }
+ }
+ if(input != null) {
+ try {
+ input.close();
+ } catch(final IOException e) {
+ LOGGER.error("decompress Gzip input exception:", e);
+ }
+ }
+ }
+ return out.toString();
+
+ }
+
+ /**
+ * View response headers Content-Encoding values if you need to extract data.<br/>
+ *
+ * @param name buffer
+ * @param value value
+ * @throws IOException
+ * @since
+ */
+ @Override
+ protected synchronized void onResponseHeader(final Buffer name, final Buffer value) throws IOException {
+ super.onResponseHeader(name, value);
+ final int header = HttpHeaders.CACHE.getOrdinal(name);
+ if(header == HttpHeaders.CONTENT_ENCODING_ORDINAL) {
+ final String encoding = StringUtil.asciiToLowerCase(value.toString());
+ gzip = encoding != null && StringUtils.contains(encoding, "gzip");
+ }
+
+ }
+
+ @Override
+ protected void onResponseComplete() throws IOException {
+ if(LOGGER.isInfoEnabled()) {
+ LOGGER.info("Response has Complete:" + "path:" + this.getRequestURI().replace("\n", "0x0A"));
+ }
+ super.onResponseComplete();
+ if(callback != null) {
+ final RestfulResponse rsp = getResponse();
+ callback.callback(rsp);
+ }
+ }
+
+ @Override
+ protected void onRequestCommitted() throws IOException {
+ if(LOGGER.isInfoEnabled()) {
+ LOGGER.info("Request Header has been send:" + "path:" + this.getRequestURI().replace("\n", "0x0A"));
+ }
+ super.onRequestCommitted();
+ }
+
+ @Override
+ protected void onRequestComplete() throws IOException {
+ if(LOGGER.isInfoEnabled()) {
+ LOGGER.info("Request has bend send complete:" + "path:" + this.getRequestURI().replace("\n", "0x0A"));
+ }
+ super.onRequestComplete();
+ }
+
+ @Override
+ protected void onException(final Throwable x) {
+ LOGGER.warn("onException:", x);
+ super.onException(x);
+ if(callback != null) {
+ callback.handleExcepion(x);
+ }
+ }
+
+ @Override
+ protected void onConnectionFailed(final Throwable x) {
+ LOGGER.warn("onConnectionFailed:", x);
+ super.onConnectionFailed(x);
+ if(callback != null) {
+ callback.handleExcepion(x);
+ }
+
+ }
+
+ @Override
+ protected void expire(final HttpDestination destination) {
+ super.expire(destination);
+ if(callback != null) {
+ callback.handleExcepion(new ServiceException("request is expired, status:" + toState(getStatus())));
+ }
+ }
+
+ public boolean isGzip() {
+ return gzip;
+ }
+
+ /**
+ * Get the response as RestfulResponse.
+ * <br/>
+ *
+ * @return response object.
+ * @throws IOException
+ * @since
+ */
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse rsp = new RestfulResponse();
+ rsp.setStatus(this.getResponseStatus());
+ if(isGzip()) {
+ final String responseString = decompressGzipToStr(getResponseContentBytes());
+ rsp.setResponseJson(responseString);
+ } else {
+ rsp.setResponseJson(this.getResponseContent());
+ }
+
+ final HttpFields field = this.getResponseFields();
+ if(field != null) {
+ final Map<String, String> header = new HashMap<>();
+
+ final Enumeration<String> names = field.getFieldNames();
+ for(final Enumeration<String> e = names; e.hasMoreElements();) {
+ final String fieldName = e.nextElement();
+ final String fieldValue = field.getStringField(fieldName);
+ header.put(fieldName, fieldValue);
+ }
+
+ rsp.setRespHeaderMap(header);
+ }
+ return rsp;
+ }
+
+}
diff --git a/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/Restful.java b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/Restful.java
new file mode 100644
index 0000000..8527e68
--- /dev/null
+++ b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/Restful.java
@@ -0,0 +1,298 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+
+/**
+ * ReSTful method interface.<br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 28-May-2016
+ */
+public interface Restful {
+
+ /**
+ * Http GET method.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: query parameters.
+ * @return response.
+ * @throws ServiceException
+ * @since
+ */
+ RestfulResponse get(String servicePath, RestfulParametes restParametes) throws ServiceException;
+
+ /**
+ * Http HEAD method.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @param options: request options.
+ * @return response.
+ * @throws ServiceException
+ * @since
+ */
+ RestfulResponse head(String servicePath, RestfulParametes restParametes, RestfulOptions options)
+ throws ServiceException;
+
+ /**
+ * Http HEAD method.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @return response.
+ * @throws ServiceException
+ * @since
+ */
+ RestfulResponse head(String servicePath, RestfulParametes restParametes) throws ServiceException;
+
+ /**
+ * Http GET method.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @param options: request options.
+ * @return response.
+ * @throws ServiceException
+ * @since
+ */
+ RestfulResponse get(String servicePath, RestfulParametes restParametes, RestfulOptions options)
+ throws ServiceException;
+
+ /**
+ * Asynchronouse GET request.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @param callback: response callback method.
+ * @throws ServiceException
+ * @since
+ */
+ void asyncGet(String servicePath, RestfulParametes restParametes, RestfulAsyncCallback callback)
+ throws ServiceException;
+
+ /**
+ * Asynchronouse GET request.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @param options: request options.
+ * @param callback: response callback method.
+ * @throws ServiceException
+ * @since
+ */
+ void asyncGet(String servicePath, RestfulParametes restParametes, RestfulOptions options,
+ RestfulAsyncCallback callback) throws ServiceException;
+
+ /**
+ * Http PUT method.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @return response.
+ * @throws ServiceException
+ * @since
+ */
+ RestfulResponse put(String servicePath, RestfulParametes restParametes) throws ServiceException;
+
+ /**
+ * Http PUT method.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @param options: request options.
+ * @return response.
+ * @throws ServiceException
+ * @since
+ */
+ RestfulResponse put(String servicePath, RestfulParametes restParametes, RestfulOptions options)
+ throws ServiceException;
+
+ /**
+ * Asynchronouse PUT request.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @param callback: response callback method.
+ * @throws ServiceException
+ * @since
+ */
+ void asyncPut(String servicePath, RestfulParametes restParametes, RestfulAsyncCallback callback)
+ throws ServiceException;
+
+ /**
+ * Asynchronouse PUT request.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @param options: request options.
+ * @param callback: response callback method.
+ * @throws ServiceException
+ * @since
+ */
+ void asyncPut(String servicePath, RestfulParametes restParametes, RestfulOptions options,
+ RestfulAsyncCallback callback) throws ServiceException;
+
+ /**
+ * Http POST method.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @return response.
+ * @throws ServiceException
+ * @since
+ */
+ RestfulResponse post(String servicePath, RestfulParametes restParametes) throws ServiceException;
+
+ /**
+ * Http POST method.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @param options: request options.
+ * @return response.
+ * @throws ServiceException
+ * @since
+ */
+ RestfulResponse post(String servicePath, RestfulParametes restParametes, RestfulOptions options)
+ throws ServiceException;
+
+ /**
+ * Asynchronouse POST request.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @param callback: response callback method.
+ * @throws ServiceException
+ * @since
+ */
+ void asyncPost(String servicePath, RestfulParametes restParametes, RestfulAsyncCallback callback)
+ throws ServiceException;
+
+ /**
+ * Asynchronouse POST request.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @param options: request options.
+ * @param callback: response callback method.
+ * @throws ServiceException
+ * @since
+ */
+ void asyncPost(String servicePath, RestfulParametes restParametes, RestfulOptions options,
+ RestfulAsyncCallback callback) throws ServiceException;
+
+ /**
+ * Http DELETE method.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @return response.
+ * @throws ServiceException
+ * @since
+ */
+ RestfulResponse delete(String servicePath, RestfulParametes restParametes) throws ServiceException;
+
+ /**
+ * Http DELETE method.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @param options: request options.
+ * @return response.
+ * @throws ServiceException
+ * @since
+ */
+ RestfulResponse delete(String servicePath, RestfulParametes restParametes, RestfulOptions options)
+ throws ServiceException;
+
+ /**
+ * Asynchronouse DELETE request.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @param callback: response callback method.
+ * @throws ServiceException
+ * @since
+ */
+ void asyncDelete(String servicePath, RestfulParametes restParametes, RestfulAsyncCallback callback)
+ throws ServiceException;
+
+ /**
+ * Asynchronouse DELETE request.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @param options: request options.
+ * @param callback: response callback method.
+ * @throws ServiceException
+ * @since
+ */
+ void asyncDelete(String servicePath, RestfulParametes restParametes, RestfulOptions options,
+ RestfulAsyncCallback callback) throws ServiceException;
+
+ /**
+ * Http PATCH method.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @return response.
+ * @throws ServiceException
+ * @since
+ */
+ RestfulResponse patch(String servicePath, RestfulParametes restParametes) throws ServiceException;
+
+ /**
+ * Http PATCH method.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @param options: request options.
+ * @return response.
+ * @throws ServiceException
+ * @since
+ */
+ RestfulResponse patch(String servicePath, RestfulParametes restParametes, RestfulOptions options)
+ throws ServiceException;
+
+ /**
+ * Asynchronouse PATCH request.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @param callback: response callback method.
+ * @throws ServiceException
+ * @since
+ */
+ void asyncPatch(String servicePath, RestfulParametes restParametes, RestfulAsyncCallback callback)
+ throws ServiceException;
+
+ /**
+ * Asynchronouse PATCH request.<br/>
+ *
+ * @param servicePath: request path.
+ * @param restParametes: request parameters.
+ * @param options: request options.
+ * @param callback: response callback method.
+ * @throws ServiceException
+ * @since
+ */
+ void asyncPatch(String servicePath, RestfulParametes restParametes, RestfulOptions options,
+ RestfulAsyncCallback callback) throws ServiceException;
+}
diff --git a/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulAsyncCallback.java b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulAsyncCallback.java
new file mode 100644
index 0000000..bf461c9
--- /dev/null
+++ b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulAsyncCallback.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+/**
+ * Callback interface for ReST calls.<br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 28-May-2016
+ */
+public interface RestfulAsyncCallback {
+
+ /**
+ * Response callback.<br/>
+ *
+ * @param response: response of ReST call.
+ * @since
+ */
+ void callback(RestfulResponse response);
+
+ /**
+ * Exceptoin callback.<br/>
+ *
+ * @param e: ReST call exception.
+ * @since
+ */
+ void handleExcepion(Throwable e);
+}
diff --git a/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulClientConst.java b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulClientConst.java
new file mode 100644
index 0000000..3741c20
--- /dev/null
+++ b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulClientConst.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+/**
+ * Constants for ReST client.<br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 28-May-2016
+ */
+public class RestfulClientConst {
+
+ /** -- json Ecode -- **/
+ public static final String APPLICATION_FORM_JSON_EBCIDED = "application/json";
+
+ /**
+ * urlencode
+ */
+ public static final String APPLICATION_FORM_URLENCODED = "application/x-www-form-urlencoded; charset=UTF-8";
+
+ public static final String ENCODING = "UTF-8";
+
+ public static final String SERVER_KEY_NAME = "defaultServer";
+
+ public static final String HOST_KEY_NAME = "host";
+
+ public static final String PORT_KEY_NAME = "port";
+
+ public static final String CONN_TIMEOUT_KEY_NAME = "ConnectTimeout";
+
+ public static final String THREAD_KEY_NAME = "thread";
+
+ public static final String IDLE_TIMEOUT_KEY_NAME = "idletimeout";
+
+ public static final String TIMEOUT_KEY_NAME = "timeout";
+
+ public static final String MAX_CONN_PER_ADDR_KEY_NAME = "maxConnectionPerAddr";
+
+ public static final String REQUEST_ID = "x-request-id";
+
+ public static final String MAX_RESPONSE_HEADER_SIZE = "responseHeaderSize";
+
+ public static final String MAX_REQUEST_HEADER_SIZE = "requestHeaderSize";
+
+ private RestfulClientConst() {
+
+ }
+}
diff --git a/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulConfigure.java b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulConfigure.java
new file mode 100644
index 0000000..3ce6859
--- /dev/null
+++ b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulConfigure.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import org.openo.baseservice.roa.util.ReaderHelper;
+import org.openo.baseservice.util.impl.SystemEnvVariablesFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.sf.json.JSONObject;
+
+/**
+ * Rest client options.<br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 28-May-2016
+ */
+public class RestfulConfigure {
+
+ private static final Logger LOG = LoggerFactory.getLogger(RestfulConfigure.class);
+
+ private RestfulOptions options = null;
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * Use the default path initialization http Rest options.
+ * </p>
+ *
+ * @since
+ */
+ public RestfulConfigure() {
+ final String config = "/etc/conf/restclient.json";
+ final String approot = SystemEnvVariablesFactory.getInstance().getAppRoot();
+ final StringBuilder extendSetting = new StringBuilder();
+
+ if(approot != null) {
+ extendSetting.append(approot);
+ extendSetting.append(config);
+ } else {
+ extendSetting.append(System.getProperty("user.dir"));
+ extendSetting.append(config);
+ }
+
+ final String configfile = extendSetting.toString();
+ initRestConf(configfile);
+ }
+
+ /**
+ * Constructor<br/>
+ * <p>
+ * Use the specified file to initialize http Rest options.
+ * </p>
+ *
+ * @since
+ * @param configfile
+ */
+ public RestfulConfigure(final String configfile) {
+ initRestConf(configfile);
+ }
+
+ public RestfulOptions getOptions() {
+ return options;
+ }
+
+ private void initRestConf(final String configfile) {
+ options = getDefaultOptions();
+
+ final JSONObject obj = loadJsonFromFile(configfile);
+ if(obj != null) {
+ if(obj.has(RestfulClientConst.SERVER_KEY_NAME)) {
+ final JSONObject server = obj.getJSONObject(RestfulClientConst.SERVER_KEY_NAME);
+ setStringOption(server, RestfulClientConst.HOST_KEY_NAME);
+ setIntOption(server, RestfulClientConst.PORT_KEY_NAME);
+ }
+ setIntOption(obj, RestfulClientConst.CONN_TIMEOUT_KEY_NAME);
+ setIntOption(obj, RestfulClientConst.THREAD_KEY_NAME);
+ setIntOption(obj, RestfulClientConst.IDLE_TIMEOUT_KEY_NAME);
+ setIntOption(obj, RestfulClientConst.TIMEOUT_KEY_NAME);
+ setIntOption(obj, RestfulClientConst.MAX_CONN_PER_ADDR_KEY_NAME);
+ setIntOption(obj, RestfulClientConst.MAX_RESPONSE_HEADER_SIZE);
+ setIntOption(obj, RestfulClientConst.MAX_REQUEST_HEADER_SIZE);
+ } else {
+ LOG.error("failed to load json from " + configfile);
+ }
+ }
+
+ private void setStringOption(final JSONObject json, final String key) {
+ if(json.has(key)) {
+ options.setOption(key, json.getString(key));
+ }
+ }
+
+ private void setIntOption(final JSONObject json, final String key) {
+ if(json.has(key)) {
+ options.setOption(key, json.getInt(key));
+ }
+ }
+
+ private RestfulOptions getDefaultOptions() {
+ options = new RestfulOptions();
+ options.setOption(RestfulClientConst.CONN_TIMEOUT_KEY_NAME, 3000);
+ options.setOption(RestfulClientConst.THREAD_KEY_NAME, 200);
+ options.setOption(RestfulClientConst.IDLE_TIMEOUT_KEY_NAME, 30000);
+ options.setOption(RestfulClientConst.TIMEOUT_KEY_NAME, 30000);
+ options.setOption(RestfulClientConst.MAX_CONN_PER_ADDR_KEY_NAME, 50);
+ options.setOption(RestfulClientConst.MAX_RESPONSE_HEADER_SIZE, 20 * 1024);
+ options.setOption(RestfulClientConst.MAX_REQUEST_HEADER_SIZE, 20 * 1024);
+ return options;
+ }
+
+ private JSONObject loadJsonFromFile(final String filePath) {
+ final File file = new File(filePath);
+ if((!file.exists()) || (!file.isFile())) {
+ LOG.error(filePath + "isn't exist.");
+ return null;
+ }
+ BufferedReader reader = null;
+ final StringBuilder jsonstr = new StringBuilder();
+ JSONObject jo = null;
+ try {
+ reader = new BufferedReader(new FileReader(file));
+ final ReaderHelper rHelpper = new ReaderHelper(reader);
+ String tempString = null;
+ while((tempString = rHelpper.getLine()) != null) {
+ jsonstr.append(tempString);
+ }
+ jo = JSONObject.fromObject(jsonstr.toString());
+ } catch(final IOException e) {
+ LOG.error("load file exception:" + e);
+ } finally {
+ if(reader != null) {
+ try {
+ reader.close();
+ } catch(final IOException e) {
+ LOG.error("close error.", e);
+ }
+ }
+ }
+ return jo;
+ }
+}
diff --git a/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulFactory.java b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulFactory.java
new file mode 100644
index 0000000..5b94374
--- /dev/null
+++ b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulFactory.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * RestFul instance factory. <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 28-May-2016
+ */
+public class RestfulFactory {
+
+ /**
+ * https protocol.
+ */
+ public static final String PROTO_HTTPS = "https";
+
+ /**
+ * http protocol.
+ */
+ public static final String PROTO_HTTP = "http";
+
+ private static final Logger LOG = LoggerFactory.getLogger(RestfulFactory.class);
+
+ private static final Map<String, Restful> INSTANCES = new HashMap<>(2);
+
+ private RestfulFactory() {
+
+ }
+
+ /**
+ * Get RESTful instance. This method returns a singleton instance.
+ * <br/>
+ *
+ * @param protocol protocol. currently only support 'http'.
+ * @return restful instance.
+ * @since
+ */
+ public static synchronized Restful getRestInstance(final String protocol) {
+ Restful rest = INSTANCES.get(protocol);
+ if(rest != null) {
+ return rest;
+ }
+ if(PROTO_HTTP.equals(protocol)) {
+ rest = createHttpRest();
+ INSTANCES.put(protocol, rest);
+ }
+ return rest;
+ }
+
+ private static Restful createHttpRest() {
+ final HttpRest rest = new HttpRest();
+ setRestOption(rest, null);
+ return rest;
+ }
+
+ private static void setRestOption(final HttpRest rest, final String restoptionfile) {
+ try {
+ RestfulConfigure config;
+ if(restoptionfile == null || restoptionfile.isEmpty()) {
+ config = new RestfulConfigure();
+ } else {
+ config = new RestfulConfigure(restoptionfile);
+ }
+
+ final RestfulOptions option = config.getOptions();
+ rest.initHttpRest(option);
+ } catch(final ServiceException e) {
+ LOG.error("init http client exception: ", e);
+ }
+ }
+}
diff --git a/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulOptions.java b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulOptions.java
new file mode 100644
index 0000000..6e5812f
--- /dev/null
+++ b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulOptions.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Options for Rest communication.<br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 28-May-2016
+ */
+public class RestfulOptions {
+
+ public static final String REST_OPTIONS_NAME_TIMEOUT = "timeout";
+
+ public static final int REST_OPTIONS_TIMEOUT_MAXTIMEOUT = 1800000;
+
+ private final Map<String, Object> optionsMap = new HashMap<>();
+
+ /**
+ * Get port.<br/>
+ *
+ * @return port.
+ * @since
+ */
+ public int getPort() {
+ final Object obj = this.getOption(RestfulClientConst.PORT_KEY_NAME);
+ if(null == obj) {
+ return 0;
+ }
+ return ((Integer)obj).intValue();
+ }
+
+ /**
+ * Set port.<br/>
+ *
+ * @param port port to set.
+ * @return
+ * @since
+ */
+ public boolean setPort(final int port) {
+ this.setOption(RestfulClientConst.PORT_KEY_NAME, port);
+ return true;
+ }
+
+ /**
+ * Get host.<br/>
+ *
+ * @return the host.
+ * @since
+ */
+ public String getHost() {
+ final Object obj = this.getOption(RestfulClientConst.HOST_KEY_NAME);
+ if(null == obj) {
+ return "";
+ }
+ return (String)obj;
+ }
+
+ /**
+ * Set host.<br/>
+ *
+ * @param host host to set.
+ * @return
+ * @since
+ */
+ public boolean setHost(final String host) {
+ this.setOption(RestfulClientConst.HOST_KEY_NAME, host);
+ return true;
+ }
+
+ /**
+ * Set rest time-out.<br/>
+ *
+ * @param timeout time-out to set in seconds.
+ * @return
+ * @since
+ */
+ public boolean setRestTimeout(final int timeout) {
+ if(0 < timeout && REST_OPTIONS_TIMEOUT_MAXTIMEOUT >= timeout) {
+ this.setOption(REST_OPTIONS_NAME_TIMEOUT, timeout);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Get time-out.<br/>
+ *
+ * @return time-out in seconds.
+ * @since
+ */
+ public int getRestTimeout() {
+ final Object obj = this.getOption(REST_OPTIONS_NAME_TIMEOUT);
+ if(null == obj) {
+ return 0;
+ }
+ return ((Integer)obj).intValue();
+ }
+
+ /**
+ * Get specified option.<br/>
+ *
+ * @param optionName option name.
+ * @return option
+ * @since
+ */
+ public Object getOption(final String optionName) {
+ return optionsMap.get(optionName);
+ }
+
+ /**
+ * Get option value as integer.<br/>
+ *
+ * @param optionName option name.
+ * @return option value as int.
+ * @since
+ */
+ public int getIntOption(final String optionName) {
+ final Object obj = this.getOption(optionName);
+ if(null == obj) {
+ return 0;
+ }
+ return ((Integer)obj).intValue();
+ }
+
+ /**
+ * Get option value as string.<br/>
+ *
+ * @param optionName option name.
+ * @return option value as string.
+ * @since
+ */
+ public String getStringOption(final String optionName) {
+ final Object obj = this.getOption(optionName);
+ if(null == obj) {
+ return "";
+ }
+ return (String)obj;
+ }
+
+ /**
+ * Set option.<br/>
+ *
+ * @param option option name.
+ * @param optionsValue option value.
+ * @return
+ * @since
+ */
+ public Object setOption(final String option, final Object optionsValue) {
+ return optionsMap.put(option, optionsValue);
+ }
+}
diff --git a/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulParametes.java b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulParametes.java
new file mode 100644
index 0000000..aea8753
--- /dev/null
+++ b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulParametes.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version Aug 9, 2016
+ */
+public class RestfulParametes {
+
+ private Map<String, String> paramMap = new HashMap<>();
+
+ private Map<String, String> headerMap = new HashMap<>();
+
+ private String rawData = null;
+
+ /**
+ * <br/>
+ *
+ * @param key
+ * @return
+ * @since
+ */
+ public String get(final String key) {
+ return paramMap.get(key);
+ }
+
+ /**
+ * <br/>
+ *
+ * @param data
+ * @since
+ */
+ public void setRawData(final String data) {
+ this.rawData = data;
+ }
+
+ /**
+ * <br/>
+ *
+ * @return
+ * @since
+ */
+ public String getRawData() {
+ return this.rawData;
+ }
+
+ /**
+ * <br/>
+ *
+ * @param key
+ * @param value
+ * @return
+ * @since
+ */
+ public String put(final String key, final String value) {
+ return paramMap.put(key, value);
+ }
+
+ /**
+ * <br/>
+ *
+ * @param key
+ * @param value
+ * @return
+ * @since
+ */
+ public String putHttpContextHeader(final String key, final String value) {
+ return headerMap.put(key, value);
+ }
+
+ /**
+ * <br/>
+ *
+ * @param key
+ * @param value
+ * @return
+ * @since
+ */
+ public String putHttpContextHeader(final String key, final int value) {
+ return this.putHttpContextHeader(key, String.valueOf(value));
+ }
+
+ /**
+ * <br/>
+ *
+ * @param key
+ * @return
+ * @since
+ */
+ public String getHttpContextHeader(final String key) {
+ return headerMap.get(key);
+ }
+
+ /**
+ * <br/>
+ *
+ * @return
+ * @since
+ */
+ public Map<String, String> getParamMap() {
+ return paramMap;
+ }
+
+ /**
+ * <br/>
+ *
+ * @param paramMap
+ * @since
+ */
+ public void setParamMap(final Map<String, String> paramMap) {
+ this.paramMap = paramMap;
+ }
+
+ /**
+ * <br/>
+ *
+ * @return
+ * @since
+ */
+ public Map<String, String> getHeaderMap() {
+ return this.headerMap;
+ }
+
+ /**
+ * <br/>
+ *
+ * @param headerMap
+ * @since
+ */
+ public void setHeaderMap(final Map<String, String> headerMap) {
+ this.headerMap = headerMap;
+ }
+}
diff --git a/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulResponse.java b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulResponse.java
new file mode 100644
index 0000000..25105b7
--- /dev/null
+++ b/wso2/rest-client/src/main/java/org/openo/baseservice/roa/util/restclient/RestfulResponse.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+import java.util.Map;
+
+/**
+ * Response for RestFul requests.<br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 28-May-2016
+ */
+public class RestfulResponse {
+
+ private String responseContent;
+
+ private int status = -1;
+
+ private Map<String, String> respHeaderMap = null;
+
+ /**
+ * <br/>
+ *
+ * @return
+ * @since
+ */
+ public int getStatus() {
+ return status;
+ }
+
+ /**
+ * <br/>
+ *
+ * @param status
+ * @since
+ */
+ public void setStatus(final int status) {
+ this.status = status;
+ }
+
+ /**
+ * <br/>
+ *
+ * @return
+ * @since
+ */
+ public Map<String, String> getRespHeaderMap() {
+ return respHeaderMap;
+ }
+
+ /**
+ * <br/>
+ *
+ * @param header
+ * @since
+ */
+ public void setRespHeaderMap(final Map<String, String> header) {
+ this.respHeaderMap = header;
+ }
+
+ /**
+ * Get response header value as integer.<br/>
+ *
+ * @param key header param name.
+ * @return header param value as integer. (-1 if error)
+ * @since
+ */
+ public int getRespHeaderInt(final String key) {
+ if(respHeaderMap != null) {
+ final String result = respHeaderMap.get(key);
+ if(result != null) {
+ return Integer.parseInt(result);
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Get response header value as long.<br/>
+ *
+ * @param key header param name.
+ * @return value as long. -1 if no value.
+ * @since
+ */
+ public long getRespHeaderLong(final String key) {
+ if(respHeaderMap != null) {
+ final String result = respHeaderMap.get(key);
+ if(result != null) {
+ return Long.parseLong(result);
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Get http header as string.<br/>
+ *
+ * @param key header name.
+ * @return header value.
+ * @since
+ */
+ public String getRespHeaderStr(final String key) {
+ if(respHeaderMap != null) {
+ return respHeaderMap.get(key);
+ }
+ return null;
+ }
+
+ /**
+ * <br/>
+ *
+ * @return
+ * @since
+ */
+ public String getResponseContent() {
+ return responseContent;
+ }
+
+ /**
+ * <br/>
+ *
+ * @param responseString
+ * @since
+ */
+ public void setResponseJson(final String responseString) {
+ this.responseContent = responseString;
+ }
+}
diff --git a/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/ReaderHelperTest.java b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/ReaderHelperTest.java
new file mode 100644
index 0000000..9922476
--- /dev/null
+++ b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/ReaderHelperTest.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.Reader;
+import java.io.StringReader;
+
+import junit.framework.Assert;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 12-Jun-2016
+ */
+public class ReaderHelperTest {
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for {@link org.openo.baseservice.util.inf.ReaderHelper#getLine()}.
+ */
+ @Test
+ public void testGetLine() {
+ final String message = "hello.. how are you?";
+ final Reader reader = new StringReader(message);
+ final ReaderHelper helper = new ReaderHelper(reader);
+ final String actual = helper.getLine();
+ Assert.assertEquals(message, actual);
+ }
+
+ /**
+ * Test method for {@link org.openo.baseservice.util.inf.ReaderHelper#getLine()}.
+ */
+ @Test
+ public void testGetLineMultiLine() {
+ final String line1 = "hello.. how are you?";
+ final String line2 = "I am fine.";
+ final Reader reader = new StringReader(line1 + System.lineSeparator() + line2);
+ final ReaderHelper helper = new ReaderHelper(reader);
+ String actual = helper.getLine();
+ Assert.assertEquals(line1, actual);
+ actual = helper.getLine();
+ Assert.assertEquals(line2, actual);
+ actual = helper.getLine();
+ Assert.assertEquals(null, actual);
+ }
+
+ @Test
+ public void testGetLineNull() {
+ final ReaderHelper helper = new ReaderHelper(null);
+ final String actual = helper.getLine();
+ Assert.assertEquals(null, actual);
+
+ }
+
+}
diff --git a/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/TestServiceUtil.java b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/TestServiceUtil.java
new file mode 100644
index 0000000..d99d562
--- /dev/null
+++ b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/TestServiceUtil.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 13-Jun-2016
+ */
+public class TestServiceUtil {
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetServiceHost() {
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetServicePort() {
+ }
+}
diff --git a/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestHttpRest.java b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestHttpRest.java
new file mode 100644
index 0000000..47d4ac8
--- /dev/null
+++ b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestHttpRest.java
@@ -0,0 +1,1179 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Field;
+import java.net.URLEncoder;
+
+import org.eclipse.jetty.client.HttpClient;
+import org.eclipse.jetty.client.HttpExchange;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+
+import mockit.Mock;
+import mockit.MockUp;
+import mockit.Mocked;
+import mockit.NonStrictExpectations;
+import mockit.integration.junit4.JMockit;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 13-Jun-2016
+ */
+@RunWith(JMockit.class)
+public class TestHttpRest {
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testInitHttpRest() throws Exception {
+ final RestfulOptions options = new RestfulOptions();
+ new MockUp<HttpClient>() {
+
+ @Mock
+ public void doStart() {
+ System.out.println("started");
+ }
+ };
+ final HttpRest httpRest = new HttpRest();
+ httpRest.initHttpRest(options);
+ final Field httpClient = HttpBaseRest.class.getDeclaredField("client");
+ httpClient.setAccessible(true);
+ Assert.assertNotNull(httpClient.get(httpRest));
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testInitHttpRestExcpetion() throws Exception {
+ final RestfulOptions options = new RestfulOptions();
+ new MockUp<HttpClient>() {
+
+ @Mock
+ public void doStart() throws Exception {
+ throw new Exception();
+ }
+ };
+ final HttpRest httpRest = new HttpRest();
+ thrown.expect(ServiceException.class);
+ thrown.expectMessage("http client init failed.");
+ httpRest.initHttpRest(options);
+ final Field httpClient = HttpRest.class.getDeclaredField("client");
+ httpClient.setAccessible(true);
+ Assert.assertNull(httpClient.get(httpRest));
+ System.out.println("finished");
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testInitHttpRestNull() throws Exception {
+ final HttpRest httpRest = new HttpRest();
+ thrown.expect(ServiceException.class);
+ thrown.expectMessage("option is null.");
+ httpRest.initHttpRest(null);
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws NoSuchFieldException
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testCreateRestHttpContentExchange() throws NoSuchFieldException, Exception {
+ final HttpBaseRest httpRest = new HttpRest();
+ final RestfulAsyncCallback callback = new RestfulAsyncCallback() {
+
+ @Override
+ public void callback(final RestfulResponse response) {
+
+ }
+
+ @Override
+ public void handleExcepion(final Throwable e) {
+
+ }
+
+ };
+ final RestHttpContentExchange exchange = httpRest.createRestHttpContentExchange(callback);
+ assertNotNull(exchange);
+ final Field callbackField = RestHttpContentExchange.class.getDeclaredField("callback");
+ assertNotNull(callbackField);
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testGetStringRestfulParametes() throws Exception {
+ final RestfulOptions options = new RestfulOptions();
+
+ final HttpRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone");
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+ final RestfulParametes parametes = new RestfulParametes();
+ parametes.put("id", "1234");
+ parametes.put("name", "some-name");
+ parametes.put("address", null);
+ parametes.putHttpContextHeader("Content-Type", "application/json");
+ parametes.putHttpContextHeader("Accept-Encoding", "*/*");
+ final RestfulResponse response = httpRest.get("path/to/service", parametes);
+ assertEquals(HttpExchange.STATUS_COMPLETED, response.getStatus());
+
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testGetStringRestfulParametesRestfulOptions() throws Exception {
+ final RestfulOptions options = new RestfulOptions();
+
+ final HttpRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone");
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+ final RestfulResponse response = httpRest.get("path/to/service", new RestfulParametes(), options);
+ assertEquals(HttpExchange.STATUS_COMPLETED, response.getStatus());
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testGetStringRestfulParametesEncodeError() throws Exception {
+ final RestfulOptions options = new RestfulOptions();
+
+ final HttpRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone");
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+
+ new NonStrictExpectations() {
+
+ @Mocked
+ URLEncoder encoder;
+
+ {
+ URLEncoder.encode(anyString, RestfulClientConst.ENCODING);
+ result = new UnsupportedEncodingException();
+ }
+
+ };
+
+ thrown.expect(ServiceException.class);
+ thrown.expectMessage("Broken VM does not support");
+
+ final RestfulParametes parametes = new RestfulParametes();
+ parametes.put("id", "1234");
+ parametes.put("name", "some-name");
+ parametes.put("address", null);
+ parametes.putHttpContextHeader("Content-Type", "application/json");
+ parametes.putHttpContextHeader("Accept-Encoding", "*/*");
+ final RestfulResponse response = httpRest.get("path/to/service", parametes);
+ assertEquals(HttpExchange.STATUS_COMPLETED, response.getStatus());
+
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testHeadStringRestfulParametes() throws Exception {
+ final RestfulOptions options = new RestfulOptions();
+
+ final HttpRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone");
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+ final RestfulParametes parametes = new RestfulParametes();
+ parametes.put("id", "1234");
+ parametes.put("name", "some-name");
+ parametes.put("address", null);
+ parametes.putHttpContextHeader("Content-Type", "");
+ parametes.putHttpContextHeader("Accept-Encoding", "");
+ final RestfulResponse response = httpRest.head("path/to/service", parametes);
+ assertEquals(HttpExchange.STATUS_COMPLETED, response.getStatus());
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testHeadStringRestfulParametesRestfulOptions() throws Exception {
+ final RestfulOptions options = new RestfulOptions();
+
+ final HttpRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone");
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+ final RestfulParametes parametes = new RestfulParametes();
+ parametes.put("id", "1234");
+ parametes.put("name", "some-name");
+ parametes.put("address", null);
+ parametes.putHttpContextHeader("Content-Type", "");
+ parametes.putHttpContextHeader("Accept-Encoding", "");
+ final RestfulResponse response = httpRest.head("path/to/service", parametes, options);
+ assertEquals(HttpExchange.STATUS_COMPLETED, response.getStatus());
+ }
+
+ /**
+ * <br/>
+ *
+ * @param options
+ * @return
+ * @throws ServiceException
+ * @since
+ */
+ private HttpRest getHttpRest(final RestfulOptions options) throws ServiceException {
+ final HttpRest httpRest = new HttpRest();
+ {
+ new MockUp<HttpClient>() {
+
+ @Mock
+ public void doStart() {
+ System.out.println("started");
+ }
+
+ @Mock
+ public void send(final HttpExchange exchange) throws IOException {
+ System.out.println("send");
+ }
+ };
+ httpRest.initHttpRest(options);
+
+ }
+ return httpRest;
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testAsyncGetStringRestfulParametesRestfulAsyncCallback() throws Exception {
+ final RestfulOptions options = new RestfulOptions();
+
+ final HttpRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone");
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+
+ final RestfulAsyncCallback callback = new RestfulAsyncCallback() {
+
+ @Override
+ public void callback(final RestfulResponse response) {
+ System.out.println("callback called.");
+
+ }
+
+ @Override
+ public void handleExcepion(final Throwable e) {
+
+ System.out.println("handleExcepion called.");
+ }
+
+ };
+ httpRest.asyncGet("path/to/service", new RestfulParametes(), callback);
+ httpRest.asyncGet("path/to/service", new RestfulParametes(), null);
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws ServiceException
+ * @since
+ */
+ @Test
+ public void testAsyncGetStringRestfulParametesRestfulOptionsRestfulAsyncCallback() throws ServiceException {
+ final RestfulOptions options = new RestfulOptions();
+
+ final HttpRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone");
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+
+ final RestfulAsyncCallback callback = new RestfulAsyncCallback() {
+
+ @Override
+ public void callback(final RestfulResponse response) {
+ System.out.println("callback called.");
+
+ }
+
+ @Override
+ public void handleExcepion(final Throwable e) {
+
+ System.out.println("handleExcepion called.");
+ }
+
+ };
+ httpRest.asyncGet("path/to/service", new RestfulParametes(), new RestfulOptions(), callback);
+ httpRest.asyncGet("path/to/service", new RestfulParametes(), new RestfulOptions(), null);
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws ServiceException
+ * @since
+ */
+ @Test
+ public void testPutStringRestfulParametes() throws ServiceException {
+ final RestfulOptions options = new RestfulOptions();
+
+ final HttpRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone");
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+ final RestfulParametes parametes = new RestfulParametes();
+ parametes.put("id", "1234");
+ parametes.put("name", "some-name");
+ parametes.put("address", null);
+ parametes.putHttpContextHeader("Content-Type", "");
+ parametes.putHttpContextHeader("Accept-Encoding", "");
+ final RestfulResponse response = httpRest.put("path/to/service", parametes);
+ assertEquals(HttpExchange.STATUS_COMPLETED, response.getStatus());
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws ServiceException
+ * @since
+ */
+ @Test
+ public void testPutStringRestfulParametesRestfulOptions() throws ServiceException {
+
+ final RestfulOptions options = new RestfulOptions();
+
+ final HttpRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone");
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+ final RestfulParametes parametes = new RestfulParametes();
+ parametes.put("id", "1234");
+ parametes.put("name", "some-name");
+ parametes.put("address", null);
+ parametes.putHttpContextHeader("Content-Type", "");
+ parametes.putHttpContextHeader("Accept-Encoding", "");
+ final RestfulResponse response = httpRest.put("path/to/service", parametes, null);
+ assertEquals(HttpExchange.STATUS_COMPLETED, response.getStatus());
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws ServiceException
+ * @since
+ */
+ @Test
+ public void testAsyncPutStringRestfulParametesRestfulAsyncCallback() throws ServiceException {
+ final RestfulOptions options = new RestfulOptions();
+
+ final HttpRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone");
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+
+ final RestfulAsyncCallback callback = new RestfulAsyncCallback() {
+
+ @Override
+ public void callback(final RestfulResponse response) {
+ System.out.println("callback called.");
+
+ }
+
+ @Override
+ public void handleExcepion(final Throwable e) {
+
+ System.out.println("handleExcepion called.");
+ }
+
+ };
+ httpRest.asyncPut("path/to/service", new RestfulParametes(), callback);
+ httpRest.asyncPut("path/to/service", new RestfulParametes(), null);
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testAsyncPutStringRestfulParametesRestfulOptionsRestfulAsyncCallback() throws Exception {
+ final RestfulOptions options = new RestfulOptions();
+
+ final HttpRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone");
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+
+ final RestfulAsyncCallback callback = new RestfulAsyncCallback() {
+
+ @Override
+ public void callback(final RestfulResponse response) {
+ System.out.println("callback called.");
+
+ }
+
+ @Override
+ public void handleExcepion(final Throwable e) {
+
+ System.out.println("handleExcepion called.");
+ }
+
+ };
+ httpRest.asyncPut("path/to/service", new RestfulParametes(), new RestfulOptions(), callback);
+ httpRest.asyncPut("path/to/service", new RestfulParametes(), new RestfulOptions(), null);
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testPostStringRestfulParametes() throws Exception {
+ final RestfulOptions options = new RestfulOptions();
+
+ final HttpBaseRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone");
+ return HttpExchange.STATUS_EXPIRED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_EXPIRED);
+ return response;
+ }
+
+ };
+ final RestfulParametes parameters = new RestfulParametes();
+ parameters.put("id", "1234");
+ parameters.put("name", "some-name");
+ parameters.put("address", null);
+ parameters.putHttpContextHeader("Content-Type", "");
+ parameters.putHttpContextHeader("Accept-Encoding", "");
+
+ thrown.expect(ServiceException.class);
+ thrown.expectMessage("request is expierd");
+ final RestfulResponse response = httpRest.post("http://localhost:80/path/to/service", parameters);
+ assertEquals(HttpExchange.STATUS_EXPIRED, response.getStatus());
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws ServiceException
+ * @since
+ */
+ @Test
+ public void testPostStringRestfulParametesRestfulOptions() throws ServiceException {
+ final RestfulOptions options = new RestfulOptions();
+
+ final HttpBaseRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone" + HttpExchange.STATUS_EXCEPTED);
+ return HttpExchange.STATUS_EXCEPTED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+ final RestfulParametes parameters = new RestfulParametes();
+ parameters.put("id", "1234");
+ parameters.put("name", "some-name");
+ parameters.put("address", null);
+ parameters.setRawData("{ \"data\"=\"sample JSON data\"");
+ parameters.putHttpContextHeader("Content-Type", "");
+ parameters.putHttpContextHeader("Accept-Encoding", "");
+ thrown.expect(ServiceException.class);
+ thrown.expectMessage("request is exception");
+ final RestfulResponse response = httpRest.post("path/to/service", parameters, null);
+ assertEquals(HttpExchange.STATUS_COMPLETED, response.getStatus());
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testAsyncPostStringRestfulParametesRestfulAsyncCallback() throws Exception {
+ final RestfulOptions options = new RestfulOptions();
+ options.setRestTimeout(10);
+
+ final HttpBaseRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone:" + HttpExchange.STATUS_EXCEPTED);
+ return 99;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_EXCEPTED);
+ return response;
+ }
+
+ };
+
+ final RestfulAsyncCallback callback = new RestfulAsyncCallback() {
+
+ @Override
+ public void callback(final RestfulResponse response) {
+ System.out.println("callback called.");
+
+ }
+
+ @Override
+ public void handleExcepion(final Throwable e) {
+
+ System.out.println("handleExcepion called.");
+ }
+
+ };
+ httpRest.asyncPost("path/to/service", new RestfulParametes(), options, callback);
+ httpRest.asyncPost("path/to/service", new RestfulParametes(), options, null);
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws ServiceException
+ * @since
+ */
+ @Test
+ public void testAsyncPostStringRestfulParametesRestfulOptionsRestfulAsyncCallback() throws ServiceException {
+ final RestfulOptions options = new RestfulOptions();
+ options.setRestTimeout(10);
+
+ final HttpBaseRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone:" + HttpExchange.STATUS_COMPLETED);
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+
+ final RestfulAsyncCallback callback = new RestfulAsyncCallback() {
+
+ @Override
+ public void callback(final RestfulResponse response) {
+ System.out.println("callback called.");
+
+ }
+
+ @Override
+ public void handleExcepion(final Throwable e) {
+
+ System.out.println("handleExcepion called.");
+ }
+
+ };
+ httpRest.asyncPost("path/to/service", new RestfulParametes(), options, callback);
+ httpRest.asyncPost("path/to/service", new RestfulParametes(), options, null);
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws ServiceException
+ * @since
+ */
+ @Test
+ public void testDeleteStringRestfulParametes() throws ServiceException {
+ final RestfulOptions options = new RestfulOptions();
+
+ final HttpBaseRest httpRest = getHttpRest(options);
+
+ final RestfulResponse response = httpRest.delete("path/to/service", null);
+ assertEquals(-1, response.getStatus());
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws ServiceException
+ * @since
+ */
+ @Test
+ public void testDeleteStringRestfulParametesRestfulOptions() throws ServiceException {
+ final RestfulOptions options = new RestfulOptions();
+
+ final HttpBaseRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone" + HttpExchange.STATUS_COMPLETED);
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+ final RestfulParametes parameters = new RestfulParametes();
+ parameters.put("id", "1234");
+ parameters.put("name", "some-name");
+ parameters.put("address", null);
+ parameters.setRawData("{ \"data\"=\"sample JSON data\"");
+ parameters.putHttpContextHeader("Content-Type", "");
+ parameters.putHttpContextHeader("Accept-Encoding", "");
+ final RestfulResponse response = httpRest.delete("path/to/service", parameters, options);
+ assertEquals(HttpExchange.STATUS_COMPLETED, response.getStatus());
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws ServiceException
+ * @since
+ */
+ @Test
+ public void testAsyncDeleteStringRestfulParametesRestfulAsyncCallback() throws ServiceException {
+ final RestfulOptions options = new RestfulOptions();
+ options.setRestTimeout(10);
+
+ final HttpBaseRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone:" + HttpExchange.STATUS_COMPLETED);
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+
+ final RestfulAsyncCallback callback = new RestfulAsyncCallback() {
+
+ @Override
+ public void callback(final RestfulResponse response) {
+ System.out.println("callback called.");
+
+ }
+
+ @Override
+ public void handleExcepion(final Throwable e) {
+
+ System.out.println("handleExcepion called.");
+ }
+
+ };
+ httpRest.asyncDelete("path/to/service", new RestfulParametes(), callback);
+ httpRest.asyncDelete("path/to/service", new RestfulParametes(), null);
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws ServiceException
+ * @since
+ */
+ @Test
+ public void testAsyncDeleteStringRestfulParametesRestfulOptionsRestfulAsyncCallback() throws ServiceException {
+ final RestfulOptions options = new RestfulOptions();
+ options.setRestTimeout(10);
+
+ final HttpBaseRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone:" + HttpExchange.STATUS_COMPLETED);
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+
+ final RestfulAsyncCallback callback = new RestfulAsyncCallback() {
+
+ @Override
+ public void callback(final RestfulResponse response) {
+ System.out.println("callback called.");
+
+ }
+
+ @Override
+ public void handleExcepion(final Throwable e) {
+
+ System.out.println("handleExcepion called.");
+ }
+
+ };
+ httpRest.asyncDelete("path/to/service", new RestfulParametes(), options, callback);
+ httpRest.asyncDelete("path/to/service", new RestfulParametes(), options, null);
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws ServiceException
+ * @since
+ */
+ @Test
+ public void testPatchStringRestfulParametes() throws ServiceException {
+ final RestfulOptions options = new RestfulOptions();
+
+ final HttpBaseRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone" + HttpExchange.STATUS_COMPLETED);
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+ final RestfulParametes parameters = new RestfulParametes();
+ parameters.put("id", "1234");
+ parameters.put("name", "some-name");
+ parameters.put("address", null);
+ parameters.setRawData("{ \"data\"=\"sample JSON data\"");
+ parameters.putHttpContextHeader("Content-Type", "");
+ parameters.putHttpContextHeader("Accept-Encoding", "");
+ final RestfulResponse response = httpRest.patch("path/to/service", parameters);
+ assertEquals(HttpExchange.STATUS_COMPLETED, response.getStatus());
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws ServiceException
+ * @since
+ */
+ @Test
+ public void testPatchStringRestfulParametesRestfulOptions() throws ServiceException {
+ final RestfulOptions options = new RestfulOptions();
+
+ final HttpBaseRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone" + HttpExchange.STATUS_COMPLETED);
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+ final RestfulParametes parameters = new RestfulParametes();
+ parameters.put("id", "1234");
+ parameters.put("name", "some-name");
+ parameters.put("address", null);
+ parameters.setRawData("{ \"data\"=\"sample JSON data\"");
+ parameters.putHttpContextHeader("Content-Type", "");
+ parameters.putHttpContextHeader("Accept-Encoding", "");
+ final RestfulResponse response = httpRest.patch("path/to/service", parameters, options);
+ assertEquals(HttpExchange.STATUS_COMPLETED, response.getStatus());
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws ServiceException
+ * @since
+ */
+ @Test
+ public void testAsyncPatchStringRestfulParametesRestfulAsyncCallback() throws ServiceException {
+ final RestfulOptions options = new RestfulOptions();
+ options.setRestTimeout(10);
+
+ final HttpBaseRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone:" + HttpExchange.STATUS_COMPLETED);
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+
+ final RestfulAsyncCallback callback = new RestfulAsyncCallback() {
+
+ @Override
+ public void callback(final RestfulResponse response) {
+ System.out.println("callback called.");
+
+ }
+
+ @Override
+ public void handleExcepion(final Throwable e) {
+
+ System.out.println("handleExcepion called.");
+ }
+
+ };
+ httpRest.asyncPatch("path/to/service", new RestfulParametes(), callback);
+ httpRest.asyncPatch("path/to/service", new RestfulParametes(), null);
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws ServiceException
+ * @since
+ */
+ @Test
+ public void testAsyncPatchStringRestfulParametesRestfulOptionsRestfulAsyncCallback() throws ServiceException {
+ final RestfulOptions options = new RestfulOptions();
+ options.setRestTimeout(10);
+
+ final HttpBaseRest httpRest = getHttpRest(options);
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public int waitForDone() {
+ System.out.println("waitForDone:" + HttpExchange.STATUS_COMPLETED);
+ return HttpExchange.STATUS_COMPLETED;
+ }
+
+ @Mock
+ public RestfulResponse getResponse() throws IOException {
+ final RestfulResponse response = new RestfulResponse();
+ response.setStatus(HttpExchange.STATUS_COMPLETED);
+ return response;
+ }
+
+ };
+
+ final RestfulAsyncCallback callback = new RestfulAsyncCallback() {
+
+ @Override
+ public void callback(final RestfulResponse response) {
+ System.out.println("callback called.");
+
+ }
+
+ @Override
+ public void handleExcepion(final Throwable e) {
+
+ System.out.println("handleExcepion called.");
+ }
+
+ };
+ httpRest.asyncPatch("path/to/service", new RestfulParametes(), options, callback);
+ httpRest.asyncPatch("path/to/service", new RestfulParametes(), options, null);
+ }
+
+}
diff --git a/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestHttpContentExchange.java b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestHttpContentExchange.java
new file mode 100644
index 0000000..dbd1b1e
--- /dev/null
+++ b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestHttpContentExchange.java
@@ -0,0 +1,592 @@
+/*
+ * Copyright 2016-2017 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.zip.GZIPInputStream;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.LogManager;
+import org.eclipse.jetty.client.Address;
+import org.eclipse.jetty.client.CachedExchange;
+import org.eclipse.jetty.client.HttpDestination;
+import org.eclipse.jetty.client.HttpExchange;
+import org.eclipse.jetty.http.HttpFields;
+import org.eclipse.jetty.http.HttpHeaders;
+import org.eclipse.jetty.io.Buffer;
+import org.eclipse.jetty.io.ByteArrayBuffer;
+import org.eclipse.jetty.util.StringUtil;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+
+import mockit.Mock;
+import mockit.MockUp;
+import mockit.Mocked;
+import mockit.integration.junit4.JMockit;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 20-Jun-2016
+ */
+@RunWith(JMockit.class)
+public class TestRestHttpContentExchange {
+
+ @Mocked
+ HttpDestination mockedDest;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @After
+ public void tearDown() throws Exception {
+ LogManager.getLogger(RestHttpContentExchange.class).setLevel(Level.ERROR);
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws IOException
+ * @since
+ */
+ @Test
+ public void testOnRequestCommitted() throws IOException {
+ final RestHttpContentExchange exchange = new RestHttpContentExchange(false, null);
+ final Address address = new Address("localhost", 9999);
+ exchange.setAddress(address);
+ exchange.setRequestURI("/the/request/uri");
+ exchange.onRequestCommitted();
+
+ LogManager.getLogger(RestHttpContentExchange.class).setLevel(Level.DEBUG);
+ exchange.onRequestCommitted();
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws IOException
+ * @since
+ */
+ @Test
+ public void testOnRequestComplete() throws IOException {
+ final RestHttpContentExchange exchange = new RestHttpContentExchange(false, null);
+ final Address address = new Address("localhost", 9999);
+ exchange.setAddress(address);
+ exchange.setRequestURI("/the/request/uri");
+ exchange.onRequestComplete();
+
+ LogManager.getLogger(RestHttpContentExchange.class).setLevel(Level.DEBUG);
+ exchange.onRequestComplete();
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testOnResponseComplete() throws Exception {
+ RestHttpContentExchange exchange = new RestHttpContentExchange(false, null);
+ final Address address = new Address("localhost", 9999);
+ exchange.setAddress(address);
+ exchange.setRequestURI("/the/request/uri");
+ exchange.onResponseComplete();
+
+ LogManager.getLogger(RestHttpContentExchange.class).setLevel(Level.DEBUG);
+ exchange.onResponseComplete();
+
+ final AtomicInteger isCallback = new AtomicInteger(0);
+ final AtomicInteger isException = new AtomicInteger(0);
+ final RestfulAsyncCallback callback = new RestfulAsyncCallback() {
+
+ @Override
+ public void callback(final RestfulResponse response) {
+ isCallback.set(1);
+ }
+
+ @Override
+ public void handleExcepion(final Throwable e) {
+ isException.set(1);
+ }
+
+ };
+
+ final Field statusField = HttpExchange.class.getDeclaredField("_status");
+ statusField.setAccessible(true);
+ exchange = new RestHttpContentExchange(false, callback);
+ statusField.set(exchange, new AtomicInteger(200));
+ exchange.setAddress(new Address("localhost", 9999));
+ exchange.setRequestURI("/the/request/uri");
+ exchange.onResponseComplete();
+ assertEquals(1, isCallback.get());
+ assertEquals(0, isException.get());
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ @Ignore
+ public void testDecompressGzipToStr() throws Exception {
+ final RestHttpContentExchange exchange = new RestHttpContentExchange(false, null);
+ final Address address = new Address("localhost", 9999);
+ exchange.setAddress(address);
+ exchange.setRequestURI("/the/request/uri");
+
+ final InputStream stream = ClassLoader.getSystemResourceAsStream("sample.txt.gz");
+ final byte[] binaryData = new byte[1024];
+ stream.read(binaryData);
+ final String expected = "sample data.";
+
+ final String actual = exchange.decompressGzipToStr(binaryData);
+
+ System.out.println("actual: '" + actual + "'");
+ System.out.println("expected: '" + expected + "'");
+ assertEquals(actual, expected);
+
+ new MockUp<ByteArrayInputStream>() {
+
+ @Mock
+ public int read() throws Exception {
+ throw new IOException();
+ }
+
+ @Mock
+ public int read(final byte abyte0[], final int i, final int j) {
+
+ return -1;
+ }
+
+ };
+
+ thrown.expect(IOException.class);
+ exchange.decompressGzipToStr(binaryData);
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ @Ignore
+ public void testDecompressGzipToStrException() throws Exception {
+ final RestHttpContentExchange exchange = new RestHttpContentExchange(false, null);
+ final Address address = new Address("localhost", 9999);
+ exchange.setAddress(address);
+ exchange.setRequestURI("/the/request/uri");
+
+ final InputStream stream = ClassLoader.getSystemResourceAsStream("sample.txt.gz");
+ final byte[] binaryData = new byte[1024];
+ stream.read(binaryData);
+ final String expected = "sample data.";
+
+ new MockUp<GZIPInputStream>() {
+
+ @Mock
+ public void close() throws IOException {
+ throw new IOException();
+ }
+
+ };
+
+ new MockUp<InputStreamReader>() {
+
+ @Mock
+ public void close() throws IOException {
+ throw new IOException();
+ }
+
+ };
+
+ new MockUp<ByteArrayInputStream>() {
+
+ @Mock
+ public void close() throws IOException {
+ throw new IOException();
+ }
+
+ };
+
+ final String actual = exchange.decompressGzipToStr(binaryData);
+
+ System.out.println("actual: '" + actual + "'");
+ System.out.println("expected: '" + expected + "'");
+ assertEquals(actual, expected);
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testDecompressGzipToStrNull() throws Exception {
+ final RestHttpContentExchange exchange = new RestHttpContentExchange(false, null);
+ final Address address = new Address("localhost", 9999);
+ exchange.setAddress(address);
+ exchange.setRequestURI("/the/request/uri");
+ final String expected = "";
+ final String actual = exchange.decompressGzipToStr(null);
+
+ System.out.println("actual: '" + actual + "'");
+ System.out.println("expected: '" + expected + "'");
+ assertEquals(actual, expected);
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testOnResponseHeaderBufferBuffer() throws Exception {
+ final RestHttpContentExchange exchange = new RestHttpContentExchange(false, null);
+ final Address address = new Address("localhost", 9999);
+ exchange.setAddress(address);
+ exchange.setRequestURI("/the/request/uri");
+
+ final Buffer name = new ByteArrayBuffer("key");
+ final Buffer value = new ByteArrayBuffer("value");
+ exchange.onResponseHeader(name, value);
+
+ new MockUp<HttpHeaders>() {
+
+ @Mock
+ public int getOrdinal(final Buffer buffer) {
+ return HttpHeaders.CONTENT_ENCODING_ORDINAL;
+ }
+
+ };
+ exchange.onResponseHeader(name, value);
+
+ new MockUp<StringUtil>() {
+
+ @Mock
+ public String asciiToLowerCase(final String s) {
+ return "gzip";
+ }
+
+ };
+ exchange.onResponseHeader(name, value);
+
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testOnExceptionThrowable() {
+ final RestHttpContentExchange exchange = new RestHttpContentExchange(false, null);
+ final Address address = new Address("localhost", 9999);
+ exchange.setAddress(address);
+ exchange.setRequestURI("/the/request/uri");
+ exchange.onException(new Exception());
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testOnExceptionThrowableWithCallback() {
+ final AtomicInteger isCallback = new AtomicInteger(0);
+ final AtomicInteger isException = new AtomicInteger(0);
+ final RestfulAsyncCallback callback = new RestfulAsyncCallback() {
+
+ @Override
+ public void callback(final RestfulResponse response) {
+ isCallback.set(1);
+ }
+
+ @Override
+ public void handleExcepion(final Throwable e) {
+ isException.set(1);
+ }
+
+ };
+ final RestHttpContentExchange exchange = new RestHttpContentExchange(true, callback);
+ final Address address = new Address("localhost", 9999);
+ exchange.setAddress(address);
+ exchange.setRequestURI("/the/request/uri");
+ exchange.onException(new Exception());
+ assertEquals(0, isCallback.get());
+ assertEquals(1, isException.get());
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testOnConnectionFailedThrowable() {
+ final RestHttpContentExchange exchange = new RestHttpContentExchange(false, null);
+ final Address address = new Address("localhost", 9999);
+ exchange.setAddress(address);
+ exchange.setRequestURI("/the/request/uri");
+ exchange.onConnectionFailed(new Exception());
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testOnConnectionFailedThrowableException() {
+ final AtomicInteger isCallback = new AtomicInteger(0);
+ final AtomicInteger isException = new AtomicInteger(0);
+ final RestfulAsyncCallback callback = new RestfulAsyncCallback() {
+
+ @Override
+ public void callback(final RestfulResponse response) {
+ isCallback.set(1);
+ }
+
+ @Override
+ public void handleExcepion(final Throwable e) {
+ isException.set(1);
+ }
+
+ };
+ final RestHttpContentExchange exchange = new RestHttpContentExchange(true, callback);
+ final Address address = new Address("localhost", 9999);
+ exchange.setAddress(address);
+ exchange.setRequestURI("/the/request/uri");
+ exchange.onConnectionFailed(new Exception());
+ assertEquals(0, isCallback.get());
+ assertEquals(1, isException.get());
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testExpireHttpDestination() {
+ final RestHttpContentExchange exchange = new RestHttpContentExchange(true, null);
+ final Address address = new Address("localhost", 9999);
+ exchange.setAddress(address);
+ exchange.setRequestURI("/the/request/uri");
+ exchange.expire(mockedDest);
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testExpireHttpDestinationException() throws Exception {
+ final AtomicInteger isCallback = new AtomicInteger(0);
+ final AtomicInteger isException = new AtomicInteger(0);
+ final List<Throwable> thrSet = new ArrayList<Throwable>();
+ final RestfulAsyncCallback callback = new RestfulAsyncCallback() {
+
+ @Override
+ public void callback(final RestfulResponse response) {
+ isCallback.set(1);
+ }
+
+ @Override
+ public void handleExcepion(final Throwable e) {
+ isException.set(1);
+ thrSet.add(e);
+ }
+
+ };
+ final RestHttpContentExchange exchange = new RestHttpContentExchange(true, callback);
+ final Address address = new Address("localhost", 9999);
+ exchange.setAddress(address);
+ exchange.setRequestURI("/the/request/uri");
+ exchange.expire(mockedDest);
+ assertEquals(0, isCallback.get());
+ assertEquals(1, isException.get());
+ assertEquals(1, thrSet.size());
+ final Throwable t = thrSet.get(0);
+ assertEquals(ServiceException.class, t.getClass());
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testIsGzip() throws Exception {
+ final RestHttpContentExchange exchange = new RestHttpContentExchange(false, null);
+ final Address address = new Address("localhost", 9999);
+ exchange.setAddress(address);
+ exchange.setRequestURI("/the/request/uri");
+
+ final Buffer name = new ByteArrayBuffer("key");
+ final Buffer value = new ByteArrayBuffer("value");
+
+ new MockUp<HttpHeaders>() {
+
+ @Mock
+ public int getOrdinal(final Buffer buffer) {
+ return HttpHeaders.CONTENT_ENCODING_ORDINAL;
+ }
+
+ };
+ exchange.onResponseHeader(name, value);
+ assertFalse(exchange.isGzip());
+
+ new MockUp<StringUtil>() {
+
+ @Mock
+ public String asciiToLowerCase(final String s) {
+ return "gzip";
+ }
+
+ };
+ exchange.onResponseHeader(name, value);
+ assertTrue(exchange.isGzip());
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testGetResponse() throws Exception {
+ final RestHttpContentExchange exchange = new RestHttpContentExchange(false, null);
+ final Address address = new Address("localhost", 9999);
+ exchange.setAddress(address);
+ exchange.setRequestURI("/the/request/uri");
+
+ final Field statusField = HttpExchange.class.getDeclaredField("_status");
+ statusField.setAccessible(true);
+ statusField.set(exchange, new AtomicInteger(200));
+
+ RestfulResponse response = exchange.getResponse();
+ assertEquals(0, response.getStatus());
+
+ final HttpFields fields = new HttpFields();
+ final Field headerFields = CachedExchange.class.getDeclaredField("_responseFields");
+ headerFields.setAccessible(true);
+ headerFields.set(exchange, fields);
+ response = exchange.getResponse();
+ assertEquals(0, response.getStatus());
+ fields.add("Content-Type", "application/json");
+ fields.add("Content-Encode", "UTF-8");
+ response = exchange.getResponse();
+ assertEquals(0, response.getStatus());
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public void testGetResponseGzip() throws Exception {
+ final RestHttpContentExchange exchange = new RestHttpContentExchange(false, null);
+ final Address address = new Address("localhost", 9999);
+ exchange.setAddress(address);
+ exchange.setRequestURI("/the/request/uri");
+ new MockUp<RestHttpContentExchange>() {
+
+ @Mock
+ public boolean isGzip() {
+ return true;
+ }
+ };
+ final Field statusField = HttpExchange.class.getDeclaredField("_status");
+ statusField.setAccessible(true);
+ statusField.set(exchange, new AtomicInteger(200));
+
+ final RestfulResponse response = exchange.getResponse();
+ assertEquals(0, response.getStatus());
+ }
+}
diff --git a/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulConfigure.java b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulConfigure.java
new file mode 100644
index 0000000..7cc7b1e
--- /dev/null
+++ b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulConfigure.java
@@ -0,0 +1,238 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+import static org.junit.Assert.assertEquals;
+
+import org.openo.baseservice.util.impl.SystemEnvVariablesDefImpl;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import net.sf.json.JSONObject;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import mockit.Mock;
+import mockit.MockUp;
+import mockit.integration.junit4.JMockit;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 20-Jun-2016
+ */
+@RunWith(JMockit.class)
+public class TestRestfulConfigure {
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ setAppRoot();
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ private static void setAppRoot() {
+ final URL resource = ClassLoader.getSystemResource("etc/conf/restclient.json");
+ final String urlPath = resource.getPath().replace("etc/conf/restclient.json", "");
+
+ try {
+ final String path = new File(urlPath).getCanonicalPath();
+ System.out.println("path: " + path);
+
+ System.setProperty("catalina.base", path);
+ System.out.println("approot:" + System.getProperty("catalina.base"));
+ } catch(final IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ /**
+ * <br/>
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public final void testRestfulConfigure() throws Exception {
+ final RestfulConfigure configure = new RestfulConfigure();
+ final RestfulOptions options = configure.getOptions();
+ assertEquals("127.0.0.1", options.getHost());
+ assertEquals(8080, options.getPort());
+ assertEquals(1000, options.getIntOption("ConnectTimeout"));
+ assertEquals(10, options.getIntOption("thread"));
+ assertEquals(500000, options.getIntOption("idletimeout"));
+ assertEquals(10000, options.getIntOption("timeout"));
+
+ }
+
+ /**
+ * <br/>
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public final void testRestfulConfigureAppRootNull() throws Exception {
+ new MockUp<SystemEnvVariablesDefImpl>() {
+
+ @Mock
+ public String getAppRoot() {
+ return null;
+ }
+
+ };
+ final RestfulConfigure configure = new RestfulConfigure();
+ final RestfulOptions options = configure.getOptions();
+
+ assertEquals("", options.getHost());
+ assertEquals(0, options.getPort());
+ assertEquals(3000, options.getIntOption("ConnectTimeout"));
+ assertEquals(200, options.getIntOption("thread"));
+ assertEquals(30000, options.getIntOption("idletimeout"));
+ assertEquals(30000, options.getIntOption("timeout"));
+
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public final void testRestfulConfigureDefault() throws Exception {
+
+ {
+
+ new MockUp<File>() {
+
+ @Mock
+ public boolean isFile() {
+ return false;
+ }
+ };
+ final RestfulConfigure configure = new RestfulConfigure();
+ final RestfulOptions options = configure.getOptions();
+ assertEquals("", options.getHost());
+ assertEquals(0, options.getPort());
+ assertEquals(3000, options.getIntOption("ConnectTimeout"));
+ assertEquals(200, options.getIntOption("thread"));
+ assertEquals(30000, options.getIntOption("idletimeout"));
+ assertEquals(30000, options.getIntOption("timeout"));
+ }
+
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws Exception
+ * @since
+ */
+ @Test
+ public final void testRestfulConfigureException() throws Exception {
+
+ new MockUp<JSONObject>() {
+
+ @Mock
+ JSONObject fromObject(final Object object) throws IOException {
+ throw new IOException();
+ }
+ };
+
+ final RestfulConfigure configure = new RestfulConfigure();
+ final RestfulOptions options = configure.getOptions();
+ assertEquals("", options.getHost());
+ assertEquals(0, options.getPort());
+ assertEquals(3000, options.getIntOption("ConnectTimeout"));
+ assertEquals(200, options.getIntOption("thread"));
+ assertEquals(30000, options.getIntOption("idletimeout"));
+ assertEquals(30000, options.getIntOption("timeout"));
+
+ }
+
+ /**
+ *
+ * @since
+ */
+ @Test
+ public final void testRestfulConfigureString() {
+ final String configFile = "rest-client-test.json";
+ final String appRoot = System.getProperty("catalina.base");
+ final RestfulConfigure configure = new RestfulConfigure(appRoot + File.separator + configFile);
+ final RestfulOptions options = configure.getOptions();
+ assertEquals("10.10.10.10", options.getHost());
+ assertEquals(443, options.getPort());
+ assertEquals(10, options.getIntOption("ConnectTimeout"));
+ assertEquals(100, options.getIntOption("thread"));
+ assertEquals(30, options.getIntOption("idletimeout"));
+ assertEquals(60, options.getIntOption("timeout"));
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public final void testGetOptions() {
+ }
+} \ No newline at end of file
diff --git a/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulFactory.java b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulFactory.java
new file mode 100644
index 0000000..5678732
--- /dev/null
+++ b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulFactory.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import org.openo.baseservice.remoteservice.exception.ServiceException;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import mockit.Mock;
+import mockit.MockUp;
+import mockit.integration.junit4.JMockit;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 21-Jun-2016
+ */
+@RunWith(JMockit.class)
+public class TestRestfulFactory {
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetRestInstance() {
+ Restful instance = RestfulFactory.getRestInstance("https");
+ assertNull(instance);
+ new MockUp<HttpRest>() {
+
+ @Mock
+ public void initHttpRest(final RestfulOptions option) throws ServiceException {
+ throw new ServiceException();
+ }
+
+ };
+ instance = RestfulFactory.getRestInstance("http");
+ assertNotNull(instance);
+
+ instance = RestfulFactory.getRestInstance("http");
+ assertNotNull(instance);
+ }
+}
diff --git a/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulOptions.java b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulOptions.java
new file mode 100644
index 0000000..b91bbef
--- /dev/null
+++ b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulOptions.java
@@ -0,0 +1,288 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import mockit.integration.junit4.JMockit;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 20-Jun-2016
+ */
+@RunWith(JMockit.class)
+public class TestRestfulOptions {
+
+ @Rule
+ final public ExpectedException thrown = ExpectedException.none();
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetPort() {
+ final RestfulOptions options = new RestfulOptions();
+ final int port = 9091;
+ assertEquals(0, options.getPort());
+ options.setPort(port);
+ assertEquals(port, options.getPort());
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testSetPort() {
+ final RestfulOptions options = new RestfulOptions();
+ final int port = 9091;
+ assertTrue(options.setPort(port));
+ assertEquals(port, options.getPort());
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetHost() {
+ final RestfulOptions options = new RestfulOptions();
+ final String host = "localhost";
+ assertEquals("", options.getHost());
+ options.setHost(host);
+ assertEquals(host, options.getHost());
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testSetHost() {
+ final RestfulOptions options = new RestfulOptions();
+ final String host = "localhost";
+ assertTrue(options.setHost(host));
+ assertEquals(host, options.getHost());
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testSetRestTimeout() {
+ final RestfulOptions options = new RestfulOptions();
+ int timeout = 0;
+ assertFalse(options.setRestTimeout(timeout));
+ assertEquals(0, options.getRestTimeout());
+
+ timeout = 1;
+ assertTrue(options.setRestTimeout(timeout));
+ assertEquals(timeout, options.getRestTimeout());
+
+ timeout = 10;
+ assertTrue(options.setRestTimeout(timeout));
+ assertEquals(timeout, options.getRestTimeout());
+
+ timeout = RestfulOptions.REST_OPTIONS_TIMEOUT_MAXTIMEOUT - 1;
+ assertTrue(options.setRestTimeout(timeout));
+ assertEquals(timeout, options.getRestTimeout());
+
+ timeout = RestfulOptions.REST_OPTIONS_TIMEOUT_MAXTIMEOUT;
+ assertTrue(options.setRestTimeout(timeout));
+ assertEquals(timeout, options.getRestTimeout());
+
+ timeout = RestfulOptions.REST_OPTIONS_TIMEOUT_MAXTIMEOUT + 1;
+ assertFalse(options.setRestTimeout(timeout));
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetRestTimeout() {
+ final RestfulOptions options = new RestfulOptions();
+ int timeout = 0;
+ assertEquals(0, options.getRestTimeout());
+
+ timeout = 1;
+ assertTrue(options.setRestTimeout(timeout));
+ assertEquals(timeout, options.getRestTimeout());
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetOption() {
+ final RestfulOptions options = new RestfulOptions();
+ assertNull(options.getOption("invalid"));
+
+ options.setHost("localhost");
+ Object obj = options.getOption(RestfulClientConst.HOST_KEY_NAME);
+ assertNotNull(obj);
+ assertTrue(obj instanceof String);
+ assertEquals("localhost", obj);
+
+ final List<String> list = new ArrayList<String>();
+ list.add("data");
+ options.setOption("list", list);
+ obj = options.getOption("list");
+ assertNotNull(obj);
+ assertTrue(obj instanceof List);
+ assertSame(list, obj);
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetIntOption() {
+ final RestfulOptions options = new RestfulOptions();
+
+ assertEquals(0, options.getIntOption("count"));
+
+ options.setOption("count", 1);
+ assertEquals(1, options.getIntOption("count"));
+
+ thrown.expect(RuntimeException.class);
+
+ options.setOption("string-count", "two");
+ final int value = options.getIntOption("string-count");
+ assertEquals(2, value);
+
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetStringOption() {
+ final RestfulOptions options = new RestfulOptions();
+
+ assertEquals("", options.getStringOption("count"));
+
+ options.setOption("string-count", "one");
+ assertEquals("one", options.getStringOption("string-count"));
+
+ thrown.expect(RuntimeException.class);
+
+ options.setOption("count", 2);
+ final String value = options.getStringOption("count");
+ assertEquals(2, value);
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testSetOption() {
+ final RestfulOptions options = new RestfulOptions();
+ assertNull(options.getOption("invalid"));
+
+ options.setHost("localhost");
+ Object obj = options.getOption(RestfulClientConst.HOST_KEY_NAME);
+ assertNotNull(obj);
+ assertTrue(obj instanceof String);
+ assertEquals("localhost", obj);
+
+ final List<String> list = new ArrayList<String>();
+ list.add("data");
+ options.setOption("list", list);
+ obj = options.getOption("list");
+ assertNotNull(obj);
+ assertTrue(obj instanceof List);
+ assertSame(list, obj);
+ }
+}
diff --git a/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulParametes.java b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulParametes.java
new file mode 100644
index 0000000..fbe9430
--- /dev/null
+++ b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulParametes.java
@@ -0,0 +1,229 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 21-Jun-2016
+ */
+public class TestRestfulParametes {
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGet() {
+ final RestfulParametes params = new RestfulParametes();
+ assertNull(params.get("param"));
+ final Map<String, String> paramMap = new HashMap<String, String>();
+ params.setParamMap(paramMap);
+ paramMap.put("param", "value");
+ assertEquals("value", params.get("param"));
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testSetRawData() {
+ final RestfulParametes params = new RestfulParametes();
+ final String data = "Sample data.";
+ params.setRawData(data);
+ assertEquals(data, params.getRawData());
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetRawData() {
+ final RestfulParametes params = new RestfulParametes();
+ assertNull(params.getRawData());
+ final String data = "Sample data.";
+ params.setRawData(data);
+ assertEquals(data, params.getRawData());
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testPut() {
+ final RestfulParametes params = new RestfulParametes();
+ params.put("somekey", "somevalue");
+ params.put("otherkey", "othervalue");
+ assertEquals("somevalue", params.get("somekey"));
+ assertEquals("othervalue", params.get("otherkey"));
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testPutHttpContextHeaderStringString() {
+ final RestfulParametes params = new RestfulParametes();
+ params.putHttpContextHeader("Context-Encoding", "UTF-8");
+ assertEquals("UTF-8", params.getHttpContextHeader("Context-Encoding"));
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testPutHttpContextHeaderStringInt() {
+ final RestfulParametes params = new RestfulParametes();
+ params.putHttpContextHeader("Expire-At", 1000);
+ assertEquals("1000", params.getHttpContextHeader("Expire-At"));
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetHttpContextHeader() {
+ final RestfulParametes params = new RestfulParametes();
+ params.putHttpContextHeader("Expire-At", 1000);
+ params.putHttpContextHeader("Context-Encoding", "UTF-8");
+ assertEquals("1000", params.getHttpContextHeader("Expire-At"));
+ assertEquals("UTF-8", params.getHttpContextHeader("Context-Encoding"));
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetParamMap() {
+ final RestfulParametes params = new RestfulParametes();
+ params.put("key", "value");
+ final Map<String, String> map = params.getParamMap();
+ assertEquals("value", map.get("key"));
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testSetParamMap() {
+ final RestfulParametes params = new RestfulParametes();
+ final Map<String, String> map = new HashMap<String, String>();
+ map.put("key", "value");
+ params.setParamMap(map);
+ assertEquals("value", params.get("key"));
+
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetHeaderMap() {
+ final RestfulParametes params = new RestfulParametes();
+ params.putHttpContextHeader("key", "value");
+ final Map<String, String> map = params.getHeaderMap();
+ assertEquals("value", map.get("key"));
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testSetHeaderMap() {
+ final RestfulParametes params = new RestfulParametes();
+ final Map<String, String> map = new HashMap<String, String>();
+ map.put("key", "value");
+ params.setHeaderMap(map);
+ assertEquals("value", params.getHttpContextHeader("key"));
+ }
+}
diff --git a/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulResponse.java b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulResponse.java
new file mode 100644
index 0000000..19fc7d5
--- /dev/null
+++ b/wso2/rest-client/src/test/java/org/openo/baseservice/roa/util/restclient/TestRestfulResponse.java
@@ -0,0 +1,273 @@
+/*
+ * Copyright 2016 Huawei Technologies Co., Ltd.
+ *
+ * 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.baseservice.roa.util.restclient;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * <br/>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version 20-Jun-2016
+ */
+public class TestRestfulResponse {
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @throws java.lang.Exception
+ * @since
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetStatus() {
+ final RestfulResponse response = new RestfulResponse();
+ int actual = response.getStatus();
+ int expected = -1;
+
+ assertEquals(expected, actual);
+ expected = 202;
+ response.setStatus(expected);
+ actual = response.getStatus();
+ assertEquals(expected, actual);
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testSetStatus() {
+ final RestfulResponse response = new RestfulResponse();
+ final int expected = 10;
+ response.setStatus(expected);
+ final int actual = response.getStatus();
+ assertEquals(expected, actual);
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetRespHeaderMap() {
+ final RestfulResponse response = new RestfulResponse();
+ Map<String, String> expected = response.getRespHeaderMap();
+ assertNull(expected);
+ expected = new HashMap<String, String>();
+ expected.put("key", "value");
+ response.setRespHeaderMap(expected);
+ final Map<String, String> actual = response.getRespHeaderMap();
+ assertNotNull(actual);
+ assertSame(actual, expected);
+
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testSetRespHeaderMap() {
+ final RestfulResponse response = new RestfulResponse();
+ response.setRespHeaderMap(null);
+ Map<String, String> expected = response.getRespHeaderMap();
+ assertNull(expected);
+ expected = new HashMap<String, String>();
+ expected.put("key", "value");
+ response.setRespHeaderMap(expected);
+ final Map<String, String> actual = response.getRespHeaderMap();
+ assertNotNull(actual);
+ assertSame(actual, expected);
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetRespHeaderInt() {
+ final RestfulResponse response = new RestfulResponse();
+ response.setRespHeaderMap(null);
+ int actual = response.getRespHeaderInt("somekey");
+ assertEquals(-1, actual);
+ final Map<String, String> headers = new HashMap<String, String>();
+ headers.put("key", "value");
+ headers.put("count", "1");
+ response.setRespHeaderMap(headers);
+ actual = response.getRespHeaderInt("somekey");
+ assertEquals(-1, actual);
+
+ actual = response.getRespHeaderInt("count");
+ assertEquals(1, actual);
+
+ thrown.expect(RuntimeException.class);
+ actual = response.getRespHeaderInt("key");
+ assertEquals(1, actual);
+
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetRespHeaderLong() {
+ final RestfulResponse response = new RestfulResponse();
+ response.setRespHeaderMap(null);
+ long actual = response.getRespHeaderLong("somekey");
+ assertEquals(-1, actual);
+ final Map<String, String> headers = new HashMap<String, String>();
+ headers.put("key", "value");
+ headers.put("count", "1");
+ headers.put("max", "" + Long.MAX_VALUE);
+ headers.put("max++", Long.MAX_VALUE + 1 + "");
+ response.setRespHeaderMap(headers);
+ actual = response.getRespHeaderLong("somekey");
+ assertEquals(-1, actual);
+
+ actual = response.getRespHeaderLong("count");
+ assertEquals(1, actual);
+
+ actual = response.getRespHeaderLong("max");
+ assertEquals(Long.MAX_VALUE, actual);
+
+ actual = response.getRespHeaderLong("max++");
+ assertTrue(actual < 0);
+
+ thrown.expect(RuntimeException.class);
+ actual = response.getRespHeaderLong("key");
+ assertEquals(1, actual);
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetRespHeaderStr() {
+ final RestfulResponse response = new RestfulResponse();
+ response.setRespHeaderMap(null);
+ String actual = response.getRespHeaderStr("somekey");
+ assertEquals(null, actual);
+ final Map<String, String> headers = new HashMap<String, String>();
+ headers.put("key", "value");
+ headers.put("count", "1");
+ headers.put("max", "" + Long.MAX_VALUE);
+ response.setRespHeaderMap(headers);
+ actual = response.getRespHeaderStr("somekey");
+ assertEquals(null, actual);
+
+ actual = response.getRespHeaderStr("key");
+ assertEquals("value", actual);
+
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testGetResponseContent() {
+ final RestfulResponse response = new RestfulResponse();
+ assertEquals(null, response.getResponseContent());
+
+ final String content = "{ \"content\" = \"The response content\" }";
+ response.setResponseJson(content);
+ assertEquals(content, response.getResponseContent());
+ }
+
+ /**
+ * <br/>
+ *
+ * @since
+ */
+ @Test
+ public void testSetResponseJson() {
+ final RestfulResponse response = new RestfulResponse();
+ assertEquals(null, response.getResponseContent());
+
+ final String content = "{ \"content\" = \"The response content\" }";
+ response.setResponseJson(content);
+ assertEquals(content, response.getResponseContent());
+ }
+}
diff --git a/wso2/rest-client/src/test/resources/etc/conf/restclient.json b/wso2/rest-client/src/test/resources/etc/conf/restclient.json
new file mode 100644
index 0000000..1ab1aaf
--- /dev/null
+++ b/wso2/rest-client/src/test/resources/etc/conf/restclient.json
@@ -0,0 +1,11 @@
+{
+ "defaultServer":
+ {
+ "host":"127.0.0.1",
+ "port":"8080",
+ },
+ "ConnectTimeout":"1000",
+ "thread":"10",
+ "idletimeout":"500000",
+ "timeout":"10000"
+} \ No newline at end of file
diff --git a/wso2/rest-client/src/test/resources/rest-client-test.json b/wso2/rest-client/src/test/resources/rest-client-test.json
new file mode 100644
index 0000000..0bdd9cd
--- /dev/null
+++ b/wso2/rest-client/src/test/resources/rest-client-test.json
@@ -0,0 +1,11 @@
+{
+ "defaultServer":
+ {
+ "host":"10.10.10.10",
+ "port":"443",
+ },
+ "ConnectTimeout":"10",
+ "thread":"100",
+ "idletimeout":"30",
+ "timeout":"60",
+} \ No newline at end of file
diff --git a/wso2/wso2bpel-ext/pom.xml b/wso2/wso2bpel-ext/pom.xml
new file mode 100644
index 0000000..e432cbe
--- /dev/null
+++ b/wso2/wso2bpel-ext/pom.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.openo.common-services.common-utilities.wso2bpel-ext</groupId>
+ <artifactId>wso2bpelparent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>wso2bpel-parent/wso2bpelparent</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>wso2bpel-root</artifactId>
+ <name>common-services-common-utilities/wso2bpel-ext</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>wso2bpel-parent</module>
+ <module>wso2bpel-core</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.mycila</groupId>
+ <artifactId>license-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
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 @@
+<?xml version="1.0"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openo.common-services.common-utilities.wso2bpel-ext</groupId>
+ <artifactId>wso2bpel-core-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+<!--
+ <groupId>org.openo.common-services.common-utilities.wso2bpel-ext</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ -->
+ <artifactId>BPEL4RESTLight</artifactId>
+ <name>common-services-common-utilities/wso2bpel-ext/wso2bpel-core/BPEL4RESTLight</name>
+
+ <packaging>jar</packaging>
+
+ <properties>
+ <httpclient.version>4.4.1</httpclient.version>
+ </properties>
+
+<repositories>
+ <repository>
+ <id>wso2-nexus</id>
+ <url>http://dist.wso2.org/maven2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <build>
+
+ <finalName>bpel4rest</finalName>
+
+ <plugins>
+ <plugin>
+ <groupId>com.mycila</groupId>
+ <artifactId>license-maven-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <excludes>**</excludes>
+ </excludes>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <inherited>false</inherited>
+ <configuration>
+ <excludes>**</excludes>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.0-rc4</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpcore</artifactId>
+ <version>${httpclient.version}</version>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-api</artifactId>
+ <version>1.3.5</version>
+ <scope>system</scope>
+ <systemPath>${project.basedir}/libs/ode-bpel-api-1.3.5-wso2v4.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-obj</artifactId>
+ <version>1.3.5</version>
+ <scope>system</scope>
+ <systemPath>${project.basedir}/libs/ode-bpel-obj-1.3.5-wso2v4.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-runtime</artifactId>
+ <version>1.3.5</version>
+ <scope>system</scope>
+ <systemPath>${project.basedir}/libs/ode-bpel-runtime-1.3.5-wso2v4.jar</systemPath>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-api</artifactId>
+ <version>1.3.5</version>
+
+ <scope>system</scope>
+ <systemPath>${project.basedir}/libs/ode-bpel-api-1.3.5-wso2v4.jar</systemPath>
+
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-obj</artifactId>
+ <version>1.3.5</version>
+
+ <scope>system</scope>
+ <systemPath>${project.basedir}/libs/ode-bpel-obj-1.3.5-wso2v4.jar</systemPath>
+
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-runtime</artifactId>
+ <version>1.3.5</version>
+
+ <scope>system</scope>
+ <systemPath>${project.basedir}/libs/ode-bpel-runtime-1.3.5-wso2v4.jar</systemPath>
+
+ </dependency>
+ -->
+
+<dependency>
+ <groupId>org.wso2.bpel</groupId>
+ <artifactId>ode-bpel-api</artifactId>
+ <version>1.3.5-wso2v4</version>
+</dependency>
+
+<dependency>
+ <groupId>org.wso2.bpel</groupId>
+ <artifactId>ode-bpel-obj</artifactId>
+ <version>1.3.5-wso2v4</version>
+</dependency>
+
+<dependency>
+ <groupId>org.wso2.bpel</groupId>
+ <artifactId>ode-bpel-runtime</artifactId>
+ <version>1.3.5-wso2v4</version>
+</dependency>
+
+
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ </dependencies>
+</project>
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 <br>
+ * <br>
+ *
+ * @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 <br>
+ * <br>
+ *
+ * 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 <br>
+ * <br>
+ *
+ * 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 <br>
+ * <br>
+ *
+ * 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 <br>
+ * <br>
+ *
+ * @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 <br>
+ * <br>
+ *
+ * @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 + "</" + wrapper + ">";
+ }
+ 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 <br>
+ * <br>
+ *
+ * @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<String> convertNodeListToStringList(NodeList nodeList) {
+ List<String> resultList = new ArrayList<String>();
+
+ 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<Node> convertNodeListToList(NodeList nodeList) {
+ List<Node> resultList = new ArrayList<Node>(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 <br>
+ * <br>
+ *
+ * @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> 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 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ // requestPayload;
+
+ HighLevelRestApi.setHeader(method, acceptHeaderValue, contentTypeHeader);
+ method.setRequestBody(requestPayload);
+
+ HttpResponseMessage responseMessage = LowLevelRestApi.executeHttpMethod(method);
+
+ // kill <?xml... in front of response
+ HighLevelRestApi.cleanResponseBody(responseMessage);
+
+ return responseMessage;
+ }
+
+ /**
+ * This method implements the HTTP Post Method
+ *
+ * @param uri
+ * Resource URI
+ * @param requestPayload
+ * Content which has to be posted into the Resource
+ * @return ResponseCode of HTTP Interaction
+ */
+ @SuppressWarnings("deprecation")
+ public static HttpResponseMessage Post(String uri, String requestPayload, String acceptHeaderValue, String contentTypeHeader) {
+
+ PostMethod method = null;
+ if (uri.contains("?")) {
+ log.debug("Found query trying to split");
+ String[] split = uri.split("\\?");
+ log.debug("Raw URI part: " + split[0]);
+ log.debug("Raw Query part: " + split[1]);
+ method = new PostMethod(split[0]);
+ method.setQueryString(HighLevelRestApi.createNameValuePairArrayFromQuery(split[1]));
+ } else {
+ method = new PostMethod(uri);
+ ;
+ }
+ method.setRequestBody(requestPayload);
+ HighLevelRestApi.setHeader(method, acceptHeaderValue, contentTypeHeader);
+ HttpResponseMessage responseMessage = LowLevelRestApi.executeHttpMethod(method);
+ HighLevelRestApi.cleanResponseBody(responseMessage);
+ return responseMessage;
+ }
+
+ /**
+ * This method implements the HTTP Get Method
+ *
+ * @param uri
+ * Resource URI
+ * @return Content represented by the Resource URI
+ */
+ public static HttpResponseMessage Get(String uri, String acceptHeaderValue, String contentTypeHeader) {
+ log.debug("Setting URI to: \n");
+ log.debug(uri);
+ GetMethod method = null;
+ if (uri.contains("?")) {
+ log.debug("Found query trying to split");
+ String[] split = uri.split("\\?");
+ log.debug("Raw URI part: " + split[0]);
+ log.debug("Raw Query part: " + split[1]);
+
+ method = new GetMethod(split[0]);
+ method.setQueryString(HighLevelRestApi.createNameValuePairArrayFromQuery(split[1]));
+ } else {
+ method = new GetMethod(uri);
+ }
+ HighLevelRestApi.setHeader(method, acceptHeaderValue, contentTypeHeader);
+ HttpResponseMessage responseMessage = LowLevelRestApi.executeHttpMethod(method);
+ HighLevelRestApi.cleanResponseBody(responseMessage);
+ return responseMessage;
+ }
+
+ private static NameValuePair[] createNameValuePairArrayFromQuery(String query) {
+ // example:
+ // csarID=Moodle.csar&serviceTemplateID={http://www.example.com/tosca/ServiceTemplates/Moodle}Moodle&nodeTemplateID={http://www.example.com/tosca/ServiceTemplates/Moodle}VmApache
+ log.debug("Splitting query: " + query);
+ String[] pairs = query.trim().split("&");
+ NameValuePair[] nameValuePairArray = new NameValuePair[pairs.length];
+ int count = 0;
+ for (String pair : pairs) {
+ log.debug("Splitting query pair: " + pair);
+ String[] keyValue = pair.split("=");
+ NameValuePair nameValuePair = new NameValuePair();
+ log.debug("Key: " + keyValue[0] + " Value: " + keyValue[1]);
+ nameValuePair.setName(keyValue[0]);
+ nameValuePair.setValue(keyValue[1]);
+ nameValuePairArray[count] = nameValuePair;
+ count++;
+ }
+ return nameValuePairArray;
+ }
+
+ /**
+ * This method implements the HTTP Delete Method
+ *
+ * @param uri
+ * Resource URI
+ * @return ResponseCode of HTTP Interaction
+ */
+ public static HttpResponseMessage Delete(String uri, String acceptHeaderValue, String contentTypeHeader) {
+
+ DeleteMethod method = new DeleteMethod(uri);
+ HighLevelRestApi.setHeader(method, acceptHeaderValue, contentTypeHeader);
+ HttpResponseMessage responseMessage = LowLevelRestApi.executeHttpMethod(method);
+ HighLevelRestApi.cleanResponseBody(responseMessage);
+ return responseMessage;
+ }
+
+ private static void setHeader(HttpMethodBase method, String accept, String contentType) {
+ if (!"".equals(accept)) {
+ method.setRequestHeader(HttpHeaders.ACCEPT, accept);
+ } else {
+ method.setRequestHeader(HttpHeaders.ACCEPT, "application/xml");
+ }
+
+ if (contentType != null && !"".equals(contentType)) {
+ method.setRequestHeader(HttpHeaders.CONTENT_TYPE, contentType);
+ } else {
+// method.setRequestHeader("Accept", accept);
+ }
+
+ }
+
+ private static void cleanResponseBody(HttpResponseMessage responseMessage) {
+ log.debug("ResponseBody: \n");
+ if (responseMessage != null && responseMessage.getResponseBody() != null) {
+ log.debug(responseMessage.getResponseBody());
+ String temp = responseMessage.getResponseBody()
+ .replace("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>", "");
+ 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 <root>
+ * @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("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
+ sb.append("<root>");
+ if(result != null && !"".equals(result)) {
+ /**
+ if(result.startsWith("<html>")) {
+ sb.append("<![CDATA[");
+ sb.append(result);
+ 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("<![CDATA[");
+ sb.append(result);
+ sb.append("]]>");
+ }
+ }
+ sb.append("</root>");
+
+ 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("<error>empty</error>");
+ return;
+ }
+
+ if(jsonObject instanceof JSONArray) {
+ JSONArray array = (JSONArray) jsonObject;
+ sb.append("<").append(key).append("s").append(">");
+ for(int i=0, len=array.size(); i<len; i++) {
+ json2Xml(sb, key, array.get(i));
+ }
+ sb.append("</").append(key).append("s").append(">");
+
+ return;
+ } else if(jsonObject instanceof JSONObject) {
+ sb.append("<").append(key).append(">");
+ JSONObject json = (JSONObject) jsonObject;
+ for(Map.Entry<String, Object> entry : (Set<Map.Entry<String, Object>>)json.entrySet()) {
+ json2Xml(sb, entry.getKey(), entry.getValue());
+ }
+ sb.append("</").append(key).append(">");
+ return;
+ } else {
+ sb.append("<").append(key).append(">");
+ sb.append("<![CDATA[");
+ sb.append(jsonObject.toString());
+ sb.append("]]>");
+ sb.append("</").append(key).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 @@
+<?xml version="1.0"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.openo.common-services.common-utilities.wso2bpel-ext</groupId>
+ <artifactId>wso2bpel-core-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>distribution</artifactId>
+ <name>common-services-common-utilities/wso2bpel-ext/wso2bpel-core/distribution</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>standalone</module>
+ </modules>
+</project>
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 @@
+<?xml version="1.0"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.openo.common-services.common-utilities.wso2bpel-ext</groupId>
+ <artifactId>distribution</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>standalone</artifactId>
+ <name>common-services-common-utilities/wso2bpel-ext/wso2bpel-core/distribution/standalone</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <packagename>openo-commonservice-commonutilities-wso2bpel-ext</packagename>
+ <linux64id>linux64</linux64id>
+ <win64id>win64</win64id>
+ <linux64outputdir>target/assembly/${linux64id}</linux64outputdir>
+ <win64outputdir>target/assembly/${win64id}</win64outputdir>
+ <version.output>target/version</version.output>
+ </properties>
+
+ <build>
+ <plugins>
+ <!--plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-resources-${linux64id}</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${linux64outputdir}</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/assembly/</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.bat</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <overwrite>true</overwrite>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-resources-${win64id}</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${win64outputdir}</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/assembly/</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.sh</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <overwrite>true</overwrite>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin-->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-jar-${linux64id}</id>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.openo.common-services.common-utilities.wso2bpel-ext</groupId>
+ <artifactId>wso2bpel-mgr</artifactId>
+ <type>jar</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${linux64outputdir}/wso2bps-ext</outputDirectory>
+ <destFileName>wso2bpel-service.jar</destFileName>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-jar-${win64id}</id>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.openo.common-services.common-utilities.wso2bpel-ext</groupId>
+ <artifactId>wso2bpel-mgr</artifactId>
+ <type>jar</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${win64outputdir}/wso2bps-ext</outputDirectory>
+ <destFileName>wso2bpel-service.jar</destFileName>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ <execution>
+ <id>unzip-wso2bps-${linux64id}</id>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>com.wso2</groupId>
+ <artifactId>wso2bps</artifactId>
+ <type>zip</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>target/assembly/wso2bps</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ <execution>
+ <id>unzip-wso2bps-${win64id}</id>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>com.wso2</groupId>
+ <artifactId>wso2bps</artifactId>
+ <type>zip</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>target/assembly/wso2bps</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-resources-${linux64id}</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${linux64outputdir}</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/assembly/</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.bat</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <overwrite>true</overwrite>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-resources-${win64id}</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${win64outputdir}</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/assembly/</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.sh</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <overwrite>true</overwrite>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-ext-resources-${linux64id}</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${linux64outputdir}/wso2bps</outputDirectory>
+ <resources>
+ <resource>
+ <directory>target/assembly/wso2bps/wso2bps-3.5.0</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.bat</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <overwrite>true</overwrite>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-ext-resources-${win64id}</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${win64outputdir}/wso2bps</outputDirectory>
+ <resources>
+ <resource>
+ <directory>target/assembly/wso2bps/wso2bps-3.5.0</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <exclude>**/*.sh</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <overwrite>true</overwrite>
+ </configuration>
+
+ </execution>
+ <execution>
+ <id>copy-config-resources-linux</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${linux64outputdir}/wso2bps/repository/conf</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/assembly/wso2bps/repository/conf/carbon</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ </resources>
+ <overwrite>true</overwrite>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-config-resources-win</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${win64outputdir}/wso2bps/repository/conf</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/assembly/wso2bps/repository/conf/carbon</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ </resources>
+ <overwrite>true</overwrite>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-bpel4rest-resources-linux</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${linux64outputdir}/wso2bps/repository/components/lib</outputDirectory>
+ <resources>
+ <resource>
+ <directory>../../BPEL4RESTLight/target</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/bpel4rest.jar</include>
+ </includes>
+ </resource>
+ </resources>
+ <overwrite>true</overwrite>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-bpel4rest-resources-win</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${win64outputdir}/wso2bps/repository/components/lib</outputDirectory>
+ <resources>
+ <resource>
+ <directory>../../BPEL4RESTLight/target</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/bpel4rest.jar</include>
+ </includes>
+ </resource>
+ </resources>
+ <overwrite>true</overwrite>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution</id>
+ <phase>package</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target name="distribution">
+ <!--copy todir="target/assembly/linux64/wso2bps-ext/lib">
+ <fileset dir="../../wso2bpel-mgr/lib">
+ <include name="*"/>
+ </fileset>
+ </copy>
+ <copy todir="target/assembly/win64/wso2bps-ext/lib">
+ <fileset dir="../../wso2bpel-mgr/lib">
+ <include name="*"/>
+ </fileset>
+ </copy-->
+ <tar destfile="${version.output}/${packagename}-${project.version}-linux64.tar.gz" longfile="posix" compression="gzip">
+ <tarfileset dir="target/assembly/linux64" filemode="0644" dirmode="0755">
+ <exclude name="**/*.sh"/>
+ </tarfileset>
+ <tarfileset dir="target/assembly/linux64" filemode="0755" dirmode="0755">
+ <include name="**/*.sh"/>
+ </tarfileset>
+ </tar>
+ <attachartifact file="${version.output}/${packagename}-${project.version}-linux64.tar.gz" classifier="linux64" type="tar.gz"/>
+ <zip destfile="${version.output}/${packagename}-${project.version}-win64.zip" update="true">
+ <zipfileset dir="target/assembly/win64" includes="**"/>
+ </zip>
+ <attachartifact file="${version.output}/${packagename}-${project.version}-win64.zip" classifier="win64" type="zip"/>
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openo.common-services.common-utilities.wso2bpel-ext</groupId>
+ <artifactId>wso2bpel-mgr</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.wso2</groupId>
+ <artifactId>wso2bps</artifactId>
+ <version>3.5.0</version>
+ <type>zip</type>
+ </dependency>
+ </dependencies>
+</project>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ ~
+ ~ WSO2 Inc. 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.
+ -->
+<tns:WSO2BPS xmlns:tns="http://wso2.org/bps/config">
+ <!-- Database Configuration for WSO2 BPS BPEL Engine's Persistence Storage -->
+ <tns:DataBaseConfig>
+ <!-- Data source configuration. Use data sources created in data sources component. -->
+ <tns:DataSource name="bpsds">
+ <!--tns:JNDI contextFactory="com.sun.jndi.rmi.registry.RegistryContextFactory" providerURL="rmi://localhost:2199"/-->
+ </tns:DataSource>
+ </tns:DataBaseConfig>
+
+ <tns:ExtensionBundles>
+ <tns:runtimes>
+ <tns:runtime class="de.unistuttgart.iaas.bpel.extensions.bpel4restlight.Bpel4RestLightExtensionBundle"/>
+ </tns:runtimes>
+ </tns:ExtensionBundles>
+
+
+ <!-- Process dehydration configuration -->
+ <!--<tns:ProcessDehydration maxCount="0" value="true">
+ <tns:MaxAge value="0"/>
+ </tns:ProcessDehydration>-->
+
+ <!--<tns:TransactionFactory class=""/>-->
+
+ <!-- BPEL Event Listeners. They must implement BPELEventListener interface -->
+ <!--<tns:EventListeners>
+ <tns:listener class="org.wso2.bps.SampleEventListener"/>
+ </tns:EventListeners>-->
+
+ <!--tns:EventListeners>
+ <tns:listener class="org.wso2.carbon.bpel.core.ode.integration.jmx.JmxBpelEventListener"/>
+ </tns:EventListeners-->
+
+ <!-- BPEL Message Exchange Interceptors. Used to track and handle incoming and out going
+ Messages from BPEL Processes.
+ -->
+ <!--<tns:MexInterceptors>
+ <tns:interceptor class=""/>
+ </tns:MexInterceptors>-->
+
+ <!-- BPEL Extensions -->
+ <!--<tns:ExtensionBundles>
+ <tns:runtimes>
+ <tns:runtime class="org.wso2.bps.SampleExtensionRuntime"/>
+ </tns:runtimes>
+ <tns:filters>
+ <tns:filter class="org.wso2.bps.SampleCorrelationFilter"/>
+ </tns:filters>
+ </tns:ExtensionBundles>-->
+
+ <!-- OpenJPA specific configuration properties -->
+ <tns:OpenJPAConfig>
+ <tns:property name="openjpa.FlushBeforeQueries" value="true"/>
+ <tns:property name="openjpa.TransactionMode" value="local"/>
+ </tns:OpenJPAConfig>
+
+ <!-- Message exchange timeout. Default value is 120000ms -->
+ <!--<tns:MexTimeOut value="120000"/>-->
+
+ <!-- External Service invocation timeout. Default value is 60000ms -->
+ <!--<tns:ExternalServiceTimeOut value="60000"/>-->
+
+ <!-- MultithreadedHttpConnectionManager tuning parameters -->
+ <tns:MultithreadedHttpConnectionManagerConfig>
+ <tns:maxConnectionsPerHost value="20"/>
+ <tns:maxTotalConnections value="100"/>
+ <!--<tns:connectionKeepAlive value="false"/> -->
+ </tns:MultithreadedHttpConnectionManagerConfig>
+
+ <!-- Process instance cleanup feature in WSO2 Business Process Server
+ allows you to configure periodic process instance cleanup tasks based
+ on various process instance properties to remove process instance data
+ from WSO2 BPS persistence storage.
+ Refer - http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html to
+ declare cron expressions format
+ Following sample configuration schedule a cleanup task at 5:11 PM every day
+ to clean completed process instances.
+ -->
+ <!--<tns:Schedules>
+ <tns:Schedule when="0 11 17 * * ?">
+ <tns:cleanup>
+ <tns:filter><![CDATA[status=completed]]></tns:filter>
+ </tns:cleanup>
+ </tns:Schedule>
+ </tns:Schedules>-->
+
+ <!-- By default all the BPEL packages are read from the file system. If you need to Synchronize
+ the file system bpel repository with set the following parameter to true. This will check the
+ timestamp of the BPEL packages in the file system against the BPEL packages in the registry. If
+ they do not match then the BPEL package in the registry is copied to the file system. -->
+ <!--<tns:SyncWithRegistry>false</tns:SyncWithRegistry>-->
+
+ <!-- The property InMemoryInstanceTimeToLive may be used to limit the time-to-live of in-memory instances.
+ This setting can be useful to avoid memory leaks related to in-memory processes that may get
+ 'stuck' during execution and never terminate (time should be specified in milliseconds) -->
+ <!--tns:InMemoryInstanceTimeToLive>600000</tns:InMemoryInstanceTimeToLive-->
+
+ <!-- This property can be used to configure ode scheduler thread pool size -->
+ <tns:ODESchedulerThreadPoolSize>50</tns:ODESchedulerThreadPoolSize>
+
+ <!-- If you are using BPS in a clustered environment, then uncomment blow entry -->
+ <!-- <tns:UseDistributedLock>true</tns:UseDistributedLock> -->
+
+ <!-- <tns:UseInstanceStateCache>true</tns:UseInstanceStateCache> -->
+
+ <!-- You can assign a unique id for each node in the cluster using NodeId property -->
+ <!-- <tns:NodeId></tns:NodeId> -->
+
+ <!-- Simple Scheduler related configuration -->
+ <!--<tns:ODESchedulerConfiguration>-->
+ <!-- Maximum number of jobs in the "near future" todo queue. -->
+ <!--<tns:ODESchedulerQueueLength>10000</tns:ODESchedulerQueueLength>-->
+
+ <!--Jobs scheduled with a time that is between [now, now+immediateInterval] will be assigned to the current node,
+ and placed directly on the todo queue. time in ms-->
+ <!--<tns:ODESchedulerImmediateInterval>30000</tns:ODESchedulerImmediateInterval>-->
+
+ <!--Jobs scheduled with a time that is between (now+immediateInterval,now+nearFutureInterval) will be assigned to the current
+ node, but will not be placed on the todo queue (the promoter will pick them up). time in ms -->
+ <!--<tns:ODESchedulerNearFutureInterval>600000</tns:ODESchedulerNearFutureInterval>-->
+
+ <!-- Stale node check interval in ms-->
+ <!--<tns:ODESchedulerStaleInterval>10000</tns:ODESchedulerStaleInterval>-->
+
+ <!-- Estimated sustained transaction per second capacity of the system.
+ e.g. 100 means the system can process 100 jobs per seconds, on average
+ This number is used to determine how many jobs to load from the database at once.-->
+ <!--<tns:ODESchedulerTransactionsPerSecond>100</tns:ODESchedulerTransactionsPerSecond>-->
+
+ <!-- Duration used to log a warning if a job scheduled at a date D is queued at D'>D+_warningDelay -->
+ <!--<tns:ODESchedulerWarningDelay>300000</tns:ODESchedulerWarningDelay>-->
+
+ <!-- Number of immediate retries when the transaction fails -->
+ <!--<tns:ODESchedulerImmediateTransactionRetryLimit>3</tns:ODESchedulerImmediateTransactionRetryLimit>-->
+
+ <!-- Interval between immediate retries when the transaction fails -->
+ <!--<tns:ODESchedulerImmediateTransactionRetryInterval>1000</tns:ODESchedulerImmediateTransactionRetryInterval>-->
+
+ <!-- End of Simple Scheduler related configuration -->
+ <!--</tns:ODESchedulerConfiguration>--> 
+
+ <!--Configurations for BPEL UI-->
+ <tns:BpelUI>
+ <!--Set the maximum value size for a variable in a instance view in kilobytes,-->
+ <!--higher sizes may slowdown the instance view rendering. Default size is 1000KB.-->
+ <!--Please note that this only limits the displayed variable content size.-->
+ <!--<tns:InstanceViewVariableLength>1000</tns:InstanceViewVariableLength>-->
+
+ <!--This property specify the maximum number of BPEL process instances that can be deleted in a single delete instance-->
+ <!--request. Default value is 1000. Increase this with caution. It may result in various timeout exceptions.-->
+ <!--<tns:BpelInstanceDeletionLimit>1000</tns:BpelInstanceDeletionLimit>-->
+ </tns:BpelUI>
+
+ <!--Timeout for the BPEL Transaction Manager in seconds. Default is 10 minutes-->
+ <!--<tns:TransactionManagerTimeout></tns:TransactionManagerTimeout>-->
+
+</tns:WSO2BPS>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ ~
+ ~ WSO2 Inc. 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.
+ -->
+<tns:WSO2BPS xmlns:tns="http://wso2.org/bps/config">
+ <!-- Database Configuration for WSO2 BPS BPEL Engine's Persistence Storage -->
+ <tns:DataBaseConfig>
+ <!-- Data source configuration. Use data sources created in data sources component. -->
+ <tns:DataSource name="bpsds">
+ <!--tns:JNDI contextFactory="com.sun.jndi.rmi.registry.RegistryContextFactory" providerURL="rmi://localhost:2199"/-->
+ </tns:DataSource>
+ </tns:DataBaseConfig>
+
+ <tns:ExtensionBundles>
+ <tns:runtimes>
+ <tns:runtime class="de.unistuttgart.iaas.bpel.extensions.bpel4restlight.Bpel4RestLightExtensionBundle"/>
+ </tns:runtimes>
+ </tns:ExtensionBundles>
+
+
+ <!-- Process dehydration configuration -->
+ <!--<tns:ProcessDehydration maxCount="0" value="true">
+ <tns:MaxAge value="0"/>
+ </tns:ProcessDehydration>-->
+
+ <!--<tns:TransactionFactory class=""/>-->
+
+ <!-- BPEL Event Listeners. They must implement BPELEventListener interface -->
+ <!--<tns:EventListeners>
+ <tns:listener class="org.wso2.bps.SampleEventListener"/>
+ </tns:EventListeners>-->
+
+ <!--tns:EventListeners>
+ <tns:listener class="org.wso2.carbon.bpel.core.ode.integration.jmx.JmxBpelEventListener"/>
+ </tns:EventListeners-->
+
+ <!-- BPEL Message Exchange Interceptors. Used to track and handle incoming and out going
+ Messages from BPEL Processes.
+ -->
+ <!--<tns:MexInterceptors>
+ <tns:interceptor class=""/>
+ </tns:MexInterceptors>-->
+
+ <!-- BPEL Extensions -->
+ <!--<tns:ExtensionBundles>
+ <tns:runtimes>
+ <tns:runtime class="org.wso2.bps.SampleExtensionRuntime"/>
+ </tns:runtimes>
+ <tns:filters>
+ <tns:filter class="org.wso2.bps.SampleCorrelationFilter"/>
+ </tns:filters>
+ </tns:ExtensionBundles>-->
+
+ <!-- OpenJPA specific configuration properties -->
+ <tns:OpenJPAConfig>
+ <tns:property name="openjpa.FlushBeforeQueries" value="true"/>
+ <tns:property name="openjpa.TransactionMode" value="local"/>
+ </tns:OpenJPAConfig>
+
+ <!-- Message exchange timeout. Default value is 120000ms -->
+ <!--<tns:MexTimeOut value="120000"/>-->
+
+ <!-- External Service invocation timeout. Default value is 60000ms -->
+ <!--<tns:ExternalServiceTimeOut value="60000"/>-->
+
+ <!-- MultithreadedHttpConnectionManager tuning parameters -->
+ <tns:MultithreadedHttpConnectionManagerConfig>
+ <tns:maxConnectionsPerHost value="20"/>
+ <tns:maxTotalConnections value="100"/>
+ <!--<tns:connectionKeepAlive value="false"/> -->
+ </tns:MultithreadedHttpConnectionManagerConfig>
+
+ <!-- Process instance cleanup feature in WSO2 Business Process Server
+ allows you to configure periodic process instance cleanup tasks based
+ on various process instance properties to remove process instance data
+ from WSO2 BPS persistence storage.
+ Refer - http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html to
+ declare cron expressions format
+ Following sample configuration schedule a cleanup task at 5:11 PM every day
+ to clean completed process instances.
+ -->
+ <!--<tns:Schedules>
+ <tns:Schedule when="0 11 17 * * ?">
+ <tns:cleanup>
+ <tns:filter><![CDATA[status=completed]]></tns:filter>
+ </tns:cleanup>
+ </tns:Schedule>
+ </tns:Schedules>-->
+
+ <!-- By default all the BPEL packages are read from the file system. If you need to Synchronize
+ the file system bpel repository with set the following parameter to true. This will check the
+ timestamp of the BPEL packages in the file system against the BPEL packages in the registry. If
+ they do not match then the BPEL package in the registry is copied to the file system. -->
+ <!--<tns:SyncWithRegistry>false</tns:SyncWithRegistry>-->
+
+ <!-- The property InMemoryInstanceTimeToLive may be used to limit the time-to-live of in-memory instances.
+ This setting can be useful to avoid memory leaks related to in-memory processes that may get
+ 'stuck' during execution and never terminate (time should be specified in milliseconds) -->
+ <!--tns:InMemoryInstanceTimeToLive>600000</tns:InMemoryInstanceTimeToLive-->
+
+ <!-- This property can be used to configure ode scheduler thread pool size -->
+ <tns:ODESchedulerThreadPoolSize>50</tns:ODESchedulerThreadPoolSize>
+
+ <!-- If you are using BPS in a clustered environment, then uncomment blow entry -->
+ <!-- <tns:UseDistributedLock>true</tns:UseDistributedLock> -->
+
+ <!-- <tns:UseInstanceStateCache>true</tns:UseInstanceStateCache> -->
+
+ <!-- You can assign a unique id for each node in the cluster using NodeId property -->
+ <!-- <tns:NodeId></tns:NodeId> -->
+
+ <!-- Simple Scheduler related configuration -->
+ <!--<tns:ODESchedulerConfiguration>-->
+ <!-- Maximum number of jobs in the "near future" todo queue. -->
+ <!--<tns:ODESchedulerQueueLength>10000</tns:ODESchedulerQueueLength>-->
+
+ <!--Jobs scheduled with a time that is between [now, now+immediateInterval] will be assigned to the current node,
+ and placed directly on the todo queue. time in ms-->
+ <!--<tns:ODESchedulerImmediateInterval>30000</tns:ODESchedulerImmediateInterval>-->
+
+ <!--Jobs scheduled with a time that is between (now+immediateInterval,now+nearFutureInterval) will be assigned to the current
+ node, but will not be placed on the todo queue (the promoter will pick them up). time in ms -->
+ <!--<tns:ODESchedulerNearFutureInterval>600000</tns:ODESchedulerNearFutureInterval>-->
+
+ <!-- Stale node check interval in ms-->
+ <!--<tns:ODESchedulerStaleInterval>10000</tns:ODESchedulerStaleInterval>-->
+
+ <!-- Estimated sustained transaction per second capacity of the system.
+ e.g. 100 means the system can process 100 jobs per seconds, on average
+ This number is used to determine how many jobs to load from the database at once.-->
+ <!--<tns:ODESchedulerTransactionsPerSecond>100</tns:ODESchedulerTransactionsPerSecond>-->
+
+ <!-- Duration used to log a warning if a job scheduled at a date D is queued at D'>D+_warningDelay -->
+ <!--<tns:ODESchedulerWarningDelay>300000</tns:ODESchedulerWarningDelay>-->
+
+ <!-- Number of immediate retries when the transaction fails -->
+ <!--<tns:ODESchedulerImmediateTransactionRetryLimit>3</tns:ODESchedulerImmediateTransactionRetryLimit>-->
+
+ <!-- Interval between immediate retries when the transaction fails -->
+ <!--<tns:ODESchedulerImmediateTransactionRetryInterval>1000</tns:ODESchedulerImmediateTransactionRetryInterval>-->
+
+ <!-- End of Simple Scheduler related configuration -->
+ <!--</tns:ODESchedulerConfiguration>--> 
+
+ <!--Configurations for BPEL UI-->
+ <tns:BpelUI>
+ <!--Set the maximum value size for a variable in a instance view in kilobytes,-->
+ <!--higher sizes may slowdown the instance view rendering. Default size is 1000KB.-->
+ <!--Please note that this only limits the displayed variable content size.-->
+ <!--<tns:InstanceViewVariableLength>1000</tns:InstanceViewVariableLength>-->
+
+ <!--This property specify the maximum number of BPEL process instances that can be deleted in a single delete instance-->
+ <!--request. Default value is 1000. Increase this with caution. It may result in various timeout exceptions.-->
+ <!--<tns:BpelInstanceDeletionLimit>1000</tns:BpelInstanceDeletionLimit>-->
+ </tns:BpelUI>
+
+ <!--Timeout for the BPEL Transaction Manager in seconds. Default is 10 minutes-->
+ <!--<tns:TransactionManagerTimeout></tns:TransactionManagerTimeout>-->
+
+</tns:WSO2BPS>
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 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+ ~ Copyright 2005-2011 WSO2, Inc. (http://wso2.com)
+ ~
+ ~ 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.
+ -->
+
+<!--
+ This is the main server configuration file
+
+ ${carbon.home} represents the carbon.home system property.
+ Other system properties can be specified in a similar manner.
+-->
+<Server xmlns="http://wso2.org/projects/carbon/carbon.xml">
+
+ <!--
+ Product Name
+ -->
+ <Name>WSO2 Business Process Server</Name>
+
+ <!--
+ machine readable unique key to identify each product
+ -->
+ <ServerKey>BPS</ServerKey>
+
+ <!--
+ Product Version
+ -->
+ <Version>3.5.0</Version>
+
+ <!--
+ Host name or IP address of the machine hosting this server
+ e.g. www.wso2.org, 192.168.1.10
+ This is will become part of the End Point Reference of the
+ services deployed on this server instance.
+ -->
+ <!--HostName>www.wso2.org</HostName-->
+
+ <!--
+ Host name to be used for the Carbon management console
+ -->
+ <!--MgtHostName>mgt.wso2.org</MgtHostName-->
+
+ <!--
+ The URL of the back end server. This is where the admin services are hosted and
+ will be used by the clients in the front end server.
+ This is required only for the Front-end server. This is used when seperating BE server from FE server
+ -->
+ <ServerURL>local:/${carbon.context}/services/</ServerURL>
+ <!--
+ <ServerURL>https://${carbon.local.ip}:${carbon.management.port}${carbon.context}/services/</ServerURL>
+ -->
+ <!--
+ The URL of the index page. This is where the user will be redirected after signing in to the
+ carbon server.
+ -->
+ <!-- IndexPageURL>/carbon/admin/index.jsp</IndexPageURL-->
+
+ <!--
+ For cApp deployment, we have to identify the roles that can be acted by the current server.
+ The following property is used for that purpose. Any number of roles can be defined here.
+ Regular expressions can be used in the role.
+ Ex : <Role>.*</Role> means this server can act any role
+ -->
+ <ServerRoles>
+ <Role>BusinessProcessServer</Role>
+ </ServerRoles>
+
+ <!-- uncommnet this line to subscribe to a bam instance automatically -->
+ <!--<BamServerURL>https://bamhost:bamport/services/</BamServerURL>-->
+
+ <!--
+ The fully qualified name of the server
+ -->
+ <Package>org.wso2.carbon</Package>
+
+ <!--
+ Webapp context root of WSO2 Carbon management console.
+ -->
+ <WebContextRoot>/</WebContextRoot>
+
+ <!--
+ Proxy context path is a useful parameter to add a proxy path when a Carbon server is fronted by reverse proxy. In addtion
+ to the proxy host and proxy port this parameter allows you add a path component to external URLs. e.g.
+ URL of the Carbon server -> https://10.100.1.1:9443/carbon
+ URL of the reverse proxy -> https://prod.abc.com/appserver/carbon
+
+ appserver - proxy context path. This specially required whenever you are generating URLs to displace in
+ Carbon UI components.
+ -->
+ <!--
+ <MgtProxyContextPath></MgtProxyContextPath>
+ <ProxyContextPath></ProxyContextPath>
+ -->
+
+ <!-- In-order to get the registry http Port from the back-end when the default http transport is not the same-->
+ <!--RegistryHttpPort>9763</RegistryHttpPort-->
+
+ <!--
+ Number of items to be displayed on a management console page. This is used at the
+ backend server for pagination of various items.
+ -->
+ <ItemsPerPage>15</ItemsPerPage>
+
+ <!-- The endpoint URL of the cloud instance management Web service -->
+ <!--<InstanceMgtWSEndpoint>https://ec2.amazonaws.com/</InstanceMgtWSEndpoint>-->
+
+ <!--
+ Ports used by this server
+ -->
+ <Ports>
+
+ <!-- Ports offset. This entry will set the value of the ports defined below to
+ the define value + Offset.
+ e.g. Offset=2 and HTTPS port=9443 will set the effective HTTPS port to 9445
+ -->
+ <Offset>0</Offset>
+
+ <!-- The JMX Ports -->
+ <JMX>
+ <!--The port RMI registry is exposed-->
+ <RMIRegistryPort>9999</RMIRegistryPort>
+ <!--The port RMI server should be exposed-->
+ <RMIServerPort>11111</RMIServerPort>
+ </JMX>
+
+ <!-- Embedded LDAP server specific ports -->
+ <EmbeddedLDAP>
+ <!-- Port which embedded LDAP server runs -->
+ <LDAPServerPort>10389</LDAPServerPort>
+ <!-- Port which KDC (Kerberos Key Distribution Center) server runs -->
+ <KDCServerPort>8000</KDCServerPort>
+ </EmbeddedLDAP>
+
+ <!--
+ Override datasources JNDIproviderPort defined in bps.xml and datasources.properties files
+ -->
+ <!--<JNDIProviderPort>2199</JNDIProviderPort>-->
+ <!--Override receive port of thrift based entitlement service.-->
+ <ThriftEntitlementReceivePort>10500</ThriftEntitlementReceivePort>
+
+ </Ports>
+
+ <!--
+ JNDI Configuration
+ -->
+ <JNDI>
+ <!--
+ The fully qualified name of the default initial context factory
+ -->
+ <DefaultInitialContextFactory>org.wso2.carbon.tomcat.jndi.CarbonJavaURLContextFactory</DefaultInitialContextFactory>
+ <!--
+ The restrictions that are done to various JNDI Contexts in a Multi-tenant environment
+ -->
+ <Restrictions>
+ <!--
+ Contexts that will be available only to the super-tenant
+ -->
+ <!-- <SuperTenantOnly>
+ <UrlContexts>
+ <UrlContext>
+ <Scheme>foo</Scheme>
+ </UrlContext>
+ <UrlContext>
+ <Scheme>bar</Scheme>
+ </UrlContext>
+ </UrlContexts>
+ </SuperTenantOnly> -->
+ <!--
+ Contexts that are common to all tenants
+ -->
+ <AllTenants>
+ <UrlContexts>
+ <UrlContext>
+ <Scheme>java</Scheme>
+ </UrlContext>
+ <!-- <UrlContext>
+ <Scheme>foo</Scheme>
+ </UrlContext> -->
+ </UrlContexts>
+ </AllTenants>
+ <!--
+ All other contexts not mentioned above will be available on a per-tenant basis
+ (i.e. will not be shared among tenants)
+ -->
+ </Restrictions>
+ </JNDI>
+
+ <!--
+ Property to determine if the server is running an a cloud deployment environment.
+ This property should only be used to determine deployment specific details that are
+ applicable only in a cloud deployment, i.e when the server deployed *-as-a-service.
+ -->
+ <IsCloudDeployment>false</IsCloudDeployment>
+
+ <!--
+ Property to determine whether usage data should be collected for metering purposes
+ -->
+ <EnableMetering>false</EnableMetering>
+
+ <!-- The Max time a thread should take for execution in seconds -->
+ <MaxThreadExecutionTime>600</MaxThreadExecutionTime>
+
+ <!--
+ A flag to enable or disable Ghost Deployer. By default this is set to false. That is
+ because the Ghost Deployer works only with the HTTP/S transports. If you are using
+ other transports, don't enable Ghost Deployer.
+ -->
+ <GhostDeployment>
+ <Enabled>false</Enabled>
+ </GhostDeployment>
+
+
+ <!--
+ Eager loading or lazy loading is a design pattern commonly used in computer programming which
+ will initialize an object upon creation or load on-demand. In carbon, lazy loading is used to
+ load tenant when a request is received only. Similarly Eager loading is used to enable load
+ existing tenants after carbon server starts up. Using this feature, you will be able to include
+ or exclude tenants which are to be loaded when server startup.
+
+ We can enable only one LoadingPolicy at a given time.
+
+ 1. Tenant Lazy Loading
+ This is the default behaviour and enabled by default. With this policy, tenants are not loaded at
+ server startup, but loaded based on-demand (i.e when a request is received for a tenant).
+ The default tenant idle time is 30 minutes.
+
+ 2. Tenant Eager Loading
+ This is by default not enabled. It can be be enabled by un-commenting the <EagerLoading> section.
+ The eager loading configurations supported are as below. These configurations can be given as the
+ value for <Include> element with eager loading.
+ (i)Load all tenants when server startup - *
+ (ii)Load all tenants except foo.com & bar.com - *,!foo.com,!bar.com
+ (iii)Load only foo.com & bar.com to be included - foo.com,bar.com
+ -->
+ <Tenant>
+ <LoadingPolicy>
+ <LazyLoading>
+ <IdleTime>30</IdleTime>
+ </LazyLoading>
+ <!-- <EagerLoading>
+ <Include>*,!foo.com,!bar.com</Include>
+ </EagerLoading>-->
+ </LoadingPolicy>
+ </Tenant>
+
+ <!--
+ Caching related configurations
+ -->
+ <Cache>
+ <!-- Default cache timeout in minutes -->
+ <DefaultCacheTimeout>15</DefaultCacheTimeout>
+ </Cache>
+
+ <!--
+ Axis2 related configurations
+ -->
+ <Axis2Config>
+ <!--
+ Location of the Axis2 Services & Modules repository
+
+ This can be a directory in the local file system, or a URL.
+
+ e.g.
+ 1. /home/wso2wsas/repository/ - An absolute path
+ 2. repository - In this case, the path is relative to CARBON_HOME
+ 3. file:///home/wso2wsas/repository/
+ 4. http://wso2wsas/repository/
+ -->
+ <RepositoryLocation>${carbon.home}/repository/deployment/server/</RepositoryLocation>
+
+ <!--
+ Deployment update interval in seconds. This is the interval between repository listener
+ executions.
+ -->
+ <DeploymentUpdateInterval>15</DeploymentUpdateInterval>
+
+ <!--
+ Location of the main Axis2 configuration descriptor file, a.k.a. axis2.xml file
+
+ This can be a file on the local file system, or a URL
+
+ e.g.
+ 1. /home/repository/axis2.xml - An absolute path
+ 2. conf/axis2.xml - In this case, the path is relative to CARBON_HOME
+ 3. file:///home/carbon/repository/axis2.xml
+ 4. http://repository/conf/axis2.xml
+ -->
+ <ConfigurationFile>${carbon.home}/repository/conf/axis2/axis2.xml</ConfigurationFile>
+
+ <!--
+ ServiceGroupContextIdleTime, which will be set in ConfigurationContex
+ for multiple clients which are going to access the same ServiceGroupContext
+ Default Value is 30 Sec.
+ -->
+ <ServiceGroupContextIdleTime>30000</ServiceGroupContextIdleTime>
+
+ <!--
+ This repository location is used to crete the client side configuration
+ context used by the server when calling admin services.
+ -->
+ <ClientRepositoryLocation>${carbon.home}/repository/deployment/client/</ClientRepositoryLocation>
+ <!-- This axis2 xml is used in createing the configuration context by the FE server
+ calling to BE server -->
+ <clientAxis2XmlLocation>${carbon.home}/repository/conf/axis2/axis2_client.xml</clientAxis2XmlLocation>
+ <!-- If this parameter is set, the ?wsdl on an admin service will not give the admin service wsdl. -->
+ <HideAdminServiceWSDLs>false</HideAdminServiceWSDLs>
+
+ <!--WARNING-Use With Care! Uncommenting bellow parameter would expose all AdminServices in HTTP transport.
+ With HTTP transport your credentials and data routed in public channels are vulnerable for sniffing attacks.
+ Use bellow parameter ONLY if your communication channels are confirmed to be secured by other means -->
+ <!--HttpAdminServices>*</HttpAdminServices-->
+
+ </Axis2Config>
+
+ <!--
+ The default user roles which will be created when the server
+ is started up for the first time.
+ -->
+ <ServiceUserRoles>
+ <Role>
+ <Name>admin</Name>
+ <Description>Default Administrator Role</Description>
+ </Role>
+ <Role>
+ <Name>user</Name>
+ <Description>Default User Role</Description>
+ </Role>
+ </ServiceUserRoles>
+
+ <!--
+ Enable following config to allow Emails as usernames.
+ -->
+ <!--EnableEmailUserName>true</EnableEmailUserName-->
+
+ <!--
+ Security configurations
+ -->
+ <Security>
+ <!--
+ KeyStore which will be used for encrypting/decrypting passwords
+ and other sensitive information.
+ -->
+ <KeyStore>
+ <!-- Keystore file location-->
+ <Location>${carbon.home}/repository/resources/security/wso2carbon.jks</Location>
+ <!-- Keystore type (JKS/PKCS12 etc.)-->
+ <Type>JKS</Type>
+ <!-- Keystore password-->
+ <Password>wso2carbon</Password>
+ <!-- Private Key alias-->
+ <KeyAlias>wso2carbon</KeyAlias>
+ <!-- Private Key password-->
+ <KeyPassword>wso2carbon</KeyPassword>
+ </KeyStore>
+
+ <!--
+ System wide trust-store which is used to maintain the certificates of all
+ the trusted parties.
+ -->
+ <TrustStore>
+ <!-- trust-store file location -->
+ <Location>${carbon.home}/repository/resources/security/client-truststore.jks</Location>
+ <!-- trust-store type (JKS/PKCS12 etc.) -->
+ <Type>JKS</Type>
+ <!-- trust-store password -->
+ <Password>wso2carbon</Password>
+ </TrustStore>
+
+ <!--
+ The Authenticator configuration to be used at the JVM level. We extend the
+ java.net.Authenticator to make it possible to authenticate to given servers and
+ proxies.
+ -->
+ <NetworkAuthenticatorConfig>
+ <!--
+ Below is a sample configuration for a single authenticator. Please note that
+ all child elements are mandatory. Not having some child elements would lead to
+ exceptions at runtime.
+ -->
+ <!-- <Credential> -->
+ <!--
+ the pattern that would match a subset of URLs for which this authenticator
+ would be used
+ -->
+ <!-- <Pattern>regularExpression</Pattern> -->
+ <!--
+ the type of this authenticator. Allowed values are:
+ 1. server
+ 2. proxy
+ -->
+ <!-- <Type>proxy</Type> -->
+ <!-- the username used to log in to server/proxy -->
+ <!-- <Username>username</Username> -->
+ <!-- the password used to log in to server/proxy -->
+ <!-- <Password>password</Password> -->
+ <!-- </Credential> -->
+ </NetworkAuthenticatorConfig>
+
+ <!--
+ The Tomcat realm to be used for hosted Web applications. Allowed values are;
+ 1. UserManager
+ 2. Memory
+
+ If this is set to 'UserManager', the realm will pick users & roles from the system's
+ WSO2 User Manager. If it is set to 'memory', the realm will pick users & roles from
+ CARBON_HOME/repository/conf/tomcat/tomcat-users.xml
+ -->
+ <TomcatRealm>UserManager</TomcatRealm>
+
+ <!--Option to disable storing of tokens issued by STS-->
+ <DisableTokenStore>false</DisableTokenStore>
+
+ <!--
+ Security token store class name. If this is not set, default class will be
+ org.wso2.carbon.security.util.SecurityTokenStore
+ -->
+ <!--TokenStoreClassName>org.wso2.carbon.identity.sts.store.DBTokenStore</TokenStoreClassName-->
+
+ <!--CSRFPreventionConfig>
+ <Enabled>true</Enabled>
+ <Rule>allow</Rule>
+
+ <Patterns>
+ <Pattern>carbon</Pattern>
+ <Pattern>commonauth</Pattern>
+ <Pattern>samlsso</Pattern>
+ <Pattern>authenticationendpoint</Pattern>
+ <Pattern>wso2</Pattern>
+ <Pattern>oauth2</Pattern>
+ <Pattern>openid</Pattern>
+ <Pattern>openidserver</Pattern>
+ <Pattern>passivests</Pattern>
+ <Pattern>services</Pattern>
+ </Patterns>
+
+ <WhiteList>
+ <Url>https://localhost:9443</Url>
+ </WhiteList>
+ </CSRFPreventionConfig>
+
+ <XSSPreventionConfig>
+ <Enabled>true</Enabled>
+ </XSSPreventionConfig-->
+
+ </Security>
+
+ <!--
+ The temporary work directory
+ -->
+ <WorkDirectory>${carbon.home}/tmp/work</WorkDirectory>
+
+ <!--
+ House-keeping configuration
+ -->
+ <HouseKeeping>
+
+ <!--
+ true - Start House-keeping thread on server startup
+ false - Do not start House-keeping thread on server startup.
+ The user will run it manually as and when he wishes.
+ -->
+ <AutoStart>true</AutoStart>
+
+ <!--
+ The interval in *minutes*, between house-keeping runs
+ -->
+ <Interval>10</Interval>
+
+ <!--
+ The maximum time in *minutes*, temp files are allowed to live
+ in the system. Files/directories which were modified more than
+ "MaxTempFileLifetime" minutes ago will be removed by the
+ house-keeping task
+ -->
+ <MaxTempFileLifetime>30</MaxTempFileLifetime>
+ </HouseKeeping>
+
+ <!--
+ Configuration for handling different types of file upload & other file uploading related
+ config parameters.
+ To map all actions to a particular FileUploadExecutor, use
+ <Action>*</Action>
+ -->
+ <FileUploadConfig>
+ <!--
+ The total file upload size limit in MB
+ -->
+ <TotalFileSizeLimit>100</TotalFileSizeLimit>
+
+ <Mapping>
+ <Actions>
+ <Action>keystore</Action>
+ <Action>certificate</Action>
+ <Action>*</Action>
+ </Actions>
+ <Class>org.wso2.carbon.ui.transports.fileupload.AnyFileUploadExecutor</Class>
+ </Mapping>
+
+ <Mapping>
+ <Actions>
+ <Action>jarZip</Action>
+ </Actions>
+ <Class>org.wso2.carbon.ui.transports.fileupload.JarZipUploadExecutor</Class>
+ </Mapping>
+ <Mapping>
+ <Actions>
+ <Action>dbs</Action>
+ </Actions>
+ <Class>org.wso2.carbon.ui.transports.fileupload.DBSFileUploadExecutor</Class>
+ </Mapping>
+ <Mapping>
+ <Actions>
+ <Action>tools</Action>
+ </Actions>
+ <Class>org.wso2.carbon.ui.transports.fileupload.ToolsFileUploadExecutor</Class>
+ </Mapping>
+ <Mapping>
+ <Actions>
+ <Action>toolsAny</Action>
+ </Actions>
+ <Class>org.wso2.carbon.ui.transports.fileupload.ToolsAnyFileUploadExecutor</Class>
+ </Mapping>
+ </FileUploadConfig>
+
+ <!--
+ Processors which process special HTTP GET requests such as ?wsdl, ?policy etc.
+
+ In order to plug in a processor to handle a special request, simply add an entry to this
+ section.
+
+ The value of the Item element is the first parameter in the query string(e.g. ?wsdl)
+ which needs special processing
+
+ The value of the Class element is a class which implements
+ org.wso2.carbon.transport.HttpGetRequestProcessor
+ -->
+ <HttpGetRequestProcessors>
+ <Processor>
+ <Item>info</Item>
+ <Class>org.wso2.carbon.core.transports.util.InfoProcessor</Class>
+ </Processor>
+ <Processor>
+ <Item>wsdl</Item>
+ <Class>org.wso2.carbon.core.transports.util.Wsdl11Processor</Class>
+ </Processor>
+ <Processor>
+ <Item>wsdl2</Item>
+ <Class>org.wso2.carbon.core.transports.util.Wsdl20Processor</Class>
+ </Processor>
+ <Processor>
+ <Item>xsd</Item>
+ <Class>org.wso2.carbon.core.transports.util.XsdProcessor</Class>
+ </Processor>
+ </HttpGetRequestProcessors>
+
+ <!-- Deployment Synchronizer Configuration. t Enabled value to true when running with "svn based" dep sync.
+ In master nodes you need to set both AutoCommit and AutoCheckout to true
+ and in worker nodes set only AutoCheckout to true.
+ -->
+ <DeploymentSynchronizer>
+ <Enabled>false</Enabled>
+ <AutoCommit>false</AutoCommit>
+ <AutoCheckout>true</AutoCheckout>
+ <RepositoryType>svn</RepositoryType>
+ <SvnUrl>http://svnrepo.example.com/repos/</SvnUrl>
+ <SvnUser>username</SvnUser>
+ <SvnPassword>password</SvnPassword>
+ <SvnUrlAppendTenantId>true</SvnUrlAppendTenantId>
+ </DeploymentSynchronizer>
+
+ <!-- Deployment Synchronizer Configuration. Uncomment the following section when running with "registry based" dep sync.
+ In master nodes you need to set both AutoCommit and AutoCheckout to true
+ and in worker nodes set only AutoCheckout to true.
+ -->
+ <!--<DeploymentSynchronizer>
+ <Enabled>true</Enabled>
+ <AutoCommit>false</AutoCommit>
+ <AutoCheckout>true</AutoCheckout>
+ </DeploymentSynchronizer>-->
+
+ <!-- Mediation persistence configurations. Only valid if mediation features are available i.e. ESB -->
+ <!--<MediationConfig>
+ <LoadFromRegistry>false</LoadFromRegistry>
+ <SaveToFile>false</SaveToFile>
+ <Persistence>enabled</Persistence>
+ <RegistryPersistence>enabled</RegistryPersistence>
+ </MediationConfig>-->
+
+ <!--
+ Server intializing code, specified as implementation classes of org.wso2.carbon.core.ServerInitializer.
+ This code will be run when the Carbon server is initialized
+ -->
+ <ServerInitializers>
+ <!--<Initializer></Initializer>-->
+ </ServerInitializers>
+
+ <!--
+ Indicates whether the Carbon Servlet is required by the system, and whether it should be
+ registered
+ -->
+ <RequireCarbonServlet>${require.carbon.servlet}</RequireCarbonServlet>
+
+ <!--
+ Carbon H2 OSGI Configuration
+ By default non of the servers start.
+ name="web" - Start the web server with the H2 Console
+ name="webPort" - The port (default: 8082)
+ name="webAllowOthers" - Allow other computers to connect
+ name="webSSL" - Use encrypted (HTTPS) connections
+ name="tcp" - Start the TCP server
+ name="tcpPort" - The port (default: 9092)
+ name="tcpAllowOthers" - Allow other computers to connect
+ name="tcpSSL" - Use encrypted (SSL) connections
+ name="pg" - Start the PG server
+ name="pgPort" - The port (default: 5435)
+ name="pgAllowOthers" - Allow other computers to connect
+ name="trace" - Print additional trace information; for all servers
+ name="baseDir" - The base directory for H2 databases; for all servers
+ -->
+ <!--H2DatabaseConfiguration>
+ <property name="web" />
+ <property name="webPort">8082</property>
+ <property name="webAllowOthers" />
+ <property name="webSSL" />
+ <property name="tcp" />
+ <property name="tcpPort">9092</property>
+ <property name="tcpAllowOthers" />
+ <property name="tcpSSL" />
+ <property name="pg" />
+ <property name="pgPort">5435</property>
+ <property name="pgAllowOthers" />
+ <property name="trace" />
+ <property name="baseDir">${carbon.home}</property>
+ </H2DatabaseConfiguration-->
+ <!--Disabling statistics reporter by default-->
+ <StatisticsReporterDisabled>true</StatisticsReporterDisabled>
+
+ <!-- Enable accessing Admin Console via HTTP -->
+ <!-- EnableHTTPAdminConsole>true</EnableHTTPAdminConsole -->
+
+ <!--
+ Default Feature Repository of WSO2 Carbon.
+ -->
+ <FeatureRepository>
+ <RepositoryName>default repository</RepositoryName>
+ <RepositoryURL>http://dist.wso2.org/p2/carbon/releases/4.4.1-SNAPSHOT</RepositoryURL>
+ </FeatureRepository>
+
+ <!--
+ Configure API Management
+ -->
+ <APIManagement>
+
+ <!--Uses the embedded API Manager by default. If you want to use an external
+ API Manager instance to manage APIs, configure below externalAPIManager-->
+
+ <Enabled>true</Enabled>
+
+ <!--Uncomment and configure API Gateway and
+ Publisher URLs to use external API Manager instance-->
+
+ <!--ExternalAPIManager>
+
+ <APIGatewayURL>http://localhost:8281</APIGatewayURL>
+ <APIPublisherURL>http://localhost:8281/publisher</APIPublisherURL>
+
+ </ExternalAPIManager-->
+
+ <LoadAPIContextsInServerStartup>true</LoadAPIContextsInServerStartup>
+ </APIManagement>
+</Server>
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 @@
+<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">
+
+ <providers>
+ <provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
+ </providers>
+
+ <datasources>
+
+ <datasource>
+ <name>ACTIVITI_DB</name>
+ <description>The datasource used for activiti engine</description>
+ <jndiConfig>
+ <name>jdbc/ActivitiDB</name>
+ </jndiConfig>
+ <definition type="RDBMS">
+ <configuration>
+ <url>jdbc:h2:repository/database/activiti;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000</url>
+ <username>wso2carbon</username>
+ <password>wso2carbon</password>
+ <driverClassName>org.h2.Driver</driverClassName>
+ <maxActive>50</maxActive>
+ <maxWait>60000</maxWait>
+ <testOnBorrow>true</testOnBorrow>
+ <validationQuery>SELECT 1</validationQuery>
+ <validationInterval>30000</validationInterval>
+ </configuration>
+ </definition>
+ </datasource>
+
+ </datasources>
+
+</datasources-configuration>
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 @@
+<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">
+
+ <providers>
+ <provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
+ </providers>
+
+ <datasources>
+ <datasource>
+ <name>BPS_DS</name>
+ <description/>
+ <jndiConfig>
+ <name>bpsds</name>
+ </jndiConfig>
+ <definition type="RDBMS">
+ <configuration>
+ <url>jdbc:mysql://localhost:3306/wso_bpel</url>
+ <username>wso_bpel</username>
+ <password>wso_bpel</password>
+ <driverClassName>com.mysql.jdbc.Driver</driverClassName>
+ <testOnBorrow>true</testOnBorrow>
+ <validationQuery>SELECT 1</validationQuery>
+ <validationInterval>30000</validationInterval>
+ <useDataSourceFactory>false</useDataSourceFactory>
+ <defaultAutoCommit>true</defaultAutoCommit>
+ <maxActive>100</maxActive>
+ <maxIdle>20</maxIdle>
+ <maxWait>10000</maxWait>
+ </configuration>
+ </definition>
+ </datasource>
+ </datasources>
+</datasources-configuration>
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 @@
+<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">
+
+ <providers>
+ <provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
+ </providers>
+
+ <datasources>
+
+ <datasource>
+ <name>WSO2_CARBON_DB</name>
+ <description>The datasource used for registry and user manager</description>
+ <jndiConfig>
+ <name>jdbc/WSO2CarbonDB</name>
+ </jndiConfig>
+ <definition type="RDBMS">
+ <configuration>
+ <url>jdbc:h2:repository/database/WSO2CARBON_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000</url>
+ <username>wso2carbon</username>
+ <password>wso2carbon</password>
+ <driverClassName>org.h2.Driver</driverClassName>
+ <maxActive>50</maxActive>
+ <maxWait>60000</maxWait>
+ <testOnBorrow>true</testOnBorrow>
+ <validationQuery>SELECT 1</validationQuery>
+ <validationInterval>30000</validationInterval>
+ <defaultAutoCommit>false</defaultAutoCommit>
+ </configuration>
+ </definition>
+ </datasource>
+
+ <!-- For an explanation of the properties, see: http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html -->
+ <!--datasource>
+ <name>SAMPLE_DATA_SOURCE</name>
+ <jndiConfig>
+ <name></name>
+ <environment>
+ <property name="java.naming.factory.initial"></property>
+ <property name="java.naming.provider.url"></property>
+ </environment>
+ </jndiConfig>
+ <definition type="RDBMS">
+ <configuration>
+
+ <defaultAutoCommit></defaultAutoCommit>
+ <defaultReadOnly></defaultReadOnly>
+ <defaultTransactionIsolation>NONE|READ_COMMITTED|READ_UNCOMMITTED|REPEATABLE_READ|SERIALIZABLE</defaultTransactionIsolation>
+ <defaultCatalog></defaultCatalog>
+ <username></username>
+ <password svns:secretAlias="WSO2.DB.Password"></password>
+ <maxActive></maxActive>
+ <maxIdle></maxIdle>
+ <initialSize></initialSize>
+ <maxWait></maxWait>
+
+ <dataSourceClassName>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</dataSourceClassName>
+ <dataSourceProps>
+ <property name="url">jdbc:mysql://localhost:3306/Test1</property>
+ <property name="user">root</property>
+ <property name="password">123</property>
+ </dataSourceProps>
+
+ </configuration>
+ </definition>
+ </datasource-->
+
+ </datasources>
+
+</datasources-configuration>
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 @@
+<?xml version="1.0"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.openo.common-services.common-utilities.wso2bpel-ext</groupId>
+ <artifactId>wso2bpel-root</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>wso2bpel-core-parent</artifactId>
+ <name>common-services-common-utilities/wso2bpel-ext/wso2bpel-core</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>BPEL4RESTLight</module>
+ <module>wso2bpel-mgr</module>
+ <module>distribution</module>
+ </modules>
+</project>
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 @@
+<?xml version="1.0"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>org.openo.common-services.common-utilities.wso2bpel-ext</groupId>
+ <artifactId>wso2bpel-core-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>wso2bpel-mgr</artifactId>
+ <name>common-services-common-utilities/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr</name>
+ <packaging>jar</packaging>
+ <properties>
+ <sonar.skip>true</sonar.skip>
+ </properties>
+
+ <repositories>
+ <repository>
+ <id>wso2-nexus</id>
+ <url>http://dist.wso2.org/maven2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>smartbearsoftware</id>
+ <url>http://smartbearsoftware.com/repository/maven2/</url>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.7</source>
+ <target>1.7</target>
+ <encoding>UTF-8</encoding>
+ <compilerArgs>
+ <arg>-verbose</arg>
+ <arg>-Xlint:unchecked</arg>
+ <arg>-Xlint:deprecation</arg>
+ <arg>-bootclasspath</arg>
+ <arg>${env.JAVA_HOME}/jre/lib/rt.jar</arg>
+ </compilerArgs>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <versionRange>[2.0,)</versionRange>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore/>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <configuration>
+ <createDependencyReducedPom>true</createDependencyReducedPom>
+ <filters>
+ <filter>
+ <artifact>*:*</artifact>
+ <excludes>
+ <exclude>META-INF/*.SF</exclude>
+ <exclude>META-INF/*.DSA</exclude>
+ <exclude>META-INF/*.RSA</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <transformers>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+ <mainClass>org.openo.carbon.bpel.Wso2BpelApplication</mainClass>
+ </transformer>
+ </transformers>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-core</artifactId>
+ <version>${dropwizard.version}</version>
+ <overWrite>true</overWrite>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-assets</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-hibernate</artifactId>
+ </dependency>
+ <!-- lombok -->
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-jersey2-jaxrs</artifactId>
+ </dependency>
+ <!-- jersey -->
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-server</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-multipart</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-servlet-core</artifactId>
+ </dependency>
+ <!-- consumer -->
+ <dependency>
+ <groupId>com.eclipsesource.jaxrs</groupId>
+ <artifactId>consumer</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>com.eclipsesource.jaxrs</groupId>
+ <artifactId>jersey-all</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!-- gson -->
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </dependency>
+ <!-- UT -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!-- UT end -->
+
+
+<dependency>
+ <groupId>org.apache.ws.commons.axiom.wso2</groupId>
+ <artifactId>axiom</artifactId>
+ <version>1.2.11.wso2v4</version>
+</dependency>
+<dependency>
+ <groupId>axion.wso2</groupId>
+ <artifactId>axion</artifactId>
+ <version>1.0.0.M3-dev-wso2v1</version>
+</dependency>
+<dependency>
+ <groupId>org.apache.axis2.wso2</groupId>
+ <artifactId>axis2</artifactId>
+ <version>1.6.1.wso2v10</version>
+</dependency>
+<dependency>
+ <groupId>org.apache.axis2.wso2</groupId>
+ <artifactId>axis2-jaxbri</artifactId>
+ <version>1.6.1.wso2v10</version>
+</dependency>
+<dependency>
+ <groupId>org.apache.axis2.wso2</groupId>
+ <artifactId>axis2-json</artifactId>
+ <version>1.6.1.wso2v10</version>
+</dependency>
+<dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-transport-jms</artifactId>
+ <version>1.0.0</version>
+</dependency>
+<dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-transport-mail</artifactId>
+ <version>1.0.0</version>
+</dependency>
+<dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-transport-sms</artifactId>
+ <version>1.0.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+</dependency>
+<dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <version>1.9.2</version>
+</dependency>
+<dependency>
+ <groupId>commons-codec.wso2</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.4.0.wso2v1</version>
+</dependency>
+<dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.1</version>
+</dependency>
+<dependency>
+ <groupId>commons-fileupload.wso2</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.2.2.wso2v1</version>
+</dependency>
+<dependency>
+ <groupId>commons-httpclient.wso2</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1.0.wso2v2</version>
+</dependency>
+<dependency>
+ <groupId>commons-io.wso2</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.0.0.wso2v2</version>
+</dependency>
+<dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.5</version>
+</dependency>
+<dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.2</version>
+</dependency>
+<dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.4</version>
+</dependency>
+<dependency>
+ <groupId>net.sf.ezmorph</groupId>
+ <artifactId>ezmorph</artifactId>
+ <version>1.0.6</version>
+</dependency>
+<dependency>
+ <groupId>org.apache.httpcomponents.wso2</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.2.5.wso2v1</version>
+</dependency>
+<dependency>
+ <groupId>org.apache.httpcomponents.wso2</groupId>
+ <artifactId>httpcore</artifactId>
+ <version>4.3.0.wso2v1</version>
+</dependency>
+<dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpmime</artifactId>
+ <version>4.3.1</version>
+</dependency>
+<dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.5.0</version>
+</dependency>
+<dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.3.GA</version>
+</dependency>
+<dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>javax.annotation-api</artifactId>
+ <version>1.2</version>
+</dependency>
+<dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <version>2.0.1</version>
+</dependency>
+<dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>0.7</version>
+</dependency>
+<dependency>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-jaxb</artifactId>
+ <version>2.25</version>
+</dependency>
+<dependency>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-multipart</artifactId>
+ <version>2.22.2</version>
+</dependency>
+<dependency>
+ <groupId>net.sf.json-lib</groupId>
+ <artifactId>json-lib</artifactId>
+ <version>2.4</version>
+ <classifier>jdk15</classifier>
+</dependency>
+<dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.16</version>
+</dependency>
+<dependency>
+ <groupId>com.jgoodies</groupId>
+ <artifactId>looks</artifactId>
+ <version>2.2.1</version>
+</dependency>
+<dependency>
+ <groupId>org.jvnet.mimepull</groupId>
+ <artifactId>mimepull</artifactId>
+ <version>1.9.3</version>
+</dependency>
+<dependency>
+ <groupId>org.apache.neethi.wso2</groupId>
+ <artifactId>neethi</artifactId>
+ <version>2.0.4.wso2v4</version>
+</dependency>
+<dependency>
+ <groupId>org.wso2.carbon</groupId>
+ <artifactId>org.wso2.carbon.bpel.stub</artifactId>
+ <version>4.2.1</version>
+</dependency>
+<dependency>
+ <groupId>org.wso2.securevault</groupId>
+ <artifactId>org.wso2.securevault</artifactId>
+ <version>1.0.0-wso2v2</version>
+</dependency>
+<dependency>
+ <groupId>wsdl4j.wso2</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>1.6.2.wso2v4</version>
+</dependency>
+<dependency>
+ <groupId>org.apache.xmlbeans</groupId>
+ <artifactId>xmlbeans</artifactId>
+ <version>2.4.0</version>
+</dependency>
+<dependency>
+ <groupId>org.apache.ws.commons.schema.wso2</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>1.4.7.wso2v2</version>
+</dependency>
+
+ <dependency>
+ <groupId>eviware</groupId>
+ <artifactId>soapui</artifactId>
+ <version>1.7.5</version>
+ </dependency>
+ <dependency>
+ <groupId>eviware</groupId>
+ <artifactId>soapui-xmlbeans</artifactId>
+ <version>1.7.5</version>
+ </dependency>
+
+ </dependencies>
+</project>
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<Wso2BpelConfiguration> {
+ 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<Wso2BpelConfiguration> 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<ServiceNode> nodes = new ArrayList<ServiceNode>();
+
+ /**
+ * 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<String> packageNameSet = new HashSet<String>();
+
+ private Map<String, String> 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, String>();
+ 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<String, Object> uploadFile(@FormDataParam("filename") String filename,
+ @FormDataParam("file") InputStream fileInputStream,
+ @FormDataParam("file") FormDataContentDisposition fileDetail,
+ @Context HttpServletRequest request, @Context HttpServletResponse response)
+ throws IOException {
+ Map<String, Object> map = new LinkedHashMap<String, Object>();
+ 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<String> auth = new ArrayList<String>();
+ 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<String, Object> bpsDeployPackage(String fileName, String fullName, String packageName,
+ HttpTransportProperties.Authenticator authenticator)
+ throws JsonParseException, JsonMappingException, IOException, AxisFault, Exception {
+ Map<String, Object> map = new HashMap<String, Object>();
+ 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<String, Object> delete(@PathParam("packageName") String packageName,
+ @Context HttpServletRequest request) {
+ Map<String, Object> map = new LinkedHashMap<String, Object>();
+ 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<String> auth = new ArrayList<String>();
+ 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<String, Object> bpsUndeployPackage(String packageName,
+ HttpTransportProperties.Authenticator authenticator)
+ throws JsonParseException, JsonMappingException, IOException, AxisFault, Exception {
+ Map<String, Object> map = new HashMap<String, Object>();
+ 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<String, Object> 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<String, Object> 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<String, Object> getParams(String jsonTemplate, Map<String, Object> 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<String, Object> listPackages(@QueryParam("page") String page,
+ @QueryParam("searchString") String searchString, @Context HttpServletRequest request)
+ throws IOException {
+ Map<String, Object> map = new LinkedHashMap<String, Object>();
+ 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<String> auth = new ArrayList<String>();
+ 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<String> auth = new ArrayList<String>();
+ 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<String, String> 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<String, String>();
+ //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<String, Object> startProcess(JsonNode jsonObj, @Context HttpServletRequest request) {
+ Map<String, Object> map = new LinkedHashMap<String, Object>();
+ String errorMessage = "unkown";
+
+ Map<String, Object> paramMap = new HashMap<String, Object>();
+ 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<String> paramSet = new HashSet<String>();
+ 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<OMElement> 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<String> auth = new ArrayList<String>();
+ 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<OMElement> iter = res.getChildrenWithLocalName("endpoints");
+ if (iter.hasNext()) {
+ OMElement endPoints = (OMElement) iter.next();
+ Iterator<OMElement> endPointIter = endPoints.getChildrenWithLocalName("endpointRef");
+ if (endPointIter.hasNext()) {
+ OMElement endpointRef = (OMElement) endPointIter.next();
+ Iterator<OMElement> endpointRefIter =
+ endpointRef.getChildrenWithLocalName("serviceLocations");
+ if (endpointRefIter.hasNext()) {
+ OMElement serviceLocations = (OMElement) endpointRefIter.next();
+ Iterator<OMElement> 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<Map> childList = new ArrayList<Map>();
+ 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> map = new LinkedHashMap<String, Object>();
+ String errorMessage = "unkown";
+
+ Map<String, Object> paramMap = new HashMap<String, Object>();
+ 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> T json2Bean(String jsonStr, Class<T> objClass)
+ throws JsonParseException, JsonMappingException, IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ return mapper.readValue(jsonStr, objClass);
+ }
+
+ @SuppressWarnings("deprecation")
+ public static <T> 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 <K>
+ * @param <V>
+ */
+@SuppressWarnings("serial")
+public class LRULinkedHashMap<K, V> extends LinkedHashMap<K, V> {
+ 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<K, V> 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<Map.Entry<K, V>> getAll() {
+ try {
+ lock.lock();
+ return new ArrayList<Map.Entry<K, V>>(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<String, WsdlInterface[]> wsdls = new LRULinkedHashMap<String, WsdlInterface[]>(256);
+
+ public SoapUtil() {
+ docBuilderFactory = DocumentBuilderFactory.newInstance();
+ docBuilderFactory.setNamespaceAware(true);
+ }
+
+ public Request[] getRequestTemplate(String wsdlUrl)
+ throws UnsupportedOperationException, IOException {
+ Request[] requests = new Request[0];
+ List<Request> requestList = new ArrayList<Request>();
+ 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("<MapSet>" + "<MapGroup id='Sheboygan'>" + "<Map>"
+ + "<Type>MapGuideddddddd</Type>" + "<SingleTile>true</SingleTile>" + "<Extension>"
+ + "<ResourceId>ddd</ResourceId>" + "</Extension>" + "</Map>" + "<Map>" + "<Type>ccc</Type>"
+ + "<SingleTile>ggg</SingleTile>" + "<Extension>" + "<ResourceId>aaa</ResourceId>"
+ + "</Extension>" + "</Map>" + "<Extension />" + "</MapGroup>" + "<ddd>" + "33333333"
+ + "</ddd>" + "<ddd>" + "444" + "</ddd>" + "</MapSet>"));
+
+ String xml =
+ "<body> <p:helloXsl xmlns:p=\"http://ode/bpel/unit-test.wsdl\"> <!--Exactly 1 occurrence--> <TestPart> <!--Exactly 1 occurrence--> <content>fdsafasdfasdf</content> </TestPart> </p:helloXsl></body>";
+
+ System.out.println(Xml2JsonUtil.xml2JSON(xml));
+
+ xml =
+ "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:unit=\"http://ode/bpel/unit-test.wsdl\"> <soapenv:Header/> <soapenv:Body> <unit:helloXsl> <TestPart> <content>?</content> </TestPart> </unit:helloXsl> </soapenv:Body></soapenv:Envelope>";
+
+ System.out.println(Xml2JsonUtil.xml2JSON(xml));
+
+ xml =
+ "<ns:uploadServiceResponse xmlns:ns=\"http://services.deployer.bpel.carbon.wso2.org\"><ns:return xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:nil=\"true\"/></ns:uploadServiceResponse>";
+
+ System.out.println(Xml2JsonUtil.xml2JSON(xml));
+
+ xml =
+ "<body> <p:planInput xmlns:p=\"http://www.open-o.org/tosca/nfv/2015/12\"> <!--Exactly 1 occurrence--> <p:sfc_count>2</p:sfc_count> <!--Exactly 1 occurrence--> <p:iaUrl></p:iaUrl> <!--Exactly 1 occurrence--> <p:vnfmId>112</p:vnfmId> <!--Exactly 1 occurrence--> <p:object_context>{\"e\":{\"f\":\"4\"}}</p:object_context> <!--Exactly 1 occurrence--> <p:statusUrl></p:statusUrl> <!--Exactly 1 occurrence--> <p:serviceTemplateId>?</p:serviceTemplateId> <!--Exactly 1 occurrence--> <p:roUrl></p:roUrl> <!--Exactly 1 occurrence--> <p:vl_count>2</p:vl_count> <!--Exactly 1 occurrence--> <p:containerapiUrl>?</p:containerapiUrl> <!--Exactly 1 occurrence--> <p:flavor></p:flavor> <!--Exactly 1 occurrence--> <p:nsInstanceId>223</p:nsInstanceId> <!--Exactly 1 occurrence--> <p:instanceId>334</p:instanceId> <!--Exactly 1 occurrence--> <p:resourceUrl></p:resourceUrl> <!--Exactly 1 occurrence--> <p:vnf_count>2</p:vnf_count> <!--Exactly 1 occurrence--> <p:callbackId></p:callbackId> <!--Exactly 1 occurrence--> <p:object_additionalParamForVnf>[{\"b\":1},{\"c\":{\"d\":\"2\"}}}]</p:object_additionalParamForVnf> <!--Exactly 1 occurrence--> <p:object_additionalParamForNs>[{\"a\":3},{\"e\":{\"f\":\"4\"}}}]</p:object_additionalParamForNs> <!--Exactly 1 occurrence--> <p:flavorParams></p:flavorParams> </p:planInput></body>";
+
+ 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 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ 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.
+
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+ version="3.0"
+ metadata-complete="true">
+
+ <description>
+ ZENAP API-DOC.
+ </description>
+ <display-name>ZENAP API-DOC</display-name>
+ <!-- Define example filters -->
+
+
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.xhtml</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>
+
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 <Maniac@SoftwareManiacs.Org> */
+.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
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.eot
Binary files 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 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg">
+<defs >
+<font id="DroidSans" horiz-adv-x="1123" ><font-face
+ font-family="Droid Sans"
+ units-per-em="2048"
+ panose-1="2 11 8 6 3 8 4 2 2 4"
+ ascent="1907"
+ descent="-492"
+ alphabetic="0" />
+<glyph unicode=" " glyph-name="space" horiz-adv-x="532" />
+<glyph unicode="!" glyph-name="exclam" horiz-adv-x="586" d="M416 485H172L121 1462H467L416 485ZM117 143Q117 190 130 222T168 275T224 304T293 313Q328 313 359 304T415 275T453 223T467 143Q467 98 453 66T415 13T360 -17T293 -27Q256 -27 224 -18T168 13T131
+66T117 143Z" />
+<glyph unicode="&quot;" glyph-name="quotedbl" horiz-adv-x="967" d="M412 1462L371 934H174L133 1462H412ZM834 1462L793 934H596L555 1462H834Z" />
+<glyph unicode="#" glyph-name="numbersign" horiz-adv-x="1323" d="M999 844L952 612H1210V406H913L836 0H616L694 406H500L424 0H209L283 406H45V612H322L369 844H117V1053H406L483 1460H702L625 1053H823L901 1460H1116L1038 1053H1278V844H999ZM539 612H735L782
+844H586L539 612Z" />
+<glyph unicode="$" glyph-name="dollar" horiz-adv-x="1128" d="M1061 457Q1061 382 1035 318T956 206T825 127T645 86V-119H508V82Q442 84 386 90T281 107T188 133T100 168V432Q142 411 191 392T294 358T401 331T508 317V635Q500 638 491 642Q483 645 475 648T461
+653Q370 688 302 726T189 811T121 915T98 1044Q98 1119 126 1180T208 1287T337 1361T508 1399V1556H645V1405Q732 1400 823 1380T1014 1317L913 1083Q848 1109 778 1129T645 1155V862L684 848Q779 813 850 776T968 693T1038 590T1061 457ZM760 451Q760 475 754
+493T733 526T698 553T645 580V328Q704 337 732 367T760 451ZM399 1051Q399 1004 425 973T508 920V1153Q454 1147 427 1123T399 1051Z" />
+<glyph unicode="%" glyph-name="percent" horiz-adv-x="1804" d="M315 1024Q315 897 337 835T410 772Q459 772 482 834T506 1024Q506 1274 410 1274Q360 1274 338 1213T315 1024ZM758 1026Q758 918 738 832T674 687T565 597T408 565Q323 565 259 596T151 687T85
+832T63 1026Q63 1134 83 1219T145 1362T253 1452T408 1483Q494 1483 559 1452T669 1363T735 1219T758 1026ZM1425 1462L614 0H375L1186 1462H1425ZM1298 440Q1298 313 1320 251T1393 188Q1442 188 1465 250T1489 440Q1489 690 1393 690Q1343 690 1321 629T1298
+440ZM1741 442Q1741 334 1721 249T1657 104T1548 14T1391 -18Q1306 -18 1242 13T1135 104T1069 248T1047 442Q1047 550 1067 635T1129 778T1236 868T1391 899Q1477 899 1542 868T1652 779T1718 635T1741 442Z" />
+<glyph unicode="&amp;" glyph-name="ampersand" horiz-adv-x="1479" d="M1475 0H1098L1001 100Q921 45 825 13T612 -20Q492 -20 395 10T228 94T120 225T82 395Q82 472 100 532T153 642T235 731T344 807Q306 853 280 895T237 979T214 1062T207 1149Q207 1227 237
+1288T322 1393T452 1460T618 1483Q704 1483 776 1462T901 1401T984 1301T1014 1165Q1014 1096 992 1039T931 932T842 842T731 766L991 498Q1026 564 1052 637T1098 784H1415Q1400 727 1380 664T1332 538T1270 411T1192 291L1475 0ZM403 424Q403 380 419 345T463
+286T530 249T614 236Q674 236 725 251T819 295L510 625Q459 583 431 535T403 424ZM731 1124Q731 1155 721 1176T695 1212T658 1232T616 1239Q594 1239 572 1233T531 1214T501 1178T489 1122Q489 1070 512 1024T575 932Q652 976 691 1020T731 1124Z" />
+<glyph unicode="&apos;" glyph-name="quotesingle" horiz-adv-x="545" d="M412 1462L371 934H174L133 1462H412Z" />
+<glyph unicode="(" glyph-name="parenleft" horiz-adv-x="694" d="M82 561Q82 686 100 807T155 1043T248 1263T383 1462H633Q492 1269 420 1038T348 563Q348 444 366 326T420 95T509 -124T631 -324H383Q305 -234 249 -131T155 84T100 317T82 561Z" />
+<glyph unicode=")" glyph-name="parenright" horiz-adv-x="694" d="M612 561Q612 437 594 317T539 85T446 -131T311 -324H63Q132 -230 185 -124T274 95T328 326T346 563Q346 807 274 1038T61 1462H311Q389 1369 445 1264T539 1044T594 808T612 561Z" />
+<glyph unicode="*" glyph-name="asterisk" horiz-adv-x="1116" d="M688 1556L647 1188L1020 1292L1053 1040L713 1016L936 719L709 598L553 911L416 600L180 719L401 1016L63 1042L102 1292L467 1188L426 1556H688Z" />
+<glyph unicode="+" glyph-name="plus" horiz-adv-x="1128" d="M455 612H88V831H455V1200H674V831H1040V612H674V248H455V612Z" />
+<glyph unicode="," glyph-name="comma" horiz-adv-x="594" d="M459 215Q445 161 426 100T383 -23T334 -146T283 -264H63Q78 -203 92 -137T120 -6T145 122T164 238H444L459 215Z" />
+<glyph unicode="-" glyph-name="hyphen" horiz-adv-x="659" d="M61 424V674H598V424H61Z" />
+<glyph unicode="." glyph-name="period" horiz-adv-x="584" d="M117 143Q117 190 130 222T168 275T224 304T293 313Q328 313 359 304T415 275T453 223T467 143Q467 98 453 66T415 13T360 -17T293 -27Q256 -27 224 -18T168 13T131 66T117 143Z" />
+<glyph unicode="/" glyph-name="slash" horiz-adv-x="846" d="M836 1462L291 0H14L559 1462H836Z" />
+<glyph unicode="0" glyph-name="zero" horiz-adv-x="1128" d="M1065 731Q1065 554 1038 415T950 179T794 31T563 -20Q436 -20 342 31T186 179T94 415T63 731Q63 908 90 1048T178 1285T333 1433T563 1485Q689 1485 783 1434T940 1286T1034 1049T1065 731ZM371 731Q371
+481 414 355T563 229Q667 229 712 354T758 731Q758 982 713 1108T563 1235Q510 1235 474 1203T414 1108T381 951T371 731Z" />
+<glyph unicode="1" glyph-name="one" horiz-adv-x="1128" d="M817 0H508V846Q508 872 508 908T510 984T513 1064T516 1137Q511 1131 499 1119T472 1093T441 1063T410 1036L242 901L92 1087L563 1462H817V0Z" />
+<glyph unicode="2" glyph-name="two" horiz-adv-x="1128" d="M1063 0H82V215L426 586Q491 656 544 715T635 830T694 944T715 1069Q715 1143 671 1184T551 1225Q472 1225 399 1186T246 1075L78 1274Q123 1315 172 1352T280 1419T410 1465T569 1483Q674 1483 757
+1454T900 1372T990 1242T1022 1071Q1022 985 992 907T910 753T790 603T643 451L467 274V260H1063V0Z" />
+<glyph unicode="3" glyph-name="three" horiz-adv-x="1128" d="M1006 1135Q1006 1059 982 999T915 893T815 817T690 770V764Q867 742 958 657T1049 426Q1049 330 1015 249T909 107T729 14T473 -20Q355 -20 251 -1T57 59V322Q102 298 152 280T252 250T350 231T442
+225Q528 225 585 241T676 286T724 355T739 444Q739 489 721 525T661 587T552 627T387 641H283V858H385Q477 858 538 874T635 919T687 986T702 1067Q702 1145 654 1189T500 1233Q452 1233 411 1224T334 1200T269 1168T215 1133L59 1339Q101 1370 150 1396T258 1441T383
+1472T526 1483Q634 1483 722 1460T874 1392T971 1283T1006 1135Z" />
+<glyph unicode="4" glyph-name="four" horiz-adv-x="1128" d="M1085 303H909V0H608V303H4V518L625 1462H909V543H1085V303ZM608 543V791Q608 804 608 828T610 884T612 948T615 1011T618 1063T621 1096H612Q594 1054 572 1007T520 913L276 543H608Z" />
+<glyph unicode="5" glyph-name="five" horiz-adv-x="1128" d="M598 934Q692 934 773 905T914 820T1008 681T1042 489Q1042 370 1005 276T896 116T718 15T473 -20Q418 -20 364 -15T261 -1T167 24T86 59V326Q121 306 167 289T262 259T362 239T457 231Q591 231 661
+286T731 463Q731 571 663 627T451 684Q425 684 396 681T338 673T283 663T238 651L115 717L170 1462H942V1200H438L414 913Q446 920 488 927T598 934Z" />
+<glyph unicode="6" glyph-name="six" horiz-adv-x="1128" d="M76 621Q76 726 87 830T128 1029T208 1207T336 1349T522 1444T776 1479Q797 1479 822 1478T872 1476T922 1471T965 1464V1217Q927 1226 885 1231T799 1237Q664 1237 577 1204T439 1110T367 966T340
+780H352Q372 816 400 847T467 901T552 937T659 950Q754 950 830 919T958 829T1039 684T1067 487Q1067 368 1034 274T938 115T788 15T590 -20Q482 -20 388 18T225 136T116 335T76 621ZM584 227Q625 227 658 242T716 289T754 369T768 483Q768 590 724 651T588 713Q542
+713 504 695T439 648T398 583T383 510Q383 459 395 409T433 318T496 252T584 227Z" />
+<glyph unicode="7" glyph-name="seven" horiz-adv-x="1128" d="M207 0L727 1200H55V1460H1063V1266L530 0H207Z" />
+<glyph unicode="8" glyph-name="eight" horiz-adv-x="1128" d="M565 1481Q656 1481 737 1459T879 1393T976 1283T1012 1128Q1012 1062 992 1009T937 912T854 834T750 772Q808 741 863 703T962 618T1031 511T1057 379Q1057 288 1021 214T920 88T765 8T565 -20Q447
+-20 355 7T200 84T105 207T72 371Q72 446 94 506T154 614T243 699T352 764Q303 795 260 831T186 912T136 1011T117 1130Q117 1217 153 1282T252 1392T395 1459T565 1481ZM358 389Q358 349 371 316T409 258T473 221T561 207Q666 207 718 256T770 387Q770 429 753
+462T708 524T645 577T575 623L553 637Q509 615 473 590T412 534T372 467T358 389ZM563 1255Q530 1255 502 1245T453 1216T420 1169T408 1106Q408 1064 420 1034T454 980T504 938T565 901Q596 917 624 936T673 979T708 1035T721 1106Q721 1141 709 1169T676 1216T626
+1245T563 1255Z" />
+<glyph unicode="9" glyph-name="nine" horiz-adv-x="1128" d="M1055 838Q1055 733 1044 629T1003 429T923 252T795 109T609 15T354 -20Q333 -20 308 -19T258 -17T208 -13T166 -6V242Q203 232 245 227T332 221Q467 221 554 254T692 348T764 493T791 678H778Q758
+642 730 611T664 557T578 521T471 508Q376 508 300 539T172 629T91 774T63 971Q63 1090 96 1184T192 1343T342 1444T541 1479Q649 1479 743 1441T906 1323T1015 1123T1055 838ZM547 1231Q506 1231 472 1216T414 1170T376 1090T362 975Q362 869 407 807T543 745Q589
+745 627 763T692 810T733 875T748 948Q748 999 736 1049T698 1140T635 1206T547 1231Z" />
+<glyph unicode=":" glyph-name="colon" horiz-adv-x="584" d="M117 143Q117 190 130 222T168 275T224 304T293 313Q328 313 359 304T415 275T453 223T467 143Q467 98 453 66T415 13T360 -17T293 -27Q256 -27 224 -18T168 13T131 66T117 143ZM117 969Q117 1016
+130 1048T168 1101T224 1130T293 1139Q328 1139 359 1130T415 1101T453 1049T467 969Q467 924 453 892T415 839T360 809T293 799Q256 799 224 808T168 838T131 891T117 969Z" />
+<glyph unicode=";" glyph-name="semicolon" horiz-adv-x="594" d="M444 238L459 215Q445 161 426 100T383 -23T334 -146T283 -264H63Q78 -203 92 -137T120 -6T145 122T164 238H444ZM117 969Q117 1016 130 1048T168 1101T224 1130T293 1139Q328 1139 359 1130T415
+1101T453 1049T467 969Q467 924 453 892T415 839T360 809T293 799Q256 799 224 808T168 838T131 891T117 969Z" />
+<glyph unicode="&lt;" glyph-name="less" horiz-adv-x="1128" d="M1040 203L88 641V784L1040 1280V1040L397 723L1040 442V203Z" />
+<glyph unicode="=" glyph-name="equal" horiz-adv-x="1128" d="M88 807V1024H1040V807H88ZM88 418V637H1040V418H88Z" />
+<glyph unicode="&gt;" glyph-name="greater" horiz-adv-x="1128" d="M88 442L731 723L88 1040V1280L1040 784V641L88 203V442Z" />
+<glyph unicode="?" glyph-name="question" horiz-adv-x="940" d="M264 485V559Q264 610 274 651T306 730T362 803T444 877Q486 910 515 936T562 987T588 1041T596 1106Q596 1163 558 1200T440 1237Q371 1237 292 1208T127 1137L25 1358Q68 1383 118 1405T223 1445T334
+1473T444 1483Q546 1483 628 1459T767 1387T854 1273T885 1120Q885 1057 871 1008T830 916T761 834T664 750Q622 717 596 693T554 646T534 601T528 545V485H264ZM231 143Q231 190 244 222T282 275T338 304T408 313Q443 313 474 304T530 275T568 223T582 143Q582
+98 568 66T530 13T475 -17T408 -27Q371 -27 339 -18T282 13T245 66T231 143Z" />
+<glyph unicode="@" glyph-name="at" horiz-adv-x="1774" d="M1673 752Q1673 657 1651 564T1582 398T1467 279T1303 233Q1265 233 1232 242T1170 269T1122 310T1090 362H1075Q1056 337 1031 314T975 272T907 244T825 233Q742 233 678 261T569 342T502 468T479 631Q479
+734 510 820T599 968T740 1065T926 1100Q971 1100 1019 1095T1111 1082T1195 1064T1262 1044L1241 625Q1239 603 1239 582T1239 555Q1239 513 1245 486T1262 444T1286 422T1315 416Q1350 416 1376 443T1419 516T1445 623T1454 754Q1454 882 1416 982T1311 1151T1150
+1256T948 1292Q795 1292 679 1241T484 1099T365 882T324 608Q324 470 359 364T463 185T633 75T866 37Q922 37 981 44T1098 63T1213 92T1321 129V-63Q1227 -105 1113 -129T868 -154Q687 -154 545 -103T304 46T154 283T102 602Q102 726 129 839T207 1050T331 1227T499
+1363T706 1450T948 1481Q1106 1481 1239 1431T1468 1286T1619 1056T1673 752ZM711 627Q711 515 749 466T850 416Q892 416 922 435T972 490T1002 575T1016 686L1028 907Q1008 912 981 915T926 918Q867 918 826 893T760 827T723 734T711 627Z" />
+<glyph unicode="A" glyph-name="A" horiz-adv-x="1331" d="M1018 0L918 348H414L313 0H0L475 1468H854L1331 0H1018ZM846 608L752 928Q746 946 734 987T709 1077T683 1177T666 1262Q662 1240 656 1210T641 1147T623 1079T606 1015T592 962T582 928L489 608H846Z" />
+<glyph unicode="B" glyph-name="B" horiz-adv-x="1315" d="M184 1462H612Q750 1462 854 1443T1028 1380T1133 1266T1169 1092Q1169 1030 1154 976T1110 881T1040 813T944 776V766Q999 754 1046 732T1129 670T1185 570T1206 424Q1206 324 1171 246T1071 113T912
+29T700 0H184V1462ZM494 883H655Q713 883 752 893T815 925T849 977T860 1051Q860 1135 808 1171T641 1208H494V883ZM494 637V256H676Q737 256 778 270T845 310T882 373T893 455Q893 496 882 529T845 587T775 624T668 637H494Z" />
+<glyph unicode="C" glyph-name="C" horiz-adv-x="1305" d="M805 1225Q716 1225 648 1191T533 1092T462 935T438 727Q438 610 459 519T525 366T639 271T805 238Q894 238 983 258T1178 315V55Q1130 35 1083 21T987 -2T887 -15T776 -20Q607 -20 483 34T278 186T158
+422T119 729Q119 895 164 1033T296 1272T511 1427T805 1483Q914 1483 1023 1456T1233 1380L1133 1128Q1051 1167 968 1196T805 1225Z" />
+<glyph unicode="D" glyph-name="D" horiz-adv-x="1434" d="M1315 745Q1315 560 1265 421T1119 188T885 47T569 0H184V1462H612Q773 1462 902 1416T1124 1280T1265 1055T1315 745ZM1001 737Q1001 859 977 947T906 1094T792 1180T637 1208H494V256H608Q804 256 902
+376T1001 737Z" />
+<glyph unicode="E" glyph-name="E" horiz-adv-x="1147" d="M1026 0H184V1462H1026V1208H494V887H989V633H494V256H1026V0Z" />
+<glyph unicode="F" glyph-name="F" horiz-adv-x="1124" d="M489 0H184V1462H1022V1208H489V831H985V578H489V0Z" />
+<glyph unicode="G" glyph-name="G" horiz-adv-x="1483" d="M739 821H1319V63Q1261 44 1202 29T1080 3T947 -14T799 -20Q635 -20 509 28T296 172T164 408T119 733Q119 905 169 1044T316 1280T556 1430T883 1483Q1000 1483 1112 1458T1317 1393L1214 1145Q1146 1179
+1061 1202T881 1225Q779 1225 698 1190T558 1089T469 932T438 727Q438 619 459 530T527 375T645 274T819 238Q885 238 930 244T1016 258V563H739V821Z" />
+<glyph unicode="H" glyph-name="H" horiz-adv-x="1485" d="M1300 0H991V631H494V0H184V1462H494V889H991V1462H1300V0Z" />
+<glyph unicode="I" glyph-name="I" horiz-adv-x="797" d="M731 0H66V176L244 258V1204L66 1286V1462H731V1286L553 1204V258L731 176V0Z" />
+<glyph unicode="J" glyph-name="J" horiz-adv-x="678" d="M-2 -430Q-67 -430 -116 -424T-199 -408V-150Q-162 -158 -122 -164T-33 -170Q13 -170 52 -160T121 -126T167 -60T184 43V1462H494V53Q494 -73 458 -164T356 -314T199 -402T-2 -430Z" />
+<glyph unicode="K" glyph-name="K" horiz-adv-x="1298" d="M1298 0H946L610 608L494 522V0H184V1462H494V758L616 965L950 1462H1294L827 803L1298 0Z" />
+<glyph unicode="L" glyph-name="L" horiz-adv-x="1096" d="M184 0V1462H494V256H1026V0H184Z" />
+<glyph unicode="M" glyph-name="M" horiz-adv-x="1870" d="M772 0L451 1147H442Q448 1055 452 969Q454 932 455 893T458 816T460 743T461 680V0H184V1462H606L922 344H928L1264 1462H1686V0H1397V692Q1397 718 1397 751T1399 821T1401 896T1404 970Q1408 1054
+1411 1145H1403L1057 0H772Z" />
+<glyph unicode="N" glyph-name="N" horiz-adv-x="1604" d="M1419 0H1026L451 1106H442Q448 1029 452 953Q456 888 458 817T461 688V0H184V1462H575L1149 367H1155Q1152 443 1148 517Q1147 549 1146 582T1143 649T1142 714T1141 770V1462H1419V0Z" />
+<glyph unicode="O" glyph-name="O" horiz-adv-x="1548" d="M1430 733Q1430 564 1391 425T1270 187T1066 34T774 -20Q606 -20 483 34T279 187T159 425T119 735Q119 905 158 1043T279 1280T483 1431T776 1485Q944 1485 1067 1432T1270 1280T1390 1043T1430 733ZM438
+733Q438 618 458 527T519 372T624 274T774 240Q863 240 926 274T1030 371T1090 526T1110 733Q1110 848 1091 939T1031 1095T927 1193T776 1227Q689 1227 625 1193T520 1095T458 940T438 733Z" />
+<glyph unicode="P" glyph-name="P" horiz-adv-x="1225" d="M494 774H555Q686 774 752 826T819 995Q819 1104 760 1156T573 1208H494V774ZM1133 1006Q1133 910 1104 822T1009 667T834 560T565 520H494V0H184V1462H590Q731 1462 833 1431T1002 1341T1101 1198T1133 1006Z" />
+<glyph unicode="Q" glyph-name="Q" horiz-adv-x="1548" d="M1430 733Q1430 614 1411 510T1352 319T1253 166T1112 55L1473 -348H1075L807 -18Q800 -18 794 -19Q789 -20 784 -20T774 -20Q606 -20 483 34T279 187T159 425T119 735Q119 905 158 1043T279 1280T483
+1431T776 1485Q944 1485 1067 1432T1270 1280T1390 1043T1430 733ZM438 733Q438 618 458 527T519 372T624 274T774 240Q863 240 926 274T1030 371T1090 526T1110 733Q1110 848 1091 939T1031 1095T927 1193T776 1227Q689 1227 625 1193T520 1095T458 940T438 733Z"
+/>
+<glyph unicode="R" glyph-name="R" horiz-adv-x="1290" d="M494 813H578Q707 813 763 864T819 1016Q819 1120 759 1164T573 1208H494V813ZM494 561V0H184V1462H584Q865 1462 999 1354T1133 1024Q1133 949 1113 888T1060 780T983 697T891 637Q1002 459 1090 319Q1128
+259 1163 202T1227 100T1273 28L1290 0H946L629 561H494Z" />
+<glyph unicode="S" glyph-name="S" horiz-adv-x="1073" d="M985 406Q985 308 952 230T854 96T696 10T481 -20Q375 -20 277 2T94 68V356Q142 333 191 312T290 273T391 246T492 236Q543 236 579 247T638 279T671 328T682 391Q682 432 665 463T616 522T540 576T440
+631Q394 655 337 689T230 773T145 895T111 1067Q111 1165 143 1242T236 1373T381 1455T573 1483Q626 1483 676 1476T776 1456T876 1424T979 1380L879 1139Q834 1160 795 1176T719 1203T647 1219T575 1225Q497 1225 456 1184T414 1073Q414 1036 426 1008T466 954T537
+903T643 844Q718 804 781 763T889 671T960 556T985 406Z" />
+<glyph unicode="T" glyph-name="T" horiz-adv-x="1124" d="M717 0H408V1204H41V1462H1083V1204H717V0Z" />
+<glyph unicode="U" glyph-name="U" horiz-adv-x="1466" d="M1292 1462V516Q1292 402 1258 304T1153 134T976 21T727 -20Q592 -20 489 18T316 128T210 298T174 520V1462H483V543Q483 462 499 405T546 311T625 257T735 240Q866 240 924 316T983 545V1462H1292Z" />
+<glyph unicode="V" glyph-name="V" horiz-adv-x="1249" d="M936 1462H1249L793 0H455L0 1462H313L561 582Q566 565 574 525T592 437T611 341T625 260Q630 293 639 341T658 436T677 524T692 582L936 1462Z" />
+<glyph unicode="W" glyph-name="W" horiz-adv-x="1898" d="M1546 0H1194L1014 721Q1010 736 1005 763T992 824T978 895T965 967T955 1031T948 1079Q946 1061 942 1032T931 968T919 896T906 825T893 763T883 719L705 0H352L0 1462H305L471 664Q474 648 479 618T492
+549T506 469T521 387T534 313T543 256Q546 278 551 312T563 384T576 464T590 540T601 603T610 643L813 1462H1085L1288 643Q1291 631 1296 604T1308 541T1322 464T1335 385T1347 312T1356 256Q1359 278 1364 312T1377 387T1391 469T1406 549T1418 617T1427 664L1593
+1462H1898L1546 0Z" />
+<glyph unicode="X" glyph-name="X" horiz-adv-x="1284" d="M1284 0H930L631 553L332 0H0L444 754L31 1462H373L647 936L915 1462H1249L831 737L1284 0Z" />
+<glyph unicode="Y" glyph-name="Y" horiz-adv-x="1196" d="M598 860L862 1462H1196L752 569V0H444V559L0 1462H336L598 860Z" />
+<glyph unicode="Z" glyph-name="Z" horiz-adv-x="1104" d="M1055 0H49V201L668 1206H68V1462H1036V1262L418 256H1055V0Z" />
+<glyph unicode="[" glyph-name="bracketleft" horiz-adv-x="678" d="M627 -324H143V1462H627V1251H403V-113H627V-324Z" />
+<glyph unicode="\" glyph-name="backslash" horiz-adv-x="846" d="M289 1462L834 0H557L12 1462H289Z" />
+<glyph unicode="]" glyph-name="bracketright" horiz-adv-x="678" d="M51 -113H274V1251H51V1462H535V-324H51V-113Z" />
+<glyph unicode="^" glyph-name="asciicircum" horiz-adv-x="1090" d="M8 520L446 1470H590L1085 520H846L524 1163Q455 1002 384 839T244 520H8Z" />
+<glyph unicode="_" glyph-name="underscore" horiz-adv-x="842" d="M846 -324H-4V-184H846V-324Z" />
+<glyph unicode="`" glyph-name="grave" horiz-adv-x="1182" d="M645 1241Q611 1269 564 1310T470 1396T386 1480T332 1548V1569H674Q690 1535 711 1495T756 1414T803 1335T848 1268V1241H645Z" />
+<glyph unicode="a" glyph-name="a" horiz-adv-x="1176" d="M809 0L750 152H741Q708 107 675 75T603 21T516 -10T403 -20Q335 -20 277 1T177 66T110 176T86 334Q86 512 200 596T541 690L719 696V780Q719 849 679 882T567 915Q495 915 427 894T289 838L190 1040Q274
+1087 376 1114T590 1141Q799 1141 910 1043T1022 745V0H809ZM719 518L618 514Q557 512 515 498T448 461T411 405T399 332Q399 262 433 233T522 203Q564 203 600 217T662 260T704 330T719 426V518Z" />
+<glyph unicode="b" glyph-name="b" horiz-adv-x="1245" d="M756 1139Q842 1139 913 1102T1035 992T1114 811T1143 561Q1143 417 1115 309T1034 127T909 17T748 -20Q692 -20 649 -8T571 24T512 69T465 123H444L393 0H160V1556H465V1194Q465 1161 463 1123T459 1051Q456
+1012 453 973H465Q486 1008 513 1038T575 1090T656 1126T756 1139ZM653 895Q602 895 567 877T509 821T477 728T465 596V563Q465 482 474 419T506 314T564 249T655 227Q746 227 788 313T831 565Q831 730 789 812T653 895Z" />
+<glyph unicode="c" glyph-name="c" horiz-adv-x="1022" d="M625 -20Q505 -20 409 13T244 115T139 293T102 553Q102 720 139 832T245 1013T410 1110T625 1139Q711 1139 796 1118T956 1059L868 827Q802 856 741 874T625 893Q514 893 464 809T414 555Q414 387 464
+307T621 227Q708 227 779 249T924 307V53Q887 35 852 21T782 -2T708 -15T625 -20Z" />
+<glyph unicode="d" glyph-name="d" horiz-adv-x="1245" d="M489 -20Q403 -20 332 17T210 126T131 307T102 557Q102 701 130 809T211 991T337 1102T498 1139Q552 1139 597 1127T678 1092T742 1040T793 975H803Q797 1014 792 1054Q787 1088 784 1126T780 1198V1556H1085V0H852L793
+145H780Q759 111 732 81T670 28T590 -7T489 -20ZM600 223Q654 223 692 241T753 297T788 391T801 522V555Q801 636 791 699T758 804T696 869T598 891Q502 891 457 805T412 553Q412 388 457 306T600 223Z" />
+<glyph unicode="e" glyph-name="e" horiz-adv-x="1190" d="M612 922Q531 922 478 865T416 686H805Q804 737 792 780T756 854T696 904T612 922ZM651 -20Q531 -20 430 15T256 120T143 298T102 551Q102 698 139 808T242 991T402 1102T610 1139Q721 1139 810 1106T962
+1007T1058 848T1092 631V483H410Q412 419 430 368T482 281T563 226T672 207Q723 207 768 212T857 229T942 256T1028 295V59Q988 38 948 24T862 -1T765 -15T651 -20Z" />
+<glyph unicode="f" glyph-name="f" horiz-adv-x="793" d="M741 889H514V0H209V889H41V1036L209 1118V1200Q209 1307 235 1377T309 1490T425 1549T578 1567Q670 1567 733 1553T840 1520L768 1296Q737 1307 703 1316T623 1325Q563 1325 539 1287T514 1188V1118H741V889Z" />
+<glyph unicode="g" glyph-name="g" horiz-adv-x="1130" d="M1085 1116V950L922 899Q942 865 950 829T958 750Q958 665 931 595T851 474T718 397T532 369Q509 369 482 371T442 377Q422 360 411 342T399 297Q399 276 412 264T446 244T495 234T553 231H727Q808 231
+872 213T980 156T1049 60T1073 -80Q1073 -175 1035 -251T922 -381T734 -463T475 -492Q361 -492 276 -471T134 -409T49 -311T20 -182Q20 -121 41 -76T97 1T176 53T268 84Q247 93 227 109T190 146T163 192T152 246Q152 278 161 304T189 352T234 395T295 436Q207 474
+156 558T104 756Q104 846 132 917T214 1037T348 1113T532 1139Q552 1139 577 1137T626 1131T672 1123T705 1116H1085ZM285 -158Q285 -183 295 -206T330 -248T393 -276T489 -287Q645 -287 724 -243T803 -125Q803 -62 754 -41T602 -20H461Q434 -20 403 -26T346 -49T303
+-91T285 -158ZM395 752Q395 661 429 611T532 561Q604 561 636 611T668 752Q668 842 637 895T532 948Q395 948 395 752Z" />
+<glyph unicode="h" glyph-name="h" horiz-adv-x="1284" d="M1130 0H825V653Q825 774 788 834T672 895Q613 895 573 871T509 800T475 684T465 526V0H160V1556H465V1239Q465 1197 463 1151T458 1065Q454 1019 451 975H467Q516 1062 592 1100T764 1139Q847 1139 914
+1116T1030 1042T1104 915T1130 729V0Z" />
+<glyph unicode="i" glyph-name="i" horiz-adv-x="625" d="M147 1407Q147 1450 160 1478T195 1524T248 1549T313 1556Q347 1556 377 1549T429 1525T465 1479T479 1407Q479 1365 466 1336T430 1290T377 1265T313 1257Q279 1257 249 1264T196 1289T160 1336T147 1407ZM465
+0H160V1118H465V0Z" />
+<glyph unicode="j" glyph-name="j" horiz-adv-x="625" d="M102 -492Q54 -492 3 -485T-82 -467V-227Q-51 -237 -24 -241T37 -246Q62 -246 84 -239T123 -212T150 -160T160 -76V1118H465V-121Q465 -198 446 -265T383 -383T270 -463T102 -492ZM147 1407Q147 1450 160
+1478T195 1524T248 1549T313 1556Q347 1556 377 1549T429 1525T465 1479T479 1407Q479 1365 466 1336T430 1290T377 1265T313 1257Q279 1257 249 1264T196 1289T160 1336T147 1407Z" />
+<glyph unicode="k" glyph-name="k" horiz-adv-x="1208" d="M453 608L565 778L838 1118H1182L778 633L1208 0H856L584 430L465 348V0H160V1556H465V862L449 608H453Z" />
+<glyph unicode="l" glyph-name="l" horiz-adv-x="625" d="M465 0H160V1556H465V0Z" />
+<glyph unicode="m" glyph-name="m" horiz-adv-x="1929" d="M1120 0H815V653Q815 774 779 834T666 895Q608 895 570 871T508 800T475 684T465 526V0H160V1118H393L434 975H451Q475 1018 508 1049T582 1100T667 1129T758 1139Q873 1139 953 1100T1077 975H1102Q1126
+1018 1160 1049T1235 1100T1321 1129T1413 1139Q1593 1139 1684 1042T1776 729V0H1470V653Q1470 774 1434 834T1321 895Q1212 895 1166 809T1120 561V0Z" />
+<glyph unicode="n" glyph-name="n" horiz-adv-x="1284" d="M1130 0H825V653Q825 774 789 834T672 895Q612 895 572 871T509 800T475 684T465 526V0H160V1118H393L434 975H451Q475 1018 509 1049T585 1100T672 1129T766 1139Q848 1139 915 1116T1030 1042T1104
+915T1130 729V0Z" />
+<glyph unicode="o" glyph-name="o" horiz-adv-x="1227" d="M414 561Q414 394 461 310T614 225Q719 225 766 310T813 561Q813 728 766 810T612 893Q507 893 461 811T414 561ZM1124 561Q1124 421 1089 313T987 131T825 19T610 -20Q499 -20 406 18T246 131T140 313T102
+561Q102 700 137 808T239 989T401 1101T616 1139Q727 1139 820 1101T980 990T1086 808T1124 561Z" />
+<glyph unicode="p" glyph-name="p" horiz-adv-x="1245" d="M748 -20Q693 -20 650 -8T572 24T512 69T465 123H449Q453 88 457 57Q460 31 462 4T465 -39V-492H160V1118H408L451 973H465Q486 1007 513 1037T575 1089T656 1125T756 1139Q843 1139 914 1102T1036 992T1115
+811T1143 561Q1143 418 1114 310T1033 128T908 17T748 -20ZM653 895Q602 895 567 877T509 821T477 728T465 596V563Q465 482 474 419T506 314T564 249T655 227Q746 227 788 313T831 565Q831 730 789 812T653 895Z" />
+<glyph unicode="q" glyph-name="q" horiz-adv-x="1245" d="M602 219Q657 219 694 237T755 293T789 386T801 518V555Q801 636 792 699T759 804T697 869T600 891Q504 891 459 805T414 553Q414 385 459 302T602 219ZM489 -20Q402 -20 331 17T209 126T130 307T102
+557Q102 700 130 808T211 990T337 1101T498 1139Q554 1139 599 1127T680 1092T745 1040T795 975H803L827 1118H1085V-492H780V-23Q780 -4 782 24T787 80Q790 112 793 145H780Q760 111 733 81T671 28T590 -7T489 -20Z" />
+<glyph unicode="r" glyph-name="r" horiz-adv-x="889" d="M743 1139Q755 1139 769 1139T797 1137T822 1134T840 1130V844Q832 846 818 848T789 851T758 853T733 854Q674 854 625 839T540 791T485 703T465 569V0H160V1118H391L436 950H451Q475 993 503 1028T565
+1087T643 1125T743 1139Z" />
+<glyph unicode="s" glyph-name="s" horiz-adv-x="985" d="M905 332Q905 244 873 178T782 68T639 2T451 -20Q396 -20 349 -17T260 -5T179 15T100 45V297Q142 276 188 259T281 230T370 210T451 203Q492 203 521 210T568 231T595 263T604 303Q604 324 598 340T568
+375T501 417T381 475Q308 508 255 540T167 613T115 704T98 827Q98 905 128 963T213 1061T345 1119T518 1139Q618 1139 708 1116T893 1047L801 831Q725 867 656 890T518 913Q456 913 429 891T401 831Q401 811 408 796T436 764T495 728T594 680Q665 649 722 619T820
+549T883 458T905 332Z" />
+<glyph unicode="t" glyph-name="t" horiz-adv-x="848" d="M614 223Q659 223 699 233T782 258V31Q739 9 676 -5T537 -20Q464 -20 401 -3T292 56T220 170T193 350V889H47V1018L215 1120L303 1356H498V1118H770V889H498V350Q498 285 530 254T614 223Z" />
+<glyph unicode="u" glyph-name="u" horiz-adv-x="1284" d="M891 0L850 143H834Q809 100 775 70T699 19T612 -10T518 -20Q436 -20 369 3T254 77T180 204T154 389V1118H459V465Q459 344 495 284T612 223Q672 223 712 247T775 318T809 434T819 592V1118H1124V0H891Z" />
+<glyph unicode="v" glyph-name="v" horiz-adv-x="1104" d="M395 0L0 1118H319L504 481Q521 424 533 363T549 252H555Q558 305 570 364T600 481L784 1118H1104L709 0H395Z" />
+<glyph unicode="w" glyph-name="w" horiz-adv-x="1651" d="M1014 0L928 391Q924 408 918 439T903 510T887 594T869 683Q849 786 825 905H819Q796 786 777 682Q769 638 761 593T744 509T730 437T719 387L629 0H301L0 1118H303L416 623Q425 584 434 530T452 420T468
+315T479 236H485Q486 255 489 285T498 351T508 422T519 491T529 547T537 582L659 1118H995L1112 582Q1117 560 1125 514T1141 416T1156 314T1163 236H1169Q1172 261 1179 310T1196 415T1215 528T1235 623L1352 1118H1651L1346 0H1014Z" />
+<glyph unicode="x" glyph-name="x" horiz-adv-x="1122" d="M389 571L29 1118H375L561 782L750 1118H1096L731 571L1112 0H766L561 362L356 0H10L389 571Z" />
+<glyph unicode="y" glyph-name="y" horiz-adv-x="1104" d="M0 1118H334L514 489Q530 437 537 378T547 272H553Q555 295 558 323T567 380T578 437T592 489L768 1118H1104L662 -143Q600 -320 493 -406T225 -492Q173 -492 135 -487T70 -475V-233Q91 -238 123 -242T190
+-246Q238 -246 272 -233T330 -197T372 -140T403 -66L422 -10L0 1118Z" />
+<glyph unicode="z" glyph-name="z" horiz-adv-x="936" d="M877 0H55V180L512 885H86V1118H858V920L416 233H877V0Z" />
+<glyph unicode="{" glyph-name="braceleft" horiz-adv-x="745" d="M287 367T222 408T31 449V688Q93 688 141 697T223 728T272 784T287 866V1184Q287 1258 306 1310T374 1396T509 1446T725 1462V1237Q685 1236 653 1230T598 1209T563 1166T551 1096V797Q545 610
+317 575V563Q432 546 493 491T551 342V43Q551 0 563 -27T597 -69T652 -91T725 -98V-324Q594 -324 509 -308T375 -259T306 -172T287 -45V270Q287 367 222 408Z" />
+<glyph unicode="|" glyph-name="bar" horiz-adv-x="1128" d="M455 1550H674V-465H455V1550Z" />
+<glyph unicode="}" glyph-name="braceright" horiz-adv-x="745" d="M469 -45Q469 -119 450 -172T382 -258T247 -308T31 -324V-98Q71 -97 103 -91T157 -70T192 -27T205 43V342Q202 436 263 491T438 563V575Q211 610 205 797V1096Q205 1139 193 1166T158 1208T103
+1230T31 1237V1462Q162 1462 247 1446T381 1397T450 1311T469 1184V866Q468 818 484 784T533 729T614 698T725 688V449Q600 449 535 408T469 270V-45Z" />
+<glyph unicode="~" glyph-name="asciitilde" horiz-adv-x="1128" d="M528 616Q491 632 463 643T411 660T366 669T322 672Q293 672 262 663T201 637T143 598T88 551V782Q139 836 202 863T344 891Q374 891 399 889T453 879T517 860T600 827Q638 811 666 801T719
+784T764 775T807 772Q836 772 867 781T928 807T986 845T1040 893V662Q939 553 784 553Q754 553 729 555T675 564T611 583T528 616Z" />
+<glyph unicode="&#xa0;" glyph-name="nbspace" horiz-adv-x="532" />
+<glyph unicode="&#xa1;" glyph-name="exclamdown" horiz-adv-x="586" d="M168 606H412L463 -369H117L168 606ZM467 948Q467 901 454 869T416 816T360 787T291 778Q256 778 225 787T169 816T131 868T117 948Q117 993 131 1025T169 1078T224 1108T291 1118Q328 1118
+360 1109T416 1079T453 1026T467 948Z" />
+<glyph unicode="&#xa2;" glyph-name="cent" horiz-adv-x="1128" d="M543 -20V186Q451 199 377 236T251 340T171 506T143 743Q143 884 171 985T251 1155T378 1260T543 1311V1483H721V1319Q759 1318 797 1313T870 1299T937 1281T993 1260L907 1034Q886 1044 860
+1053T805 1070T750 1082T698 1087Q632 1087 586 1067T511 1006T468 901T455 750Q455 579 512 500T698 420Q774 420 844 438T965 481V242Q914 213 852 198T721 180V-20H543Z" />
+<glyph unicode="&#xa3;" glyph-name="sterling" horiz-adv-x="1128" d="M680 1483Q790 1483 879 1459T1049 1401L956 1171Q885 1200 827 1217T705 1235Q638 1235 601 1197T563 1063V870H897V651H563V508Q563 453 550 413T514 343T466 294T412 260H1090V0H82V248Q124
+266 157 287T214 337T250 407T262 506V651H84V870H262V1065Q262 1178 293 1257T380 1387T512 1460T680 1483Z" />
+<glyph unicode="&#xa4;" glyph-name="currency" horiz-adv-x="1128" d="M168 723Q168 777 182 826T221 920L92 1047L240 1194L367 1067Q410 1092 461 1106T563 1120Q617 1120 665 1107T760 1065L887 1194L1036 1051L907 922Q932 880 946 829T961 723Q961 667 947
+618T907 524L1032 399L887 254L760 379Q716 356 667 342T563 328Q507 328 458 340T365 379L240 256L94 401L221 526Q168 617 168 723ZM375 723Q375 684 390 650T430 590T490 550T563 535Q603 535 638 549T699 589T741 649T756 723Q756 763 741 797T700 857T638
+898T563 913Q524 913 490 898T431 858T390 798T375 723Z" />
+<glyph unicode="&#xa5;" glyph-name="yen" horiz-adv-x="1128" d="M565 860L809 1462H1122L760 715H954V537H709V399H954V221H709V0H422V221H174V399H422V537H174V715H365L8 1462H324L565 860Z" />
+<glyph unicode="&#xa6;" glyph-name="brokenbar" horiz-adv-x="1128" d="M455 1550H674V735H455V1550ZM455 350H674V-465H455V350Z" />
+<glyph unicode="&#xa7;" glyph-name="section" horiz-adv-x="995" d="M121 805Q121 849 131 886T160 955T203 1012T254 1055Q191 1095 156 1154T121 1288Q121 1353 150 1406T232 1498T360 1556T526 1577Q628 1577 716 1554T889 1493L807 1303Q739 1335 669 1360T520
+1386Q439 1386 402 1363T365 1292Q365 1267 377 1246T415 1206T481 1167T578 1124Q649 1096 707 1062T807 987T872 895T895 782Q895 682 861 621T770 522Q832 482 863 430T895 303Q895 229 864 170T776 68T638 3T455 -20Q345 -20 261 0T106 59V266Q145 246 190
+229T281 198T371 176T455 168Q511 168 548 177T607 202T639 239T649 285Q649 310 642 329T612 368T549 408T442 457Q366 489 306 521T205 593T143 685T121 805ZM344 827Q344 764 400 716T575 616L590 610Q605 621 619 635T644 668T661 708T668 756Q668 788 658
+815T621 867T550 917T434 967Q416 960 400 947T372 915T352 875T344 827Z" />
+<glyph unicode="&#xa8;" glyph-name="dieresis" horiz-adv-x="1182" d="M248 1405Q248 1440 259 1465T288 1507T332 1532T387 1540Q416 1540 441 1532T486 1508T516 1466T528 1405Q528 1371 517 1346T486 1305T442 1280T387 1272Q358 1272 333 1280T289 1304T259
+1346T248 1405ZM651 1405Q651 1440 662 1465T692 1507T737 1532T793 1540Q821 1540 846 1532T891 1508T922 1466T934 1405Q934 1371 923 1346T892 1305T847 1280T793 1272Q733 1272 692 1305T651 1405Z" />
+<glyph unicode="&#xa9;" glyph-name="copyright" horiz-adv-x="1704" d="M895 1010Q798 1010 745 936T692 731Q692 596 740 524T895 451Q952 451 1018 466T1141 510V319Q1084 292 1025 277T889 262Q782 262 702 296T569 392T488 540T461 733Q461 836 487 921T565
+1068T697 1164T881 1198Q964 1198 1041 1176T1186 1120L1112 952Q999 1010 895 1010ZM100 731Q100 835 127 931T202 1110T320 1263T472 1380T652 1456T852 1483Q956 1483 1052 1456T1231 1381T1384 1263T1501 1111T1577 931T1604 731Q1604 627 1577 531T1502 352T1384
+200T1232 82T1052 7T852 -20Q748 -20 652 6T473 82T320 199T203 351T127 531T100 731ZM242 731Q242 604 290 493T420 300T614 169T852 121Q979 121 1090 169T1283 299T1414 493T1462 731Q1462 858 1414 969T1284 1162T1090 1293T852 1341Q725 1341 614 1293T421
+1163T290 969T242 731Z" />
+<glyph unicode="&#xaa;" glyph-name="ordfeminine" horiz-adv-x="743" d="M520 764L489 874Q449 816 393 784T268 752Q218 752 178 765T108 806T63 876T47 975Q47 1035 68 1076T130 1144T230 1184T365 1202L455 1206Q455 1269 426 1296T342 1323Q302 1323 253
+1306T152 1262L86 1397Q148 1429 222 1454T387 1479Q455 1479 505 1460T589 1405T638 1319T655 1206V764H520ZM373 1081Q335 1078 312 1068T275 1044T257 1012T252 977Q252 939 271 921T317 903Q349 903 374 914T418 944T445 991T455 1051V1087L373 1081Z" />
+<glyph unicode="&#xab;" glyph-name="guillemotleft" horiz-adv-x="1198" d="M82 573L391 1028L610 909L393 561L610 213L391 94L82 547V573ZM588 573L897 1028L1116 909L899 561L1116 213L897 94L588 547V573Z" />
+<glyph unicode="&#xac;" glyph-name="logicalnot" horiz-adv-x="1128" d="M1040 248H821V612H88V831H1040V248Z" />
+<glyph unicode="&#xad;" glyph-name="uni00AD" horiz-adv-x="659" d="M61 424V674H598V424H61Z" />
+<glyph unicode="&#xae;" glyph-name="registered" horiz-adv-x="1704" d="M1157 905Q1157 811 1119 756T1014 672L1251 272H997L819 610H772V272H543V1188H807Q989 1188 1073 1118T1157 905ZM772 778H803Q869 778 897 806T926 901Q926 936 919 959T896 995T857
+1014T801 1020H772V778ZM100 731Q100 835 127 931T202 1110T320 1263T472 1380T652 1456T852 1483Q956 1483 1052 1456T1231 1381T1384 1263T1501 1111T1577 931T1604 731Q1604 627 1577 531T1502 352T1384 200T1232 82T1052 7T852 -20Q748 -20 652 6T473 82T320
+199T203 351T127 531T100 731ZM242 731Q242 604 290 493T420 300T614 169T852 121Q979 121 1090 169T1283 299T1414 493T1462 731Q1462 858 1414 969T1284 1162T1090 1293T852 1341Q725 1341 614 1293T421 1163T290 969T242 731Z" />
+<glyph unicode="&#xaf;" glyph-name="overscore" horiz-adv-x="1024" d="M1030 1556H-6V1757H1030V1556Z" />
+<glyph unicode="&#xb0;" glyph-name="degree" horiz-adv-x="877" d="M92 1137Q92 1208 119 1271T193 1381T303 1455T438 1483Q510 1483 573 1456T683 1381T757 1271T784 1137Q784 1065 757 1002T684 893T574 820T438 793Q366 793 303 819T193 892T119 1002T92
+1137ZM283 1137Q283 1106 295 1078T328 1029T377 996T438 983Q470 983 498 995T548 1029T581 1078T594 1137Q594 1169 582 1197T548 1247T499 1281T438 1294Q406 1294 378 1282T328 1248T295 1198T283 1137Z" />
+<glyph unicode="&#xb1;" glyph-name="plusminus" horiz-adv-x="1128" d="M455 674H88V893H455V1262H674V893H1040V674H674V309H455V674ZM88 0V219H1040V0H88Z" />
+<glyph unicode="&#xb2;" glyph-name="twosuperior" horiz-adv-x="776" d="M702 586H55V754L279 973Q325 1018 355 1051T404 1111T430 1161T438 1212Q438 1250 414 1270T350 1290Q310 1290 267 1270T170 1202L47 1354Q112 1411 193 1447T383 1483Q449 1483 503
+1467T596 1419T656 1341T678 1233Q678 1187 666 1147T626 1065T557 980T455 881L350 786H702V586Z" />
+<glyph unicode="&#xb3;" glyph-name="threesuperior" horiz-adv-x="776" d="M666 1249Q666 1180 626 1130T496 1051V1038Q547 1028 584 1007T645 959T682 898T694 829Q694 708 606 639T332 569Q256 569 190 586T59 639V829Q125 789 191 764T330 739Q404 739 438
+766T473 846Q473 867 465 886T438 919T387 943T307 952H195V1112H287Q339 1112 371 1121T421 1145T445 1180T451 1221Q451 1259 426 1284T350 1309Q303 1309 261 1290T162 1231L61 1372Q123 1419 198 1450T377 1481Q439 1481 492 1465T583 1418T644 1345T666 1249Z"
+/>
+<glyph unicode="&#xb4;" glyph-name="acute" horiz-adv-x="1182" d="M332 1241V1268Q353 1297 377 1335T424 1413T469 1494T506 1569H848V1548Q837 1530 816 1506T768 1453T710 1396T648 1338T587 1285T535 1241H332Z" />
+<glyph unicode="&#xb5;" glyph-name="mu" horiz-adv-x="1290" d="M465 465Q465 344 502 284T621 223Q679 223 718 247T781 318T815 434T825 592V1118H1130V0H897L854 150H842Q807 65 755 23T627 -20Q573 -20 528 3T455 70Q457 28 460 -15Q462 -52 463 -94T465
+-172V-492H160V1118H465V465Z" />
+<glyph unicode="&#xb6;" glyph-name="paragraph" horiz-adv-x="1341" d="M1167 -260H1006V1356H840V-260H678V559Q617 541 532 541Q437 541 360 566T228 651T143 806T113 1042Q113 1189 145 1287T237 1446T380 1531T563 1556H1167V-260Z" />
+<glyph unicode="&#xb7;" glyph-name="middot" horiz-adv-x="584" d="M117 723Q117 770 130 802T168 855T224 884T293 893Q328 893 359 884T415 855T453 803T467 723Q467 678 453 646T415 593T360 563T293 553Q256 553 224 562T168 592T131 645T117 723Z" />
+<glyph unicode="&#xb8;" glyph-name="cedilla" horiz-adv-x="420" d="M418 -250Q418 -307 403 -352T351 -428T256 -475T109 -492Q64 -492 28 -486T-37 -471V-303Q-22 -307 -4 -310T34 -317T72 -322T106 -324Q135 -324 156 -311T178 -262Q178 -225 141 -197T12
+-154L90 0H283L256 -61Q287 -71 316 -88T367 -128T404 -182T418 -250Z" />
+<glyph unicode="&#xb9;" glyph-name="onesuperior" horiz-adv-x="776" d="M584 586H346V1032Q346 1052 346 1082T348 1144T351 1201T354 1239Q348 1231 339 1221T319 1199T298 1178T279 1161L201 1100L92 1227L393 1462H584V586Z" />
+<glyph unicode="&#xba;" glyph-name="ordmasculine" horiz-adv-x="754" d="M696 1116Q696 1029 674 962T609 848T508 777T375 752Q306 752 248 776T147 847T81 961T57 1116Q57 1203 79 1270T143 1384T244 1455T379 1479Q447 1479 504 1455T605 1385T672 1271T696
+1116ZM260 1116Q260 1016 287 966T377 915Q437 915 464 965T492 1116Q492 1216 465 1265T377 1315Q315 1315 288 1266T260 1116Z" />
+<glyph unicode="&#xbb;" glyph-name="guillemotright" horiz-adv-x="1198" d="M1118 547L809 94L590 213L807 561L590 909L809 1028L1118 573V547ZM612 547L303 94L84 213L301 561L84 909L303 1028L612 573V547Z" />
+<glyph unicode="&#xbc;" glyph-name="onequarter" horiz-adv-x="1804" d="M1370 1462L559 0H320L1131 1462H1370ZM794 586H556V1032Q556 1052 556 1082T558 1144T561 1201T564 1239Q558 1231 549 1221T529 1199T508 1178T489 1161L411 1100L302 1227L603 1462H794V586ZM1682
+152H1557V1H1319V152H936V306L1321 883H1557V320H1682V152ZM1319 320V484Q1319 526 1320 572T1325 668Q1320 655 1311 634T1290 590T1268 546T1248 511L1121 320H1319Z" />
+<glyph unicode="&#xbd;" glyph-name="onehalf" horiz-adv-x="1804" d="M1370 1462L559 0H320L1131 1462H1370ZM794 586H556V1032Q556 1052 556 1082T558 1144T561 1201T564 1239Q558 1231 549 1221T529 1199T508 1178T489 1161L411 1100L302 1227L603 1462H794V586ZM1716
+1H1069V169L1293 388Q1339 433 1369 466T1418 526T1444 576T1452 627Q1452 665 1428 685T1364 705Q1324 705 1281 685T1184 617L1061 769Q1126 826 1207 862T1397 898Q1463 898 1517 882T1610 834T1670 756T1692 648Q1692 602 1680 562T1640 480T1571 395T1469
+296L1364 201H1716V1Z" />
+<glyph unicode="&#xbe;" glyph-name="threequarters" horiz-adv-x="1804" d="M1441 1462L630 0H391L1202 1462H1441ZM1712 152H1587V1H1349V152H966V306L1351 883H1587V320H1712V152ZM1349 320V484Q1349 526 1350 572T1355 668Q1350 655 1341 634T1320 590T1298
+546T1278 511L1151 320H1349ZM697 1249Q697 1180 657 1130T527 1051V1038Q578 1028 615 1007T676 959T713 898T725 829Q725 708 637 639T363 569Q287 569 221 586T90 639V829Q156 789 222 764T361 739Q435 739 469 766T504 846Q504 867 496 886T469 919T418 943T338
+952H226V1112H318Q370 1112 402 1121T452 1145T476 1180T482 1221Q482 1259 457 1284T381 1309Q334 1309 292 1290T193 1231L92 1372Q154 1419 229 1450T408 1481Q470 1481 523 1465T614 1418T675 1345T697 1249Z" />
+<glyph unicode="&#xbf;" glyph-name="questiondown" horiz-adv-x="940" d="M686 606V532Q686 481 676 440T644 361T588 288T506 215Q464 182 435 156T388 105T362 51T354 -14Q354 -71 393 -108T510 -145Q579 -145 659 -116T823 -45L926 -266Q883 -292 832 -314T727
+-354T616 -381T506 -391Q404 -391 323 -367T184 -296T97 -182T66 -29Q66 34 79 83T121 175T190 258T287 342Q328 375 354 399T396 446T416 492T422 547V606H686ZM719 948Q719 901 706 869T668 816T612 787T543 778Q508 778 477 787T421 816T383 868T369 948Q369
+993 383 1025T421 1078T476 1108T543 1118Q580 1118 612 1109T668 1079T705 1026T719 948Z" />
+<glyph unicode="&#xc0;" glyph-name="Agrave" horiz-adv-x="1331" d="M1018 0L918 348H414L313 0H0L475 1468H854L1331 0H1018ZM846 608L752 928Q746 946 734 987T709 1077T683 1177T666 1262Q662 1240 656 1210T641 1147T623 1079T606 1015T592 962T582 928L489
+608H846ZM632 1579Q598 1607 551 1648T457 1734T373 1818T319 1886V1907H661Q677 1873 698 1833T743 1752T790 1673T835 1606V1579H632Z" />
+<glyph unicode="&#xc1;" glyph-name="Aacute" horiz-adv-x="1331" d="M1018 0L918 348H414L313 0H0L475 1468H854L1331 0H1018ZM846 608L752 928Q746 946 734 987T709 1077T683 1177T666 1262Q662 1240 656 1210T641 1147T623 1079T606 1015T592 962T582 928L489
+608H846ZM494 1579V1606Q515 1635 539 1673T586 1751T631 1832T668 1907H1010V1886Q999 1868 978 1844T930 1791T872 1734T810 1676T749 1623T697 1579H494Z" />
+<glyph unicode="&#xc2;" glyph-name="Acircumflex" horiz-adv-x="1331" d="M1018 0L918 348H414L313 0H0L475 1468H854L1331 0H1018ZM846 608L752 928Q746 946 734 987T709 1077T683 1177T666 1262Q662 1240 656 1210T641 1147T623 1079T606 1015T592 962T582
+928L489 608H846ZM879 1579Q828 1613 773 1656T666 1755Q612 1699 560 1656T457 1579H254V1606Q280 1635 311 1673T375 1751T438 1832T490 1907H846Q867 1873 897 1833T959 1752T1024 1673T1082 1606V1579H879Z" />
+<glyph unicode="&#xc3;" glyph-name="Atilde" horiz-adv-x="1331" d="M1018 0L918 348H414L313 0H0L475 1468H854L1331 0H1018ZM846 608L752 928Q746 946 734 987T709 1077T683 1177T666 1262Q662 1240 656 1210T641 1147T623 1079T606 1015T592 962T582 928L489
+608H846ZM504 1684Q473 1684 455 1658T424 1577H275Q281 1657 301 1715T353 1811T430 1867T527 1886Q568 1886 607 1870T684 1835T760 1799T834 1782Q865 1782 883 1808T914 1888H1063Q1057 1809 1037 1751T983 1655T907 1598T811 1579Q771 1579 731 1595T653 1631T578
+1667T504 1684Z" />
+<glyph unicode="&#xc4;" glyph-name="Adieresis" horiz-adv-x="1331" d="M1018 0L918 348H414L313 0H0L475 1468H854L1331 0H1018ZM846 608L752 928Q746 946 734 987T709 1077T683 1177T666 1262Q662 1240 656 1210T641 1147T623 1079T606 1015T592 962T582 928L489
+608H846ZM324 1743Q324 1778 335 1803T364 1845T408 1870T463 1878Q492 1878 517 1870T562 1846T592 1804T604 1743Q604 1709 593 1684T562 1643T518 1618T463 1610Q434 1610 409 1618T365 1642T335 1684T324 1743ZM727 1743Q727 1778 738 1803T768 1845T813 1870T869
+1878Q897 1878 922 1870T967 1846T998 1804T1010 1743Q1010 1709 999 1684T968 1643T923 1618T869 1610Q809 1610 768 1643T727 1743Z" />
+<glyph unicode="&#xc5;" glyph-name="Aring" horiz-adv-x="1331" d="M1018 0L918 348H414L313 0H0L475 1468H854L1331 0H1018ZM846 608L752 928Q746 946 734 987T709 1077T683 1177T666 1262Q662 1240 656 1210T641 1147T623 1079T606 1015T592 962T582 928L489
+608H846ZM918 1567Q918 1511 899 1467T845 1391T764 1344T664 1327Q609 1327 563 1343T485 1390T434 1465T416 1565Q416 1620 434 1664T484 1738T563 1785T664 1802Q717 1802 763 1786T843 1739T898 1665T918 1567ZM760 1565Q760 1610 733 1635T664 1661Q622 1661
+595 1636T568 1565Q568 1520 592 1494T664 1468Q706 1468 733 1494T760 1565Z" />
+<glyph unicode="&#xc6;" glyph-name="AE" horiz-adv-x="1888" d="M1767 0H926V348H465L315 0H0L655 1462H1767V1208H1235V887H1731V633H1235V256H1767V0ZM578 608H926V1198H829L578 608Z" />
+<glyph unicode="&#xc7;" glyph-name="Ccedilla" horiz-adv-x="1305" d="M805 1225Q716 1225 648 1191T533 1092T462 935T438 727Q438 610 459 519T525 366T639 271T805 238Q894 238 983 258T1178 315V55Q1130 35 1083 21T987 -2T887 -15T776 -20Q607 -20 483 34T278
+186T158 422T119 729Q119 895 164 1033T296 1272T511 1427T805 1483Q914 1483 1023 1456T1233 1380L1133 1128Q1051 1167 968 1196T805 1225ZM926 -250Q926 -307 911 -352T859 -428T764 -475T617 -492Q572 -492 536 -486T471 -471V-303Q486 -307 504 -310T542 -317T580
+-322T614 -324Q643 -324 664 -311T686 -262Q686 -225 649 -197T520 -154L598 0H791L764 -61Q795 -71 824 -88T875 -128T912 -182T926 -250Z" />
+<glyph unicode="&#xc8;" glyph-name="Egrave" horiz-adv-x="1147" d="M1026 0H184V1462H1026V1208H494V887H989V633H494V256H1026V0ZM572 1579Q538 1607 491 1648T397 1734T313 1818T259 1886V1907H601Q617 1873 638 1833T683 1752T730 1673T775 1606V1579H572Z" />
+<glyph unicode="&#xc9;" glyph-name="Eacute" horiz-adv-x="1147" d="M1026 0H184V1462H1026V1208H494V887H989V633H494V256H1026V0ZM424 1579V1606Q445 1635 469 1673T516 1751T561 1832T598 1907H940V1886Q929 1868 908 1844T860 1791T802 1734T740 1676T679
+1623T627 1579H424Z" />
+<glyph unicode="&#xca;" glyph-name="Ecircumflex" horiz-adv-x="1147" d="M1026 0H184V1462H1026V1208H494V887H989V633H494V256H1026V0ZM832 1579Q781 1613 726 1656T619 1755Q565 1699 513 1656T410 1579H207V1606Q233 1635 264 1673T328 1751T391 1832T443
+1907H799Q820 1873 850 1833T912 1752T977 1673T1035 1606V1579H832Z" />
+<glyph unicode="&#xcb;" glyph-name="Edieresis" horiz-adv-x="1147" d="M1026 0H184V1462H1026V1208H494V887H989V633H494V256H1026V0ZM273 1743Q273 1778 284 1803T313 1845T357 1870T412 1878Q441 1878 466 1870T511 1846T541 1804T553 1743Q553 1709 542 1684T511
+1643T467 1618T412 1610Q383 1610 358 1618T314 1642T284 1684T273 1743ZM676 1743Q676 1778 687 1803T717 1845T762 1870T818 1878Q846 1878 871 1870T916 1846T947 1804T959 1743Q959 1709 948 1684T917 1643T872 1618T818 1610Q758 1610 717 1643T676 1743Z"
+/>
+<glyph unicode="&#xcc;" glyph-name="Igrave" horiz-adv-x="797" d="M731 0H66V176L244 258V1204L66 1286V1462H731V1286L553 1204V258L731 176V0ZM355 1579Q321 1607 274 1648T180 1734T96 1818T42 1886V1907H384Q400 1873 421 1833T466 1752T513 1673T558 1606V1579H355Z"
+/>
+<glyph unicode="&#xcd;" glyph-name="Iacute" horiz-adv-x="797" d="M731 0H66V176L244 258V1204L66 1286V1462H731V1286L553 1204V258L731 176V0ZM237 1579V1606Q258 1635 282 1673T329 1751T374 1832T411 1907H753V1886Q742 1868 721 1844T673 1791T615 1734T553
+1676T492 1623T440 1579H237Z" />
+<glyph unicode="&#xce;" glyph-name="Icircumflex" horiz-adv-x="797" d="M731 0H66V176L244 258V1204L66 1286V1462H731V1286L553 1204V258L731 176V0ZM609 1579Q558 1613 503 1656T396 1755Q342 1699 290 1656T187 1579H-16V1606Q10 1635 41 1673T105 1751T168
+1832T220 1907H576Q597 1873 627 1833T689 1752T754 1673T812 1606V1579H609Z" />
+<glyph unicode="&#xcf;" glyph-name="Idieresis" horiz-adv-x="797" d="M731 0H66V176L244 258V1204L66 1286V1462H731V1286L553 1204V258L731 176V0ZM54 1743Q54 1778 65 1803T94 1845T138 1870T193 1878Q222 1878 247 1870T292 1846T322 1804T334 1743Q334 1709
+323 1684T292 1643T248 1618T193 1610Q164 1610 139 1618T95 1642T65 1684T54 1743ZM457 1743Q457 1778 468 1803T498 1845T543 1870T599 1878Q627 1878 652 1870T697 1846T728 1804T740 1743Q740 1709 729 1684T698 1643T653 1618T599 1610Q539 1610 498 1643T457
+1743Z" />
+<glyph unicode="&#xd0;" glyph-name="Eth" horiz-adv-x="1434" d="M47 850H184V1462H612Q773 1462 902 1416T1124 1280T1265 1055T1315 745Q1315 560 1265 421T1119 188T885 47T569 0H184V596H47V850ZM1001 737Q1001 859 977 947T906 1094T792 1180T637 1208H494V850H731V596H494V256H608Q804
+256 902 376T1001 737Z" />
+<glyph unicode="&#xd1;" glyph-name="Ntilde" horiz-adv-x="1604" d="M1419 0H1026L451 1106H442Q448 1029 452 953Q456 888 458 817T461 688V0H184V1462H575L1149 367H1155Q1152 443 1148 517Q1147 549 1146 582T1143 649T1142 714T1141 770V1462H1419V0ZM623
+1684Q592 1684 574 1658T543 1577H394Q400 1657 420 1715T472 1811T549 1867T646 1886Q687 1886 726 1870T803 1835T879 1799T953 1782Q984 1782 1002 1808T1033 1888H1182Q1176 1809 1156 1751T1102 1655T1026 1598T930 1579Q890 1579 850 1595T772 1631T697 1667T623
+1684Z" />
+<glyph unicode="&#xd2;" glyph-name="Ograve" horiz-adv-x="1548" d="M1430 733Q1430 564 1391 425T1270 187T1066 34T774 -20Q606 -20 483 34T279 187T159 425T119 735Q119 905 158 1043T279 1280T483 1431T776 1485Q944 1485 1067 1432T1270 1280T1390 1043T1430
+733ZM438 733Q438 618 458 527T519 372T624 274T774 240Q863 240 926 274T1030 371T1090 526T1110 733Q1110 848 1091 939T1031 1095T927 1193T776 1227Q689 1227 625 1193T520 1095T458 940T438 733ZM729 1579Q695 1607 648 1648T554 1734T470 1818T416 1886V1907H758Q774
+1873 795 1833T840 1752T887 1673T932 1606V1579H729Z" />
+<glyph unicode="&#xd3;" glyph-name="Oacute" horiz-adv-x="1548" d="M1430 733Q1430 564 1391 425T1270 187T1066 34T774 -20Q606 -20 483 34T279 187T159 425T119 735Q119 905 158 1043T279 1280T483 1431T776 1485Q944 1485 1067 1432T1270 1280T1390 1043T1430
+733ZM438 733Q438 618 458 527T519 372T624 274T774 240Q863 240 926 274T1030 371T1090 526T1110 733Q1110 848 1091 939T1031 1095T927 1193T776 1227Q689 1227 625 1193T520 1095T458 940T438 733ZM590 1579V1606Q611 1635 635 1673T682 1751T727 1832T764 1907H1106V1886Q1095
+1868 1074 1844T1026 1791T968 1734T906 1676T845 1623T793 1579H590Z" />
+<glyph unicode="&#xd4;" glyph-name="Ocircumflex" horiz-adv-x="1548" d="M1430 733Q1430 564 1391 425T1270 187T1066 34T774 -20Q606 -20 483 34T279 187T159 425T119 735Q119 905 158 1043T279 1280T483 1431T776 1485Q944 1485 1067 1432T1270 1280T1390
+1043T1430 733ZM438 733Q438 618 458 527T519 372T624 274T774 240Q863 240 926 274T1030 371T1090 526T1110 733Q1110 848 1091 939T1031 1095T927 1193T776 1227Q689 1227 625 1193T520 1095T458 940T438 733ZM975 1579Q924 1613 869 1656T762 1755Q708 1699
+656 1656T553 1579H350V1606Q376 1635 407 1673T471 1751T534 1832T586 1907H942Q963 1873 993 1833T1055 1752T1120 1673T1178 1606V1579H975Z" />
+<glyph unicode="&#xd5;" glyph-name="Otilde" horiz-adv-x="1548" d="M1430 733Q1430 564 1391 425T1270 187T1066 34T774 -20Q606 -20 483 34T279 187T159 425T119 735Q119 905 158 1043T279 1280T483 1431T776 1485Q944 1485 1067 1432T1270 1280T1390 1043T1430
+733ZM438 733Q438 618 458 527T519 372T624 274T774 240Q863 240 926 274T1030 371T1090 526T1110 733Q1110 848 1091 939T1031 1095T927 1193T776 1227Q689 1227 625 1193T520 1095T458 940T438 733ZM612 1684Q581 1684 563 1658T532 1577H383Q389 1657 409 1715T461
+1811T538 1867T635 1886Q676 1886 715 1870T792 1835T868 1799T942 1782Q973 1782 991 1808T1022 1888H1171Q1165 1809 1145 1751T1091 1655T1015 1598T919 1579Q879 1579 839 1595T761 1631T686 1667T612 1684Z" />
+<glyph unicode="&#xd6;" glyph-name="Odieresis" horiz-adv-x="1548" d="M1430 733Q1430 564 1391 425T1270 187T1066 34T774 -20Q606 -20 483 34T279 187T159 425T119 735Q119 905 158 1043T279 1280T483 1431T776 1485Q944 1485 1067 1432T1270 1280T1390 1043T1430
+733ZM438 733Q438 618 458 527T519 372T624 274T774 240Q863 240 926 274T1030 371T1090 526T1110 733Q1110 848 1091 939T1031 1095T927 1193T776 1227Q689 1227 625 1193T520 1095T458 940T438 733ZM428 1743Q428 1778 439 1803T468 1845T512 1870T567 1878Q596
+1878 621 1870T666 1846T696 1804T708 1743Q708 1709 697 1684T666 1643T622 1618T567 1610Q538 1610 513 1618T469 1642T439 1684T428 1743ZM831 1743Q831 1778 842 1803T872 1845T917 1870T973 1878Q1001 1878 1026 1870T1071 1846T1102 1804T1114 1743Q1114
+1709 1103 1684T1072 1643T1027 1618T973 1610Q913 1610 872 1643T831 1743Z" />
+<glyph unicode="&#xd7;" glyph-name="multiply" horiz-adv-x="1128" d="M408 723L109 1024L260 1178L561 879L866 1178L1020 1028L715 723L1016 420L866 268L561 569L260 270L111 422L408 723Z" />
+<glyph unicode="&#xd8;" glyph-name="Oslash" horiz-adv-x="1548" d="M1430 733Q1430 564 1391 425T1270 187T1066 34T774 -20Q595 -20 467 41L395 -76L227 18L309 152Q212 252 166 400T119 735Q119 905 158 1043T279 1280T483 1431T776 1485Q867 1485 944 1469T1087
+1421L1157 1532L1323 1436L1243 1307Q1337 1208 1383 1063T1430 733ZM438 733Q438 553 485 438L942 1184Q873 1227 776 1227Q689 1227 625 1193T520 1095T458 940T438 733ZM1110 733Q1110 904 1067 1020L612 279Q646 260 686 250T774 240Q863 240 926 274T1030
+371T1090 526T1110 733Z" />
+<glyph unicode="&#xd9;" glyph-name="Ugrave" horiz-adv-x="1466" d="M1292 1462V516Q1292 402 1258 304T1153 134T976 21T727 -20Q592 -20 489 18T316 128T210 298T174 520V1462H483V543Q483 462 499 405T546 311T625 257T735 240Q866 240 924 316T983 545V1462H1292ZM706
+1579Q672 1607 625 1648T531 1734T447 1818T393 1886V1907H735Q751 1873 772 1833T817 1752T864 1673T909 1606V1579H706Z" />
+<glyph unicode="&#xda;" glyph-name="Uacute" horiz-adv-x="1466" d="M1292 1462V516Q1292 402 1258 304T1153 134T976 21T727 -20Q592 -20 489 18T316 128T210 298T174 520V1462H483V543Q483 462 499 405T546 311T625 257T735 240Q866 240 924 316T983 545V1462H1292ZM570
+1579V1606Q591 1635 615 1673T662 1751T707 1832T744 1907H1086V1886Q1075 1868 1054 1844T1006 1791T948 1734T886 1676T825 1623T773 1579H570Z" />
+<glyph unicode="&#xdb;" glyph-name="Ucircumflex" horiz-adv-x="1466" d="M1292 1462V516Q1292 402 1258 304T1153 134T976 21T727 -20Q592 -20 489 18T316 128T210 298T174 520V1462H483V543Q483 462 499 405T546 311T625 257T735 240Q866 240 924 316T983 545V1462H1292ZM942
+1579Q891 1613 836 1656T729 1755Q675 1699 623 1656T520 1579H317V1606Q343 1635 374 1673T438 1751T501 1832T553 1907H909Q930 1873 960 1833T1022 1752T1087 1673T1145 1606V1579H942Z" />
+<glyph unicode="&#xdc;" glyph-name="Udieresis" horiz-adv-x="1466" d="M1292 1462V516Q1292 402 1258 304T1153 134T976 21T727 -20Q592 -20 489 18T316 128T210 298T174 520V1462H483V543Q483 462 499 405T546 311T625 257T735 240Q866 240 924 316T983 545V1462H1292ZM393
+1743Q393 1778 404 1803T433 1845T477 1870T532 1878Q561 1878 586 1870T631 1846T661 1804T673 1743Q673 1709 662 1684T631 1643T587 1618T532 1610Q503 1610 478 1618T434 1642T404 1684T393 1743ZM796 1743Q796 1778 807 1803T837 1845T882 1870T938 1878Q966
+1878 991 1870T1036 1846T1067 1804T1079 1743Q1079 1709 1068 1684T1037 1643T992 1618T938 1610Q878 1610 837 1643T796 1743Z" />
+<glyph unicode="&#xdd;" glyph-name="Yacute" horiz-adv-x="1196" d="M598 860L862 1462H1196L752 569V0H444V559L0 1462H336L598 860ZM422 1579V1606Q443 1635 467 1673T514 1751T559 1832T596 1907H938V1886Q927 1868 906 1844T858 1791T800 1734T738 1676T677
+1623T625 1579H422Z" />
+<glyph unicode="&#xde;" glyph-name="Thorn" horiz-adv-x="1225" d="M1133 770Q1133 676 1108 590T1024 438T870 333T633 293H494V0H184V1462H494V1233H655Q779 1233 869 1200T1017 1107T1104 961T1133 770ZM494 543H578Q699 543 759 595T819 770Q819 878 766
+929T598 981H494V543Z" />
+<glyph unicode="&#xdf;" glyph-name="germandbls" horiz-adv-x="1395" d="M1188 1241Q1188 1177 1167 1129T1114 1042T1045 975T976 922T923 877T901 834Q901 814 913 797T952 760T1020 715T1118 651Q1167 620 1205 588T1269 517T1309 432T1323 326Q1323 154 1206
+67T862 -20Q764 -20 692 -6T559 43V285Q583 269 617 254T690 226T768 207T842 199Q922 199 966 229T1010 322Q1010 349 1003 370T976 412T918 457T821 516Q758 552 716 584T647 647T609 713T598 788Q598 841 618 880T670 950T737 1007T805 1059T856 1117T877 1188Q877
+1251 827 1290T680 1329Q572 1329 519 1281T465 1128V0H160V1139Q160 1248 197 1328T302 1462T467 1541T680 1567Q795 1567 889 1546T1049 1483T1152 1380T1188 1241Z" />
+<glyph unicode="&#xe0;" glyph-name="agrave" horiz-adv-x="1176" d="M809 0L750 152H741Q708 107 675 75T603 21T516 -10T403 -20Q335 -20 277 1T177 66T110 176T86 334Q86 512 200 596T541 690L719 696V780Q719 849 679 882T567 915Q495 915 427 894T289 838L190
+1040Q274 1087 376 1114T590 1141Q799 1141 910 1043T1022 745V0H809ZM719 518L618 514Q557 512 515 498T448 461T411 405T399 332Q399 262 433 233T522 203Q564 203 600 217T662 260T704 330T719 426V518ZM808 1241Q774 1269 727 1310T633 1396T549 1480T495 1548V1569H837Q853
+1535 874 1495T919 1414T966 1335T1011 1268V1241H808Z" />
+<glyph unicode="&#xe1;" glyph-name="aacute" horiz-adv-x="1176" d="M809 0L750 152H741Q708 107 675 75T603 21T516 -10T403 -20Q335 -20 277 1T177 66T110 176T86 334Q86 512 200 596T541 690L719 696V780Q719 849 679 882T567 915Q495 915 427 894T289 838L190
+1040Q274 1087 376 1114T590 1141Q799 1141 910 1043T1022 745V0H809ZM719 518L618 514Q557 512 515 498T448 461T411 405T399 332Q399 262 433 233T522 203Q564 203 600 217T662 260T704 330T719 426V518ZM441 1241V1268Q462 1297 486 1335T533 1413T578 1494T615
+1569H957V1548Q946 1530 925 1506T877 1453T819 1396T757 1338T696 1285T644 1241H441Z" />
+<glyph unicode="&#xe2;" glyph-name="acircumflex" horiz-adv-x="1176" d="M809 0L750 152H741Q708 107 675 75T603 21T516 -10T403 -20Q335 -20 277 1T177 66T110 176T86 334Q86 512 200 596T541 690L719 696V780Q719 849 679 882T567 915Q495 915 427 894T289
+838L190 1040Q274 1087 376 1114T590 1141Q799 1141 910 1043T1022 745V0H809ZM719 518L618 514Q557 512 515 498T448 461T411 405T399 332Q399 262 433 233T522 203Q564 203 600 217T662 260T704 330T719 426V518ZM801 1496Q750 1530 695 1573T588 1672Q534 1616
+482 1573T379 1496H176V1523Q202 1552 233 1590T297 1668T360 1749T412 1824H768Q789 1790 819 1750T881 1669T946 1590T1004 1523V1496H801Z" />
+<glyph unicode="&#xe3;" glyph-name="atilde" horiz-adv-x="1176" d="M809 0L750 152H741Q708 107 675 75T603 21T516 -10T403 -20Q335 -20 277 1T177 66T110 176T86 334Q86 512 200 596T541 690L719 696V780Q719 849 679 882T567 915Q495 915 427 894T289 838L190
+1040Q274 1087 376 1114T590 1141Q799 1141 910 1043T1022 745V0H809ZM719 518L618 514Q557 512 515 498T448 461T411 405T399 332Q399 262 433 233T522 203Q564 203 600 217T662 260T704 330T719 426V518ZM681 1346Q650 1346 632 1320T601 1239H452Q458 1319 478
+1377T530 1473T607 1529T704 1548Q745 1548 784 1532T861 1497T937 1461T1011 1444Q1042 1444 1060 1470T1091 1550H1240Q1234 1471 1214 1413T1160 1317T1084 1260T988 1241Q948 1241 908 1257T830 1293T755 1329T681 1346Z" />
+<glyph unicode="&#xe4;" glyph-name="adieresis" horiz-adv-x="1176" d="M809 0L750 152H741Q708 107 675 75T603 21T516 -10T403 -20Q335 -20 277 1T177 66T110 176T86 334Q86 512 200 596T541 690L719 696V780Q719 849 679 882T567 915Q495 915 427 894T289
+838L190 1040Q274 1087 376 1114T590 1141Q799 1141 910 1043T1022 745V0H809ZM719 518L618 514Q557 512 515 498T448 461T411 405T399 332Q399 262 433 233T522 203Q564 203 600 217T662 260T704 330T719 426V518ZM254 1405Q254 1440 265 1465T294 1507T338 1532T393
+1540Q422 1540 447 1532T492 1508T522 1466T534 1405Q534 1371 523 1346T492 1305T448 1280T393 1272Q364 1272 339 1280T295 1304T265 1346T254 1405ZM657 1405Q657 1440 668 1465T698 1507T743 1532T799 1540Q827 1540 852 1532T897 1508T928 1466T940 1405Q940
+1371 929 1346T898 1305T853 1280T799 1272Q739 1272 698 1305T657 1405Z" />
+<glyph unicode="&#xe5;" glyph-name="aring" horiz-adv-x="1176" d="M809 0L750 152H741Q708 107 675 75T603 21T516 -10T403 -20Q335 -20 277 1T177 66T110 176T86 334Q86 512 200 596T541 690L719 696V780Q719 849 679 882T567 915Q495 915 427 894T289 838L190
+1040Q274 1087 376 1114T590 1141Q799 1141 910 1043T1022 745V0H809ZM719 518L618 514Q557 512 515 498T448 461T411 405T399 332Q399 262 433 233T522 203Q564 203 600 217T662 260T704 330T719 426V518ZM842 1479Q842 1423 823 1379T769 1303T688 1256T588 1239Q533
+1239 487 1255T409 1302T358 1377T340 1477Q340 1532 358 1576T408 1650T487 1697T588 1714Q641 1714 687 1698T767 1651T822 1577T842 1479ZM684 1477Q684 1522 657 1547T588 1573Q546 1573 519 1548T492 1477Q492 1432 516 1406T588 1380Q630 1380 657 1406T684
+1477Z" />
+<glyph unicode="&#xe6;" glyph-name="ae" horiz-adv-x="1806" d="M1268 -20Q1137 -20 1030 30T854 186Q811 132 769 94T678 30T568 -8T424 -20Q356 -20 295 1T187 66T113 176T86 334Q86 512 200 596T541 690L719 696V780Q719 849 679 882T567 915Q495 915 427
+894T289 838L190 1040Q274 1087 376 1114T590 1141Q804 1141 913 1010Q1039 1139 1227 1139Q1338 1139 1427 1106T1579 1007T1674 848T1708 631V483H1026Q1028 419 1046 368T1098 281T1179 226T1288 207Q1382 207 1469 228T1645 295V59Q1605 38 1565 24T1479 -1T1382
+-15T1268 -20ZM719 518L618 514Q557 512 515 498T448 461T411 405T399 332Q399 262 433 233T522 203Q564 203 600 217T662 260T704 330T719 426V518ZM1229 922Q1147 922 1094 865T1032 686H1421Q1420 737 1408 780T1373 854T1313 904T1229 922Z" />
+<glyph unicode="&#xe7;" glyph-name="ccedilla" horiz-adv-x="1022" d="M625 -20Q505 -20 409 13T244 115T139 293T102 553Q102 720 139 832T245 1013T410 1110T625 1139Q711 1139 796 1118T956 1059L868 827Q802 856 741 874T625 893Q514 893 464 809T414 555Q414
+387 464 307T621 227Q708 227 779 249T924 307V53Q887 35 852 21T782 -2T708 -15T625 -20ZM778 -250Q778 -307 763 -352T711 -428T616 -475T469 -492Q424 -492 388 -486T323 -471V-303Q338 -307 356 -310T394 -317T432 -322T466 -324Q495 -324 516 -311T538 -262Q538
+-225 501 -197T372 -154L450 0H643L616 -61Q647 -71 676 -88T727 -128T764 -182T778 -250Z" />
+<glyph unicode="&#xe8;" glyph-name="egrave" horiz-adv-x="1190" d="M612 922Q531 922 478 865T416 686H805Q804 737 792 780T756 854T696 904T612 922ZM651 -20Q531 -20 430 15T256 120T143 298T102 551Q102 698 139 808T242 991T402 1102T610 1139Q721 1139
+810 1106T962 1007T1058 848T1092 631V483H410Q412 419 430 368T482 281T563 226T672 207Q723 207 768 212T857 229T942 256T1028 295V59Q988 38 948 24T862 -1T765 -15T651 -20ZM834 1241Q800 1269 753 1310T659 1396T575 1480T521 1548V1569H863Q879 1535 900
+1495T945 1414T992 1335T1037 1268V1241H834Z" />
+<glyph unicode="&#xe9;" glyph-name="eacute" horiz-adv-x="1190" d="M612 922Q531 922 478 865T416 686H805Q804 737 792 780T756 854T696 904T612 922ZM651 -20Q531 -20 430 15T256 120T143 298T102 551Q102 698 139 808T242 991T402 1102T610 1139Q721 1139
+810 1106T962 1007T1058 848T1092 631V483H410Q412 419 430 368T482 281T563 226T672 207Q723 207 768 212T857 229T942 256T1028 295V59Q988 38 948 24T862 -1T765 -15T651 -20ZM447 1241V1268Q468 1297 492 1335T539 1413T584 1494T621 1569H963V1548Q952 1530
+931 1506T883 1453T825 1396T763 1338T702 1285T650 1241H447Z" />
+<glyph unicode="&#xea;" glyph-name="ecircumflex" horiz-adv-x="1190" d="M612 922Q531 922 478 865T416 686H805Q804 737 792 780T756 854T696 904T612 922ZM651 -20Q531 -20 430 15T256 120T143 298T102 551Q102 698 139 808T242 991T402 1102T610 1139Q721
+1139 810 1106T962 1007T1058 848T1092 631V483H410Q412 419 430 368T482 281T563 226T672 207Q723 207 768 212T857 229T942 256T1028 295V59Q988 38 948 24T862 -1T765 -15T651 -20ZM819 1241Q768 1275 713 1318T606 1417Q552 1361 500 1318T397 1241H194V1268Q220
+1297 251 1335T315 1413T378 1494T430 1569H786Q807 1535 837 1495T899 1414T964 1335T1022 1268V1241H819Z" />
+<glyph unicode="&#xeb;" glyph-name="edieresis" horiz-adv-x="1190" d="M612 922Q531 922 478 865T416 686H805Q804 737 792 780T756 854T696 904T612 922ZM651 -20Q531 -20 430 15T256 120T143 298T102 551Q102 698 139 808T242 991T402 1102T610 1139Q721 1139
+810 1106T962 1007T1058 848T1092 631V483H410Q412 419 430 368T482 281T563 226T672 207Q723 207 768 212T857 229T942 256T1028 295V59Q988 38 948 24T862 -1T765 -15T651 -20ZM266 1405Q266 1440 277 1465T306 1507T350 1532T405 1540Q434 1540 459 1532T504
+1508T534 1466T546 1405Q546 1371 535 1346T504 1305T460 1280T405 1272Q376 1272 351 1280T307 1304T277 1346T266 1405ZM669 1405Q669 1440 680 1465T710 1507T755 1532T811 1540Q839 1540 864 1532T909 1508T940 1466T952 1405Q952 1371 941 1346T910 1305T865
+1280T811 1272Q751 1272 710 1305T669 1405Z" />
+<glyph unicode="&#xec;" glyph-name="igrave" horiz-adv-x="625" d="M465 0H160V1118H465V0ZM269 1241Q235 1269 188 1310T94 1396T10 1480T-44 1548V1569H298Q314 1535 335 1495T380 1414T427 1335T472 1268V1241H269Z" />
+<glyph unicode="&#xed;" glyph-name="iacute" horiz-adv-x="625" d="M465 0H160V1118H465V0ZM145 1241V1268Q166 1297 190 1335T237 1413T282 1494T319 1569H661V1548Q650 1530 629 1506T581 1453T523 1396T461 1338T400 1285T348 1241H145Z" />
+<glyph unicode="&#xee;" glyph-name="icircumflex" horiz-adv-x="625" d="M465 0H160V1118H465V0ZM521 1241Q470 1275 415 1318T308 1417Q254 1361 202 1318T99 1241H-104V1268Q-78 1297 -47 1335T17 1413T80 1494T132 1569H488Q509 1535 539 1495T601 1414T666
+1335T724 1268V1241H521Z" />
+<glyph unicode="&#xef;" glyph-name="idieresis" horiz-adv-x="625" d="M465 0H160V1118H465V0ZM-32 1405Q-32 1440 -21 1465T8 1507T52 1532T107 1540Q136 1540 161 1532T206 1508T236 1466T248 1405Q248 1371 237 1346T206 1305T162 1280T107 1272Q78 1272 53
+1280T9 1304T-21 1346T-32 1405ZM371 1405Q371 1440 382 1465T412 1507T457 1532T513 1540Q541 1540 566 1532T611 1508T642 1466T654 1405Q654 1371 643 1346T612 1305T567 1280T513 1272Q453 1272 412 1305T371 1405Z" />
+<glyph unicode="&#xf0;" glyph-name="eth" horiz-adv-x="1182" d="M457 1309Q423 1330 384 1354T303 1401L399 1571Q472 1537 536 1503T657 1430L883 1569L983 1415L809 1309Q881 1240 935 1162T1024 993T1078 798T1096 573Q1096 431 1060 321T957 135T795 20T582
+-20Q471 -20 378 14T218 113T112 272T74 489Q74 611 106 705T197 863T337 961T516 995Q612 995 680 964T780 883L801 885Q773 973 723 1050T606 1184L375 1040L274 1196L457 1309ZM784 532Q784 579 773 622T737 698T675 750T586 770Q478 770 432 700T385 487Q385
+424 396 372T432 283T495 226T586 205Q692 205 738 286T784 532Z" />
+<glyph unicode="&#xf1;" glyph-name="ntilde" horiz-adv-x="1284" d="M1130 0H825V653Q825 774 789 834T672 895Q612 895 572 871T509 800T475 684T465 526V0H160V1118H393L434 975H451Q475 1018 509 1049T585 1100T672 1129T766 1139Q848 1139 915 1116T1030
+1042T1104 915T1130 729V0ZM477 1346Q446 1346 428 1320T397 1239H248Q254 1319 274 1377T326 1473T403 1529T500 1548Q541 1548 580 1532T657 1497T733 1461T807 1444Q838 1444 856 1470T887 1550H1036Q1030 1471 1010 1413T956 1317T880 1260T784 1241Q744 1241
+704 1257T626 1293T551 1329T477 1346Z" />
+<glyph unicode="&#xf2;" glyph-name="ograve" horiz-adv-x="1227" d="M414 561Q414 394 461 310T614 225Q719 225 766 310T813 561Q813 728 766 810T612 893Q507 893 461 811T414 561ZM1124 561Q1124 421 1089 313T987 131T825 19T610 -20Q499 -20 406 18T246
+131T140 313T102 561Q102 700 137 808T239 989T401 1101T616 1139Q727 1139 820 1101T980 990T1086 808T1124 561ZM841 1241Q807 1269 760 1310T666 1396T582 1480T528 1548V1569H870Q886 1535 907 1495T952 1414T999 1335T1044 1268V1241H841Z" />
+<glyph unicode="&#xf3;" glyph-name="oacute" horiz-adv-x="1227" d="M414 561Q414 394 461 310T614 225Q719 225 766 310T813 561Q813 728 766 810T612 893Q507 893 461 811T414 561ZM1124 561Q1124 421 1089 313T987 131T825 19T610 -20Q499 -20 406 18T246
+131T140 313T102 561Q102 700 137 808T239 989T401 1101T616 1139Q727 1139 820 1101T980 990T1086 808T1124 561ZM434 1241V1268Q455 1297 479 1335T526 1413T571 1494T608 1569H950V1548Q939 1530 918 1506T870 1453T812 1396T750 1338T689 1285T637 1241H434Z"
+/>
+<glyph unicode="&#xf4;" glyph-name="ocircumflex" horiz-adv-x="1227" d="M414 561Q414 394 461 310T614 225Q719 225 766 310T813 561Q813 728 766 810T612 893Q507 893 461 811T414 561ZM1124 561Q1124 421 1089 313T987 131T825 19T610 -20Q499 -20 406 18T246
+131T140 313T102 561Q102 700 137 808T239 989T401 1101T616 1139Q727 1139 820 1101T980 990T1086 808T1124 561ZM821 1241Q770 1275 715 1318T608 1417Q554 1361 502 1318T399 1241H196V1268Q222 1297 253 1335T317 1413T380 1494T432 1569H788Q809 1535 839
+1495T901 1414T966 1335T1024 1268V1241H821Z" />
+<glyph unicode="&#xf5;" glyph-name="otilde" horiz-adv-x="1227" d="M414 561Q414 394 461 310T614 225Q719 225 766 310T813 561Q813 728 766 810T612 893Q507 893 461 811T414 561ZM1124 561Q1124 421 1089 313T987 131T825 19T610 -20Q499 -20 406 18T246
+131T140 313T102 561Q102 700 137 808T239 989T401 1101T616 1139Q727 1139 820 1101T980 990T1086 808T1124 561ZM444 1346Q413 1346 395 1320T364 1239H215Q221 1319 241 1377T293 1473T370 1529T467 1548Q508 1548 547 1532T624 1497T700 1461T774 1444Q805
+1444 823 1470T854 1550H1003Q997 1471 977 1413T923 1317T847 1260T751 1241Q711 1241 671 1257T593 1293T518 1329T444 1346Z" />
+<glyph unicode="&#xf6;" glyph-name="odieresis" horiz-adv-x="1227" d="M414 561Q414 394 461 310T614 225Q719 225 766 310T813 561Q813 728 766 810T612 893Q507 893 461 811T414 561ZM1124 561Q1124 421 1089 313T987 131T825 19T610 -20Q499 -20 406 18T246
+131T140 313T102 561Q102 700 137 808T239 989T401 1101T616 1139Q727 1139 820 1101T980 990T1086 808T1124 561ZM266 1405Q266 1440 277 1465T306 1507T350 1532T405 1540Q434 1540 459 1532T504 1508T534 1466T546 1405Q546 1371 535 1346T504 1305T460 1280T405
+1272Q376 1272 351 1280T307 1304T277 1346T266 1405ZM669 1405Q669 1440 680 1465T710 1507T755 1532T811 1540Q839 1540 864 1532T909 1508T940 1466T952 1405Q952 1371 941 1346T910 1305T865 1280T811 1272Q751 1272 710 1305T669 1405Z" />
+<glyph unicode="&#xf7;" glyph-name="divide" horiz-adv-x="1128" d="M88 612V831H1040V612H88ZM424 373Q424 415 435 444T465 490T509 516T563 524Q591 524 616 516T660 491T690 444T702 373Q702 333 691 304T660 257T616 230T563 221Q535 221 510 229T465 256T435
+304T424 373ZM424 1071Q424 1113 435 1142T465 1189T509 1215T563 1223Q591 1223 616 1215T660 1189T690 1142T702 1071Q702 1031 691 1003T660 956T616 929T563 920Q535 920 510 928T465 955T435 1002T424 1071Z" />
+<glyph unicode="&#xf8;" glyph-name="oslash" horiz-adv-x="1227" d="M1124 561Q1124 421 1089 313T987 131T825 19T610 -20Q553 -20 501 -10T401 18L344 -76L182 14L250 125Q181 199 142 308T102 561Q102 700 137 808T239 989T401 1101T616 1139Q678 1139 735
+1126T844 1090L893 1169L1053 1073L991 975Q1054 903 1089 799T1124 561ZM414 561Q414 475 426 410L709 868Q669 893 612 893Q507 893 461 811T414 561ZM813 561Q813 625 807 674L539 240Q556 232 574 229T614 225Q719 225 766 310T813 561Z" />
+<glyph unicode="&#xf9;" glyph-name="ugrave" horiz-adv-x="1284" d="M891 0L850 143H834Q809 100 775 70T699 19T612 -10T518 -20Q436 -20 369 3T254 77T180 204T154 389V1118H459V465Q459 344 495 284T612 223Q672 223 712 247T775 318T809 434T819 592V1118H1124V0H891ZM839
+1241Q805 1269 758 1310T664 1396T580 1480T526 1548V1569H868Q884 1535 905 1495T950 1414T997 1335T1042 1268V1241H839Z" />
+<glyph unicode="&#xfa;" glyph-name="uacute" horiz-adv-x="1284" d="M891 0L850 143H834Q809 100 775 70T699 19T612 -10T518 -20Q436 -20 369 3T254 77T180 204T154 389V1118H459V465Q459 344 495 284T612 223Q672 223 712 247T775 318T809 434T819 592V1118H1124V0H891ZM461
+1241V1268Q482 1297 506 1335T553 1413T598 1494T635 1569H977V1548Q966 1530 945 1506T897 1453T839 1396T777 1338T716 1285T664 1241H461Z" />
+<glyph unicode="&#xfb;" glyph-name="ucircumflex" horiz-adv-x="1284" d="M891 0L850 143H834Q809 100 775 70T699 19T612 -10T518 -20Q436 -20 369 3T254 77T180 204T154 389V1118H459V465Q459 344 495 284T612 223Q672 223 712 247T775 318T809 434T819 592V1118H1124V0H891ZM842
+1241Q791 1275 736 1318T629 1417Q575 1361 523 1318T420 1241H217V1268Q243 1297 274 1335T338 1413T401 1494T453 1569H809Q830 1535 860 1495T922 1414T987 1335T1045 1268V1241H842Z" />
+<glyph unicode="&#xfc;" glyph-name="udieresis" horiz-adv-x="1284" d="M891 0L850 143H834Q809 100 775 70T699 19T612 -10T518 -20Q436 -20 369 3T254 77T180 204T154 389V1118H459V465Q459 344 495 284T612 223Q672 223 712 247T775 318T809 434T819 592V1118H1124V0H891ZM295
+1405Q295 1440 306 1465T335 1507T379 1532T434 1540Q463 1540 488 1532T533 1508T563 1466T575 1405Q575 1371 564 1346T533 1305T489 1280T434 1272Q405 1272 380 1280T336 1304T306 1346T295 1405ZM698 1405Q698 1440 709 1465T739 1507T784 1532T840 1540Q868
+1540 893 1532T938 1508T969 1466T981 1405Q981 1371 970 1346T939 1305T894 1280T840 1272Q780 1272 739 1305T698 1405Z" />
+<glyph unicode="&#xfd;" glyph-name="yacute" horiz-adv-x="1104" d="M0 1118H334L514 489Q530 437 537 378T547 272H553Q555 295 558 323T567 380T578 437T592 489L768 1118H1104L662 -143Q600 -320 493 -406T225 -492Q173 -492 135 -487T70 -475V-233Q91 -238
+123 -242T190 -246Q238 -246 272 -233T330 -197T372 -140T403 -66L422 -10L0 1118ZM393 1241V1268Q414 1297 438 1335T485 1413T530 1494T567 1569H909V1548Q898 1530 877 1506T829 1453T771 1396T709 1338T648 1285T596 1241H393Z" />
+<glyph unicode="&#xfe;" glyph-name="thorn" horiz-adv-x="1245" d="M465 973Q485 1008 512 1038T576 1090T656 1126T756 1139Q842 1139 913 1102T1035 992T1114 811T1143 561Q1143 418 1115 310T1036 128T914 17T756 -20Q701 -20 656 -10T576 20T513 64T465 117H451Q454
+85 458 55Q461 29 463 3T465 -39V-492H160V1556H465V1165Q465 1141 463 1108T458 1045Q454 1010 451 973H465ZM653 895Q602 895 567 877T509 821T477 728T465 596V563Q465 482 474 419T506 314T564 249T655 227Q746 227 788 313T831 565Q831 730 789 812T653 895Z"
+/>
+<glyph unicode="&#xff;" glyph-name="ydieresis" horiz-adv-x="1104" d="M0 1118H334L514 489Q530 437 537 378T547 272H553Q555 295 558 323T567 380T578 437T592 489L768 1118H1104L662 -143Q600 -320 493 -406T225 -492Q173 -492 135 -487T70 -475V-233Q91
+-238 123 -242T190 -246Q238 -246 272 -233T330 -197T372 -140T403 -66L422 -10L0 1118ZM466 1405Q466 1440 477 1465T506 1507T550 1532T605 1540Q634 1540 659 1532T704 1508T734 1466T746 1405Q746 1371 735 1346T704 1305T660 1280T605 1272Q576 1272 551 1280T507
+1304T477 1346T466 1405ZM869 1405Q869 1440 880 1465T910 1507T955 1532T1011 1540Q1039 1540 1064 1532T1109 1508T1140 1466T1152 1405Q1152 1371 1141 1346T1110 1305T1065 1280T1011 1272Q951 1272 910 1305T869 1405Z" />
+<glyph unicode="&#x2013;" glyph-name="endash" horiz-adv-x="1024" d="M82 436V666H942V436H82Z" />
+<glyph unicode="&#x2014;" glyph-name="emdash" horiz-adv-x="2048" d="M82 436V666H1966V436H82Z" />
+<glyph unicode="&#x2018;" glyph-name="quoteleft" horiz-adv-x="440" d="M37 961L23 983Q37 1037 56 1098T99 1221T148 1344T199 1462H418Q403 1401 389 1335T361 1204T336 1076T317 961H37Z" />
+<glyph unicode="&#x2019;" glyph-name="quoteright" horiz-adv-x="440" d="M403 1462L418 1440Q404 1385 385 1325T342 1202T293 1078T242 961H23Q37 1021 51 1087T79 1219T104 1347T123 1462H403Z" />
+<glyph unicode="&#x201a;" glyph-name="quotesinglbase" horiz-adv-x="594" d="M459 215Q445 161 426 100T383 -23T334 -146T283 -264H63Q78 -203 92 -137T120 -6T145 122T164 238H444L459 215Z" />
+<glyph unicode="&#x201c;" glyph-name="quotedblleft" horiz-adv-x="907" d="M489 983Q503 1037 523 1098T566 1221T615 1344T666 1462H885Q870 1401 856 1335T828 1204T803 1076T784 961H504L489 983ZM23 983Q37 1037 56 1098T99 1221T148 1344T199 1462H418Q403
+1401 389 1335T361 1204T336 1076T317 961H37L23 983Z" />
+<glyph unicode="&#x201d;" glyph-name="quotedblright" horiz-adv-x="907" d="M418 1440Q404 1385 385 1325T342 1202T293 1078T242 961H23Q37 1021 51 1087T79 1219T104 1347T123 1462H403L418 1440ZM885 1440Q871 1385 852 1325T809 1202T760 1078T709 961H489Q504
+1021 518 1087T546 1219T571 1347T590 1462H870L885 1440Z" />
+<glyph unicode="&#x201e;" glyph-name="quotedblbase" horiz-adv-x="1061" d="M459 215Q445 161 426 100T383 -23T334 -146T283 -264H63Q78 -203 92 -137T120 -6T145 122T164 238H444L459 215ZM926 215Q912 161 893 100T850 -23T801 -146T750 -264H530Q545 -203
+559 -137T587 -6T612 122T631 238H911L926 215Z" />
+<glyph unicode="&#x2022;" glyph-name="bullet" horiz-adv-x="770" d="M98 748Q98 834 120 894T180 992T271 1047T385 1065Q444 1065 496 1048T588 992T649 894T672 748Q672 663 650 603T588 505T497 448T385 430Q324 430 272 448T181 504T120 603T98 748Z" />
+<glyph unicode="&#x2039;" glyph-name="guilsinglleft" horiz-adv-x="692" d="M82 573L391 1028L610 909L393 561L610 213L391 94L82 547V573Z" />
+<glyph unicode="&#x203a;" glyph-name="guilsinglright" horiz-adv-x="692" d="M610 547L301 94L82 213L299 561L82 909L301 1028L610 573V547Z" />
+</font>
+</defs>
+</svg>
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
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.ttf
Binary files 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
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.woff
Binary files 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
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-700.woff2
Binary files 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
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.eot
Binary files 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 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg">
+<defs >
+<font id="DroidSans" horiz-adv-x="1062" ><font-face
+ font-family="Droid Sans"
+ units-per-em="2048"
+ panose-1="2 11 6 6 3 8 4 2 2 4"
+ ascent="1907"
+ descent="-492"
+ alphabetic="0" />
+<glyph unicode=" " glyph-name="space" horiz-adv-x="532" />
+<glyph unicode="!" glyph-name="exclam" horiz-adv-x="551" d="M336 414H215L164 1462H387L336 414ZM147 111Q147 149 157 175T184 218T224 242T274 250Q300 250 323 243T364 219T391 176T401 111Q401 74 391 48T364 4T324 -21T274 -29Q247 -29 224 -21T184 4T157
+47T147 111Z" />
+<glyph unicode="&quot;" glyph-name="quotedbl" horiz-adv-x="823" d="M330 1462L289 934H174L133 1462H330ZM690 1462L649 934H535L494 1462H690Z" />
+<glyph unicode="#" glyph-name="numbersign" horiz-adv-x="1323" d="M983 893L920 565H1200V428H893L811 0H664L748 428H457L375 0H231L309 428H51V565H336L401 893H127V1030H426L508 1462H655L573 1030H866L950 1462H1094L1010 1030H1272V893H983ZM483 565H774L838
+893H547L483 565Z" />
+<glyph unicode="$" glyph-name="dollar" horiz-adv-x="1128" d="M985 446Q985 376 960 319T889 220T776 151T625 111V-119H487V102Q437 102 386 106T287 120T197 142T123 172V344Q156 328 199 312T291 282T389 261T487 252V686Q398 716 333 749T224 824T160 922T139
+1051Q139 1118 163 1173T233 1270T343 1338T487 1374V1554H625V1378Q725 1373 809 1352T961 1300L895 1155Q839 1180 769 1200T625 1227V805Q713 774 780 741T893 667T962 572T985 446ZM809 446Q809 479 799 506T768 556T711 598T625 635V262Q718 276 763 325T809
+446ZM315 1049Q315 1013 323 985T352 933T405 890T487 854V1223Q398 1207 357 1163T315 1049Z" />
+<glyph unicode="%" glyph-name="percent" horiz-adv-x="1690" d="M250 1026Q250 861 285 779T401 696Q557 696 557 1026Q557 1354 401 1354Q321 1354 286 1273T250 1026ZM705 1026Q705 918 687 832T632 687T538 597T401 565Q328 565 272 596T178 687T121 832T102
+1026Q102 1134 119 1219T173 1362T266 1452T401 1483Q476 1483 532 1452T627 1363T685 1219T705 1026ZM1133 440Q1133 275 1168 193T1284 111Q1440 111 1440 440Q1440 768 1284 768Q1204 768 1169 687T1133 440ZM1587 440Q1587 332 1570 247T1515 102T1421 12T1284
+-20Q1210 -20 1154 11T1061 102T1004 246T985 440Q985 548 1002 633T1056 776T1149 866T1284 897Q1359 897 1415 866T1510 777T1567 633T1587 440ZM1331 1462L520 0H362L1174 1462H1331Z" />
+<glyph unicode="&amp;" glyph-name="ampersand" horiz-adv-x="1438" d="M422 1165Q422 1131 430 1099T454 1034T497 968T559 897Q618 932 661 963T732 1026T774 1093T788 1169Q788 1205 776 1235T740 1288T683 1322T608 1335Q522 1335 472 1291T422 1165ZM557
+141Q615 141 664 152T755 184T833 231T901 289L514 696Q462 663 422 632T355 564T313 486T299 387Q299 333 316 288T367 210T448 159T557 141ZM109 381Q109 459 129 520T187 631T281 724T408 809Q377 845 347 883T295 965T258 1058T244 1165Q244 1240 269 1299T341
+1400T457 1463T614 1485Q697 1485 762 1464T873 1401T943 1300T967 1165Q967 1101 942 1047T875 946T779 860T664 784L1016 412Q1043 441 1064 471T1103 535T1133 608T1157 694H1341Q1326 628 1306 573T1259 468T1200 377T1128 293L1405 0H1180L1012 172Q963 127
+915 92T813 32T697 -6T557 -20Q452 -20 369 6T228 84T140 210T109 381Z" />
+<glyph unicode="&apos;" glyph-name="quotesingle" horiz-adv-x="463" d="M330 1462L289 934H174L133 1462H330Z" />
+<glyph unicode="(" glyph-name="parenleft" horiz-adv-x="616" d="M82 561Q82 686 100 807T155 1043T248 1263T383 1462H555Q415 1269 343 1038T270 563Q270 444 288 326T342 95T431 -124T553 -324H383Q305 -234 249 -131T155 84T100 317T82 561Z" />
+<glyph unicode=")" glyph-name="parenright" horiz-adv-x="616" d="M535 561Q535 437 517 317T462 85T368 -131T233 -324H63Q132 -230 185 -124T274 95T328 326T346 563Q346 807 274 1038T61 1462H233Q311 1369 367 1264T461 1044T517 808T535 561Z" />
+<glyph unicode="*" glyph-name="asterisk" horiz-adv-x="1128" d="M664 1556L621 1163L1018 1274L1044 1081L666 1053L911 727L733 631L557 989L399 631L215 727L457 1053L82 1081L111 1274L502 1163L459 1556H664Z" />
+<glyph unicode="+" glyph-name="plus" horiz-adv-x="1128" d="M489 647H102V797H489V1186H639V797H1026V647H639V262H489V647Z" />
+<glyph unicode="," glyph-name="comma" horiz-adv-x="512" d="M362 238L377 215Q363 161 344 100T301 -23T252 -146T201 -264H63Q78 -203 92 -137T120 -6T145 122T164 238H362Z" />
+<glyph unicode="-" glyph-name="hyphen" horiz-adv-x="659" d="M82 465V633H578V465H82Z" />
+<glyph unicode="." glyph-name="period" horiz-adv-x="549" d="M147 111Q147 149 157 175T184 218T224 242T274 250Q300 250 323 243T364 219T391 176T401 111Q401 74 391 48T364 4T324 -21T274 -29Q247 -29 224 -21T184 4T157 47T147 111Z" />
+<glyph unicode="/" glyph-name="slash" horiz-adv-x="764" d="M743 1462L199 0H20L565 1462H743Z" />
+<glyph unicode="0" glyph-name="zero" horiz-adv-x="1128" d="M1032 733Q1032 556 1007 416T925 179T779 31T563 -20Q445 -20 358 31T213 179T127 416T98 733Q98 910 123 1050T204 1286T348 1434T563 1485Q682 1485 770 1435T916 1288T1003 1051T1032 733ZM283
+733Q283 583 298 471T346 285T432 173T563 135Q640 135 694 172T782 283T832 469T848 733Q848 883 833 995T783 1181T694 1292T563 1329Q486 1329 433 1292T346 1181T298 995T283 733Z" />
+<glyph unicode="1" glyph-name="one" horiz-adv-x="1128" d="M711 0H535V913Q535 956 535 1005T537 1102T540 1195T543 1274Q526 1256 513 1243T487 1218T458 1193T422 1161L274 1040L178 1163L561 1462H711V0Z" />
+<glyph unicode="2" glyph-name="two" horiz-adv-x="1128" d="M1008 0H96V156L446 537Q521 618 580 685T680 816T744 944T766 1085Q766 1144 749 1189T701 1265T626 1313T530 1329Q435 1329 359 1291T213 1192L111 1311Q151 1347 197 1378T296 1433T408 1469T532
+1483Q628 1483 705 1456T837 1379T920 1256T950 1092Q950 1007 924 930T851 779T740 629T600 473L319 174V166H1008V0Z" />
+<glyph unicode="3" glyph-name="three" horiz-adv-x="1128" d="M961 1120Q961 1047 938 987T874 883T774 811T645 770V764Q822 742 914 652T1006 416Q1006 320 974 240T875 102T708 12T469 -20Q360 -20 264 -3T82 59V229Q169 183 270 158T465 133Q557 133 624
+153T734 210T798 301T819 422Q819 490 793 538T717 618T598 665T438 680H305V831H438Q519 831 582 851T687 908T752 996T774 1108Q774 1160 756 1201T705 1270T626 1314T524 1329Q417 1329 336 1296T180 1208L88 1333Q126 1364 172 1391T274 1438T391 1471T524
+1483Q632 1483 713 1456T850 1381T933 1266T961 1120Z" />
+<glyph unicode="4" glyph-name="four" horiz-adv-x="1128" d="M1087 328H874V0H698V328H23V487L686 1470H874V494H1087V328ZM698 494V850Q698 906 699 967T703 1087T707 1197T711 1282H702Q695 1262 685 1238T662 1189T636 1141T612 1102L201 494H698Z" />
+<glyph unicode="5" glyph-name="five" horiz-adv-x="1128" d="M545 897Q644 897 729 870T878 788T978 654T1014 469Q1014 355 980 264T879 110T714 14T487 -20Q436 -20 387 -15T292 -1T205 24T131 59V231Q164 208 208 190T302 160T400 142T492 135Q571 135 633
+153T738 211T804 309T827 449Q827 592 739 667T483 743Q456 743 425 741T362 734T302 726T252 717L162 774L217 1462H907V1296H375L336 877Q368 883 420 890T545 897Z" />
+<glyph unicode="6" glyph-name="six" horiz-adv-x="1128" d="M113 625Q113 730 123 834T160 1033T233 1211T350 1353T520 1448T752 1483Q771 1483 794 1482T840 1479T885 1473T924 1464V1309Q889 1321 845 1327T758 1333Q668 1333 600 1312T481 1251T398 1158T343
+1039T312 899T299 745H311Q331 781 359 812T426 866T511 902T618 915Q713 915 790 886T921 799T1004 660T1034 471Q1034 357 1003 266T914 112T774 14T590 -20Q490 -20 403 19T251 138T150 339T113 625ZM588 133Q648 133 697 153T783 215T838 320T858 471Q858 541
+842 596T792 691T710 751T594 772Q527 772 472 749T377 688T317 602T295 506Q295 439 313 373T368 253T460 167T588 133Z" />
+<glyph unicode="7" glyph-name="seven" horiz-adv-x="1128" d="M281 0L844 1296H90V1462H1030V1317L475 0H281Z" />
+<glyph unicode="8" glyph-name="eight" horiz-adv-x="1128" d="M565 1485Q649 1485 723 1463T854 1397T944 1287T977 1133Q977 1066 957 1012T902 915T819 837T715 774Q773 743 828 705T927 620T997 513T1024 381Q1024 289 991 215T897 88T752 8T565 -20Q455 -20
+370 7T226 84T137 208T106 373Q106 448 128 508T189 616T279 701T389 766Q340 797 297 833T223 915T173 1014T154 1135Q154 1222 187 1287T278 1397T409 1463T565 1485ZM285 371Q285 318 301 274T351 198T437 149T561 131Q631 131 684 148T774 198T828 277T846
+379Q846 431 827 473T771 551T683 619T569 682L539 696Q413 636 349 559T285 371ZM563 1333Q457 1333 395 1280T332 1126Q332 1069 349 1028T398 955T472 898T567 848Q615 870 657 896T731 955T781 1030T799 1126Q799 1227 736 1280T563 1333Z" />
+<glyph unicode="9" glyph-name="nine" horiz-adv-x="1128" d="M1028 838Q1028 733 1018 629T981 429T908 252T791 109T621 15T389 -20Q370 -20 347 -19T301 -16T256 -10T217 -2V154Q252 141 296 135T383 129Q518 129 605 176T743 303T815 491T842 717H829Q809
+681 781 650T715 596T629 560T522 547Q427 547 350 576T219 663T136 802T106 991Q106 1105 137 1196T226 1351T366 1449T551 1483Q652 1483 739 1444T890 1325T991 1124T1028 838ZM553 1329Q493 1329 444 1309T358 1247T303 1142T283 991Q283 921 299 866T349 771T431
+711T547 690Q615 690 670 713T764 774T824 860T846 956Q846 1023 828 1089T773 1209T681 1296T553 1329Z" />
+<glyph unicode=":" glyph-name="colon" horiz-adv-x="549" d="M147 111Q147 149 157 175T184 218T224 242T274 250Q300 250 323 243T364 219T391 176T401 111Q401 74 391 48T364 4T324 -21T274 -29Q247 -29 224 -21T184 4T157 47T147 111ZM147 987Q147 1026 157
+1052T184 1095T224 1119T274 1126Q300 1126 323 1119T364 1096T391 1053T401 987Q401 950 391 924T364 881T324 856T274 848Q247 848 224 856T184 881T157 924T147 987Z" />
+<glyph unicode=";" glyph-name="semicolon" horiz-adv-x="549" d="M362 238L377 215Q363 161 344 100T301 -23T252 -146T201 -264H63Q78 -203 92 -137T120 -6T145 122T164 238H362ZM147 987Q147 1026 157 1052T184 1095T224 1119T274 1126Q300 1126 323 1119T364
+1096T391 1053T401 987Q401 950 391 924T364 881T324 856T274 848Q247 848 224 856T184 881T157 924T147 987Z" />
+<glyph unicode="&lt;" glyph-name="less" horiz-adv-x="1128" d="M1026 238L102 662V764L1026 1245V1085L291 721L1026 399V238Z" />
+<glyph unicode="=" glyph-name="equal" horiz-adv-x="1128" d="M102 852V1001H1026V852H102ZM102 442V592H1026V442H102Z" />
+<glyph unicode="&gt;" glyph-name="greater" horiz-adv-x="1128" d="M102 399L838 721L102 1085V1245L1026 764V662L102 238V399Z" />
+<glyph unicode="?" glyph-name="question" horiz-adv-x="872" d="M281 414V451Q281 508 288 554T315 640T368 718T451 799Q499 840 533 873T588 941T620 1015T631 1108Q631 1156 616 1195T573 1263T502 1307T403 1323Q320 1323 245 1297T100 1237L37 1382Q118
+1424 212 1453T403 1483Q496 1483 570 1458T697 1384T777 1267T805 1110Q805 1043 792 991T751 893T684 806T590 717Q538 672 505 639T453 574T427 509T420 432V414H281ZM233 111Q233 149 243 175T270 218T310 242T360 250Q386 250 409 243T450 219T477 176T487
+111Q487 74 477 48T450 4T410 -21T360 -29Q333 -29 310 -21T270 4T243 47T233 111Z" />
+<glyph unicode="@" glyph-name="at" horiz-adv-x="1774" d="M1665 731Q1665 669 1656 607T1628 488T1581 383T1514 298T1428 242T1321 221Q1276 221 1240 236T1177 276T1135 333T1112 401H1108Q1090 364 1063 331T1001 274T921 235T823 221Q746 221 687 249T586
+327T524 449T502 606Q502 707 531 791T616 936T751 1031T928 1065Q973 1065 1018 1061T1104 1050T1179 1035T1237 1018L1214 602Q1213 580 1213 567T1212 545T1212 533T1212 526Q1212 473 1222 439T1250 385T1288 358T1333 350Q1379 350 1414 380T1472 463T1508
+585T1520 733Q1520 875 1477 985T1358 1172T1178 1287T950 1327Q781 1327 652 1272T436 1117T303 881T258 582Q258 431 297 314T413 117T603 -4T864 -45Q925 -45 984 -38T1099 -19T1205 8T1298 41V-100Q1212 -138 1104 -160T866 -182Q687 -182 547 -131T309 17T160
+255T109 575Q109 763 168 925T336 1207T601 1394T950 1462Q1106 1462 1237 1412T1463 1267T1612 1037T1665 731ZM662 602Q662 469 712 410T848 350Q903 350 942 372T1006 436T1044 535T1061 662L1075 915Q1047 923 1009 929T928 936Q854 936 804 907T722 831T676
+724T662 602Z" />
+<glyph unicode="A" glyph-name="A" horiz-adv-x="1245" d="M1055 0L895 453H350L188 0H0L537 1468H707L1245 0H1055ZM836 618L688 1042Q682 1060 674 1086T656 1142T638 1204T621 1268Q614 1237 605 1204T587 1141T570 1085T555 1042L410 618H836Z" />
+<glyph unicode="B" glyph-name="B" horiz-adv-x="1272" d="M199 1462H598Q726 1462 823 1443T986 1380T1085 1266T1118 1092Q1118 1030 1099 976T1042 881T951 813T827 776V766Q896 754 956 732T1062 670T1133 570T1159 424Q1159 324 1127 246T1033 113T883 29T684
+0H199V1462ZM385 842H629Q713 842 770 857T862 901T912 975T928 1079Q928 1199 851 1251T608 1303H385V842ZM385 686V158H651Q739 158 798 178T894 234T947 320T963 432Q963 488 947 535T893 615T793 667T639 686H385Z" />
+<glyph unicode="C" glyph-name="C" horiz-adv-x="1235" d="M793 1319Q686 1319 599 1279T451 1162T356 977T322 731Q322 590 351 481T440 296T587 182T793 143Q882 143 962 160T1120 201V39Q1081 24 1042 13T961 -6T870 -16T762 -20Q598 -20 478 34T280 187T163
+425T125 733Q125 899 168 1037T296 1274T506 1428T793 1483Q901 1483 999 1461T1176 1397L1098 1241Q1035 1273 961 1296T793 1319Z" />
+<glyph unicode="D" glyph-name="D" horiz-adv-x="1401" d="M1276 745Q1276 560 1228 421T1089 188T866 47T565 0H199V1462H606Q759 1462 883 1416T1094 1280T1228 1055T1276 745ZM1079 739Q1079 885 1046 991T950 1167T795 1269T586 1303H385V160H547Q811 160
+945 306T1079 739Z" />
+<glyph unicode="E" glyph-name="E" horiz-adv-x="1081" d="M958 0H199V1462H958V1298H385V846H920V684H385V164H958V0Z" />
+<glyph unicode="F" glyph-name="F" horiz-adv-x="1006" d="M385 0H199V1462H958V1298H385V782H920V618H385V0Z" />
+<glyph unicode="G" glyph-name="G" horiz-adv-x="1413" d="M782 772H1266V55Q1211 37 1155 23T1040 0T916 -15T776 -20Q619 -20 498 32T294 182T168 419T125 733Q125 905 172 1044T311 1280T535 1430T840 1483Q951 1483 1053 1461T1243 1397L1171 1235Q1135 1252
+1094 1267T1008 1293T918 1312T825 1319Q703 1319 609 1279T452 1162T355 977T322 731Q322 601 349 493T437 307T592 186T821 143Q865 143 901 145T969 152T1027 161T1081 172V608H782V772Z" />
+<glyph unicode="H" glyph-name="H" horiz-adv-x="1436" d="M1237 0H1051V682H385V0H199V1462H385V846H1051V1462H1237V0Z" />
+<glyph unicode="I" glyph-name="I" horiz-adv-x="694" d="M612 0H82V102L254 143V1319L82 1360V1462H612V1360L440 1319V143L612 102V0Z" />
+<glyph unicode="J" glyph-name="J" horiz-adv-x="555" d="M-29 -389Q-80 -389 -118 -383T-184 -365V-205Q-150 -214 -111 -219T-27 -225Q10 -225 47 -216T115 -181T165 -112T184 0V1462H371V20Q371 -85 342 -162T260 -289T134 -364T-29 -389Z" />
+<glyph unicode="K" glyph-name="K" horiz-adv-x="1186" d="M1186 0H975L524 698L385 584V0H199V1462H385V731L506 899L958 1462H1167L647 825L1186 0Z" />
+<glyph unicode="L" glyph-name="L" horiz-adv-x="1006" d="M199 0V1462H385V166H958V0H199Z" />
+<glyph unicode="M" glyph-name="M" horiz-adv-x="1782" d="M803 0L360 1280H352Q358 1206 362 1133Q366 1070 368 1001T371 874V0H199V1462H475L887 270H893L1307 1462H1583V0H1397V887Q1397 939 1399 1006T1404 1134Q1408 1205 1411 1278H1403L956 0H803Z" />
+<glyph unicode="N" glyph-name="N" horiz-adv-x="1493" d="M1294 0H1079L360 1210H352Q358 1133 362 1057Q366 992 368 921T371 793V0H199V1462H412L1128 258H1135Q1132 334 1128 408Q1127 440 1126 473T1123 540T1121 605T1120 662V1462H1294V0Z" />
+<glyph unicode="O" glyph-name="O" horiz-adv-x="1520" d="M1393 733Q1393 564 1353 425T1232 187T1034 34T760 -20Q597 -20 478 34T280 187T163 425T125 735Q125 905 163 1043T280 1280T479 1431T762 1485Q917 1485 1034 1432T1232 1280T1352 1043T1393 733ZM322
+733Q322 596 348 487T427 301T563 184T760 143Q874 143 956 183T1092 300T1171 486T1196 733Q1196 871 1171 980T1093 1164T958 1280T762 1321Q648 1321 565 1281T428 1165T348 980T322 733Z" />
+<glyph unicode="P" glyph-name="P" horiz-adv-x="1180" d="M1075 1034Q1075 943 1048 859T957 711T791 608T535 569H385V0H199V1462H561Q695 1462 792 1434T952 1351T1045 1216T1075 1034ZM385 727H514Q607 727 676 743T791 794T860 886T883 1024Q883 1166 801
+1234T545 1303H385V727Z" />
+<glyph unicode="Q" glyph-name="Q" horiz-adv-x="1518" d="M1393 733Q1393 602 1369 489T1297 286T1178 129T1014 25Q1057 -69 1125 -140T1284 -272L1163 -414Q1060 -341 974 -242T836 -16Q819 -18 799 -19T760 -20Q597 -20 478 34T280 187T163 425T125 735Q125
+905 163 1043T280 1280T479 1431T762 1485Q917 1485 1034 1432T1232 1280T1352 1043T1393 733ZM322 733Q322 596 348 487T427 301T563 184T760 143Q874 143 956 183T1092 300T1171 486T1196 733Q1196 871 1171 980T1093 1164T958 1280T762 1321Q648 1321 565 1281T428
+1165T348 980T322 733Z" />
+<glyph unicode="R" glyph-name="R" horiz-adv-x="1208" d="M385 604V0H199V1462H555Q821 1462 948 1359T1075 1047Q1075 960 1051 895T986 784T893 706T786 655L1184 0H965L614 604H385ZM385 762H549Q639 762 702 779T805 831T864 917T883 1038Q883 1110 863 1160T801
+1242T696 1288T545 1303H385V762Z" />
+<glyph unicode="S" glyph-name="S" horiz-adv-x="1063" d="M969 391Q969 294 935 218T836 88T680 8T473 -20Q362 -20 266 -3T104 49V227Q138 211 181 196T273 168T372 149T473 141Q633 141 709 201T786 373Q786 427 772 467T721 540T623 605T469 674Q380 709 315
+750T207 844T144 962T123 1112Q123 1200 155 1269T245 1385T383 1458T561 1483Q680 1483 775 1461T944 1403L877 1247Q812 1276 730 1297T559 1319Q437 1319 370 1263T303 1110Q303 1053 318 1012T368 937T460 874T602 811Q693 775 761 737T876 651T945 540T969
+391Z" />
+<glyph unicode="T" glyph-name="T" horiz-adv-x="1063" d="M625 0H438V1298H20V1462H1042V1298H625V0Z" />
+<glyph unicode="U" glyph-name="U" horiz-adv-x="1430" d="M1245 1464V516Q1245 402 1212 304T1113 134T946 21T709 -20Q581 -20 483 18T319 128T218 298T184 520V1462H371V510Q371 335 457 239T719 143Q808 143 872 170T977 246T1038 363T1059 512V1464H1245Z" />
+<glyph unicode="V" glyph-name="V" horiz-adv-x="1163" d="M965 1462H1163L674 0H487L0 1462H197L492 535Q521 444 542 360T580 201Q595 275 618 359T672 541L965 1462Z" />
+<glyph unicode="W" glyph-name="W" horiz-adv-x="1810" d="M809 1462H1006L1235 606Q1250 550 1264 494T1291 386T1313 286T1329 201Q1333 239 1339 284T1353 378T1370 479T1391 580L1591 1462H1790L1423 0H1235L981 938Q967 989 954 1043T930 1144Q918 1199 907
+1251Q896 1200 885 1145Q875 1098 863 1042T836 932L594 0H406L20 1462H217L440 573Q452 527 462 478T480 379T496 285T508 201Q513 238 520 287T538 390T559 499T584 604L809 1462Z" />
+<glyph unicode="X" glyph-name="X" horiz-adv-x="1120" d="M1120 0H909L555 635L188 0H0L453 764L31 1462H229L561 903L895 1462H1085L664 770L1120 0Z" />
+<glyph unicode="Y" glyph-name="Y" horiz-adv-x="1079" d="M539 723L879 1462H1079L633 569V0H446V559L0 1462H203L539 723Z" />
+<glyph unicode="Z" glyph-name="Z" horiz-adv-x="1104" d="M1022 0H82V145L793 1296H102V1462H1001V1317L291 166H1022V0Z" />
+<glyph unicode="[" glyph-name="bracketleft" horiz-adv-x="621" d="M569 -324H164V1462H569V1313H346V-174H569V-324Z" />
+<glyph unicode="\" glyph-name="backslash" horiz-adv-x="764" d="M201 1462L745 0H567L23 1462H201Z" />
+<glyph unicode="]" glyph-name="bracketright" horiz-adv-x="621" d="M51 -174H274V1313H51V1462H457V-324H51V-174Z" />
+<glyph unicode="^" glyph-name="asciicircum" horiz-adv-x="1090" d="M41 549L500 1473H602L1049 549H888L551 1284L202 549H41Z" />
+<glyph unicode="_" glyph-name="underscore" horiz-adv-x="842" d="M846 -324H-4V-184H846V-324Z" />
+<glyph unicode="`" glyph-name="grave" horiz-adv-x="1182" d="M786 1241H666Q631 1269 590 1310T511 1396T441 1480T393 1548V1569H612Q628 1535 649 1495T694 1414T741 1335T786 1268V1241Z" />
+<glyph unicode="a" glyph-name="a" horiz-adv-x="1087" d="M793 0L756 152H748Q715 107 682 75T610 21T523 -10T412 -20Q343 -20 285 -1T185 59T118 161T94 307Q94 471 209 559T561 655L745 662V731Q745 798 731 843T689 915T621 955T528 967Q445 967 374 943T236
+885L172 1022Q246 1062 337 1090T528 1118Q630 1118 704 1098T827 1033T900 919T924 752V0H793ZM459 127Q520 127 572 146T662 203T721 300T743 438V537L600 530Q510 526 449 510T352 466T299 397T283 305Q283 213 331 170T459 127Z" />
+<glyph unicode="b" glyph-name="b" horiz-adv-x="1200" d="M670 1118Q764 1118 841 1082T972 975T1057 797T1087 551Q1087 410 1057 304T973 125T841 17T670 -20Q611 -20 563 -7T477 27T409 78T356 139H344L307 0H174V1556H356V1180Q356 1145 355 1106T352 1032Q350
+992 348 954H356Q379 989 408 1019T475 1071T562 1105T670 1118ZM635 967Q555 967 502 942T416 864T370 734T356 551Q356 450 369 372T415 240T502 159T637 131Q772 131 835 240T899 553Q899 761 836 864T635 967Z" />
+<glyph unicode="c" glyph-name="c" horiz-adv-x="948" d="M594 -20Q493 -20 405 11T252 111T150 286T113 543Q113 700 151 809T255 987T411 1087T602 1118Q680 1118 754 1101T879 1059L825 905Q802 915 774 924T716 941T657 953T602 958Q445 958 373 858T301 545Q301
+334 373 237T594 139Q675 139 740 157T860 201V39Q806 10 745 -5T594 -20Z" />
+<glyph unicode="d" glyph-name="d" horiz-adv-x="1200" d="M852 147H844Q822 113 793 83T725 29T638 -7T530 -20Q437 -20 360 16T228 123T143 301T113 547Q113 688 143 794T228 973T360 1081T530 1118Q589 1118 637 1105T723 1070T792 1019T844 958H856Q853 992
+850 1023Q848 1049 846 1076T844 1120V1556H1026V0H879L852 147ZM565 131Q641 131 693 154T778 224T826 341T844 506V547Q844 648 831 726T785 858T698 939T563 967Q428 967 365 858T301 545Q301 336 364 234T565 131Z" />
+<glyph unicode="e" glyph-name="e" horiz-adv-x="1096" d="M608 -20Q498 -20 407 17T251 125T149 301T113 541Q113 677 146 784T239 965T382 1079T567 1118Q666 1118 745 1083T879 983T963 828T993 627V514H301Q306 321 382 230T610 139Q661 139 704 144T788 158T867
+182T944 215V53Q904 34 866 20T787 -3T703 -16T608 -20ZM563 967Q449 967 383 889T305 662H797Q797 730 784 786T742 883T669 945T563 967Z" />
+<glyph unicode="f" glyph-name="f" horiz-adv-x="674" d="M651 961H406V0H223V961H29V1036L223 1104V1200Q223 1307 245 1377T310 1490T415 1549T555 1567Q614 1567 663 1556T752 1530L705 1389Q674 1400 638 1408T561 1417Q521 1417 492 1408T444 1374T416 1309T406
+1202V1098H651V961Z" />
+<glyph unicode="g" glyph-name="g" horiz-adv-x="1061" d="M1020 1098V985L823 958Q851 923 870 869T889 745Q889 669 866 605T795 493T677 420T514 393Q492 393 470 393T434 397Q417 387 401 375T371 346T349 310T340 266Q340 239 352 223T384 197T433 185T492
+182H668Q761 182 825 159T929 95T988 1T1006 -115Q1006 -203 974 -273T874 -391T705 -466T463 -492Q356 -492 276 -471T143 -410T64 -314T37 -186Q37 -126 56 -81T109 -2T185 52T276 84Q234 103 207 144T180 238Q180 299 212 343T313 430Q270 448 235 479T175 551T137
+640T123 739Q123 828 148 898T222 1017T344 1092T514 1118Q551 1118 590 1113T657 1098H1020ZM209 -180Q209 -217 222 -249T264 -304T342 -340T463 -354Q649 -354 741 -297T834 -131Q834 -85 822 -56T783 -11T710 12T600 18H424Q389 18 351 10T282 -20T230 -80T209
+-180ZM301 745Q301 630 355 574T508 518Q608 518 659 573T711 748Q711 871 659 929T506 987Q407 987 354 927T301 745Z" />
+<glyph unicode="h" glyph-name="h" horiz-adv-x="1206" d="M860 0V707Q860 837 808 902T643 967Q562 967 507 941T419 864T371 739T356 569V0H174V1556H356V1094L348 950H358Q383 993 417 1024T493 1077T580 1108T674 1118Q857 1118 949 1023T1042 717V0H860Z" />
+<glyph unicode="i" glyph-name="i" horiz-adv-x="530" d="M356 0H174V1098H356V0ZM160 1395Q160 1455 190 1482T266 1509Q288 1509 307 1503T341 1482T364 1447T373 1395Q373 1337 342 1309T266 1280Q221 1280 191 1308T160 1395Z" />
+<glyph unicode="j" glyph-name="j" horiz-adv-x="530" d="M66 -492Q18 -492 -13 -485T-68 -467V-319Q-42 -329 -15 -334T47 -340Q74 -340 97 -333T137 -306T164 -254T174 -170V1098H356V-158Q356 -235 339 -296T286 -401T196 -468T66 -492ZM160 1395Q160 1455
+190 1482T266 1509Q288 1509 307 1503T341 1482T364 1447T373 1395Q373 1337 342 1309T266 1280Q221 1280 191 1308T160 1395Z" />
+<glyph unicode="k" glyph-name="k" horiz-adv-x="1016" d="M342 567L477 737L770 1098H981L580 623L1008 0H799L463 504L354 422V0H174V1556H354V842L338 567H342Z" />
+<glyph unicode="l" glyph-name="l" horiz-adv-x="530" d="M356 0H174V1556H356V0Z" />
+<glyph unicode="m" glyph-name="m" horiz-adv-x="1835" d="M1489 0V707Q1489 837 1439 902T1284 967Q1211 967 1160 944T1077 875T1029 762T1014 606V0H831V707Q831 837 782 902T627 967Q550 967 498 941T415 864T370 739T356 569V0H174V1098H322L348 950H358Q382
+993 415 1024T487 1077T571 1108T662 1118Q782 1118 861 1074T979 936H987Q1013 983 1049 1017T1129 1073T1221 1107T1319 1118Q1494 1118 1582 1023T1671 717V0H1489Z" />
+<glyph unicode="n" glyph-name="n" horiz-adv-x="1206" d="M860 0V707Q860 837 808 902T643 967Q562 967 507 941T419 864T371 739T356 569V0H174V1098H322L348 950H358Q383 993 417 1024T493 1077T580 1108T674 1118Q857 1118 949 1023T1042 717V0H860Z" />
+<glyph unicode="o" glyph-name="o" horiz-adv-x="1182" d="M1069 551Q1069 414 1036 308T940 129T788 18T588 -20Q485 -20 398 18T248 128T149 307T113 551Q113 687 146 792T242 970T393 1080T594 1118Q697 1118 784 1081T934 971T1033 793T1069 551ZM301 551Q301
+342 369 237T592 131Q746 131 813 236T881 551Q881 760 813 863T590 967Q436 967 369 864T301 551Z" />
+<glyph unicode="p" glyph-name="p" horiz-adv-x="1200" d="M670 -20Q611 -20 563 -7T477 27T409 78T356 139H344Q347 105 350 74Q352 48 354 21T356 -23V-492H174V1098H322L348 950H356Q379 985 408 1015T475 1068T562 1104T670 1118Q764 1118 841 1082T972 975T1057
+797T1087 551Q1087 410 1057 304T973 125T841 17T670 -20ZM635 967Q559 967 507 944T422 874T374 757T356 592V551Q356 450 369 372T415 240T502 159T637 131Q772 131 835 240T899 553Q899 761 836 864T635 967Z" />
+<glyph unicode="q" glyph-name="q" horiz-adv-x="1200" d="M565 131Q641 131 693 154T778 224T826 341T844 506V547Q844 648 831 726T785 858T698 939T563 967Q428 967 365 858T301 545Q301 336 364 234T565 131ZM530 -20Q437 -20 360 16T228 123T143 301T113
+547Q113 688 143 794T228 973T360 1081T530 1118Q589 1118 637 1105T723 1069T791 1016T844 950H852L879 1098H1026V-492H844V-23Q844 -4 846 25T850 81Q853 113 856 147H844Q822 113 793 83T725 29T638 -7T530 -20Z" />
+<glyph unicode="r" glyph-name="r" horiz-adv-x="817" d="M649 1118Q678 1118 714 1116T776 1108L752 940Q724 945 695 948T639 952Q576 952 524 927T435 854T377 740T356 592V0H174V1098H322L344 897H352Q377 940 405 980T469 1050T549 1099T649 1118Z" />
+<glyph unicode="s" glyph-name="s" horiz-adv-x="924" d="M831 301Q831 221 802 161T719 61T587 0T414 -20Q305 -20 227 -3T90 49V215Q121 199 159 184T239 156T325 137T414 129Q479 129 524 140T598 171T640 221T653 287Q653 318 643 343T607 392T534 442T416
+498Q344 529 287 559T189 626T128 711T106 827Q106 897 133 951T211 1043T331 1099T487 1118Q584 1118 664 1097T817 1042L754 895Q689 924 621 945T481 967Q379 967 330 934T281 838Q281 803 292 777T332 728T407 682T524 629Q596 599 652 569T749 502T810 416T831
+301Z" />
+<glyph unicode="t" glyph-name="t" horiz-adv-x="694" d="M506 129Q524 129 546 131T590 136T628 143T655 150V12Q642 6 622 0T578 -10T528 -17T477 -20Q415 -20 362 -4T271 51T210 156T188 324V961H33V1042L188 1120L266 1350H371V1098H647V961H371V324Q371 227
+402 178T506 129Z" />
+<glyph unicode="u" glyph-name="u" horiz-adv-x="1206" d="M885 0L858 147H848Q823 104 789 73T713 21T626 -10T532 -20Q441 -20 372 3T257 75T188 200T164 381V1098H346V391Q346 261 399 196T563 131Q644 131 699 157T787 233T835 358T850 528V1098H1032V0H885Z" />
+<glyph unicode="v" glyph-name="v" horiz-adv-x="981" d="M375 0L0 1098H188L387 487Q398 454 413 402T443 296T470 194T487 121H494Q499 146 511 194T538 296T568 402T594 487L793 1098H981L606 0H375Z" />
+<glyph unicode="w" glyph-name="w" horiz-adv-x="1528" d="M1008 0L840 616Q836 634 830 656T818 704T806 755T793 806Q779 864 764 926H758Q744 863 731 805Q720 755 708 702T684 612L512 0H301L20 1098H211L342 514Q352 469 362 417T381 313T397 216T408 141H414Q419
+167 427 210T446 302T468 398T489 479L668 1098H864L1036 479Q1045 445 1056 399T1079 306T1099 214T1112 141H1118Q1121 167 1127 210T1143 306T1162 412T1184 514L1321 1098H1507L1223 0H1008Z" />
+<glyph unicode="x" glyph-name="x" horiz-adv-x="1024" d="M408 563L55 1098H262L512 688L762 1098H969L614 563L987 0H780L512 436L242 0H35L408 563Z" />
+<glyph unicode="y" glyph-name="y" horiz-adv-x="1001" d="M10 1098H199L414 485Q428 445 442 401T469 313T491 228T504 152H510Q515 177 526 220T550 311T578 407T604 487L803 1098H991L557 -143Q529 -224 497 -288T421 -398T320 -467T182 -492Q130 -492 92 -487T27
+-475V-330Q48 -335 80 -338T147 -342Q195 -342 230 -331T291 -297T335 -243T369 -170L426 -10L10 1098Z" />
+<glyph unicode="z" glyph-name="z" horiz-adv-x="903" d="M821 0H82V125L618 961H115V1098H803V952L279 137H821V0Z" />
+<glyph unicode="{" glyph-name="braceleft" horiz-adv-x="725" d="M500 -16Q500 -64 512 -94T546 -142T601 -166T674 -174V-324Q597 -323 532 -307T419 -255T344 -164T317 -31V303Q317 406 252 449T61 492V647Q186 647 251 690T317 836V1169Q317 1247 344 1302T418
+1392T531 1444T674 1462V1313Q634 1312 602 1306T547 1282T512 1234T500 1155V823Q500 718 441 657T266 575V563Q381 543 440 482T500 315V-16Z" />
+<glyph unicode="|" glyph-name="bar" horiz-adv-x="1128" d="M489 1556H639V-492H489V1556Z" />
+<glyph unicode="}" glyph-name="braceright" horiz-adv-x="725" d="M225 315Q225 421 284 482T459 563V575Q344 595 285 656T225 823V1155Q225 1203 213 1233T179 1281T124 1305T51 1313V1462Q128 1461 193 1445T306 1393T381 1302T408 1169V836Q408 784 424 748T473
+690T554 657T664 647V492Q539 492 474 449T408 303V-31Q408 -109 381 -164T307 -254T194 -306T51 -324V-174Q91 -173 123 -167T178 -143T213 -95T225 -16V315Z" />
+<glyph unicode="~" glyph-name="asciitilde" horiz-adv-x="1128" d="M530 651Q493 667 466 678T416 695T373 704T330 707Q302 707 272 698T213 672T155 633T102 586V748Q202 856 350 856Q379 856 404 854T456 845T517 826T598 793Q635 777 662 766T713 749T757
+740T799 737Q827 737 857 746T916 772T974 811T1026 858V696Q927 588 778 588Q749 588 724 590T672 599T611 618T530 651Z" />
+<glyph unicode="&#xa0;" glyph-name="nbspace" horiz-adv-x="532" />
+<glyph unicode="&#xa1;" glyph-name="exclamdown" horiz-adv-x="551" d="M213 676H334L385 -373H162L213 676ZM401 979Q401 941 392 915T365 872T324 848T274 840Q248 840 225 847T185 871T157 914T147 979Q147 1016 157 1042T184 1085T225 1110T274 1118Q301
+1118 324 1110T364 1085T391 1042T401 979Z" />
+<glyph unicode="&#xa2;" glyph-name="cent" horiz-adv-x="1128" d="M886 212T831 197T700 180V-20H563V186Q476 199 407 236T289 340T214 506T188 743Q188 884 214 985T289 1155T407 1260T563 1311V1483H700V1319Q772 1316 840 1300T954 1260L901 1106Q878 1116
+850 1125T792 1142T733 1154T678 1159Q521 1159 449 1058T377 745Q377 535 449 438T670 340Q751 340 816 358T936 401V240Q886 212 831 197Z" />
+<glyph unicode="&#xa3;" glyph-name="sterling" horiz-adv-x="1128" d="M666 1481Q772 1481 859 1459T1012 1401L946 1257Q890 1286 820 1307T674 1329Q626 1329 585 1316T514 1273T468 1196T451 1083V788H827V651H451V440Q451 378 440 334T409 257T364 204T311
+166H1059V0H68V154Q112 165 148 185T211 240T253 322T268 438V651H70V788H268V1112Q268 1199 297 1267T379 1383T505 1456T666 1481Z" />
+<glyph unicode="&#xa4;" glyph-name="currency" horiz-adv-x="1128" d="M186 723Q186 782 203 835T252 936L123 1065L221 1163L348 1034Q395 1066 449 1084T563 1102Q623 1102 676 1084T776 1034L905 1163L1004 1067L874 938Q905 892 923 838T942 723Q942 663
+925 608T874 508L1001 381L905 285L776 412Q730 381 677 364T563 346Q503 346 448 364T348 414L221 287L125 383L252 510Q221 555 204 609T186 723ZM324 723Q324 673 342 630T393 554T469 502T563 483Q614 483 658 502T736 553T788 629T807 723Q807 774 788 818T736
+896T659 948T563 967Q513 967 470 948T394 896T343 819T324 723Z" />
+<glyph unicode="&#xa5;" glyph-name="yen" horiz-adv-x="1128" d="M563 723L909 1462H1100L715 694H954V557H653V399H954V262H653V0H475V262H174V399H475V557H174V694H408L29 1462H221L563 723Z" />
+<glyph unicode="&#xa6;" glyph-name="brokenbar" horiz-adv-x="1128" d="M489 1556H639V776H489V1556ZM489 289H639V-492H489V289Z" />
+<glyph unicode="&#xa7;" glyph-name="section" horiz-adv-x="995" d="M137 809Q137 860 150 901T185 975T237 1029T297 1067Q222 1105 180 1162T137 1303Q137 1364 164 1413T242 1496T362 1548T518 1567Q615 1567 693 1547T844 1495L788 1356Q723 1384 653 1403T512
+1423Q413 1423 362 1394T311 1307Q311 1280 323 1257T363 1212T439 1167T557 1114Q629 1086 685 1054T781 982T841 895T862 784Q862 732 850 690T818 613T771 555T717 514Q786 476 824 422T862 289Q862 218 833 163T749 69T618 10T444 -10Q336 -10 258 6T121 55V213Q152
+198 190 183T270 157T356 138T444 131Q513 131 559 143T633 174T672 219T684 272Q684 301 676 323T642 368T569 415T446 471Q373 502 316 533T218 603T158 692T137 809ZM291 831Q291 794 305 763T350 702T432 646T555 588L590 573Q610 586 630 604T667 645T694
+696T705 758Q705 796 692 828T647 889T560 947T424 1006Q399 998 376 983T333 945T303 893T291 831Z" />
+<glyph unicode="&#xa8;" glyph-name="dieresis" horiz-adv-x="1182" d="M307 1395Q307 1449 335 1473T403 1497Q442 1497 471 1473T500 1395Q500 1342 471 1317T403 1292Q363 1292 335 1317T307 1395ZM682 1395Q682 1449 710 1473T778 1497Q797 1497 814 1491T845
+1473T866 1441T874 1395Q874 1342 845 1317T778 1292Q738 1292 710 1317T682 1395Z" />
+<glyph unicode="&#xa9;" glyph-name="copyright" horiz-adv-x="1704" d="M891 1053Q830 1053 783 1031T704 968T656 866T639 731Q639 653 653 593T698 492T776 430T891 408Q914 408 941 411T996 421T1053 435T1106 453V322Q1082 311 1058 302T1007 286T950 276T885
+272Q783 272 707 305T581 399T505 545T479 733Q479 834 506 917T585 1061T714 1154T891 1188Q954 1188 1020 1172T1145 1126L1083 999Q1031 1025 983 1039T891 1053ZM100 731Q100 835 127 931T202 1110T320 1263T472 1380T652 1456T852 1483Q956 1483 1052 1456T1231
+1381T1384 1263T1501 1111T1577 931T1604 731Q1604 627 1577 531T1502 352T1384 200T1232 82T1052 7T852 -20Q748 -20 652 6T473 82T320 199T203 351T127 531T100 731ZM209 731Q209 598 259 481T397 277T602 139T852 88Q985 88 1102 138T1306 276T1444 481T1495
+731Q1495 864 1445 981T1307 1185T1102 1323T852 1374Q719 1374 602 1324T398 1186T260 981T209 731Z" />
+<glyph unicode="&#xaa;" glyph-name="ordfeminine" horiz-adv-x="678" d="M487 797L459 879Q441 857 422 840T379 810T327 791T264 784Q221 784 185 797T123 835T83 899T68 989Q68 1091 138 1145T352 1204L451 1208V1239Q451 1311 421 1339T334 1368Q286 1368
+241 1354T154 1317L106 1417Q157 1443 215 1461T334 1479Q459 1479 518 1426T578 1251V797H487ZM377 1110Q326 1107 292 1098T238 1074T208 1038T199 987Q199 936 224 914T291 891Q325 891 354 901T404 934T438 988T451 1065V1114L377 1110Z" />
+<glyph unicode="&#xab;" glyph-name="guillemotleft" horiz-adv-x="997" d="M82 553L391 967L508 889L270 541L508 193L391 115L82 526V553ZM489 553L799 967L915 889L678 541L915 193L799 115L489 526V553Z" />
+<glyph unicode="&#xac;" glyph-name="logicalnot" horiz-adv-x="1128" d="M1026 797V262H877V647H102V797H1026Z" />
+<glyph unicode="&#xad;" glyph-name="uni00AD" horiz-adv-x="659" d="M82 465V633H578V465H82Z" />
+<glyph unicode="&#xae;" glyph-name="registered" horiz-adv-x="1704" d="M743 768H815Q906 768 945 804T985 909Q985 983 944 1012T813 1042H743V768ZM1145 913Q1145 865 1132 828T1096 762T1045 713T985 680Q1052 570 1105 483Q1128 446 1149 411T1186 347T1213
+302L1223 285H1044L838 637H743V285H586V1178H819Q987 1178 1066 1113T1145 913ZM100 731Q100 835 127 931T202 1110T320 1263T472 1380T652 1456T852 1483Q956 1483 1052 1456T1231 1381T1384 1263T1501 1111T1577 931T1604 731Q1604 627 1577 531T1502 352T1384
+200T1232 82T1052 7T852 -20Q748 -20 652 6T473 82T320 199T203 351T127 531T100 731ZM209 731Q209 598 259 481T397 277T602 139T852 88Q985 88 1102 138T1306 276T1444 481T1495 731Q1495 864 1445 981T1307 1185T1102 1323T852 1374Q719 1374 602 1324T398 1186T260
+981T209 731Z" />
+<glyph unicode="&#xaf;" glyph-name="overscore" horiz-adv-x="1024" d="M1030 1556H-6V1696H1030V1556Z" />
+<glyph unicode="&#xb0;" glyph-name="degree" horiz-adv-x="877" d="M123 1167Q123 1232 148 1289T215 1390T315 1458T438 1483Q503 1483 560 1458T661 1390T729 1290T754 1167Q754 1102 729 1045T661 946T561 879T438 854Q373 854 316 878T216 945T148 1045T123
+1167ZM246 1167Q246 1128 261 1094T302 1033T363 992T438 977Q478 977 513 992T574 1033T616 1093T631 1167Q631 1207 616 1242T575 1304T513 1346T438 1362Q398 1362 363 1347T302 1305T261 1243T246 1167Z" />
+<glyph unicode="&#xb1;" glyph-name="plusminus" horiz-adv-x="1128" d="M489 647H102V797H489V1186H639V797H1026V647H639V262H489V647ZM102 0V150H1026V0H102Z" />
+<glyph unicode="&#xb2;" glyph-name="twosuperior" horiz-adv-x="678" d="M621 586H49V698L258 926Q315 988 351 1030T407 1106T434 1169T442 1233Q442 1298 409 1330T322 1362Q271 1362 225 1337T133 1274L55 1368Q109 1416 175 1448T324 1481Q384 1481 432 1465T515
+1417T567 1340T586 1237Q586 1187 572 1144T530 1059T464 971T373 870L225 713H621V586Z" />
+<glyph unicode="&#xb3;" glyph-name="threesuperior" horiz-adv-x="678" d="M590 1255Q590 1177 550 1124T440 1047Q528 1024 572 971T616 840Q616 780 596 730T535 645T430 589T281 569Q211 569 150 581T31 625V758Q94 724 160 705T279 686Q377 686 421 727T465
+842Q465 916 412 949T262 983H164V1096H262Q354 1096 396 1135T438 1239Q438 1271 428 1294T401 1333T360 1355T309 1362Q250 1362 202 1342T102 1284L33 1380Q62 1403 92 1421T157 1453T229 1473T311 1481Q380 1481 432 1464T520 1417T572 1346T590 1255Z" />
+<glyph unicode="&#xb4;" glyph-name="acute" horiz-adv-x="1182" d="M393 1268Q415 1297 438 1335T485 1413T530 1494T567 1569H786V1548Q770 1521 739 1481T669 1396T590 1311T514 1241H393V1268Z" />
+<glyph unicode="&#xb5;" glyph-name="mu" horiz-adv-x="1217" d="M356 391Q356 261 409 196T573 131Q655 131 710 157T798 233T846 358T860 528V1098H1042V0H895L868 147H858Q810 64 738 22T563 -20Q491 -20 438 3T350 68Q351 30 353 -10Q355 -45 355 -87T356
+-172V-492H174V1098H356V391Z" />
+<glyph unicode="&#xb6;" glyph-name="paragraph" horiz-adv-x="1341" d="M1126 -260H1006V1397H799V-260H678V559Q617 541 532 541Q437 541 360 566T228 651T143 806T113 1042Q113 1189 145 1287T237 1446T380 1531T563 1556H1126V-260Z" />
+<glyph unicode="&#xb7;" glyph-name="middot" horiz-adv-x="549" d="M147 723Q147 761 157 787T184 830T224 854T274 862Q300 862 323 855T364 831T391 788T401 723Q401 686 391 660T364 617T324 592T274 584Q247 584 224 592T184 617T157 660T147 723Z" />
+<glyph unicode="&#xb8;" glyph-name="cedilla" horiz-adv-x="420" d="M408 -287Q408 -384 338 -438T117 -492Q95 -492 73 -489T35 -483V-375Q50 -378 74 -379T115 -381Q186 -381 226 -360T266 -289Q266 -265 253 -248T217 -217T163 -195T94 -176L184 0H305L248
+-115Q282 -123 311 -136T361 -169T395 -219T408 -287Z" />
+<glyph unicode="&#xb9;" glyph-name="onesuperior" horiz-adv-x="678" d="M307 1462H442V586H297V1102Q297 1127 297 1157T299 1217T302 1275T305 1325Q291 1308 272 1288T231 1251L137 1178L63 1274L307 1462Z" />
+<glyph unicode="&#xba;" glyph-name="ordmasculine" horiz-adv-x="717" d="M651 1133Q651 1050 631 985T572 876T479 808T356 784Q293 784 240 807T148 875T88 985T66 1133Q66 1216 86 1280T145 1389T237 1456T360 1479Q422 1479 475 1456T568 1389T629 1281T651
+1133ZM197 1133Q197 1014 234 954T358 893Q443 893 480 953T518 1133Q518 1253 481 1310T358 1368Q272 1368 235 1311T197 1133Z" />
+<glyph unicode="&#xbb;" glyph-name="guillemotright" horiz-adv-x="997" d="M918 526L608 115L492 193L729 541L492 889L608 967L918 553V526ZM510 526L201 115L84 193L322 541L84 889L201 967L510 553V526Z" />
+<glyph unicode="&#xbc;" glyph-name="onequarter" horiz-adv-x="1509" d="M307 1462H442V586H297V1102Q297 1127 297 1157T299 1217T302 1275T305 1325Q291 1308 272 1288T231 1251L137 1178L63 1274L307 1462ZM1202 1462L391 0H234L1045 1462H1202ZM1419 193H1294V1H1151V193H776V304L1153
+883H1294V320H1419V193ZM1151 320V515Q1151 557 1152 606T1157 705Q1152 694 1142 676T1121 636T1098 595T1077 560L922 320H1151Z" />
+<glyph unicode="&#xbd;" glyph-name="onehalf" horiz-adv-x="1509" d="M544 1462H679V586H534V1102Q534 1127 534 1157T536 1217T539 1275T542 1325Q528 1308 509 1288T468 1251L374 1178L300 1274L544 1462ZM1181 1462L370 0H213L1024 1462H1181ZM1440 1H868V113L1077
+341Q1134 403 1170 445T1226 521T1253 584T1261 648Q1261 713 1228 745T1141 777Q1090 777 1044 752T952 689L874 783Q928 831 994 863T1143 896Q1203 896 1251 880T1334 832T1386 755T1405 652Q1405 602 1391 559T1349 474T1283 386T1192 285L1044 128H1440V1Z"
+/>
+<glyph unicode="&#xbe;" glyph-name="threequarters" horiz-adv-x="1509" d="M590 1255Q590 1177 550 1124T440 1047Q528 1024 572 971T616 840Q616 780 596 730T535 645T430 589T281 569Q211 569 150 581T31 625V758Q94 724 160 705T279 686Q377 686 421 727T465
+842Q465 916 412 949T262 983H164V1096H262Q354 1096 396 1135T438 1239Q438 1271 428 1294T401 1333T360 1355T309 1362Q250 1362 202 1342T102 1284L33 1380Q62 1403 92 1421T157 1453T229 1473T311 1481Q380 1481 432 1464T520 1417T572 1346T590 1255ZM1296
+1462L485 0H328L1139 1462H1296ZM1486 193H1361V1H1218V193H843V304L1220 883H1361V320H1486V193ZM1218 320V515Q1218 557 1219 606T1224 705Q1219 694 1209 676T1188 636T1165 595T1144 560L989 320H1218Z" />
+<glyph unicode="&#xbf;" glyph-name="questiondown" horiz-adv-x="872" d="M592 676V639Q592 581 584 536T557 450T505 371T422 291Q374 250 340 217T285 149T253 75T242 -18Q242 -66 257 -105T300 -173T371 -217T469 -233Q553 -233 628 -208T772 -147L836 -293Q754
+-335 660 -364T469 -393Q376 -393 302 -368T176 -294T96 -177T68 -20Q68 48 81 100T121 197T188 284T283 373Q335 418 368 451T420 516T446 580T453 657V676H592ZM639 979Q639 941 630 915T603 872T562 848T512 840Q486 840 463 847T423 871T395 914T385 979Q385
+1016 395 1042T422 1085T463 1110T512 1118Q539 1118 562 1110T602 1085T629 1042T639 979Z" />
+<glyph unicode="&#xc0;" glyph-name="Agrave" horiz-adv-x="1245" d="M1055 0L895 453H350L188 0H0L537 1468H707L1245 0H1055ZM836 618L688 1042Q682 1060 674 1086T656 1142T638 1204T621 1268Q614 1237 605 1204T587 1141T570 1085T555 1042L410 618H836ZM719
+1579H599Q564 1607 523 1648T444 1734T374 1818T326 1886V1907H545Q561 1873 582 1833T627 1752T674 1673T719 1606V1579Z" />
+<glyph unicode="&#xc1;" glyph-name="Aacute" horiz-adv-x="1245" d="M1055 0L895 453H350L188 0H0L537 1468H707L1245 0H1055ZM836 618L688 1042Q682 1060 674 1086T656 1142T638 1204T621 1268Q614 1237 605 1204T587 1141T570 1085T555 1042L410 618H836ZM534
+1606Q556 1635 579 1673T626 1751T671 1832T708 1907H927V1886Q911 1859 880 1819T810 1734T731 1649T655 1579H534V1606Z" />
+<glyph unicode="&#xc2;" glyph-name="Acircumflex" horiz-adv-x="1245" d="M1055 0L895 453H350L188 0H0L537 1468H707L1245 0H1055ZM836 618L688 1042Q682 1060 674 1086T656 1142T638 1204T621 1268Q614 1237 605 1204T587 1141T570 1085T555 1042L410 618H836ZM953
+1579H832Q781 1613 727 1661T621 1765Q567 1710 514 1662T410 1579H289V1606Q315 1635 349 1673T416 1751T479 1832T525 1907H717Q733 1873 762 1833T825 1752T893 1673T953 1606V1579Z" />
+<glyph unicode="&#xc3;" glyph-name="Atilde" horiz-adv-x="1245" d="M1055 0L895 453H350L188 0H0L537 1468H707L1245 0H1055ZM836 618L688 1042Q682 1060 674 1086T656 1142T638 1204T621 1268Q614 1237 605 1204T587 1141T570 1085T555 1042L410 618H836ZM772
+1581Q732 1581 693 1598T615 1637T542 1676T475 1694Q430 1694 406 1668T368 1579H264Q269 1639 285 1688T328 1771T392 1824T475 1843Q517 1843 557 1826T636 1787T708 1749T772 1731Q817 1731 840 1757T878 1845H983Q978 1785 962 1737T919 1654T855 1600T772
+1581Z" />
+<glyph unicode="&#xc4;" glyph-name="Adieresis" horiz-adv-x="1245" d="M1055 0L895 453H350L188 0H0L537 1468H707L1245 0H1055ZM836 618L688 1042Q682 1060 674 1086T656 1142T638 1204T621 1268Q614 1237 605 1204T587 1141T570 1085T555 1042L410 618H836ZM340
+1733Q340 1787 368 1811T436 1835Q475 1835 504 1811T533 1733Q533 1680 504 1655T436 1630Q396 1630 368 1655T340 1733ZM715 1733Q715 1787 743 1811T811 1835Q830 1835 847 1829T878 1811T899 1779T907 1733Q907 1680 878 1655T811 1630Q771 1630 743 1655T715
+1733Z" />
+<glyph unicode="&#xc5;" glyph-name="Aring" horiz-adv-x="1245" d="M1055 0L895 453H350L188 0H0L537 1468H707L1245 0H1055ZM836 618L688 1042Q682 1060 674 1086T656 1142T638 1204T621 1268Q614 1237 605 1204T587 1141T570 1085T555 1042L410 618H836ZM848
+1583Q848 1532 831 1492T783 1423T710 1381T619 1366Q569 1366 528 1380T458 1423T412 1490T396 1581Q396 1632 412 1671T457 1739T528 1781T619 1796Q667 1796 709 1782T782 1740T830 1673T848 1583ZM731 1581Q731 1634 700 1664T619 1694Q569 1694 538 1664T506
+1581Q506 1528 534 1498T619 1468Q668 1468 699 1498T731 1581Z" />
+<glyph unicode="&#xc6;" glyph-name="AE" horiz-adv-x="1745" d="M1622 0H862V453H387L184 0H-2L653 1462H1622V1298H1049V846H1583V684H1049V164H1622V0ZM459 618H862V1298H754L459 618Z" />
+<glyph unicode="&#xc7;" glyph-name="Ccedilla" horiz-adv-x="1235" d="M793 1319Q686 1319 599 1279T451 1162T356 977T322 731Q322 590 351 481T440 296T587 182T793 143Q882 143 962 160T1120 201V39Q1081 24 1042 13T961 -6T870 -16T762 -20Q598 -20 478 34T280
+187T163 425T125 733Q125 899 168 1037T296 1274T506 1428T793 1483Q901 1483 999 1461T1176 1397L1098 1241Q1035 1273 961 1296T793 1319ZM916 -287Q916 -384 846 -438T625 -492Q603 -492 581 -489T543 -483V-375Q558 -378 582 -379T623 -381Q694 -381 734 -360T774
+-289Q774 -265 761 -248T725 -217T671 -195T602 -176L692 0H813L756 -115Q790 -123 819 -136T869 -169T903 -219T916 -287Z" />
+<glyph unicode="&#xc8;" glyph-name="Egrave" horiz-adv-x="1081" d="M958 0H199V1462H958V1298H385V846H920V684H385V164H958V0ZM713 1579H593Q558 1607 517 1648T438 1734T368 1818T320 1886V1907H539Q555 1873 576 1833T621 1752T668 1673T713 1606V1579Z" />
+<glyph unicode="&#xc9;" glyph-name="Eacute" horiz-adv-x="1081" d="M958 0H199V1462H958V1298H385V846H920V684H385V164H958V0ZM456 1606Q478 1635 501 1673T548 1751T593 1832T630 1907H849V1886Q833 1859 802 1819T732 1734T653 1649T577 1579H456V1606Z" />
+<glyph unicode="&#xca;" glyph-name="Ecircumflex" horiz-adv-x="1081" d="M958 0H199V1462H958V1298H385V846H920V684H385V164H958V0ZM907 1579H786Q735 1613 681 1661T575 1765Q521 1710 468 1662T364 1579H243V1606Q269 1635 303 1673T370 1751T433 1832T479
+1907H671Q687 1873 716 1833T779 1752T847 1673T907 1606V1579Z" />
+<glyph unicode="&#xcb;" glyph-name="Edieresis" horiz-adv-x="1081" d="M958 0H199V1462H958V1298H385V846H920V684H385V164H958V0ZM296 1733Q296 1787 324 1811T392 1835Q431 1835 460 1811T489 1733Q489 1680 460 1655T392 1630Q352 1630 324 1655T296 1733ZM671
+1733Q671 1787 699 1811T767 1835Q786 1835 803 1829T834 1811T855 1779T863 1733Q863 1680 834 1655T767 1630Q727 1630 699 1655T671 1733Z" />
+<glyph unicode="&#xcc;" glyph-name="Igrave" horiz-adv-x="694" d="M612 0H82V102L254 143V1319L82 1360V1462H612V1360L440 1319V143L612 102V0ZM455 1579H335Q300 1607 259 1648T180 1734T110 1818T62 1886V1907H281Q297 1873 318 1833T363 1752T410 1673T455
+1606V1579Z" />
+<glyph unicode="&#xcd;" glyph-name="Iacute" horiz-adv-x="694" d="M612 0H82V102L254 143V1319L82 1360V1462H612V1360L440 1319V143L612 102V0ZM257 1606Q279 1635 302 1673T349 1751T394 1832T431 1907H650V1886Q634 1859 603 1819T533 1734T454 1649T378
+1579H257V1606Z" />
+<glyph unicode="&#xce;" glyph-name="Icircumflex" horiz-adv-x="694" d="M612 0H82V102L254 143V1319L82 1360V1462H612V1360L440 1319V143L612 102V0ZM681 1579H560Q509 1613 455 1661T349 1765Q295 1710 242 1662T138 1579H17V1606Q43 1635 77 1673T144 1751T207
+1832T253 1907H445Q461 1873 490 1833T553 1752T621 1673T681 1606V1579Z" />
+<glyph unicode="&#xcf;" glyph-name="Idieresis" horiz-adv-x="694" d="M612 0H82V102L254 143V1319L82 1360V1462H612V1360L440 1319V143L612 102V0ZM64 1733Q64 1787 92 1811T160 1835Q199 1835 228 1811T257 1733Q257 1680 228 1655T160 1630Q120 1630 92 1655T64
+1733ZM439 1733Q439 1787 467 1811T535 1835Q554 1835 571 1829T602 1811T623 1779T631 1733Q631 1680 602 1655T535 1630Q495 1630 467 1655T439 1733Z" />
+<glyph unicode="&#xd0;" glyph-name="Eth" horiz-adv-x="1401" d="M47 805H199V1462H606Q759 1462 883 1416T1094 1280T1228 1055T1276 745Q1276 560 1228 421T1089 188T866 47T565 0H199V643H47V805ZM1079 739Q1079 885 1046 991T950 1167T795 1269T586 1303H385V805H721V643H385V160H547Q811
+160 945 306T1079 739Z" />
+<glyph unicode="&#xd1;" glyph-name="Ntilde" horiz-adv-x="1493" d="M1294 0H1079L360 1210H352Q358 1133 362 1057Q366 992 368 921T371 793V0H199V1462H412L1128 258H1135Q1132 334 1128 408Q1127 440 1126 473T1123 540T1121 605T1120 662V1462H1294V0ZM905
+1581Q865 1581 826 1598T748 1637T675 1676T608 1694Q563 1694 539 1668T501 1579H397Q402 1639 418 1688T461 1771T525 1824T608 1843Q650 1843 690 1826T769 1787T841 1749T905 1731Q950 1731 973 1757T1011 1845H1116Q1111 1785 1095 1737T1052 1654T988 1600T905
+1581Z" />
+<glyph unicode="&#xd2;" glyph-name="Ograve" horiz-adv-x="1520" d="M1393 733Q1393 564 1353 425T1232 187T1034 34T760 -20Q597 -20 478 34T280 187T163 425T125 735Q125 905 163 1043T280 1280T479 1431T762 1485Q917 1485 1034 1432T1232 1280T1352 1043T1393
+733ZM322 733Q322 596 348 487T427 301T563 184T760 143Q874 143 956 183T1092 300T1171 486T1196 733Q1196 871 1171 980T1093 1164T958 1280T762 1321Q648 1321 565 1281T428 1165T348 980T322 733ZM870 1579H750Q715 1607 674 1648T595 1734T525 1818T477 1886V1907H696Q712
+1873 733 1833T778 1752T825 1673T870 1606V1579Z" />
+<glyph unicode="&#xd3;" glyph-name="Oacute" horiz-adv-x="1520" d="M1393 733Q1393 564 1353 425T1232 187T1034 34T760 -20Q597 -20 478 34T280 187T163 425T125 735Q125 905 163 1043T280 1280T479 1431T762 1485Q917 1485 1034 1432T1232 1280T1352 1043T1393
+733ZM322 733Q322 596 348 487T427 301T563 184T760 143Q874 143 956 183T1092 300T1171 486T1196 733Q1196 871 1171 980T1093 1164T958 1280T762 1321Q648 1321 565 1281T428 1165T348 980T322 733ZM651 1606Q673 1635 696 1673T743 1751T788 1832T825 1907H1044V1886Q1028
+1859 997 1819T927 1734T848 1649T772 1579H651V1606Z" />
+<glyph unicode="&#xd4;" glyph-name="Ocircumflex" horiz-adv-x="1520" d="M1393 733Q1393 564 1353 425T1232 187T1034 34T760 -20Q597 -20 478 34T280 187T163 425T125 735Q125 905 163 1043T280 1280T479 1431T762 1485Q917 1485 1034 1432T1232 1280T1352
+1043T1393 733ZM322 733Q322 596 348 487T427 301T563 184T760 143Q874 143 956 183T1092 300T1171 486T1196 733Q1196 871 1171 980T1093 1164T958 1280T762 1321Q648 1321 565 1281T428 1165T348 980T322 733ZM1096 1579H975Q924 1613 870 1661T764 1765Q710
+1710 657 1662T553 1579H432V1606Q458 1635 492 1673T559 1751T622 1832T668 1907H860Q876 1873 905 1833T968 1752T1036 1673T1096 1606V1579Z" />
+<glyph unicode="&#xd5;" glyph-name="Otilde" horiz-adv-x="1520" d="M1393 733Q1393 564 1353 425T1232 187T1034 34T760 -20Q597 -20 478 34T280 187T163 425T125 735Q125 905 163 1043T280 1280T479 1431T762 1485Q917 1485 1034 1432T1232 1280T1352 1043T1393
+733ZM322 733Q322 596 348 487T427 301T563 184T760 143Q874 143 956 183T1092 300T1171 486T1196 733Q1196 871 1171 980T1093 1164T958 1280T762 1321Q648 1321 565 1281T428 1165T348 980T322 733ZM891 1581Q851 1581 812 1598T734 1637T661 1676T594 1694Q549
+1694 525 1668T487 1579H383Q388 1639 404 1688T447 1771T511 1824T594 1843Q636 1843 676 1826T755 1787T827 1749T891 1731Q936 1731 959 1757T997 1845H1102Q1097 1785 1081 1737T1038 1654T974 1600T891 1581Z" />
+<glyph unicode="&#xd6;" glyph-name="Odieresis" horiz-adv-x="1520" d="M1393 733Q1393 564 1353 425T1232 187T1034 34T760 -20Q597 -20 478 34T280 187T163 425T125 735Q125 905 163 1043T280 1280T479 1431T762 1485Q917 1485 1034 1432T1232 1280T1352 1043T1393
+733ZM322 733Q322 596 348 487T427 301T563 184T760 143Q874 143 956 183T1092 300T1171 486T1196 733Q1196 871 1171 980T1093 1164T958 1280T762 1321Q648 1321 565 1281T428 1165T348 980T322 733ZM477 1733Q477 1787 505 1811T573 1835Q612 1835 641 1811T670
+1733Q670 1680 641 1655T573 1630Q533 1630 505 1655T477 1733ZM852 1733Q852 1787 880 1811T948 1835Q967 1835 984 1829T1015 1811T1036 1779T1044 1733Q1044 1680 1015 1655T948 1630Q908 1630 880 1655T852 1733Z" />
+<glyph unicode="&#xd7;" glyph-name="multiply" horiz-adv-x="1128" d="M459 723L141 1042L246 1147L563 829L885 1147L989 1044L668 723L987 403L885 301L563 618L246 303L143 406L459 723Z" />
+<glyph unicode="&#xd8;" glyph-name="Oslash" horiz-adv-x="1520" d="M1300 1454L1208 1305Q1299 1206 1346 1061T1393 733Q1393 564 1353 425T1232 187T1034 34T760 -20Q571 -20 438 51L360 -76L223 2L313 147Q216 247 171 396T125 735Q125 905 163 1043T280
+1280T479 1431T762 1485Q856 1485 936 1464T1083 1405L1163 1532L1300 1454ZM322 733Q322 602 345 498T416 315L995 1260Q947 1289 890 1305T762 1321Q648 1321 565 1281T428 1165T348 980T322 733ZM1196 733Q1196 990 1108 1141L530 201Q577 173 634 158T760 143Q874
+143 956 183T1092 300T1171 486T1196 733Z" />
+<glyph unicode="&#xd9;" glyph-name="Ugrave" horiz-adv-x="1430" d="M1245 1464V516Q1245 402 1212 304T1113 134T946 21T709 -20Q581 -20 483 18T319 128T218 298T184 520V1462H371V510Q371 335 457 239T719 143Q808 143 872 170T977 246T1038 363T1059 512V1464H1245ZM847
+1579H727Q692 1607 651 1648T572 1734T502 1818T454 1886V1907H673Q689 1873 710 1833T755 1752T802 1673T847 1606V1579Z" />
+<glyph unicode="&#xda;" glyph-name="Uacute" horiz-adv-x="1430" d="M1245 1464V516Q1245 402 1212 304T1113 134T946 21T709 -20Q581 -20 483 18T319 128T218 298T184 520V1462H371V510Q371 335 457 239T719 143Q808 143 872 170T977 246T1038 363T1059 512V1464H1245ZM590
+1606Q612 1635 635 1673T682 1751T727 1832T764 1907H983V1886Q967 1859 936 1819T866 1734T787 1649T711 1579H590V1606Z" />
+<glyph unicode="&#xdb;" glyph-name="Ucircumflex" horiz-adv-x="1430" d="M1245 1464V516Q1245 402 1212 304T1113 134T946 21T709 -20Q581 -20 483 18T319 128T218 298T184 520V1462H371V510Q371 335 457 239T719 143Q808 143 872 170T977 246T1038 363T1059
+512V1464H1245ZM1043 1579H922Q871 1613 817 1661T711 1765Q657 1710 604 1662T500 1579H379V1606Q405 1635 439 1673T506 1751T569 1832T615 1907H807Q823 1873 852 1833T915 1752T983 1673T1043 1606V1579Z" />
+<glyph unicode="&#xdc;" glyph-name="Udieresis" horiz-adv-x="1430" d="M1245 1464V516Q1245 402 1212 304T1113 134T946 21T709 -20Q581 -20 483 18T319 128T218 298T184 520V1462H371V510Q371 335 457 239T719 143Q808 143 872 170T977 246T1038 363T1059 512V1464H1245ZM432
+1733Q432 1787 460 1811T528 1835Q567 1835 596 1811T625 1733Q625 1680 596 1655T528 1630Q488 1630 460 1655T432 1733ZM807 1733Q807 1787 835 1811T903 1835Q922 1835 939 1829T970 1811T991 1779T999 1733Q999 1680 970 1655T903 1630Q863 1630 835 1655T807
+1733Z" />
+<glyph unicode="&#xdd;" glyph-name="Yacute" horiz-adv-x="1079" d="M539 723L879 1462H1079L633 569V0H446V559L0 1462H203L539 723ZM442 1606Q464 1635 487 1673T534 1751T579 1832T616 1907H835V1886Q819 1859 788 1819T718 1734T639 1649T563 1579H442V1606Z" />
+<glyph unicode="&#xde;" glyph-name="Thorn" horiz-adv-x="1180" d="M1075 782Q1075 691 1048 607T957 459T791 356T535 317H385V0H199V1462H385V1210H561Q695 1210 792 1182T952 1099T1045 964T1075 782ZM385 475H514Q607 475 676 491T791 542T860 634T883 772Q883
+915 801 983T545 1051H385V475Z" />
+<glyph unicode="&#xdf;" glyph-name="germandbls" horiz-adv-x="1233" d="M1010 1260Q1010 1203 989 1159T936 1078T867 1011T798 954T745 899T723 842Q723 821 730 805T756 769T811 725T903 662Q959 625 1003 589T1077 512T1124 423T1141 313Q1141 226 1113 163T1035
+60T914 0T758 -20Q661 -20 592 -3T469 49V215Q495 199 527 184T596 156T670 137T745 129Q801 129 841 141T908 176T946 231T958 303Q958 339 950 368T920 426T862 483T770 547Q707 587 665 621T596 688T558 757T547 834Q547 888 567 927T619 998T686 1057T753 1113T804
+1175T825 1253Q825 1295 809 1326T762 1377T691 1407T598 1417Q549 1417 505 1408T428 1374T376 1309T356 1202V0H174V1200Q174 1304 205 1374T293 1487T428 1548T598 1567Q690 1567 766 1548T896 1491T980 1395T1010 1260Z" />
+<glyph unicode="&#xe0;" glyph-name="agrave" horiz-adv-x="1087" d="M793 0L756 152H748Q715 107 682 75T610 21T523 -10T412 -20Q343 -20 285 -1T185 59T118 161T94 307Q94 471 209 559T561 655L745 662V731Q745 798 731 843T689 915T621 955T528 967Q445 967
+374 943T236 885L172 1022Q246 1062 337 1090T528 1118Q630 1118 704 1098T827 1033T900 919T924 752V0H793ZM459 127Q520 127 572 146T662 203T721 300T743 438V537L600 530Q510 526 449 510T352 466T299 397T283 305Q283 213 331 170T459 127ZM934 1241H814Q779
+1269 738 1310T659 1396T589 1480T541 1548V1569H760Q776 1535 797 1495T842 1414T889 1335T934 1268V1241Z" />
+<glyph unicode="&#xe1;" glyph-name="aacute" horiz-adv-x="1087" d="M793 0L756 152H748Q715 107 682 75T610 21T523 -10T412 -20Q343 -20 285 -1T185 59T118 161T94 307Q94 471 209 559T561 655L745 662V731Q745 798 731 843T689 915T621 955T528 967Q445 967
+374 943T236 885L172 1022Q246 1062 337 1090T528 1118Q630 1118 704 1098T827 1033T900 919T924 752V0H793ZM459 127Q520 127 572 146T662 203T721 300T743 438V537L600 530Q510 526 449 510T352 466T299 397T283 305Q283 213 331 170T459 127ZM446 1268Q468 1297
+491 1335T538 1413T583 1494T620 1569H839V1548Q823 1521 792 1481T722 1396T643 1311T567 1241H446V1268Z" />
+<glyph unicode="&#xe2;" glyph-name="acircumflex" horiz-adv-x="1087" d="M793 0L756 152H748Q715 107 682 75T610 21T523 -10T412 -20Q343 -20 285 -1T185 59T118 161T94 307Q94 471 209 559T561 655L745 662V731Q745 798 731 843T689 915T621 955T528 967Q445
+967 374 943T236 885L172 1022Q246 1062 337 1090T528 1118Q630 1118 704 1098T827 1033T900 919T924 752V0H793ZM459 127Q520 127 572 146T662 203T721 300T743 438V537L600 530Q510 526 449 510T352 466T299 397T283 305Q283 213 331 170T459 127ZM1148 1241H1027Q976
+1275 922 1323T816 1427Q762 1372 709 1324T605 1241H484V1268Q510 1297 544 1335T611 1413T674 1494T720 1569H912Q928 1535 957 1495T1020 1414T1088 1335T1148 1268V1241Z" />
+<glyph unicode="&#xe3;" glyph-name="atilde" horiz-adv-x="1087" d="M793 0L756 152H748Q715 107 682 75T610 21T523 -10T412 -20Q343 -20 285 -1T185 59T118 161T94 307Q94 471 209 559T561 655L745 662V731Q745 798 731 843T689 915T621 955T528 967Q445 967
+374 943T236 885L172 1022Q246 1062 337 1090T528 1118Q630 1118 704 1098T827 1033T900 919T924 752V0H793ZM459 127Q520 127 572 146T662 203T721 300T743 438V537L600 530Q510 526 449 510T352 466T299 397T283 305Q283 213 331 170T459 127ZM955 1243Q915 1243
+876 1260T798 1299T725 1338T658 1356Q613 1356 589 1330T551 1241H447Q452 1301 468 1350T511 1433T575 1486T658 1505Q700 1505 740 1488T819 1449T891 1411T955 1393Q1000 1393 1023 1419T1061 1507H1166Q1161 1447 1145 1399T1102 1316T1038 1262T955 1243Z"
+/>
+<glyph unicode="&#xe4;" glyph-name="adieresis" horiz-adv-x="1087" d="M793 0L756 152H748Q715 107 682 75T610 21T523 -10T412 -20Q343 -20 285 -1T185 59T118 161T94 307Q94 471 209 559T561 655L745 662V731Q745 798 731 843T689 915T621 955T528 967Q445
+967 374 943T236 885L172 1022Q246 1062 337 1090T528 1118Q630 1118 704 1098T827 1033T900 919T924 752V0H793ZM459 127Q520 127 572 146T662 203T721 300T743 438V537L600 530Q510 526 449 510T352 466T299 397T283 305Q283 213 331 170T459 127ZM529 1395Q529
+1449 557 1473T625 1497Q664 1497 693 1473T722 1395Q722 1342 693 1317T625 1292Q585 1292 557 1317T529 1395ZM904 1395Q904 1449 932 1473T1000 1497Q1019 1497 1036 1491T1067 1473T1088 1441T1096 1395Q1096 1342 1067 1317T1000 1292Q960 1292 932 1317T904
+1395Z" />
+<glyph unicode="&#xe5;" glyph-name="aring" horiz-adv-x="1087" d="M793 0L756 152H748Q715 107 682 75T610 21T523 -10T412 -20Q343 -20 285 -1T185 59T118 161T94 307Q94 471 209 559T561 655L745 662V731Q745 798 731 843T689 915T621 955T528 967Q445 967
+374 943T236 885L172 1022Q246 1062 337 1090T528 1118Q630 1118 704 1098T827 1033T900 919T924 752V0H793ZM459 127Q520 127 572 146T662 203T721 300T743 438V537L600 530Q510 526 449 510T352 466T299 397T283 305Q283 213 331 170T459 127ZM1039 1458Q1039
+1407 1022 1367T974 1298T901 1256T810 1241Q760 1241 719 1255T649 1298T603 1365T587 1456Q587 1507 603 1546T648 1614T719 1656T810 1671Q858 1671 900 1657T973 1615T1021 1548T1039 1458ZM922 1456Q922 1509 891 1539T810 1569Q760 1569 729 1539T697 1456Q697
+1403 725 1373T810 1343Q859 1343 890 1373T922 1456Z" />
+<glyph unicode="&#xe6;" glyph-name="ae" horiz-adv-x="1706" d="M94 307Q94 471 209 559T561 655L745 662V731Q745 798 731 843T689 915T621 955T528 967Q445 967 374 943T236 885L172 1022Q246 1062 337 1090T528 1118Q659 1118 742 1076T868 940Q919 1025 1002
+1071T1188 1118Q1285 1118 1362 1083T1493 983T1575 828T1604 627V514H932Q937 321 1010 230T1231 139Q1280 139 1322 144T1404 158T1480 182T1554 215V53Q1515 34 1478 20T1401 -3T1319 -16T1227 -20Q1089 -20 988 37T825 209Q791 155 753 113T668 41T562 -4T430
+-20Q359 -20 298 -1T191 59T120 161T94 307ZM283 305Q283 213 331 170T459 127Q520 127 572 146T662 203T721 300T743 438V537L600 530Q510 526 449 510T352 466T299 397T283 305ZM1184 967Q1074 967 1011 889T936 662H1407Q1407 730 1394 786T1354 883T1284 945T1184
+967Z" />
+<glyph unicode="&#xe7;" glyph-name="ccedilla" horiz-adv-x="948" d="M594 -20Q493 -20 405 11T252 111T150 286T113 543Q113 700 151 809T255 987T411 1087T602 1118Q680 1118 754 1101T879 1059L825 905Q802 915 774 924T716 941T657 953T602 958Q445 958 373
+858T301 545Q301 334 373 237T594 139Q675 139 740 157T860 201V39Q806 10 745 -5T594 -20ZM730 -287Q730 -384 660 -438T439 -492Q417 -492 395 -489T357 -483V-375Q372 -378 396 -379T437 -381Q508 -381 548 -360T588 -289Q588 -265 575 -248T539 -217T485 -195T416
+-176L506 0H627L570 -115Q604 -123 633 -136T683 -169T717 -219T730 -287Z" />
+<glyph unicode="&#xe8;" glyph-name="egrave" horiz-adv-x="1096" d="M608 -20Q498 -20 407 17T251 125T149 301T113 541Q113 677 146 784T239 965T382 1079T567 1118Q666 1118 745 1083T879 983T963 828T993 627V514H301Q306 321 382 230T610 139Q661 139 704
+144T788 158T867 182T944 215V53Q904 34 866 20T787 -3T703 -16T608 -20ZM563 967Q449 967 383 889T305 662H797Q797 730 784 786T742 883T669 945T563 967ZM934 1241H814Q779 1269 738 1310T659 1396T589 1480T541 1548V1569H760Q776 1535 797 1495T842 1414T889
+1335T934 1268V1241Z" />
+<glyph unicode="&#xe9;" glyph-name="eacute" horiz-adv-x="1096" d="M608 -20Q498 -20 407 17T251 125T149 301T113 541Q113 677 146 784T239 965T382 1079T567 1118Q666 1118 745 1083T879 983T963 828T993 627V514H301Q306 321 382 230T610 139Q661 139 704
+144T788 158T867 182T944 215V53Q904 34 866 20T787 -3T703 -16T608 -20ZM563 967Q449 967 383 889T305 662H797Q797 730 784 786T742 883T669 945T563 967ZM475 1268Q497 1297 520 1335T567 1413T612 1494T649 1569H868V1548Q852 1521 821 1481T751 1396T672 1311T596
+1241H475V1268Z" />
+<glyph unicode="&#xea;" glyph-name="ecircumflex" horiz-adv-x="1096" d="M608 -20Q498 -20 407 17T251 125T149 301T113 541Q113 677 146 784T239 965T382 1079T567 1118Q666 1118 745 1083T879 983T963 828T993 627V514H301Q306 321 382 230T610 139Q661 139
+704 144T788 158T867 182T944 215V53Q904 34 866 20T787 -3T703 -16T608 -20ZM563 967Q449 967 383 889T305 662H797Q797 730 784 786T742 883T669 945T563 967ZM1144 1241H1023Q972 1275 918 1323T812 1427Q758 1372 705 1324T601 1241H480V1268Q506 1297 540
+1335T607 1413T670 1494T716 1569H908Q924 1535 953 1495T1016 1414T1084 1335T1144 1268V1241Z" />
+<glyph unicode="&#xeb;" glyph-name="edieresis" horiz-adv-x="1096" d="M608 -20Q498 -20 407 17T251 125T149 301T113 541Q113 677 146 784T239 965T382 1079T567 1118Q666 1118 745 1083T879 983T963 828T993 627V514H301Q306 321 382 230T610 139Q661 139
+704 144T788 158T867 182T944 215V53Q904 34 866 20T787 -3T703 -16T608 -20ZM563 967Q449 967 383 889T305 662H797Q797 730 784 786T742 883T669 945T563 967ZM525 1395Q525 1449 553 1473T621 1497Q660 1497 689 1473T718 1395Q718 1342 689 1317T621 1292Q581
+1292 553 1317T525 1395ZM900 1395Q900 1449 928 1473T996 1497Q1015 1497 1032 1491T1063 1473T1084 1441T1092 1395Q1092 1342 1063 1317T996 1292Q956 1292 928 1317T900 1395Z" />
+<glyph unicode="&#xec;" glyph-name="igrave" horiz-adv-x="530" d="M356 0H174V1098H356V0ZM359 1241H239Q204 1269 163 1310T84 1396T14 1480T-34 1548V1569H185Q201 1535 222 1495T267 1414T314 1335T359 1268V1241Z" />
+<glyph unicode="&#xed;" glyph-name="iacute" horiz-adv-x="530" d="M356 0H174V1098H356V0ZM185 1268Q207 1297 230 1335T277 1413T322 1494T359 1569H578V1548Q562 1521 531 1481T461 1396T382 1311T306 1241H185V1268Z" />
+<glyph unicode="&#xee;" glyph-name="icircumflex" horiz-adv-x="530" d="M356 0H174V1098H356V0ZM597 1241H476Q425 1275 371 1323T265 1427Q211 1372 158 1324T54 1241H-67V1268Q-41 1297 -7 1335T60 1413T123 1494T169 1569H361Q377 1535 406 1495T469 1414T537
+1335T597 1268V1241Z" />
+<glyph unicode="&#xef;" glyph-name="idieresis" horiz-adv-x="530" d="M356 0H174V1098H356V0ZM-18 1395Q-18 1449 10 1473T78 1497Q117 1497 146 1473T175 1395Q175 1342 146 1317T78 1292Q38 1292 10 1317T-18 1395ZM357 1395Q357 1449 385 1473T453 1497Q472
+1497 489 1491T520 1473T541 1441T549 1395Q549 1342 520 1317T453 1292Q413 1292 385 1317T357 1395Z" />
+<glyph unicode="&#xf0;" glyph-name="eth" horiz-adv-x="1182" d="M1069 573Q1069 431 1036 321T940 135T788 20T588 -20Q484 -20 397 13T246 109T147 265T111 477Q111 596 142 688T233 843T376 938T565 971Q667 971 744 942T864 852L872 856Q841 974 781 1070T631
+1247L375 1094L301 1208L518 1339Q478 1367 436 1394T346 1448L416 1571Q481 1539 542 1503T662 1423L889 1561L963 1448L768 1331Q835 1266 890 1188T985 1017T1047 813T1069 573ZM881 526Q881 582 864 635T812 730T722 796T592 821Q515 821 461 798T371 731T320
+622T303 471Q303 395 319 333T371 225T461 156T592 131Q746 131 813 230T881 526Z" />
+<glyph unicode="&#xf1;" glyph-name="ntilde" horiz-adv-x="1206" d="M860 0V707Q860 837 808 902T643 967Q562 967 507 941T419 864T371 739T356 569V0H174V1098H322L348 950H358Q383 993 417 1024T493 1077T580 1108T674 1118Q857 1118 949 1023T1042 717V0H860ZM1015
+1243Q975 1243 936 1260T858 1299T785 1338T718 1356Q673 1356 649 1330T611 1241H507Q512 1301 528 1350T571 1433T635 1486T718 1505Q760 1505 800 1488T879 1449T951 1411T1015 1393Q1060 1393 1083 1419T1121 1507H1226Q1221 1447 1205 1399T1162 1316T1098
+1262T1015 1243Z" />
+<glyph unicode="&#xf2;" glyph-name="ograve" horiz-adv-x="1182" d="M1069 551Q1069 414 1036 308T940 129T788 18T588 -20Q485 -20 398 18T248 128T149 307T113 551Q113 687 146 792T242 970T393 1080T594 1118Q697 1118 784 1081T934 971T1033 793T1069 551ZM301
+551Q301 342 369 237T592 131Q746 131 813 236T881 551Q881 760 813 863T590 967Q436 967 369 864T301 551ZM1002 1241H882Q847 1269 806 1310T727 1396T657 1480T609 1548V1569H828Q844 1535 865 1495T910 1414T957 1335T1002 1268V1241Z" />
+<glyph unicode="&#xf3;" glyph-name="oacute" horiz-adv-x="1182" d="M1069 551Q1069 414 1036 308T940 129T788 18T588 -20Q485 -20 398 18T248 128T149 307T113 551Q113 687 146 792T242 970T393 1080T594 1118Q697 1118 784 1081T934 971T1033 793T1069 551ZM301
+551Q301 342 369 237T592 131Q746 131 813 236T881 551Q881 760 813 863T590 967Q436 967 369 864T301 551ZM473 1268Q495 1297 518 1335T565 1413T610 1494T647 1569H866V1548Q850 1521 819 1481T749 1396T670 1311T594 1241H473V1268Z" />
+<glyph unicode="&#xf4;" glyph-name="ocircumflex" horiz-adv-x="1182" d="M1069 551Q1069 414 1036 308T940 129T788 18T588 -20Q485 -20 398 18T248 128T149 307T113 551Q113 687 146 792T242 970T393 1080T594 1118Q697 1118 784 1081T934 971T1033 793T1069
+551ZM301 551Q301 342 369 237T592 131Q746 131 813 236T881 551Q881 760 813 863T590 967Q436 967 369 864T301 551ZM1173 1241H1052Q1001 1275 947 1323T841 1427Q787 1372 734 1324T630 1241H509V1268Q535 1297 569 1335T636 1413T699 1494T745 1569H937Q953
+1535 982 1495T1045 1414T1113 1335T1173 1268V1241Z" />
+<glyph unicode="&#xf5;" glyph-name="otilde" horiz-adv-x="1182" d="M1069 551Q1069 414 1036 308T940 129T788 18T588 -20Q485 -20 398 18T248 128T149 307T113 551Q113 687 146 792T242 970T393 1080T594 1118Q697 1118 784 1081T934 971T1033 793T1069 551ZM301
+551Q301 342 369 237T592 131Q746 131 813 236T881 551Q881 760 813 863T590 967Q436 967 369 864T301 551ZM992 1243Q952 1243 913 1260T835 1299T762 1338T695 1356Q650 1356 626 1330T588 1241H484Q489 1301 505 1350T548 1433T612 1486T695 1505Q737 1505 777
+1488T856 1449T928 1411T992 1393Q1037 1393 1060 1419T1098 1507H1203Q1198 1447 1182 1399T1139 1316T1075 1262T992 1243Z" />
+<glyph unicode="&#xf6;" glyph-name="odieresis" horiz-adv-x="1182" d="M1069 551Q1069 414 1036 308T940 129T788 18T588 -20Q485 -20 398 18T248 128T149 307T113 551Q113 687 146 792T242 970T393 1080T594 1118Q697 1118 784 1081T934 971T1033 793T1069
+551ZM301 551Q301 342 369 237T592 131Q746 131 813 236T881 551Q881 760 813 863T590 967Q436 967 369 864T301 551ZM556 1395Q556 1449 584 1473T652 1497Q691 1497 720 1473T749 1395Q749 1342 720 1317T652 1292Q612 1292 584 1317T556 1395ZM931 1395Q931
+1449 959 1473T1027 1497Q1046 1497 1063 1491T1094 1473T1115 1441T1123 1395Q1123 1342 1094 1317T1027 1292Q987 1292 959 1317T931 1395Z" />
+<glyph unicode="&#xf7;" glyph-name="divide" horiz-adv-x="1128" d="M102 647V797H1026V647H102ZM449 373Q449 408 458 431T482 470T518 491T563 498Q586 498 607 492T644 470T669 432T678 373Q678 340 669 317T644 278T607 255T563 248Q539 248 519 255T483
+277T458 316T449 373ZM449 1071Q449 1106 458 1129T482 1168T518 1189T563 1196Q586 1196 607 1190T644 1168T669 1130T678 1071Q678 1038 669 1015T644 976T607 953T563 946Q539 946 519 953T483 975T458 1014T449 1071Z" />
+<glyph unicode="&#xf8;" glyph-name="oslash" horiz-adv-x="1182" d="M1071 551Q1071 414 1038 308T942 129T790 18T590 -20Q465 -20 367 33L299 -76L168 -2L248 129Q185 201 150 307T115 551Q115 687 148 792T244 970T395 1080T596 1118Q659 1118 715 1104T821
+1061L889 1169L1020 1096L940 967Q1002 894 1036 790T1071 551ZM303 551Q303 467 312 402T344 285L741 932Q712 949 675 958T592 967Q438 967 371 864T303 551ZM883 551Q883 710 844 809L446 164Q477 147 513 139T594 131Q748 131 815 236T883 551Z" />
+<glyph unicode="&#xf9;" glyph-name="ugrave" horiz-adv-x="1206" d="M885 0L858 147H848Q823 104 789 73T713 21T626 -10T532 -20Q441 -20 372 3T257 75T188 200T164 381V1098H346V391Q346 261 399 196T563 131Q644 131 699 157T787 233T835 358T850 528V1098H1032V0H885ZM949
+1241H829Q794 1269 753 1310T674 1396T604 1480T556 1548V1569H775Q791 1535 812 1495T857 1414T904 1335T949 1268V1241Z" />
+<glyph unicode="&#xfa;" glyph-name="uacute" horiz-adv-x="1206" d="M885 0L858 147H848Q823 104 789 73T713 21T626 -10T532 -20Q441 -20 372 3T257 75T188 200T164 381V1098H346V391Q346 261 399 196T563 131Q644 131 699 157T787 233T835 358T850 528V1098H1032V0H885ZM489
+1268Q511 1297 534 1335T581 1413T626 1494T663 1569H882V1548Q866 1521 835 1481T765 1396T686 1311T610 1241H489V1268Z" />
+<glyph unicode="&#xfb;" glyph-name="ucircumflex" horiz-adv-x="1206" d="M885 0L858 147H848Q823 104 789 73T713 21T626 -10T532 -20Q441 -20 372 3T257 75T188 200T164 381V1098H346V391Q346 261 399 196T563 131Q644 131 699 157T787 233T835 358T850 528V1098H1032V0H885ZM930
+1241H809Q758 1275 704 1323T598 1427Q544 1372 491 1324T387 1241H266V1268Q292 1297 326 1335T393 1413T456 1494T502 1569H694Q710 1535 739 1495T802 1414T870 1335T930 1268V1241Z" />
+<glyph unicode="&#xfc;" glyph-name="udieresis" horiz-adv-x="1206" d="M885 0L858 147H848Q823 104 789 73T713 21T626 -10T532 -20Q441 -20 372 3T257 75T188 200T164 381V1098H346V391Q346 261 399 196T563 131Q644 131 699 157T787 233T835 358T850 528V1098H1032V0H885ZM309
+1395Q309 1449 337 1473T405 1497Q444 1497 473 1473T502 1395Q502 1342 473 1317T405 1292Q365 1292 337 1317T309 1395ZM684 1395Q684 1449 712 1473T780 1497Q799 1497 816 1491T847 1473T868 1441T876 1395Q876 1342 847 1317T780 1292Q740 1292 712 1317T684
+1395Z" />
+<glyph unicode="&#xfd;" glyph-name="yacute" horiz-adv-x="1001" d="M10 1098H199L414 485Q428 445 442 401T469 313T491 228T504 152H510Q515 177 526 220T550 311T578 407T604 487L803 1098H991L557 -143Q529 -224 497 -288T421 -398T320 -467T182 -492Q130
+-492 92 -487T27 -475V-330Q48 -335 80 -338T147 -342Q195 -342 230 -331T291 -297T335 -243T369 -170L426 -10L10 1098ZM407 1268Q429 1297 452 1335T499 1413T544 1494T581 1569H800V1548Q784 1521 753 1481T683 1396T604 1311T528 1241H407V1268Z" />
+<glyph unicode="&#xfe;" glyph-name="thorn" horiz-adv-x="1200" d="M356 950Q379 985 408 1015T475 1068T562 1104T670 1118Q764 1118 841 1082T972 975T1057 797T1087 551Q1087 410 1057 304T973 125T841 17T670 -20Q611 -20 563 -7T477 27T409 78T356 139H344Q347
+105 350 74Q352 48 354 21T356 -23V-492H174V1556H356V1098L348 950H356ZM635 967Q559 967 507 944T422 874T374 757T356 592V551Q356 450 369 372T415 240T502 159T637 131Q772 131 835 240T899 553Q899 761 836 864T635 967Z" />
+<glyph unicode="&#xff;" glyph-name="ydieresis" horiz-adv-x="1001" d="M10 1098H199L414 485Q428 445 442 401T469 313T491 228T504 152H510Q515 177 526 220T550 311T578 407T604 487L803 1098H991L557 -143Q529 -224 497 -288T421 -398T320 -467T182 -492Q130
+-492 92 -487T27 -475V-330Q48 -335 80 -338T147 -342Q195 -342 230 -331T291 -297T335 -243T369 -170L426 -10L10 1098ZM484 1395Q484 1449 512 1473T580 1497Q619 1497 648 1473T677 1395Q677 1342 648 1317T580 1292Q540 1292 512 1317T484 1395ZM859 1395Q859
+1449 887 1473T955 1497Q974 1497 991 1491T1022 1473T1043 1441T1051 1395Q1051 1342 1022 1317T955 1292Q915 1292 887 1317T859 1395Z" />
+<glyph unicode="&#x2013;" glyph-name="endash" horiz-adv-x="1024" d="M82 465V633H942V465H82Z" />
+<glyph unicode="&#x2014;" glyph-name="emdash" horiz-adv-x="2048" d="M82 465V633H1966V465H82Z" />
+<glyph unicode="&#x2018;" glyph-name="quoteleft" horiz-adv-x="358" d="M37 961L23 983Q37 1037 56 1098T99 1221T148 1344T199 1462H336Q321 1401 307 1335T279 1204T255 1076T236 961H37Z" />
+<glyph unicode="&#x2019;" glyph-name="quoteright" horiz-adv-x="358" d="M322 1462L336 1440Q322 1385 303 1325T260 1202T211 1078T160 961H23Q37 1021 51 1087T79 1219T104 1347T123 1462H322Z" />
+<glyph unicode="&#x201a;" glyph-name="quotesinglbase" horiz-adv-x="512" d="M362 238L377 215Q363 161 344 100T301 -23T252 -146T201 -264H63Q78 -203 92 -137T120 -6T145 122T164 238H362Z" />
+<glyph unicode="&#x201c;" glyph-name="quotedblleft" horiz-adv-x="743" d="M422 961L408 983Q422 1037 441 1098T484 1221T533 1344T584 1462H721Q706 1401 692 1335T664 1204T640 1076T621 961H422ZM37 961L23 983Q37 1037 56 1098T99 1221T148 1344T199 1462H336Q321
+1401 307 1335T279 1204T255 1076T236 961H37Z" />
+<glyph unicode="&#x201d;" glyph-name="quotedblright" horiz-adv-x="743" d="M322 1462L336 1440Q322 1385 303 1325T260 1202T211 1078T160 961H23Q37 1021 51 1087T79 1219T104 1347T123 1462H322ZM707 1462L721 1440Q707 1385 688 1325T645 1202T596 1078T545
+961H408Q422 1021 436 1087T464 1219T489 1347T508 1462H707Z" />
+<glyph unicode="&#x201e;" glyph-name="quotedblbase" horiz-adv-x="897" d="M362 238L377 215Q363 161 344 100T301 -23T252 -146T201 -264H63Q78 -203 92 -137T120 -6T145 122T164 238H362ZM748 238L762 215Q748 161 729 100T686 -23T637 -146T586 -264H449Q463
+-203 477 -137T505 -6T530 122T549 238H748Z" />
+<glyph unicode="&#x2022;" glyph-name="bullet" horiz-adv-x="770" d="M150 748Q150 819 168 869T217 950T292 996T385 1010Q434 1010 477 996T552 951T602 869T621 748Q621 678 603 628T552 547T477 500T385 485Q335 485 292 500T218 546T168 628T150 748Z" />
+<glyph unicode="&#x2039;" glyph-name="guilsinglleft" horiz-adv-x="590" d="M82 553L391 967L508 889L270 541L508 193L391 115L82 526V553Z" />
+<glyph unicode="&#x203a;" glyph-name="guilsinglright" horiz-adv-x="590" d="M508 526L199 115L82 193L319 541L82 889L199 967L508 553V526Z" />
+</font>
+</defs>
+</svg>
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
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.ttf
Binary files 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
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.woff
Binary files 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
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/fonts/droid-sans-v6-latin-regular.woff2
Binary files 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
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/explorer_icons.png
Binary files 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
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/logo_small.png
Binary files 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
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/pet_store_api.png
Binary files 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
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/throbber.gif
Binary files 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
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/images/wordnik_api.png
Binary files 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 @@
+<!--
+
+ 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.
+
+-->
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Swagger UI</title>
+ <link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
+ <link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
+ <link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
+ <link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/>
+ <link href='css/screen.css' media='print' rel='stylesheet' type='text/css'/>
+ <script type="text/javascript" src="lib/shred.bundle.js"></script>
+ <script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
+ <script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
+ <script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
+ <script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
+ <script src='lib/handlebars-2.0.0.js' type='text/javascript'></script>
+ <script src='lib/underscore-min.js' type='text/javascript'></script>
+ <script src='lib/backbone-min.js' type='text/javascript'></script>
+ <script src='lib/swagger-client.js' type='text/javascript'></script>
+ <script src='swagger-ui.js' type='text/javascript'></script>
+ <script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
+ <script src='lib/marked.js' type='text/javascript'></script>
+
+ <!-- enabling this will enable oauth2 implicit scope support -->
+ <script src='lib/swagger-oauth.js' type='text/javascript'></script>
+ <script type="text/javascript">
+ $(function () {
+ var url = window.location.search.match(/url=([^&]+)/);
+ if (url && url.length > 1) {
+ url = decodeURIComponent(url[1]);
+ } else {
+ url = "/openoapi/wso2bpel/v1/swagger.json";
+ }
+ window.swaggerUi = new SwaggerUi({
+ url: url,
+ dom_id: "swagger-ui-container",
+ supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
+ onComplete: function(swaggerApi, swaggerUi){
+ if(typeof initOAuth == "function") {
+ /*
+ initOAuth({
+ clientId: "your-client-id",
+ realm: "your-realms",
+ appName: "your-app-name"
+ });
+ */
+ }
+ $('pre code').each(function(i, e) {
+ hljs.highlightBlock(e)
+ });
+ },
+ onFailure: function(data) {
+ log("Unable to Load SwaggerUI");
+ },
+ docExpansion: "none",
+ sorter : "alpha"
+ });
+
+ function addApiKeyAuthorization() {
+ var key = $('#input_apiKey')[0].value;
+ log("key: " + key);
+ if(key && key.trim() != "") {
+ log("added key " + key);
+ window.authorizations.add("api_key", new ApiKeyAuthorization("api_key", key, "query"));
+ }
+ }
+
+ $('#input_apiKey').change(function() {
+ addApiKeyAuthorization();
+ });
+
+ // if you have an apiKey you would like to pre-populate on the page for demonstration purposes...
+ /*
+ var apiKey = "myApiKeyXXXX123456789";
+ $('#input_apiKey').val(apiKey);
+ addApiKeyAuthorization();
+ */
+
+ window.swaggerUi.load();
+ });
+ </script>
+</head>
+
+<body class="swagger-section">
+<div id='header'>
+ <div class="swagger-ui-wrap">
+ <a id="logo" >OPEN-O wso2bpel-ext</a>
+ <form id='api_selector'>
+ <div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
+ <div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div>
+ <div class='input'><a id="explore" href="#">Explore</a></div>
+ </form>
+ </div>
+</div>
+
+<div id="message-bar" class="swagger-ui-wrap">&nbsp;</div>
+<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
+</body>
+</html>
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<u;h++){t=o[h];if(a=this._events[t]){this._events[t]=s=[];if(e||r){for(l=0,f=a.length;l<f;l++){n=a[l];if(e&&e!==n.callback&&e!==n.callback._callback||r&&r!==n.context){s.push(n)}}}if(!s.length)delete this._events[t]}}return this},trigger:function(t){if(!this._events)return this;var e=o.call(arguments,1);if(!c(this,"trigger",t,e))return this;var i=this._events[t];var r=this._events.all;if(i)f(i,e);if(r)f(r,arguments);return this},stopListening:function(t,e,r){var s=this._listeningTo;if(!s)return this;var n=!e&&!r;if(!r&&typeof e==="object")r=this;if(t)(s={})[t._listenId]=t;for(var a in s){t=s[a];t.off(e,r,this);if(n||i.isEmpty(t._events))delete this._listeningTo[a]}return this}};var l=/\s+/;var c=function(t,e,i,r){if(!i)return true;if(typeof i==="object"){for(var s in i){t[e].apply(t,[s,i[s]].concat(r))}return false}if(l.test(i)){var n=i.split(l);for(var a=0,o=n.length;a<o;a++){t[e].apply(t,[n[a]].concat(r))}return false}return true};var f=function(t,e){var i,r=-1,s=t.length,n=e[0],a=e[1],o=e[2];switch(e.length){case 0:while(++r<s)(i=t[r]).callback.call(i.ctx);return;case 1:while(++r<s)(i=t[r]).callback.call(i.ctx,n);return;case 2:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a);return;case 3:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a,o);return;default:while(++r<s)(i=t[r]).callback.apply(i.ctx,e);return}};var d={listenTo:"on",listenToOnce:"once"};i.each(d,function(t,e){u[e]=function(e,r,s){var n=this._listeningTo||(this._listeningTo={});var a=e._listenId||(e._listenId=i.uniqueId("l"));n[a]=e;if(!s&&typeof r==="object")s=this;e[t](r,s,this);return this}});u.bind=u.on;u.unbind=u.off;i.extend(e,u);var p=e.Model=function(t,e){var r=t||{};e||(e={});this.cid=i.uniqueId("c");this.attributes={};if(e.collection)this.collection=e.collection;if(e.parse)r=this.parse(r,e)||{};r=i.defaults({},r,i.result(this,"defaults"));this.set(r,e);this.changed={};this.initialize.apply(this,arguments)};i.extend(p.prototype,u,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(t){return i.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return i.escape(this.get(t))},has:function(t){return this.get(t)!=null},set:function(t,e,r){var s,n,a,o,h,u,l,c;if(t==null)return this;if(typeof t==="object"){n=t;r=e}else{(n={})[t]=e}r||(r={});if(!this._validate(n,r))return false;a=r.unset;h=r.silent;o=[];u=this._changing;this._changing=true;if(!u){this._previousAttributes=i.clone(this.attributes);this.changed={}}c=this.attributes,l=this._previousAttributes;if(this.idAttribute in n)this.id=n[this.idAttribute];for(s in n){e=n[s];if(!i.isEqual(c[s],e))o.push(s);if(!i.isEqual(l[s],e)){this.changed[s]=e}else{delete this.changed[s]}a?delete c[s]:c[s]=e}if(!h){if(o.length)this._pending=r;for(var f=0,d=o.length;f<d;f++){this.trigger("change:"+o[f],this,c[o[f]],r)}}if(u)return this;if(!h){while(this._pending){r=this._pending;this._pending=false;this.trigger("change",this,r)}}this._pending=false;this._changing=false;return this},unset:function(t,e){return this.set(t,void 0,i.extend({},e,{unset:true}))},clear:function(t){var e={};for(var r in this.attributes)e[r]=void 0;return this.set(e,i.extend({},t,{unset:true}))},hasChanged:function(t){if(t==null)return!i.isEmpty(this.changed);return i.has(this.changed,t)},changedAttributes:function(t){if(!t)return this.hasChanged()?i.clone(this.changed):false;var e,r=false;var s=this._changing?this._previousAttributes:this.attributes;for(var n in t){if(i.isEqual(s[n],e=t[n]))continue;(r||(r={}))[n]=e}return r},previous:function(t){if(t==null||!this._previousAttributes)return null;return this._previousAttributes[t]},previousAttributes:function(){return i.clone(this._previousAttributes)},fetch:function(t){t=t?i.clone(t):{};if(t.parse===void 0)t.parse=true;var e=this;var r=t.success;t.success=function(i){if(!e.set(e.parse(i,t),t))return false;if(r)r(e,i,t);e.trigger("sync",e,i,t)};q(this,t);return this.sync("read",this,t)},save:function(t,e,r){var s,n,a,o=this.attributes;if(t==null||typeof t==="object"){s=t;r=e}else{(s={})[t]=e}r=i.extend({validate:true},r);if(s&&!r.wait){if(!this.set(s,r))return false}else{if(!this._validate(s,r))return false}if(s&&r.wait){this.attributes=i.extend({},o,s)}if(r.parse===void 0)r.parse=true;var h=this;var u=r.success;r.success=function(t){h.attributes=o;var e=h.parse(t,r);if(r.wait)e=i.extend(s||{},e);if(i.isObject(e)&&!h.set(e,r)){return false}if(u)u(h,t,r);h.trigger("sync",h,t,r)};q(this,r);n=this.isNew()?"create":r.patch?"patch":"update";if(n==="patch")r.attrs=s;a=this.sync(n,this,r);if(s&&r.wait)this.attributes=o;return a},destroy:function(t){t=t?i.clone(t):{};var e=this;var r=t.success;var s=function(){e.trigger("destroy",e,e.collection,t)};t.success=function(i){if(t.wait||e.isNew())s();if(r)r(e,i,t);if(!e.isNew())e.trigger("sync",e,i,t)};if(this.isNew()){t.success();return false}q(this,t);var n=this.sync("delete",this,t);if(!t.wait)s();return n},url:function(){var t=i.result(this,"urlRoot")||i.result(this.collection,"url")||M();if(this.isNew())return t;return t.replace(/([^\/])$/,"$1/")+encodeURIComponent(this.id)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(t){return this._validate({},i.extend(t||{},{validate:true}))},_validate:function(t,e){if(!e.validate||!this.validate)return true;t=i.extend({},this.attributes,t);var r=this.validationError=this.validate(t,e)||null;if(!r)return true;this.trigger("invalid",this,r,i.extend(e,{validationError:r}));return false}});var v=["keys","values","pairs","invert","pick","omit"];i.each(v,function(t){p.prototype[t]=function(){var e=o.call(arguments);e.unshift(this.attributes);return i[t].apply(i,e)}});var g=e.Collection=function(t,e){e||(e={});if(e.model)this.model=e.model;if(e.comparator!==void 0)this.comparator=e.comparator;this._reset();this.initialize.apply(this,arguments);if(t)this.reset(t,i.extend({silent:true},e))};var m={add:true,remove:true,merge:true};var y={add:true,remove:false};i.extend(g.prototype,u,{model:p,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return e.sync.apply(this,arguments)},add:function(t,e){return this.set(t,i.extend({merge:false},e,y))},remove:function(t,e){var r=!i.isArray(t);t=r?[t]:i.clone(t);e||(e={});var s,n,a,o;for(s=0,n=t.length;s<n;s++){o=t[s]=this.get(t[s]);if(!o)continue;delete this._byId[o.id];delete this._byId[o.cid];a=this.indexOf(o);this.models.splice(a,1);this.length--;if(!e.silent){e.index=a;o.trigger("remove",o,this,e)}this._removeReference(o,e)}return r?t[0]:t},set:function(t,e){e=i.defaults({},e,m);if(e.parse)t=this.parse(t,e);var r=!i.isArray(t);t=r?t?[t]:[]:i.clone(t);var s,n,a,o,h,u,l;var c=e.at;var f=this.model;var d=this.comparator&&c==null&&e.sort!==false;var v=i.isString(this.comparator)?this.comparator:null;var g=[],y=[],_={};var b=e.add,w=e.merge,x=e.remove;var E=!d&&b&&x?[]:false;for(s=0,n=t.length;s<n;s++){h=t[s]||{};if(h instanceof p){a=o=h}else{a=h[f.prototype.idAttribute||"id"]}if(u=this.get(a)){if(x)_[u.cid]=true;if(w){h=h===o?o.attributes:h;if(e.parse)h=u.parse(h,e);u.set(h,e);if(d&&!l&&u.hasChanged(v))l=true}t[s]=u}else if(b){o=t[s]=this._prepareModel(h,e);if(!o)continue;g.push(o);this._addReference(o,e)}o=u||o;if(E&&(o.isNew()||!_[o.id]))E.push(o);_[o.id]=true}if(x){for(s=0,n=this.length;s<n;++s){if(!_[(o=this.models[s]).cid])y.push(o)}if(y.length)this.remove(y,e)}if(g.length||E&&E.length){if(d)l=true;this.length+=g.length;if(c!=null){for(s=0,n=g.length;s<n;s++){this.models.splice(c+s,0,g[s])}}else{if(E)this.models.length=0;var k=E||g;for(s=0,n=k.length;s<n;s++){this.models.push(k[s])}}}if(l)this.sort({silent:true});if(!e.silent){for(s=0,n=g.length;s<n;s++){(o=g[s]).trigger("add",o,this,e)}if(l||E&&E.length)this.trigger("sort",this,e)}return r?t[0]:t},reset:function(t,e){e||(e={});for(var r=0,s=this.models.length;r<s;r++){this._removeReference(this.models[r],e)}e.previousModels=this.models;this._reset();t=this.add(t,i.extend({silent:true},e));if(!e.silent)this.trigger("reset",this,e);return t},push:function(t,e){return this.add(t,i.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);this.remove(e,t);return e},unshift:function(t,e){return this.add(t,i.extend({at:0},e))},shift:function(t){var e=this.at(0);this.remove(e,t);return e},slice:function(){return o.apply(this.models,arguments)},get:function(t){if(t==null)return void 0;return this._byId[t]||this._byId[t.id]||this._byId[t.cid]},at:function(t){return this.models[t]},where:function(t,e){if(i.isEmpty(t))return e?void 0:[];return this[e?"find":"filter"](function(e){for(var i in t){if(t[i]!==e.get(i))return false}return true})},findWhere:function(t){return this.where(t,true)},sort:function(t){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");t||(t={});if(i.isString(this.comparator)||this.comparator.length===1){this.models=this.sortBy(this.comparator,this)}else{this.models.sort(i.bind(this.comparator,this))}if(!t.silent)this.trigger("sort",this,t);return this},pluck:function(t){return i.invoke(this.models,"get",t)},fetch:function(t){t=t?i.clone(t):{};if(t.parse===void 0)t.parse=true;var e=t.success;var r=this;t.success=function(i){var s=t.reset?"reset":"set";r[s](i,t);if(e)e(r,i,t);r.trigger("sync",r,i,t)};q(this,t);return this.sync("read",this,t)},create:function(t,e){e=e?i.clone(e):{};if(!(t=this._prepareModel(t,e)))return false;if(!e.wait)this.add(t,e);var r=this;var s=e.success;e.success=function(t,i){if(e.wait)r.add(t,e);if(s)s(t,i,e)};t.save(null,e);return t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0;this.models=[];this._byId={}},_prepareModel:function(t,e){if(t instanceof p)return t;e=e?i.clone(e):{};e.collection=this;var r=new this.model(t,e);if(!r.validationError)return r;this.trigger("invalid",this,r.validationError,e);return false},_addReference:function(t,e){this._byId[t.cid]=t;if(t.id!=null)this._byId[t.id]=t;if(!t.collection)t.collection=this;t.on("all",this._onModelEvent,this)},_removeReference:function(t,e){if(this===t.collection)delete t.collection;t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,r){if((t==="add"||t==="remove")&&i!==this)return;if(t==="destroy")this.remove(e,r);if(e&&t==="change:"+e.idAttribute){delete this._byId[e.previous(e.idAttribute)];if(e.id!=null)this._byId[e.id]=e}this.trigger.apply(this,arguments)}});var _=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","difference","indexOf","shuffle","lastIndexOf","isEmpty","chain","sample"];i.each(_,function(t){g.prototype[t]=function(){var e=o.call(arguments);e.unshift(this.models);return i[t].apply(i,e)}});var b=["groupBy","countBy","sortBy","indexBy"];i.each(b,function(t){g.prototype[t]=function(e,r){var s=i.isFunction(e)?e:function(t){return t.get(e)};return i[t](this.models,s,r)}});var w=e.View=function(t){this.cid=i.uniqueId("view");t||(t={});i.extend(this,i.pick(t,E));this._ensureElement();this.initialize.apply(this,arguments);this.delegateEvents()};var x=/^(\S+)\s*(.*)$/;var E=["model","collection","el","id","attributes","className","tagName","events"];i.extend(w.prototype,u,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){this.$el.remove();this.stopListening();return this},setElement:function(t,i){if(this.$el)this.undelegateEvents();this.$el=t instanceof e.$?t:e.$(t);this.el=this.$el[0];if(i!==false)this.delegateEvents();return this},delegateEvents:function(t){if(!(t||(t=i.result(this,"events"))))return this;this.undelegateEvents();for(var e in t){var r=t[e];if(!i.isFunction(r))r=this[t[e]];if(!r)continue;var s=e.match(x);var n=s[1],a=s[2];r=i.bind(r,this);n+=".delegateEvents"+this.cid;if(a===""){this.$el.on(n,r)}else{this.$el.on(n,a,r)}}return this},undelegateEvents:function(){this.$el.off(".delegateEvents"+this.cid);return this},_ensureElement:function(){if(!this.el){var t=i.extend({},i.result(this,"attributes"));if(this.id)t.id=i.result(this,"id");if(this.className)t["class"]=i.result(this,"className");var r=e.$("<"+i.result(this,"tagName")+">").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.$('<iframe src="javascript:0" tabindex="-1">');this.iframe=a.hide().appendTo("body")[0].contentWindow;this.navigate(r)}if(this._hasPushState){e.$(window).on("popstate",this.checkUrl)}else if(this._wantsHashChange&&"onhashchange"in window&&!n){e.$(window).on("hashchange",this.checkUrl)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}this.fragment=r;var o=this.location;if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){this.fragment=this.getFragment(null,true);this.location.replace(this.root+"#"+this.fragment);return true}else if(this._hasPushState&&this.atRoot()&&o.hash){this.fragment=this.getHash().replace(R,"");this.history.replaceState({},document.title,this.root+this.fragment)}}if(!this.options.silent)return this.loadUrl()},stop:function(){e.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl);if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);N.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getFragment(this.getHash(this.iframe))}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){t=this.fragment=this.getFragment(t);return i.any(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!N.started)return false;if(!e||e===true)e={trigger:!!e};var i=this.root+(t=this.getFragment(t||""));t=t.replace(j,"");if(this.fragment===t)return;this.fragment=t;if(t===""&&i!=="/")i=i.slice(0,-1);if(this._hasPushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,i)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getFragment(this.getHash(this.iframe))){if(!e.replace)this.iframe.document.open().close();this._updateHash(this.iframe.location,t,e.replace)}}else{return this.location.assign(i)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});e.history=new N;var U=function(t,e){var r=this;var s;if(t&&i.has(t,"constructor")){s=t.constructor}else{s=function(){return r.apply(this,arguments)}}i.extend(s,r,e);var n=function(){this.constructor=s};n.prototype=r.prototype;s.prototype=new n;if(t)i.extend(s.prototype,t);s.__super__=r.prototype;return s};p.extend=g.extend=$.extend=w.extend=N.extend=U;var M=function(){throw new Error('A "url" property or function must be specified')};var q=function(t,e){var i=e.error;e.error=function(r){if(i)i(t,r,e);t.trigger("error",t,r,e)}};return e});
+
+// From http://stackoverflow.com/a/19431552
+// Compatibility override - Backbone 1.1 got rid of the 'options' binding
+// automatically to views in the constructor - we need to keep that.
+Backbone.View = (function(View) {
+ return View.extend({
+ constructor: function(options) {
+ this.options = options || {};
+ View.apply(this, arguments);
+ }
+ });
+})(Backbone.View); \ No newline at end of file
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/handlebars-2.0.0.js b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/handlebars-2.0.0.js
new file mode 100644
index 0000000..743f04b
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/handlebars-2.0.0.js
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+/*!
+
+ handlebars v2.0.0
+
+Copyright (C) 2011-2014 by Yehuda Katz
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+@license
+*/
+!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?module.exports=b():a.Handlebars=a.Handlebars||b()}(this,function(){var a=function(){"use strict";function a(a){this.string=a}var b;return a.prototype.toString=function(){return""+this.string},b=a}(),b=function(a){"use strict";function b(a){return i[a]}function c(a){for(var b=1;b<arguments.length;b++)for(var c in arguments[b])Object.prototype.hasOwnProperty.call(arguments[b],c)&&(a[c]=arguments[b][c]);return a}function d(a){return a instanceof h?a.toString():null==a?"":a?(a=""+a,k.test(a)?a.replace(j,b):a):a+""}function e(a){return a||0===a?n(a)&&0===a.length?!0:!1:!0}function f(a,b){return(a?a+".":"")+b}var g={},h=a,i={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},j=/[&<>"'`]/g,k=/[&<>"'`]/;g.extend=c;var l=Object.prototype.toString;g.toString=l;var m=function(a){return"function"==typeof a};m(/x/)&&(m=function(a){return"function"==typeof a&&"[object Function]"===l.call(a)});var m;g.isFunction=m;var n=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===l.call(a):!1};return g.isArray=n,g.escapeExpression=d,g.isEmpty=e,g.appendContextPath=f,g}(a),c=function(){"use strict";function a(a,b){var d;b&&b.firstLine&&(d=b.firstLine,a+=" - "+d+":"+b.firstColumn);for(var e=Error.prototype.constructor.call(this,a),f=0;f<c.length;f++)this[c[f]]=e[c[f]];d&&(this.lineNumber=d,this.column=b.firstColumn)}var b,c=["description","fileName","lineNumber","message","name","number","stack"];return a.prototype=new Error,b=a}(),d=function(a,b){"use strict";function c(a,b){this.helpers=a||{},this.partials=b||{},d(this)}function d(a){a.registerHelper("helperMissing",function(){if(1===arguments.length)return void 0;throw new g("Missing helper: '"+arguments[arguments.length-1].name+"'")}),a.registerHelper("blockHelperMissing",function(b,c){var d=c.inverse,e=c.fn;if(b===!0)return e(this);if(b===!1||null==b)return d(this);if(k(b))return b.length>0?(c.ids&&(c.ids=[c.name]),a.helpers.each(b,c)):d(this);if(c.data&&c.ids){var g=q(c.data);g.contextPath=f.appendContextPath(c.data.contextPath,c.name),c={data:g}}return e(b,c)}),a.registerHelper("each",function(a,b){if(!b)throw new g("Must pass iterator to #each");var c,d,e=b.fn,h=b.inverse,i=0,j="";if(b.data&&b.ids&&(d=f.appendContextPath(b.data.contextPath,b.ids[0])+"."),l(a)&&(a=a.call(this)),b.data&&(c=q(b.data)),a&&"object"==typeof a)if(k(a))for(var m=a.length;m>i;i++)c&&(c.index=i,c.first=0===i,c.last=i===a.length-1,d&&(c.contextPath=d+i)),j+=e(a[i],{data:c});else for(var n in a)a.hasOwnProperty(n)&&(c&&(c.key=n,c.index=i,c.first=0===i,d&&(c.contextPath=d+n)),j+=e(a[n],{data:c}),i++);return 0===i&&(j=h(this)),j}),a.registerHelper("if",function(a,b){return l(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||f.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})}),a.registerHelper("with",function(a,b){l(a)&&(a=a.call(this));var c=b.fn;if(f.isEmpty(a))return b.inverse(this);if(b.data&&b.ids){var d=q(b.data);d.contextPath=f.appendContextPath(b.data.contextPath,b.ids[0]),b={data:d}}return c(a,b)}),a.registerHelper("log",function(b,c){var d=c.data&&null!=c.data.level?parseInt(c.data.level,10):1;a.log(d,b)}),a.registerHelper("lookup",function(a,b){return a&&a[b]})}var e={},f=a,g=b,h="2.0.0";e.VERSION=h;var i=6;e.COMPILER_REVISION=i;var j={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1"};e.REVISION_CHANGES=j;var k=f.isArray,l=f.isFunction,m=f.toString,n="[object Object]";e.HandlebarsEnvironment=c,c.prototype={constructor:c,logger:o,log:p,registerHelper:function(a,b){if(m.call(a)===n){if(b)throw new g("Arg not supported with multiple helpers");f.extend(this.helpers,a)}else this.helpers[a]=b},unregisterHelper:function(a){delete this.helpers[a]},registerPartial:function(a,b){m.call(a)===n?f.extend(this.partials,a):this.partials[a]=b},unregisterPartial:function(a){delete this.partials[a]}};var o={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(a,b){if(o.level<=a){var c=o.methodMap[a];"undefined"!=typeof console&&console[c]&&console[c].call(console,b)}}};e.logger=o;var p=o.log;e.log=p;var q=function(a){var b=f.extend({},a);return b._parent=a,b};return e.createFrame=q,e}(b,c),e=function(a,b,c){"use strict";function d(a){var b=a&&a[0]||1,c=m;if(b!==c){if(c>b){var d=n[c],e=n[b];throw new l("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new l("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function e(a,b){if(!b)throw new l("No environment passed to template");if(!a||!a.main)throw new l("Unknown template object: "+typeof a);b.VM.checkRevision(a.compiler);var c=function(c,d,e,f,g,h,i,j,m){g&&(f=k.extend({},f,g));var n=b.VM.invokePartial.call(this,c,e,f,h,i,j,m);if(null==n&&b.compile){var o={helpers:h,partials:i,data:j,depths:m};i[e]=b.compile(c,{data:void 0!==j,compat:a.compat},b),n=i[e](f,o)}if(null!=n){if(d){for(var p=n.split("\n"),q=0,r=p.length;r>q&&(p[q]||q+1!==r);q++)p[q]=d+p[q];n=p.join("\n")}return n}throw new l("The partial "+e+" could not be compiled when running in runtime-only mode")},d={lookup:function(a,b){for(var c=a.length,d=0;c>d;d++)if(a[d]&&null!=a[d][b])return a[d][b]},lambda:function(a,b){return"function"==typeof a?a.call(b):a},escapeExpression:k.escapeExpression,invokePartial:c,fn:function(b){return a[b]},programs:[],program:function(a,b,c){var d=this.programs[a],e=this.fn(a);return b||c?d=f(this,a,e,b,c):d||(d=this.programs[a]=f(this,a,e)),d},data:function(a,b){for(;a&&b--;)a=a._parent;return a},merge:function(a,b){var c=a||b;return a&&b&&a!==b&&(c=k.extend({},b,a)),c},noop:b.VM.noop,compilerInfo:a.compiler},e=function(b,c){c=c||{};var f=c.data;e._setup(c),!c.partial&&a.useData&&(f=i(b,f));var g;return a.useDepths&&(g=c.depths?[b].concat(c.depths):[b]),a.main.call(d,b,d.helpers,d.partials,f,g)};return e.isTop=!0,e._setup=function(c){c.partial?(d.helpers=c.helpers,d.partials=c.partials):(d.helpers=d.merge(c.helpers,b.helpers),a.usePartial&&(d.partials=d.merge(c.partials,b.partials)))},e._child=function(b,c,e){if(a.useDepths&&!e)throw new l("must pass parent depths");return f(d,b,a[b],c,e)},e}function f(a,b,c,d,e){var f=function(b,f){return f=f||{},c.call(a,b,a.helpers,a.partials,f.data||d,e&&[b].concat(e))};return f.program=b,f.depth=e?e.length:0,f}function g(a,b,c,d,e,f,g){var h={partial:!0,helpers:d,partials:e,data:f,depths:g};if(void 0===a)throw new l("The partial "+b+" could not be found");return a instanceof Function?a(c,h):void 0}function h(){return""}function i(a,b){return b&&"root"in b||(b=b?o(b):{},b.root=a),b}var j={},k=a,l=b,m=c.COMPILER_REVISION,n=c.REVISION_CHANGES,o=c.createFrame;return j.checkRevision=d,j.template=e,j.program=f,j.invokePartial=g,j.noop=h,j}(b,c,d),f=function(a,b,c,d,e){"use strict";var f,g=a,h=b,i=c,j=d,k=e,l=function(){var a=new g.HandlebarsEnvironment;return j.extend(a,g),a.SafeString=h,a.Exception=i,a.Utils=j,a.escapeExpression=j.escapeExpression,a.VM=k,a.template=function(b){return k.template(b,a)},a},m=l();return m.create=l,m["default"]=m,f=m}(d,a,c,b,e),g=function(a){"use strict";function b(a){a=a||{},this.firstLine=a.first_line,this.firstColumn=a.first_column,this.lastColumn=a.last_column,this.lastLine=a.last_line}var c,d=a,e={ProgramNode:function(a,c,d){b.call(this,d),this.type="program",this.statements=a,this.strip=c},MustacheNode:function(a,c,d,f,g){if(b.call(this,g),this.type="mustache",this.strip=f,null!=d&&d.charAt){var h=d.charAt(3)||d.charAt(2);this.escaped="{"!==h&&"&"!==h}else this.escaped=!!d;this.sexpr=a instanceof e.SexprNode?a:new e.SexprNode(a,c),this.id=this.sexpr.id,this.params=this.sexpr.params,this.hash=this.sexpr.hash,this.eligibleHelper=this.sexpr.eligibleHelper,this.isHelper=this.sexpr.isHelper},SexprNode:function(a,c,d){b.call(this,d),this.type="sexpr",this.hash=c;var e=this.id=a[0],f=this.params=a.slice(1);this.isHelper=!(!f.length&&!c),this.eligibleHelper=this.isHelper||e.isSimple},PartialNode:function(a,c,d,e,f){b.call(this,f),this.type="partial",this.partialName=a,this.context=c,this.hash=d,this.strip=e,this.strip.inlineStandalone=!0},BlockNode:function(a,c,d,e,f){b.call(this,f),this.type="block",this.mustache=a,this.program=c,this.inverse=d,this.strip=e,d&&!c&&(this.isInverse=!0)},RawBlockNode:function(a,c,f,g){if(b.call(this,g),a.sexpr.id.original!==f)throw new d(a.sexpr.id.original+" doesn't match "+f,this);c=new e.ContentNode(c,g),this.type="block",this.mustache=a,this.program=new e.ProgramNode([c],{},g)},ContentNode:function(a,c){b.call(this,c),this.type="content",this.original=this.string=a},HashNode:function(a,c){b.call(this,c),this.type="hash",this.pairs=a},IdNode:function(a,c){b.call(this,c),this.type="ID";for(var e="",f=[],g=0,h="",i=0,j=a.length;j>i;i++){var k=a[i].part;if(e+=(a[i].separator||"")+k,".."===k||"."===k||"this"===k){if(f.length>0)throw new d("Invalid path: "+e,this);".."===k?(g++,h+="../"):this.isScoped=!0}else f.push(k)}this.original=e,this.parts=f,this.string=f.join("."),this.depth=g,this.idName=h+this.string,this.isSimple=1===a.length&&!this.isScoped&&0===g,this.stringModeValue=this.string},PartialNameNode:function(a,c){b.call(this,c),this.type="PARTIAL_NAME",this.name=a.original},DataNode:function(a,c){b.call(this,c),this.type="DATA",this.id=a,this.stringModeValue=a.stringModeValue,this.idName="@"+a.stringModeValue},StringNode:function(a,c){b.call(this,c),this.type="STRING",this.original=this.string=this.stringModeValue=a},NumberNode:function(a,c){b.call(this,c),this.type="NUMBER",this.original=this.number=a,this.stringModeValue=Number(a)},BooleanNode:function(a,c){b.call(this,c),this.type="BOOLEAN",this.bool=a,this.stringModeValue="true"===a},CommentNode:function(a,c){b.call(this,c),this.type="comment",this.comment=a,this.strip={inlineStandalone:!0}}};return c=e}(c),h=function(){"use strict";var a,b=function(){function a(){this.yy={}}var b={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,CONTENT:12,COMMENT:13,openRawBlock:14,END_RAW_BLOCK:15,OPEN_RAW_BLOCK:16,sexpr:17,CLOSE_RAW_BLOCK:18,openBlock:19,block_option0:20,closeBlock:21,openInverse:22,block_option1:23,OPEN_BLOCK:24,CLOSE:25,OPEN_INVERSE:26,inverseAndProgram:27,INVERSE:28,OPEN_ENDBLOCK:29,path:30,OPEN:31,OPEN_UNESCAPED:32,CLOSE_UNESCAPED:33,OPEN_PARTIAL:34,partialName:35,param:36,partial_option0:37,partial_option1:38,sexpr_repetition0:39,sexpr_option0:40,dataName:41,STRING:42,NUMBER:43,BOOLEAN:44,OPEN_SEXPR:45,CLOSE_SEXPR:46,hash:47,hash_repetition_plus0:48,hashSegment:49,ID:50,EQUALS:51,DATA:52,pathSegments:53,SEP:54,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",12:"CONTENT",13:"COMMENT",15:"END_RAW_BLOCK",16:"OPEN_RAW_BLOCK",18:"CLOSE_RAW_BLOCK",24:"OPEN_BLOCK",25:"CLOSE",26:"OPEN_INVERSE",28:"INVERSE",29:"OPEN_ENDBLOCK",31:"OPEN",32:"OPEN_UNESCAPED",33:"CLOSE_UNESCAPED",34:"OPEN_PARTIAL",42:"STRING",43:"NUMBER",44:"BOOLEAN",45:"OPEN_SEXPR",46:"CLOSE_SEXPR",50:"ID",51:"EQUALS",52:"DATA",54:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[10,3],[14,3],[9,4],[9,4],[19,3],[22,3],[27,2],[21,3],[8,3],[8,3],[11,5],[11,4],[17,3],[17,1],[36,1],[36,1],[36,1],[36,1],[36,1],[36,3],[47,1],[49,3],[35,1],[35,1],[35,1],[41,2],[30,1],[53,3],[53,1],[6,0],[6,2],[20,0],[20,1],[23,0],[23,1],[37,0],[37,1],[38,0],[38,1],[39,0],[39,2],[40,0],[40,1],[48,1],[48,2]],performAction:function(a,b,c,d,e,f){var g=f.length-1;switch(e){case 1:return d.prepareProgram(f[g-1].statements,!0),f[g-1];case 2:this.$=new d.ProgramNode(d.prepareProgram(f[g]),{},this._$);break;case 3:this.$=f[g];break;case 4:this.$=f[g];break;case 5:this.$=f[g];break;case 6:this.$=f[g];break;case 7:this.$=new d.ContentNode(f[g],this._$);break;case 8:this.$=new d.CommentNode(f[g],this._$);break;case 9:this.$=new d.RawBlockNode(f[g-2],f[g-1],f[g],this._$);break;case 10:this.$=new d.MustacheNode(f[g-1],null,"","",this._$);break;case 11:this.$=d.prepareBlock(f[g-3],f[g-2],f[g-1],f[g],!1,this._$);break;case 12:this.$=d.prepareBlock(f[g-3],f[g-2],f[g-1],f[g],!0,this._$);break;case 13:this.$=new d.MustacheNode(f[g-1],null,f[g-2],d.stripFlags(f[g-2],f[g]),this._$);break;case 14:this.$=new d.MustacheNode(f[g-1],null,f[g-2],d.stripFlags(f[g-2],f[g]),this._$);break;case 15:this.$={strip:d.stripFlags(f[g-1],f[g-1]),program:f[g]};break;case 16:this.$={path:f[g-1],strip:d.stripFlags(f[g-2],f[g])};break;case 17:this.$=new d.MustacheNode(f[g-1],null,f[g-2],d.stripFlags(f[g-2],f[g]),this._$);break;case 18:this.$=new d.MustacheNode(f[g-1],null,f[g-2],d.stripFlags(f[g-2],f[g]),this._$);break;case 19:this.$=new d.PartialNode(f[g-3],f[g-2],f[g-1],d.stripFlags(f[g-4],f[g]),this._$);break;case 20:this.$=new d.PartialNode(f[g-2],void 0,f[g-1],d.stripFlags(f[g-3],f[g]),this._$);break;case 21:this.$=new d.SexprNode([f[g-2]].concat(f[g-1]),f[g],this._$);break;case 22:this.$=new d.SexprNode([f[g]],null,this._$);break;case 23:this.$=f[g];break;case 24:this.$=new d.StringNode(f[g],this._$);break;case 25:this.$=new d.NumberNode(f[g],this._$);break;case 26:this.$=new d.BooleanNode(f[g],this._$);break;case 27:this.$=f[g];break;case 28:f[g-1].isHelper=!0,this.$=f[g-1];break;case 29:this.$=new d.HashNode(f[g],this._$);break;case 30:this.$=[f[g-2],f[g]];break;case 31:this.$=new d.PartialNameNode(f[g],this._$);break;case 32:this.$=new d.PartialNameNode(new d.StringNode(f[g],this._$),this._$);break;case 33:this.$=new d.PartialNameNode(new d.NumberNode(f[g],this._$));break;case 34:this.$=new d.DataNode(f[g],this._$);break;case 35:this.$=new d.IdNode(f[g],this._$);break;case 36:f[g-2].push({part:f[g],separator:f[g-1]}),this.$=f[g-2];break;case 37:this.$=[{part:f[g]}];break;case 38:this.$=[];break;case 39:f[g-1].push(f[g]);break;case 48:this.$=[];break;case 49:f[g-1].push(f[g]);break;case 52:this.$=[f[g]];break;case 53:f[g-1].push(f[g])}},table:[{3:1,4:2,5:[2,38],6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],31:[2,38],32:[2,38],34:[2,38]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:[1,10],13:[1,11],14:16,16:[1,20],19:14,22:15,24:[1,18],26:[1,19],28:[2,2],29:[2,2],31:[1,12],32:[1,13],34:[1,17]},{1:[2,1]},{5:[2,39],12:[2,39],13:[2,39],16:[2,39],24:[2,39],26:[2,39],28:[2,39],29:[2,39],31:[2,39],32:[2,39],34:[2,39]},{5:[2,3],12:[2,3],13:[2,3],16:[2,3],24:[2,3],26:[2,3],28:[2,3],29:[2,3],31:[2,3],32:[2,3],34:[2,3]},{5:[2,4],12:[2,4],13:[2,4],16:[2,4],24:[2,4],26:[2,4],28:[2,4],29:[2,4],31:[2,4],32:[2,4],34:[2,4]},{5:[2,5],12:[2,5],13:[2,5],16:[2,5],24:[2,5],26:[2,5],28:[2,5],29:[2,5],31:[2,5],32:[2,5],34:[2,5]},{5:[2,6],12:[2,6],13:[2,6],16:[2,6],24:[2,6],26:[2,6],28:[2,6],29:[2,6],31:[2,6],32:[2,6],34:[2,6]},{5:[2,7],12:[2,7],13:[2,7],16:[2,7],24:[2,7],26:[2,7],28:[2,7],29:[2,7],31:[2,7],32:[2,7],34:[2,7]},{5:[2,8],12:[2,8],13:[2,8],16:[2,8],24:[2,8],26:[2,8],28:[2,8],29:[2,8],31:[2,8],32:[2,8],34:[2,8]},{17:21,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:27,30:22,41:23,50:[1,26],52:[1,25],53:24},{4:28,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{4:29,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{12:[1,30]},{30:32,35:31,42:[1,33],43:[1,34],50:[1,26],53:24},{17:35,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:36,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:37,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[1,38]},{18:[2,48],25:[2,48],33:[2,48],39:39,42:[2,48],43:[2,48],44:[2,48],45:[2,48],46:[2,48],50:[2,48],52:[2,48]},{18:[2,22],25:[2,22],33:[2,22],46:[2,22]},{18:[2,35],25:[2,35],33:[2,35],42:[2,35],43:[2,35],44:[2,35],45:[2,35],46:[2,35],50:[2,35],52:[2,35],54:[1,40]},{30:41,50:[1,26],53:24},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],52:[2,37],54:[2,37]},{33:[1,42]},{20:43,27:44,28:[1,45],29:[2,40]},{23:46,27:47,28:[1,45],29:[2,42]},{15:[1,48]},{25:[2,46],30:51,36:49,38:50,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],47:57,48:58,49:60,50:[1,59],52:[1,25],53:24},{25:[2,31],42:[2,31],43:[2,31],44:[2,31],45:[2,31],50:[2,31],52:[2,31]},{25:[2,32],42:[2,32],43:[2,32],44:[2,32],45:[2,32],50:[2,32],52:[2,32]},{25:[2,33],42:[2,33],43:[2,33],44:[2,33],45:[2,33],50:[2,33],52:[2,33]},{25:[1,61]},{25:[1,62]},{18:[1,63]},{5:[2,17],12:[2,17],13:[2,17],16:[2,17],24:[2,17],26:[2,17],28:[2,17],29:[2,17],31:[2,17],32:[2,17],34:[2,17]},{18:[2,50],25:[2,50],30:51,33:[2,50],36:65,40:64,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],46:[2,50],47:66,48:58,49:60,50:[1,59],52:[1,25],53:24},{50:[1,67]},{18:[2,34],25:[2,34],33:[2,34],42:[2,34],43:[2,34],44:[2,34],45:[2,34],46:[2,34],50:[2,34],52:[2,34]},{5:[2,18],12:[2,18],13:[2,18],16:[2,18],24:[2,18],26:[2,18],28:[2,18],29:[2,18],31:[2,18],32:[2,18],34:[2,18]},{21:68,29:[1,69]},{29:[2,41]},{4:70,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{21:71,29:[1,69]},{29:[2,43]},{5:[2,9],12:[2,9],13:[2,9],16:[2,9],24:[2,9],26:[2,9],28:[2,9],29:[2,9],31:[2,9],32:[2,9],34:[2,9]},{25:[2,44],37:72,47:73,48:58,49:60,50:[1,74]},{25:[1,75]},{18:[2,23],25:[2,23],33:[2,23],42:[2,23],43:[2,23],44:[2,23],45:[2,23],46:[2,23],50:[2,23],52:[2,23]},{18:[2,24],25:[2,24],33:[2,24],42:[2,24],43:[2,24],44:[2,24],45:[2,24],46:[2,24],50:[2,24],52:[2,24]},{18:[2,25],25:[2,25],33:[2,25],42:[2,25],43:[2,25],44:[2,25],45:[2,25],46:[2,25],50:[2,25],52:[2,25]},{18:[2,26],25:[2,26],33:[2,26],42:[2,26],43:[2,26],44:[2,26],45:[2,26],46:[2,26],50:[2,26],52:[2,26]},{18:[2,27],25:[2,27],33:[2,27],42:[2,27],43:[2,27],44:[2,27],45:[2,27],46:[2,27],50:[2,27],52:[2,27]},{17:76,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[2,47]},{18:[2,29],25:[2,29],33:[2,29],46:[2,29],49:77,50:[1,74]},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],51:[1,78],52:[2,37],54:[2,37]},{18:[2,52],25:[2,52],33:[2,52],46:[2,52],50:[2,52]},{12:[2,13],13:[2,13],16:[2,13],24:[2,13],26:[2,13],28:[2,13],29:[2,13],31:[2,13],32:[2,13],34:[2,13]},{12:[2,14],13:[2,14],16:[2,14],24:[2,14],26:[2,14],28:[2,14],29:[2,14],31:[2,14],32:[2,14],34:[2,14]},{12:[2,10]},{18:[2,21],25:[2,21],33:[2,21],46:[2,21]},{18:[2,49],25:[2,49],33:[2,49],42:[2,49],43:[2,49],44:[2,49],45:[2,49],46:[2,49],50:[2,49],52:[2,49]},{18:[2,51],25:[2,51],33:[2,51],46:[2,51]},{18:[2,36],25:[2,36],33:[2,36],42:[2,36],43:[2,36],44:[2,36],45:[2,36],46:[2,36],50:[2,36],52:[2,36],54:[2,36]},{5:[2,11],12:[2,11],13:[2,11],16:[2,11],24:[2,11],26:[2,11],28:[2,11],29:[2,11],31:[2,11],32:[2,11],34:[2,11]},{30:79,50:[1,26],53:24},{29:[2,15]},{5:[2,12],12:[2,12],13:[2,12],16:[2,12],24:[2,12],26:[2,12],28:[2,12],29:[2,12],31:[2,12],32:[2,12],34:[2,12]},{25:[1,80]},{25:[2,45]},{51:[1,78]},{5:[2,20],12:[2,20],13:[2,20],16:[2,20],24:[2,20],26:[2,20],28:[2,20],29:[2,20],31:[2,20],32:[2,20],34:[2,20]},{46:[1,81]},{18:[2,53],25:[2,53],33:[2,53],46:[2,53],50:[2,53]},{30:51,36:82,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],50:[1,26],52:[1,25],53:24},{25:[1,83]},{5:[2,19],12:[2,19],13:[2,19],16:[2,19],24:[2,19],26:[2,19],28:[2,19],29:[2,19],31:[2,19],32:[2,19],34:[2,19]},{18:[2,28],25:[2,28],33:[2,28],42:[2,28],43:[2,28],44:[2,28],45:[2,28],46:[2,28],50:[2,28],52:[2,28]},{18:[2,30],25:[2,30],33:[2,30],46:[2,30],50:[2,30]},{5:[2,16],12:[2,16],13:[2,16],16:[2,16],24:[2,16],26:[2,16],28:[2,16],29:[2,16],31:[2,16],32:[2,16],34:[2,16]}],defaultActions:{4:[2,1],44:[2,41],47:[2,43],57:[2,47],63:[2,10],70:[2,15],73:[2,45]},parseError:function(a){throw new Error(a)},parse:function(a){function b(){var a;return a=c.lexer.lex()||1,"number"!=typeof a&&(a=c.symbols_[a]||a),a}var c=this,d=[0],e=[null],f=[],g=this.table,h="",i=0,j=0,k=0;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var l=this.lexer.yylloc;f.push(l);var m=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var n,o,p,q,r,s,t,u,v,w={};;){if(p=d[d.length-1],this.defaultActions[p]?q=this.defaultActions[p]:((null===n||"undefined"==typeof n)&&(n=b()),q=g[p]&&g[p][n]),"undefined"==typeof q||!q.length||!q[0]){var x="";if(!k){v=[];for(s in g[p])this.terminals_[s]&&s>2&&v.push("'"+this.terminals_[s]+"'");x=this.lexer.showPosition?"Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+v.join(", ")+", got '"+(this.terminals_[n]||n)+"'":"Parse error on line "+(i+1)+": Unexpected "+(1==n?"end of input":"'"+(this.terminals_[n]||n)+"'"),this.parseError(x,{text:this.lexer.match,token:this.terminals_[n]||n,line:this.lexer.yylineno,loc:l,expected:v})}}if(q[0]instanceof Array&&q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+p+", token: "+n);switch(q[0]){case 1:d.push(n),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(q[1]),n=null,o?(n=o,o=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,l=this.lexer.yylloc,k>0&&k--);break;case 2:if(t=this.productions_[q[1]][1],w.$=e[e.length-t],w._$={first_line:f[f.length-(t||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(t||1)].first_column,last_column:f[f.length-1].last_column},m&&(w._$.range=[f[f.length-(t||1)].range[0],f[f.length-1].range[1]]),r=this.performAction.call(w,h,j,i,this.yy,q[1],e,f),"undefined"!=typeof r)return r;t&&(d=d.slice(0,-1*t*2),e=e.slice(0,-1*t),f=f.slice(0,-1*t)),d.push(this.productions_[q[1]][0]),e.push(w.$),f.push(w._$),u=g[d[d.length-2]][d[d.length-1]],d.push(u);break;case 3:return!0}}return!0}},c=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this},more:function(){return this._more=!0,this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d,e;this._more||(this.yytext="",this.match="");for(var f=this._currentRules(),g=0;g<f.length&&(c=this._input.match(this.rules[f[g]]),!c||b&&!(c[0].length>b[0].length)||(b=c,d=g,this.options.flex));g++);return b?(e=b[0].match(/(?:\r\n?|\n).*/g),e&&(this.yylineno+=e.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:e?e[e.length-1].length-e[e.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.matches=b,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],a=this.performAction.call(this,this.yy,this,f[d],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a?a:void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return"undefined"!=typeof a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)}};return a.options={},a.performAction=function(a,b,c,d){function e(a,c){return b.yytext=b.yytext.substr(a,b.yyleng-c)}switch(c){case 0:if("\\\\"===b.yytext.slice(-2)?(e(0,1),this.begin("mu")):"\\"===b.yytext.slice(-1)?(e(0,1),this.begin("emu")):this.begin("mu"),b.yytext)return 12;break;case 1:return 12;case 2:return this.popState(),12;case 3:return b.yytext=b.yytext.substr(5,b.yyleng-9),this.popState(),15;case 4:return 12;case 5:return e(0,4),this.popState(),13;case 6:return 45;case 7:return 46;case 8:return 16;case 9:return this.popState(),this.begin("raw"),18;case 10:return 34;case 11:return 24;case 12:return 29;case 13:return this.popState(),28;case 14:return this.popState(),28;case 15:return 26;case 16:return 26;case 17:return 32;case 18:return 31;case 19:this.popState(),this.begin("com");break;case 20:return e(3,5),this.popState(),13;case 21:return 31;case 22:return 51;case 23:return 50;case 24:return 50;case 25:return 54;case 26:break;case 27:return this.popState(),33;case 28:return this.popState(),25;case 29:return b.yytext=e(1,2).replace(/\\"/g,'"'),42;case 30:return b.yytext=e(1,2).replace(/\\'/g,"'"),42;case 31:return 52;case 32:return 44;case 33:return 44;case 34:return 43;case 35:return 50;case 36:return b.yytext=e(1,2),50;case 37:return"INVALID";case 38:return 5}},a.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],a.conditions={mu:{rules:[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[5],inclusive:!1},raw:{rules:[3,4],inclusive:!1},INITIAL:{rules:[0,1,38],inclusive:!0}},a}();return b.lexer=c,a.prototype=b,b.Parser=a,new a}();return a=b}(),i=function(a){"use strict";function b(a,b){return{left:"~"===a.charAt(2),right:"~"===b.charAt(b.length-3)}}function c(a,b,c,d,i,k){if(a.sexpr.id.original!==d.path.original)throw new j(a.sexpr.id.original+" doesn't match "+d.path.original,a);var l=c&&c.program,m={left:a.strip.left,right:d.strip.right,openStandalone:f(b.statements),closeStandalone:e((l||b).statements)};if(a.strip.right&&g(b.statements,null,!0),l){var n=c.strip;n.left&&h(b.statements,null,!0),n.right&&g(l.statements,null,!0),d.strip.left&&h(l.statements,null,!0),e(b.statements)&&f(l.statements)&&(h(b.statements),g(l.statements))}else d.strip.left&&h(b.statements,null,!0);return i?new this.BlockNode(a,l,b,m,k):new this.BlockNode(a,b,l,m,k)}function d(a,b){for(var c=0,d=a.length;d>c;c++){var i=a[c],j=i.strip;if(j){var k=e(a,c,b,"partial"===i.type),l=f(a,c,b),m=j.openStandalone&&k,n=j.closeStandalone&&l,o=j.inlineStandalone&&k&&l;j.right&&g(a,c,!0),j.left&&h(a,c,!0),o&&(g(a,c),h(a,c)&&"partial"===i.type&&(i.indent=/([ \t]+$)/.exec(a[c-1].original)?RegExp.$1:"")),m&&(g((i.program||i.inverse).statements),h(a,c)),n&&(g(a,c),h((i.inverse||i.program).statements))}}return a}function e(a,b,c){void 0===b&&(b=a.length);var d=a[b-1],e=a[b-2];return d?"content"===d.type?(e||!c?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(d.original):void 0:c}function f(a,b,c){void 0===b&&(b=-1);var d=a[b+1],e=a[b+2];return d?"content"===d.type?(e||!c?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(d.original):void 0:c}function g(a,b,c){var d=a[null==b?0:b+1];if(d&&"content"===d.type&&(c||!d.rightStripped)){var e=d.string;d.string=d.string.replace(c?/^\s+/:/^[ \t]*\r?\n?/,""),d.rightStripped=d.string!==e}}function h(a,b,c){var d=a[null==b?a.length-1:b-1];if(d&&"content"===d.type&&(c||!d.leftStripped)){var e=d.string;return d.string=d.string.replace(c?/\s+$/:/[ \t]+$/,""),d.leftStripped=d.string!==e,d.leftStripped}}var i={},j=a;return i.stripFlags=b,i.prepareBlock=c,i.prepareProgram=d,i}(c),j=function(a,b,c,d){"use strict";function e(a){return a.constructor===h.ProgramNode?a:(g.yy=k,g.parse(a))}var f={},g=a,h=b,i=c,j=d.extend;f.parser=g;var k={};return j(k,i,h),f.parse=e,f}(h,g,i,b),k=function(a,b){"use strict";function c(){}function d(a,b,c){if(null==a||"string"!=typeof a&&a.constructor!==c.AST.ProgramNode)throw new h("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+a);b=b||{},"data"in b||(b.data=!0),b.compat&&(b.useDepths=!0);var d=c.parse(a),e=(new c.Compiler).compile(d,b);return(new c.JavaScriptCompiler).compile(e,b)}function e(a,b,c){function d(){var d=c.parse(a),e=(new c.Compiler).compile(d,b),f=(new c.JavaScriptCompiler).compile(e,b,void 0,!0);return c.template(f)}if(null==a||"string"!=typeof a&&a.constructor!==c.AST.ProgramNode)throw new h("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+a);b=b||{},"data"in b||(b.data=!0),b.compat&&(b.useDepths=!0);var e,f=function(a,b){return e||(e=d()),e.call(this,a,b)};return f._setup=function(a){return e||(e=d()),e._setup(a)},f._child=function(a,b,c){return e||(e=d()),e._child(a,b,c)},f}function f(a,b){if(a===b)return!0;if(i(a)&&i(b)&&a.length===b.length){for(var c=0;c<a.length;c++)if(!f(a[c],b[c]))return!1;return!0}}var g={},h=a,i=b.isArray,j=[].slice;return g.Compiler=c,c.prototype={compiler:c,equals:function(a){var b=this.opcodes.length;if(a.opcodes.length!==b)return!1;for(var c=0;b>c;c++){var d=this.opcodes[c],e=a.opcodes[c];if(d.opcode!==e.opcode||!f(d.args,e.args))return!1}for(b=this.children.length,c=0;b>c;c++)if(!this.children[c].equals(a.children[c]))return!1;return!0},guid:0,compile:function(a,b){this.opcodes=[],this.children=[],this.depths={list:[]},this.options=b,this.stringParams=b.stringParams,this.trackIds=b.trackIds;var c=this.options.knownHelpers;if(this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0,lookup:!0},c)for(var d in c)this.options.knownHelpers[d]=c[d];return this.accept(a)},accept:function(a){return this[a.type](a)},program:function(a){for(var b=a.statements,c=0,d=b.length;d>c;c++)this.accept(b[c]);return this.isSimple=1===d,this.depths.list=this.depths.list.sort(function(a,b){return a-b}),this},compileProgram:function(a){var b,c=(new this.compiler).compile(a,this.options),d=this.guid++;
+this.usePartial=this.usePartial||c.usePartial,this.children[d]=c;for(var e=0,f=c.depths.list.length;f>e;e++)b=c.depths.list[e],2>b||this.addDepth(b-1);return d},block:function(a){var b=a.mustache,c=a.program,d=a.inverse;c&&(c=this.compileProgram(c)),d&&(d=this.compileProgram(d));var e=b.sexpr,f=this.classifySexpr(e);"helper"===f?this.helperSexpr(e,c,d):"simple"===f?(this.simpleSexpr(e),this.opcode("pushProgram",c),this.opcode("pushProgram",d),this.opcode("emptyHash"),this.opcode("blockValue",e.id.original)):(this.ambiguousSexpr(e,c,d),this.opcode("pushProgram",c),this.opcode("pushProgram",d),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},hash:function(a){var b,c,d=a.pairs;for(this.opcode("pushHash"),b=0,c=d.length;c>b;b++)this.pushParam(d[b][1]);for(;b--;)this.opcode("assignToHash",d[b][0]);this.opcode("popHash")},partial:function(a){var b=a.partialName;this.usePartial=!0,a.hash?this.accept(a.hash):this.opcode("push","undefined"),a.context?this.accept(a.context):(this.opcode("getContext",0),this.opcode("pushContext")),this.opcode("invokePartial",b.name,a.indent||""),this.opcode("append")},content:function(a){a.string&&this.opcode("appendContent",a.string)},mustache:function(a){this.sexpr(a.sexpr),a.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousSexpr:function(a,b,c){var d=a.id,e=d.parts[0],f=null!=b||null!=c;this.opcode("getContext",d.depth),this.opcode("pushProgram",b),this.opcode("pushProgram",c),this.ID(d),this.opcode("invokeAmbiguous",e,f)},simpleSexpr:function(a){var b=a.id;"DATA"===b.type?this.DATA(b):b.parts.length?this.ID(b):(this.addDepth(b.depth),this.opcode("getContext",b.depth),this.opcode("pushContext")),this.opcode("resolvePossibleLambda")},helperSexpr:function(a,b,c){var d=this.setupFullMustacheParams(a,b,c),e=a.id,f=e.parts[0];if(this.options.knownHelpers[f])this.opcode("invokeKnownHelper",d.length,f);else{if(this.options.knownHelpersOnly)throw new h("You specified knownHelpersOnly, but used the unknown helper "+f,a);e.falsy=!0,this.ID(e),this.opcode("invokeHelper",d.length,e.original,e.isSimple)}},sexpr:function(a){var b=this.classifySexpr(a);"simple"===b?this.simpleSexpr(a):"helper"===b?this.helperSexpr(a):this.ambiguousSexpr(a)},ID:function(a){this.addDepth(a.depth),this.opcode("getContext",a.depth);var b=a.parts[0];b?this.opcode("lookupOnContext",a.parts,a.falsy,a.isScoped):this.opcode("pushContext")},DATA:function(a){this.options.data=!0,this.opcode("lookupData",a.id.depth,a.id.parts)},STRING:function(a){this.opcode("pushString",a.string)},NUMBER:function(a){this.opcode("pushLiteral",a.number)},BOOLEAN:function(a){this.opcode("pushLiteral",a.bool)},comment:function(){},opcode:function(a){this.opcodes.push({opcode:a,args:j.call(arguments,1)})},addDepth:function(a){0!==a&&(this.depths[a]||(this.depths[a]=!0,this.depths.list.push(a)))},classifySexpr:function(a){var b=a.isHelper,c=a.eligibleHelper,d=this.options;if(c&&!b){var e=a.id.parts[0];d.knownHelpers[e]?b=!0:d.knownHelpersOnly&&(c=!1)}return b?"helper":c?"ambiguous":"simple"},pushParams:function(a){for(var b=0,c=a.length;c>b;b++)this.pushParam(a[b])},pushParam:function(a){this.stringParams?(a.depth&&this.addDepth(a.depth),this.opcode("getContext",a.depth||0),this.opcode("pushStringParam",a.stringModeValue,a.type),"sexpr"===a.type&&this.sexpr(a)):(this.trackIds&&this.opcode("pushId",a.type,a.idName||a.stringModeValue),this.accept(a))},setupFullMustacheParams:function(a,b,c){var d=a.params;return this.pushParams(d),this.opcode("pushProgram",b),this.opcode("pushProgram",c),a.hash?this.hash(a.hash):this.opcode("emptyHash"),d}},g.precompile=d,g.compile=e,g}(c,b),l=function(a,b){"use strict";function c(a){this.value=a}function d(){}var e,f=a.COMPILER_REVISION,g=a.REVISION_CHANGES,h=b;d.prototype={nameLookup:function(a,b){return d.isValidJavaScriptVariableName(b)?a+"."+b:a+"['"+b+"']"},depthedLookup:function(a){return this.aliases.lookup="this.lookup",'lookup(depths, "'+a+'")'},compilerInfo:function(){var a=f,b=g[a];return[a,b]},appendToBuffer:function(a){return this.environment.isSimple?"return "+a+";":{appendToBuffer:!0,content:a,toString:function(){return"buffer += "+a+";"}}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(a,b,c,d){this.environment=a,this.options=b,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!d,this.name=this.environment.name,this.isChild=!!c,this.context=c||{programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.compileChildren(a,b),this.useDepths=this.useDepths||a.depths.list.length||this.options.compat;var e,f,g,i=a.opcodes;for(f=0,g=i.length;g>f;f++)e=i[f],this[e.opcode].apply(this,e.args);if(this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new h("Compile completed with content left on stack");var j=this.createFunctionContext(d);if(this.isChild)return j;var k={compiler:this.compilerInfo(),main:j},l=this.context.programs;for(f=0,g=l.length;g>f;f++)l[f]&&(k[f]=l[f]);return this.environment.usePartial&&(k.usePartial=!0),this.options.data&&(k.useData=!0),this.useDepths&&(k.useDepths=!0),this.options.compat&&(k.compat=!0),d||(k.compiler=JSON.stringify(k.compiler),k=this.objectLiteral(k)),k},preamble:function(){this.lastContext=0,this.source=[]},createFunctionContext:function(a){var b="",c=this.stackVars.concat(this.registers.list);c.length>0&&(b+=", "+c.join(", "));for(var d in this.aliases)this.aliases.hasOwnProperty(d)&&(b+=", "+d+"="+this.aliases[d]);var e=["depth0","helpers","partials","data"];this.useDepths&&e.push("depths");var f=this.mergeSource(b);return a?(e.push(f),Function.apply(this,e)):"function("+e.join(",")+") {\n "+f+"}"},mergeSource:function(a){for(var b,c,d="",e=!this.forceBuffer,f=0,g=this.source.length;g>f;f++){var h=this.source[f];h.appendToBuffer?b=b?b+"\n + "+h.content:h.content:(b&&(d?d+="buffer += "+b+";\n ":(c=!0,d=b+";\n "),b=void 0),d+=h+"\n ",this.environment.isSimple||(e=!1))}return e?(b||!d)&&(d+="return "+(b||'""')+";\n"):(a+=", buffer = "+(c?"":this.initializeBuffer()),d+=b?"return buffer + "+b+";\n":"return buffer;\n"),a&&(d="var "+a.substring(2)+(c?"":";\n ")+d),d},blockValue:function(a){this.aliases.blockHelperMissing="helpers.blockHelperMissing";var b=[this.contextName(0)];this.setupParams(a,0,b);var c=this.popStack();b.splice(1,0,c),this.push("blockHelperMissing.call("+b.join(", ")+")")},ambiguousBlockValue:function(){this.aliases.blockHelperMissing="helpers.blockHelperMissing";var a=[this.contextName(0)];this.setupParams("",0,a,!0),this.flushInline();var b=this.topStack();a.splice(1,0,b),this.pushSource("if (!"+this.lastHelper+") { "+b+" = blockHelperMissing.call("+a.join(", ")+"); }")},appendContent:function(a){this.pendingContent&&(a=this.pendingContent+a),this.pendingContent=a},append:function(){this.flushInline();var a=this.popStack();this.pushSource("if ("+a+" != null) { "+this.appendToBuffer(a)+" }"),this.environment.isSimple&&this.pushSource("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){this.aliases.escapeExpression="this.escapeExpression",this.pushSource(this.appendToBuffer("escapeExpression("+this.popStack()+")"))},getContext:function(a){this.lastContext=a},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(a,b,c){var d=0,e=a.length;for(c||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(a[d++]));e>d;d++)this.replaceStack(function(c){var e=this.nameLookup(c,a[d],"context");return b?" && "+e:" != null ? "+e+" : "+c})},lookupData:function(a,b){a?this.pushStackLiteral("this.data(data, "+a+")"):this.pushStackLiteral("data");for(var c=b.length,d=0;c>d;d++)this.replaceStack(function(a){return" && "+this.nameLookup(a,b[d],"data")})},resolvePossibleLambda:function(){this.aliases.lambda="this.lambda",this.push("lambda("+this.popStack()+", "+this.contextName(0)+")")},pushStringParam:function(a,b){this.pushContext(),this.pushString(b),"sexpr"!==b&&("string"==typeof a?this.pushString(a):this.pushStackLiteral(a))},emptyHash:function(){this.pushStackLiteral("{}"),this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}"))},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:[],types:[],contexts:[],ids:[]}},popHash:function(){var a=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push("{"+a.ids.join(",")+"}"),this.stringParams&&(this.push("{"+a.contexts.join(",")+"}"),this.push("{"+a.types.join(",")+"}")),this.push("{\n "+a.values.join(",\n ")+"\n }")},pushString:function(a){this.pushStackLiteral(this.quotedString(a))},push:function(a){return this.inlineStack.push(a),a},pushLiteral:function(a){this.pushStackLiteral(a)},pushProgram:function(a){null!=a?this.pushStackLiteral(this.programExpression(a)):this.pushStackLiteral(null)},invokeHelper:function(a,b,c){this.aliases.helperMissing="helpers.helperMissing";var d=this.popStack(),e=this.setupHelper(a,b),f=(c?e.name+" || ":"")+d+" || helperMissing";this.push("(("+f+").call("+e.callParams+"))")},invokeKnownHelper:function(a,b){var c=this.setupHelper(a,b);this.push(c.name+".call("+c.callParams+")")},invokeAmbiguous:function(a,b){this.aliases.functionType='"function"',this.aliases.helperMissing="helpers.helperMissing",this.useRegister("helper");var c=this.popStack();this.emptyHash();var d=this.setupHelper(0,a,b),e=this.lastHelper=this.nameLookup("helpers",a,"helper");this.push("((helper = (helper = "+e+" || "+c+") != null ? helper : helperMissing"+(d.paramsInit?"),("+d.paramsInit:"")+"),(typeof helper === functionType ? helper.call("+d.callParams+") : helper))")},invokePartial:function(a,b){var c=[this.nameLookup("partials",a,"partial"),"'"+b+"'","'"+a+"'",this.popStack(),this.popStack(),"helpers","partials"];this.options.data?c.push("data"):this.options.compat&&c.push("undefined"),this.options.compat&&c.push("depths"),this.push("this.invokePartial("+c.join(", ")+")")},assignToHash:function(a){var b,c,d,e=this.popStack();this.trackIds&&(d=this.popStack()),this.stringParams&&(c=this.popStack(),b=this.popStack());var f=this.hash;b&&f.contexts.push("'"+a+"': "+b),c&&f.types.push("'"+a+"': "+c),d&&f.ids.push("'"+a+"': "+d),f.values.push("'"+a+"': ("+e+")")},pushId:function(a,b){"ID"===a||"DATA"===a?this.pushString(b):"sexpr"===a?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:d,compileChildren:function(a,b){for(var c,d,e=a.children,f=0,g=e.length;g>f;f++){c=e[f],d=new this.compiler;var h=this.matchExistingProgram(c);null==h?(this.context.programs.push(""),h=this.context.programs.length,c.index=h,c.name="program"+h,this.context.programs[h]=d.compile(c,b,this.context,!this.precompile),this.context.environments[h]=c,this.useDepths=this.useDepths||d.useDepths):(c.index=h,c.name="program"+h)}},matchExistingProgram:function(a){for(var b=0,c=this.context.environments.length;c>b;b++){var d=this.context.environments[b];if(d&&d.equals(a))return b}},programExpression:function(a){var b=this.environment.children[a],c=(b.depths.list,this.useDepths),d=[b.index,"data"];return c&&d.push("depths"),"this.program("+d.join(", ")+")"},useRegister:function(a){this.registers[a]||(this.registers[a]=!0,this.registers.list.push(a))},pushStackLiteral:function(a){return this.push(new c(a))},pushSource:function(a){this.pendingContent&&(this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent))),this.pendingContent=void 0),a&&this.source.push(a)},pushStack:function(a){this.flushInline();var b=this.incrStack();return this.pushSource(b+" = "+a+";"),this.compileStack.push(b),b},replaceStack:function(a){{var b,d,e,f="";this.isInline()}if(!this.isInline())throw new h("replaceStack on non-inline");var g=this.popStack(!0);if(g instanceof c)f=b=g.value,e=!0;else{d=!this.stackSlot;var i=d?this.incrStack():this.topStackName();f="("+this.push(i)+" = "+g+")",b=this.topStack()}var j=a.call(this,b);e||this.popStack(),d&&this.stackSlot--,this.push("("+f+j+")")},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var a=this.inlineStack;if(a.length){this.inlineStack=[];for(var b=0,d=a.length;d>b;b++){var e=a[b];e instanceof c?this.compileStack.push(e):this.pushStack(e)}}},isInline:function(){return this.inlineStack.length},popStack:function(a){var b=this.isInline(),d=(b?this.inlineStack:this.compileStack).pop();if(!a&&d instanceof c)return d.value;if(!b){if(!this.stackSlot)throw new h("Invalid stack pop");this.stackSlot--}return d},topStack:function(){var a=this.isInline()?this.inlineStack:this.compileStack,b=a[a.length-1];return b instanceof c?b.value:b},contextName:function(a){return this.useDepths&&a?"depths["+a+"]":"depth"+a},quotedString:function(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(this.quotedString(c)+":"+a[c]);return"{"+b.join(",")+"}"},setupHelper:function(a,b,c){var d=[],e=this.setupParams(b,a,d,c),f=this.nameLookup("helpers",b,"helper");return{params:d,paramsInit:e,name:f,callParams:[this.contextName(0)].concat(d).join(", ")}},setupOptions:function(a,b,c){var d,e,f,g={},h=[],i=[],j=[];g.name=this.quotedString(a),g.hash=this.popStack(),this.trackIds&&(g.hashIds=this.popStack()),this.stringParams&&(g.hashTypes=this.popStack(),g.hashContexts=this.popStack()),e=this.popStack(),f=this.popStack(),(f||e)&&(f||(f="this.noop"),e||(e="this.noop"),g.fn=f,g.inverse=e);for(var k=b;k--;)d=this.popStack(),c[k]=d,this.trackIds&&(j[k]=this.popStack()),this.stringParams&&(i[k]=this.popStack(),h[k]=this.popStack());return this.trackIds&&(g.ids="["+j.join(",")+"]"),this.stringParams&&(g.types="["+i.join(",")+"]",g.contexts="["+h.join(",")+"]"),this.options.data&&(g.data="data"),g},setupParams:function(a,b,c,d){var e=this.objectLiteral(this.setupOptions(a,b,c));return d?(this.useRegister("options"),c.push("options"),"options="+e):(c.push(e),"")}};for(var i="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),j=d.RESERVED_WORDS={},k=0,l=i.length;l>k;k++)j[i[k]]=!0;return d.isValidJavaScriptVariableName=function(a){return!d.RESERVED_WORDS[a]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(a)},e=d}(d,c),m=function(a,b,c,d,e){"use strict";var f,g=a,h=b,i=c.parser,j=c.parse,k=d.Compiler,l=d.compile,m=d.precompile,n=e,o=g.create,p=function(){var a=o();return a.compile=function(b,c){return l(b,c,a)},a.precompile=function(b,c){return m(b,c,a)},a.AST=h,a.Compiler=k,a.JavaScriptCompiler=n,a.Parser=i,a.parse=j,a};return g=p(),g.create=p,g["default"]=g,f=g}(f,g,j,k,l);return m}); \ No newline at end of file
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/highlight.7.3.pack.js b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/highlight.7.3.pack.js
new file mode 100644
index 0000000..78f8bd9
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/highlight.7.3.pack.js
@@ -0,0 +1,16 @@
+/*
+ * 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.
+ */
+var hljs=new function(){function l(o){return o.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;")}function b(p){for(var o=p.firstChild;o;o=o.nextSibling){if(o.nodeName=="CODE"){return o}if(!(o.nodeType==3&&o.nodeValue.match(/\s+/))){break}}}function h(p,o){return Array.prototype.map.call(p.childNodes,function(q){if(q.nodeType==3){return o?q.nodeValue.replace(/\n/g,""):q.nodeValue}if(q.nodeName=="BR"){return"\n"}return h(q,o)}).join("")}function a(q){var p=(q.className+" "+q.parentNode.className).split(/\s+/);p=p.map(function(r){return r.replace(/^language-/,"")});for(var o=0;o<p.length;o++){if(e[p[o]]||p[o]=="no-highlight"){return p[o]}}}function c(q){var o=[];(function p(r,s){for(var t=r.firstChild;t;t=t.nextSibling){if(t.nodeType==3){s+=t.nodeValue.length}else{if(t.nodeName=="BR"){s+=1}else{if(t.nodeType==1){o.push({event:"start",offset:s,node:t});s=p(t,s);o.push({event:"stop",offset:s,node:t})}}}}return s})(q,0);return o}function j(x,v,w){var p=0;var y="";var r=[];function t(){if(x.length&&v.length){if(x[0].offset!=v[0].offset){return(x[0].offset<v[0].offset)?x:v}else{return v[0].event=="start"?x:v}}else{return x.length?x:v}}function s(A){function z(B){return" "+B.nodeName+'="'+l(B.value)+'"'}return"<"+A.nodeName+Array.prototype.map.call(A.attributes,z).join("")+">"}while(x.length||v.length){var u=t().splice(0,1)[0];y+=l(w.substr(p,u.offset-p));p=u.offset;if(u.event=="start"){y+=s(u.node);r.push(u.node)}else{if(u.event=="stop"){var o,q=r.length;do{q--;o=r[q];y+=("</"+o.nodeName.toLowerCase()+">")}while(o!=u.node);r.splice(q,1);while(q<r.length){y+=s(r[q]);q++}}}}return y+l(w.substr(p))}function f(q){function o(s,r){return RegExp(s,"m"+(q.cI?"i":"")+(r?"g":""))}function p(y,w){if(y.compiled){return}y.compiled=true;var s=[];if(y.k){var r={};function z(A,t){t.split(" ").forEach(function(B){var C=B.split("|");r[C[0]]=[A,C[1]?Number(C[1]):1];s.push(C[0])})}y.lR=o(y.l||hljs.IR,true);if(typeof y.k=="string"){z("keyword",y.k)}else{for(var x in y.k){if(!y.k.hasOwnProperty(x)){continue}z(x,y.k[x])}}y.k=r}if(w){if(y.bWK){y.b="\\b("+s.join("|")+")\\s"}y.bR=o(y.b?y.b:"\\B|\\b");if(!y.e&&!y.eW){y.e="\\B|\\b"}if(y.e){y.eR=o(y.e)}y.tE=y.e||"";if(y.eW&&w.tE){y.tE+=(y.e?"|":"")+w.tE}}if(y.i){y.iR=o(y.i)}if(y.r===undefined){y.r=1}if(!y.c){y.c=[]}for(var v=0;v<y.c.length;v++){if(y.c[v]=="self"){y.c[v]=y}p(y.c[v],y)}if(y.starts){p(y.starts,w)}var u=[];for(var v=0;v<y.c.length;v++){u.push(y.c[v].b)}if(y.tE){u.push(y.tE)}if(y.i){u.push(y.i)}y.t=u.length?o(u.join("|"),true):{exec:function(t){return null}}}p(q)}function d(D,E){function o(r,M){for(var L=0;L<M.c.length;L++){var K=M.c[L].bR.exec(r);if(K&&K.index==0){return M.c[L]}}}function s(K,r){if(K.e&&K.eR.test(r)){return K}if(K.eW){return s(K.parent,r)}}function t(r,K){return K.i&&K.iR.test(r)}function y(L,r){var K=F.cI?r[0].toLowerCase():r[0];return L.k.hasOwnProperty(K)&&L.k[K]}function G(){var K=l(w);if(!A.k){return K}var r="";var N=0;A.lR.lastIndex=0;var L=A.lR.exec(K);while(L){r+=K.substr(N,L.index-N);var M=y(A,L);if(M){v+=M[1];r+='<span class="'+M[0]+'">'+L[0]+"</span>"}else{r+=L[0]}N=A.lR.lastIndex;L=A.lR.exec(K)}return r+K.substr(N)}function z(){if(A.sL&&!e[A.sL]){return l(w)}var r=A.sL?d(A.sL,w):g(w);if(A.r>0){v+=r.keyword_count;B+=r.r}return'<span class="'+r.language+'">'+r.value+"</span>"}function J(){return A.sL!==undefined?z():G()}function I(L,r){var K=L.cN?'<span class="'+L.cN+'">':"";if(L.rB){x+=K;w=""}else{if(L.eB){x+=l(r)+K;w=""}else{x+=K;w=r}}A=Object.create(L,{parent:{value:A}});B+=L.r}function C(K,r){w+=K;if(r===undefined){x+=J();return 0}var L=o(r,A);if(L){x+=J();I(L,r);return L.rB?0:r.length}var M=s(A,r);if(M){if(!(M.rE||M.eE)){w+=r}x+=J();do{if(A.cN){x+="</span>"}A=A.parent}while(A!=M.parent);if(M.eE){x+=l(r)}w="";if(M.starts){I(M.starts,"")}return M.rE?0:r.length}if(t(r,A)){throw"Illegal"}w+=r;return r.length||1}var F=e[D];f(F);var A=F;var w="";var B=0;var v=0;var x="";try{var u,q,p=0;while(true){A.t.lastIndex=p;u=A.t.exec(E);if(!u){break}q=C(E.substr(p,u.index-p),u[0]);p=u.index+q}C(E.substr(p));return{r:B,keyword_count:v,value:x,language:D}}catch(H){if(H=="Illegal"){return{r:0,keyword_count:0,value:l(E)}}else{throw H}}}function g(s){var o={keyword_count:0,r:0,value:l(s)};var q=o;for(var p in e){if(!e.hasOwnProperty(p)){continue}var r=d(p,s);r.language=p;if(r.keyword_count+r.r>q.keyword_count+q.r){q=r}if(r.keyword_count+r.r>o.keyword_count+o.r){q=o;o=r}}if(q.language){o.second_best=q}return o}function i(q,p,o){if(p){q=q.replace(/^((<[^>]+>|\t)+)/gm,function(r,v,u,t){return v.replace(/\t/g,p)})}if(o){q=q.replace(/\n/g,"<br>")}return q}function m(r,u,p){var v=h(r,p);var t=a(r);if(t=="no-highlight"){return}var w=t?d(t,v):g(v);t=w.language;var o=c(r);if(o.length){var q=document.createElement("pre");q.innerHTML=w.value;w.value=j(o,c(q),v)}w.value=i(w.value,u,p);var s=r.className;if(!s.match("(\\s|^)(language-)?"+t+"(\\s|$)")){s=s?(s+" "+t):t}r.innerHTML=w.value;r.className=s;r.result={language:t,kw:w.keyword_count,re:w.r};if(w.second_best){r.second_best={language:w.second_best.language,kw:w.second_best.keyword_count,re:w.second_best.r}}}function n(){if(n.called){return}n.called=true;Array.prototype.map.call(document.getElementsByTagName("pre"),b).filter(Boolean).forEach(function(o){m(o,hljs.tabReplace)})}function k(){window.addEventListener("DOMContentLoaded",n,false);window.addEventListener("load",n,false)}var e={};this.LANGUAGES=e;this.highlight=d;this.highlightAuto=g;this.fixMarkup=i;this.highlightBlock=m;this.initHighlighting=n;this.initHighlightingOnLoad=k;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.inherit=function(q,r){var o={};for(var p in q){o[p]=q[p]}if(r){for(var p in r){o[p]=r[p]}}return o}}();hljs.LANGUAGES.xml=function(a){var c="[A-Za-z0-9\\._:-]+";var b={eW:true,c:[{cN:"attribute",b:c,r:0},{b:'="',rB:true,e:'"',c:[{cN:"value",b:'"',eW:true}]},{b:"='",rB:true,e:"'",c:[{cN:"value",b:"'",eW:true}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:true,c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{title:"style"},c:[b],starts:{e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ />]+"},b]}]}}(hljs);hljs.LANGUAGES.json=function(a){var e={literal:"true false null"};var d=[a.QSM,a.CNM];var c={cN:"value",e:",",eW:true,eE:true,c:d,k:e};var b={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:true,eE:true,c:[a.BE],i:"\\n",starts:c}],i:"\\S"};var f={b:"\\[",e:"\\]",c:[a.inherit(c,{cN:null})],i:"\\S"};d.splice(d.length,0,b,f);return{c:d,k:e,i:"\\S"}}(hljs); \ No newline at end of file
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery-1.8.0.min.js b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery-1.8.0.min.js
new file mode 100644
index 0000000..d6be256
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery-1.8.0.min.js
@@ -0,0 +1,17 @@
+/*
+ * 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.
+ */
+/*! jQuery v@1.8.0 jquery.com | jquery.org/license */
+(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)p.event.add(b,c,h[c][d])}g.data&&(g.data=p.extend({},g.data))}function bE(a,b){var c;if(b.nodeType!==1)return;b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?(b.parentNode&&(b.outerHTML=a.outerHTML),p.support.html5Clone&&a.innerHTML&&!p.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):c==="input"&&bv.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text),b.removeAttribute(p.expando)}function bF(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bG(a){bv.test(a.type)&&(a.defaultChecked=a.checked)}function bX(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=bV.length;while(e--){b=bV[e]+c;if(b in a)return b}return d}function bY(a,b){return a=b||a,p.css(a,"display")==="none"||!p.contains(a.ownerDocument,a)}function bZ(a,b){var c,d,e=[],f=0,g=a.length;for(;f<g;f++){c=a[f];if(!c.style)continue;e[f]=p._data(c,"olddisplay"),b?(!e[f]&&c.style.display==="none"&&(c.style.display=""),c.style.display===""&&bY(c)&&(e[f]=p._data(c,"olddisplay",cb(c.nodeName)))):(d=bH(c,"display"),!e[f]&&d!=="none"&&p._data(c,"olddisplay",d))}for(f=0;f<g;f++){c=a[f];if(!c.style)continue;if(!b||c.style.display==="none"||c.style.display==="")c.style.display=b?e[f]||"":"none"}return a}function b$(a,b,c){var d=bO.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function b_(a,b,c,d){var e=c===(d?"border":"content")?4:b==="width"?1:0,f=0;for(;e<4;e+=2)c==="margin"&&(f+=p.css(a,c+bU[e],!0)),d?(c==="content"&&(f-=parseFloat(bH(a,"padding"+bU[e]))||0),c!=="margin"&&(f-=parseFloat(bH(a,"border"+bU[e]+"Width"))||0)):(f+=parseFloat(bH(a,"padding"+bU[e]))||0,c!=="padding"&&(f+=parseFloat(bH(a,"border"+bU[e]+"Width"))||0));return f}function ca(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=!0,f=p.support.boxSizing&&p.css(a,"boxSizing")==="border-box";if(d<=0){d=bH(a,b);if(d<0||d==null)d=a.style[b];if(bP.test(d))return d;e=f&&(p.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+b_(a,b,c||(f?"border":"content"),e)+"px"}function cb(a){if(bR[a])return bR[a];var b=p("<"+a+">").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write("<!doctype html><html><body>"),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bR[a]=c,c}function ch(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||cd.test(a)?d(a,e):ch(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ch(a+"["+e+"]",b[e],c,d);else d(a,b)}function cy(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h<i;h++)d=g[h],f=/^\+/.test(d),f&&(d=d.substr(1)||"*"),e=a[d]=a[d]||[],e[f?"unshift":"push"](c)}}function cz(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h,i=a[f],j=0,k=i?i.length:0,l=a===cu;for(;j<k&&(l||!h);j++)h=i[j](c,d,e),typeof h=="string"&&(!l||g[h]?h=b:(c.dataTypes.unshift(h),h=cz(a,c,d,e,h,g)));return(l||!h)&&!g["*"]&&(h=cz(a,c,d,e,"*",g)),h}function cA(a,c){var d,e,f=p.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);e&&p.extend(!0,a,e)}function cB(a,c,d){var e,f,g,h,i=a.contents,j=a.dataTypes,k=a.responseFields;for(f in k)f in d&&(c[k[f]]=d[f]);while(j[0]==="*")j.shift(),e===b&&(e=a.mimeType||c.getResponseHeader("content-type"));if(e)for(f in i)if(i[f]&&i[f].test(e)){j.unshift(f);break}if(j[0]in d)g=j[0];else{for(f in d){if(!j[0]||a.converters[f+" "+j[0]]){g=f;break}h||(h=f)}g=g||h}if(g)return g!==j[0]&&j.unshift(g),d[g]}function cC(a,b){var c,d,e,f,g=a.dataTypes.slice(),h=g[0],i={},j=0;a.dataFilter&&(b=a.dataFilter(b,a.dataType));if(g[1])for(c in a.converters)i[c.toLowerCase()]=a.converters[c];for(;e=g[++j];)if(e!=="*"){if(h!=="*"&&h!==e){c=i[h+" "+e]||i["* "+e];if(!c)for(d in i){f=d.split(" ");if(f[1]===e){c=i[h+" "+f[0]]||i["* "+f[0]];if(c){c===!0?c=i[d]:i[d]!==!0&&(e=f[0],g.splice(j--,0,e));break}}}if(c!==!0)if(c&&a["throws"])b=c(b);else try{b=c(b)}catch(k){return{state:"parsererror",error:c?k:"No conversion from "+h+" to "+e}}}h=e}return{state:"success",data:b}}function cK(){try{return new a.XMLHttpRequest}catch(b){}}function cL(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cT(){return setTimeout(function(){cM=b},0),cM=p.now()}function cU(a,b){p.each(b,function(b,c){var d=(cS[b]||[]).concat(cS["*"]),e=0,f=d.length;for(;e<f;e++)if(d[e].call(a,b,c))return})}function cV(a,b,c){var d,e=0,f=0,g=cR.length,h=p.Deferred().always(function(){delete i.elem}),i=function(){var b=cM||cT(),c=Math.max(0,j.startTime+j.duration-b),d=1-(c/j.duration||0),e=0,f=j.tweens.length;for(;e<f;e++)j.tweens[e].run(d);return h.notifyWith(a,[j,d,c]),d<1&&f?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:p.extend({},b),opts:p.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:cM||cT(),duration:c.duration,tweens:[],createTween:function(b,c,d){var e=p.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(e),e},stop:function(b){var c=0,d=b?j.tweens.length:0;for(;c<d;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;cW(k,j.opts.specialEasing);for(;e<g;e++){d=cR[e].call(j,a,k,j.opts);if(d)return d}return cU(j,k),p.isFunction(j.opts.start)&&j.opts.start.call(a,j),p.fx.timer(p.extend(i,{anim:j,queue:j.opts.queue,elem:a})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function cW(a,b){var c,d,e,f,g;for(c in a){d=p.camelCase(c),e=b[d],f=a[c],p.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=p.cssHooks[d];if(g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}}function cX(a,b,c){var d,e,f,g,h,i,j,k,l=this,m=a.style,n={},o=[],q=a.nodeType&&bY(a);c.queue||(j=p._queueHooks(a,"fx"),j.unqueued==null&&(j.unqueued=0,k=j.empty.fire,j.empty.fire=function(){j.unqueued||k()}),j.unqueued++,l.always(function(){l.always(function(){j.unqueued--,p.queue(a,"fx").length||j.empty.fire()})})),a.nodeType===1&&("height"in b||"width"in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],p.css(a,"display")==="inline"&&p.css(a,"float")==="none"&&(!p.support.inlineBlockNeedsLayout||cb(a.nodeName)==="inline"?m.display="inline-block":m.zoom=1)),c.overflow&&(m.overflow="hidden",p.support.shrinkWrapBlocks||l.done(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b){f=b[d];if(cO.exec(f)){delete b[d];if(f===(q?"hide":"show"))continue;o.push(d)}}g=o.length;if(g){h=p._data(a,"fxshow")||p._data(a,"fxshow",{}),q?p(a).show():l.done(function(){p(a).hide()}),l.done(function(){var b;p.removeData(a,"fxshow",!0);for(b in n)p.style(a,b,n[b])});for(d=0;d<g;d++)e=o[d],i=l.createTween(e,q?h[e]:0),n[e]=h[e]||p.style(a,e),e in h||(h[e]=i.start,q&&(i.end=i.start,i.start=e==="width"||e==="height"?1:0))}}function cY(a,b,c,d,e){return new cY.prototype.init(a,b,c,d,e)}function cZ(a,b){var c,d={height:a},e=0;for(;e<4;e+=2-b)c=bU[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function c_(a){return p.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}var c,d,e=a.document,f=a.location,g=a.navigator,h=a.jQuery,i=a.$,j=Array.prototype.push,k=Array.prototype.slice,l=Array.prototype.indexOf,m=Object.prototype.toString,n=Object.prototype.hasOwnProperty,o=String.prototype.trim,p=function(a,b){return new p.fn.init(a,b,c)},q=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,r=/\S/,s=/\s+/,t=r.test(" ")?/^[\s\xA0]+|[\s\xA0]+$/g:/^\s+|\s+$/g,u=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.0",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i<j;i++)if((a=arguments[i])!=null)for(c in a){d=h[c],e=a[c];if(h===e)continue;k&&e&&(p.isPlainObject(e)||(f=p.isArray(e)))?(f?(f=!1,g=d&&p.isArray(d)?d:[]):g=d&&p.isPlainObject(d)?d:{},h[c]=p.extend(k,g,e)):e!==b&&(h[c]=e)}return h},p.extend({noConflict:function(b){return a.$===p&&(a.$=i),b&&a.jQuery===p&&(a.jQuery=h),p},isReady:!1,readyWait:1,holdReady:function(a){a?p.readyWait++:p.ready(!0)},ready:function(a){if(a===!0?--p.readyWait:p.isReady)return;if(!e.body)return setTimeout(p.ready,1);p.isReady=!0;if(a!==!0&&--p.readyWait>0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f<g;)if(c.apply(a[f++],d)===!1)break}else if(h){for(e in a)if(c.call(a[e],e,a[e])===!1)break}else for(;f<g;)if(c.call(a[f],f,a[f++])===!1)break;return a},trim:o?function(a){return a==null?"":o.call(a)}:function(a){return a==null?"":a.toString().replace(t,"")},makeArray:function(a,b){var c,d=b||[];return a!=null&&(c=p.type(a),a.length==null||c==="string"||c==="function"||c==="regexp"||p.isWindow(a)?j.call(d,a):p.merge(d,a)),d},inArray:function(a,b,c){var d;if(b){if(l)return l.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=c.length,e=a.length,f=0;if(typeof d=="number")for(;f<d;f++)a[e++]=c[f];else while(c[f]!==b)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;c=!!c;for(;f<g;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,c,d){var e,f,g=[],h=0,i=a.length,j=a instanceof p||i!==b&&typeof i=="number"&&(i>0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h<i;h++)e=c(a[h],h,d),e!=null&&(g[g.length]=e);else for(f in a)e=c(a[f],f,d),e!=null&&(g[g.length]=e);return g.concat.apply([],g)},guid:1,proxy:function(a,c){var d,e,f;return typeof c=="string"&&(d=a[c],c=a,a=d),p.isFunction(a)?(e=k.call(arguments,2),f=function(){return a.apply(c,e.concat(k.call(arguments)))},f.guid=a.guid=a.guid||f.guid||p.guid++,f):b},access:function(a,c,d,e,f,g,h){var i,j=d==null,k=0,l=a.length;if(d&&typeof d=="object"){for(k in d)p.access(a,c,k,d[k],1,g,e);f=1}else if(e!==b){i=h===b&&p.isFunction(e),j&&(i?(i=c,c=function(a,b,c){return i.call(p(a),c)}):(c.call(a,e),c=null));if(c)for(;k<l;k++)c(a[k],d,i?e.call(a[k],k,c(a[k],d)):e,h);f=1}return f?a:j?c.call(a):l?c(a[0],d):g},now:function(){return(new Date).getTime()}}),p.ready.promise=function(b){if(!d){d=p.Deferred();if(e.readyState==="complete"||e.readyState!=="loading"&&e.addEventListener)setTimeout(p.ready,1);else if(e.addEventListener)e.addEventListener("DOMContentLoaded",D,!1),a.addEventListener("load",p.ready,!1);else{e.attachEvent("onreadystatechange",D),a.attachEvent("onload",p.ready);var c=!1;try{c=a.frameElement==null&&e.documentElement}catch(f){}c&&c.doScroll&&function g(){if(!p.isReady){try{c.doScroll("left")}catch(a){return setTimeout(g,50)}p.ready()}}()}}return d.promise(b)},p.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){E["[object "+b+"]"]=b.toLowerCase()}),c=p(e);var F={};p.Callbacks=function(a){a=typeof a=="string"?F[a]||G(a):p.extend({},a);var c,d,e,f,g,h,i=[],j=!a.once&&[],k=function(b){c=a.memory&&b,d=!0,h=f||0,f=0,g=i.length,e=!0;for(;i&&h<g;h++)if(i[h].apply(b[0],b[1])===!1&&a.stopOnFalse){c=!1;break}e=!1,i&&(j?j.length&&k(j.shift()):c?i=[]:l.disable())},l={add:function(){if(i){var b=i.length;(function d(b){p.each(b,function(b,c){p.isFunction(c)&&(!a.unique||!l.has(c))?i.push(c):c&&c.length&&d(c)})})(arguments),e?g=i.length:c&&(f=b,k(c))}return this},remove:function(){return i&&p.each(arguments,function(a,b){var c;while((c=p.inArray(b,i,c))>-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return typeof a=="object"?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b<d;b++)c[b]&&p.isFunction(c[b].promise)?c[b].promise().done(g(b,j,c)).fail(f.reject).progress(g(b,i,h)):--e}return e||f.resolveWith(j,c),f.promise()}}),p.support=function(){var b,c,d,f,g,h,i,j,k,l,m,n=e.createElement("div");n.setAttribute("className","t"),n.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length||!d)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="<div></div>",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/^(?:\{.*\}|\[.*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||++p.uuid:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e<f;e++)delete d[b[e]];if(!(c?K:p.isEmptyObject)(d))return}}if(!c){delete h[i].data;if(!K(h[i]))return}g?p.cleanData([a],!0):p.support.deleteExpando||h!=h.window?delete h[i]:h[i]=null},_data:function(a,b,c){return p.data(a,b,c,!0)},acceptData:function(a){var b=a.nodeName&&p.noData[a.nodeName.toLowerCase()];return!b||b!==!0&&a.getAttribute("classid")===b}}),p.fn.extend({data:function(a,c){var d,e,f,g,h,i=this[0],j=0,k=null;if(a===b){if(this.length){k=p.data(i);if(i.nodeType===1&&!p._data(i,"parsedAttrs")){f=i.attributes;for(h=f.length;j<h;j++)g=f[j].name,g.indexOf("data-")===0&&(g=p.camelCase(g.substring(5)),J(i,g,k[g]));p._data(i,"parsedAttrs",!0)}}return k}return typeof a=="object"?this.each(function(){p.data(this,a)}):(d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!",p.access(this,function(c){if(c===b)return k=this.triggerHandler("getData"+e,[d[0]]),k===b&&i&&(k=p.data(i,a),k=J(i,a,k)),k===b&&d[1]?this.data(d[0]):k;d[1]=c,this.each(function(){var b=p(this);b.triggerHandler("setData"+e,d),p.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.shift(),e=p._queueHooks(a,b),f=function(){p.dequeue(a,b)};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),delete e.stop,d.call(a,f,e)),!c.length&&e&&e.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length<d?p.queue(this[0],a):c===b?this:this.each(function(){var b=p.queue(this,a,c);p._queueHooks(this,a),a==="fx"&&b[0]!=="inprogress"&&p.dequeue(this,a)})},dequeue:function(a){return this.each(function(){p.dequeue(this,a)})},delay:function(a,b){return a=p.fx?p.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){var d,e=1,f=p.Deferred(),g=this,h=this.length,i=function(){--e||f.resolveWith(g,[g])};typeof a!="string"&&(c=a,a=b),a=a||"fx";while(h--)(d=p._data(g[h],a+"queueHooks"))&&d.empty&&(e++,d.empty.add(i));return i(),f.promise(c)}});var L,M,N,O=/[\t\r\n]/g,P=/\r/g,Q=/^(?:button|input)$/i,R=/^(?:button|input|object|select|textarea)$/i,S=/^a(?:rea|)$/i,T=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,U=p.support.getSetAttribute;p.fn.extend({attr:function(a,b){return p.access(this,p.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{f=" "+e.className+" ";for(g=0,h=b.length;g<h;g++)~f.indexOf(" "+b[g]+" ")||(f+=b[g]+" ");e.className=p.trim(f)}}}return this},removeClass:function(a){var c,d,e,f,g,h,i;if(p.isFunction(a))return this.each(function(b){p(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(s);for(h=0,i=this.length;h<i;h++){e=this[h];if(e.nodeType===1&&e.className){d=(" "+e.className+" ").replace(O," ");for(f=0,g=c.length;f<g;f++)while(d.indexOf(" "+c[f]+" ")>-1)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(O," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c<d;c++){e=h[c];if(e.selected&&(p.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!p.nodeName(e.parentNode,"optgroup"))){b=p(e).val();if(i)return b;g.push(b)}}return i&&!g.length&&h.length?p(h[f]).val():g},set:function(a,b){var c=p.makeArray(b);return p(a).find("option").each(function(){this.selected=p.inArray(p(this).val(),c)>=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,""+d),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g<d.length;g++)e=d[g],e&&(c=p.propFix[e]||e,f=T.test(e),f||p.attr(a,e,""),a.removeAttribute(U?e:c),f&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(Q.test(a.nodeName)&&a.parentNode)p.error("type property can't be changed");else if(!p.support.radioValue&&b==="radio"&&p.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}},value:{get:function(a,b){return L&&p.nodeName(a,"button")?L.get(a,b):b in a?a.value:null},set:function(a,b,c){if(L&&p.nodeName(a,"button"))return L.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,f,g,h=a.nodeType;if(!a||h===3||h===8||h===2)return;return g=h!==1||!p.isXMLDoc(a),g&&(c=p.propFix[c]||c,f=p.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&(e=f.get(a,c))!==null?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):R.test(a.nodeName)||S.test(a.nodeName)&&a.href?0:b}}}}),M={get:function(a,c){var d,e=p.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;return b===!1?p.removeAttr(a,c):(d=p.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase())),c}},U||(N={name:!0,id:!0,coords:!0},L=p.valHooks.button={get:function(a,c){var d;return d=a.getAttributeNode(c),d&&(N[c]?d.value!=="":d.specified)?d.value:b},set:function(a,b,c){var d=a.getAttributeNode(c);return d||(d=e.createAttribute(c),a.setAttributeNode(d)),d.value=b+""}},p.each(["width","height"],function(a,b){p.attrHooks[b]=p.extend(p.attrHooks[b],{set:function(a,c){if(c==="")return a.setAttribute(b,"auto"),c}})}),p.attrHooks.contenteditable={get:L.get,set:function(a,b,c){b===""&&(b="false"),L.set(a,b,c)}}),p.support.hrefNormalized||p.each(["href","src","width","height"],function(a,c){p.attrHooks[c]=p.extend(p.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),p.support.style||(p.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),p.support.optSelected||(p.propHooks.selected=p.extend(p.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}})),p.support.enctype||(p.propFix.enctype="encoding"),p.support.checkOn||p.each(["radio","checkbox"],function(){p.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),p.each(["radio","checkbox"],function(){p.valHooks[this]=p.extend(p.valHooks[this],{set:function(a,b){if(p.isArray(b))return a.checked=p.inArray(p(a).val(),b)>=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j<c.length;j++){k=W.exec(c[j])||[],l=k[1],m=(k[2]||"").split(".").sort(),r=p.event.special[l]||{},l=(f?r.delegateType:r.bindType)||l,r=p.event.special[l]||{},n=p.extend({type:l,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,namespace:m.join(".")},o),q=i[l];if(!q){q=i[l]=[],q.delegateCount=0;if(!r.setup||r.setup.call(a,e,m,h)===!1)a.addEventListener?a.addEventListener(l,h,!1):a.attachEvent&&a.attachEvent("on"+l,h)}r.add&&(r.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),f?q.splice(q.delegateCount++,0,n):q.push(n),p.event.global[l]=!0}a=null},global:{},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,q,r=p.hasData(a)&&p._data(a);if(!r||!(m=r.events))return;b=p.trim(_(b||"")).split(" ");for(f=0;f<b.length;f++){g=W.exec(b[f])||[],h=i=g[1],j=g[2];if(!h){for(h in m)p.event.remove(a,h+b[f],c,d,!0);continue}n=p.event.special[h]||{},h=(d?n.delegateType:n.bindType)||h,o=m[h]||[],k=o.length,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(l=0;l<o.length;l++)q=o[l],(e||i===q.origType)&&(!c||c.guid===q.guid)&&(!j||j.test(q.namespace))&&(!d||d===q.selector||d==="**"&&q.selector)&&(o.splice(l--,1),q.selector&&o.delegateCount--,n.remove&&n.remove.call(a,q));o.length===0&&k!==o.length&&((!n.teardown||n.teardown.call(a,j,r.handle)===!1)&&p.removeEvent(a,h,r.handle),delete m[h])}p.isEmptyObject(m)&&(delete r.handle,p.removeData(a,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,f,g){if(!f||f.nodeType!==3&&f.nodeType!==8){var h,i,j,k,l,m,n,o,q,r,s=c.type||c,t=[];if($.test(s+p.event.triggered))return;s.indexOf("!")>=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;j<q.length&&!c.isPropagationStopped();j++)k=q[j][0],c.type=q[j][1],o=(p._data(k,"events")||{})[c.type]&&p._data(k,"handle"),o&&o.apply(k,d),o=m&&k[m],o&&p.acceptData(k)&&o.apply(k,d)===!1&&c.preventDefault();return c.type=s,!g&&!c.isDefaultPrevented()&&(!n._default||n._default.apply(f.ownerDocument,d)===!1)&&(s!=="click"||!p.nodeName(f,"a"))&&p.acceptData(f)&&m&&f[s]&&(s!=="focus"&&s!=="blur"||c.target.offsetWidth!==0)&&!p.isWindow(f)&&(l=f[m],l&&(f[m]=null),p.event.triggered=s,f[s](),p.event.triggered=b,l&&(f[m]=l)),c.result}return},dispatch:function(c){c=p.event.fix(c||a.event);var d,e,f,g,h,i,j,k,l,m,n,o=(p._data(this,"events")||{})[c.type]||[],q=o.delegateCount,r=[].slice.call(arguments),s=!c.exclusive&&!c.namespace,t=p.event.special[c.type]||{},u=[];r[0]=c,c.delegateTarget=this;if(t.preDispatch&&t.preDispatch.call(this,c)===!1)return;if(q&&(!c.button||c.type!=="click")){g=p(this),g.context=this;for(f=c.target;f!=this;f=f.parentNode||this)if(f.disabled!==!0||c.type!=="click"){i={},k=[],g[0]=f;for(d=0;d<q;d++)l=o[d],m=l.selector,i[m]===b&&(i[m]=g.is(m)),i[m]&&k.push(l);k.length&&u.push({elem:f,matches:k})}}o.length>q&&u.push({elem:this,matches:o.slice(q)});for(d=0;d<u.length&&!c.isPropagationStopped();d++){j=u[d],c.currentTarget=j.elem;for(e=0;e<j.matches.length&&!c.isImmediatePropagationStopped();e++){l=j.matches[e];if(s||!c.namespace&&!l.namespace||c.namespace_re&&c.namespace_re.test(l.namespace))c.data=l.data,c.handleObj=l,h=((p.event.special[l.origType]||{}).handle||l.handler).apply(j.elem,r),h!==b&&(c.result=h,h===!1&&(c.preventDefault(),c.stopPropagation()))}}return t.postDispatch&&t.postDispatch.call(this,c),c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,f,g,h=c.button,i=c.fromElement;return a.pageX==null&&c.clientX!=null&&(d=a.target.ownerDocument||e,f=d.documentElement,g=d.body,a.pageX=c.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=c.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?c.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0),a}},fix:function(a){if(a[p.expando])return a;var b,c,d=a,f=p.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=p.Event(d);for(b=g.length;b;)c=g[--b],a[c]=d[c];return a.target||(a.target=d.srcElement||e),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,f.filter?f.filter(a,d):a},special:{ready:{setup:p.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){p.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=p.extend(new p.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?p.event.trigger(e,null,b):p.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},p.event.handle=p.event.dispatch,p.removeEvent=e.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]=="undefined"&&(a[d]=null),a.detachEvent(d,c))},p.Event=function(a,b){if(this instanceof p.Event)a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?bb:ba):this.type=a,b&&p.extend(this,b),this.timeStamp=a&&a.timeStamp||p.now(),this[p.expando]=!0;else return new p.Event(a,b)},p.Event.prototype={preventDefault:function(){this.isDefaultPrevented=bb;var a=this.originalEvent;if(!a)return;a.preventDefault?a.preventDefault():a.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=bb;var a=this.originalEvent;if(!a)return;a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()},isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba},p.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){p.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj,g=f.selector;if(!e||e!==d&&!p.contains(d,e))a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b;return c}}}),p.support.submitBubbles||(p.event.special.submit={setup:function(){if(p.nodeName(this,"form"))return!1;p.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=p.nodeName(c,"input")||p.nodeName(c,"button")?c.form:b;d&&!p._data(d,"_submit_attached")&&(p.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),p._data(d,"_submit_attached",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&p.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(p.nodeName(this,"form"))return!1;p.event.remove(this,"._submit")}}),p.support.changeBubbles||(p.event.special.change={setup:function(){if(V.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")p.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),p.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),p.event.simulate("change",this,a,!0)});return!1}p.event.add(this,"beforeactivate._change",function(a){var b=a.target;V.test(b.nodeName)&&!p._data(b,"_change_attached")&&(p.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&p.event.simulate("change",this.parentNode,a,!0)}),p._data(b,"_change_attached",!0))})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){return p.event.remove(this,"._change"),V.test(this.nodeName)}}),p.support.focusinBubbles||p.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){p.event.simulate(b,a.target,p.event.fix(a),!0)};p.event.special[b]={setup:function(){c++===0&&e.addEventListener(a,d,!0)},teardown:function(){--c===0&&e.removeEventListener(a,d,!0)}}}),p.fn.extend({on:function(a,c,d,e,f){var g,h;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(h in a)this.on(h,c,d,a[h],f);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=ba;else if(!e)return this;return f===1&&(g=e,e=function(a){return p().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=p.guid++)),this.each(function(){p.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,p(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if(typeof a=="object"){for(f in a)this.off(f,c,a[f]);return this}if(c===!1||typeof c=="function")d=c,c=b;return d===!1&&(d=ba),this.each(function(){p.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){return p(this.context).on(a,this.selector,b,c),this},die:function(a,b){return p(this.context).off(a,this.selector||"**",b),this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a||"**",c)},trigger:function(a,b){return this.each(function(){p.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return p.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||p.guid++,d=0,e=function(c){var e=(p._data(this,"lastToggle"+a.guid)||0)%d;return p._data(this,"lastToggle"+a.guid,e+1),c.preventDefault(),b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),p.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){p.fn[b]=function(a,c){return c==null&&(c=a,a=null),arguments.length>0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function bd(a,b,c,d){var e=0,f=b.length;for(;e<f;e++)Z(a,b[e],c,d)}function be(a,b,c,d,e,f){var g,h=$.setFilters[b.toLowerCase()];return h||Z.error(b),(a||!(g=e))&&bd(a||"*",d,g=[],e),g.length>0?h(g,c,f):[]}function bf(a,c,d,e,f){var g,h,i,j,k,l,m,n,p=0,q=f.length,s=L.POS,t=new RegExp("^"+s.source+"(?!"+r+")","i"),u=function(){var a=1,c=arguments.length-2;for(;a<c;a++)arguments[a]===b&&(g[a]=b)};for(;p<q;p++){s.exec(""),a=f[p],j=[],i=0,k=e;while(g=s.exec(a)){n=s.lastIndex=g.index+g[0].length;if(n>i){m=a.slice(i,g.index),i=n,l=[c],B.test(m)&&(k&&(l=k),k=e);if(h=H.test(m))m=m.slice(0,-5).replace(B,"$&*");g.length>1&&g[0].replace(t,u),k=be(m,g[1],g[2],l,k,h)}}k?(j=j.concat(k),(m=a.slice(i))&&m!==")"?B.test(m)?bd(m,j,d,e):Z(m,c,d,e?e.concat(k):k):o.apply(d,j)):Z(a,c,d,e)}return q===1?d:Z.uniqueSort(d)}function bg(a,b,c){var d,e,f,g=[],i=0,j=D.exec(a),k=!j.pop()&&!j.pop(),l=k&&a.match(C)||[""],m=$.preFilter,n=$.filter,o=!c&&b!==h;for(;(e=l[i])!=null&&k;i++){g.push(d=[]),o&&(e=" "+e);while(e){k=!1;if(j=B.exec(e))e=e.slice(j[0].length),k=d.push({part:j.pop().replace(A," "),captures:j});for(f in n)(j=L[f].exec(e))&&(!m[f]||(j=m[f](j,b,c)))&&(e=e.slice(j.shift().length),k=d.push({part:f,captures:j}));if(!k)break}}return k||Z.error(a),g}function bh(a,b,e){var f=b.dir,g=m++;return a||(a=function(a){return a===e}),b.first?function(b,c){while(b=b[f])if(b.nodeType===1)return a(b,c)&&b}:function(b,e){var h,i=g+"."+d,j=i+"."+c;while(b=b[f])if(b.nodeType===1){if((h=b[q])===j)return b.sizset;if(typeof h=="string"&&h.indexOf(i)===0){if(b.sizset)return b}else{b[q]=j;if(a(b,e))return b.sizset=!0,b;b.sizset=!1}}}}function bi(a,b){return a?function(c,d){var e=b(c,d);return e&&a(e===!0?c:e,d)}:b}function bj(a,b,c){var d,e,f=0;for(;d=a[f];f++)$.relative[d.part]?e=bh(e,$.relative[d.part],b):(d.captures.push(b,c),e=bi(e,$.filter[d.part].apply(null,d.captures)));return e}function bk(a){return function(b,c){var d,e=0;for(;d=a[e];e++)if(d(b,c))return!0;return!1}}var c,d,e,f,g,h=a.document,i=h.documentElement,j="undefined",k=!1,l=!0,m=0,n=[].slice,o=[].push,q=("sizcache"+Math.random()).replace(".",""),r="[\\x20\\t\\r\\n\\f]",s="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",t=s.replace("w","w#"),u="([*^$|!~]?=)",v="\\["+r+"*("+s+")"+r+"*(?:"+u+r+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+t+")|)|)"+r+"*\\]",w=":("+s+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|((?:[^,]|\\\\,|(?:,(?=[^\\[]*\\]))|(?:,(?=[^\\(]*\\))))*))\\)|)",x=":(nth|eq|gt|lt|first|last|even|odd)(?:\\((\\d*)\\)|)(?=[^-]|$)",y=r+"*([\\x20\\t\\r\\n\\f>+~])"+r+"*",z="(?=[^\\x20\\t\\r\\n\\f])(?:\\\\.|"+v+"|"+w.replace(2,7)+"|[^\\\\(),])+",A=new RegExp("^"+r+"+|((?:^|[^\\\\])(?:\\\\.)*)"+r+"+$","g"),B=new RegExp("^"+y),C=new RegExp(z+"?(?="+r+"*,|$)","g"),D=new RegExp("^(?:(?!,)(?:(?:^|,)"+r+"*"+z+")*?|"+r+"*(.*?))(\\)|$)"),E=new RegExp(z.slice(19,-6)+"\\x20\\t\\r\\n\\f>+~])+|"+y,"g"),F=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,G=/[\x20\t\r\n\f]*[+~]/,H=/:not\($/,I=/h\d/i,J=/input|select|textarea|button/i,K=/\\(?!\\)/g,L={ID:new RegExp("^#("+s+")"),CLASS:new RegExp("^\\.("+s+")"),NAME:new RegExp("^\\[name=['\"]?("+s+")['\"]?\\]"),TAG:new RegExp("^("+s.replace("[-","[-\\*")+")"),ATTR:new RegExp("^"+v),PSEUDO:new RegExp("^"+w),CHILD:new RegExp("^:(only|nth|last|first)-child(?:\\("+r+"*(even|odd|(([+-]|)(\\d*)n|)"+r+"*(?:([+-]|)"+r+"*(\\d+)|))"+r+"*\\)|)","i"),POS:new RegExp(x,"ig"),needsContext:new RegExp("^"+r+"*[>+~]|"+x,"i")},M={},N=[],O={},P=[],Q=function(a){return a.sizzleFilter=!0,a},R=function(a){return function(b){return b.nodeName.toLowerCase()==="input"&&b.type===a}},S=function(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}},T=function(a){var b=!1,c=h.createElement("div");try{b=a(c)}catch(d){}return c=null,b},U=T(function(a){a.innerHTML="<select></select>";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),V=T(function(a){a.id=q+0,a.innerHTML="<a name='"+q+"'></a><div name='"+q+"'></div>",i.insertBefore(a,i.firstChild);var b=h.getElementsByName&&h.getElementsByName(q).length===2+h.getElementsByName(q+0).length;return g=!h.getElementById(q),i.removeChild(a),b}),W=T(function(a){return a.appendChild(h.createComment("")),a.getElementsByTagName("*").length===0}),X=T(function(a){return a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!==j&&a.firstChild.getAttribute("href")==="#"}),Y=T(function(a){return a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!a.getElementsByClassName||a.getElementsByClassName("e").length===0?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length!==1)}),Z=function(a,b,c,d){c=c||[],b=b||h;var e,f,g,i,j=b.nodeType;if(j!==1&&j!==9)return[];if(!a||typeof a!="string")return c;g=ba(b);if(!g&&!d)if(e=F.exec(a))if(i=e[1]){if(j===9){f=b.getElementById(i);if(!f||!f.parentNode)return c;if(f.id===i)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(i))&&bb(b,f)&&f.id===i)return c.push(f),c}else{if(e[2])return o.apply(c,n.call(b.getElementsByTagName(a),0)),c;if((i=e[3])&&Y&&b.getElementsByClassName)return o.apply(c,n.call(b.getElementsByClassName(i),0)),c}return bm(a,b,c,d,g)},$=Z.selectors={cacheLength:50,match:L,order:["ID","TAG"],attrHandle:{},createPseudo:Q,find:{ID:g?function(a,b,c){if(typeof b.getElementById!==j&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==j&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==j&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:W?function(a,b){if(typeof b.getElementsByTagName!==j)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(K,""),a[3]=(a[4]||a[5]||"").replace(K,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||Z.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&Z.error(a[0]),a},PSEUDO:function(a){var b,c=a[4];return L.CHILD.test(a[0])?null:(c&&(b=D.exec(c))&&b.pop()&&(a[0]=a[0].slice(0,b[0].length-c.length-1),c=b[0].slice(0,-1)),a.splice(2,3,c||a[3]),a)}},filter:{ID:g?function(a){return a=a.replace(K,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(K,""),function(b){var c=typeof b.getAttributeNode!==j&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(K,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=M[a];return b||(b=M[a]=new RegExp("(^|"+r+")"+a+"("+r+"|$)"),N.push(a),N.length>$.cacheLength&&delete M[N.shift()]),function(a){return b.test(a.className||typeof a.getAttribute!==j&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return b?function(d){var e=Z.attr(d,a),f=e+"";if(e==null)return b==="!=";switch(b){case"=":return f===c;case"!=":return f!==c;case"^=":return c&&f.indexOf(c)===0;case"*=":return c&&f.indexOf(c)>-1;case"$=":return c&&f.substr(f.length-c.length)===c;case"~=":return(" "+f+" ").indexOf(c)>-1;case"|=":return f===c||f.substr(0,c.length+1)===c+"-"}}:function(b){return Z.attr(b,a)!=null}},CHILD:function(a,b,c,d){if(a==="nth"){var e=m++;return function(a){var b,f,g=0,h=a;if(c===1&&d===0)return!0;b=a.parentNode;if(b&&(b[q]!==e||!a.sizset)){for(h=b.firstChild;h;h=h.nextSibling)if(h.nodeType===1){h.sizset=++g;if(h===a)break}b[q]=e}return f=a.sizset-d,c===0?f===0:f%c===0&&f/c>=0}}return function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b,c,d){var e=$.pseudos[a]||$.pseudos[a.toLowerCase()];return e||Z.error("unsupported pseudo: "+a),e.sizzleFilter?e(b,c,d):e}},pseudos:{not:Q(function(a,b,c){var d=bl(a.replace(A,"$1"),b,c);return function(a){return!d(a)}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!$.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},contains:Q(function(a){return function(b){return(b.textContent||b.innerText||bc(b)).indexOf(a)>-1}}),has:Q(function(a){return function(b){return Z(a,b).length>0}}),header:function(a){return I.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:R("radio"),checkbox:R("checkbox"),file:R("file"),password:R("password"),image:R("image"),submit:S("submit"),reset:S("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return J.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b,c){return c?a.slice(1):[a[0]]},last:function(a,b,c){var d=a.pop();return c?a:[d]},even:function(a,b,c){var d=[],e=c?1:0,f=a.length;for(;e<f;e=e+2)d.push(a[e]);return d},odd:function(a,b,c){var d=[],e=c?0:1,f=a.length;for(;e<f;e=e+2)d.push(a[e]);return d},lt:function(a,b,c){return c?a.slice(+b):a.slice(0,+b)},gt:function(a,b,c){return c?a.slice(0,+b+1):a.slice(+b+1)},eq:function(a,b,c){var d=a.splice(+b,1);return c?a:d}}};$.setFilters.nth=$.setFilters.eq,$.filters=$.pseudos,X||($.attrHandle={href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}}),V&&($.order.push("NAME"),$.find.NAME=function(a,b){if(typeof b.getElementsByName!==j)return b.getElementsByName(a)}),Y&&($.order.splice(1,0,"CLASS"),$.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!==j&&!c)return b.getElementsByClassName(a)});try{n.call(i.childNodes,0)[0].nodeType}catch(_){n=function(a){var b,c=[];for(;b=this[a];a++)c.push(b);return c}}var ba=Z.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?b.nodeName!=="HTML":!1},bb=Z.contains=i.compareDocumentPosition?function(a,b){return!!(a.compareDocumentPosition(b)&16)}:i.contains?function(a,b){var c=a.nodeType===9?a.documentElement:a,d=b.parentNode;return a===d||!!(d&&d.nodeType===1&&c.contains&&c.contains(d))}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1},bc=Z.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(e===1||e===9||e===11){if(typeof a.textContent=="string")return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=bc(a)}else if(e===3||e===4)return a.nodeValue}else for(;b=a[d];d++)c+=bc(b);return c};Z.attr=function(a,b){var c,d=ba(a);return d||(b=b.toLowerCase()),$.attrHandle[b]?$.attrHandle[b](a):U||d?a.getAttribute(b):(c=a.getAttributeNode(b),c?typeof a[b]=="boolean"?a[b]?b:null:c.specified?c.value:null:null)},Z.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},[0,0].sort(function(){return l=0}),i.compareDocumentPosition?e=function(a,b){return a===b?(k=!0,0):(!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition:a.compareDocumentPosition(b)&4)?-1:1}:(e=function(a,b){if(a===b)return k=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],g=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return f(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)g.unshift(j),j=j.parentNode;c=e.length,d=g.length;for(var l=0;l<c&&l<d;l++)if(e[l]!==g[l])return f(e[l],g[l]);return l===c?f(a,g[l],-1):f(e[l],b,1)},f=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),Z.uniqueSort=function(a){var b,c=1;if(e){k=l,a.sort(e);if(k)for(;b=a[c];c++)b===a[c-1]&&a.splice(c--,1)}return a};var bl=Z.compile=function(a,b,c){var d,e,f,g=O[a];if(g&&g.context===b)return g;e=bg(a,b,c);for(f=0;d=e[f];f++)e[f]=bj(d,b,c);return g=O[a]=bk(e),g.context=b,g.runs=g.dirruns=0,P.push(a),P.length>$.cacheLength&&delete O[P.shift()],g};Z.matches=function(a,b){return Z(a,null,null,b)},Z.matchesSelector=function(a,b){return Z(b,null,null,[a]).length>0};var bm=function(a,b,e,f,g){a=a.replace(A,"$1");var h,i,j,k,l,m,p,q,r,s=a.match(C),t=a.match(E),u=b.nodeType;if(L.POS.test(a))return bf(a,b,e,f,s);if(f)h=n.call(f,0);else if(s&&s.length===1){if(t.length>1&&u===9&&!g&&(s=L.ID.exec(t[0]))){b=$.find.ID(s[1],b,g)[0];if(!b)return e;a=a.slice(t.shift().length)}q=(s=G.exec(t[0]))&&!s.index&&b.parentNode||b,r=t.pop(),m=r.split(":not")[0];for(j=0,k=$.order.length;j<k;j++){p=$.order[j];if(s=L[p].exec(m)){h=$.find[p]((s[1]||"").replace(K,""),q,g);if(h==null)continue;m===r&&(a=a.slice(0,a.length-r.length)+m.replace(L[p],""),a||o.apply(e,n.call(h,0)));break}}}if(a){i=bl(a,b,g),d=i.dirruns++,h==null&&(h=$.find.TAG("*",G.test(a)&&b.parentNode||b));for(j=0;l=h[j];j++)c=i.runs++,i(l,b)&&e.push(l)}return e};h.querySelectorAll&&function(){var a,b=bm,c=/'|\\/g,d=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,e=[],f=[":active"],g=i.matchesSelector||i.mozMatchesSelector||i.webkitMatchesSelector||i.oMatchesSelector||i.msMatchesSelector;T(function(a){a.innerHTML="<select><option selected></option></select>",a.querySelectorAll("[selected]").length||e.push("\\["+r+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),T(function(a){a.innerHTML="<p test=''></p>",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+r+"*(?:\"\"|'')"),a.innerHTML="<input type='hidden'>",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=e.length&&new RegExp(e.join("|")),bm=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a)))if(d.nodeType===9)try{return o.apply(f,n.call(d.querySelectorAll(a),0)),f}catch(i){}else if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){var j=d.getAttribute("id"),k=j||q,l=G.test(a)&&d.parentNode||d;j?k=k.replace(c,"\\$&"):d.setAttribute("id",k);try{return o.apply(f,n.call(l.querySelectorAll(a.replace(C,"[id='"+k+"'] $&")),0)),f}catch(i){}finally{j||d.removeAttribute("id")}}return b(a,d,f,g,h)},g&&(T(function(b){a=g.call(b,"div");try{g.call(b,"[test!='']:sizzle"),f.push($.match.PSEUDO)}catch(c){}}),f=new RegExp(f.join("|")),Z.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!ba(b)&&!f.test(c)&&(!e||!e.test(c)))try{var h=g.call(b,c);if(h||a||b.document&&b.document.nodeType!==11)return h}catch(i){}return Z(c,null,null,[b]).length>0})}(),Z.attr=p.attr,p.find=Z,p.expr=Z.selectors,p.expr[":"]=p.expr.pseudos,p.unique=Z.uniqueSort,p.text=Z.getText,p.isXMLDoc=Z.isXML,p.contains=Z.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b<c;b++)if(p.contains(h[b],this))return!0});g=this.pushStack("","find",a);for(b=0,c=this.length;b<c;b++){d=g.length,p.find(a,this[b],g);if(b>0)for(e=d;e<g.length;e++)for(f=0;f<d;f++)if(g[f]===g[e]){g.splice(e--,1);break}}return g},has:function(a){var b,c=p(a,this),d=c.length;return this.filter(function(){for(b=0;b<d;b++)if(p.contains(this,c[b]))return!0})},not:function(a){return this.pushStack(bj(this,a,!1),"not",a)},filter:function(a){return this.pushStack(bj(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?bf.test(a)?p(a,this.context).index(this[0])>=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d<e;d++){c=this[d];while(c&&c.ownerDocument&&c!==b&&c.nodeType!==11){if(g?g.index(c)>-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/<tbody/i,br=/<|&#?\w+;/,bs=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,bu=new RegExp("<(?:"+bl+")[\\s/>]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,bz={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X<div>","</div>"]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){return bh(this[0])?this.length?this.pushStack(p(p.isFunction(a)?a():a),"replaceWith",a):this:p.isFunction(a)?this.each(function(b){var c=p(this),d=c.html();c.replaceWith(a.call(this,b,d))}):(typeof a!="string"&&(a=p(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;p(this).remove(),b?p(b).before(a):p(c).append(a)}))},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=[].concat.apply([],a);var e,f,g,h,i=0,j=a[0],k=[],l=this.length;if(!p.support.checkClone&&l>1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i<l;i++)d.call(c&&p.nodeName(this[i],"table")?bC(this[i],"tbody"):this[i],i===h?g:p.clone(g,!0,!0))}g=f=null,k.length&&p.each(k,function(a,b){b.src?p.ajax?p.ajax({url:b.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):p.error("no ajax"):p.globalEval((b.text||b.textContent||b.innerHTML||"").replace(by,"")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),p.buildFragment=function(a,c,d){var f,g,h,i=a[0];return c=c||e,c=(c[0]||c).ownerDocument||c[0]||c,typeof c.createDocumentFragment=="undefined"&&(c=e),a.length===1&&typeof i=="string"&&i.length<512&&c===e&&i.charAt(0)==="<"&&!bt.test(i)&&(p.support.checkClone||!bw.test(i))&&(p.support.html5Clone||!bu.test(i))&&(g=!0,f=p.fragments[i],h=f!==b),f||(f=c.createDocumentFragment(),p.clean(a,c,f,d),g&&(p.fragments[i]=h&&f)),{fragment:f,cacheable:g}},p.fragments={},p.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){p.fn[a]=function(c){var d,e=0,f=[],g=p(c),h=g.length,i=this.length===1&&this[0].parentNode;if((i==null||i&&i.nodeType===11&&i.childNodes.length===1)&&h===1)return g[b](this[0]),this;for(;e<h;e++)d=(e>0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=0,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(g=b===e&&bA;(h=a[s])!=null;s++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{g=g||bk(b),l=l||g.appendChild(b.createElement("div")),h=h.replace(bo,"<$1></$2>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]==="<table>"&&!m?l.childNodes:[];for(f=n.length-1;f>=0;--f)p.nodeName(n[f],"tbody")&&!n[f].childNodes.length&&n[f].parentNode.removeChild(n[f])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l=g.lastChild}h.nodeType?t.push(h):t=p.merge(t,h)}l&&(g.removeChild(l),h=l=g=null);if(!p.support.appendChecked)for(s=0;(h=t[s])!=null;s++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(s=0;(h=t[s])!=null;s++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[s+1,0].concat(r)),s+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^margin/,bO=new RegExp("^("+q+")(.*)$","i"),bP=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bQ=new RegExp("^([-+])=("+q+")","i"),bR={},bS={position:"absolute",visibility:"hidden",display:"block"},bT={letterSpacing:0,fontWeight:400,lineHeight:1},bU=["Top","Right","Bottom","Left"],bV=["Webkit","O","Moz","ms"],bW=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return bZ(this,!0)},hide:function(){return bZ(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bW.apply(this,arguments):this.each(function(){(c?a:bY(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bX(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bQ.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bX(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bT&&(f=bT[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(a,b){var c,d,e,f,g=getComputedStyle(a,null),h=a.style;return g&&(c=g[b],c===""&&!p.contains(a.ownerDocument.documentElement,a)&&(c=p.style(a,b)),bP.test(c)&&bN.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=c,c=g.width,h.width=d,h.minWidth=e,h.maxWidth=f)),c}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bP.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0||bH(a,"display")!=="none"?ca(a,b,d):p.swap(a,bS,function(){return ca(a,b,d)})},set:function(a,c,d){return b$(a,c,d?b_(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bP.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bU[d]+b]=e[d]||e[d-2]||e[0];return f}},bN.test(a)||(p.cssHooks[a+b].set=b$)});var cc=/%20/g,cd=/\[\]$/,ce=/\r?\n/g,cf=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,cg=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||cg.test(this.nodeName)||cf.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(ce,"\r\n")}}):{name:b.name,value:c.replace(ce,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ch(d,a[d],c,f);return e.join("&").replace(cc,"+")};var ci,cj,ck=/#.*$/,cl=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cm=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,cn=/^(?:GET|HEAD)$/,co=/^\/\//,cp=/\?/,cq=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,cr=/([?&])_=[^&]*/,cs=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,ct=p.fn.load,cu={},cv={},cw=["*/"]+["*"];try{ci=f.href}catch(cx){ci=e.createElement("a"),ci.href="",ci=ci.href}cj=cs.exec(ci.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&ct)return ct.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("<div>").append(a.replace(cq,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cA(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cA(a,b),a},ajaxSettings:{url:ci,isLocal:cm.test(cj[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cw},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cy(cu),ajaxTransport:cy(cv),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cB(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cC(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=""+(c||y),k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cl.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(ck,"").replace(co,cj[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=cs.exec(l.url.toLowerCase()),l.crossDomain=!(!i||i[1]==cj[1]&&i[2]==cj[2]&&(i[3]||(i[1]==="http:"?80:443))==(cj[3]||(cj[1]==="http:"?80:443)))),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cz(cu,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!cn.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cp.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cr,"$1_="+z);l.url=A+(A===l.url?(cp.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cw+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cz(cv,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cD=[],cE=/\?/,cF=/(=)\?(?=&|$)|\?\?/,cG=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cD.pop()||p.expando+"_"+cG++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cF.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cF.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cF,"$1"+f):m?c.data=i.replace(cF,"$1"+f):k&&(c.url+=(cE.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cD.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cH,cI=a.ActiveXObject?function(){for(var a in cH)cH[a](0,1)}:!1,cJ=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cK()||cL()}:cK,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cI&&delete cH[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cJ,cI&&(cH||(cH={},p(a).unload(cI)),cH[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cM,cN,cO=/^(?:toggle|show|hide)$/,cP=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cQ=/queueHooks$/,cR=[cX],cS={"*":[function(a,b){var c,d,e,f=this.createTween(a,b),g=cP.exec(b),h=f.cur(),i=+h||0,j=1;if(g){c=+g[2],d=g[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&i){i=p.css(f.elem,a,!0)||c||1;do e=j=j||".5",i=i/j,p.style(f.elem,a,i+d),j=f.cur()/h;while(j!==1&&j!==e)}f.unit=d,f.start=i,f.end=g[1]?i+(g[1]+1)*c:c}return f}]};p.Animation=p.extend(cV,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d<e;d++)c=a[d],cS[c]=cS[c]||[],cS[c].unshift(b)},prefilter:function(a,b){b?cR.unshift(a):cR.push(a)}}),p.Tween=cY,cY.prototype={constructor:cY,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(p.cssNumber[c]?"":"px")},cur:function(){var a=cY.propHooks[this.prop];return a&&a.get?a.get(this):cY.propHooks._default.get(this)},run:function(a){var b,c=cY.propHooks[this.prop];return this.pos=b=p.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration),this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):cY.propHooks._default.set(this),this}},cY.prototype.init.prototype=cY.prototype,cY.propHooks={_default:{get:function(a){var b;return a.elem[a.prop]==null||!!a.elem.style&&a.elem.style[a.prop]!=null?(b=p.css(a.elem,a.prop,!1,""),!b||b==="auto"?0:b):a.elem[a.prop]},set:function(a){p.fx.step[a.prop]?p.fx.step[a.prop](a):a.elem.style&&(a.elem.style[p.cssProps[a.prop]]!=null||p.cssHooks[a.prop])?p.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},cY.propHooks.scrollTop=cY.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},p.each(["toggle","show","hide"],function(a,b){var c=p.fn[b];p.fn[b]=function(d,e,f){return d==null||typeof d=="boolean"||!a&&p.isFunction(d)&&p.isFunction(e)?c.apply(this,arguments):this.animate(cZ(b,!0),d,e,f)}}),p.fn.extend({fadeTo:function(a,b,c,d){return this.filter(bY).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=p.isEmptyObject(a),f=p.speed(b,c,d),g=function(){var b=cV(this,p.extend({},a),f);e&&b.stop(!0)};return e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,c,d){var e=function(a){var b=a.stop;delete a.stop,b(d)};return typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,c=a!=null&&a+"queueHooks",f=p.timers,g=p._data(this);if(c)g[c]&&g[c].stop&&e(g[c]);else for(c in g)g[c]&&g[c].stop&&cQ.test(c)&&e(g[c]);for(c=f.length;c--;)f[c].elem===this&&(a==null||f[c].queue===a)&&(f[c].anim.stop(d),b=!1,f.splice(c,1));(b||!d)&&p.dequeue(this,a)})}}),p.each({slideDown:cZ("show"),slideUp:cZ("hide"),slideToggle:cZ("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){p.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),p.speed=function(a,b,c){var d=a&&typeof a=="object"?p.extend({},a):{complete:c||!c&&b||p.isFunction(a)&&a,duration:a,easing:c&&b||b&&!p.isFunction(b)&&b};d.duration=p.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in p.fx.speeds?p.fx.speeds[d.duration]:p.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";return d.old=d.complete,d.complete=function(){p.isFunction(d.old)&&d.old.call(this),d.queue&&p.dequeue(this,d.queue)},d},p.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},p.timers=[],p.fx=cY.prototype.init,p.fx.tick=function(){var a,b=p.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||p.fx.stop()},p.fx.timer=function(a){a()&&p.timers.push(a)&&!cN&&(cN=setInterval(p.fx.tick,p.fx.interval))},p.fx.interval=13,p.fx.stop=function(){clearInterval(cN),cN=null},p.fx.speeds={slow:600,fast:200,_default:400},p.fx.step={},p.expr&&p.expr.filters&&(p.expr.filters.animated=function(a){return p.grep(p.timers,function(b){return a===b.elem}).length});var c$=/^(?:body|html)$/i;p.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){p.offset.setOffset(this,a,b)});var c,d,e,f,g,h,i,j,k,l,m=this[0],n=m&&m.ownerDocument;if(!n)return;return(e=n.body)===m?p.offset.bodyOffset(m):(d=n.documentElement,p.contains(d,m)?(c=m.getBoundingClientRect(),f=c_(n),g=d.clientTop||e.clientTop||0,h=d.clientLeft||e.clientLeft||0,i=f.pageYOffset||d.scrollTop,j=f.pageXOffset||d.scrollLeft,k=c.top+i-g,l=c.left+j-h,{top:k,left:l}):{top:0,left:0})},p.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;return p.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(p.css(a,"marginTop"))||0,c+=parseFloat(p.css(a,"marginLeft"))||0),{top:b,left:c}},setOffset:function(a,b,c){var d=p.css(a,"position");d==="static"&&(a.style.position="relative");var e=p(a),f=e.offset(),g=p.css(a,"top"),h=p.css(a,"left"),i=(d==="absolute"||d==="fixed")&&p.inArray("auto",[g,h])>-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c$.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c$.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=c_(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g)}})}),a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window); \ No newline at end of file
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery.ba-bbq.min.js b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery.ba-bbq.min.js
new file mode 100644
index 0000000..8c1ae26
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery.ba-bbq.min.js
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+(function($,p){var i,m=Array.prototype.slice,r=decodeURIComponent,a=$.param,c,l,v,b=$.bbq=$.bbq||{},q,u,j,e=$.event.special,d="hashchange",A="querystring",D="fragment",y="elemUrlAttr",g="location",k="href",t="src",x=/^.*\?|#.*$/g,w=/^.*\#/,h,C={};function E(F){return typeof F==="string"}function B(G){var F=m.call(arguments,1);return function(){return G.apply(this,F.concat(m.call(arguments)))}}function n(F){return F.replace(/^[^#]*#?(.*)$/,"$1")}function o(F){return F.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(H,M,F,I,G){var O,L,K,N,J;if(I!==i){K=F.match(H?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);J=K[3]||"";if(G===2&&E(I)){L=I.replace(H?w:x,"")}else{N=l(K[2]);I=E(I)?l[H?D:A](I):I;L=G===2?I:G===1?$.extend({},I,N):$.extend({},N,I);L=a(L);if(H){L=L.replace(h,r)}}O=K[1]+(H?"#":L||!K[1]?"?":"")+L+J}else{O=M(F!==i?F:p[g][k])}return O}a[A]=B(f,0,o);a[D]=c=B(f,1,n);c.noEscape=function(G){G=G||"";var F=$.map(G.split(""),encodeURIComponent);h=new RegExp(F.join("|"),"g")};c.noEscape(",/");$.deparam=l=function(I,F){var H={},G={"true":!0,"false":!1,"null":null};$.each(I.replace(/\+/g," ").split("&"),function(L,Q){var K=Q.split("="),P=r(K[0]),J,O=H,M=0,R=P.split("]["),N=R.length-1;if(/\[/.test(R[0])&&/\]$/.test(R[N])){R[N]=R[N].replace(/\]$/,"");R=R.shift().split("[").concat(R);N=R.length-1}else{N=0}if(K.length===2){J=r(K[1]);if(F){J=J&&!isNaN(J)?+J:J==="undefined"?i:G[J]!==i?G[J]:J}if(N){for(;M<=N;M++){P=R[M]===""?O.length:R[M];O=O[P]=M<N?O[P]||(R[M+1]&&isNaN(R[M+1])?{}:[]):J}}else{if($.isArray(H[P])){H[P].push(J)}else{if(H[P]!==i){H[P]=[H[P],J]}else{H[P]=J}}}}else{if(P){H[P]=F?i:""}}});return H};function z(H,F,G){if(F===i||typeof F==="boolean"){G=F;F=a[H?D:A]()}else{F=E(F)?F.replace(H?w:x,""):F}return l(F,G)}l[A]=B(z,0);l[D]=v=B(z,1);$[y]||($[y]=function(F){return $.extend(C,F)})({a:k,base:k,iframe:t,img:t,input:t,form:"action",link:k,script:t});j=$[y];function s(I,G,H,F){if(!E(H)&&typeof H!=="object"){F=H;H=G;G=i}return this.each(function(){var L=$(this),J=G||j()[(this.nodeName||"").toLowerCase()]||"",K=J&&L.attr(J)||"";L.attr(J,a[I](K,H,F))})}$.fn[A]=B(s,A);$.fn[D]=B(s,D);b.pushState=q=function(I,F){if(E(I)&&/^#/.test(I)&&F===i){F=2}var H=I!==i,G=c(p[g][k],H?I:{},H?F:2);p[g][k]=G+(/#/.test(G)?"":"#")};b.getState=u=function(F,G){return F===i||typeof F==="boolean"?v(F):v(G)[F]};b.removeState=function(F){var G={};if(F!==i){G=u();$.each($.isArray(F)?F:arguments,function(I,H){delete G[H]})}q(G,2)};e[d]=$.extend(e[d],{add:function(F){var H;function G(J){var I=J[D]=c();J.getState=function(K,L){return K===i||typeof K==="boolean"?l(I,K):l(I,L)[K]};H.apply(this,arguments)}if($.isFunction(F)){H=F;return G}else{H=F.handler;F.handler=G}}})})(jQuery,this);
+/*
+ * jQuery hashchange event - v1.2 - 2/11/2010
+ * http://benalman.com/projects/jquery-hashchange-plugin/
+ *
+ * Copyright (c) 2010 "Cowboy" Ben Alman
+ * Dual licensed under the MIT and GPL licenses.
+ * http://benalman.com/about/license/
+ */
+(function($,i,b){var j,k=$.event.special,c="location",d="hashchange",l="href",f=$.browser,g=document.documentMode,h=f.msie&&(g===b||g<8),e="on"+d in i&&!h;function a(m){m=m||i[c][l];return m.replace(/^[^#]*#?(.*)$/,"$1")}$[d+"Delay"]=100;k[d]=$.extend(k[d],{setup:function(){if(e){return false}$(j.start)},teardown:function(){if(e){return false}$(j.stop)}});j=(function(){var m={},r,n,o,q;function p(){o=q=function(s){return s};if(h){n=$('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this); \ No newline at end of file
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery.slideto.min.js b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery.slideto.min.js
new file mode 100644
index 0000000..09b1584
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery.slideto.min.js
@@ -0,0 +1,16 @@
+/*
+ * 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.
+ */
+(function(b){b.fn.slideto=function(a){a=b.extend({slide_duration:"slow",highlight_duration:3E3,highlight:true,highlight_color:"#FFFF99"},a);return this.each(function(){obj=b(this);b("body").animate({scrollTop:obj.offset().top},a.slide_duration,function(){a.highlight&&b.ui.version&&obj.effect("highlight",{color:a.highlight_color},a.highlight_duration)})})}})(jQuery);
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery.wiggle.min.js b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery.wiggle.min.js
new file mode 100644
index 0000000..6d9404d
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/jquery.wiggle.min.js
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+/*
+jQuery Wiggle
+Author: WonderGroup, Jordan Thomas
+URL: http://labs.wondergroup.com/demos/mini-ui/index.html
+License: MIT (http://en.wikipedia.org/wiki/MIT_License)
+*/
+jQuery.fn.wiggle=function(o){var d={speed:50,wiggles:3,travel:5,callback:null};var o=jQuery.extend(d,o);return this.each(function(){var cache=this;var wrap=jQuery(this).wrap('<div class="wiggle-wrap"></div>').css("position","relative");var calls=0;for(i=1;i<=o.wiggles;i++){jQuery(this).animate({left:"-="+o.travel},o.speed).animate({left:"+="+o.travel*2},o.speed*2).animate({left:"-="+o.travel},o.speed,function(){calls++;if(jQuery(cache).parent().hasClass('wiggle-wrap')){jQuery(cache).parent().replaceWith(cache);}
+if(calls==o.wiggles&&jQuery.isFunction(o.callback)){o.callback();}});}});}; \ No newline at end of file
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/marked.js b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/marked.js
new file mode 100644
index 0000000..5111145
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/marked.js
@@ -0,0 +1,1281 @@
+/*
+ * 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.
+ */
+;(function() {
+
+/**
+ * Block-Level Grammar
+ */
+
+var block = {
+ newline: /^\n+/,
+ code: /^( {4}[^\n]+\n*)+/,
+ fences: noop,
+ hr: /^( *[-*_]){3,} *(?:\n+|$)/,
+ heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,
+ nptable: noop,
+ lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,
+ blockquote: /^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,
+ list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
+ html: /^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,
+ table: noop,
+ paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,
+ text: /^[^\n]+/
+};
+
+block.bullet = /(?:[*+-]|\d+\.)/;
+block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;
+block.item = replace(block.item, 'gm')
+ (/bull/g, block.bullet)
+ ();
+
+block.list = replace(block.list)
+ (/bull/g, block.bullet)
+ ('hr', '\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))')
+ ('def', '\\n+(?=' + block.def.source + ')')
+ ();
+
+block.blockquote = replace(block.blockquote)
+ ('def', block.def)
+ ();
+
+block._tag = '(?!(?:'
+ + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code'
+ + '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo'
+ + '|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b';
+
+block.html = replace(block.html)
+ ('comment', /<!--[\s\S]*?-->/)
+ ('closed', /<(tag)[\s\S]+?<\/\1>/)
+ ('closing', /<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)
+ (/tag/g, block._tag)
+ ();
+
+block.paragraph = replace(block.paragraph)
+ ('hr', block.hr)
+ ('heading', block.heading)
+ ('lheading', block.lheading)
+ ('blockquote', block.blockquote)
+ ('tag', '<' + block._tag)
+ ('def', block.def)
+ ();
+
+/**
+ * Normal Block Grammar
+ */
+
+block.normal = merge({}, block);
+
+/**
+ * GFM Block Grammar
+ */
+
+block.gfm = merge({}, block.normal, {
+ fences: /^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,
+ paragraph: /^/
+});
+
+block.gfm.paragraph = replace(block.paragraph)
+ ('(?!', '(?!'
+ + block.gfm.fences.source.replace('\\1', '\\2') + '|'
+ + block.list.source.replace('\\1', '\\3') + '|')
+ ();
+
+/**
+ * GFM + Tables Block Grammar
+ */
+
+block.tables = merge({}, block.gfm, {
+ nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,
+ table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/
+});
+
+/**
+ * Block Lexer
+ */
+
+function Lexer(options) {
+ this.tokens = [];
+ this.tokens.links = {};
+ this.options = options || marked.defaults;
+ this.rules = block.normal;
+
+ if (this.options.gfm) {
+ if (this.options.tables) {
+ this.rules = block.tables;
+ } else {
+ this.rules = block.gfm;
+ }
+ }
+}
+
+/**
+ * Expose Block Rules
+ */
+
+Lexer.rules = block;
+
+/**
+ * Static Lex Method
+ */
+
+Lexer.lex = function(src, options) {
+ var lexer = new Lexer(options);
+ return lexer.lex(src);
+};
+
+/**
+ * Preprocessing
+ */
+
+Lexer.prototype.lex = function(src) {
+ src = src
+ .replace(/\r\n|\r/g, '\n')
+ .replace(/\t/g, ' ')
+ .replace(/\u00a0/g, ' ')
+ .replace(/\u2424/g, '\n');
+
+ return this.token(src, true);
+};
+
+/**
+ * Lexing
+ */
+
+Lexer.prototype.token = function(src, top, bq) {
+ var src = src.replace(/^ +$/gm, '')
+ , next
+ , loose
+ , cap
+ , bull
+ , b
+ , item
+ , space
+ , i
+ , l;
+
+ while (src) {
+ // newline
+ if (cap = this.rules.newline.exec(src)) {
+ src = src.substring(cap[0].length);
+ if (cap[0].length > 1) {
+ this.tokens.push({
+ type: 'space'
+ });
+ }
+ }
+
+ // code
+ if (cap = this.rules.code.exec(src)) {
+ src = src.substring(cap[0].length);
+ cap = cap[0].replace(/^ {4}/gm, '');
+ this.tokens.push({
+ type: 'code',
+ text: !this.options.pedantic
+ ? cap.replace(/\n+$/, '')
+ : cap
+ });
+ continue;
+ }
+
+ // fences (gfm)
+ if (cap = this.rules.fences.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'code',
+ lang: cap[2],
+ text: cap[3]
+ });
+ continue;
+ }
+
+ // heading
+ if (cap = this.rules.heading.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'heading',
+ depth: cap[1].length,
+ text: cap[2]
+ });
+ continue;
+ }
+
+ // table no leading pipe (gfm)
+ if (top && (cap = this.rules.nptable.exec(src))) {
+ src = src.substring(cap[0].length);
+
+ item = {
+ type: 'table',
+ header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
+ align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
+ cells: cap[3].replace(/\n$/, '').split('\n')
+ };
+
+ for (i = 0; i < item.align.length; i++) {
+ if (/^ *-+: *$/.test(item.align[i])) {
+ item.align[i] = 'right';
+ } else if (/^ *:-+: *$/.test(item.align[i])) {
+ item.align[i] = 'center';
+ } else if (/^ *:-+ *$/.test(item.align[i])) {
+ item.align[i] = 'left';
+ } else {
+ item.align[i] = null;
+ }
+ }
+
+ for (i = 0; i < item.cells.length; i++) {
+ item.cells[i] = item.cells[i].split(/ *\| */);
+ }
+
+ this.tokens.push(item);
+
+ continue;
+ }
+
+ // lheading
+ if (cap = this.rules.lheading.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'heading',
+ depth: cap[2] === '=' ? 1 : 2,
+ text: cap[1]
+ });
+ continue;
+ }
+
+ // hr
+ if (cap = this.rules.hr.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'hr'
+ });
+ continue;
+ }
+
+ // blockquote
+ if (cap = this.rules.blockquote.exec(src)) {
+ src = src.substring(cap[0].length);
+
+ this.tokens.push({
+ type: 'blockquote_start'
+ });
+
+ cap = cap[0].replace(/^ *> ?/gm, '');
+
+ // Pass `top` to keep the current
+ // "toplevel" state. This is exactly
+ // how markdown.pl works.
+ this.token(cap, top, true);
+
+ this.tokens.push({
+ type: 'blockquote_end'
+ });
+
+ continue;
+ }
+
+ // list
+ if (cap = this.rules.list.exec(src)) {
+ src = src.substring(cap[0].length);
+ bull = cap[2];
+
+ this.tokens.push({
+ type: 'list_start',
+ ordered: bull.length > 1
+ });
+
+ // Get each top-level item.
+ cap = cap[0].match(this.rules.item);
+
+ next = false;
+ l = cap.length;
+ i = 0;
+
+ for (; i < l; i++) {
+ item = cap[i];
+
+ // Remove the list item's bullet
+ // so it is seen as the next token.
+ space = item.length;
+ item = item.replace(/^ *([*+-]|\d+\.) +/, '');
+
+ // Outdent whatever the
+ // list item contains. Hacky.
+ if (~item.indexOf('\n ')) {
+ space -= item.length;
+ item = !this.options.pedantic
+ ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '')
+ : item.replace(/^ {1,4}/gm, '');
+ }
+
+ // Determine whether the next list item belongs here.
+ // Backpedal if it does not belong in this list.
+ if (this.options.smartLists && i !== l - 1) {
+ b = block.bullet.exec(cap[i + 1])[0];
+ if (bull !== b && !(bull.length > 1 && b.length > 1)) {
+ src = cap.slice(i + 1).join('\n') + src;
+ i = l - 1;
+ }
+ }
+
+ // Determine whether item is loose or not.
+ // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
+ // for discount behavior.
+ loose = next || /\n\n(?!\s*$)/.test(item);
+ if (i !== l - 1) {
+ next = item.charAt(item.length - 1) === '\n';
+ if (!loose) loose = next;
+ }
+
+ this.tokens.push({
+ type: loose
+ ? 'loose_item_start'
+ : 'list_item_start'
+ });
+
+ // Recurse.
+ this.token(item, false, bq);
+
+ this.tokens.push({
+ type: 'list_item_end'
+ });
+ }
+
+ this.tokens.push({
+ type: 'list_end'
+ });
+
+ continue;
+ }
+
+ // html
+ if (cap = this.rules.html.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: this.options.sanitize
+ ? 'paragraph'
+ : 'html',
+ pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',
+ text: cap[0]
+ });
+ continue;
+ }
+
+ // def
+ if ((!bq && top) && (cap = this.rules.def.exec(src))) {
+ src = src.substring(cap[0].length);
+ this.tokens.links[cap[1].toLowerCase()] = {
+ href: cap[2],
+ title: cap[3]
+ };
+ continue;
+ }
+
+ // table (gfm)
+ if (top && (cap = this.rules.table.exec(src))) {
+ src = src.substring(cap[0].length);
+
+ item = {
+ type: 'table',
+ header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */),
+ align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
+ cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n')
+ };
+
+ for (i = 0; i < item.align.length; i++) {
+ if (/^ *-+: *$/.test(item.align[i])) {
+ item.align[i] = 'right';
+ } else if (/^ *:-+: *$/.test(item.align[i])) {
+ item.align[i] = 'center';
+ } else if (/^ *:-+ *$/.test(item.align[i])) {
+ item.align[i] = 'left';
+ } else {
+ item.align[i] = null;
+ }
+ }
+
+ for (i = 0; i < item.cells.length; i++) {
+ item.cells[i] = item.cells[i]
+ .replace(/^ *\| *| *\| *$/g, '')
+ .split(/ *\| */);
+ }
+
+ this.tokens.push(item);
+
+ continue;
+ }
+
+ // top-level paragraph
+ if (top && (cap = this.rules.paragraph.exec(src))) {
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'paragraph',
+ text: cap[1].charAt(cap[1].length - 1) === '\n'
+ ? cap[1].slice(0, -1)
+ : cap[1]
+ });
+ continue;
+ }
+
+ // text
+ if (cap = this.rules.text.exec(src)) {
+ // Top-level should never reach here.
+ src = src.substring(cap[0].length);
+ this.tokens.push({
+ type: 'text',
+ text: cap[0]
+ });
+ continue;
+ }
+
+ if (src) {
+ throw new
+ Error('Infinite loop on byte: ' + src.charCodeAt(0));
+ }
+ }
+
+ return this.tokens;
+};
+
+/**
+ * Inline-Level Grammar
+ */
+
+var inline = {
+ escape: /^\\([\\`*{}\[\]()#+\-.!_>])/,
+ autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
+ url: noop,
+ tag: /^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,
+ link: /^!?\[(inside)\]\(href\)/,
+ reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/,
+ nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,
+ strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,
+ em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
+ code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,
+ br: /^ {2,}\n(?!\s*$)/,
+ del: noop,
+ text: /^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/
+};
+
+inline._inside = /(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/;
+inline._href = /\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;
+
+inline.link = replace(inline.link)
+ ('inside', inline._inside)
+ ('href', inline._href)
+ ();
+
+inline.reflink = replace(inline.reflink)
+ ('inside', inline._inside)
+ ();
+
+/**
+ * Normal Inline Grammar
+ */
+
+inline.normal = merge({}, inline);
+
+/**
+ * Pedantic Inline Grammar
+ */
+
+inline.pedantic = merge({}, inline.normal, {
+ strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
+ em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/
+});
+
+/**
+ * GFM Inline Grammar
+ */
+
+inline.gfm = merge({}, inline.normal, {
+ escape: replace(inline.escape)('])', '~|])')(),
+ url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,
+ del: /^~~(?=\S)([\s\S]*?\S)~~/,
+ text: replace(inline.text)
+ (']|', '~]|')
+ ('|', '|https?://|')
+ ()
+});
+
+/**
+ * GFM + Line Breaks Inline Grammar
+ */
+
+inline.breaks = merge({}, inline.gfm, {
+ br: replace(inline.br)('{2,}', '*')(),
+ text: replace(inline.gfm.text)('{2,}', '*')()
+});
+
+/**
+ * Inline Lexer & Compiler
+ */
+
+function InlineLexer(links, options) {
+ this.options = options || marked.defaults;
+ this.links = links;
+ this.rules = inline.normal;
+ this.renderer = this.options.renderer || new Renderer;
+ this.renderer.options = this.options;
+
+ if (!this.links) {
+ throw new
+ Error('Tokens array requires a `links` property.');
+ }
+
+ if (this.options.gfm) {
+ if (this.options.breaks) {
+ this.rules = inline.breaks;
+ } else {
+ this.rules = inline.gfm;
+ }
+ } else if (this.options.pedantic) {
+ this.rules = inline.pedantic;
+ }
+}
+
+/**
+ * Expose Inline Rules
+ */
+
+InlineLexer.rules = inline;
+
+/**
+ * Static Lexing/Compiling Method
+ */
+
+InlineLexer.output = function(src, links, options) {
+ var inline = new InlineLexer(links, options);
+ return inline.output(src);
+};
+
+/**
+ * Lexing/Compiling
+ */
+
+InlineLexer.prototype.output = function(src) {
+ var out = ''
+ , link
+ , text
+ , href
+ , cap;
+
+ while (src) {
+ // escape
+ if (cap = this.rules.escape.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += cap[1];
+ continue;
+ }
+
+ // autolink
+ if (cap = this.rules.autolink.exec(src)) {
+ src = src.substring(cap[0].length);
+ if (cap[2] === '@') {
+ text = cap[1].charAt(6) === ':'
+ ? this.mangle(cap[1].substring(7))
+ : this.mangle(cap[1]);
+ href = this.mangle('mailto:') + text;
+ } else {
+ text = escape(cap[1]);
+ href = text;
+ }
+ out += this.renderer.link(href, null, text);
+ continue;
+ }
+
+ // url (gfm)
+ if (!this.inLink && (cap = this.rules.url.exec(src))) {
+ src = src.substring(cap[0].length);
+ text = escape(cap[1]);
+ href = text;
+ out += this.renderer.link(href, null, text);
+ continue;
+ }
+
+ // tag
+ if (cap = this.rules.tag.exec(src)) {
+ if (!this.inLink && /^<a /i.test(cap[0])) {
+ this.inLink = true;
+ } else if (this.inLink && /^<\/a>/i.test(cap[0])) {
+ this.inLink = false;
+ }
+ src = src.substring(cap[0].length);
+ out += this.options.sanitize
+ ? escape(cap[0])
+ : cap[0];
+ continue;
+ }
+
+ // link
+ if (cap = this.rules.link.exec(src)) {
+ src = src.substring(cap[0].length);
+ this.inLink = true;
+ out += this.outputLink(cap, {
+ href: cap[2],
+ title: cap[3]
+ });
+ this.inLink = false;
+ continue;
+ }
+
+ // reflink, nolink
+ if ((cap = this.rules.reflink.exec(src))
+ || (cap = this.rules.nolink.exec(src))) {
+ src = src.substring(cap[0].length);
+ link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
+ link = this.links[link.toLowerCase()];
+ if (!link || !link.href) {
+ out += cap[0].charAt(0);
+ src = cap[0].substring(1) + src;
+ continue;
+ }
+ this.inLink = true;
+ out += this.outputLink(cap, link);
+ this.inLink = false;
+ continue;
+ }
+
+ // strong
+ if (cap = this.rules.strong.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.strong(this.output(cap[2] || cap[1]));
+ continue;
+ }
+
+ // em
+ if (cap = this.rules.em.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.em(this.output(cap[2] || cap[1]));
+ continue;
+ }
+
+ // code
+ if (cap = this.rules.code.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.codespan(escape(cap[2], true));
+ continue;
+ }
+
+ // br
+ if (cap = this.rules.br.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.br();
+ continue;
+ }
+
+ // del (gfm)
+ if (cap = this.rules.del.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += this.renderer.del(this.output(cap[1]));
+ continue;
+ }
+
+ // text
+ if (cap = this.rules.text.exec(src)) {
+ src = src.substring(cap[0].length);
+ out += escape(this.smartypants(cap[0]));
+ continue;
+ }
+
+ if (src) {
+ throw new
+ Error('Infinite loop on byte: ' + src.charCodeAt(0));
+ }
+ }
+
+ return out;
+};
+
+/**
+ * Compile Link
+ */
+
+InlineLexer.prototype.outputLink = function(cap, link) {
+ var href = escape(link.href)
+ , title = link.title ? escape(link.title) : null;
+
+ return cap[0].charAt(0) !== '!'
+ ? this.renderer.link(href, title, this.output(cap[1]))
+ : this.renderer.image(href, title, escape(cap[1]));
+};
+
+/**
+ * Smartypants Transformations
+ */
+
+InlineLexer.prototype.smartypants = function(text) {
+ if (!this.options.smartypants) return text;
+ return text
+ // em-dashes
+ .replace(/--/g, '\u2014')
+ // opening singles
+ .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018')
+ // closing singles & apostrophes
+ .replace(/'/g, '\u2019')
+ // opening doubles
+ .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c')
+ // closing doubles
+ .replace(/"/g, '\u201d')
+ // ellipses
+ .replace(/\.{3}/g, '\u2026');
+};
+
+/**
+ * Mangle Links
+ */
+
+InlineLexer.prototype.mangle = function(text) {
+ var out = ''
+ , l = text.length
+ , i = 0
+ , ch;
+
+ for (; i < l; i++) {
+ ch = text.charCodeAt(i);
+ if (Math.random() > 0.5) {
+ ch = 'x' + ch.toString(16);
+ }
+ out += '&#' + ch + ';';
+ }
+
+ return out;
+};
+
+/**
+ * Renderer
+ */
+
+function Renderer(options) {
+ this.options = options || {};
+}
+
+Renderer.prototype.code = function(code, lang, escaped) {
+ if (this.options.highlight) {
+ var out = this.options.highlight(code, lang);
+ if (out != null && out !== code) {
+ escaped = true;
+ code = out;
+ }
+ }
+
+ if (!lang) {
+ return '<pre><code>'
+ + (escaped ? code : escape(code, true))
+ + '\n</code></pre>';
+ }
+
+ return '<pre><code class="'
+ + this.options.langPrefix
+ + escape(lang, true)
+ + '">'
+ + (escaped ? code : escape(code, true))
+ + '\n</code></pre>\n';
+};
+
+Renderer.prototype.blockquote = function(quote) {
+ return '<blockquote>\n' + quote + '</blockquote>\n';
+};
+
+Renderer.prototype.html = function(html) {
+ return html;
+};
+
+Renderer.prototype.heading = function(text, level, raw) {
+ return '<h'
+ + level
+ + ' id="'
+ + this.options.headerPrefix
+ + raw.toLowerCase().replace(/[^\w]+/g, '-')
+ + '">'
+ + text
+ + '</h'
+ + level
+ + '>\n';
+};
+
+Renderer.prototype.hr = function() {
+ return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
+};
+
+Renderer.prototype.list = function(body, ordered) {
+ var type = ordered ? 'ol' : 'ul';
+ return '<' + type + '>\n' + body + '</' + type + '>\n';
+};
+
+Renderer.prototype.listitem = function(text) {
+ return '<li>' + text + '</li>\n';
+};
+
+Renderer.prototype.paragraph = function(text) {
+ return '<p>' + text + '</p>\n';
+};
+
+Renderer.prototype.table = function(header, body) {
+ return '<table>\n'
+ + '<thead>\n'
+ + header
+ + '</thead>\n'
+ + '<tbody>\n'
+ + body
+ + '</tbody>\n'
+ + '</table>\n';
+};
+
+Renderer.prototype.tablerow = function(content) {
+ return '<tr>\n' + content + '</tr>\n';
+};
+
+Renderer.prototype.tablecell = function(content, flags) {
+ var type = flags.header ? 'th' : 'td';
+ var tag = flags.align
+ ? '<' + type + ' style="text-align:' + flags.align + '">'
+ : '<' + type + '>';
+ return tag + content + '</' + type + '>\n';
+};
+
+// span level renderer
+Renderer.prototype.strong = function(text) {
+ return '<strong>' + text + '</strong>';
+};
+
+Renderer.prototype.em = function(text) {
+ return '<em>' + text + '</em>';
+};
+
+Renderer.prototype.codespan = function(text) {
+ return '<code>' + text + '</code>';
+};
+
+Renderer.prototype.br = function() {
+ return this.options.xhtml ? '<br/>' : '<br>';
+};
+
+Renderer.prototype.del = function(text) {
+ return '<del>' + text + '</del>';
+};
+
+Renderer.prototype.link = function(href, title, text) {
+ if (this.options.sanitize) {
+ try {
+ var prot = decodeURIComponent(unescape(href))
+ .replace(/[^\w:]/g, '')
+ .toLowerCase();
+ } catch (e) {
+ return '';
+ }
+ if (prot.indexOf('javascript:') === 0) {
+ return '';
+ }
+ }
+ var out = '<a href="' + href + '"';
+ if (title) {
+ out += ' title="' + title + '"';
+ }
+ out += '>' + text + '</a>';
+ return out;
+};
+
+Renderer.prototype.image = function(href, title, text) {
+ var out = '<img src="' + href + '" alt="' + text + '"';
+ if (title) {
+ out += ' title="' + title + '"';
+ }
+ out += this.options.xhtml ? '/>' : '>';
+ return out;
+};
+
+/**
+ * Parsing & Compiling
+ */
+
+function Parser(options) {
+ this.tokens = [];
+ this.token = null;
+ this.options = options || marked.defaults;
+ this.options.renderer = this.options.renderer || new Renderer;
+ this.renderer = this.options.renderer;
+ this.renderer.options = this.options;
+}
+
+/**
+ * Static Parse Method
+ */
+
+Parser.parse = function(src, options, renderer) {
+ var parser = new Parser(options, renderer);
+ return parser.parse(src);
+};
+
+/**
+ * Parse Loop
+ */
+
+Parser.prototype.parse = function(src) {
+ this.inline = new InlineLexer(src.links, this.options, this.renderer);
+ this.tokens = src.reverse();
+
+ var out = '';
+ while (this.next()) {
+ out += this.tok();
+ }
+
+ return out;
+};
+
+/**
+ * Next Token
+ */
+
+Parser.prototype.next = function() {
+ return this.token = this.tokens.pop();
+};
+
+/**
+ * Preview Next Token
+ */
+
+Parser.prototype.peek = function() {
+ return this.tokens[this.tokens.length - 1] || 0;
+};
+
+/**
+ * Parse Text Tokens
+ */
+
+Parser.prototype.parseText = function() {
+ var body = this.token.text;
+
+ while (this.peek().type === 'text') {
+ body += '\n' + this.next().text;
+ }
+
+ return this.inline.output(body);
+};
+
+/**
+ * Parse Current Token
+ */
+
+Parser.prototype.tok = function() {
+ switch (this.token.type) {
+ case 'space': {
+ return '';
+ }
+ case 'hr': {
+ return this.renderer.hr();
+ }
+ case 'heading': {
+ return this.renderer.heading(
+ this.inline.output(this.token.text),
+ this.token.depth,
+ this.token.text);
+ }
+ case 'code': {
+ return this.renderer.code(this.token.text,
+ this.token.lang,
+ this.token.escaped);
+ }
+ case 'table': {
+ var header = ''
+ , body = ''
+ , i
+ , row
+ , cell
+ , flags
+ , j;
+
+ // header
+ cell = '';
+ for (i = 0; i < this.token.header.length; i++) {
+ flags = { header: true, align: this.token.align[i] };
+ cell += this.renderer.tablecell(
+ this.inline.output(this.token.header[i]),
+ { header: true, align: this.token.align[i] }
+ );
+ }
+ header += this.renderer.tablerow(cell);
+
+ for (i = 0; i < this.token.cells.length; i++) {
+ row = this.token.cells[i];
+
+ cell = '';
+ for (j = 0; j < row.length; j++) {
+ cell += this.renderer.tablecell(
+ this.inline.output(row[j]),
+ { header: false, align: this.token.align[j] }
+ );
+ }
+
+ body += this.renderer.tablerow(cell);
+ }
+ return this.renderer.table(header, body);
+ }
+ case 'blockquote_start': {
+ var body = '';
+
+ while (this.next().type !== 'blockquote_end') {
+ body += this.tok();
+ }
+
+ return this.renderer.blockquote(body);
+ }
+ case 'list_start': {
+ var body = ''
+ , ordered = this.token.ordered;
+
+ while (this.next().type !== 'list_end') {
+ body += this.tok();
+ }
+
+ return this.renderer.list(body, ordered);
+ }
+ case 'list_item_start': {
+ var body = '';
+
+ while (this.next().type !== 'list_item_end') {
+ body += this.token.type === 'text'
+ ? this.parseText()
+ : this.tok();
+ }
+
+ return this.renderer.listitem(body);
+ }
+ case 'loose_item_start': {
+ var body = '';
+
+ while (this.next().type !== 'list_item_end') {
+ body += this.tok();
+ }
+
+ return this.renderer.listitem(body);
+ }
+ case 'html': {
+ var html = !this.token.pre && !this.options.pedantic
+ ? this.inline.output(this.token.text)
+ : this.token.text;
+ return this.renderer.html(html);
+ }
+ case 'paragraph': {
+ return this.renderer.paragraph(this.inline.output(this.token.text));
+ }
+ case 'text': {
+ return this.renderer.paragraph(this.parseText());
+ }
+ }
+};
+
+/**
+ * Helpers
+ */
+
+function escape(html, encode) {
+ return html
+ .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;')
+ .replace(/'/g, '&#39;');
+}
+
+function unescape(html) {
+ return html.replace(/&([#\w]+);/g, function(_, n) {
+ n = n.toLowerCase();
+ if (n === 'colon') return ':';
+ if (n.charAt(0) === '#') {
+ return n.charAt(1) === 'x'
+ ? String.fromCharCode(parseInt(n.substring(2), 16))
+ : String.fromCharCode(+n.substring(1));
+ }
+ return '';
+ });
+}
+
+function replace(regex, opt) {
+ regex = regex.source;
+ opt = opt || '';
+ return function self(name, val) {
+ if (!name) return new RegExp(regex, opt);
+ val = val.source || val;
+ val = val.replace(/(^|[^\[])\^/g, '$1');
+ regex = regex.replace(name, val);
+ return self;
+ };
+}
+
+function noop() {}
+noop.exec = noop;
+
+function merge(obj) {
+ var i = 1
+ , target
+ , key;
+
+ for (; i < arguments.length; i++) {
+ target = arguments[i];
+ for (key in target) {
+ if (Object.prototype.hasOwnProperty.call(target, key)) {
+ obj[key] = target[key];
+ }
+ }
+ }
+
+ return obj;
+}
+
+
+/**
+ * Marked
+ */
+
+function marked(src, opt, callback) {
+ if (callback || typeof opt === 'function') {
+ if (!callback) {
+ callback = opt;
+ opt = null;
+ }
+
+ opt = merge({}, marked.defaults, opt || {});
+
+ var highlight = opt.highlight
+ , tokens
+ , pending
+ , i = 0;
+
+ try {
+ tokens = Lexer.lex(src, opt)
+ } catch (e) {
+ return callback(e);
+ }
+
+ pending = tokens.length;
+
+ var done = function(err) {
+ if (err) {
+ opt.highlight = highlight;
+ return callback(err);
+ }
+
+ var out;
+
+ try {
+ out = Parser.parse(tokens, opt);
+ } catch (e) {
+ err = e;
+ }
+
+ opt.highlight = highlight;
+
+ return err
+ ? callback(err)
+ : callback(null, out);
+ };
+
+ if (!highlight || highlight.length < 3) {
+ return done();
+ }
+
+ delete opt.highlight;
+
+ if (!pending) return done();
+
+ for (; i < tokens.length; i++) {
+ (function(token) {
+ if (token.type !== 'code') {
+ return --pending || done();
+ }
+ return highlight(token.text, token.lang, function(err, code) {
+ if (err) return done(err);
+ if (code == null || code === token.text) {
+ return --pending || done();
+ }
+ token.text = code;
+ token.escaped = true;
+ --pending || done();
+ });
+ })(tokens[i]);
+ }
+
+ return;
+ }
+ try {
+ if (opt) opt = merge({}, marked.defaults, opt);
+ return Parser.parse(Lexer.lex(src, opt), opt);
+ } catch (e) {
+ e.message += '\nPlease report this to https://github.com/chjj/marked.';
+ if ((opt || marked.defaults).silent) {
+ return '<p>An error occured:</p><pre>'
+ + escape(e.message + '', true)
+ + '</pre>';
+ }
+ throw e;
+ }
+}
+
+/**
+ * Options
+ */
+
+marked.options =
+marked.setOptions = function(opt) {
+ merge(marked.defaults, opt);
+ return marked;
+};
+
+marked.defaults = {
+ gfm: true,
+ tables: true,
+ breaks: false,
+ pedantic: false,
+ sanitize: false,
+ smartLists: false,
+ silent: false,
+ highlight: null,
+ langPrefix: 'lang-',
+ smartypants: false,
+ headerPrefix: '',
+ renderer: new Renderer,
+ xhtml: false
+};
+
+/**
+ * Expose
+ */
+
+marked.Parser = Parser;
+marked.parser = Parser.parse;
+
+marked.Renderer = Renderer;
+
+marked.Lexer = Lexer;
+marked.lexer = Lexer.lex;
+
+marked.InlineLexer = InlineLexer;
+marked.inlineLexer = InlineLexer.output;
+
+marked.parse = marked;
+
+if (typeof module !== 'undefined' && typeof exports === 'object') {
+ module.exports = marked;
+} else if (typeof define === 'function' && define.amd) {
+ define(function() { return marked; });
+} else {
+ this.marked = marked;
+}
+
+}).call(function() {
+ return this || (typeof window !== 'undefined' ? window : global);
+}()); \ No newline at end of file
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/shred.bundle.js b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/shred.bundle.js
new file mode 100644
index 0000000..83fe8fa
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/shred.bundle.js
@@ -0,0 +1,2780 @@
+/*
+ * 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.
+ */
+var require = function (file, cwd) {
+ var resolved = require.resolve(file, cwd || '/');
+ var mod = require.modules[resolved];
+ if (!mod) throw new Error(
+ 'Failed to resolve module ' + file + ', tried ' + resolved
+ );
+ var res = mod._cached ? mod._cached : mod();
+ return res;
+}
+
+require.paths = [];
+require.modules = {};
+require.extensions = [".js",".coffee"];
+
+require._core = {
+ 'assert': true,
+ 'events': true,
+ 'fs': true,
+ 'path': true,
+ 'vm': true
+};
+
+require.resolve = (function () {
+ return function (x, cwd) {
+ if (!cwd) cwd = '/';
+
+ if (require._core[x]) return x;
+ var path = require.modules.path();
+ var y = cwd || '.';
+
+ if (x.match(/^(?:\.\.?\/|\/)/)) {
+ var m = loadAsFileSync(path.resolve(y, x))
+ || loadAsDirectorySync(path.resolve(y, x));
+ if (m) return m;
+ }
+
+ var n = loadNodeModulesSync(x, y);
+ if (n) return n;
+
+ throw new Error("Cannot find module '" + x + "'");
+
+ function loadAsFileSync (x) {
+ if (require.modules[x]) {
+ return x;
+ }
+
+ for (var i = 0; i < require.extensions.length; i++) {
+ var ext = require.extensions[i];
+ if (require.modules[x + ext]) return x + ext;
+ }
+ }
+
+ function loadAsDirectorySync (x) {
+ x = x.replace(/\/+$/, '');
+ var pkgfile = x + '/package.json';
+ if (require.modules[pkgfile]) {
+ var pkg = require.modules[pkgfile]();
+ var b = pkg.browserify;
+ if (typeof b === 'object' && b.main) {
+ var m = loadAsFileSync(path.resolve(x, b.main));
+ if (m) return m;
+ }
+ else if (typeof b === 'string') {
+ var m = loadAsFileSync(path.resolve(x, b));
+ if (m) return m;
+ }
+ else if (pkg.main) {
+ var m = loadAsFileSync(path.resolve(x, pkg.main));
+ if (m) return m;
+ }
+ }
+
+ return loadAsFileSync(x + '/index');
+ }
+
+ function loadNodeModulesSync (x, start) {
+ var dirs = nodeModulesPathsSync(start);
+ for (var i = 0; i < dirs.length; i++) {
+ var dir = dirs[i];
+ var m = loadAsFileSync(dir + '/' + x);
+ if (m) return m;
+ var n = loadAsDirectorySync(dir + '/' + x);
+ if (n) return n;
+ }
+
+ var m = loadAsFileSync(x);
+ if (m) return m;
+ }
+
+ function nodeModulesPathsSync (start) {
+ var parts;
+ if (start === '/') parts = [ '' ];
+ else parts = path.normalize(start).split('/');
+
+ var dirs = [];
+ for (var i = parts.length - 1; i >= 0; i--) {
+ if (parts[i] === 'node_modules') continue;
+ var dir = parts.slice(0, i + 1).join('/') + '/node_modules';
+ dirs.push(dir);
+ }
+
+ return dirs;
+ }
+ };
+})();
+
+require.alias = function (from, to) {
+ var path = require.modules.path();
+ var res = null;
+ try {
+ res = require.resolve(from + '/package.json', '/');
+ }
+ catch (err) {
+ res = require.resolve(from, '/');
+ }
+ var basedir = path.dirname(res);
+
+ var keys = (Object.keys || function (obj) {
+ var res = [];
+ for (var key in obj) res.push(key)
+ return res;
+ })(require.modules);
+
+ for (var i = 0; i < keys.length; i++) {
+ var key = keys[i];
+ if (key.slice(0, basedir.length + 1) === basedir + '/') {
+ var f = key.slice(basedir.length);
+ require.modules[to + f] = require.modules[basedir + f];
+ }
+ else if (key === basedir) {
+ require.modules[to] = require.modules[basedir];
+ }
+ }
+};
+
+require.define = function (filename, fn) {
+ var dirname = require._core[filename]
+ ? ''
+ : require.modules.path().dirname(filename)
+ ;
+
+ var require_ = function (file) {
+ return require(file, dirname)
+ };
+ require_.resolve = function (name) {
+ return require.resolve(name, dirname);
+ };
+ require_.modules = require.modules;
+ require_.define = require.define;
+ var module_ = { exports : {} };
+
+ require.modules[filename] = function () {
+ require.modules[filename]._cached = module_.exports;
+ fn.call(
+ module_.exports,
+ require_,
+ module_,
+ module_.exports,
+ dirname,
+ filename
+ );
+ require.modules[filename]._cached = module_.exports;
+ return module_.exports;
+ };
+};
+
+if (typeof process === 'undefined') process = {};
+
+if (!process.nextTick) process.nextTick = (function () {
+ var queue = [];
+ var canPost = typeof window !== 'undefined'
+ && window.postMessage && window.addEventListener
+ ;
+
+ if (canPost) {
+ window.addEventListener('message', function (ev) {
+ if (ev.source === window && ev.data === 'browserify-tick') {
+ ev.stopPropagation();
+ if (queue.length > 0) {
+ var fn = queue.shift();
+ fn();
+ }
+ }
+ }, true);
+ }
+
+ return function (fn) {
+ if (canPost) {
+ queue.push(fn);
+ window.postMessage('browserify-tick', '*');
+ }
+ else setTimeout(fn, 0);
+ };
+})();
+
+if (!process.title) process.title = 'browser';
+
+if (!process.binding) process.binding = function (name) {
+ if (name === 'evals') return require('vm')
+ else throw new Error('No such module')
+};
+
+if (!process.cwd) process.cwd = function () { return '.' };
+
+require.define("path", function (require, module, exports, __dirname, __filename) {
+ function filter (xs, fn) {
+ var res = [];
+ for (var i = 0; i < xs.length; i++) {
+ if (fn(xs[i], i, xs)) res.push(xs[i]);
+ }
+ return res;
+}
+
+// resolves . and .. elements in a path array with directory names there
+// must be no slashes, empty elements, or device names (c:\) in the array
+// (so also no leading and trailing slashes - it does not distinguish
+// relative and absolute paths)
+function normalizeArray(parts, allowAboveRoot) {
+ // if the path tries to go above the root, `up` ends up > 0
+ var up = 0;
+ for (var i = parts.length; i >= 0; i--) {
+ var last = parts[i];
+ if (last == '.') {
+ parts.splice(i, 1);
+ } else if (last === '..') {
+ parts.splice(i, 1);
+ up++;
+ } else if (up) {
+ parts.splice(i, 1);
+ up--;
+ }
+ }
+
+ // if the path is allowed to go above the root, restore leading ..s
+ if (allowAboveRoot) {
+ for (; up--; up) {
+ parts.unshift('..');
+ }
+ }
+
+ return parts;
+}
+
+// Regex to split a filename into [*, dir, basename, ext]
+// posix version
+var splitPathRe = /^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;
+
+// path.resolve([from ...], to)
+// posix version
+exports.resolve = function() {
+var resolvedPath = '',
+ resolvedAbsolute = false;
+
+for (var i = arguments.length; i >= -1 && !resolvedAbsolute; i--) {
+ var path = (i >= 0)
+ ? arguments[i]
+ : process.cwd();
+
+ // Skip empty and invalid entries
+ if (typeof path !== 'string' || !path) {
+ continue;
+ }
+
+ resolvedPath = path + '/' + resolvedPath;
+ resolvedAbsolute = path.charAt(0) === '/';
+}
+
+// At this point the path should be resolved to a full absolute path, but
+// handle relative paths to be safe (might happen when process.cwd() fails)
+
+// Normalize the path
+resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
+ return !!p;
+ }), !resolvedAbsolute).join('/');
+
+ return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
+};
+
+// path.normalize(path)
+// posix version
+exports.normalize = function(path) {
+var isAbsolute = path.charAt(0) === '/',
+ trailingSlash = path.slice(-1) === '/';
+
+// Normalize the path
+path = normalizeArray(filter(path.split('/'), function(p) {
+ return !!p;
+ }), !isAbsolute).join('/');
+
+ if (!path && !isAbsolute) {
+ path = '.';
+ }
+ if (path && trailingSlash) {
+ path += '/';
+ }
+
+ return (isAbsolute ? '/' : '') + path;
+};
+
+
+// posix version
+exports.join = function() {
+ var paths = Array.prototype.slice.call(arguments, 0);
+ return exports.normalize(filter(paths, function(p, index) {
+ return p && typeof p === 'string';
+ }).join('/'));
+};
+
+
+exports.dirname = function(path) {
+ var dir = splitPathRe.exec(path)[1] || '';
+ var isWindows = false;
+ if (!dir) {
+ // No dirname
+ return '.';
+ } else if (dir.length === 1 ||
+ (isWindows && dir.length <= 3 && dir.charAt(1) === ':')) {
+ // It is just a slash or a drive letter with a slash
+ return dir;
+ } else {
+ // It is a full dirname, strip trailing slash
+ return dir.substring(0, dir.length - 1);
+ }
+};
+
+
+exports.basename = function(path, ext) {
+ var f = splitPathRe.exec(path)[2] || '';
+ // TODO: make this comparison case-insensitive on windows?
+ if (ext && f.substr(-1 * ext.length) === ext) {
+ f = f.substr(0, f.length - ext.length);
+ }
+ return f;
+};
+
+
+exports.extname = function(path) {
+ return splitPathRe.exec(path)[3] || '';
+};
+
+});
+
+require.define("/shred.js", function (require, module, exports, __dirname, __filename) {
+ // Shred is an HTTP client library intended to simplify the use of Node's
+// built-in HTTP library. In particular, we wanted to make it easier to interact
+// with HTTP-based APIs.
+//
+// See the [examples](./examples.html) for more details.
+
+// Ax is a nice logging library we wrote. You can use any logger, providing it
+// has `info`, `warn`, `debug`, and `error` methods that take a string.
+var Ax = require("ax")
+ , CookieJarLib = require( "cookiejar" )
+ , CookieJar = CookieJarLib.CookieJar
+;
+
+// Shred takes some options, including a logger and request defaults.
+
+var Shred = function(options) {
+ options = (options||{});
+ this.agent = options.agent;
+ this.defaults = options.defaults||{};
+ this.log = options.logger||(new Ax({ level: "info" }));
+ this._sharedCookieJar = new CookieJar();
+ this.logCurl = options.logCurl || false;
+};
+
+// Most of the real work is done in the request and reponse classes.
+
+Shred.Request = require("./shred/request");
+Shred.Response = require("./shred/response");
+
+// The `request` method kicks off a new request, instantiating a new `Request`
+// object and passing along whatever default options we were given.
+
+Shred.prototype = {
+ request: function(options) {
+ options.logger = this.log;
+ options.logCurl = options.logCurl || this.logCurl;
+ options.cookieJar = ( 'cookieJar' in options ) ? options.cookieJar : this._sharedCookieJar; // let them set cookieJar = null
+ options.agent = options.agent || this.agent;
+ // fill in default options
+ for (var key in this.defaults) {
+ if (this.defaults.hasOwnProperty(key) && !options[key]) {
+ options[key] = this.defaults[key]
+ }
+ }
+ return new Shred.Request(options);
+ }
+};
+
+// Define a bunch of convenience methods so that you don't have to include
+// a `method` property in your request options.
+
+"get put post delete".split(" ").forEach(function(method) {
+ Shred.prototype[method] = function(options) {
+ options.method = method;
+ return this.request(options);
+ };
+});
+
+
+module.exports = Shred;
+
+});
+
+require.define("/node_modules/ax/package.json", function (require, module, exports, __dirname, __filename) {
+ module.exports = {"main":"./lib/ax.js"}
+});
+
+require.define("/node_modules/ax/lib/ax.js", function (require, module, exports, __dirname, __filename) {
+ var inspect = require("util").inspect
+ , fs = require("fs")
+;
+
+
+// this is a quick-and-dirty logger. there are other nicer loggers out there
+// but the ones i found were also somewhat involved. this one has a Ruby
+// logger type interface
+//
+// we can easily replace this, provide the info, debug, etc. methods are the
+// same. or, we can change Haiku to use a more standard node.js interface
+
+var format = function(level,message) {
+ var debug = (level=="debug"||level=="error");
+ if (!message) { return message.toString(); }
+ if (typeof(message) == "object") {
+ if (message instanceof Error && debug) {
+ return message.stack;
+ } else {
+ return inspect(message);
+ }
+ } else {
+ return message.toString();
+ }
+};
+
+var noOp = function(message) { return this; }
+var makeLogger = function(level,fn) {
+ return function(message) {
+ this.stream.write(this.format(level, message)+"\n");
+ return this;
+ }
+};
+
+var Logger = function(options) {
+ var logger = this;
+ var options = options||{};
+
+ // Default options
+ options.level = options.level || "info";
+ options.timestamp = options.timestamp || true;
+ options.prefix = options.prefix || "";
+ logger.options = options;
+
+ // Allows a prefix to be added to the message.
+ //
+ // var logger = new Ax({ module: 'Haiku' })
+ // logger.warn('this is going to be awesome!');
+ // //=> Haiku: this is going to be awesome!
+ //
+ if (logger.options.module){
+ logger.options.prefix = logger.options.module;
+ }
+
+ // Write to stderr or a file
+ if (logger.options.file){
+ logger.stream = fs.createWriteStream(logger.options.file, {"flags": "a"});
+ } else {
+ if(process.title === "node")
+ logger.stream = process.stderr;
+ else if(process.title === "browser")
+ logger.stream = function () {
+ // Work around weird console context issue: http://code.google.com/p/chromium/issues/detail?id=48662
+ return console[logger.options.level].apply(console, arguments);
+ };
+ }
+
+ switch(logger.options.level){
+ case 'debug':
+ ['debug', 'info', 'warn'].forEach(function (level) {
+ logger[level] = Logger.writer(level);
+ });
+ case 'info':
+ ['info', 'warn'].forEach(function (level) {
+ logger[level] = Logger.writer(level);
+ });
+ case 'warn':
+ logger.warn = Logger.writer('warn');
+ }
+}
+
+// Used to define logger methods
+Logger.writer = function(level){
+ return function(message){
+ var logger = this;
+
+ if(process.title === "node")
+ logger.stream.write(logger.format(level, message) + '\n');
+ else if(process.title === "browser")
+ logger.stream(logger.format(level, message) + '\n');
+
+ };
+}
+
+
+Logger.prototype = {
+ info: function(){},
+ debug: function(){},
+ warn: function(){},
+ error: Logger.writer('error'),
+ format: function(level, message){
+ if (! message) return '';
+
+ var logger = this
+ , prefix = logger.options.prefix
+ , timestamp = logger.options.timestamp ? " " + (new Date().toISOString()) : ""
+ ;
+
+ return (prefix + timestamp + ": " + message);
+ }
+};
+
+module.exports = Logger;
+
+});
+
+require.define("util", function (require, module, exports, __dirname, __filename) {
+ // todo
+
+});
+
+require.define("fs", function (require, module, exports, __dirname, __filename) {
+ // nothing to see here... no file methods for the browser
+
+});
+
+require.define("/node_modules/cookiejar/package.json", function (require, module, exports, __dirname, __filename) {
+ module.exports = {"main":"cookiejar.js"}
+});
+
+require.define("/node_modules/cookiejar/cookiejar.js", function (require, module, exports, __dirname, __filename) {
+ exports.CookieAccessInfo=CookieAccessInfo=function CookieAccessInfo(domain,path,secure,script) {
+ if(this instanceof CookieAccessInfo) {
+ this.domain=domain||undefined;
+ this.path=path||"/";
+ this.secure=!!secure;
+ this.script=!!script;
+ return this;
+ }
+ else {
+ return new CookieAccessInfo(domain,path,secure,script)
+ }
+}
+
+exports.Cookie=Cookie=function Cookie(cookiestr) {
+ if(cookiestr instanceof Cookie) {
+ return cookiestr;
+ }
+ else {
+ if(this instanceof Cookie) {
+ this.name = null;
+ this.value = null;
+ this.expiration_date = Infinity;
+ this.path = "/";
+ this.domain = null;
+ this.secure = false; //how to define?
+ this.noscript = false; //httponly
+ if(cookiestr) {
+ this.parse(cookiestr)
+ }
+ return this;
+ }
+ return new Cookie(cookiestr)
+ }
+}
+
+Cookie.prototype.toString = function toString() {
+ var str=[this.name+"="+this.value];
+ if(this.expiration_date !== Infinity) {
+ str.push("expires="+(new Date(this.expiration_date)).toGMTString());
+ }
+ if(this.domain) {
+ str.push("domain="+this.domain);
+ }
+ if(this.path) {
+ str.push("path="+this.path);
+ }
+ if(this.secure) {
+ str.push("secure");
+ }
+ if(this.noscript) {
+ str.push("httponly");
+ }
+ return str.join("; ");
+}
+
+Cookie.prototype.toValueString = function toValueString() {
+ return this.name+"="+this.value;
+}
+
+var cookie_str_splitter=/[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g
+Cookie.prototype.parse = function parse(str) {
+ if(this instanceof Cookie) {
+ var parts=str.split(";")
+ , pair=parts[0].match(/([^=]+)=((?:.|\n)*)/)
+ , key=pair[1]
+ , value=pair[2];
+ this.name = key;
+ this.value = value;
+
+ for(var i=1;i<parts.length;i++) {
+ pair=parts[i].match(/([^=]+)(?:=((?:.|\n)*))?/)
+ , key=pair[1].trim().toLowerCase()
+ , value=pair[2];
+ switch(key) {
+ case "httponly":
+ this.noscript = true;
+ break;
+ case "expires":
+ this.expiration_date = value
+ ? Number(Date.parse(value))
+ : Infinity;
+ break;
+ case "path":
+ this.path = value
+ ? value.trim()
+ : "";
+ break;
+ case "domain":
+ this.domain = value
+ ? value.trim()
+ : "";
+ break;
+ case "secure":
+ this.secure = true;
+ break
+ }
+ }
+
+ return this;
+ }
+ return new Cookie().parse(str)
+}
+
+Cookie.prototype.matches = function matches(access_info) {
+ if(this.noscript && access_info.script
+ || this.secure && !access_info.secure
+ || !this.collidesWith(access_info)) {
+ return false
+ }
+ return true;
+}
+
+Cookie.prototype.collidesWith = function collidesWith(access_info) {
+ if((this.path && !access_info.path) || (this.domain && !access_info.domain)) {
+ return false
+ }
+ if(this.path && access_info.path.indexOf(this.path) !== 0) {
+ return false;
+ }
+ if (this.domain===access_info.domain) {
+ return true;
+ }
+ else if(this.domain && this.domain.charAt(0)===".")
+ {
+ var wildcard=access_info.domain.indexOf(this.domain.slice(1))
+ if(wildcard===-1 || wildcard!==access_info.domain.length-this.domain.length+1) {
+ return false;
+ }
+ }
+ else if(this.domain){
+ return false
+ }
+ return true;
+}
+
+exports.CookieJar=CookieJar=function CookieJar() {
+ if(this instanceof CookieJar) {
+ var cookies = {} //name: [Cookie]
+
+ this.setCookie = function setCookie(cookie) {
+ cookie = Cookie(cookie);
+ //Delete the cookie if the set is past the current time
+ var remove = cookie.expiration_date <= Date.now();
+ if(cookie.name in cookies) {
+ var cookies_list = cookies[cookie.name];
+ for(var i=0;i<cookies_list.length;i++) {
+ var collidable_cookie = cookies_list[i];
+ if(collidable_cookie.collidesWith(cookie)) {
+ if(remove) {
+ cookies_list.splice(i,1);
+ if(cookies_list.length===0) {
+ delete cookies[cookie.name]
+ }
+ return false;
+ }
+ else {
+ return cookies_list[i]=cookie;
+ }
+ }
+ }
+ if(remove) {
+ return false;
+ }
+ cookies_list.push(cookie);
+ return cookie;
+ }
+ else if(remove){
+ return false;
+ }
+ else {
+ return cookies[cookie.name]=[cookie];
+ }
+ }
+ //returns a cookie
+ this.getCookie = function getCookie(cookie_name,access_info) {
+ var cookies_list = cookies[cookie_name];
+ for(var i=0;i<cookies_list.length;i++) {
+ var cookie = cookies_list[i];
+ if(cookie.expiration_date <= Date.now()) {
+ if(cookies_list.length===0) {
+ delete cookies[cookie.name]
+ }
+ continue;
+ }
+ if(cookie.matches(access_info)) {
+ return cookie;
+ }
+ }
+ }
+ //returns a list of cookies
+ this.getCookies = function getCookies(access_info) {
+ var matches=[];
+ for(var cookie_name in cookies) {
+ var cookie=this.getCookie(cookie_name,access_info);
+ if (cookie) {
+ matches.push(cookie);
+ }
+ }
+ matches.toString=function toString(){return matches.join(":");}
+ matches.toValueString=function() {return matches.map(function(c){return c.toValueString();}).join(';');}
+ return matches;
+ }
+
+ return this;
+ }
+ return new CookieJar()
+}
+
+
+//returns list of cookies that were set correctly
+CookieJar.prototype.setCookies = function setCookies(cookies) {
+ cookies=Array.isArray(cookies)
+ ?cookies
+ :cookies.split(cookie_str_splitter);
+ var successful=[]
+ for(var i=0;i<cookies.length;i++) {
+ var cookie = Cookie(cookies[i]);
+ if(this.setCookie(cookie)) {
+ successful.push(cookie);
+ }
+ }
+ return successful;
+}
+
+});
+
+require.define("/shred/request.js", function (require, module, exports, __dirname, __filename) {
+ // The request object encapsulates a request, creating a Node.js HTTP request and
+// then handling the response.
+
+var HTTP = require("http")
+ , HTTPS = require("https")
+ , parseUri = require("./parseUri")
+ , Emitter = require('events').EventEmitter
+ , sprintf = require("sprintf").sprintf
+ , Response = require("./response")
+ , HeaderMixins = require("./mixins/headers")
+ , Content = require("./content")
+;
+
+var STATUS_CODES = HTTP.STATUS_CODES || {
+ 100 : 'Continue',
+ 101 : 'Switching Protocols',
+ 102 : 'Processing', // RFC 2518, obsoleted by RFC 4918
+ 200 : 'OK',
+ 201 : 'Created',
+ 202 : 'Accepted',
+ 203 : 'Non-Authoritative Information',
+ 204 : 'No Content',
+ 205 : 'Reset Content',
+ 206 : 'Partial Content',
+ 207 : 'Multi-Status', // RFC 4918
+ 300 : 'Multiple Choices',
+ 301 : 'Moved Permanently',
+ 302 : 'Moved Temporarily',
+ 303 : 'See Other',
+ 304 : 'Not Modified',
+ 305 : 'Use Proxy',
+ 307 : 'Temporary Redirect',
+ 400 : 'Bad Request',
+ 401 : 'Unauthorized',
+ 402 : 'Payment Required',
+ 403 : 'Forbidden',
+ 404 : 'Not Found',
+ 405 : 'Method Not Allowed',
+ 406 : 'Not Acceptable',
+ 407 : 'Proxy Authentication Required',
+ 408 : 'Request Time-out',
+ 409 : 'Conflict',
+ 410 : 'Gone',
+ 411 : 'Length Required',
+ 412 : 'Precondition Failed',
+ 413 : 'Request Entity Too Large',
+ 414 : 'Request-URI Too Large',
+ 415 : 'Unsupported Media Type',
+ 416 : 'Requested Range Not Satisfiable',
+ 417 : 'Expectation Failed',
+ 418 : 'I\'m a teapot', // RFC 2324
+ 422 : 'Unprocessable Entity', // RFC 4918
+ 423 : 'Locked', // RFC 4918
+ 424 : 'Failed Dependency', // RFC 4918
+ 425 : 'Unordered Collection', // RFC 4918
+ 426 : 'Upgrade Required', // RFC 2817
+ 500 : 'Internal Server Error',
+ 501 : 'Not Implemented',
+ 502 : 'Bad Gateway',
+ 503 : 'Service Unavailable',
+ 504 : 'Gateway Time-out',
+ 505 : 'HTTP Version not supported',
+ 506 : 'Variant Also Negotiates', // RFC 2295
+ 507 : 'Insufficient Storage', // RFC 4918
+ 509 : 'Bandwidth Limit Exceeded',
+ 510 : 'Not Extended' // RFC 2774
+};
+
+// The Shred object itself constructs the `Request` object. You should rarely
+// need to do this directly.
+
+var Request = function(options) {
+ this.log = options.logger;
+ this.cookieJar = options.cookieJar;
+ this.encoding = options.encoding;
+ this.logCurl = options.logCurl;
+ processOptions(this,options||{});
+ createRequest(this);
+};
+
+// A `Request` has a number of properties, many of which help with details like
+// URL parsing or defaulting the port for the request.
+
+Object.defineProperties(Request.prototype, {
+
+// - **url**. You can set the `url` property with a valid URL string and all the
+// URL-related properties (host, port, etc.) will be automatically set on the
+// request object.
+
+ url: {
+ get: function() {
+ if (!this.scheme) { return null; }
+ return sprintf("%s://%s:%s%s",
+ this.scheme, this.host, this.port,
+ (this.proxy ? "/" : this.path) +
+ (this.query ? ("?" + this.query) : ""));
+ },
+ set: function(_url) {
+ _url = parseUri(_url);
+ this.scheme = _url.protocol;
+ this.host = _url.host;
+ this.port = _url.port;
+ this.path = _url.path;
+ this.query = _url.query;
+ return this;
+ },
+ enumerable: true
+ },
+
+// - **headers**. Returns a hash representing the request headers. You can't set
+// this directly, only get it. You can add or modify headers by using the
+// `setHeader` or `setHeaders` method. This ensures that the headers are
+// normalized - that is, you don't accidentally send `Content-Type` and
+// `content-type` headers. Keep in mind that if you modify the returned hash,
+// it will *not* modify the request headers.
+
+ headers: {
+ get: function() {
+ return this.getHeaders();
+ },
+ enumerable: true
+ },
+
+// - **port**. Unless you set the `port` explicitly or include it in the URL, it
+// will default based on the scheme.
+
+ port: {
+ get: function() {
+ if (!this._port) {
+ switch(this.scheme) {
+ case "https": return this._port = 443;
+ case "http":
+ default: return this._port = 80;
+ }
+ }
+ return this._port;
+ },
+ set: function(value) { this._port = value; return this; },
+ enumerable: true
+ },
+
+// - **method**. The request method - `get`, `put`, `post`, etc. that will be
+// used to make the request. Defaults to `get`.
+
+ method: {
+ get: function() {
+ return this._method = (this._method||"GET");
+ },
+ set: function(value) {
+ this._method = value; return this;
+ },
+ enumerable: true
+ },
+
+// - **query**. Can be set either with a query string or a hash (object). Get
+// will always return a properly escaped query string or null if there is no
+// query component for the request.
+
+ query: {
+ get: function() {return this._query;},
+ set: function(value) {
+ var stringify = function (hash) {
+ var query = "";
+ for (var key in hash) {
+ query += encodeURIComponent(key) + '=' + encodeURIComponent(hash[key]) + '&';
+ }
+ // Remove the last '&'
+ query = query.slice(0, -1);
+ return query;
+ }
+
+ if (value) {
+ if (typeof value === 'object') {
+ value = stringify(value);
+ }
+ this._query = value;
+ } else {
+ this._query = "";
+ }
+ return this;
+ },
+ enumerable: true
+ },
+
+// - **parameters**. This will return the query parameters in the form of a hash
+// (object).
+
+ parameters: {
+ get: function() { return QueryString.parse(this._query||""); },
+ enumerable: true
+ },
+
+// - **content**. (Aliased as `body`.) Set this to add a content entity to the
+// request. Attempts to use the `content-type` header to determine what to do
+// with the content value. Get this to get back a [`Content`
+// object](./content.html).
+
+ body: {
+ get: function() { return this._body; },
+ set: function(value) {
+ this._body = new Content({
+ data: value,
+ type: this.getHeader("Content-Type")
+ });
+ this.setHeader("Content-Type",this.content.type);
+ this.setHeader("Content-Length",this.content.length);
+ return this;
+ },
+ enumerable: true
+ },
+
+// - **timeout**. Used to determine how long to wait for a response. Does not
+// distinguish between connect timeouts versus request timeouts. Set either in
+// milliseconds or with an object with temporal attributes (hours, minutes,
+// seconds) and convert it into milliseconds. Get will always return
+// milliseconds.
+
+ timeout: {
+ get: function() { return this._timeout; }, // in milliseconds
+ set: function(timeout) {
+ var request = this
+ , milliseconds = 0;
+ ;
+ if (!timeout) return this;
+ if (typeof timeout==="number") { milliseconds = timeout; }
+ else {
+ milliseconds = (timeout.milliseconds||0) +
+ (1000 * ((timeout.seconds||0) +
+ (60 * ((timeout.minutes||0) +
+ (60 * (timeout.hours||0))))));
+ }
+ this._timeout = milliseconds;
+ return this;
+ },
+ enumerable: true
+ }
+});
+
+// Alias `body` property to `content`. Since the [content object](./content.html)
+// has a `body` attribute, it's preferable to use `content` since you can then
+// access the raw content data using `content.body`.
+
+Object.defineProperty(Request.prototype,"content",
+ Object.getOwnPropertyDescriptor(Request.prototype, "body"));
+
+// The `Request` object can be pretty overwhelming to view using the built-in
+// Node.js inspect method. We want to make it a bit more manageable. This
+// probably goes [too far in the other
+// direction](https://github.com/spire-io/shred/issues/2).
+
+Request.prototype.inspect = function () {
+ var request = this;
+ var headers = this.format_headers();
+ var summary = ["<Shred Request> ", request.method.toUpperCase(),
+ request.url].join(" ")
+ return [ summary, "- Headers:", headers].join("\n");
+};
+
+Request.prototype.format_headers = function () {
+ var array = []
+ var headers = this._headers
+ for (var key in headers) {
+ if (headers.hasOwnProperty(key)) {
+ var value = headers[key]
+ array.push("\t" + key + ": " + value);
+ }
+ }
+ return array.join("\n");
+};
+
+// Allow chainable 'on's: shred.get({ ... }).on( ... ). You can pass in a
+// single function, a pair (event, function), or a hash:
+// { event: function, event: function }
+Request.prototype.on = function (eventOrHash, listener) {
+ var emitter = this.emitter;
+ // Pass in a single argument as a function then make it the default response handler
+ if (arguments.length === 1 && typeof(eventOrHash) === 'function') {
+ emitter.on('response', eventOrHash);
+ } else if (arguments.length === 1 && typeof(eventOrHash) === 'object') {
+ for (var key in eventOrHash) {
+ if (eventOrHash.hasOwnProperty(key)) {
+ emitter.on(key, eventOrHash[key]);
+ }
+ }
+ } else {
+ emitter.on(eventOrHash, listener);
+ }
+ return this;
+};
+
+// Add in the header methods. Again, these ensure we don't get the same header
+// multiple times with different case conventions.
+HeaderMixins.gettersAndSetters(Request);
+
+// `processOptions` is called from the constructor to handle all the work
+// associated with making sure we do our best to ensure we have a valid request.
+
+var processOptions = function(request,options) {
+
+ request.log.debug("Processing request options ..");
+
+ // We'll use `request.emitter` to manage the `on` event handlers.
+ request.emitter = (new Emitter);
+
+ request.agent = options.agent;
+
+ // Set up the handlers ...
+ if (options.on) {
+ for (var key in options.on) {
+ if (options.on.hasOwnProperty(key)) {
+ request.emitter.on(key, options.on[key]);
+ }
+ }
+ }
+
+ // Make sure we were give a URL or a host
+ if (!options.url && !options.host) {
+ request.emitter.emit("request_error",
+ new Error("No url or url options (host, port, etc.)"));
+ return;
+ }
+
+ // Allow for the [use of a proxy](http://www.jmarshall.com/easy/http/#proxies).
+
+ if (options.url) {
+ if (options.proxy) {
+ request.url = options.proxy;
+ request.path = options.url;
+ } else {
+ request.url = options.url;
+ }
+ }
+
+ // Set the remaining options.
+ request.query = options.query||options.parameters||request.query ;
+ request.method = options.method;
+ request.setHeader("user-agent",options.agent||"Shred");
+ request.setHeaders(options.headers);
+
+ if (request.cookieJar) {
+ var cookies = request.cookieJar.getCookies( CookieAccessInfo( request.host, request.path ) );
+ if (cookies.length) {
+ var cookieString = request.getHeader('cookie')||'';
+ for (var cookieIndex = 0; cookieIndex < cookies.length; ++cookieIndex) {
+ if ( cookieString.length && cookieString[ cookieString.length - 1 ] != ';' )
+ {
+ cookieString += ';';
+ }
+ cookieString += cookies[ cookieIndex ].name + '=' + cookies[ cookieIndex ].value + ';';
+ }
+ request.setHeader("cookie", cookieString);
+ }
+ }
+
+ // The content entity can be set either using the `body` or `content` attributes.
+ if (options.body||options.content) {
+ request.content = options.body||options.content;
+ }
+ request.timeout = options.timeout;
+
+};
+
+// `createRequest` is also called by the constructor, after `processOptions`.
+// This actually makes the request and processes the response, so `createRequest`
+// is a bit of a misnomer.
+
+var createRequest = function(request) {
+ var timeout ;
+
+ request.log.debug("Creating request ..");
+ request.log.debug(request);
+
+ var reqParams = {
+ host: request.host,
+ port: request.port,
+ method: request.method,
+ path: request.path + (request.query ? '?'+request.query : ""),
+ headers: request.getHeaders(),
+ // Node's HTTP/S modules will ignore this, but we are using the
+ // browserify-http module in the browser for both HTTP and HTTPS, and this
+ // is how you differentiate the two.
+ scheme: request.scheme,
+ // Use a provided agent. 'Undefined' is the default, which uses a global
+ // agent.
+ agent: request.agent
+ };
+
+ if (request.logCurl) {
+ logCurl(request);
+ }
+
+ var http = request.scheme == "http" ? HTTP : HTTPS;
+
+ // Set up the real request using the selected library. The request won't be
+ // sent until we call `.end()`.
+ request._raw = http.request(reqParams, function(response) {
+ request.log.debug("Received response ..");
+
+ // We haven't timed out and we have a response, so make sure we clear the
+ // timeout so it doesn't fire while we're processing the response.
+ clearTimeout(timeout);
+
+ // Construct a Shred `Response` object from the response. This will stream
+ // the response, thus the need for the callback. We can access the response
+ // entity safely once we're in the callback.
+ response = new Response(response, request, function(response) {
+
+ // Set up some event magic. The precedence is given first to
+ // status-specific handlers, then to responses for a given event, and then
+ // finally to the more general `response` handler. In the last case, we
+ // need to first make sure we're not dealing with a a redirect.
+ var emit = function(event) {
+ var emitter = request.emitter;
+ var textStatus = STATUS_CODES[response.status] ? STATUS_CODES[response.status].toLowerCase() : null;
+ if (emitter.listeners(response.status).length > 0 || emitter.listeners(textStatus).length > 0) {
+ emitter.emit(response.status, response);
+ emitter.emit(textStatus, response);
+ } else {
+ if (emitter.listeners(event).length>0) {
+ emitter.emit(event, response);
+ } else if (!response.isRedirect) {
+ emitter.emit("response", response);
+ //console.warn("Request has no event listener for status code " + response.status);
+ }
+ }
+ };
+
+ // Next, check for a redirect. We simply repeat the request with the URL
+ // given in the `Location` header. We fire a `redirect` event.
+ if (response.isRedirect) {
+ request.log.debug("Redirecting to "
+ + response.getHeader("Location"));
+ request.url = response.getHeader("Location");
+ emit("redirect");
+ createRequest(request);
+
+ // Okay, it's not a redirect. Is it an error of some kind?
+ } else if (response.isError) {
+ emit("error");
+ } else {
+ // It looks like we're good shape. Trigger the `success` event.
+ emit("success");
+ }
+ });
+ });
+
+ // We're still setting up the request. Next, we're going to handle error cases
+ // where we have no response. We don't emit an error event because that event
+ // takes a response. We don't response handlers to have to check for a null
+ // value. However, we [should introduce a different event
+ // type](https://github.com/spire-io/shred/issues/3) for this type of error.
+ request._raw.on("error", function(error) {
+ request.emitter.emit("request_error", error);
+ });
+
+ request._raw.on("socket", function(socket) {
+ request.emitter.emit("socket", socket);
+ });
+
+ // TCP timeouts should also trigger the "response_error" event.
+ request._raw.on('socket', function () {
+ request._raw.socket.on('timeout', function () {
+ // This should trigger the "error" event on the raw request, which will
+ // trigger the "response_error" on the shred request.
+ request._raw.abort();
+ });
+ });
+
+
+ // We're almost there. Next, we need to write the request entity to the
+ // underlying request object.
+ if (request.content) {
+ request.log.debug("Streaming body: '" +
+ request.content.data.slice(0,59) + "' ... ");
+ request._raw.write(request.content.data);
+ }
+
+ // Finally, we need to set up the timeout. We do this last so that we don't
+ // start the clock ticking until the last possible moment.
+ if (request.timeout) {
+ timeout = setTimeout(function() {
+ request.log.debug("Timeout fired, aborting request ...");
+ request._raw.abort();
+ request.emitter.emit("timeout", request);
+ },request.timeout);
+ }
+
+ // The `.end()` method will cause the request to fire. Technically, it might
+ // have already sent the headers and body.
+ request.log.debug("Sending request ...");
+ request._raw.end();
+};
+
+// Logs the curl command for the request.
+var logCurl = function (req) {
+ var headers = req.getHeaders();
+ var headerString = "";
+
+ for (var key in headers) {
+ headerString += '-H "' + key + ": " + headers[key] + '" ';
+ }
+
+ var bodyString = ""
+
+ if (req.content) {
+ bodyString += "-d '" + req.content.body + "' ";
+ }
+
+ var query = req.query ? '?' + req.query : "";
+
+ console.log("curl " +
+ "-X " + req.method.toUpperCase() + " " +
+ req.scheme + "://" + req.host + ":" + req.port + req.path + query + " " +
+ headerString +
+ bodyString
+ );
+};
+
+
+module.exports = Request;
+
+});
+
+require.define("http", function (require, module, exports, __dirname, __filename) {
+ // todo
+
+});
+
+require.define("https", function (require, module, exports, __dirname, __filename) {
+ // todo
+
+});
+
+require.define("/shred/parseUri.js", function (require, module, exports, __dirname, __filename) {
+ // parseUri 1.2.2
+// (c) Steven Levithan <stevenlevithan.com>
+// MIT License
+
+function parseUri (str) {
+ var o = parseUri.options,
+ m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
+ uri = {},
+ i = 14;
+
+ while (i--) uri[o.key[i]] = m[i] || "";
+
+ uri[o.q.name] = {};
+ uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
+ if ($1) uri[o.q.name][$1] = $2;
+ });
+
+ return uri;
+};
+
+parseUri.options = {
+ strictMode: false,
+ key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
+ q: {
+ name: "queryKey",
+ parser: /(?:^|&)([^&=]*)=?([^&]*)/g
+ },
+ parser: {
+ strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
+ loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
+ }
+};
+
+module.exports = parseUri;
+
+});
+
+require.define("events", function (require, module, exports, __dirname, __filename) {
+ if (!process.EventEmitter) process.EventEmitter = function () {};
+
+var EventEmitter = exports.EventEmitter = process.EventEmitter;
+var isArray = typeof Array.isArray === 'function'
+ ? Array.isArray
+ : function (xs) {
+ return Object.toString.call(xs) === '[object Array]'
+ }
+;
+
+// By default EventEmitters will print a warning if more than
+// 10 listeners are added to it. This is a useful default which
+// helps finding memory leaks.
+//
+// Obviously not all Emitters should be limited to 10. This function allows
+// that to be increased. Set to zero for unlimited.
+var defaultMaxListeners = 10;
+EventEmitter.prototype.setMaxListeners = function(n) {
+ if (!this._events) this._events = {};
+ this._events.maxListeners = n;
+};
+
+
+EventEmitter.prototype.emit = function(type) {
+ // If there is no 'error' event listener then throw.
+ if (type === 'error') {
+ if (!this._events || !this._events.error ||
+ (isArray(this._events.error) && !this._events.error.length))
+ {
+ if (arguments[1] instanceof Error) {
+ throw arguments[1]; // Unhandled 'error' event
+ } else {
+ throw new Error("Uncaught, unspecified 'error' event.");
+ }
+ return false;
+ }
+ }
+
+ if (!this._events) return false;
+ var handler = this._events[type];
+ if (!handler) return false;
+
+ if (typeof handler == 'function') {
+ switch (arguments.length) {
+ // fast cases
+ case 1:
+ handler.call(this);
+ break;
+ case 2:
+ handler.call(this, arguments[1]);
+ break;
+ case 3:
+ handler.call(this, arguments[1], arguments[2]);
+ break;
+ // slower
+ default:
+ var args = Array.prototype.slice.call(arguments, 1);
+ handler.apply(this, args);
+ }
+ return true;
+
+ } else if (isArray(handler)) {
+ var args = Array.prototype.slice.call(arguments, 1);
+
+ var listeners = handler.slice();
+ for (var i = 0, l = listeners.length; i < l; i++) {
+ listeners[i].apply(this, args);
+ }
+ return true;
+
+ } else {
+ return false;
+ }
+};
+
+// EventEmitter is defined in src/node_events.cc
+// EventEmitter.prototype.emit() is also defined there.
+EventEmitter.prototype.addListener = function(type, listener) {
+ if ('function' !== typeof listener) {
+ throw new Error('addListener only takes instances of Function');
+ }
+
+ if (!this._events) this._events = {};
+
+ // To avoid recursion in the case that type == "newListeners"! Before
+ // adding it to the listeners, first emit "newListeners".
+ this.emit('newListener', type, listener);
+
+ if (!this._events[type]) {
+ // Optimize the case of one listener. Don't need the extra array object.
+ this._events[type] = listener;
+ } else if (isArray(this._events[type])) {
+
+ // Check for listener leak
+ if (!this._events[type].warned) {
+ var m;
+ if (this._events.maxListeners !== undefined) {
+ m = this._events.maxListeners;
+ } else {
+ m = defaultMaxListeners;
+ }
+
+ if (m && m > 0 && this._events[type].length > m) {
+ this._events[type].warned = true;
+ console.error('(node) warning: possible EventEmitter memory ' +
+ 'leak detected. %d listeners added. ' +
+ 'Use emitter.setMaxListeners() to increase limit.',
+ this._events[type].length);
+ console.trace();
+ }
+ }
+
+ // If we've already got an array, just append.
+ this._events[type].push(listener);
+ } else {
+ // Adding the second element, need to change to array.
+ this._events[type] = [this._events[type], listener];
+ }
+
+ return this;
+};
+
+EventEmitter.prototype.on = EventEmitter.prototype.addListener;
+
+EventEmitter.prototype.once = function(type, listener) {
+ var self = this;
+ self.on(type, function g() {
+ self.removeListener(type, g);
+ listener.apply(this, arguments);
+ });
+
+ return this;
+};
+
+EventEmitter.prototype.removeListener = function(type, listener) {
+ if ('function' !== typeof listener) {
+ throw new Error('removeListener only takes instances of Function');
+ }
+
+ // does not use listeners(), so no side effect of creating _events[type]
+ if (!this._events || !this._events[type]) return this;
+
+ var list = this._events[type];
+
+ if (isArray(list)) {
+ var i = list.indexOf(listener);
+ if (i < 0) return this;
+ list.splice(i, 1);
+ if (list.length == 0)
+ delete this._events[type];
+ } else if (this._events[type] === listener) {
+ delete this._events[type];
+ }
+
+ return this;
+};
+
+EventEmitter.prototype.removeAllListeners = function(type) {
+ // does not use listeners(), so no side effect of creating _events[type]
+ if (type && this._events && this._events[type]) this._events[type] = null;
+ return this;
+};
+
+EventEmitter.prototype.listeners = function(type) {
+ if (!this._events) this._events = {};
+ if (!this._events[type]) this._events[type] = [];
+ if (!isArray(this._events[type])) {
+ this._events[type] = [this._events[type]];
+ }
+ return this._events[type];
+};
+
+});
+
+require.define("/node_modules/sprintf/package.json", function (require, module, exports, __dirname, __filename) {
+ module.exports = {"main":"./lib/sprintf"}
+});
+
+require.define("/node_modules/sprintf/lib/sprintf.js", function (require, module, exports, __dirname, __filename) {
+ /**
+sprintf() for JavaScript 0.7-beta1
+http://www.diveintojavascript.com/projects/javascript-sprintf
+
+Copyright (c) Alexandru Marasteanu <alexaholic [at) gmail (dot] com>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of sprintf() for JavaScript nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL Alexandru Marasteanu BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+Changelog:
+2010.11.07 - 0.7-beta1-node
+ - converted it to a node.js compatible module
+
+2010.09.06 - 0.7-beta1
+ - features: vsprintf, support for named placeholders
+ - enhancements: format cache, reduced global namespace pollution
+
+2010.05.22 - 0.6:
+ - reverted to 0.4 and fixed the bug regarding the sign of the number 0
+ Note:
+ Thanks to Raphael Pigulla <raph (at] n3rd [dot) org> (http://www.n3rd.org/)
+ who warned me about a bug in 0.5, I discovered that the last update was
+ a regress. I appologize for that.
+
+2010.05.09 - 0.5:
+ - bug fix: 0 is now preceeded with a + sign
+ - bug fix: the sign was not at the right position on padded results (Kamal Abdali)
+ - switched from GPL to BSD license
+
+2007.10.21 - 0.4:
+ - unit test and patch (David Baird)
+
+2007.09.17 - 0.3:
+ - bug fix: no longer throws exception on empty paramenters (Hans Pufal)
+
+2007.09.11 - 0.2:
+ - feature: added argument swapping
+
+2007.04.03 - 0.1:
+ - initial release
+**/
+
+var sprintf = (function() {
+ function get_type(variable) {
+ return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();
+ }
+ function str_repeat(input, multiplier) {
+ for (var output = []; multiplier > 0; output[--multiplier] = input) {/* do nothing */}
+ return output.join('');
+ }
+
+ var str_format = function() {
+ if (!str_format.cache.hasOwnProperty(arguments[0])) {
+ str_format.cache[arguments[0]] = str_format.parse(arguments[0]);
+ }
+ return str_format.format.call(null, str_format.cache[arguments[0]], arguments);
+ };
+
+ str_format.format = function(parse_tree, argv) {
+ var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length;
+ for (i = 0; i < tree_length; i++) {
+ node_type = get_type(parse_tree[i]);
+ if (node_type === 'string') {
+ output.push(parse_tree[i]);
+ }
+ else if (node_type === 'array') {
+ match = parse_tree[i]; // convenience purposes only
+ if (match[2]) { // keyword argument
+ arg = argv[cursor];
+ for (k = 0; k < match[2].length; k++) {
+ if (!arg.hasOwnProperty(match[2][k])) {
+ throw(sprintf('[sprintf] property "%s" does not exist', match[2][k]));
+ }
+ arg = arg[match[2][k]];
+ }
+ }
+ else if (match[1]) { // positional argument (explicit)
+ arg = argv[match[1]];
+ }
+ else { // positional argument (implicit)
+ arg = argv[cursor++];
+ }
+
+ if (/[^s]/.test(match[8]) && (get_type(arg) != 'number')) {
+ throw(sprintf('[sprintf] expecting number but found %s', get_type(arg)));
+ }
+ switch (match[8]) {
+ case 'b': arg = arg.toString(2); break;
+ case 'c': arg = String.fromCharCode(arg); break;
+ case 'd': arg = parseInt(arg, 10); break;
+ case 'e': arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); break;
+ case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); break;
+ case 'o': arg = arg.toString(8); break;
+ case 's': arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg); break;
+ case 'u': arg = Math.abs(arg); break;
+ case 'x': arg = arg.toString(16); break;
+ case 'X': arg = arg.toString(16).toUpperCase(); break;
+ }
+ arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+'+ arg : arg);
+ pad_character = match[4] ? match[4] == '0' ? '0' : match[4].charAt(1) : ' ';
+ pad_length = match[6] - String(arg).length;
+ pad = match[6] ? str_repeat(pad_character, pad_length) : '';
+ output.push(match[5] ? arg + pad : pad + arg);
+ }
+ }
+ return output.join('');
+ };
+
+ str_format.cache = {};
+
+ str_format.parse = function(fmt) {
+ var _fmt = fmt, match = [], parse_tree = [], arg_names = 0;
+ while (_fmt) {
+ if ((match = /^[^\x25]+/.exec(_fmt)) !== null) {
+ parse_tree.push(match[0]);
+ }
+ else if ((match = /^\x25{2}/.exec(_fmt)) !== null) {
+ parse_tree.push('%');
+ }
+ else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) {
+ if (match[2]) {
+ arg_names |= 1;
+ var field_list = [], replacement_field = match[2], field_match = [];
+ if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
+ field_list.push(field_match[1]);
+ while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
+ if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
+ field_list.push(field_match[1]);
+ }
+ else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) {
+ field_list.push(field_match[1]);
+ }
+ else {
+ throw('[sprintf] huh?');
+ }
+ }
+ }
+ else {
+ throw('[sprintf] huh?');
+ }
+ match[2] = field_list;
+ }
+ else {
+ arg_names |= 2;
+ }
+ if (arg_names === 3) {
+ throw('[sprintf] mixing positional and named placeholders is not (yet) supported');
+ }
+ parse_tree.push(match);
+ }
+ else {
+ throw('[sprintf] huh?');
+ }
+ _fmt = _fmt.substring(match[0].length);
+ }
+ return parse_tree;
+ };
+
+ return str_format;
+})();
+
+var vsprintf = function(fmt, argv) {
+ argv.unshift(fmt);
+ return sprintf.apply(null, argv);
+};
+
+exports.sprintf = sprintf;
+exports.vsprintf = vsprintf;
+});
+
+require.define("/shred/response.js", function (require, module, exports, __dirname, __filename) {
+ // The `Response object` encapsulates a Node.js HTTP response.
+
+var Content = require("./content")
+ , HeaderMixins = require("./mixins/headers")
+ , CookieJarLib = require( "cookiejar" )
+ , Cookie = CookieJarLib.Cookie
+;
+
+// Browser doesn't have zlib.
+var zlib = null;
+try {
+ zlib = require('zlib');
+} catch (e) {
+ // console.warn("no zlib library");
+}
+
+// Iconv doesn't work in browser
+var Iconv = null;
+try {
+ Iconv = require('iconv-lite');
+} catch (e) {
+ // console.warn("no iconv library");
+}
+
+// Construct a `Response` object. You should never have to do this directly. The
+// `Request` object handles this, getting the raw response object and passing it
+// in here, along with the request. The callback allows us to stream the response
+// and then use the callback to let the request know when it's ready.
+var Response = function(raw, request, callback) {
+ var response = this;
+ this._raw = raw;
+
+ // The `._setHeaders` method is "private"; you can't otherwise set headers on
+ // the response.
+ this._setHeaders.call(this,raw.headers);
+
+ // store any cookies
+ if (request.cookieJar && this.getHeader('set-cookie')) {
+ var cookieStrings = this.getHeader('set-cookie');
+ var cookieObjs = []
+ , cookie;
+
+ for (var i = 0; i < cookieStrings.length; i++) {
+ var cookieString = cookieStrings[i];
+ if (!cookieString) {
+ continue;
+ }
+
+ if (!cookieString.match(/domain\=/i)) {
+ cookieString += '; domain=' + request.host;
+ }
+
+ if (!cookieString.match(/path\=/i)) {
+ cookieString += '; path=' + request.path;
+ }
+
+ try {
+ cookie = new Cookie(cookieString);
+ if (cookie) {
+ cookieObjs.push(cookie);
+ }
+ } catch (e) {
+ console.warn("Tried to set bad cookie: " + cookieString);
+ }
+ }
+
+ request.cookieJar.setCookies(cookieObjs);
+ }
+
+ this.request = request;
+ this.client = request.client;
+ this.log = this.request.log;
+
+ // Stream the response content entity and fire the callback when we're done.
+ // Store the incoming data in a array of Buffers which we concatinate into one
+ // buffer at the end. We need to use buffers instead of strings here in order
+ // to preserve binary data.
+ var chunkBuffers = [];
+ var dataLength = 0;
+ raw.on("data", function(chunk) {
+ chunkBuffers.push(chunk);
+ dataLength += chunk.length;
+ });
+ raw.on("end", function() {
+ var body;
+ if (typeof Buffer === 'undefined') {
+ // Just concatinate into a string
+ body = chunkBuffers.join('');
+ } else {
+ // Initialize new buffer and add the chunks one-at-a-time.
+ body = new Buffer(dataLength);
+ for (var i = 0, pos = 0; i < chunkBuffers.length; i++) {
+ chunkBuffers[i].copy(body, pos);
+ pos += chunkBuffers[i].length;
+ }
+ }
+
+ var setBodyAndFinish = function (body) {
+ response._body = new Content({
+ body: body,
+ type: response.getHeader("Content-Type")
+ });
+ callback(response);
+ }
+
+ if (zlib && response.getHeader("Content-Encoding") === 'gzip'){
+ zlib.gunzip(body, function (err, gunzippedBody) {
+ if (Iconv && response.request.encoding){
+ body = Iconv.fromEncoding(gunzippedBody,response.request.encoding);
+ } else {
+ body = gunzippedBody.toString();
+ }
+ setBodyAndFinish(body);
+ })
+ }
+ else{
+ if (response.request.encoding){
+ body = Iconv.fromEncoding(body,response.request.encoding);
+ }
+ setBodyAndFinish(body);
+ }
+ });
+};
+
+// The `Response` object can be pretty overwhelming to view using the built-in
+// Node.js inspect method. We want to make it a bit more manageable. This
+// probably goes [too far in the other
+// direction](https://github.com/spire-io/shred/issues/2).
+
+Response.prototype = {
+ inspect: function() {
+ var response = this;
+ var headers = this.format_headers();
+ var summary = ["<Shred Response> ", response.status].join(" ")
+ return [ summary, "- Headers:", headers].join("\n");
+ },
+ format_headers: function () {
+ var array = []
+ var headers = this._headers
+ for (var key in headers) {
+ if (headers.hasOwnProperty(key)) {
+ var value = headers[key]
+ array.push("\t" + key + ": " + value);
+ }
+ }
+ return array.join("\n");
+ }
+};
+
+// `Response` object properties, all of which are read-only:
+Object.defineProperties(Response.prototype, {
+
+// - **status**. The HTTP status code for the response.
+ status: {
+ get: function() { return this._raw.statusCode; },
+ enumerable: true
+ },
+
+// - **content**. The HTTP content entity, if any. Provided as a [content
+// object](./content.html), which will attempt to convert the entity based upon
+// the `content-type` header. The converted value is available as
+// `content.data`. The original raw content entity is available as
+// `content.body`.
+ body: {
+ get: function() { return this._body; }
+ },
+ content: {
+ get: function() { return this.body; },
+ enumerable: true
+ },
+
+// - **isRedirect**. Is the response a redirect? These are responses with 3xx
+// status and a `Location` header.
+ isRedirect: {
+ get: function() {
+ return (this.status>299
+ &&this.status<400
+ &&this.getHeader("Location"));
+ },
+ enumerable: true
+ },
+
+// - **isError**. Is the response an error? These are responses with status of
+// 400 or greater.
+ isError: {
+ get: function() {
+ return (this.status === 0 || this.status > 399)
+ },
+ enumerable: true
+ }
+});
+
+// Add in the [getters for accessing the normalized headers](./headers.js).
+HeaderMixins.getters(Response);
+HeaderMixins.privateSetters(Response);
+
+// Work around Mozilla bug #608735 [https://bugzil.la/608735], which causes
+// getAllResponseHeaders() to return {} if the response is a CORS request.
+// xhr.getHeader still works correctly.
+var getHeader = Response.prototype.getHeader;
+Response.prototype.getHeader = function (name) {
+ return (getHeader.call(this,name) ||
+ (typeof this._raw.getHeader === 'function' && this._raw.getHeader(name)));
+};
+
+module.exports = Response;
+
+});
+
+require.define("/shred/content.js", function (require, module, exports, __dirname, __filename) {
+
+// The purpose of the `Content` object is to abstract away the data conversions
+// to and from raw content entities as strings. For example, you want to be able
+// to pass in a Javascript object and have it be automatically converted into a
+// JSON string if the `content-type` is set to a JSON-based media type.
+// Conversely, you want to be able to transparently get back a Javascript object
+// in the response if the `content-type` is a JSON-based media-type.
+
+// One limitation of the current implementation is that it [assumes the `charset` is UTF-8](https://github.com/spire-io/shred/issues/5).
+
+// The `Content` constructor takes an options object, which *must* have either a
+// `body` or `data` property and *may* have a `type` property indicating the
+// media type. If there is no `type` attribute, a default will be inferred.
+var Content = function(options) {
+ this.body = options.body;
+ this.data = options.data;
+ this.type = options.type;
+};
+
+Content.prototype = {
+ // Treat `toString()` as asking for the `content.body`. That is, the raw content entity.
+ //
+ // toString: function() { return this.body; }
+ //
+ // Commented out, but I've forgotten why. :/
+};
+
+
+// `Content` objects have the following attributes:
+Object.defineProperties(Content.prototype,{
+
+// - **type**. Typically accessed as `content.type`, reflects the `content-type`
+// header associated with the request or response. If not passed as an options
+// to the constructor or set explicitly, it will infer the type the `data`
+// attribute, if possible, and, failing that, will default to `text/plain`.
+ type: {
+ get: function() {
+ if (this._type) {
+ return this._type;
+ } else {
+ if (this._data) {
+ switch(typeof this._data) {
+ case "string": return "text/plain";
+ case "object": return "application/json";
+ }
+ }
+ }
+ return "text/plain";
+ },
+ set: function(value) {
+ this._type = value;
+ return this;
+ },
+ enumerable: true
+ },
+
+// - **data**. Typically accessed as `content.data`, reflects the content entity
+// converted into Javascript data. This can be a string, if the `type` is, say,
+// `text/plain`, but can also be a Javascript object. The conversion applied is
+// based on the `processor` attribute. The `data` attribute can also be set
+// directly, in which case the conversion will be done the other way, to infer
+// the `body` attribute.
+ data: {
+ get: function() {
+ if (this._body) {
+ return this.processor.parser(this._body);
+ } else {
+ return this._data;
+ }
+ },
+ set: function(data) {
+ if (this._body&&data) Errors.setDataWithBody(this);
+ this._data = data;
+ return this;
+ },
+ enumerable: true
+ },
+
+// - **body**. Typically accessed as `content.body`, reflects the content entity
+// as a UTF-8 string. It is the mirror of the `data` attribute. If you set the
+// `data` attribute, the `body` attribute will be inferred and vice-versa. If
+// you attempt to set both, an exception is raised.
+ body: {
+ get: function() {
+ if (this._data) {
+ return this.processor.stringify(this._data);
+ } else {
+ return this.processor.stringify(this._body);
+ }
+ },
+ set: function(body) {
+ if (this._data&&body) Errors.setBodyWithData(this);
+ this._body = body;
+ return this;
+ },
+ enumerable: true
+ },
+
+// - **processor**. The functions that will be used to convert to/from `data` and
+// `body` attributes. You can add processors. The two that are built-in are for
+// `text/plain`, which is basically an identity transformation and
+// `application/json` and other JSON-based media types (including custom media
+// types with `+json`). You can add your own processors. See below.
+ processor: {
+ get: function() {
+ var processor = Content.processors[this.type];
+ if (processor) {
+ return processor;
+ } else {
+ // Return the first processor that matches any part of the
+ // content type. ex: application/vnd.foobar.baz+json will match json.
+ var main = this.type.split(";")[0];
+ var parts = main.split(/\+|\//);
+ for (var i=0, l=parts.length; i < l; i++) {
+ processor = Content.processors[parts[i]]
+ }
+ return processor || {parser:identity,stringify:toString};
+ }
+ },
+ enumerable: true
+ },
+
+// - **length**. Typically accessed as `content.length`, returns the length in
+// bytes of the raw content entity.
+ length: {
+ get: function() {
+ if (typeof Buffer !== 'undefined') {
+ return Buffer.byteLength(this.body);
+ }
+ return this.body.length;
+ }
+ }
+});
+
+Content.processors = {};
+
+// The `registerProcessor` function allows you to add your own processors to
+// convert content entities. Each processor consists of a Javascript object with
+// two properties:
+// - **parser**. The function used to parse a raw content entity and convert it
+// into a Javascript data type.
+// - **stringify**. The function used to convert a Javascript data type into a
+// raw content entity.
+Content.registerProcessor = function(types,processor) {
+
+// You can pass an array of types that will trigger this processor, or just one.
+// We determine the array via duck-typing here.
+ if (types.forEach) {
+ types.forEach(function(type) {
+ Content.processors[type] = processor;
+ });
+ } else {
+ // If you didn't pass an array, we just use what you pass in.
+ Content.processors[types] = processor;
+ }
+};
+
+// Register the identity processor, which is used for text-based media types.
+var identity = function(x) { return x; }
+ , toString = function(x) { return x.toString(); }
+Content.registerProcessor(
+ ["text/html","text/plain","text"],
+ { parser: identity, stringify: toString });
+
+// Register the JSON processor, which is used for JSON-based media types.
+Content.registerProcessor(
+ ["application/json; charset=utf-8","application/json","json"],
+ {
+ parser: function(string) {
+ return JSON.parse(string);
+ },
+ stringify: function(data) {
+ return JSON.stringify(data); }});
+
+// Error functions are defined separately here in an attempt to make the code
+// easier to read.
+var Errors = {
+ setDataWithBody: function(object) {
+ throw new Error("Attempt to set data attribute of a content object " +
+ "when the body attributes was already set.");
+ },
+ setBodyWithData: function(object) {
+ throw new Error("Attempt to set body attribute of a content object " +
+ "when the data attributes was already set.");
+ }
+}
+module.exports = Content;
+
+});
+
+require.define("/shred/mixins/headers.js", function (require, module, exports, __dirname, __filename) {
+ // The header mixins allow you to add HTTP header support to any object. This
+// might seem pointless: why not simply use a hash? The main reason is that, per
+// the [HTTP spec](http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2),
+// headers are case-insensitive. So, for example, `content-type` is the same as
+// `CONTENT-TYPE` which is the same as `Content-Type`. Since there is no way to
+// overload the index operator in Javascript, using a hash to represent the
+// headers means it's possible to have two conflicting values for a single
+// header.
+//
+// The solution to this is to provide explicit methods to set or get headers.
+// This also has the benefit of allowing us to introduce additional variations,
+// including snake case, which we automatically convert to what Matthew King has
+// dubbed "corset case" - the hyphen-separated names with initial caps:
+// `Content-Type`. We use corset-case just in case we're dealing with servers
+// that haven't properly implemented the spec.
+
+// Convert headers to corset-case. **Example:** `CONTENT-TYPE` will be converted
+// to `Content-Type`.
+
+var corsetCase = function(string) {
+ return string;//.toLowerCase()
+ //.replace("_","-")
+ // .replace(/(^|-)(\w)/g,
+ // function(s) { return s.toUpperCase(); });
+};
+
+// We suspect that `initializeHeaders` was once more complicated ...
+var initializeHeaders = function(object) {
+ return {};
+};
+
+// Access the `_headers` property using lazy initialization. **Warning:** If you
+// mix this into an object that is using the `_headers` property already, you're
+// going to have trouble.
+var $H = function(object) {
+ return object._headers||(object._headers=initializeHeaders(object));
+};
+
+// Hide the implementations as private functions, separate from how we expose them.
+
+// The "real" `getHeader` function: get the header after normalizing the name.
+var getHeader = function(object,name) {
+ return $H(object)[corsetCase(name)];
+};
+
+// The "real" `getHeader` function: get one or more headers, or all of them
+// if you don't ask for any specifics.
+var getHeaders = function(object,names) {
+ var keys = (names && names.length>0) ? names : Object.keys($H(object));
+ var hash = keys.reduce(function(hash,key) {
+ hash[key] = getHeader(object,key);
+ return hash;
+ },{});
+ // Freeze the resulting hash so you don't mistakenly think you're modifying
+ // the real headers.
+ Object.freeze(hash);
+ return hash;
+};
+
+// The "real" `setHeader` function: set a header, after normalizing the name.
+var setHeader = function(object,name,value) {
+ $H(object)[corsetCase(name)] = value;
+ return object;
+};
+
+// The "real" `setHeaders` function: set multiple headers based on a hash.
+var setHeaders = function(object,hash) {
+ for( var key in hash ) { setHeader(object,key,hash[key]); };
+ return this;
+};
+
+// Here's where we actually bind the functionality to an object. These mixins work by
+// exposing mixin functions. Each function mixes in a specific batch of features.
+module.exports = {
+
+ // Add getters.
+ getters: function(constructor) {
+ constructor.prototype.getHeader = function(name) { return getHeader(this,name); };
+ constructor.prototype.getHeaders = function() { return getHeaders(this,arguments); };
+ },
+ // Add setters but as "private" methods.
+ privateSetters: function(constructor) {
+ constructor.prototype._setHeader = function(key,value) { return setHeader(this,key,value); };
+ constructor.prototype._setHeaders = function(hash) { return setHeaders(this,hash); };
+ },
+ // Add setters.
+ setters: function(constructor) {
+ constructor.prototype.setHeader = function(key,value) { return setHeader(this,key,value); };
+ constructor.prototype.setHeaders = function(hash) { return setHeaders(this,hash); };
+ },
+ // Add both getters and setters.
+ gettersAndSetters: function(constructor) {
+ constructor.prototype.getHeader = function(name) { return getHeader(this,name); };
+ constructor.prototype.getHeaders = function() { return getHeaders(this,arguments); };
+ constructor.prototype.setHeader = function(key,value) { return setHeader(this,key,value); };
+ constructor.prototype.setHeaders = function(hash) { return setHeaders(this,hash); };
+ }
+};
+
+});
+
+require.define("/node_modules/iconv-lite/package.json", function (require, module, exports, __dirname, __filename) {
+ module.exports = {}
+});
+
+require.define("/node_modules/iconv-lite/index.js", function (require, module, exports, __dirname, __filename) {
+ // Module exports
+var iconv = module.exports = {
+ toEncoding: function(str, encoding) {
+ return iconv.getCodec(encoding).toEncoding(str);
+ },
+ fromEncoding: function(buf, encoding) {
+ return iconv.getCodec(encoding).fromEncoding(buf);
+ },
+
+ defaultCharUnicode: '�',
+ defaultCharSingleByte: '?',
+
+ // Get correct codec for given encoding.
+ getCodec: function(encoding) {
+ var enc = encoding || "utf8";
+ var codecOptions = undefined;
+ while (1) {
+ if (getType(enc) === "String")
+ enc = enc.replace(/[- ]/g, "").toLowerCase();
+ var codec = iconv.encodings[enc];
+ var type = getType(codec);
+ if (type === "String") {
+ // Link to other encoding.
+ codecOptions = {originalEncoding: enc};
+ enc = codec;
+ }
+ else if (type === "Object" && codec.type != undefined) {
+ // Options for other encoding.
+ codecOptions = codec;
+ enc = codec.type;
+ }
+ else if (type === "Function")
+ // Codec itself.
+ return codec(codecOptions);
+ else
+ throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '"+enc+"')");
+ }
+ },
+
+ // Define basic encodings
+ encodings: {
+ internal: function(options) {
+ return {
+ toEncoding: function(str) {
+ return new Buffer(ensureString(str), options.originalEncoding);
+ },
+ fromEncoding: function(buf) {
+ return ensureBuffer(buf).toString(options.originalEncoding);
+ }
+ };
+ },
+ utf8: "internal",
+ ucs2: "internal",
+ binary: "internal",
+ ascii: "internal",
+ base64: "internal",
+
+ // Codepage single-byte encodings.
+ singlebyte: function(options) {
+ // Prepare chars if needed
+ if (!options.chars || (options.chars.length !== 128 && options.chars.length !== 256))
+ throw new Error("Encoding '"+options.type+"' has incorrect 'chars' (must be of len 128 or 256)");
+
+ if (options.chars.length === 128)
+ options.chars = asciiString + options.chars;
+
+ if (!options.charsBuf) {
+ options.charsBuf = new Buffer(options.chars, 'ucs2');
+ }
+
+ if (!options.revCharsBuf) {
+ options.revCharsBuf = new Buffer(65536);
+ var defChar = iconv.defaultCharSingleByte.charCodeAt(0);
+ for (var i = 0; i < options.revCharsBuf.length; i++)
+ options.revCharsBuf[i] = defChar;
+ for (var i = 0; i < options.chars.length; i++)
+ options.revCharsBuf[options.chars.charCodeAt(i)] = i;
+ }
+
+ return {
+ toEncoding: function(str) {
+ str = ensureString(str);
+
+ var buf = new Buffer(str.length);
+ var revCharsBuf = options.revCharsBuf;
+ for (var i = 0; i < str.length; i++)
+ buf[i] = revCharsBuf[str.charCodeAt(i)];
+
+ return buf;
+ },
+ fromEncoding: function(buf) {
+ buf = ensureBuffer(buf);
+
+ // Strings are immutable in JS -> we use ucs2 buffer to speed up computations.
+ var charsBuf = options.charsBuf;
+ var newBuf = new Buffer(buf.length*2);
+ var idx1 = 0, idx2 = 0;
+ for (var i = 0, _len = buf.length; i < _len; i++) {
+ idx1 = buf[i]*2; idx2 = i*2;
+ newBuf[idx2] = charsBuf[idx1];
+ newBuf[idx2+1] = charsBuf[idx1+1];
+ }
+ return newBuf.toString('ucs2');
+ }
+ };
+ },
+
+ // Codepage double-byte encodings.
+ table: function(options) {
+ var table = options.table, key, revCharsTable = options.revCharsTable;
+ if (!table) {
+ throw new Error("Encoding '" + options.type +"' has incorect 'table' option");
+ }
+ if(!revCharsTable) {
+ revCharsTable = options.revCharsTable = {};
+ for (key in table) {
+ revCharsTable[table[key]] = parseInt(key);
+ }
+ }
+
+ return {
+ toEncoding: function(str) {
+ str = ensureString(str);
+ var strLen = str.length;
+ var bufLen = strLen;
+ for (var i = 0; i < strLen; i++)
+ if (str.charCodeAt(i) >> 7)
+ bufLen++;
+
+ var newBuf = new Buffer(bufLen), gbkcode, unicode,
+ defaultChar = revCharsTable[iconv.defaultCharUnicode.charCodeAt(0)];
+
+ for (var i = 0, j = 0; i < strLen; i++) {
+ unicode = str.charCodeAt(i);
+ if (unicode >> 7) {
+ gbkcode = revCharsTable[unicode] || defaultChar;
+ newBuf[j++] = gbkcode >> 8; //high byte;
+ newBuf[j++] = gbkcode & 0xFF; //low byte
+ } else {//ascii
+ newBuf[j++] = unicode;
+ }
+ }
+ return newBuf;
+ },
+ fromEncoding: function(buf) {
+ buf = ensureBuffer(buf);
+ var bufLen = buf.length, strLen = 0;
+ for (var i = 0; i < bufLen; i++) {
+ strLen++;
+ if (buf[i] & 0x80) //the high bit is 1, so this byte is gbkcode's high byte.skip next byte
+ i++;
+ }
+ var newBuf = new Buffer(strLen*2), unicode, gbkcode,
+ defaultChar = iconv.defaultCharUnicode.charCodeAt(0);
+
+ for (var i = 0, j = 0; i < bufLen; i++, j+=2) {
+ gbkcode = buf[i];
+ if (gbkcode & 0x80) {
+ gbkcode = (gbkcode << 8) + buf[++i];
+ unicode = table[gbkcode] || defaultChar;
+ } else {
+ unicode = gbkcode;
+ }
+ newBuf[j] = unicode & 0xFF; //low byte
+ newBuf[j+1] = unicode >> 8; //high byte
+ }
+ return newBuf.toString('ucs2');
+ }
+ }
+ }
+ }
+};
+
+// Add aliases to convert functions
+iconv.encode = iconv.toEncoding;
+iconv.decode = iconv.fromEncoding;
+
+// Load other encodings from files in /encodings dir.
+var encodingsDir = __dirname+"/encodings/",
+ fs = require('fs');
+fs.readdirSync(encodingsDir).forEach(function(file) {
+ if(fs.statSync(encodingsDir + file).isDirectory()) return;
+ var encodings = require(encodingsDir + file)
+ for (var key in encodings)
+ iconv.encodings[key] = encodings[key]
+});
+
+// Utilities
+var asciiString = '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f'+
+ ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f';
+
+var ensureBuffer = function(buf) {
+ buf = buf || new Buffer(0);
+ return (buf instanceof Buffer) ? buf : new Buffer(buf.toString(), "utf8");
+}
+
+var ensureString = function(str) {
+ str = str || "";
+ return (str instanceof String) ? str : str.toString((str instanceof Buffer) ? 'utf8' : undefined);
+}
+
+var getType = function(obj) {
+ return Object.prototype.toString.call(obj).slice(8, -1);
+}
+
+
+});
+
+require.define("/node_modules/http-browserify/package.json", function (require, module, exports, __dirname, __filename) {
+ module.exports = {"main":"index.js","browserify":"browser.js"}
+});
+
+require.define("/node_modules/http-browserify/browser.js", function (require, module, exports, __dirname, __filename) {
+ var http = module.exports;
+var EventEmitter = require('events').EventEmitter;
+var Request = require('./lib/request');
+
+http.request = function (params, cb) {
+ if (!params) params = {};
+ if (!params.host) params.host = window.location.host.split(':')[0];
+ if (!params.port) params.port = window.location.port;
+
+ var req = new Request(new xhrHttp, params);
+ if (cb) req.on('response', cb);
+ return req;
+};
+
+http.get = function (params, cb) {
+ params.method = 'GET';
+ var req = http.request(params, cb);
+ req.end();
+ return req;
+};
+
+var xhrHttp = (function () {
+ if (typeof window === 'undefined') {
+ throw new Error('no window object present');
+ }
+ else if (window.XMLHttpRequest) {
+ return window.XMLHttpRequest;
+ }
+ else if (window.ActiveXObject) {
+ var axs = [
+ 'Msxml2.XMLHTTP.6.0',
+ 'Msxml2.XMLHTTP.3.0',
+ 'Microsoft.XMLHTTP'
+ ];
+ for (var i = 0; i < axs.length; i++) {
+ try {
+ var ax = new(window.ActiveXObject)(axs[i]);
+ return function () {
+ if (ax) {
+ var ax_ = ax;
+ ax = null;
+ return ax_;
+ }
+ else {
+ return new(window.ActiveXObject)(axs[i]);
+ }
+ };
+ }
+ catch (e) {}
+ }
+ throw new Error('ajax not supported in this browser')
+ }
+ else {
+ throw new Error('ajax not supported in this browser');
+ }
+})();
+
+http.STATUS_CODES = {
+ 100 : 'Continue',
+ 101 : 'Switching Protocols',
+ 102 : 'Processing', // RFC 2518, obsoleted by RFC 4918
+ 200 : 'OK',
+ 201 : 'Created',
+ 202 : 'Accepted',
+ 203 : 'Non-Authoritative Information',
+ 204 : 'No Content',
+ 205 : 'Reset Content',
+ 206 : 'Partial Content',
+ 207 : 'Multi-Status', // RFC 4918
+ 300 : 'Multiple Choices',
+ 301 : 'Moved Permanently',
+ 302 : 'Moved Temporarily',
+ 303 : 'See Other',
+ 304 : 'Not Modified',
+ 305 : 'Use Proxy',
+ 307 : 'Temporary Redirect',
+ 400 : 'Bad Request',
+ 401 : 'Unauthorized',
+ 402 : 'Payment Required',
+ 403 : 'Forbidden',
+ 404 : 'Not Found',
+ 405 : 'Method Not Allowed',
+ 406 : 'Not Acceptable',
+ 407 : 'Proxy Authentication Required',
+ 408 : 'Request Time-out',
+ 409 : 'Conflict',
+ 410 : 'Gone',
+ 411 : 'Length Required',
+ 412 : 'Precondition Failed',
+ 413 : 'Request Entity Too Large',
+ 414 : 'Request-URI Too Large',
+ 415 : 'Unsupported Media Type',
+ 416 : 'Requested Range Not Satisfiable',
+ 417 : 'Expectation Failed',
+ 418 : 'I\'m a teapot', // RFC 2324
+ 422 : 'Unprocessable Entity', // RFC 4918
+ 423 : 'Locked', // RFC 4918
+ 424 : 'Failed Dependency', // RFC 4918
+ 425 : 'Unordered Collection', // RFC 4918
+ 426 : 'Upgrade Required', // RFC 2817
+ 500 : 'Internal Server Error',
+ 501 : 'Not Implemented',
+ 502 : 'Bad Gateway',
+ 503 : 'Service Unavailable',
+ 504 : 'Gateway Time-out',
+ 505 : 'HTTP Version not supported',
+ 506 : 'Variant Also Negotiates', // RFC 2295
+ 507 : 'Insufficient Storage', // RFC 4918
+ 509 : 'Bandwidth Limit Exceeded',
+ 510 : 'Not Extended' // RFC 2774
+};
+
+});
+
+require.define("/node_modules/http-browserify/lib/request.js", function (require, module, exports, __dirname, __filename) {
+ var EventEmitter = require('events').EventEmitter;
+var Response = require('./response');
+var isSafeHeader = require('./isSafeHeader');
+
+var Request = module.exports = function (xhr, params) {
+ var self = this;
+ self.xhr = xhr;
+ self.body = '';
+
+ var uri = params.host + ':' + params.port + (params.path || '/');
+
+ xhr.open(
+ params.method || 'GET',
+ (params.scheme || 'http') + '://' + uri,
+ true
+ );
+
+ if (params.headers) {
+ Object.keys(params.headers).forEach(function (key) {
+ if (!isSafeHeader(key)) return;
+ var value = params.headers[key];
+ if (Array.isArray(value)) {
+ value.forEach(function (v) {
+ xhr.setRequestHeader(key, v);
+ });
+ }
+ else xhr.setRequestHeader(key, value)
+ });
+ }
+
+ var res = new Response(xhr);
+ res.on('ready', function () {
+ self.emit('response', res);
+ });
+
+ xhr.onreadystatechange = function () {
+ res.handle(xhr);
+ };
+};
+
+Request.prototype = new EventEmitter;
+
+Request.prototype.setHeader = function (key, value) {
+ if ((Array.isArray && Array.isArray(value))
+ || value instanceof Array) {
+ for (var i = 0; i < value.length; i++) {
+ this.xhr.setRequestHeader(key, value[i]);
+ }
+ }
+ else {
+ this.xhr.setRequestHeader(key, value);
+ }
+};
+
+Request.prototype.write = function (s) {
+ this.body += s;
+};
+
+Request.prototype.end = function (s) {
+ if (s !== undefined) this.write(s);
+ this.xhr.send(this.body);
+};
+
+});
+
+require.define("/node_modules/http-browserify/lib/response.js", function (require, module, exports, __dirname, __filename) {
+ var EventEmitter = require('events').EventEmitter;
+var isSafeHeader = require('./isSafeHeader');
+
+var Response = module.exports = function (xhr) {
+ this.xhr = xhr;
+ this.offset = 0;
+};
+
+Response.prototype = new EventEmitter;
+
+var capable = {
+ streaming : true,
+ status2 : true
+};
+
+function parseHeaders (xhr) {
+ var lines = xhr.getAllResponseHeaders().split(/\r?\n/);
+ var headers = {};
+ for (var i = 0; i < lines.length; i++) {
+ var line = lines[i];
+ if (line === '') continue;
+
+ var m = line.match(/^([^:]+):\s*(.*)/);
+ if (m) {
+ var key = m[1].toLowerCase(), value = m[2];
+
+ if (headers[key] !== undefined) {
+ if ((Array.isArray && Array.isArray(headers[key]))
+ || headers[key] instanceof Array) {
+ headers[key].push(value);
+ }
+ else {
+ headers[key] = [ headers[key], value ];
+ }
+ }
+ else {
+ headers[key] = value;
+ }
+ }
+ else {
+ headers[line] = true;
+ }
+ }
+ return headers;
+}
+
+Response.prototype.getHeader = function (key) {
+ var header = this.headers ? this.headers[key.toLowerCase()] : null;
+ if (header) return header;
+
+ // Work around Mozilla bug #608735 [https://bugzil.la/608735], which causes
+ // getAllResponseHeaders() to return {} if the response is a CORS request.
+ // xhr.getHeader still works correctly.
+ if (isSafeHeader(key)) {
+ return this.xhr.getResponseHeader(key);
+ }
+ return null;
+};
+
+Response.prototype.handle = function () {
+ var xhr = this.xhr;
+ if (xhr.readyState === 2 && capable.status2) {
+ try {
+ this.statusCode = xhr.status;
+ this.headers = parseHeaders(xhr);
+ }
+ catch (err) {
+ capable.status2 = false;
+ }
+
+ if (capable.status2) {
+ this.emit('ready');
+ }
+ }
+ else if (capable.streaming && xhr.readyState === 3) {
+ try {
+ if (!this.statusCode) {
+ this.statusCode = xhr.status;
+ this.headers = parseHeaders(xhr);
+ this.emit('ready');
+ }
+ }
+ catch (err) {}
+
+ try {
+ this.write();
+ }
+ catch (err) {
+ capable.streaming = false;
+ }
+ }
+ else if (xhr.readyState === 4) {
+ if (!this.statusCode) {
+ this.statusCode = xhr.status;
+ this.emit('ready');
+ }
+ this.write();
+
+ if (xhr.error) {
+ this.emit('error', xhr.responseText);
+ }
+ else this.emit('end');
+ }
+};
+
+Response.prototype.write = function () {
+ var xhr = this.xhr;
+ if (xhr.responseText.length > this.offset) {
+ this.emit('data', xhr.responseText.slice(this.offset));
+ this.offset = xhr.responseText.length;
+ }
+};
+
+});
+
+require.define("/node_modules/http-browserify/lib/isSafeHeader.js", function (require, module, exports, __dirname, __filename) {
+ // Taken from http://dxr.mozilla.org/mozilla/mozilla-central/content/base/src/nsXMLHttpRequest.cpp.html
+var unsafeHeaders = [
+ "accept-charset",
+ "accept-encoding",
+ "access-control-request-headers",
+ "access-control-request-method",
+ "connection",
+ "content-length",
+ "cookie",
+ "cookie2",
+ "content-transfer-encoding",
+ "date",
+ "expect",
+ "host",
+ "keep-alive",
+ "origin",
+ "referer",
+ "set-cookie",
+ "te",
+ "trailer",
+ "transfer-encoding",
+ "upgrade",
+ "user-agent",
+ "via"
+];
+
+module.exports = function (headerName) {
+ if (!headerName) return false;
+ return (unsafeHeaders.indexOf(headerName.toLowerCase()) === -1)
+};
+
+});
+
+require.alias("http-browserify", "/node_modules/http");
+
+require.alias("http-browserify", "/node_modules/https"); \ No newline at end of file
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/shred/content.js b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/shred/content.js
new file mode 100644
index 0000000..a30f474
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/shred/content.js
@@ -0,0 +1,208 @@
+/*
+ * 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.
+ */
+
+// The purpose of the `Content` object is to abstract away the data conversions
+// to and from raw content entities as strings. For example, you want to be able
+// to pass in a Javascript object and have it be automatically converted into a
+// JSON string if the `content-type` is set to a JSON-based media type.
+// Conversely, you want to be able to transparently get back a Javascript object
+// in the response if the `content-type` is a JSON-based media-type.
+
+// One limitation of the current implementation is that it [assumes the `charset` is UTF-8](https://github.com/spire-io/shred/issues/5).
+
+// The `Content` constructor takes an options object, which *must* have either a
+// `body` or `data` property and *may* have a `type` property indicating the
+// media type. If there is no `type` attribute, a default will be inferred.
+var Content = function(options) {
+ this.body = options.body;
+ this.data = options.data;
+ this.type = options.type;
+};
+
+Content.prototype = {
+ // Treat `toString()` as asking for the `content.body`. That is, the raw content entity.
+ //
+ // toString: function() { return this.body; }
+ //
+ // Commented out, but I've forgotten why. :/
+};
+
+
+// `Content` objects have the following attributes:
+Object.defineProperties(Content.prototype,{
+
+// - **type**. Typically accessed as `content.type`, reflects the `content-type`
+// header associated with the request or response. If not passed as an options
+// to the constructor or set explicitly, it will infer the type the `data`
+// attribute, if possible, and, failing that, will default to `text/plain`.
+ type: {
+ get: function() {
+ if (this._type) {
+ return this._type;
+ } else {
+ if (this._data) {
+ switch(typeof this._data) {
+ case "string": return "text/plain";
+ case "object": return "application/json";
+ }
+ }
+ }
+ return "text/plain";
+ },
+ set: function(value) {
+ this._type = value;
+ return this;
+ },
+ enumerable: true
+ },
+
+// - **data**. Typically accessed as `content.data`, reflects the content entity
+// converted into Javascript data. This can be a string, if the `type` is, say,
+// `text/plain`, but can also be a Javascript object. The conversion applied is
+// based on the `processor` attribute. The `data` attribute can also be set
+// directly, in which case the conversion will be done the other way, to infer
+// the `body` attribute.
+ data: {
+ get: function() {
+ if (this._body) {
+ return this.processor.parser(this._body);
+ } else {
+ return this._data;
+ }
+ },
+ set: function(data) {
+ if (this._body&&data) Errors.setDataWithBody(this);
+ this._data = data;
+ return this;
+ },
+ enumerable: true
+ },
+
+// - **body**. Typically accessed as `content.body`, reflects the content entity
+// as a UTF-8 string. It is the mirror of the `data` attribute. If you set the
+// `data` attribute, the `body` attribute will be inferred and vice-versa. If
+// you attempt to set both, an exception is raised.
+ body: {
+ get: function() {
+ if (this._data) {
+ return this.processor.stringify(this._data);
+ } else {
+ return this._body.toString();
+ }
+ },
+ set: function(body) {
+ if (this._data&&body) Errors.setBodyWithData(this);
+ this._body = body;
+ return this;
+ },
+ enumerable: true
+ },
+
+// - **processor**. The functions that will be used to convert to/from `data` and
+// `body` attributes. You can add processors. The two that are built-in are for
+// `text/plain`, which is basically an identity transformation and
+// `application/json` and other JSON-based media types (including custom media
+// types with `+json`). You can add your own processors. See below.
+ processor: {
+ get: function() {
+ var processor = Content.processors[this.type];
+ if (processor) {
+ return processor;
+ } else {
+ // Return the first processor that matches any part of the
+ // content type. ex: application/vnd.foobar.baz+json will match json.
+ var main = this.type.split(";")[0];
+ var parts = main.split(/\+|\//);
+ for (var i=0, l=parts.length; i < l; i++) {
+ processor = Content.processors[parts[i]]
+ }
+ return processor || {parser:identity,stringify:toString};
+ }
+ },
+ enumerable: true
+ },
+
+// - **length**. Typically accessed as `content.length`, returns the length in
+// bytes of the raw content entity.
+ length: {
+ get: function() {
+ if (typeof Buffer !== 'undefined') {
+ return Buffer.byteLength(this.body);
+ }
+ return this.body.length;
+ }
+ }
+});
+
+Content.processors = {};
+
+// The `registerProcessor` function allows you to add your own processors to
+// convert content entities. Each processor consists of a Javascript object with
+// two properties:
+// - **parser**. The function used to parse a raw content entity and convert it
+// into a Javascript data type.
+// - **stringify**. The function used to convert a Javascript data type into a
+// raw content entity.
+Content.registerProcessor = function(types,processor) {
+
+// You can pass an array of types that will trigger this processor, or just one.
+// We determine the array via duck-typing here.
+ if (types.forEach) {
+ types.forEach(function(type) {
+ Content.processors[type] = processor;
+ });
+ } else {
+ // If you didn't pass an array, we just use what you pass in.
+ Content.processors[types] = processor;
+ }
+};
+
+// Register the identity processor, which is used for text-based media types.
+var identity = function(x) { return x; }
+ , toString = function(x) { return x.toString(); }
+Content.registerProcessor(
+ ["text/html","text/plain","text"],
+ { parser: identity, stringify: toString });
+
+// Register the JSON processor, which is used for JSON-based media types.
+Content.registerProcessor(
+ ["application/json; charset=utf-8","application/json","json"],
+ {
+ parser: function(string) {
+ return JSON.parse(string);
+ },
+ stringify: function(data) {
+ return JSON.stringify(data); }});
+
+var qs = require('querystring');
+// Register the post processor, which is used for JSON-based media types.
+Content.registerProcessor(
+ ["application/x-www-form-urlencoded"],
+ { parser : qs.parse, stringify : qs.stringify });
+
+// Error functions are defined separately here in an attempt to make the code
+// easier to read.
+var Errors = {
+ setDataWithBody: function(object) {
+ throw new Error("Attempt to set data attribute of a content object " +
+ "when the body attributes was already set.");
+ },
+ setBodyWithData: function(object) {
+ throw new Error("Attempt to set body attribute of a content object " +
+ "when the data attributes was already set.");
+ }
+}
+module.exports = Content; \ No newline at end of file
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/swagger-client.js b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/swagger-client.js
new file mode 100644
index 0000000..1c76448
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/swagger-client.js
@@ -0,0 +1,3309 @@
+/*
+ * 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.
+ */
+/**
+ * swagger-client - swagger.js is a javascript client for use with swaggering APIs.
+ * @version v2.1.9-M1
+ * @link http://swagger.io
+ * @license apache 2.0
+ */
+(function(){
+var ArrayModel = function(definition) {
+ this.name = "arrayModel";
+ this.definition = definition || {};
+ this.properties = [];
+
+ var requiredFields = definition.enum || [];
+ var innerType = definition.items;
+ if(innerType) {
+ if(innerType.type) {
+ this.type = typeFromJsonSchema(innerType.type, innerType.format);
+ }
+ else {
+ this.ref = innerType.$ref;
+ }
+ }
+ return this;
+};
+
+ArrayModel.prototype.createJSONSample = function(modelsToIgnore) {
+ var result;
+ modelsToIgnore = (modelsToIgnore||{});
+ if(this.type) {
+ result = this.type;
+ }
+ else if (this.ref) {
+ var name = simpleRef(this.ref);
+ if(typeof modelsToIgnore[name] === 'undefined') {
+ modelsToIgnore[name] = this;
+ result = models[name].createJSONSample(modelsToIgnore);
+ }
+ else {
+ return name;
+ }
+ }
+ return [ result ];
+};
+
+ArrayModel.prototype.getSampleValue = function(modelsToIgnore) {
+ var result;
+ modelsToIgnore = (modelsToIgnore || {});
+ if(this.type) {
+ result = type;
+ }
+ else if (this.ref) {
+ var name = simpleRef(this.ref);
+ result = models[name].getSampleValue(modelsToIgnore);
+ }
+ return [ result ];
+};
+
+ArrayModel.prototype.getMockSignature = function(modelsToIgnore) {
+ var propertiesStr = [];
+ var i, prop;
+ for (i = 0; i < this.properties.length; i++) {
+ prop = this.properties[i];
+ propertiesStr.push(prop.toString());
+ }
+
+ var strong = '<span class="strong">';
+ var stronger = '<span class="stronger">';
+ var strongClose = '</span>';
+ var classOpen = strong + 'array' + ' {' + strongClose;
+ var classClose = strong + '}' + strongClose;
+ var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
+
+ if (!modelsToIgnore)
+ modelsToIgnore = {};
+ modelsToIgnore[this.name] = this;
+ for (i = 0; i < this.properties.length; i++) {
+ prop = this.properties[i];
+ var ref = prop.$ref;
+ var model = models[ref];
+ if (model && typeof modelsToIgnore[ref] === 'undefined') {
+ returnVal = returnVal + ('<br>' + model.getMockSignature(modelsToIgnore));
+ }
+ }
+ return returnVal;
+};
+
+
+/**
+ * SwaggerAuthorizations applys the correct authorization to an operation being executed
+ */
+var SwaggerAuthorizations = function() {
+ this.authz = {};
+};
+
+SwaggerAuthorizations.prototype.add = function(name, auth) {
+ this.authz[name] = auth;
+ return auth;
+};
+
+SwaggerAuthorizations.prototype.remove = function(name) {
+ return delete this.authz[name];
+};
+
+SwaggerAuthorizations.prototype.apply = function (obj, authorizations) {
+ var status = null;
+ var key, name, value, result;
+
+ // if the "authorizations" key is undefined, or has an empty array, add all keys
+ if (typeof authorizations === 'undefined' || Object.keys(authorizations).length === 0) {
+ for (key in this.authz) {
+ value = this.authz[key];
+ result = value.apply(obj, authorizations);
+ if (result === true)
+ status = true;
+ }
+ }
+ else {
+ // 2.0 support
+ if (Array.isArray(authorizations)) {
+
+ for (var i = 0; i < authorizations.length; i++) {
+ var auth = authorizations[i];
+ for (name in auth) {
+ for (key in this.authz) {
+ if (key == name) {
+ value = this.authz[key];
+ result = value.apply(obj, authorizations);
+ if (result === true)
+ status = true;
+ }
+ }
+ }
+ }
+ }
+ else {
+ // 1.2 support
+ for (name in authorizations) {
+ for (key in this.authz) {
+ if (key == name) {
+ value = this.authz[key];
+ result = value.apply(obj, authorizations);
+ if (result === true)
+ status = true;
+ }
+ }
+ }
+ }
+ }
+
+ return status;
+};
+
+/**
+ * ApiKeyAuthorization allows a query param or header to be injected
+ */
+var ApiKeyAuthorization = function(name, value, type) {
+ this.name = name;
+ this.value = value;
+ this.type = type;
+};
+
+ApiKeyAuthorization.prototype.apply = function(obj, authorizations) {
+ if (this.type === "query") {
+ if (obj.url.indexOf('?') > 0)
+ obj.url = obj.url + "&" + this.name + "=" + this.value;
+ else
+ obj.url = obj.url + "?" + this.name + "=" + this.value;
+ return true;
+ } else if (this.type === "header") {
+ obj.headers[this.name] = this.value;
+ return true;
+ }
+};
+
+var CookieAuthorization = function(cookie) {
+ this.cookie = cookie;
+};
+
+CookieAuthorization.prototype.apply = function(obj, authorizations) {
+ obj.cookieJar = obj.cookieJar || CookieJar();
+ obj.cookieJar.setCookie(this.cookie);
+ return true;
+};
+
+/**
+ * Password Authorization is a basic auth implementation
+ */
+var PasswordAuthorization = function(name, username, password) {
+ this.name = name;
+ this.username = username;
+ this.password = password;
+ this._btoa = null;
+ if (typeof window !== 'undefined')
+ this._btoa = btoa;
+ else
+ this._btoa = require("btoa");
+};
+
+PasswordAuthorization.prototype.apply = function(obj, authorizations) {
+ var base64encoder = this._btoa;
+ obj.headers.Authorization = "Basic " + base64encoder(this.username + ":" + this.password);
+ return true;
+};
+var __bind = function(fn, me){
+ return function(){
+ return fn.apply(me, arguments);
+ };
+};
+
+fail = function(message) {
+ log(message);
+};
+
+log = function(){
+ log.history = log.history || [];
+ log.history.push(arguments);
+ if(this.console){
+ console.log( Array.prototype.slice.call(arguments)[0] );
+ }
+};
+
+if (!Array.prototype.indexOf) {
+ Array.prototype.indexOf = function(obj, start) {
+ for (var i = (start || 0), j = this.length; i < j; i++) {
+ if (this[i] === obj) { return i; }
+ }
+ return -1;
+ };
+}
+
+/**
+ * allows override of the default value based on the parameter being
+ * supplied
+ **/
+var applyParameterMacro = function (operation, parameter) {
+ var e = (typeof window !== 'undefined' ? window : exports);
+ if(e.parameterMacro)
+ return e.parameterMacro(operation, parameter);
+ else
+ return parameter.defaultValue;
+};
+
+/**
+ * allows overriding the default value of an model property
+ **/
+var applyModelPropertyMacro = function (model, property) {
+ var e = (typeof window !== 'undefined' ? window : exports);
+ if(e.modelPropertyMacro)
+ return e.modelPropertyMacro(model, property);
+ else
+ return property.defaultValue;
+};
+
+/**
+ * PrimitiveModel
+ **/
+var PrimitiveModel = function(definition) {
+ this.name = "name";
+ this.definition = definition || {};
+ this.properties = [];
+
+ var requiredFields = definition.enum || [];
+ this.type = typeFromJsonSchema(definition.type, definition.format);
+};
+
+PrimitiveModel.prototype.createJSONSample = function(modelsToIgnore) {
+ var result = this.type;
+ return result;
+};
+
+PrimitiveModel.prototype.getSampleValue = function() {
+ var result = this.type;
+ return null;
+};
+
+PrimitiveModel.prototype.getMockSignature = function(modelsToIgnore) {
+ var propertiesStr = [];
+ var i, prop;
+ for (i = 0; i < this.properties.length; i++) {
+ prop = this.properties[i];
+ propertiesStr.push(prop.toString());
+ }
+
+ var strong = '<span class="strong">';
+ var stronger = '<span class="stronger">';
+ var strongClose = '</span>';
+ var classOpen = strong + this.name + ' {' + strongClose;
+ var classClose = strong + '}' + strongClose;
+ var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
+
+ if (!modelsToIgnore)
+ modelsToIgnore = {};
+ modelsToIgnore[this.name] = this;
+ for (i = 0; i < this.properties.length; i++) {
+ prop = this.properties[i];
+ var ref = prop.$ref;
+ var model = models[ref];
+ if (model && typeof modelsToIgnore[ref] === 'undefined') {
+ returnVal = returnVal + ('<br>' + model.getMockSignature(modelsToIgnore));
+ }
+ }
+ return returnVal;
+};
+/**
+ * Resolves a spec's remote references
+ */
+var Resolver = function (){};
+
+Resolver.prototype.resolve = function(spec, callback, scope) {
+ this.scope = (scope || this);
+ var host, name, path, property, propertyName, type;
+ var processedCalls = 0, resolvedRefs = {}, unresolvedRefs = {};
+
+ // store objects for dereferencing
+ var resolutionTable = {};
+
+ // models
+ for(name in spec.definitions) {
+ var model = spec.definitions[name];
+ for(propertyName in model.properties) {
+ property = model.properties[propertyName];
+ this.resolveTo(property, resolutionTable);
+ }
+ }
+ // operations
+ for(name in spec.paths) {
+ var method, operation, responseCode;
+ path = spec.paths[name];
+ for(method in path) {
+ operation = path[method];
+ var i, parameters = operation.parameters;
+ for(i in parameters) {
+ var parameter = parameters[i];
+ if(parameter.in === 'body' && parameter.schema) {
+ this.resolveTo(parameter.schema, resolutionTable);
+ }
+ if(parameter.$ref) {
+ this.resolveInline(spec, parameter, resolutionTable, unresolvedRefs);
+ }
+ }
+ for(responseCode in operation.responses) {
+ var response = operation.responses[responseCode];
+ if(response.schema) {
+ this.resolveTo(response.schema, resolutionTable);
+ }
+ }
+ }
+ }
+ // get hosts
+ var opts = {}, expectedCalls = 0;
+ for(name in resolutionTable) {
+ var parts = name.split('#');
+ if(parts.length == 2) {
+ host = parts[0]; path = parts[1];
+ if(!Array.isArray(opts[host])) {
+ opts[host] = [];
+ expectedCalls += 1;
+ }
+ opts[host].push(path);
+ }
+ }
+
+ for(name in opts) {
+ var self = this, opt = opts[name];
+ host = name;
+
+ var obj = {
+ useJQuery: false, // TODO
+ url: host,
+ method: "get",
+ headers: {
+ accept: this.scope.swaggerRequestHeaders || 'application/json'
+ },
+ on: {
+ error: function(response) {
+ processedCalls += 1;
+ var i;
+ for(i = 0; i < opt.length; i++) {
+ // fail all of these
+ var resolved = host + '#' + opt[i];
+ unresolvedRefs[resolved] = null;
+ }
+ if(processedCalls === expectedCalls)
+ self.finish(spec, resolutionTable, resolvedRefs, unresolvedRefs, callback);
+ },
+ response: function(response) {
+ var i, j, swagger = response.obj;
+ processedCalls += 1;
+ for(i = 0; i < opt.length; i++) {
+ var location = swagger, path = opt[i], parts = path.split('/');
+ for(j = 0; j < parts.length; j++) {
+ var segment = parts[j];
+ if(typeof location === 'undefined')
+ break;
+ if(segment.length > 0)
+ location = location[segment];
+ }
+ var resolved = host + '#' + path, resolvedName = parts[j-1];
+ if(typeof location !== 'undefined') {
+ resolvedRefs[resolved] = {
+ name: resolvedName,
+ obj: location
+ };
+ }
+ else unresolvedRefs[resolved] = null;
+ }
+ if(processedCalls === expectedCalls)
+ self.finish(spec, resolutionTable, resolvedRefs, unresolvedRefs, callback);
+ }
+ }
+ };
+ authorizations.apply(obj);
+ new SwaggerHttp().execute(obj);
+ }
+ if(Object.keys(opts).length === 0)
+ callback.call(this.scope, spec, unresolvedRefs);
+};
+
+Resolver.prototype.finish = function(spec, resolutionTable, resolvedRefs, unresolvedRefs, callback) {
+ // walk resolution table and replace with resolved refs
+ var ref;
+ for(ref in resolutionTable) {
+ var i, locations = resolutionTable[ref];
+ for(i = 0; i < locations.length; i++) {
+ var resolvedTo = resolvedRefs[locations[i].obj.$ref];
+ if(resolvedTo) {
+ if(!spec.definitions)
+ spec.definitions = {};
+ if(locations[i].resolveAs === '$ref') {
+ spec.definitions[resolvedTo.name] = resolvedTo.obj;
+ locations[i].obj.$ref = '#/definitions/' + resolvedTo.name;
+ }
+ else if (locations[i].resolveAs === 'inline') {
+ var key;
+ var targetObj = locations[i].obj;
+ delete targetObj.$ref;
+ for(key in resolvedTo.obj) {
+ targetObj[key] = resolvedTo.obj[key];
+ }
+ }
+ }
+ }
+ }
+ callback.call(this.scope, spec, unresolvedRefs);
+};
+
+/**
+ * immediately in-lines local refs, queues remote refs
+ * for inline resolution
+ */
+Resolver.prototype.resolveInline = function (spec, property, objs, unresolvedRefs) {
+ var ref = property.$ref;
+ if(ref) {
+ if(ref.indexOf('http') === 0) {
+ if(Array.isArray(objs[ref])) {
+ objs[ref].push({obj: property, resolveAs: 'inline'});
+ }
+ else {
+ objs[ref] = [{obj: property, resolveAs: 'inline'}];
+ }
+ }
+ else if (ref.indexOf('#') === 0) {
+ // local resolve
+ var shortenedRef = ref.substring(1);
+ var i, parts = shortenedRef.split('/'), location = spec;
+ for(i = 0; i < parts.length; i++) {
+ var part = parts[i];
+ if(part.length > 0) {
+ location = location[part];
+ }
+ }
+ if(location) {
+ delete property.$ref;
+ var key;
+ for(key in location) {
+ property[key] = location[key];
+ }
+ }
+ else unresolvedRefs[ref] = null;
+ }
+ }
+ else if(property.type === 'array') {
+ this.resolveTo(property.items, objs);
+ }
+};
+
+Resolver.prototype.resolveTo = function (property, objs) {
+ var ref = property.$ref;
+ if(ref) {
+ if(ref.indexOf('http') === 0) {
+ if(Array.isArray(objs[ref])) {
+ objs[ref].push({obj: property, resolveAs: '$ref'});
+ }
+ else {
+ objs[ref] = [{obj: property, resolveAs: '$ref'}];
+ }
+ }
+ }
+ else if(property.type === 'array') {
+ var items = property.items;
+ this.resolveTo(items, objs);
+ }
+};
+var addModel = function(name, model) {
+ models[name] = model;
+};
+
+var SwaggerClient = function(url, options) {
+ this.isBuilt = false;
+ this.url = null;
+ this.debug = false;
+ this.basePath = null;
+ this.modelsArray = [];
+ this.authorizations = null;
+ this.authorizationScheme = null;
+ this.isValid = false;
+ this.info = null;
+ this.useJQuery = false;
+ this.resourceCount = 0;
+
+ if(typeof url !== 'undefined')
+ return this.initialize(url, options);
+};
+
+SwaggerClient.prototype.initialize = function (url, options) {
+ this.models = models = {};
+
+ options = (options||{});
+
+ if(typeof url === 'string')
+ this.url = url;
+ else if(typeof url === 'object') {
+ options = url;
+ this.url = options.url;
+ }
+ this.swaggerRequstHeaders = options.swaggerRequstHeaders || 'application/json;charset=utf-8,*/*';
+ this.defaultSuccessCallback = options.defaultSuccessCallback || null;
+ this.defaultErrorCallback = options.defaultErrorCallback || null;
+
+ if (typeof options.success === 'function')
+ this.success = options.success;
+
+ if (options.useJQuery)
+ this.useJQuery = options.useJQuery;
+
+ if (options.authorizations) {
+ this.clientAuthorizations = options.authorizations;
+ } else {
+ this.clientAuthorizations = authorizations;
+ }
+
+ this.supportedSubmitMethods = options.supportedSubmitMethods || [];
+ this.failure = options.failure || function() {};
+ this.progress = options.progress || function() {};
+ this.spec = options.spec;
+ this.options = options;
+
+ if (typeof options.success === 'function') {
+ this.ready = true;
+ this.build();
+ }
+};
+
+SwaggerClient.prototype.build = function(mock) {
+ if (this.isBuilt) return this;
+ var self = this;
+ this.progress('fetching resource list: ' + this.url);
+ var obj = {
+ useJQuery: this.useJQuery,
+ url: this.url,
+ method: "get",
+ headers: {
+ accept: this.swaggerRequstHeaders
+ },
+ on: {
+ error: function(response) {
+ if (self.url.substring(0, 4) !== 'http')
+ return self.fail('Please specify the protocol for ' + self.url);
+ else if (response.status === 0)
+ return self.fail('Can\'t read from server. It may not have the appropriate access-control-origin settings.');
+ else if (response.status === 404)
+ return self.fail('Can\'t read swagger JSON from ' + self.url);
+ else
+ return self.fail(response.status + ' : ' + response.statusText + ' ' + self.url);
+ },
+ response: function(resp) {
+ var responseObj = resp.obj || JSON.parse(resp.data);
+ self.swaggerVersion = responseObj.swaggerVersion;
+
+ if(responseObj.swagger && parseInt(responseObj.swagger) === 2) {
+ self.swaggerVersion = responseObj.swagger;
+ new Resolver().resolve(responseObj, self.buildFromSpec, self);
+ self.isValid = true;
+ }
+ else {
+ if (self.swaggerVersion === '1.2') {
+ return self.buildFrom1_2Spec(responseObj);
+ } else {
+ return self.buildFrom1_1Spec(responseObj);
+ }
+ }
+ }
+ }
+ };
+ if(this.spec) {
+ setTimeout(function() {
+ new Resolver().resolve(self.spec, self.buildFromSpec, self);
+ }, 10);
+ }
+ else {
+ authorizations.apply(obj);
+ if(mock)
+ return obj;
+ new SwaggerHttp().execute(obj);
+ }
+ return this;
+};
+
+SwaggerClient.prototype.buildFromSpec = function(response) {
+ if(this.isBuilt) return this;
+
+ this.info = response.info || {};
+ this.title = response.title || '';
+ this.host = response.host || '';
+ this.schemes = response.schemes || [];
+ this.basePath = response.basePath || '';
+ this.apis = {};
+ this.apisArray = [];
+ this.consumes = response.consumes;
+ this.produces = response.produces;
+ this.securityDefinitions = response.securityDefinitions;
+
+ // legacy support
+ this.authSchemes = response.securityDefinitions;
+
+ var definedTags = {};
+ if(Array.isArray(response.tags)) {
+ definedTags = {};
+ for(k = 0; k < response.tags.length; k++) {
+ var t = response.tags[k];
+ definedTags[t.name] = t;
+ }
+ }
+
+ var location;
+ if(typeof this.url === 'string') {
+ location = this.parseUri(this.url);
+ }
+
+ if(typeof this.schemes === 'undefined' || this.schemes.length === 0) {
+ this.scheme = location.scheme || 'http';
+ }
+ else {
+ this.scheme = this.schemes[0];
+ }
+
+ if(typeof this.host === 'undefined' || this.host === '') {
+ this.host = location.host;
+ if (location.port) {
+ this.host = this.host + ':' + location.port;
+ }
+ }
+
+ this.definitions = response.definitions;
+ var key;
+ for(key in this.definitions) {
+ var model = new Model(key, this.definitions[key]);
+ if(model) {
+ models[key] = model;
+ }
+ }
+
+ // get paths, create functions for each operationId
+ var path;
+ var operations = [];
+ for(path in response.paths) {
+ if(typeof response.paths[path] === 'object') {
+ var httpMethod;
+ for(httpMethod in response.paths[path]) {
+ if(['delete', 'get', 'head', 'options', 'patch', 'post', 'put'].indexOf(httpMethod) === -1) {
+ continue;
+ }
+ var operation = response.paths[path][httpMethod];
+ var tags = operation.tags;
+ if(typeof tags === 'undefined') {
+ operation.tags = [ 'default' ];
+ tags = operation.tags;
+ }
+ var operationId = this.idFromOp(path, httpMethod, operation);
+ var operationObject = new Operation (
+ this,
+ operation.scheme,
+ operationId,
+ httpMethod,
+ path,
+ operation,
+ this.definitions
+ );
+ // bind this operation's execute command to the api
+ if(tags.length > 0) {
+ var i;
+ for(i = 0; i < tags.length; i++) {
+ var tag = this.tagFromLabel(tags[i]);
+ var operationGroup = this[tag];
+ if(typeof this.apis[tag] === 'undefined')
+ this.apis[tag] = {};
+ if(typeof operationGroup === 'undefined') {
+ this[tag] = [];
+ operationGroup = this[tag];
+ operationGroup.operations = {};
+ operationGroup.label = tag;
+ operationGroup.apis = [];
+ var tagObject = definedTags[tag];
+ if(typeof tagObject === 'object') {
+ operationGroup.description = tagObject.description;
+ operationGroup.externalDocs = tagObject.externalDocs;
+ }
+ this[tag].help = this.help.bind(operationGroup);
+ this.apisArray.push(new OperationGroup(tag, operationGroup.description, operationGroup.externalDocs, operationObject));
+ }
+ if(typeof this.apis[tag].help !== 'function')
+ this.apis[tag].help = this.help.bind(operationGroup);
+ // bind to the apis object
+ this.apis[tag][operationId] = operationObject.execute.bind(operationObject);
+ this.apis[tag][operationId].help = operationObject.help.bind(operationObject);
+ this.apis[tag][operationId].asCurl = operationObject.asCurl.bind(operationObject);
+ operationGroup[operationId] = operationObject.execute.bind(operationObject);
+ operationGroup[operationId].help = operationObject.help.bind(operationObject);
+ operationGroup[operationId].asCurl = operationObject.asCurl.bind(operationObject);
+
+ operationGroup.apis.push(operationObject);
+ operationGroup.operations[operationId] = operationObject;
+
+ // legacy UI feature
+ var j;
+ var api;
+ for(j = 0; j < this.apisArray.length; j++) {
+ if(this.apisArray[j].tag === tag) {
+ api = this.apisArray[j];
+ }
+ }
+ if(api) {
+ api.operationsArray.push(operationObject);
+ }
+ }
+ }
+ else {
+ log('no group to bind to');
+ }
+ }
+ }
+ }
+ this.isBuilt = true;
+ if (this.success) {
+ this.isValid = true;
+ this.isBuilt = true;
+ this.success();
+ }
+ return this;
+};
+
+SwaggerClient.prototype.parseUri = function(uri) {
+ var urlParseRE = /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;
+ var parts = urlParseRE.exec(uri);
+ return {
+ scheme: parts[4].replace(':',''),
+ host: parts[11],
+ port: parts[12],
+ path: parts[15]
+ };
+};
+
+SwaggerClient.prototype.help = function(dontPrint) {
+ var i;
+ var output = 'operations for the "' + this.label + '" tag';
+ for(i = 0; i < this.apis.length; i++) {
+ var api = this.apis[i];
+ output += '\n * ' + api.nickname + ': ' + api.operation.summary;
+ }
+ if(dontPrint)
+ return output;
+ else {
+ log(output);
+ return output;
+ }
+};
+
+SwaggerClient.prototype.tagFromLabel = function(label) {
+ return label;
+};
+
+SwaggerClient.prototype.idFromOp = function(path, httpMethod, op) {
+ var opId = op.operationId || (path.substring(1) + '_' + httpMethod);
+ return opId.replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()\+\s]/g,'_');
+};
+
+SwaggerClient.prototype.fail = function(message) {
+ this.failure(message);
+ throw message;
+};
+
+var OperationGroup = function(tag, description, externalDocs, operation) {
+ this.tag = tag;
+ this.path = tag;
+ this.description = description;
+ this.externalDocs = externalDocs;
+ this.name = tag;
+ this.operation = operation;
+ this.operationsArray = [];
+};
+
+var Operation = function(parent, scheme, operationId, httpMethod, path, args, definitions) {
+ var errors = [];
+ parent = parent||{};
+ args = args||{};
+
+ this.operations = {};
+ this.operation = args;
+ this.deprecated = args.deprecated;
+ this.consumes = args.consumes;
+ this.produces = args.produces;
+ this.parent = parent;
+ this.host = parent.host || 'localhost';
+ this.schemes = parent.schemes;
+ this.scheme = scheme || parent.scheme || 'http';
+ this.basePath = parent.basePath || '/';
+ this.nickname = (operationId||errors.push('Operations must have a nickname.'));
+ this.method = (httpMethod||errors.push('Operation ' + operationId + ' is missing method.'));
+ this.path = (path||errors.push('Operation ' + this.nickname + ' is missing path.'));
+ this.parameters = args !== null ? (args.parameters||[]) : {};
+ this.summary = args.summary || '';
+ this.responses = (args.responses||{});
+ this.type = null;
+ this.security = args.security;
+ this.authorizations = args.security;
+ this.description = args.description;
+ this.useJQuery = parent.useJQuery;
+
+ if(typeof this.deprecated === 'string') {
+ switch(this.deprecated.toLowerCase()) {
+ case 'true': case 'yes': case '1': {
+ this.deprecated = true;
+ break;
+ }
+ case 'false': case 'no': case '0': case null: {
+ this.deprecated = false;
+ break;
+ }
+ default: this.deprecated = Boolean(this.deprecated);
+ }
+ }
+
+ var i, model;
+
+ if(definitions) {
+ // add to global models
+ var key;
+ for(key in this.definitions) {
+ model = new Model(key, definitions[key]);
+ if(model) {
+ models[key] = model;
+ }
+ }
+ }
+ for(i = 0; i < this.parameters.length; i++) {
+ var param = this.parameters[i];
+ if(param.type === 'array') {
+ param.isList = true;
+ param.allowMultiple = true;
+ }
+ var innerType = this.getType(param);
+ if(innerType && innerType.toString().toLowerCase() === 'boolean') {
+ param.allowableValues = {};
+ param.isList = true;
+ param['enum'] = ["true", "false"];
+ }
+ if(typeof param['enum'] !== 'undefined') {
+ var id;
+ param.allowableValues = {};
+ param.allowableValues.values = [];
+ param.allowableValues.descriptiveValues = [];
+ for(id = 0; id < param['enum'].length; id++) {
+ var value = param['enum'][id];
+ var isDefault = (value === param.default) ? true : false;
+ param.allowableValues.values.push(value);
+ param.allowableValues.descriptiveValues.push({value : value, isDefault: isDefault});
+ }
+ }
+ if(param.type === 'array') {
+ innerType = [innerType];
+ if(typeof param.allowableValues === 'undefined') {
+ // can't show as a list if no values to select from
+ delete param.isList;
+ delete param.allowMultiple;
+ }
+ }
+ param.signature = this.getModelSignature(innerType, models).toString();
+ param.sampleJSON = this.getModelSampleJSON(innerType, models);
+ param.responseClassSignature = param.signature;
+ }
+
+ var defaultResponseCode, response, responses = this.responses;
+
+ if(responses['200']) {
+ response = responses['200'];
+ defaultResponseCode = '200';
+ }
+ else if(responses['201']) {
+ response = responses['201'];
+ defaultResponseCode = '201';
+ }
+ else if(responses['202']) {
+ response = responses['202'];
+ defaultResponseCode = '202';
+ }
+ else if(responses['203']) {
+ response = responses['203'];
+ defaultResponseCode = '203';
+ }
+ else if(responses['204']) {
+ response = responses['204'];
+ defaultResponseCode = '204';
+ }
+ else if(responses['205']) {
+ response = responses['205'];
+ defaultResponseCode = '205';
+ }
+ else if(responses['206']) {
+ response = responses['206'];
+ defaultResponseCode = '206';
+ }
+ else if(responses['default']) {
+ response = responses['default'];
+ defaultResponseCode = 'default';
+ }
+
+ if(response && response.schema) {
+ var resolvedModel = this.resolveModel(response.schema, definitions);
+ delete responses[defaultResponseCode];
+ if(resolvedModel) {
+ this.successResponse = {};
+ this.successResponse[defaultResponseCode] = resolvedModel;
+ }
+ else {
+ this.successResponse = {};
+ this.successResponse[defaultResponseCode] = response.schema.type;
+ }
+ this.type = response;
+ }
+
+ if (errors.length > 0) {
+ if(this.resource && this.resource.api && this.resource.api.fail)
+ this.resource.api.fail(errors);
+ }
+
+ return this;
+};
+
+OperationGroup.prototype.sort = function(sorter) {
+
+};
+
+Operation.prototype.getType = function (param) {
+ var type = param.type;
+ var format = param.format;
+ var isArray = false;
+ var str;
+ if(type === 'integer' && format === 'int32')
+ str = 'integer';
+ else if(type === 'integer' && format === 'int64')
+ str = 'long';
+ else if(type === 'integer')
+ str = 'integer';
+ else if(type === 'string') {
+ if(format === 'date-time')
+ str = 'date-time';
+ else if(format === 'date')
+ str = 'date';
+ else
+ str = 'string';
+ }
+ else if(type === 'number' && format === 'float')
+ str = 'float';
+ else if(type === 'number' && format === 'double')
+ str = 'double';
+ else if(type === 'number')
+ str = 'double';
+ else if(type === 'boolean')
+ str = 'boolean';
+ else if(type === 'array') {
+ isArray = true;
+ if(param.items)
+ str = this.getType(param.items);
+ }
+ if(param.$ref)
+ str = param.$ref;
+
+ var schema = param.schema;
+ if(schema) {
+ var ref = schema.$ref;
+ if(ref) {
+ ref = simpleRef(ref);
+ if(isArray)
+ return [ ref ];
+ else
+ return ref;
+ }
+ else
+ return this.getType(schema);
+ }
+ if(isArray)
+ return [ str ];
+ else
+ return str;
+};
+
+Operation.prototype.resolveModel = function (schema, definitions) {
+ if(typeof schema.$ref !== 'undefined') {
+ var ref = schema.$ref;
+ if(ref.indexOf('#/definitions/') === 0)
+ ref = ref.substring('#/definitions/'.length);
+ if(definitions[ref]) {
+ return new Model(ref, definitions[ref]);
+ }
+ }
+ if(schema.type === 'array')
+ return new ArrayModel(schema);
+ else
+ return null;
+};
+
+Operation.prototype.help = function(dontPrint) {
+ var out = this.nickname + ': ' + this.summary + '\n';
+ for(var i = 0; i < this.parameters.length; i++) {
+ var param = this.parameters[i];
+ var typeInfo = param.signature;
+ out += '\n * ' + param.name + ' (' + typeInfo + '): ' + param.description;
+ }
+ if(typeof dontPrint === 'undefined')
+ log(out);
+ return out;
+};
+
+Operation.prototype.getModelSignature = function(type, definitions) {
+ var isPrimitive, listType;
+
+ if(type instanceof Array) {
+ listType = true;
+ type = type[0];
+ }
+ else if(typeof type === 'undefined')
+ type = 'undefined';
+
+ if(type === 'string')
+ isPrimitive = true;
+ else
+ isPrimitive = (listType && definitions[listType]) || (definitions[type]) ? false : true;
+ if (isPrimitive) {
+ if(listType)
+ return 'Array[' + type + ']';
+ else
+ return type.toString();
+ } else {
+ if (listType)
+ return 'Array[' + definitions[type].getMockSignature() + ']';
+ else
+ return definitions[type].getMockSignature();
+ }
+};
+
+Operation.prototype.supportHeaderParams = function () {
+ return true;
+};
+
+Operation.prototype.supportedSubmitMethods = function () {
+ return this.parent.supportedSubmitMethods;
+};
+
+Operation.prototype.getHeaderParams = function (args) {
+ var headers = this.setContentTypes(args, {});
+ for(var i = 0; i < this.parameters.length; i++) {
+ var param = this.parameters[i];
+ if(typeof args[param.name] !== 'undefined') {
+ if (param.in === 'header') {
+ var value = args[param.name];
+ if(Array.isArray(value))
+ value = value.toString();
+ headers[param.name] = value;
+ }
+ }
+ }
+ return headers;
+};
+
+Operation.prototype.urlify = function (args) {
+ var formParams = {};
+ var requestUrl = this.path;
+
+ // grab params from the args, build the querystring along the way
+ var querystring = '';
+ for(var i = 0; i < this.parameters.length; i++) {
+ var param = this.parameters[i];
+ if(typeof args[param.name] !== 'undefined') {
+ if(param.in === 'path') {
+ var reg = new RegExp('\{' + param.name + '\}', 'gi');
+ var value = args[param.name];
+ if(Array.isArray(value))
+ value = this.encodePathCollection(param.collectionFormat, param.name, value);
+ else
+ value = this.encodePathParam(value);
+ requestUrl = requestUrl.replace(reg, value);
+ }
+ else if (param.in === 'query' && typeof args[param.name] !== 'undefined') {
+ if(querystring === '')
+ querystring += '?';
+ else
+ querystring += '&';
+ if(typeof param.collectionFormat !== 'undefined') {
+ var qp = args[param.name];
+ if(Array.isArray(qp))
+ querystring += this.encodeQueryCollection(param.collectionFormat, param.name, qp);
+ else
+ querystring += this.encodeQueryParam(param.name) + '=' + this.encodeQueryParam(args[param.name]);
+ }
+ else
+ querystring += this.encodeQueryParam(param.name) + '=' + this.encodeQueryParam(args[param.name]);
+ }
+ else if (param.in === 'formData')
+ formParams[param.name] = args[param.name];
+ }
+ }
+ var url = this.scheme + '://' + this.host;
+
+ if(this.basePath !== '/')
+ url += this.basePath;
+
+ return url + requestUrl + querystring;
+};
+
+Operation.prototype.getMissingParams = function(args) {
+ var missingParams = [];
+ // check required params, track the ones that are missing
+ var i;
+ for(i = 0; i < this.parameters.length; i++) {
+ var param = this.parameters[i];
+ if(param.required === true) {
+ if(typeof args[param.name] === 'undefined')
+ missingParams = param.name;
+ }
+ }
+ return missingParams;
+};
+
+Operation.prototype.getBody = function(headers, args, opts) {
+ var formParams = {}, body, key;
+
+ for(var i = 0; i < this.parameters.length; i++) {
+ var param = this.parameters[i];
+ if(typeof args[param.name] !== 'undefined') {
+ if (param.in === 'body') {
+ body = args[param.name];
+ } else if(param.in === 'formData') {
+ formParams[param.name] = args[param.name];
+ }
+ }
+ }
+
+ // handle form params
+ if(headers['Content-Type'] === 'application/x-www-form-urlencoded') {
+ var encoded = "";
+ for(key in formParams) {
+ value = formParams[key];
+ if(typeof value !== 'undefined'){
+ if(encoded !== "")
+ encoded += "&";
+ encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value);
+ }
+ }
+ body = encoded;
+ }
+ else if (headers['Content-Type'] && headers['Content-Type'].indexOf('multipart/form-data') >= 0) {
+ if(opts.useJQuery) {
+ var bodyParam = new FormData();
+ bodyParam.type = 'formData';
+ for (key in formParams) {
+ value = args[key];
+ if (typeof value !== 'undefined') {
+ // required for jquery file upload
+ if(value.type === 'file' && value.value) {
+ delete headers['Content-Type'];
+ bodyParam.append(key, value.value);
+ }
+ else
+ bodyParam.append(key, value);
+ }
+ }
+ body = bodyParam;
+ }
+ }
+
+ return body;
+};
+
+/**
+ * gets sample response for a single operation
+ **/
+Operation.prototype.getModelSampleJSON = function(type, models) {
+ var isPrimitive, listType, sampleJson;
+
+ listType = (type instanceof Array);
+ isPrimitive = models[type] ? false : true;
+ sampleJson = isPrimitive ? void 0 : models[type].createJSONSample();
+ if (sampleJson) {
+ sampleJson = listType ? [sampleJson] : sampleJson;
+ if(typeof sampleJson == 'string')
+ return sampleJson;
+ else if(typeof sampleJson === 'object') {
+ var t = sampleJson;
+ if(sampleJson instanceof Array && sampleJson.length > 0) {
+ t = sampleJson[0];
+ }
+ if(t.nodeName) {
+ var xmlString = new XMLSerializer().serializeToString(t);
+ return this.formatXml(xmlString);
+ }
+ else
+ return JSON.stringify(sampleJson, null, 2);
+ }
+ else
+ return sampleJson;
+ }
+};
+
+/**
+ * legacy binding
+ **/
+Operation.prototype["do"] = function(args, opts, callback, error, parent) {
+ return this.execute(args, opts, callback, error, parent);
+};
+
+
+/**
+ * executes an operation
+ **/
+Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
+ var args = arg1 || {};
+ var opts = {}, success, error;
+ if(typeof arg2 === 'object') {
+ opts = arg2;
+ success = arg3;
+ error = arg4;
+ }
+
+ if(typeof arg2 === 'function') {
+ success = arg2;
+ error = arg3;
+ }
+
+ success = (success||log);
+ error = (error||log);
+
+ if(opts.useJQuery)
+ this.useJQuery = opts.useJQuery;
+
+ var missingParams = this.getMissingParams(args);
+ if(missingParams.length > 0) {
+ var message = 'missing required params: ' + missingParams;
+ fail(message);
+ return;
+ }
+ var allHeaders = this.getHeaderParams(args);
+ var contentTypeHeaders = this.setContentTypes(args, opts);
+
+ var headers = {}, attrname;
+ for (attrname in allHeaders) { headers[attrname] = allHeaders[attrname]; }
+ for (attrname in contentTypeHeaders) { headers[attrname] = contentTypeHeaders[attrname]; }
+
+ var body = this.getBody(headers, args, opts);
+ var url = this.urlify(args);
+
+ var obj = {
+ url: url,
+ method: this.method.toUpperCase(),
+ body: body,
+ useJQuery: this.useJQuery,
+ headers: headers,
+ on: {
+ response: function(response) {
+ return success(response, parent);
+ },
+ error: function(response) {
+ return error(response, parent);
+ }
+ }
+ };
+ var status = authorizations.apply(obj, this.operation.security);
+ if(opts.mock === true)
+ return obj;
+ else
+ new SwaggerHttp().execute(obj, opts);
+};
+
+Operation.prototype.setContentTypes = function(args, opts) {
+ // default type
+ var accepts = 'application/json';
+ var consumes = args.parameterContentType || 'application/json';
+ var allDefinedParams = this.parameters;
+ var definedFormParams = [];
+ var definedFileParams = [];
+ var body;
+ var headers = {};
+
+ // get params from the operation and set them in definedFileParams, definedFormParams, headers
+ var i;
+ for(i = 0; i < allDefinedParams.length; i++) {
+ var param = allDefinedParams[i];
+ if(param.in === 'formData') {
+ if(param.type === 'file')
+ definedFileParams.push(param);
+ else
+ definedFormParams.push(param);
+ }
+ else if(param.in === 'header' && opts) {
+ var key = param.name;
+ var headerValue = opts[param.name];
+ if(typeof opts[param.name] !== 'undefined')
+ headers[key] = headerValue;
+ }
+ else if(param.in === 'body' && typeof args[param.name] !== 'undefined') {
+ body = args[param.name];
+ }
+ }
+
+ // if there's a body, need to set the consumes header via requestContentType
+ if (body && (this.method === 'post' || this.method === 'put' || this.method === 'patch' || this.method === 'delete')) {
+ if (opts.requestContentType)
+ consumes = opts.requestContentType;
+ } else {
+ // if any form params, content type must be set
+ if(definedFormParams.length > 0) {
+ if(opts.requestContentType) // override if set
+ consumes = opts.requestContentType;
+ else if(definedFileParams.length > 0) // if a file, must be multipart/form-data
+ consumes = 'multipart/form-data';
+ else // default to x-www-from-urlencoded
+ consumes = 'application/x-www-form-urlencoded';
+ }
+ else if (this.type == 'DELETE')
+ body = '{}';
+ else if (this.type != 'DELETE')
+ consumes = null;
+ }
+
+ if (consumes && this.consumes) {
+ if (this.consumes.indexOf(consumes) === -1) {
+ log('server doesn\'t consume ' + consumes + ', try ' + JSON.stringify(this.consumes));
+ }
+ }
+
+ if (opts.responseContentType) {
+ accepts = opts.responseContentType;
+ } else {
+ accepts = 'application/json';
+ }
+ if (accepts && this.produces) {
+ if (this.produces.indexOf(accepts) === -1) {
+ log('server can\'t produce ' + accepts);
+ }
+ }
+
+ if ((consumes && body !== '') || (consumes === 'application/x-www-form-urlencoded'))
+ headers['Content-Type'] = consumes;
+ if (accepts)
+ headers.Accept = accepts;
+ return headers;
+};
+
+Operation.prototype.asCurl = function (args) {
+ var obj = this.execute(args, {mock: true});
+ authorizations.apply(obj);
+ var results = [];
+ results.push('-X ' + this.method.toUpperCase());
+ if (obj.headers) {
+ var key;
+ for (key in obj.headers)
+ results.push('--header "' + key + ': ' + obj.headers[key] + '"');
+ }
+ if(obj.body) {
+ var body;
+ if(typeof obj.body === 'object')
+ body = JSON.stringify(obj.body);
+ else
+ body = obj.body;
+ results.push('-d "' + body.replace(/"/g, '\\"') + '"');
+ }
+ return 'curl ' + (results.join(' ')) + ' "' + obj.url + '"';
+};
+
+Operation.prototype.encodePathCollection = function(type, name, value) {
+ var encoded = '';
+ var i;
+ var separator = '';
+ if(type === 'ssv')
+ separator = '%20';
+ else if(type === 'tsv')
+ separator = '\\t';
+ else if(type === 'pipes')
+ separator = '|';
+ else
+ separator = ',';
+
+ for(i = 0; i < value.length; i++) {
+ if(i === 0)
+ encoded = this.encodeQueryParam(value[i]);
+ else
+ encoded += separator + this.encodeQueryParam(value[i]);
+ }
+ return encoded;
+};
+
+Operation.prototype.encodeQueryCollection = function(type, name, value) {
+ var encoded = '';
+ var i;
+ if(type === 'default' || type === 'multi') {
+ for(i = 0; i < value.length; i++) {
+ if(i > 0) encoded += '&';
+ encoded += this.encodeQueryParam(name) + '=' + this.encodeQueryParam(value[i]);
+ }
+ }
+ else {
+ var separator = '';
+ if(type === 'csv')
+ separator = ',';
+ else if(type === 'ssv')
+ separator = '%20';
+ else if(type === 'tsv')
+ separator = '\\t';
+ else if(type === 'pipes')
+ separator = '|';
+ else if(type === 'brackets') {
+ for(i = 0; i < value.length; i++) {
+ if(i !== 0)
+ encoded += '&';
+ encoded += this.encodeQueryParam(name) + '[]=' + this.encodeQueryParam(value[i]);
+ }
+ }
+ if(separator !== '') {
+ for(i = 0; i < value.length; i++) {
+ if(i === 0)
+ encoded = this.encodeQueryParam(name) + '=' + this.encodeQueryParam(value[i]);
+ else
+ encoded += separator + this.encodeQueryParam(value[i]);
+ }
+ }
+ }
+ return encoded;
+};
+
+Operation.prototype.encodeQueryParam = function(arg) {
+ return encodeURIComponent(arg);
+};
+
+/**
+ * TODO revisit, might not want to leave '/'
+ **/
+Operation.prototype.encodePathParam = function(pathParam) {
+ var encParts, part, parts, i, len;
+ pathParam = pathParam.toString();
+ if (pathParam.indexOf('/') === -1) {
+ return encodeURIComponent(pathParam);
+ } else {
+ parts = pathParam.split('/');
+ encParts = [];
+ for (i = 0, len = parts.length; i < len; i++) {
+ encParts.push(encodeURIComponent(parts[i]));
+ }
+ return encParts.join('/');
+ }
+};
+
+var Model = function(name, definition) {
+ this.name = name;
+ this.definition = definition || {};
+ this.properties = [];
+ var requiredFields = definition.required || [];
+ if(definition.type === 'array') {
+ var out = new ArrayModel(definition);
+ return out;
+ }
+ var key;
+ var props = definition.properties;
+ if(props) {
+ for(key in props) {
+ var required = false;
+ var property = props[key];
+ if(requiredFields.indexOf(key) >= 0)
+ required = true;
+ this.properties.push(new Property(key, property, required));
+ }
+ }
+};
+
+Model.prototype.createJSONSample = function(modelsToIgnore) {
+ var i, result = {}, representations = {};
+ modelsToIgnore = (modelsToIgnore||{});
+ modelsToIgnore[this.name] = this;
+ for (i = 0; i < this.properties.length; i++) {
+ prop = this.properties[i];
+ var sample = prop.getSampleValue(modelsToIgnore, representations);
+ result[prop.name] = sample;
+ }
+ delete modelsToIgnore[this.name];
+ return result;
+};
+
+Model.prototype.getSampleValue = function(modelsToIgnore) {
+ var i, obj = {}, representations = {};
+ for(i = 0; i < this.properties.length; i++ ) {
+ var property = this.properties[i];
+ obj[property.name] = property.sampleValue(false, modelsToIgnore, representations);
+ }
+ return obj;
+};
+
+Model.prototype.getMockSignature = function(modelsToIgnore) {
+ var i, prop, propertiesStr = [];
+ for (i = 0; i < this.properties.length; i++) {
+ prop = this.properties[i];
+ propertiesStr.push(prop.toString());
+ }
+ var strong = '<span class="strong">';
+ var stronger = '<span class="stronger">';
+ var strongClose = '</span>';
+ var classOpen = strong + this.name + ' {' + strongClose;
+ var classClose = strong + '}' + strongClose;
+ var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
+ if (!modelsToIgnore)
+ modelsToIgnore = {};
+
+ modelsToIgnore[this.name] = this;
+ for (i = 0; i < this.properties.length; i++) {
+ prop = this.properties[i];
+ var ref = prop.$ref;
+ var model = models[ref];
+ if (model && typeof modelsToIgnore[model.name] === 'undefined') {
+ returnVal = returnVal + ('<br>' + model.getMockSignature(modelsToIgnore));
+ }
+ }
+ return returnVal;
+};
+
+var Property = function(name, obj, required) {
+ this.schema = obj;
+ this.required = required;
+ if(obj.$ref)
+ this.$ref = simpleRef(obj.$ref);
+ else if (obj.type === 'array' && obj.items) {
+ if(obj.items.$ref)
+ this.$ref = simpleRef(obj.items.$ref);
+ else
+ obj = obj.items;
+ }
+ this.name = name;
+ this.description = obj.description;
+ this.obj = obj;
+ this.optional = true;
+ this.optional = !required;
+ this.default = obj.default || null;
+ this.example = obj.example !== undefined ? obj.example : null;
+ this.collectionFormat = obj.collectionFormat || null;
+ this.maximum = obj.maximum || null;
+ this.exclusiveMaximum = obj.exclusiveMaximum || null;
+ this.minimum = obj.minimum || null;
+ this.exclusiveMinimum = obj.exclusiveMinimum || null;
+ this.maxLength = obj.maxLength || null;
+ this.minLength = obj.minLength || null;
+ this.pattern = obj.pattern || null;
+ this.maxItems = obj.maxItems || null;
+ this.minItems = obj.minItems || null;
+ this.uniqueItems = obj.uniqueItems || null;
+ this['enum'] = obj['enum'] || null;
+ this.multipleOf = obj.multipleOf || null;
+};
+
+Property.prototype.getSampleValue = function (modelsToIgnore, representations) {
+ return this.sampleValue(false, modelsToIgnore, representations);
+};
+
+Property.prototype.isArray = function () {
+ var schema = this.schema;
+ if(schema.type === 'array')
+ return true;
+ else
+ return false;
+};
+
+Property.prototype.sampleValue = function(isArray, ignoredModels, representations) {
+ isArray = (isArray || this.isArray());
+ ignoredModels = (ignoredModels || {});
+ // representations = (representations || {});
+
+ var type = getStringSignature(this.obj, true);
+ var output;
+
+ if(this.$ref) {
+ var refModelName = simpleRef(this.$ref);
+ var refModel = models[refModelName];
+ if(typeof representations[type] !== 'undefined') {
+ return representations[type];
+ }
+ else
+
+ if(refModel && typeof ignoredModels[type] === 'undefined') {
+ ignoredModels[type] = this;
+ output = refModel.getSampleValue(ignoredModels, representations);
+ representations[type] = output;
+ }
+ else {
+ output = (representations[type] || refModelName);
+ }
+ }
+ else if(this.example)
+ output = this.example;
+ else if(this.default)
+ output = this.default;
+ else if(type === 'date-time')
+ output = new Date().toISOString();
+ else if(type === 'date')
+ output = new Date().toISOString().split("T")[0];
+ else if(type === 'string')
+ output = 'string';
+ else if(type === 'integer')
+ output = 0;
+ else if(type === 'long')
+ output = 0;
+ else if(type === 'float')
+ output = 0.0;
+ else if(type === 'double')
+ output = 0.0;
+ else if(type === 'boolean')
+ output = true;
+ else
+ output = {};
+ ignoredModels[type] = output;
+ if(isArray)
+ return [output];
+ else
+ return output;
+};
+
+getStringSignature = function(obj, baseComponent) {
+ var str = '';
+ if(typeof obj.$ref !== 'undefined')
+ str += simpleRef(obj.$ref);
+ else if(typeof obj.type === 'undefined')
+ str += 'object';
+ else if(obj.type === 'array') {
+ if(baseComponent)
+ str += getStringSignature((obj.items || obj.$ref || {}));
+ else {
+ str += 'Array[';
+ str += getStringSignature((obj.items || obj.$ref || {}));
+ str += ']';
+ }
+ }
+ else if(obj.type === 'integer' && obj.format === 'int32')
+ str += 'integer';
+ else if(obj.type === 'integer' && obj.format === 'int64')
+ str += 'long';
+ else if(obj.type === 'integer' && typeof obj.format === 'undefined')
+ str += 'long';
+ else if(obj.type === 'string' && obj.format === 'date-time')
+ str += 'date-time';
+ else if(obj.type === 'string' && obj.format === 'date')
+ str += 'date';
+ else if(obj.type === 'string' && typeof obj.format === 'undefined')
+ str += 'string';
+ else if(obj.type === 'number' && obj.format === 'float')
+ str += 'float';
+ else if(obj.type === 'number' && obj.format === 'double')
+ str += 'double';
+ else if(obj.type === 'number' && typeof obj.format === 'undefined')
+ str += 'double';
+ else if(obj.type === 'boolean')
+ str += 'boolean';
+ else if(obj.$ref)
+ str += simpleRef(obj.$ref);
+ else
+ str += obj.type;
+ return str;
+};
+
+simpleRef = function(name) {
+ if(typeof name === 'undefined')
+ return null;
+ if(name.indexOf("#/definitions/") === 0)
+ return name.substring('#/definitions/'.length);
+ else
+ return name;
+};
+
+Property.prototype.toString = function() {
+ var str = getStringSignature(this.obj);
+ if(str !== '') {
+ str = '<span class="propName ' + this.required + '">' + this.name + '</span> (<span class="propType">' + str + '</span>';
+ if(!this.required)
+ str += ', <span class="propOptKey">optional</span>';
+ str += ')';
+ }
+ else
+ str = this.name + ' (' + JSON.stringify(this.obj) + ')';
+
+ if(typeof this.description !== 'undefined')
+ str += ': ' + this.description;
+
+ if (this['enum']) {
+ str += ' = <span class="propVals">[\'' + this['enum'].join('\' or \'') + '\']</span>';
+ }
+ if (this.descr) {
+ str += ': <span class="propDesc">' + this.descr + '</span>';
+ }
+
+
+ var options = '';
+ var isArray = this.schema.type === 'array';
+ var type;
+
+ if(isArray) {
+ if(this.schema.items)
+ type = this.schema.items.type;
+ else
+ type = '';
+ }
+ else {
+ type = this.schema.type;
+ }
+
+ if (this.default)
+ options += optionHtml('Default', this.default);
+
+ switch (type) {
+ case 'string':
+ if (this.minLength)
+ options += optionHtml('Min. Length', this.minLength);
+ if (this.maxLength)
+ options += optionHtml('Max. Length', this.maxLength);
+ if (this.pattern)
+ options += optionHtml('Reg. Exp.', this.pattern);
+ break;
+ case 'integer':
+ case 'number':
+ if (this.minimum)
+ options += optionHtml('Min. Value', this.minimum);
+ if (this.exclusiveMinimum)
+ options += optionHtml('Exclusive Min.', "true");
+ if (this.maximum)
+ options += optionHtml('Max. Value', this.maximum);
+ if (this.exclusiveMaximum)
+ options += optionHtml('Exclusive Max.', "true");
+ if (this.multipleOf)
+ options += optionHtml('Multiple Of', this.multipleOf);
+ break;
+ }
+
+ if (isArray) {
+ if (this.minItems)
+ options += optionHtml('Min. Items', this.minItems);
+ if (this.maxItems)
+ options += optionHtml('Max. Items', this.maxItems);
+ if (this.uniqueItems)
+ options += optionHtml('Unique Items', "true");
+ if (this.collectionFormat)
+ options += optionHtml('Coll. Format', this.collectionFormat);
+ }
+
+ if (this['enum']) {
+ var enumString;
+
+ if (type === 'number' || type === 'integer')
+ enumString = this['enum'].join(', ');
+ else {
+ enumString = '"' + this['enum'].join('", "') + '"';
+ }
+
+ options += optionHtml('Enum', enumString);
+ }
+
+ if (options.length > 0)
+ str = '<span class="propWrap">' + str + '<table class="optionsWrapper"><tr><th colspan="2">' + this.name + '</th></tr>' + options + '</table></span>';
+
+ return str;
+};
+
+optionHtml = function(label, value) {
+ return '<tr><td class="optionName">' + label + ':</td><td>' + value + '</td></tr>';
+};
+
+typeFromJsonSchema = function(type, format) {
+ var str;
+ if(type === 'integer' && format === 'int32')
+ str = 'integer';
+ else if(type === 'integer' && format === 'int64')
+ str = 'long';
+ else if(type === 'integer' && typeof format === 'undefined')
+ str = 'long';
+ else if(type === 'string' && format === 'date-time')
+ str = 'date-time';
+ else if(type === 'string' && format === 'date')
+ str = 'date';
+ else if(type === 'number' && format === 'float')
+ str = 'float';
+ else if(type === 'number' && format === 'double')
+ str = 'double';
+ else if(type === 'number' && typeof format === 'undefined')
+ str = 'double';
+ else if(type === 'boolean')
+ str = 'boolean';
+ else if(type === 'string')
+ str = 'string';
+
+ return str;
+};
+
+var sampleModels = {};
+var cookies = {};
+var models = {};
+
+SwaggerClient.prototype.buildFrom1_2Spec = function (response) {
+ if (response.apiVersion !== null) {
+ this.apiVersion = response.apiVersion;
+ }
+ this.apis = {};
+ this.apisArray = [];
+ this.consumes = response.consumes;
+ this.produces = response.produces;
+ this.authSchemes = response.authorizations;
+ this.info = this.convertInfo(response.info);
+
+ var isApi = false, i, res;
+ for (i = 0; i < response.apis.length; i++) {
+ var api = response.apis[i];
+ if (api.operations) {
+ var j;
+ for (j = 0; j < api.operations.length; j++) {
+ operation = api.operations[j];
+ isApi = true;
+ }
+ }
+ }
+ if (response.basePath)
+ this.basePath = response.basePath;
+ else if (this.url.indexOf('?') > 0)
+ this.basePath = this.url.substring(0, this.url.lastIndexOf('?'));
+ else
+ this.basePath = this.url;
+
+ if (isApi) {
+ var newName = response.resourcePath.replace(/\//g, '');
+ this.resourcePath = response.resourcePath;
+ res = new SwaggerResource(response, this);
+ this.apis[newName] = res;
+ this.apisArray.push(res);
+ this.finish();
+ } else {
+ var k;
+ this.expectedResourceCount = response.apis.length;
+ for (k = 0; k < response.apis.length; k++) {
+ var resource = response.apis[k];
+ res = new SwaggerResource(resource, this);
+ this.apis[res.name] = res;
+ this.apisArray.push(res);
+ }
+ }
+ this.isValid = true;
+ return this;
+};
+
+SwaggerClient.prototype.finish = function() {
+ if (typeof this.success === 'function') {
+ this.isValid = true;
+ this.ready = true;
+ this.isBuilt = true;
+ this.selfReflect();
+ this.success();
+ }
+};
+
+SwaggerClient.prototype.buildFrom1_1Spec = function (response) {
+ log('This API is using a deprecated version of Swagger! Please see http://github.com/wordnik/swagger-core/wiki for more info');
+ if (response.apiVersion !== null)
+ this.apiVersion = response.apiVersion;
+ this.apis = {};
+ this.apisArray = [];
+ this.produces = response.produces;
+ this.info = this.convertInfo(response.info);
+ var isApi = false, res;
+ for (var i = 0; i < response.apis.length; i++) {
+ var api = response.apis[i];
+ if (api.operations) {
+ for (var j = 0; j < api.operations.length; j++) {
+ operation = api.operations[j];
+ isApi = true;
+ }
+ }
+ }
+ if (response.basePath) {
+ this.basePath = response.basePath;
+ } else if (this.url.indexOf('?') > 0) {
+ this.basePath = this.url.substring(0, this.url.lastIndexOf('?'));
+ } else {
+ this.basePath = this.url;
+ }
+ if (isApi) {
+ var newName = response.resourcePath.replace(/\//g, '');
+ this.resourcePath = response.resourcePath;
+ res = new SwaggerResource(response, this);
+ this.apis[newName] = res;
+ this.apisArray.push(res);
+ this.finish();
+ } else {
+ this.expectedResourceCount = response.apis.length;
+ for (k = 0; k < response.apis.length; k++) {
+ resource = response.apis[k];
+ res = new SwaggerResource(resource, this);
+ this.apis[res.name] = res;
+ this.apisArray.push(res);
+ }
+ }
+ this.isValid = true;
+ return this;
+};
+
+SwaggerClient.prototype.convertInfo = function (resp) {
+ if(typeof resp == 'object') {
+ var info = {};
+
+ info.title = resp.title;
+ info.description = resp.description;
+ info.termsOfService = resp.termsOfServiceUrl;
+ info.contact = {};
+ info.contact.name = resp.contact;
+ info.license = {};
+ info.license.name = resp.license;
+ info.license.url = resp.licenseUrl;
+
+ return info;
+ }
+};
+
+SwaggerClient.prototype.selfReflect = function () {
+ var resource, tag, ref;
+ if (this.apis === null) {
+ return false;
+ }
+ ref = this.apis;
+ for (tag in ref) {
+ api = ref[tag];
+ if (api.ready === null) {
+ return false;
+ }
+ this[tag] = api;
+ this[tag].help = __bind(api.help, api);
+ }
+ this.setConsolidatedModels();
+ this.ready = true;
+};
+
+SwaggerClient.prototype.setConsolidatedModels = function () {
+ var model, modelName, resource, resource_name, i, apis, models, results;
+ this.models = {};
+ apis = this.apis;
+ for (resource_name in apis) {
+ resource = apis[resource_name];
+ for (modelName in resource.models) {
+ if (typeof this.models[modelName] === 'undefined') {
+ this.models[modelName] = resource.models[modelName];
+ this.modelsArray.push(resource.models[modelName]);
+ }
+ }
+ }
+ models = this.modelsArray;
+ results = [];
+ for (i = 0; i < models.length; i++) {
+ model = models[i];
+ results.push(model.setReferencedModels(this.models));
+ }
+ return results;
+};
+
+var SwaggerResource = function (resourceObj, api) {
+ var _this = this;
+ this.api = api;
+ this.swaggerRequstHeaders = api.swaggerRequstHeaders;
+ this.path = (typeof this.api.resourcePath === 'string') ? this.api.resourcePath : resourceObj.path;
+ this.description = resourceObj.description;
+ this.authorizations = (resourceObj.authorizations || {});
+
+ var parts = this.path.split('/');
+ this.name = parts[parts.length - 1].replace('.{format}', '');
+ this.basePath = this.api.basePath;
+ this.operations = {};
+ this.operationsArray = [];
+ this.modelsArray = [];
+ this.models = api.models || {};
+ this.rawModels = {};
+ this.useJQuery = (typeof api.useJQuery !== 'undefined') ? api.useJQuery : null;
+
+ if ((resourceObj.apis) && this.api.resourcePath) {
+ this.addApiDeclaration(resourceObj);
+ } else {
+ if (typeof this.path === 'undefined') {
+ this.api.fail('SwaggerResources must have a path.');
+ }
+ if (this.path.substring(0, 4) === 'http') {
+ this.url = this.path.replace('{format}', 'json');
+ } else {
+ this.url = this.api.basePath + this.path.replace('{format}', 'json');
+ }
+ this.api.progress('fetching resource ' + this.name + ': ' + this.url);
+ var obj = {
+ url: this.url,
+ method: 'GET',
+ useJQuery: this.useJQuery,
+ headers: {
+ accept: this.swaggerRequstHeaders
+ },
+ on: {
+ response: function (resp) {
+ var responseObj = resp.obj || JSON.parse(resp.data);
+ _this.api.resourceCount += 1;
+ return _this.addApiDeclaration(responseObj);
+ },
+ error: function (response) {
+ _this.api.resourceCount += 1;
+ return _this.api.fail('Unable to read api \'' +
+ _this.name + '\' from path ' + _this.url + ' (server returned ' + response.statusText + ')');
+ }
+ }
+ };
+ var e = typeof window !== 'undefined' ? window : exports;
+ e.authorizations.apply(obj);
+ new SwaggerHttp().execute(obj);
+ }
+};
+
+SwaggerResource.prototype.help = function (dontPrint) {
+ var i;
+ var output = 'operations for the "' + this.name + '" tag';
+ for(i = 0; i < this.operationsArray.length; i++) {
+ var api = this.operationsArray[i];
+ output += '\n * ' + api.nickname + ': ' + api.description;
+ }
+ if(dontPrint)
+ return output;
+ else {
+ log(output);
+ return output;
+ }
+};
+
+SwaggerResource.prototype.getAbsoluteBasePath = function (relativeBasePath) {
+ var pos, url;
+ url = this.api.basePath;
+ pos = url.lastIndexOf(relativeBasePath);
+ var parts = url.split('/');
+ var rootUrl = parts[0] + '//' + parts[2];
+
+ if (relativeBasePath.indexOf('http') === 0)
+ return relativeBasePath;
+ if (relativeBasePath === '/')
+ return rootUrl;
+ if (relativeBasePath.substring(0, 1) == '/') {
+ // use root + relative
+ return rootUrl + relativeBasePath;
+ }
+ else {
+ pos = this.basePath.lastIndexOf('/');
+ var base = this.basePath.substring(0, pos);
+ if (base.substring(base.length - 1) == '/')
+ return base + relativeBasePath;
+ else
+ return base + '/' + relativeBasePath;
+ }
+};
+
+SwaggerResource.prototype.addApiDeclaration = function (response) {
+ if (typeof response.produces === 'string')
+ this.produces = response.produces;
+ if (typeof response.consumes === 'string')
+ this.consumes = response.consumes;
+ if ((typeof response.basePath === 'string') && response.basePath.replace(/\s/g, '').length > 0)
+ this.basePath = response.basePath.indexOf('http') === -1 ? this.getAbsoluteBasePath(response.basePath) : response.basePath;
+ this.resourcePath = response.resourcePath;
+ this.addModels(response.models);
+ if (response.apis) {
+ for (var i = 0 ; i < response.apis.length; i++) {
+ var endpoint = response.apis[i];
+ this.addOperations(endpoint.path, endpoint.operations, response.consumes, response.produces);
+ }
+ }
+ this.api[this.name] = this;
+ this.ready = true;
+ if(this.api.resourceCount === this.api.expectedResourceCount)
+ this.api.finish();
+ return this;
+};
+
+SwaggerResource.prototype.addModels = function (models) {
+ if (typeof models === 'object') {
+ var modelName;
+ for (modelName in models) {
+ if (typeof this.models[modelName] === 'undefined') {
+ var swaggerModel = new SwaggerModel(modelName, models[modelName]);
+ this.modelsArray.push(swaggerModel);
+ this.models[modelName] = swaggerModel;
+ this.rawModels[modelName] = models[modelName];
+ }
+ }
+ var output = [];
+ for (var i = 0; i < this.modelsArray.length; i++) {
+ var model = this.modelsArray[i];
+ output.push(model.setReferencedModels(this.models));
+ }
+ return output;
+ }
+};
+
+SwaggerResource.prototype.addOperations = function (resource_path, ops, consumes, produces) {
+ if (ops) {
+ var output = [];
+ for (var i = 0; i < ops.length; i++) {
+ var o = ops[i];
+ consumes = this.consumes;
+ produces = this.produces;
+ if (typeof o.consumes !== 'undefined')
+ consumes = o.consumes;
+ else
+ consumes = this.consumes;
+
+ if (typeof o.produces !== 'undefined')
+ produces = o.produces;
+ else
+ produces = this.produces;
+ var type = (o.type || o.responseClass);
+
+ if (type === 'array') {
+ ref = null;
+ if (o.items)
+ ref = o.items.type || o.items.$ref;
+ type = 'array[' + ref + ']';
+ }
+ var responseMessages = o.responseMessages;
+ var method = o.method;
+ if (o.httpMethod) {
+ method = o.httpMethod;
+ }
+ if (o.supportedContentTypes) {
+ consumes = o.supportedContentTypes;
+ }
+ if (o.errorResponses) {
+ responseMessages = o.errorResponses;
+ for (var j = 0; j < responseMessages.length; j++) {
+ r = responseMessages[j];
+ r.message = r.reason;
+ r.reason = null;
+ }
+ }
+ o.nickname = this.sanitize(o.nickname);
+ var op = new SwaggerOperation(o.nickname,
+ resource_path,
+ method,
+ o.parameters,
+ o.summary,
+ o.notes,
+ type,
+ responseMessages,
+ this,
+ consumes,
+ produces,
+ o.authorizations,
+ o.deprecated);
+
+ this.operations[op.nickname] = op;
+ output.push(this.operationsArray.push(op));
+ }
+ return output;
+ }
+};
+
+SwaggerResource.prototype.sanitize = function (nickname) {
+ var op;
+ op = nickname.replace(/[\s!@#$%^&*()_+=\[{\]};:<>|.\/?,\\'""-]/g, '_');
+ op = op.replace(/((_){2,})/g, '_');
+ op = op.replace(/^(_)*/g, '');
+ op = op.replace(/([_])*$/g, '');
+ return op;
+};
+
+var SwaggerModel = function (modelName, obj) {
+ this.name = typeof obj.id !== 'undefined' ? obj.id : modelName;
+ this.properties = [];
+ var propertyName;
+ for (propertyName in obj.properties) {
+ if (obj.required) {
+ var value;
+ for (value in obj.required) {
+ if (propertyName === obj.required[value]) {
+ obj.properties[propertyName].required = true;
+ }
+ }
+ }
+ var prop = new SwaggerModelProperty(propertyName, obj.properties[propertyName], this);
+ this.properties.push(prop);
+ }
+};
+
+SwaggerModel.prototype.setReferencedModels = function (allModels) {
+ var results = [];
+ for (var i = 0; i < this.properties.length; i++) {
+ var property = this.properties[i];
+ var type = property.type || property.dataType;
+ if (allModels[type])
+ results.push(property.refModel = allModels[type]);
+ else if ((property.refDataType) && (allModels[property.refDataType]))
+ results.push(property.refModel = allModels[property.refDataType]);
+ else
+ results.push(void 0);
+ }
+ return results;
+};
+
+SwaggerModel.prototype.getMockSignature = function (modelsToIgnore) {
+ var i, prop, propertiesStr = [];
+ for (i = 0; i < this.properties.length; i++) {
+ prop = this.properties[i];
+ propertiesStr.push(prop.toString());
+ }
+
+ var strong = '<span class="strong">';
+ var strongClose = '</span>';
+ var classOpen = strong + this.name + ' {' + strongClose;
+ var classClose = strong + '}' + strongClose;
+ var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
+ if (!modelsToIgnore)
+ modelsToIgnore = [];
+ modelsToIgnore.push(this.name);
+
+ for (i = 0; i < this.properties.length; i++) {
+ prop = this.properties[i];
+ if ((prop.refModel) && modelsToIgnore.indexOf(prop.refModel.name) === -1) {
+ returnVal = returnVal + ('<br>' + prop.refModel.getMockSignature(modelsToIgnore));
+ }
+ }
+ return returnVal;
+};
+
+SwaggerModel.prototype.createJSONSample = function (modelsToIgnore) {
+ if (sampleModels[this.name]) {
+ return sampleModels[this.name];
+ }
+ else {
+ var result = {};
+ modelsToIgnore = (modelsToIgnore || []);
+ modelsToIgnore.push(this.name);
+ for (var i = 0; i < this.properties.length; i++) {
+ var prop = this.properties[i];
+ result[prop.name] = prop.getSampleValue(modelsToIgnore);
+ }
+ modelsToIgnore.pop(this.name);
+ return result;
+ }
+};
+
+var SwaggerModelProperty = function (name, obj, model) {
+ this.name = name;
+ this.dataType = obj.type || obj.dataType || obj.$ref;
+ this.isCollection = this.dataType && (this.dataType.toLowerCase() === 'array' || this.dataType.toLowerCase() === 'list' || this.dataType.toLowerCase() === 'set');
+ this.descr = obj.description;
+ this.required = obj.required;
+ this.defaultValue = applyModelPropertyMacro(obj, model);
+ if (obj.items) {
+ if (obj.items.type) {
+ this.refDataType = obj.items.type;
+ }
+ if (obj.items.$ref) {
+ this.refDataType = obj.items.$ref;
+ }
+ }
+ this.dataTypeWithRef = this.refDataType ? (this.dataType + '[' + this.refDataType + ']') : this.dataType;
+ if (obj.allowableValues) {
+ this.valueType = obj.allowableValues.valueType;
+ this.values = obj.allowableValues.values;
+ if (this.values) {
+ this.valuesString = '\'' + this.values.join('\' or \'') + '\'';
+ }
+ }
+ if (obj['enum']) {
+ this.valueType = 'string';
+ this.values = obj['enum'];
+ if (this.values) {
+ this.valueString = '\'' + this.values.join('\' or \'') + '\'';
+ }
+ }
+};
+
+SwaggerModelProperty.prototype.getSampleValue = function (modelsToIgnore) {
+ var result;
+ if ((this.refModel) && (modelsToIgnore.indexOf(this.refModel.name) === -1)) {
+ result = this.refModel.createJSONSample(modelsToIgnore);
+ } else {
+ if (this.isCollection) {
+ result = this.toSampleValue(this.refDataType);
+ } else {
+ result = this.toSampleValue(this.dataType);
+ }
+ }
+ if (this.isCollection) {
+ return [result];
+ } else {
+ return result;
+ }
+};
+
+SwaggerModelProperty.prototype.toSampleValue = function (value) {
+ var result;
+ if ((typeof this.defaultValue !== 'undefined') && this.defaultValue) {
+ result = this.defaultValue;
+ } else if (value === 'integer') {
+ result = 0;
+ } else if (value === 'boolean') {
+ result = false;
+ } else if (value === 'double' || value === 'number') {
+ result = 0.0;
+ } else if (value === 'string') {
+ result = '';
+ } else {
+ result = value;
+ }
+ return result;
+};
+
+SwaggerModelProperty.prototype.toString = function () {
+ var req = this.required ? 'propReq' : 'propOpt';
+ var str = '<span class="propName ' + req + '">' + this.name + '</span> (<span class="propType">' + this.dataTypeWithRef + '</span>';
+ if (!this.required) {
+ str += ', <span class="propOptKey">optional</span>';
+ }
+ str += ')';
+ if (this.values) {
+ str += ' = <span class="propVals">[\'' + this.values.join('\' or \'') + '\']</span>';
+ }
+ if (this.descr) {
+ str += ': <span class="propDesc">' + this.descr + '</span>';
+ }
+ return str;
+};
+
+var SwaggerOperation = function (nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces, authorizations, deprecated) {
+ var _this = this;
+
+ var errors = [];
+ this.nickname = (nickname || errors.push('SwaggerOperations must have a nickname.'));
+ this.path = (path || errors.push('SwaggerOperation ' + nickname + ' is missing path.'));
+ this.method = (method || errors.push('SwaggerOperation ' + nickname + ' is missing method.'));
+ this.parameters = parameters ? parameters : [];
+ this.summary = summary;
+ this.notes = notes;
+ this.type = type;
+ this.responseMessages = (responseMessages || []);
+ this.resource = (resource || errors.push('Resource is required'));
+ this.consumes = consumes;
+ this.produces = produces;
+ this.authorizations = typeof authorizations !== 'undefined' ? authorizations : resource.authorizations;
+ this.deprecated = deprecated;
+ this['do'] = __bind(this['do'], this);
+
+
+ if(typeof this.deprecated === 'string') {
+ switch(this.deprecated.toLowerCase()) {
+ case 'true': case 'yes': case '1': {
+ this.deprecated = true;
+ break;
+ }
+ case 'false': case 'no': case '0': case null: {
+ this.deprecated = false;
+ break;
+ }
+ default: this.deprecated = Boolean(this.deprecated);
+ }
+ }
+
+ if (errors.length > 0) {
+ console.error('SwaggerOperation errors', errors, arguments);
+ this.resource.api.fail(errors);
+ }
+
+ this.path = this.path.replace('{format}', 'json');
+ this.method = this.method.toLowerCase();
+ this.isGetMethod = this.method === 'get';
+
+ var i, j, v;
+ this.resourceName = this.resource.name;
+ if (typeof this.type !== 'undefined' && this.type === 'void')
+ this.type = null;
+ else {
+ this.responseClassSignature = this.getSignature(this.type, this.resource.models);
+ this.responseSampleJSON = this.getSampleJSON(this.type, this.resource.models);
+ }
+
+ for (i = 0; i < this.parameters.length; i++) {
+ var param = this.parameters[i];
+ // might take this away
+ param.name = param.name || param.type || param.dataType;
+ // for 1.1 compatibility
+ type = param.type || param.dataType;
+ if (type === 'array') {
+ type = 'array[' + (param.items.$ref ? param.items.$ref : param.items.type) + ']';
+ }
+ param.type = type;
+
+ if (type && type.toLowerCase() === 'boolean') {
+ param.allowableValues = {};
+ param.allowableValues.values = ['true', 'false'];
+ }
+ param.signature = this.getSignature(type, this.resource.models);
+ param.sampleJSON = this.getSampleJSON(type, this.resource.models);
+
+ var enumValue = param['enum'];
+ if (typeof enumValue !== 'undefined') {
+ param.isList = true;
+ param.allowableValues = {};
+ param.allowableValues.descriptiveValues = [];
+
+ for (j = 0; j < enumValue.length; j++) {
+ v = enumValue[j];
+ if (param.defaultValue) {
+ param.allowableValues.descriptiveValues.push({
+ value: String(v),
+ isDefault: (v === param.defaultValue)
+ });
+ }
+ else {
+ param.allowableValues.descriptiveValues.push({
+ value: String(v),
+ isDefault: false
+ });
+ }
+ }
+ }
+ else if (param.allowableValues) {
+ if (param.allowableValues.valueType === 'RANGE')
+ param.isRange = true;
+ else
+ param.isList = true;
+ if (param.allowableValues) {
+ param.allowableValues.descriptiveValues = [];
+ if (param.allowableValues.values) {
+ for (j = 0; j < param.allowableValues.values.length; j++) {
+ v = param.allowableValues.values[j];
+ if (param.defaultValue !== null) {
+ param.allowableValues.descriptiveValues.push({
+ value: String(v),
+ isDefault: (v === param.defaultValue)
+ });
+ }
+ else {
+ param.allowableValues.descriptiveValues.push({
+ value: String(v),
+ isDefault: false
+ });
+ }
+ }
+ }
+ }
+ }
+ param.defaultValue = applyParameterMacro(this, param);
+ }
+ var defaultSuccessCallback = this.resource.api.defaultSuccessCallback || null;
+ var defaultErrorCallback = this.resource.api.defaultErrorCallback || null;
+
+ this.resource[this.nickname] = function (args, opts, callback, error) {
+ var arg1, arg2, arg3, arg4;
+ if(typeof args === 'function') { // right shift 3
+ arg1 = {}; arg2 = {}; arg3 = args; arg4 = opts;
+ }
+ else if(typeof args === 'object' && typeof opts === 'function') { // right shift 2
+ arg1 = args; arg2 = {}; arg3 = opts; arg4 = callback;
+ }
+ else {
+ arg1 = args; arg2 = opts; arg3 = callback; arg4 = error;
+ }
+ return _this['do'](arg1 || {}, arg2 || {}, arg3 || defaultSuccessCallback, arg4 || defaultErrorCallback);
+ };
+
+ this.resource[this.nickname].help = function (dontPrint) {
+ return _this.help(dontPrint);
+ };
+ this.resource[this.nickname].asCurl = function (args) {
+ return _this.asCurl(args);
+ };
+};
+
+SwaggerOperation.prototype.isListType = function (type) {
+ if (type && type.indexOf('[') >= 0) {
+ return type.substring(type.indexOf('[') + 1, type.indexOf(']'));
+ } else {
+ return void 0;
+ }
+};
+
+SwaggerOperation.prototype.getSignature = function (type, models) {
+ var isPrimitive, listType;
+ listType = this.isListType(type);
+ isPrimitive = ((typeof listType !== 'undefined') && models[listType]) || (typeof models[type] !== 'undefined') ? false : true;
+ if (isPrimitive) {
+ return type;
+ } else {
+ if (typeof listType !== 'undefined') {
+ return models[listType].getMockSignature();
+ } else {
+ return models[type].getMockSignature();
+ }
+ }
+};
+
+SwaggerOperation.prototype.getSampleJSON = function (type, models) {
+ var isPrimitive, listType, val;
+ listType = this.isListType(type);
+ isPrimitive = ((typeof listType !== 'undefined') && models[listType]) || (typeof models[type] !== 'undefined') ? false : true;
+ val = isPrimitive ? void 0 : (listType ? models[listType].createJSONSample() : models[type].createJSONSample());
+ if (val) {
+ val = listType ? [val] : val;
+ if (typeof val == 'string')
+ return val;
+ else if (typeof val === 'object') {
+ var t = val;
+ if (val instanceof Array && val.length > 0) {
+ t = val[0];
+ }
+ if (t.nodeName) {
+ var xmlString = new XMLSerializer().serializeToString(t);
+ return this.formatXml(xmlString);
+ }
+ else
+ return JSON.stringify(val, null, 2);
+ }
+ else
+ return val;
+ }
+};
+
+SwaggerOperation.prototype['do'] = function (args, opts, callback, error) {
+ var key, param, params, possibleParams = [], req, value;
+
+ if (typeof error !== 'function') {
+ error = function (xhr, textStatus, error) {
+ return log(xhr, textStatus, error);
+ };
+ }
+
+ if (typeof callback !== 'function') {
+ callback = function (response) {
+ var content;
+ content = null;
+ if (response !== null) {
+ content = response.data;
+ } else {
+ content = 'no data';
+ }
+ return log('default callback: ' + content);
+ };
+ }
+
+ params = {};
+ params.headers = [];
+ if (args.headers) {
+ params.headers = args.headers;
+ delete args.headers;
+ }
+ // allow override from the opts
+ if(opts && opts.responseContentType) {
+ params.headers['Content-Type'] = opts.responseContentType;
+ }
+ if(opts && opts.requestContentType) {
+ params.headers.Accept = opts.requestContentType;
+ }
+
+ for (var i = 0; i < this.parameters.length; i++) {
+ param = this.parameters[i];
+ if (param.paramType === 'header') {
+ if (typeof args[param.name] !== 'undefined')
+ params.headers[param.name] = args[param.name];
+ }
+ else if (param.paramType === 'form' || param.paramType.toLowerCase() === 'file')
+ possibleParams.push(param);
+ else if (param.paramType === 'body' && param.name !== 'body' && typeof args[param.name] !== 'undefined') {
+ if (args.body) {
+ throw new Error('Saw two body params in an API listing; expecting a max of one.');
+ }
+ args.body = args[param.name];
+ }
+ }
+
+ if (typeof args.body !== 'undefined') {
+ params.body = args.body;
+ delete args.body;
+ }
+
+ if (possibleParams) {
+ for (key in possibleParams) {
+ value = possibleParams[key];
+ if (args[value.name]) {
+ params[value.name] = args[value.name];
+ }
+ }
+ }
+
+ req = new SwaggerRequest(this.method, this.urlify(args), params, opts, callback, error, this);
+ if (opts.mock) {
+ return req;
+ } else {
+ return true;
+ }
+};
+
+SwaggerOperation.prototype.pathJson = function () {
+ return this.path.replace('{format}', 'json');
+};
+
+SwaggerOperation.prototype.pathXml = function () {
+ return this.path.replace('{format}', 'xml');
+};
+
+SwaggerOperation.prototype.encodePathParam = function (pathParam) {
+ var encParts, part, parts, _i, _len;
+ pathParam = pathParam.toString();
+ if (pathParam.indexOf('/') === -1) {
+ return encodeURIComponent(pathParam);
+ } else {
+ parts = pathParam.split('/');
+ encParts = [];
+ for (_i = 0, _len = parts.length; _i < _len; _i++) {
+ part = parts[_i];
+ encParts.push(encodeURIComponent(part));
+ }
+ return encParts.join('/');
+ }
+};
+
+SwaggerOperation.prototype.urlify = function (args) {
+ var i, j, param, url;
+ // ensure no double slashing...
+ if(this.resource.basePath.length > 1 && this.resource.basePath.slice(-1) === '/' && this.pathJson().charAt(0) === '/')
+ url = this.resource.basePath + this.pathJson().substring(1);
+ else
+ url = this.resource.basePath + this.pathJson();
+ var params = this.parameters;
+ for (i = 0; i < params.length; i++) {
+ param = params[i];
+ if (param.paramType === 'path') {
+ if (typeof args[param.name] !== 'undefined') {
+ // apply path params and remove from args
+ var reg = new RegExp('\\{\\s*?' + param.name + '[^\\{\\}\\/]*(?:\\{.*?\\}[^\\{\\}\\/]*)*\\}(?=(\\/?|$))', 'gi');
+ url = url.replace(reg, this.encodePathParam(args[param.name]));
+ delete args[param.name];
+ }
+ else
+ throw '' + param.name + ' is a required path param.';
+ }
+ }
+
+ var queryParams = '';
+ for (i = 0; i < params.length; i++) {
+ param = params[i];
+ if(param.paramType === 'query') {
+ if (queryParams !== '')
+ queryParams += '&';
+ if (Array.isArray(param)) {
+ var output = '';
+ for(j = 0; j < param.length; j++) {
+ if(j > 0)
+ output += ',';
+ output += encodeURIComponent(param[j]);
+ }
+ queryParams += encodeURIComponent(param.name) + '=' + output;
+ }
+ else {
+ if (typeof args[param.name] !== 'undefined') {
+ queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
+ } else {
+ if (param.required)
+ throw '' + param.name + ' is a required query param.';
+ }
+ }
+ }
+ }
+ if ((queryParams) && queryParams.length > 0)
+ url += '?' + queryParams;
+ return url;
+};
+
+SwaggerOperation.prototype.supportHeaderParams = function () {
+ return this.resource.api.supportHeaderParams;
+};
+
+SwaggerOperation.prototype.supportedSubmitMethods = function () {
+ return this.resource.api.supportedSubmitMethods;
+};
+
+SwaggerOperation.prototype.getQueryParams = function (args) {
+ return this.getMatchingParams(['query'], args);
+};
+
+SwaggerOperation.prototype.getHeaderParams = function (args) {
+ return this.getMatchingParams(['header'], args);
+};
+
+SwaggerOperation.prototype.getMatchingParams = function (paramTypes, args) {
+ var matchingParams = {};
+ var params = this.parameters;
+ for (var i = 0; i < params.length; i++) {
+ param = params[i];
+ if (args && args[param.name])
+ matchingParams[param.name] = args[param.name];
+ }
+ var headers = this.resource.api.headers;
+ var name;
+ for (name in headers) {
+ var value = headers[name];
+ matchingParams[name] = value;
+ }
+ return matchingParams;
+};
+
+SwaggerOperation.prototype.help = function (dontPrint) {
+ var msg = this.nickname + ': ' + this.summary;
+ var params = this.parameters;
+ for (var i = 0; i < params.length; i++) {
+ var param = params[i];
+ msg += '\n* ' + param.name + (param.required ? ' (required)' : '') + " - " + param.description;
+ }
+ if(dontPrint)
+ return msg;
+ else {
+ console.log(msg);
+ return msg;
+ }
+};
+
+SwaggerOperation.prototype.asCurl = function (args) {
+ var results = [];
+ var i;
+
+ var headers = SwaggerRequest.prototype.setHeaders(args, {}, this);
+ for(i = 0; i < this.parameters.length; i++) {
+ var param = this.parameters[i];
+ if(param.paramType && param.paramType === 'header' && args[param.name]) {
+ headers[param.name] = args[param.name];
+ }
+ }
+
+ var key;
+ for (key in headers) {
+ results.push('--header "' + key + ': ' + headers[key] + '"');
+ }
+ return 'curl ' + (results.join(' ')) + ' ' + this.urlify(args);
+};
+
+SwaggerOperation.prototype.formatXml = function (xml) {
+ var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
+ reg = /(>)(<)(\/*)/g;
+ wsexp = /[ ]*(.*)[ ]+\n/g;
+ contexp = /(<.+>)(.+\n)/g;
+ xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
+ pad = 0;
+ formatted = '';
+ lines = xml.split('\n');
+ indent = 0;
+ lastType = 'other';
+ transitions = {
+ 'single->single': 0,
+ 'single->closing': -1,
+ 'single->opening': 0,
+ 'single->other': 0,
+ 'closing->single': 0,
+ 'closing->closing': -1,
+ 'closing->opening': 0,
+ 'closing->other': 0,
+ 'opening->single': 1,
+ 'opening->closing': 0,
+ 'opening->opening': 1,
+ 'opening->other': 1,
+ 'other->single': 0,
+ 'other->closing': -1,
+ 'other->opening': 0,
+ 'other->other': 0
+ };
+ _fn = function (ln) {
+ var fromTo, j, key, padding, type, types, value;
+ types = {
+ single: Boolean(ln.match(/<.+\/>/)),
+ closing: Boolean(ln.match(/<\/.+>/)),
+ opening: Boolean(ln.match(/<[^!?].*>/))
+ };
+ type = ((function () {
+ var _results;
+ _results = [];
+ for (key in types) {
+ value = types[key];
+ if (value) {
+ _results.push(key);
+ }
+ }
+ return _results;
+ })())[0];
+ type = type === void 0 ? 'other' : type;
+ fromTo = lastType + '->' + type;
+ lastType = type;
+ padding = '';
+ indent += transitions[fromTo];
+ padding = ((function () {
+ var _j, _ref5, _results;
+ _results = [];
+ for (j = _j = 0, _ref5 = indent; 0 <= _ref5 ? _j < _ref5 : _j > _ref5; j = 0 <= _ref5 ? ++_j : --_j) {
+ _results.push(' ');
+ }
+ return _results;
+ })()).join('');
+ if (fromTo === 'opening->closing') {
+ formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
+ } else {
+ formatted += padding + ln + '\n';
+ }
+ };
+ for (_i = 0, _len = lines.length; _i < _len; _i++) {
+ ln = lines[_i];
+ _fn(ln);
+ }
+ return formatted;
+};
+
+var SwaggerRequest = function (type, url, params, opts, successCallback, errorCallback, operation, execution) {
+ var _this = this;
+ var errors = [];
+
+ this.useJQuery = (typeof operation.resource.useJQuery !== 'undefined' ? operation.resource.useJQuery : null);
+ this.type = (type || errors.push('SwaggerRequest type is required (get/post/put/delete/patch/options).'));
+ this.url = (url || errors.push('SwaggerRequest url is required.'));
+ this.params = params;
+ this.opts = opts;
+ this.successCallback = (successCallback || errors.push('SwaggerRequest successCallback is required.'));
+ this.errorCallback = (errorCallback || errors.push('SwaggerRequest error callback is required.'));
+ this.operation = (operation || errors.push('SwaggerRequest operation is required.'));
+ this.execution = execution;
+ this.headers = (params.headers || {});
+
+ if (errors.length > 0) {
+ throw errors;
+ }
+
+ this.type = this.type.toUpperCase();
+
+ // set request, response content type headers
+ var headers = this.setHeaders(params, opts, this.operation);
+ var body = params.body;
+
+ // encode the body for form submits
+ if (headers['Content-Type']) {
+ var key, value, values = {}, i;
+ var operationParams = this.operation.parameters;
+ for (i = 0; i < operationParams.length; i++) {
+ var param = operationParams[i];
+ if (param.paramType === 'form')
+ values[param.name] = param;
+ }
+
+ if (headers['Content-Type'].indexOf('application/x-www-form-urlencoded') === 0) {
+ var encoded = '';
+ for (key in values) {
+ value = this.params[key];
+ if (typeof value !== 'undefined') {
+ if (encoded !== '')
+ encoded += '&';
+ encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value);
+ }
+ }
+ body = encoded;
+ }
+ else if (headers['Content-Type'].indexOf('multipart/form-data') === 0) {
+ // encode the body for form submits
+ var data = '';
+ var boundary = '----SwaggerFormBoundary' + Date.now();
+ for (key in values) {
+ value = this.params[key];
+ if (typeof value !== 'undefined') {
+ data += '--' + boundary + '\n';
+ data += 'Content-Disposition: form-data; name="' + key + '"';
+ data += '\n\n';
+ data += value + '\n';
+ }
+ }
+ data += '--' + boundary + '--\n';
+ headers['Content-Type'] = 'multipart/form-data; boundary=' + boundary;
+ body = data;
+ }
+ }
+
+ var obj;
+ if (!((this.headers) && (this.headers.mock))) {
+ obj = {
+ url: this.url,
+ method: this.type,
+ headers: headers,
+ body: body,
+ useJQuery: this.useJQuery,
+ on: {
+ error: function (response) {
+ return _this.errorCallback(response, _this.opts.parent);
+ },
+ redirect: function (response) {
+ return _this.successCallback(response, _this.opts.parent);
+ },
+ 307: function (response) {
+ return _this.successCallback(response, _this.opts.parent);
+ },
+ response: function (response) {
+ return _this.successCallback(response, _this.opts.parent);
+ }
+ }
+ };
+
+ var status = false;
+ if (this.operation.resource && this.operation.resource.api && this.operation.resource.api.clientAuthorizations) {
+ // Get the client authorizations from the resource declaration
+ status = this.operation.resource.api.clientAuthorizations.apply(obj, this.operation.authorizations);
+ } else {
+ // Get the client authorization from the default authorization declaration
+ var e;
+ if (typeof window !== 'undefined') {
+ e = window;
+ } else {
+ e = exports;
+ }
+ status = e.authorizations.apply(obj, this.operation.authorizations);
+ }
+
+ if (!opts.mock) {
+ if (status !== false) {
+ new SwaggerHttp().execute(obj);
+ } else {
+ obj.canceled = true;
+ }
+ } else {
+ return obj;
+ }
+ }
+ return obj;
+};
+
+SwaggerRequest.prototype.setHeaders = function (params, opts, operation) {
+ // default type
+ var accepts = opts.responseContentType || 'application/json';
+ var consumes = opts.requestContentType || 'application/json';
+
+ var allDefinedParams = operation.parameters;
+ var definedFormParams = [];
+ var definedFileParams = [];
+ var body = params.body;
+ var headers = {};
+
+ // get params from the operation and set them in definedFileParams, definedFormParams, headers
+ var i;
+ for (i = 0; i < allDefinedParams.length; i++) {
+ var param = allDefinedParams[i];
+ if (param.paramType === 'form')
+ definedFormParams.push(param);
+ else if (param.paramType === 'file')
+ definedFileParams.push(param);
+ else if (param.paramType === 'header' && this.params.headers) {
+ var key = param.name;
+ var headerValue = this.params.headers[param.name];
+ if (typeof this.params.headers[param.name] !== 'undefined')
+ headers[key] = headerValue;
+ }
+ }
+
+ // if there's a body, need to set the accepts header via requestContentType
+ if (body && (this.type === 'POST' || this.type === 'PUT' || this.type === 'PATCH' || this.type === 'DELETE')) {
+ if (this.opts.requestContentType)
+ consumes = this.opts.requestContentType;
+ } else {
+ // if any form params, content type must be set
+ if (definedFormParams.length > 0) {
+ if (definedFileParams.length > 0)
+ consumes = 'multipart/form-data';
+ else
+ consumes = 'application/x-www-form-urlencoded';
+ }
+ else if (this.type === 'DELETE')
+ body = '{}';
+ else if (this.type != 'DELETE')
+ consumes = null;
+ }
+
+ if (consumes && this.operation.consumes) {
+ if (this.operation.consumes.indexOf(consumes) === -1) {
+ log('server doesn\'t consume ' + consumes + ', try ' + JSON.stringify(this.operation.consumes));
+ }
+ }
+
+ if (this.opts && this.opts.responseContentType) {
+ accepts = this.opts.responseContentType;
+ } else {
+ accepts = 'application/json';
+ }
+ if (accepts && operation.produces) {
+ if (operation.produces.indexOf(accepts) === -1) {
+ log('server can\'t produce ' + accepts);
+ }
+ }
+
+ if ((consumes && body !== '') || (consumes === 'application/x-www-form-urlencoded'))
+ headers['Content-Type'] = consumes;
+ if (accepts)
+ headers.Accept = accepts;
+ return headers;
+};
+
+/**
+ * SwaggerHttp is a wrapper for executing requests
+ */
+var SwaggerHttp = function() {};
+
+SwaggerHttp.prototype.execute = function(obj, opts) {
+ if(obj && (typeof obj.useJQuery === 'boolean'))
+ this.useJQuery = obj.useJQuery;
+ else
+ this.useJQuery = this.isIE8();
+
+ if(obj && typeof obj.body === 'object') {
+ if(obj.body.type && obj.body.type !== 'formData')
+ obj.body = JSON.stringify(obj.body);
+ else {
+ obj.contentType = false;
+ obj.processData = false;
+ // delete obj.cache;
+ delete obj.headers['Content-Type'];
+ }
+ }
+
+ if(this.useJQuery)
+ return new JQueryHttpClient(opts).execute(obj);
+ else
+ return new ShredHttpClient(opts).execute(obj);
+};
+
+SwaggerHttp.prototype.isIE8 = function() {
+ var detectedIE = false;
+ if (typeof navigator !== 'undefined' && navigator.userAgent) {
+ nav = navigator.userAgent.toLowerCase();
+ if (nav.indexOf('msie') !== -1) {
+ var version = parseInt(nav.split('msie')[1]);
+ if (version <= 8) {
+ detectedIE = true;
+ }
+ }
+ }
+ return detectedIE;
+};
+
+/*
+ * JQueryHttpClient lets a browser take advantage of JQuery's cross-browser magic.
+ * NOTE: when jQuery is available it will export both '$' and 'jQuery' to the global space.
+ * Since we are using closures here we need to alias it for internal use.
+ */
+var JQueryHttpClient = function(options) {
+ "use strict";
+ if(!jQuery){
+ var jQuery = window.jQuery;
+ }
+};
+
+JQueryHttpClient.prototype.execute = function(obj) {
+ var cb = obj.on;
+ var request = obj;
+
+ obj.type = obj.method;
+ obj.cache = false;
+ delete obj.useJQuery;
+
+ /*
+ obj.beforeSend = function(xhr) {
+ var key, results;
+ if (obj.headers) {
+ results = [];
+ for (key in obj.headers) {
+ if (key.toLowerCase() === "content-type") {
+ results.push(obj.contentType = obj.headers[key]);
+ } else if (key.toLowerCase() === "accept") {
+ results.push(obj.accepts = obj.headers[key]);
+ } else {
+ results.push(xhr.setRequestHeader(key, obj.headers[key]));
+ }
+ }
+ return results;
+ }
+ };*/
+
+ obj.data = obj.body;
+ delete obj.body;
+ obj.complete = function(response, textStatus, opts) {
+ var headers = {},
+ headerArray = response.getAllResponseHeaders().split("\n");
+
+ for(var i = 0; i < headerArray.length; i++) {
+ var toSplit = headerArray[i].trim();
+ if(toSplit.length === 0)
+ continue;
+ var separator = toSplit.indexOf(":");
+ if(separator === -1) {
+ // Name but no value in the header
+ headers[toSplit] = null;
+ continue;
+ }
+ var name = toSplit.substring(0, separator).trim(),
+ value = toSplit.substring(separator + 1).trim();
+ headers[name] = value;
+ }
+
+ var out = {
+ url: request.url,
+ method: request.method,
+ status: response.status,
+ statusText: response.statusText,
+ data: response.responseText,
+ headers: headers
+ };
+
+ var contentType = (headers["content-type"]||headers["Content-Type"]||null);
+ if(contentType) {
+ if(contentType.indexOf("application/json") === 0 || contentType.indexOf("+json") > 0) {
+ try {
+ out.obj = response.responseJSON || JSON.parse(out.data) || {};
+ } catch (ex) {
+ // do not set out.obj
+ log("unable to parse JSON content");
+ }
+ }
+ }
+
+ if(response.status >= 200 && response.status < 300)
+ cb.response(out);
+ else if(response.status === 0 || (response.status >= 400 && response.status < 599))
+ cb.error(out);
+ else
+ return cb.response(out);
+ };
+
+ jQuery.support.cors = true;
+ return jQuery.ajax(obj);
+};
+
+/*
+ * ShredHttpClient is a light-weight, node or browser HTTP client
+ */
+var ShredHttpClient = function(opts) {
+ this.opts = (opts||{});
+ this.isInitialized = false;
+
+ var identity, toString;
+
+ if (typeof window !== 'undefined') {
+ this.Shred = require("./shred");
+ this.content = require("./shred/content");
+ }
+ else
+ this.Shred = require("shred");
+ this.shred = new this.Shred(opts);
+};
+
+ShredHttpClient.prototype.initShred = function () {
+ this.isInitialized = true;
+ this.registerProcessors(this.shred);
+};
+
+ShredHttpClient.prototype.registerProcessors = function(shred) {
+ var identity = function(x) {
+ return x;
+ };
+ var toString = function(x) {
+ return x.toString();
+ };
+
+ if (typeof window !== 'undefined') {
+ this.content.registerProcessor(["application/json; charset=utf-8", "application/json", "json"], {
+ parser: identity,
+ stringify: toString
+ });
+ } else {
+ this.Shred.registerProcessor(["application/json; charset=utf-8", "application/json", "json"], {
+ parser: identity,
+ stringify: toString
+ });
+ }
+};
+
+ShredHttpClient.prototype.execute = function(obj) {
+ if(!this.isInitialized)
+ this.initShred();
+
+ var cb = obj.on, res;
+ var transform = function(response) {
+ var out = {
+ headers: response._headers,
+ url: response.request.url,
+ method: response.request.method,
+ status: response.status,
+ data: response.content.data
+ };
+
+ var headers = response._headers.normalized || response._headers;
+ var contentType = (headers["content-type"]||headers["Content-Type"]||null);
+
+ if(contentType) {
+ if(contentType.indexOf("application/json") === 0 || contentType.indexOf("+json") > 0) {
+ if(response.content.data && response.content.data !== "")
+ try{
+ out.obj = JSON.parse(response.content.data);
+ }
+ catch (e) {
+ // unable to parse
+ }
+ else
+ out.obj = {};
+ }
+ }
+ return out;
+ };
+
+ // Transform an error into a usable response-like object
+ var transformError = function (error) {
+ var out = {
+ // Default to a status of 0 - The client will treat this as a generic permissions sort of error
+ status: 0,
+ data: error.message || error
+ };
+
+ if (error.code) {
+ out.obj = error;
+
+ if (error.code === 'ENOTFOUND' || error.code === 'ECONNREFUSED') {
+ // We can tell the client that this should be treated as a missing resource and not as a permissions thing
+ out.status = 404;
+ }
+ }
+ return out;
+ };
+
+ res = {
+ error: function (response) {
+ if (obj)
+ return cb.error(transform(response));
+ },
+ // Catch the Shred error raised when the request errors as it is made (i.e. No Response is coming)
+ request_error: function (err) {
+ if (obj)
+ return cb.error(transformError(err));
+ },
+ response: function (response) {
+ if (obj) {
+ return cb.response(transform(response));
+ }
+ }
+ };
+ if (obj) {
+ obj.on = res;
+ }
+ return this.shred.request(obj);
+};
+
+
+var e = (typeof window !== 'undefined' ? window : exports);
+
+e.authorizations = authorizations = new SwaggerAuthorizations();
+e.ApiKeyAuthorization = ApiKeyAuthorization;
+e.PasswordAuthorization = PasswordAuthorization;
+e.CookieAuthorization = CookieAuthorization;
+e.SwaggerClient = SwaggerClient;
+e.SwaggerApi = SwaggerClient;
+e.Operation = Operation;
+e.Model = Model;
+e.addModel = addModel;
+e.Resolver = Resolver;
+})(); \ No newline at end of file
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/swagger-oauth.js b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/swagger-oauth.js
new file mode 100644
index 0000000..c0dd558
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/swagger-oauth.js
@@ -0,0 +1,294 @@
+/*
+ * 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.
+ */
+var appName;
+var popupMask;
+var popupDialog;
+var clientId;
+var realm;
+var oauth2KeyName;
+var redirect_uri;
+
+function handleLogin() {
+ var scopes = [];
+
+ var auths = window.swaggerUi.api.authSchemes || window.swaggerUi.api.securityDefinitions;
+ if(auths) {
+ var key;
+ var defs = auths;
+ for(key in defs) {
+ var auth = defs[key];
+ if(auth.type === 'oauth2' && auth.scopes) {
+ oauth2KeyName = key;
+ var scope;
+ if(Array.isArray(auth.scopes)) {
+ // 1.2 support
+ var i;
+ for(i = 0; i < auth.scopes.length; i++) {
+ scopes.push(auth.scopes[i]);
+ }
+ }
+ else {
+ // 2.0 support
+ for(scope in auth.scopes) {
+ scopes.push({scope: scope, description: auth.scopes[scope]});
+ }
+ }
+ }
+ }
+ }
+
+ if(window.swaggerUi.api
+ && window.swaggerUi.api.info) {
+ appName = window.swaggerUi.api.info.title;
+ }
+
+ popupDialog = $(
+ [
+ '<div class="api-popup-dialog">',
+ '<div class="api-popup-title">Select OAuth2.0 Scopes</div>',
+ '<div class="api-popup-content">',
+ '<p>Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes.',
+ '<a href="#">Learn how to use</a>',
+ '</p>',
+ '<p><strong>' + appName + '</strong> API requires the following scopes. Select which ones you want to grant to Swagger UI.</p>',
+ '<ul class="api-popup-scopes">',
+ '</ul>',
+ '<p class="error-msg"></p>',
+ '<div class="api-popup-actions"><button class="api-popup-authbtn api-button green" type="button">Authorize</button><button class="api-popup-cancel api-button gray" type="button">Cancel</button></div>',
+ '</div>',
+ '</div>'].join(''));
+ $(document.body).append(popupDialog);
+
+ popup = popupDialog.find('ul.api-popup-scopes').empty();
+ for (i = 0; i < scopes.length; i ++) {
+ scope = scopes[i];
+ str = '<li><input type="checkbox" id="scope_' + i + '" scope="' + scope.scope + '"/>' + '<label for="scope_' + i + '">' + scope.scope;
+ if (scope.description) {
+ str += '<br/><span class="api-scope-desc">' + scope.description + '</span>';
+ }
+ str += '</label></li>';
+ popup.append(str);
+ }
+
+ var $win = $(window),
+ dw = $win.width(),
+ dh = $win.height(),
+ st = $win.scrollTop(),
+ dlgWd = popupDialog.outerWidth(),
+ dlgHt = popupDialog.outerHeight(),
+ top = (dh -dlgHt)/2 + st,
+ left = (dw - dlgWd)/2;
+
+ popupDialog.css({
+ top: (top < 0? 0 : top) + 'px',
+ left: (left < 0? 0 : left) + 'px'
+ });
+
+ popupDialog.find('button.api-popup-cancel').click(function() {
+ popupMask.hide();
+ popupDialog.hide();
+ popupDialog.empty();
+ popupDialog = [];
+ });
+
+ $('button.api-popup-authbtn').unbind();
+ popupDialog.find('button.api-popup-authbtn').click(function() {
+ popupMask.hide();
+ popupDialog.hide();
+
+ var authSchemes = window.swaggerUi.api.authSchemes;
+ var host = window.location;
+ var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/"));
+ var redirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
+ var url = null;
+
+ for (var key in authSchemes) {
+ if (authSchemes.hasOwnProperty(key)) {
+ var flow = authSchemes[key].flow;
+
+ if(authSchemes[key].type === 'oauth2' && flow && (flow === 'implicit' || flow === 'accessCode')) {
+ var dets = authSchemes[key];
+ url = dets.authorizationUrl + '?response_type=' + (flow === 'implicit' ? 'token' : 'code');
+ window.swaggerUi.tokenName = dets.tokenName || 'access_token';
+ window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
+ }
+ else if(authSchemes[key].grantTypes) {
+ // 1.2 support
+ var o = authSchemes[key].grantTypes;
+ for(var t in o) {
+ if(o.hasOwnProperty(t) && t === 'implicit') {
+ var dets = o[t];
+ var ep = dets.loginEndpoint.url;
+ url = dets.loginEndpoint.url + '?response_type=token';
+ window.swaggerUi.tokenName = dets.tokenName;
+ }
+ else if (o.hasOwnProperty(t) && t === 'accessCode') {
+ var dets = o[t];
+ var ep = dets.tokenRequestEndpoint.url;
+ url = dets.tokenRequestEndpoint.url + '?response_type=code';
+ window.swaggerUi.tokenName = dets.tokenName;
+ }
+ }
+ }
+ }
+ }
+ var scopes = []
+ var o = $('.api-popup-scopes').find('input:checked');
+
+ for(k =0; k < o.length; k++) {
+ var scope = $(o[k]).attr('scope');
+
+ if (scopes.indexOf(scope) === -1)
+ scopes.push(scope);
+ }
+
+ window.enabledScopes=scopes;
+
+ redirect_uri = redirectUrl;
+
+ url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
+ url += '&realm=' + encodeURIComponent(realm);
+ url += '&client_id=' + encodeURIComponent(clientId);
+ url += '&scope=' + encodeURIComponent(scopes);
+
+ window.open(url);
+ });
+
+ popupMask.show();
+ popupDialog.show();
+ return;
+}
+
+
+function handleLogout() {
+ for(key in window.authorizations.authz){
+ window.authorizations.remove(key)
+ }
+ window.enabledScopes = null;
+ $('.api-ic.ic-on').addClass('ic-off');
+ $('.api-ic.ic-on').removeClass('ic-on');
+
+ // set the info box
+ $('.api-ic.ic-warning').addClass('ic-error');
+ $('.api-ic.ic-warning').removeClass('ic-warning');
+}
+
+function initOAuth(opts) {
+ var o = (opts||{});
+ var errors = [];
+
+ appName = (o.appName||errors.push('missing appName'));
+ popupMask = (o.popupMask||$('#api-common-mask'));
+ popupDialog = (o.popupDialog||$('.api-popup-dialog'));
+ clientId = (o.clientId||errors.push('missing client id'));
+ realm = (o.realm||errors.push('missing realm'));
+
+ if(errors.length > 0){
+ log('auth unable initialize oauth: ' + errors);
+ return;
+ }
+
+ $('pre code').each(function(i, e) {hljs.highlightBlock(e)});
+ $('.api-ic').unbind();
+ $('.api-ic').click(function(s) {
+ if($(s.target).hasClass('ic-off'))
+ handleLogin();
+ else {
+ handleLogout();
+ }
+ false;
+ });
+}
+
+function processOAuthCode(data) {
+ var params = {
+ 'client_id': clientId,
+ 'code': data.code,
+ 'grant_type': 'authorization_code',
+ 'redirect_uri': redirect_uri
+ }
+ $.ajax(
+ {
+ url : window.swaggerUi.tokenUrl,
+ type: "POST",
+ data: params,
+ success:function(data, textStatus, jqXHR)
+ {
+ onOAuthComplete(data);
+ },
+ error: function(jqXHR, textStatus, errorThrown)
+ {
+ onOAuthComplete("");
+ }
+ });
+}
+
+function onOAuthComplete(token) {
+ if(token) {
+ if(token.error) {
+ var checkbox = $('input[type=checkbox],.secured')
+ checkbox.each(function(pos){
+ checkbox[pos].checked = false;
+ });
+ alert(token.error);
+ }
+ else {
+ var b = token[window.swaggerUi.tokenName];
+ if(b){
+ // if all roles are satisfied
+ var o = null;
+ $.each($('.auth #api_information_panel'), function(k, v) {
+ var children = v;
+ if(children && children.childNodes) {
+ var requiredScopes = [];
+ $.each((children.childNodes), function (k1, v1){
+ var inner = v1.innerHTML;
+ if(inner)
+ requiredScopes.push(inner);
+ });
+ var diff = [];
+ for(var i=0; i < requiredScopes.length; i++) {
+ var s = requiredScopes[i];
+ if(window.enabledScopes && window.enabledScopes.indexOf(s) == -1) {
+ diff.push(s);
+ }
+ }
+ if(diff.length > 0){
+ o = v.parentNode;
+ $(o.parentNode).find('.api-ic.ic-on').addClass('ic-off');
+ $(o.parentNode).find('.api-ic.ic-on').removeClass('ic-on');
+
+ // sorry, not all scopes are satisfied
+ $(o).find('.api-ic').addClass('ic-warning');
+ $(o).find('.api-ic').removeClass('ic-error');
+ }
+ else {
+ o = v.parentNode;
+ $(o.parentNode).find('.api-ic.ic-off').addClass('ic-on');
+ $(o.parentNode).find('.api-ic.ic-off').removeClass('ic-off');
+
+ // all scopes are satisfied
+ $(o).find('.api-ic').addClass('ic-info');
+ $(o).find('.api-ic').removeClass('ic-warning');
+ $(o).find('.api-ic').removeClass('ic-error');
+ }
+ }
+ });
+ window.authorizations.add(oauth2KeyName, new ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/underscore-min.js b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/underscore-min.js
new file mode 100644
index 0000000..e183d64
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/lib/underscore-min.js
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+// Underscore.js 1.7.0
+// http://underscorejs.org
+// (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+// Underscore may be freely distributed under the MIT license.
+(function(){var n=this,t=n._,r=Array.prototype,e=Object.prototype,u=Function.prototype,i=r.push,a=r.slice,o=r.concat,l=e.toString,c=e.hasOwnProperty,f=Array.isArray,s=Object.keys,p=u.bind,h=function(n){return n instanceof h?n:this instanceof h?void(this._wrapped=n):new h(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=h),exports._=h):n._=h,h.VERSION="1.7.0";var g=function(n,t,r){if(t===void 0)return n;switch(null==r?3:r){case 1:return function(r){return n.call(t,r)};case 2:return function(r,e){return n.call(t,r,e)};case 3:return function(r,e,u){return n.call(t,r,e,u)};case 4:return function(r,e,u,i){return n.call(t,r,e,u,i)}}return function(){return n.apply(t,arguments)}};h.iteratee=function(n,t,r){return null==n?h.identity:h.isFunction(n)?g(n,t,r):h.isObject(n)?h.matches(n):h.property(n)},h.each=h.forEach=function(n,t,r){if(null==n)return n;t=g(t,r);var e,u=n.length;if(u===+u)for(e=0;u>e;e++)t(n[e],e,n);else{var i=h.keys(n);for(e=0,u=i.length;u>e;e++)t(n[i[e]],i[e],n)}return n},h.map=h.collect=function(n,t,r){if(null==n)return[];t=h.iteratee(t,r);for(var e,u=n.length!==+n.length&&h.keys(n),i=(u||n).length,a=Array(i),o=0;i>o;o++)e=u?u[o]:o,a[o]=t(n[e],e,n);return a};var v="Reduce of empty array with no initial value";h.reduce=h.foldl=h.inject=function(n,t,r,e){null==n&&(n=[]),t=g(t,e,4);var u,i=n.length!==+n.length&&h.keys(n),a=(i||n).length,o=0;if(arguments.length<3){if(!a)throw new TypeError(v);r=n[i?i[o++]:o++]}for(;a>o;o++)u=i?i[o]:o,r=t(r,n[u],u,n);return r},h.reduceRight=h.foldr=function(n,t,r,e){null==n&&(n=[]),t=g(t,e,4);var u,i=n.length!==+n.length&&h.keys(n),a=(i||n).length;if(arguments.length<3){if(!a)throw new TypeError(v);r=n[i?i[--a]:--a]}for(;a--;)u=i?i[a]:a,r=t(r,n[u],u,n);return r},h.find=h.detect=function(n,t,r){var e;return t=h.iteratee(t,r),h.some(n,function(n,r,u){return t(n,r,u)?(e=n,!0):void 0}),e},h.filter=h.select=function(n,t,r){var e=[];return null==n?e:(t=h.iteratee(t,r),h.each(n,function(n,r,u){t(n,r,u)&&e.push(n)}),e)},h.reject=function(n,t,r){return h.filter(n,h.negate(h.iteratee(t)),r)},h.every=h.all=function(n,t,r){if(null==n)return!0;t=h.iteratee(t,r);var e,u,i=n.length!==+n.length&&h.keys(n),a=(i||n).length;for(e=0;a>e;e++)if(u=i?i[e]:e,!t(n[u],u,n))return!1;return!0},h.some=h.any=function(n,t,r){if(null==n)return!1;t=h.iteratee(t,r);var e,u,i=n.length!==+n.length&&h.keys(n),a=(i||n).length;for(e=0;a>e;e++)if(u=i?i[e]:e,t(n[u],u,n))return!0;return!1},h.contains=h.include=function(n,t){return null==n?!1:(n.length!==+n.length&&(n=h.values(n)),h.indexOf(n,t)>=0)},h.invoke=function(n,t){var r=a.call(arguments,2),e=h.isFunction(t);return h.map(n,function(n){return(e?t:n[t]).apply(n,r)})},h.pluck=function(n,t){return h.map(n,h.property(t))},h.where=function(n,t){return h.filter(n,h.matches(t))},h.findWhere=function(n,t){return h.find(n,h.matches(t))},h.max=function(n,t,r){var e,u,i=-1/0,a=-1/0;if(null==t&&null!=n){n=n.length===+n.length?n:h.values(n);for(var o=0,l=n.length;l>o;o++)e=n[o],e>i&&(i=e)}else t=h.iteratee(t,r),h.each(n,function(n,r,e){u=t(n,r,e),(u>a||u===-1/0&&i===-1/0)&&(i=n,a=u)});return i},h.min=function(n,t,r){var e,u,i=1/0,a=1/0;if(null==t&&null!=n){n=n.length===+n.length?n:h.values(n);for(var o=0,l=n.length;l>o;o++)e=n[o],i>e&&(i=e)}else t=h.iteratee(t,r),h.each(n,function(n,r,e){u=t(n,r,e),(a>u||1/0===u&&1/0===i)&&(i=n,a=u)});return i},h.shuffle=function(n){for(var t,r=n&&n.length===+n.length?n:h.values(n),e=r.length,u=Array(e),i=0;e>i;i++)t=h.random(0,i),t!==i&&(u[i]=u[t]),u[t]=r[i];return u},h.sample=function(n,t,r){return null==t||r?(n.length!==+n.length&&(n=h.values(n)),n[h.random(n.length-1)]):h.shuffle(n).slice(0,Math.max(0,t))},h.sortBy=function(n,t,r){return t=h.iteratee(t,r),h.pluck(h.map(n,function(n,r,e){return{value:n,index:r,criteria:t(n,r,e)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var m=function(n){return function(t,r,e){var u={};return r=h.iteratee(r,e),h.each(t,function(e,i){var a=r(e,i,t);n(u,e,a)}),u}};h.groupBy=m(function(n,t,r){h.has(n,r)?n[r].push(t):n[r]=[t]}),h.indexBy=m(function(n,t,r){n[r]=t}),h.countBy=m(function(n,t,r){h.has(n,r)?n[r]++:n[r]=1}),h.sortedIndex=function(n,t,r,e){r=h.iteratee(r,e,1);for(var u=r(t),i=0,a=n.length;a>i;){var o=i+a>>>1;r(n[o])<u?i=o+1:a=o}return i},h.toArray=function(n){return n?h.isArray(n)?a.call(n):n.length===+n.length?h.map(n,h.identity):h.values(n):[]},h.size=function(n){return null==n?0:n.length===+n.length?n.length:h.keys(n).length},h.partition=function(n,t,r){t=h.iteratee(t,r);var e=[],u=[];return h.each(n,function(n,r,i){(t(n,r,i)?e:u).push(n)}),[e,u]},h.first=h.head=h.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:0>t?[]:a.call(n,0,t)},h.initial=function(n,t,r){return a.call(n,0,Math.max(0,n.length-(null==t||r?1:t)))},h.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:a.call(n,Math.max(n.length-t,0))},h.rest=h.tail=h.drop=function(n,t,r){return a.call(n,null==t||r?1:t)},h.compact=function(n){return h.filter(n,h.identity)};var y=function(n,t,r,e){if(t&&h.every(n,h.isArray))return o.apply(e,n);for(var u=0,a=n.length;a>u;u++){var l=n[u];h.isArray(l)||h.isArguments(l)?t?i.apply(e,l):y(l,t,r,e):r||e.push(l)}return e};h.flatten=function(n,t){return y(n,t,!1,[])},h.without=function(n){return h.difference(n,a.call(arguments,1))},h.uniq=h.unique=function(n,t,r,e){if(null==n)return[];h.isBoolean(t)||(e=r,r=t,t=!1),null!=r&&(r=h.iteratee(r,e));for(var u=[],i=[],a=0,o=n.length;o>a;a++){var l=n[a];if(t)a&&i===l||u.push(l),i=l;else if(r){var c=r(l,a,n);h.indexOf(i,c)<0&&(i.push(c),u.push(l))}else h.indexOf(u,l)<0&&u.push(l)}return u},h.union=function(){return h.uniq(y(arguments,!0,!0,[]))},h.intersection=function(n){if(null==n)return[];for(var t=[],r=arguments.length,e=0,u=n.length;u>e;e++){var i=n[e];if(!h.contains(t,i)){for(var a=1;r>a&&h.contains(arguments[a],i);a++);a===r&&t.push(i)}}return t},h.difference=function(n){var t=y(a.call(arguments,1),!0,!0,[]);return h.filter(n,function(n){return!h.contains(t,n)})},h.zip=function(n){if(null==n)return[];for(var t=h.max(arguments,"length").length,r=Array(t),e=0;t>e;e++)r[e]=h.pluck(arguments,e);return r},h.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},h.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=h.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}for(;u>e;e++)if(n[e]===t)return e;return-1},h.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=n.length;for("number"==typeof r&&(e=0>r?e+r+1:Math.min(e,r+1));--e>=0;)if(n[e]===t)return e;return-1},h.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=r||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=Array(e),i=0;e>i;i++,n+=r)u[i]=n;return u};var d=function(){};h.bind=function(n,t){var r,e;if(p&&n.bind===p)return p.apply(n,a.call(arguments,1));if(!h.isFunction(n))throw new TypeError("Bind must be called on a function");return r=a.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(a.call(arguments)));d.prototype=n.prototype;var u=new d;d.prototype=null;var i=n.apply(u,r.concat(a.call(arguments)));return h.isObject(i)?i:u}},h.partial=function(n){var t=a.call(arguments,1);return function(){for(var r=0,e=t.slice(),u=0,i=e.length;i>u;u++)e[u]===h&&(e[u]=arguments[r++]);for(;r<arguments.length;)e.push(arguments[r++]);return n.apply(this,e)}},h.bindAll=function(n){var t,r,e=arguments.length;if(1>=e)throw new Error("bindAll must be passed function names");for(t=1;e>t;t++)r=arguments[t],n[r]=h.bind(n[r],n);return n},h.memoize=function(n,t){var r=function(e){var u=r.cache,i=t?t.apply(this,arguments):e;return h.has(u,i)||(u[i]=n.apply(this,arguments)),u[i]};return r.cache={},r},h.delay=function(n,t){var r=a.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},h.defer=function(n){return h.delay.apply(h,[n,1].concat(a.call(arguments,1)))},h.throttle=function(n,t,r){var e,u,i,a=null,o=0;r||(r={});var l=function(){o=r.leading===!1?0:h.now(),a=null,i=n.apply(e,u),a||(e=u=null)};return function(){var c=h.now();o||r.leading!==!1||(o=c);var f=t-(c-o);return e=this,u=arguments,0>=f||f>t?(clearTimeout(a),a=null,o=c,i=n.apply(e,u),a||(e=u=null)):a||r.trailing===!1||(a=setTimeout(l,f)),i}},h.debounce=function(n,t,r){var e,u,i,a,o,l=function(){var c=h.now()-a;t>c&&c>0?e=setTimeout(l,t-c):(e=null,r||(o=n.apply(i,u),e||(i=u=null)))};return function(){i=this,u=arguments,a=h.now();var c=r&&!e;return e||(e=setTimeout(l,t)),c&&(o=n.apply(i,u),i=u=null),o}},h.wrap=function(n,t){return h.partial(t,n)},h.negate=function(n){return function(){return!n.apply(this,arguments)}},h.compose=function(){var n=arguments,t=n.length-1;return function(){for(var r=t,e=n[t].apply(this,arguments);r--;)e=n[r].call(this,e);return e}},h.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},h.before=function(n,t){var r;return function(){return--n>0?r=t.apply(this,arguments):t=null,r}},h.once=h.partial(h.before,2),h.keys=function(n){if(!h.isObject(n))return[];if(s)return s(n);var t=[];for(var r in n)h.has(n,r)&&t.push(r);return t},h.values=function(n){for(var t=h.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},h.pairs=function(n){for(var t=h.keys(n),r=t.length,e=Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},h.invert=function(n){for(var t={},r=h.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},h.functions=h.methods=function(n){var t=[];for(var r in n)h.isFunction(n[r])&&t.push(r);return t.sort()},h.extend=function(n){if(!h.isObject(n))return n;for(var t,r,e=1,u=arguments.length;u>e;e++){t=arguments[e];for(r in t)c.call(t,r)&&(n[r]=t[r])}return n},h.pick=function(n,t,r){var e,u={};if(null==n)return u;if(h.isFunction(t)){t=g(t,r);for(e in n){var i=n[e];t(i,e,n)&&(u[e]=i)}}else{var l=o.apply([],a.call(arguments,1));n=new Object(n);for(var c=0,f=l.length;f>c;c++)e=l[c],e in n&&(u[e]=n[e])}return u},h.omit=function(n,t,r){if(h.isFunction(t))t=h.negate(t);else{var e=h.map(o.apply([],a.call(arguments,1)),String);t=function(n,t){return!h.contains(e,t)}}return h.pick(n,t,r)},h.defaults=function(n){if(!h.isObject(n))return n;for(var t=1,r=arguments.length;r>t;t++){var e=arguments[t];for(var u in e)n[u]===void 0&&(n[u]=e[u])}return n},h.clone=function(n){return h.isObject(n)?h.isArray(n)?n.slice():h.extend({},n):n},h.tap=function(n,t){return t(n),n};var b=function(n,t,r,e){if(n===t)return 0!==n||1/n===1/t;if(null==n||null==t)return n===t;n instanceof h&&(n=n._wrapped),t instanceof h&&(t=t._wrapped);var u=l.call(n);if(u!==l.call(t))return!1;switch(u){case"[object RegExp]":case"[object String]":return""+n==""+t;case"[object Number]":return+n!==+n?+t!==+t:0===+n?1/+n===1/t:+n===+t;case"[object Date]":case"[object Boolean]":return+n===+t}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]===n)return e[i]===t;var a=n.constructor,o=t.constructor;if(a!==o&&"constructor"in n&&"constructor"in t&&!(h.isFunction(a)&&a instanceof a&&h.isFunction(o)&&o instanceof o))return!1;r.push(n),e.push(t);var c,f;if("[object Array]"===u){if(c=n.length,f=c===t.length)for(;c--&&(f=b(n[c],t[c],r,e)););}else{var s,p=h.keys(n);if(c=p.length,f=h.keys(t).length===c)for(;c--&&(s=p[c],f=h.has(t,s)&&b(n[s],t[s],r,e)););}return r.pop(),e.pop(),f};h.isEqual=function(n,t){return b(n,t,[],[])},h.isEmpty=function(n){if(null==n)return!0;if(h.isArray(n)||h.isString(n)||h.isArguments(n))return 0===n.length;for(var t in n)if(h.has(n,t))return!1;return!0},h.isElement=function(n){return!(!n||1!==n.nodeType)},h.isArray=f||function(n){return"[object Array]"===l.call(n)},h.isObject=function(n){var t=typeof n;return"function"===t||"object"===t&&!!n},h.each(["Arguments","Function","String","Number","Date","RegExp"],function(n){h["is"+n]=function(t){return l.call(t)==="[object "+n+"]"}}),h.isArguments(arguments)||(h.isArguments=function(n){return h.has(n,"callee")}),"function"!=typeof/./&&(h.isFunction=function(n){return"function"==typeof n||!1}),h.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},h.isNaN=function(n){return h.isNumber(n)&&n!==+n},h.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"===l.call(n)},h.isNull=function(n){return null===n},h.isUndefined=function(n){return n===void 0},h.has=function(n,t){return null!=n&&c.call(n,t)},h.noConflict=function(){return n._=t,this},h.identity=function(n){return n},h.constant=function(n){return function(){return n}},h.noop=function(){},h.property=function(n){return function(t){return t[n]}},h.matches=function(n){var t=h.pairs(n),r=t.length;return function(n){if(null==n)return!r;n=new Object(n);for(var e=0;r>e;e++){var u=t[e],i=u[0];if(u[1]!==n[i]||!(i in n))return!1}return!0}},h.times=function(n,t,r){var e=Array(Math.max(0,n));t=g(t,r,1);for(var u=0;n>u;u++)e[u]=t(u);return e},h.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},h.now=Date.now||function(){return(new Date).getTime()};var _={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},w=h.invert(_),j=function(n){var t=function(t){return n[t]},r="(?:"+h.keys(n).join("|")+")",e=RegExp(r),u=RegExp(r,"g");return function(n){return n=null==n?"":""+n,e.test(n)?n.replace(u,t):n}};h.escape=j(_),h.unescape=j(w),h.result=function(n,t){if(null==n)return void 0;var r=n[t];return h.isFunction(r)?n[t]():r};var x=0;h.uniqueId=function(n){var t=++x+"";return n?n+t:t},h.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var A=/(.)^/,k={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},O=/\\|'|\r|\n|\u2028|\u2029/g,F=function(n){return"\\"+k[n]};h.template=function(n,t,r){!t&&r&&(t=r),t=h.defaults({},t,h.templateSettings);var e=RegExp([(t.escape||A).source,(t.interpolate||A).source,(t.evaluate||A).source].join("|")+"|$","g"),u=0,i="__p+='";n.replace(e,function(t,r,e,a,o){return i+=n.slice(u,o).replace(O,F),u=o+t.length,r?i+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":e?i+="'+\n((__t=("+e+"))==null?'':__t)+\n'":a&&(i+="';\n"+a+"\n__p+='"),t}),i+="';\n",t.variable||(i="with(obj||{}){\n"+i+"}\n"),i="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{var a=new Function(t.variable||"obj","_",i)}catch(o){throw o.source=i,o}var l=function(n){return a.call(this,n,h)},c=t.variable||"obj";return l.source="function("+c+"){\n"+i+"}",l},h.chain=function(n){var t=h(n);return t._chain=!0,t};var E=function(n){return this._chain?h(n).chain():n};h.mixin=function(n){h.each(h.functions(n),function(t){var r=h[t]=n[t];h.prototype[t]=function(){var n=[this._wrapped];return i.apply(n,arguments),E.call(this,r.apply(h,n))}})},h.mixin(h),h.each(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=r[n];h.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!==n&&"splice"!==n||0!==r.length||delete r[0],E.call(this,r)}}),h.each(["concat","join","slice"],function(n){var t=r[n];h.prototype[n]=function(){return E.call(this,t.apply(this._wrapped,arguments))}}),h.prototype.value=function(){return this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return h})}).call(this);
+//# sourceMappingURL=underscore-min.map \ No newline at end of file
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/o2c.html b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/o2c.html
new file mode 100644
index 0000000..04c8c28
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/o2c.html
@@ -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.
+
+-->
+<script>
+var qp = null;
+if(window.location.hash) {
+ qp = location.hash.substring(1);
+}
+else {
+ qp = location.search.substring(1);
+}
+qp = qp ? JSON.parse('{"' + qp.replace(/&/g, '","').replace(/=/g,'":"') + '"}',
+ function(key, value) {
+ return key===""?value:decodeURIComponent(value) }
+ ):{}
+
+if (window.opener.swaggerUi.tokenUrl)
+ window.opener.processOAuthCode(qp);
+else
+ window.opener.onOAuthComplete(qp);
+
+window.close();
+</script> \ No newline at end of file
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/swagger-ui.js b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/swagger-ui.js
new file mode 100644
index 0000000..5a1b345
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/swagger-ui.js
@@ -0,0 +1,2255 @@
+/*
+ * 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.
+ */
+/**
+ * swagger-ui - Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API
+ * @version v2.1.8-M1
+ * @link http://swagger.io
+ * @license Apache 2.0
+ */
+$(function() {
+
+ // Helper function for vertically aligning DOM elements
+ // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
+ $.fn.vAlign = function() {
+ return this.each(function(i){
+ var ah = $(this).height();
+ var ph = $(this).parent().height();
+ var mh = (ph - ah) / 2;
+ $(this).css('margin-top', mh);
+ });
+ };
+
+ $.fn.stretchFormtasticInputWidthToParent = function() {
+ return this.each(function(i){
+ var p_width = $(this).closest("form").innerWidth();
+ var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
+ var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
+ $(this).css('width', p_width - p_padding - this_padding);
+ });
+ };
+
+ $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
+
+ // Vertically center these paragraphs
+ // Parent may need a min-height for this to work..
+ $('ul.downplayed li div.content p').vAlign();
+
+ // When a sandbox form is submitted..
+ $("form.sandbox").submit(function(){
+
+ var error_free = true;
+
+ // Cycle through the forms required inputs
+ $(this).find("input.required").each(function() {
+
+ // Remove any existing error styles from the input
+ $(this).removeClass('error');
+
+ // Tack the error style on if the input is empty..
+ if ($(this).val() == '') {
+ $(this).addClass('error');
+ $(this).wiggle();
+ error_free = false;
+ }
+
+ });
+
+ return error_free;
+ });
+
+});
+
+function clippyCopiedCallback(a) {
+ $('#api_key_copied').fadeIn().delay(1000).fadeOut();
+
+ // var b = $("#clippy_tooltip_" + a);
+ // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
+ // b.attr("title", "copy to clipboard")
+ // },
+ // 500))
+}
+
+// Logging function that accounts for browsers that don't have window.console
+log = function(){
+ log.history = log.history || [];
+ log.history.push(arguments);
+ if(this.console){
+ console.log( Array.prototype.slice.call(arguments)[0] );
+ }
+};
+
+// Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
+if (Function.prototype.bind && console && typeof console.log == "object") {
+ [
+ "log","info","warn","error","assert","dir","clear","profile","profileEnd"
+ ].forEach(function (method) {
+ console[method] = this.bind(console[method], console);
+ }, Function.prototype.call);
+}
+
+var Docs = {
+
+ shebang: function() {
+
+ // If shebang has an operation nickname in it..
+ // e.g. /docs/#!/words/get_search
+ var fragments = $.param.fragment().split('/');
+ fragments.shift(); // get rid of the bang
+
+ switch (fragments.length) {
+ case 1:
+ // Expand all operations for the resource and scroll to it
+ var dom_id = 'resource_' + fragments[0];
+
+ Docs.expandEndpointListForResource(fragments[0]);
+ $("#"+dom_id).slideto({highlight: false});
+ break;
+ case 2:
+ // Refer to the endpoint DOM element, e.g. #words_get_search
+
+ // Expand Resource
+ Docs.expandEndpointListForResource(fragments[0]);
+ $("#"+dom_id).slideto({highlight: false});
+
+ // Expand operation
+ var li_dom_id = fragments.join('_');
+ var li_content_dom_id = li_dom_id + "_content";
+
+
+ Docs.expandOperation($('#'+li_content_dom_id));
+ $('#'+li_dom_id).slideto({highlight: false});
+ break;
+ }
+
+ },
+
+ toggleEndpointListForResource: function(resource) {
+ var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
+ if (elem.is(':visible')) {
+ Docs.collapseEndpointListForResource(resource);
+ } else {
+ Docs.expandEndpointListForResource(resource);
+ }
+ },
+
+ // Expand resource
+ expandEndpointListForResource: function(resource) {
+ var resource = Docs.escapeResourceName(resource);
+ if (resource == '') {
+ $('.resource ul.endpoints').slideDown();
+ return;
+ }
+
+ $('li#resource_' + resource).addClass('active');
+
+ var elem = $('li#resource_' + resource + ' ul.endpoints');
+ elem.slideDown();
+ },
+
+ // Collapse resource and mark as explicitly closed
+ collapseEndpointListForResource: function(resource) {
+ var resource = Docs.escapeResourceName(resource);
+ if (resource == '') {
+ $('.resource ul.endpoints').slideUp();
+ return;
+ }
+
+ $('li#resource_' + resource).removeClass('active');
+
+ var elem = $('li#resource_' + resource + ' ul.endpoints');
+ elem.slideUp();
+ },
+
+ expandOperationsForResource: function(resource) {
+ // Make sure the resource container is open..
+ Docs.expandEndpointListForResource(resource);
+
+ if (resource == '') {
+ $('.resource ul.endpoints li.operation div.content').slideDown();
+ return;
+ }
+
+ $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
+ Docs.expandOperation($(this));
+ });
+ },
+
+ collapseOperationsForResource: function(resource) {
+ // Make sure the resource container is open..
+ Docs.expandEndpointListForResource(resource);
+
+ if (resource == '') {
+ $('.resource ul.endpoints li.operation div.content').slideUp();
+ return;
+ }
+
+ $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
+ Docs.collapseOperation($(this));
+ });
+ },
+
+ escapeResourceName: function(resource) {
+ return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
+ },
+
+ expandOperation: function(elem) {
+ elem.slideDown();
+ },
+
+ collapseOperation: function(elem) {
+ elem.slideUp();
+ }
+};
+
+this["Handlebars"] = this["Handlebars"] || {};
+this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
+this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return "<!--div class='auth_button' id='apikey_button'><img class='auth_icon' alt='apply api key' src='images/apikey.jpeg'></div-->\n<div class='auth_container' id='apikey_container'>\n <div class='key_input_container'>\n <div class='auth_label'>"
+ + escapeExpression(((helper = (helper = helpers.keyName || (depth0 != null ? depth0.keyName : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"keyName","hash":{},"data":data}) : helper)))
+ + "</div>\n <input placeholder=\"api_key\" class=\"auth_input\" id=\"input_apiKey_entry\" name=\"apiKey\" type=\"text\"/>\n <div class='auth_submit'><a class='auth_submit_button' id=\"apply_api_key\" href=\"#\">apply</a></div>\n </div>\n</div>\n\n";
+},"useData":true});
+var SwaggerUi,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ __hasProp = {}.hasOwnProperty;
+
+SwaggerUi = (function(_super) {
+ __extends(SwaggerUi, _super);
+
+ function SwaggerUi() {
+ return SwaggerUi.__super__.constructor.apply(this, arguments);
+ }
+
+ SwaggerUi.prototype.dom_id = "swagger_ui";
+
+ SwaggerUi.prototype.options = null;
+
+ SwaggerUi.prototype.api = null;
+
+ SwaggerUi.prototype.headerView = null;
+
+ SwaggerUi.prototype.mainView = null;
+
+ SwaggerUi.prototype.initialize = function(options) {
+ if (options == null) {
+ options = {};
+ }
+ if (options.dom_id != null) {
+ this.dom_id = options.dom_id;
+ delete options.dom_id;
+ }
+ if (options.supportedSubmitMethods == null) {
+ options.supportedSubmitMethods = ['get', 'put', 'post', 'delete', 'head', 'options', 'patch'];
+ }
+ if ($('#' + this.dom_id) == null) {
+ $('body').append('<div id="' + this.dom_id + '"></div>');
+ }
+ this.options = options;
+ this.options.success = (function(_this) {
+ return function() {
+ return _this.render();
+ };
+ })(this);
+ this.options.progress = (function(_this) {
+ return function(d) {
+ return _this.showMessage(d);
+ };
+ })(this);
+ this.options.failure = (function(_this) {
+ return function(d) {
+ return _this.onLoadFailure(d);
+ };
+ })(this);
+ this.headerView = new HeaderView({
+ el: $('#header')
+ });
+ return this.headerView.on('update-swagger-ui', (function(_this) {
+ return function(data) {
+ return _this.updateSwaggerUi(data);
+ };
+ })(this));
+ };
+
+ SwaggerUi.prototype.setOption = function(option, value) {
+ return this.options[option] = value;
+ };
+
+ SwaggerUi.prototype.getOption = function(option) {
+ return this.options[option];
+ };
+
+ SwaggerUi.prototype.updateSwaggerUi = function(data) {
+ this.options.url = data.url;
+ return this.load();
+ };
+
+ SwaggerUi.prototype.load = function() {
+ var url, _ref;
+ if ((_ref = this.mainView) != null) {
+ _ref.clear();
+ }
+ url = this.options.url;
+ if (url && url.indexOf("http") !== 0) {
+ url = this.buildUrl(window.location.href.toString(), url);
+ }
+ this.options.url = url;
+ this.headerView.update(url);
+ return this.api = new SwaggerClient(this.options);
+ };
+
+ SwaggerUi.prototype.collapseAll = function() {
+ return Docs.collapseEndpointListForResource('');
+ };
+
+ SwaggerUi.prototype.listAll = function() {
+ return Docs.collapseOperationsForResource('');
+ };
+
+ SwaggerUi.prototype.expandAll = function() {
+ return Docs.expandOperationsForResource('');
+ };
+
+ SwaggerUi.prototype.render = function() {
+ this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
+ this.mainView = new MainView({
+ model: this.api,
+ el: $('#' + this.dom_id),
+ swaggerOptions: this.options
+ }).render();
+ this.showMessage();
+ switch (this.options.docExpansion) {
+ case "full":
+ this.expandAll();
+ break;
+ case "list":
+ this.listAll();
+ }
+ this.renderGFM();
+ if (this.options.onComplete) {
+ this.options.onComplete(this.api, this);
+ }
+ return setTimeout((function(_this) {
+ return function() {
+ return Docs.shebang();
+ };
+ })(this), 100);
+ };
+
+ SwaggerUi.prototype.buildUrl = function(base, url) {
+ var endOfPath, parts;
+ if (url.indexOf("/") === 0) {
+ parts = base.split("/");
+ base = parts[0] + "//" + parts[2];
+ return base + url;
+ } else {
+ endOfPath = base.length;
+ if (base.indexOf("?") > -1) {
+ endOfPath = Math.min(endOfPath, base.indexOf("?"));
+ }
+ if (base.indexOf("#") > -1) {
+ endOfPath = Math.min(endOfPath, base.indexOf("#"));
+ }
+ base = base.substring(0, endOfPath);
+ if (base.indexOf("/", base.length - 1) !== -1) {
+ return base + url;
+ }
+ return base + "/" + url;
+ }
+ };
+
+ SwaggerUi.prototype.showMessage = function(data) {
+ if (data == null) {
+ data = '';
+ }
+ $('#message-bar').removeClass('message-fail');
+ $('#message-bar').addClass('message-success');
+ return $('#message-bar').html(data);
+ };
+
+ SwaggerUi.prototype.onLoadFailure = function(data) {
+ var val;
+ if (data == null) {
+ data = '';
+ }
+ $('#message-bar').removeClass('message-success');
+ $('#message-bar').addClass('message-fail');
+ val = $('#message-bar').html(data);
+ if (this.options.onFailure != null) {
+ this.options.onFailure(data);
+ }
+ return val;
+ };
+
+ SwaggerUi.prototype.renderGFM = function(data) {
+ if (data == null) {
+ data = '';
+ }
+ return $('.markdown').each(function(index) {
+ return $(this).html(marked($(this).html()));
+ });
+ };
+
+ return SwaggerUi;
+
+})(Backbone.Router);
+
+window.SwaggerUi = SwaggerUi;
+
+this["Handlebars"]["templates"]["basic_auth_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ return "<div class='auth_button' id='basic_auth_button'><img class='auth_icon' src='images/password.jpeg'></div>\n<div class='auth_container' id='basic_auth_container'>\n <div class='key_input_container'>\n <div class=\"auth_label\">Username</div>\n <input placeholder=\"username\" class=\"auth_input\" id=\"input_username\" name=\"username\" type=\"text\"/>\n <div class=\"auth_label\">Password</div>\n <input placeholder=\"password\" class=\"auth_input\" id=\"input_password\" name=\"password\" type=\"password\"/>\n <div class='auth_submit'><a class='auth_submit_button' id=\"apply_basic_auth\" href=\"#\">apply</a></div>\n </div>\n</div>\n\n";
+ },"useData":true});
+Handlebars.registerHelper('sanitize', function(html) {
+ html = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
+ return new Handlebars.SafeString(html);
+});
+
+this["Handlebars"]["templates"]["content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "";
+ stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"2":function(depth0,helpers,partials,data) {
+ var stack1, lambda=this.lambda, buffer = " <option value=\"";
+ stack1 = lambda(depth0, depth0);
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "\">";
+ stack1 = lambda(depth0, depth0);
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "</option>\n";
+},"4":function(depth0,helpers,partials,data) {
+ return " <option value=\"application/json\">application/json</option>\n";
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "</select>\n";
+},"useData":true});
+var ApiKeyButton,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ __hasProp = {}.hasOwnProperty;
+
+ApiKeyButton = (function(_super) {
+ __extends(ApiKeyButton, _super);
+
+ function ApiKeyButton() {
+ return ApiKeyButton.__super__.constructor.apply(this, arguments);
+ }
+
+ ApiKeyButton.prototype.initialize = function() {};
+
+ ApiKeyButton.prototype.render = function() {
+ var template;
+ template = this.template();
+ $(this.el).html(template(this.model));
+ return this;
+ };
+
+ ApiKeyButton.prototype.events = {
+ "click #apikey_button": "toggleApiKeyContainer",
+ "click #apply_api_key": "applyApiKey"
+ };
+
+ ApiKeyButton.prototype.applyApiKey = function() {
+ var elem;
+ window.authorizations.add(this.model.name, new ApiKeyAuthorization(this.model.name, $("#input_apiKey_entry").val(), this.model["in"]));
+ window.swaggerUi.load();
+ return elem = $('#apikey_container').show();
+ };
+
+ ApiKeyButton.prototype.toggleApiKeyContainer = function() {
+ var elem;
+ if ($('#apikey_container').length > 0) {
+ elem = $('#apikey_container').first();
+ if (elem.is(':visible')) {
+ return elem.hide();
+ } else {
+ $('.auth_container').hide();
+ return elem.show();
+ }
+ }
+ };
+
+ ApiKeyButton.prototype.template = function() {
+ return Handlebars.templates.apikey_button_view;
+ };
+
+ return ApiKeyButton;
+
+})(Backbone.View);
+
+this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
+ var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div class=\"info_title\">"
+ + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
+ + "</div>\n <div class=\"info_description markdown\">";
+ stack1 = lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.description : stack1), depth0);
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "</div>\n ";
+ stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "\n ";
+ stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "\n ";
+ stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), {"name":"if","hash":{},"fn":this.program(6, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "\n ";
+ stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), {"name":"if","hash":{},"fn":this.program(8, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "\n ";
+ stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "\n";
+},"2":function(depth0,helpers,partials,data) {
+ var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
+ return "<div class=\"info_tos\"><a href=\""
+ + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1), depth0))
+ + "\">Terms of service</a></div>";
+},"4":function(depth0,helpers,partials,data) {
+ var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
+ return "<div class='info_name'>Created by "
+ + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), depth0))
+ + "</div>";
+},"6":function(depth0,helpers,partials,data) {
+ var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
+ return "<div class='info_url'>See more at <a href=\""
+ + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
+ + "\">"
+ + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
+ + "</a></div>";
+},"8":function(depth0,helpers,partials,data) {
+ var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
+ return "<div class='info_email'><a href=\"mailto:"
+ + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), depth0))
+ + "?subject="
+ + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
+ + "\">Contact the developer</a></div>";
+},"10":function(depth0,helpers,partials,data) {
+ var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
+ return "<div class='info_license'><a href='"
+ + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.url : stack1), depth0))
+ + "'>"
+ + escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.license : stack1)) != null ? stack1.name : stack1), depth0))
+ + "</a></div>";
+},"12":function(depth0,helpers,partials,data) {
+ var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
+ return " , <span style=\"font-variant: small-caps\">api version</span>: "
+ + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), depth0))
+ + "\n ";
+},"14":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " <span style=\"float:right;display:none\"><a href=\""
+ + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
+ + "/debug?url="
+ + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
+ + "\"><img id=\"validator\" src=\""
+ + escapeExpression(((helper = (helper = helpers.validatorUrl || (depth0 != null ? depth0.validatorUrl : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"validatorUrl","hash":{},"data":data}) : helper)))
+ + "?url="
+ + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
+ + "\"></a>\n </span>\n";
+},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div class='info' id='api_info'>\n";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.info : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "</div>\n<div class='container' id='resources_container'>\n <ul id='resources'></ul>\n\n <div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: "
+ + escapeExpression(((helper = (helper = helpers.basePath || (depth0 != null ? depth0.basePath : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"basePath","hash":{},"data":data}) : helper)))
+ + "\n";
+ stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.version : stack1), {"name":"if","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "]\n";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.validatorUrl : depth0), {"name":"if","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + " </h4>\n </div>\n</div>\n";
+},"useData":true});
+var BasicAuthButton,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ __hasProp = {}.hasOwnProperty;
+
+BasicAuthButton = (function(_super) {
+ __extends(BasicAuthButton, _super);
+
+ function BasicAuthButton() {
+ return BasicAuthButton.__super__.constructor.apply(this, arguments);
+ }
+
+ BasicAuthButton.prototype.initialize = function() {};
+
+ BasicAuthButton.prototype.render = function() {
+ var template;
+ template = this.template();
+ $(this.el).html(template(this.model));
+ return this;
+ };
+
+ BasicAuthButton.prototype.events = {
+ "click #basic_auth_button": "togglePasswordContainer",
+ "click #apply_basic_auth": "applyPassword"
+ };
+
+ BasicAuthButton.prototype.applyPassword = function() {
+ var elem, password, username;
+ username = $(".input_username").val();
+ password = $(".input_password").val();
+ window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
+ window.swaggerUi.load();
+ return elem = $('#basic_auth_container').hide();
+ };
+
+ BasicAuthButton.prototype.togglePasswordContainer = function() {
+ var elem;
+ if ($('#basic_auth_container').length > 0) {
+ elem = $('#basic_auth_container').show();
+ if (elem.is(':visible')) {
+ return elem.slideUp();
+ } else {
+ $('.auth_container').hide();
+ return elem.show();
+ }
+ }
+ };
+
+ BasicAuthButton.prototype.template = function() {
+ return Handlebars.templates.basic_auth_button_view;
+ };
+
+ return BasicAuthButton;
+
+})(Backbone.View);
+
+this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
+ return "deprecated";
+ },"3":function(depth0,helpers,partials,data) {
+ return " <h4>Warning: Deprecated</h4>\n";
+ },"5":function(depth0,helpers,partials,data) {
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, buffer = " <h4>Implementation Notes</h4>\n <p class=\"markdown\">";
+ stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "</p>\n";
+},"7":function(depth0,helpers,partials,data) {
+ return " <div class=\"auth\">\n <span class=\"api-ic ic-error\"></span>";
+ },"9":function(depth0,helpers,partials,data) {
+ var stack1, buffer = " <div id=\"api_information_panel\" style=\"top: 526px; left: 776px; display: none;\">\n";
+ stack1 = helpers.each.call(depth0, depth0, {"name":"each","hash":{},"fn":this.program(10, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + " </div>\n";
+},"10":function(depth0,helpers,partials,data) {
+ var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div title='";
+ stack1 = lambda((depth0 != null ? depth0.description : depth0), depth0);
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "'>"
+ + escapeExpression(lambda((depth0 != null ? depth0.scope : depth0), depth0))
+ + "</div>\n";
+},"12":function(depth0,helpers,partials,data) {
+ return "</div>";
+ },"14":function(depth0,helpers,partials,data) {
+ return " <div class='access'>\n <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n </div>\n";
+ },"16":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " <h4>Response Class (Status "
+ + escapeExpression(((helper = (helper = helpers.successCode || (depth0 != null ? depth0.successCode : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"successCode","hash":{},"data":data}) : helper)))
+ + ")</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n";
+},"18":function(depth0,helpers,partials,data) {
+ return " <h4>Parameters</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th style=\"width: 100px; max-width: 100px\">Parameter</th>\n <th style=\"width: 310px; max-width: 310px\">Value</th>\n <th style=\"width: 200px; max-width: 200px\">Description</th>\n <th style=\"width: 100px; max-width: 100px\">Parameter Type</th>\n <th style=\"width: 220px; max-width: 230px\">Data Type</th>\n </tr>\n </thead>\n <tbody class=\"operation-params\">\n\n </tbody>\n </table>\n";
+ },"20":function(depth0,helpers,partials,data) {
+ return " <div style='margin:0;padding:0;display:inline'></div>\n <h4>Response Messages</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n <th>Response Model</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n";
+ },"22":function(depth0,helpers,partials,data) {
+ return "";
+},"24":function(depth0,helpers,partials,data) {
+ return " <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <span class='response_throbber' style='display:none'></span>\n </div>\n";
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "\n <ul class='operations' >\n <li class='"
+ + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
+ + " operation' id='"
+ + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
+ + "_"
+ + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
+ + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/"
+ + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
+ + "/"
+ + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
+ + "' class=\"toggleOperation\">"
+ + escapeExpression(((helper = (helper = helpers.method || (depth0 != null ? depth0.method : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"method","hash":{},"data":data}) : helper)))
+ + "</a>\n </span>\n <span class='path'>\n <a href='#!/"
+ + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
+ + "/"
+ + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
+ + "' class=\"toggleOperation ";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "\">"
+ + escapeExpression(((helper = (helper = helpers.path || (depth0 != null ? depth0.path : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"path","hash":{},"data":data}) : helper)))
+ + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/"
+ + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
+ + "/"
+ + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
+ + "' class=\"toggleOperation\">";
+ stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='"
+ + escapeExpression(((helper = (helper = helpers.parentId || (depth0 != null ? depth0.parentId : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"parentId","hash":{},"data":data}) : helper)))
+ + "_"
+ + escapeExpression(((helper = (helper = helpers.nickname || (depth0 != null ? depth0.nickname : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"nickname","hash":{},"data":data}) : helper)))
+ + "_content' style='display:none'>\n";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.deprecated : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.description : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(7, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
+ if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "\n";
+ stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.oauth : depth0), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ buffer += " ";
+ stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(12, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
+ if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "\n";
+ stack1 = ((helper = (helper = helpers.oauth || (depth0 != null ? depth0.oauth : depth0)) != null ? helper : helperMissing),(options={"name":"oauth","hash":{},"fn":this.program(14, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
+ if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
+ if (stack1 != null) { buffer += stack1; }
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.type : depth0), {"name":"if","hash":{},"fn":this.program(16, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ buffer += " <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.parameters : depth0), {"name":"if","hash":{},"fn":this.program(18, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.responseMessages : depth0), {"name":"if","hash":{},"fn":this.program(20, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isReadOnly : depth0), {"name":"if","hash":{},"fn":this.program(22, data),"inverse":this.program(24, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + " </form>\n <div class='response' style='display:none'>\n <h4>Request URL</h4>\n <div class='block request_url'></div>\n <h4>Response Body</h4>\n <div class='block response_body'></div>\n <h4>Response Code</h4>\n <div class='block response_code'></div>\n <h4>Response Headers</h4>\n <div class='block response_headers'></div>\n </div>\n </div>\n </li>\n </ul>\n";
+},"useData":true});
+var ContentTypeView,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ __hasProp = {}.hasOwnProperty;
+
+ContentTypeView = (function(_super) {
+ __extends(ContentTypeView, _super);
+
+ function ContentTypeView() {
+ return ContentTypeView.__super__.constructor.apply(this, arguments);
+ }
+
+ ContentTypeView.prototype.initialize = function() {};
+
+ ContentTypeView.prototype.render = function() {
+ var template;
+ template = this.template();
+ $(this.el).html(template(this.model));
+ $('label[for=contentType]', $(this.el)).text('Response Content Type');
+ return this;
+ };
+
+ ContentTypeView.prototype.template = function() {
+ return Handlebars.templates.content_type;
+ };
+
+ return ContentTypeView;
+
+})(Backbone.View);
+
+this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"2":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " <input type=\"file\" name='"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "'/>\n <div class=\"parameter-content-type\" />\n";
+},"4":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"5":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " <textarea class='body-textarea' name='"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "'>"
+ + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
+ + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
+},"7":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " <textarea class='body-textarea' name='"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
+},"9":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(10, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"10":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(11, data),"inverse":this.program(13, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"11":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " <input class='parameter' minlength='0' name='"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "' placeholder='' type='text' value='"
+ + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
+ + "'/>\n";
+},"13":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " <input class='parameter' minlength='0' name='"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "' placeholder='' type='text' value=''/>\n";
+},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "</td>\n<td>\n\n";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "\n</td>\n<td class=\"markdown\">";
+ stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "</td>\n<td>";
+ stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
+},"useData":true});
+var HeaderView,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ __hasProp = {}.hasOwnProperty;
+
+HeaderView = (function(_super) {
+ __extends(HeaderView, _super);
+
+ function HeaderView() {
+ return HeaderView.__super__.constructor.apply(this, arguments);
+ }
+
+ HeaderView.prototype.events = {
+ 'click #show-pet-store-icon': 'showPetStore',
+ 'click #show-wordnik-dev-icon': 'showWordnikDev',
+ 'click #explore': 'showCustom',
+ 'keyup #input_baseUrl': 'showCustomOnKeyup',
+ 'keyup #input_apiKey': 'showCustomOnKeyup'
+ };
+
+ HeaderView.prototype.initialize = function() {};
+
+ HeaderView.prototype.showPetStore = function(e) {
+ return this.trigger('update-swagger-ui', {
+ url: "http://petstore.swagger.wordnik.com/api/api-docs"
+ });
+ };
+
+ HeaderView.prototype.showWordnikDev = function(e) {
+ return this.trigger('update-swagger-ui', {
+ url: "http://api.wordnik.com/v4/resources.json"
+ });
+ };
+
+ HeaderView.prototype.showCustomOnKeyup = function(e) {
+ if (e.keyCode === 13) {
+ return this.showCustom();
+ }
+ };
+
+ HeaderView.prototype.showCustom = function(e) {
+ if (e != null) {
+ e.preventDefault();
+ }
+ return this.trigger('update-swagger-ui', {
+ url: $('#input_baseUrl').val(),
+ apiKey: $('#input_apiKey').val()
+ });
+ };
+
+ HeaderView.prototype.update = function(url, apiKey, trigger) {
+ if (trigger == null) {
+ trigger = false;
+ }
+ $('#input_baseUrl').val(url);
+ if (trigger) {
+ return this.trigger('update-swagger-ui', {
+ url: url
+ });
+ }
+ };
+
+ return HeaderView;
+
+})(Backbone.View);
+
+this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
+ return " multiple='multiple'";
+ },"3":function(depth0,helpers,partials,data) {
+ return "";
+},"5":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(6, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"6":function(depth0,helpers,partials,data) {
+ var stack1, helperMissing=helpers.helperMissing, buffer = "";
+ stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(3, data),"inverse":this.program(7, data),"data":data}));
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"7":function(depth0,helpers,partials,data) {
+ return " <option selected=\"\" value=''></option>\n";
+ },"9":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"10":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " <option selected=\"\" value='"
+ + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
+ + "'>"
+ + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
+ + " (default)</option>\n";
+},"12":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " <option value='"
+ + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
+ + "'>"
+ + escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
+ + "</option>\n";
+},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "</td>\n<td>\n <select ";
+ stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}));
+ if (stack1 != null) { buffer += stack1; }
+ buffer += " class='parameter' name='"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "'>\n";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(5, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ stack1 = helpers.each.call(depth0, ((stack1 = (depth0 != null ? depth0.allowableValues : depth0)) != null ? stack1.descriptiveValues : stack1), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ buffer += " </select>\n</td>\n<td class=\"markdown\">";
+ stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "</td>\n<td>";
+ stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>";
+},"useData":true});
+var MainView,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ __hasProp = {}.hasOwnProperty;
+
+MainView = (function(_super) {
+ var sorters;
+
+ __extends(MainView, _super);
+
+ function MainView() {
+ return MainView.__super__.constructor.apply(this, arguments);
+ }
+
+ sorters = {
+ 'alpha': function(a, b) {
+ return a.path.localeCompare(b.path);
+ },
+ 'method': function(a, b) {
+ return a.method.localeCompare(b.method);
+ }
+ };
+
+ MainView.prototype.initialize = function(opts) {
+ var auth, key, value, _ref;
+ if (opts == null) {
+ opts = {};
+ }
+ this.model.auths = [];
+ _ref = this.model.securityDefinitions;
+ for (key in _ref) {
+ value = _ref[key];
+ auth = {
+ name: key,
+ type: value.type,
+ value: value
+ };
+ this.model.auths.push(auth);
+ }
+ if (this.model.swaggerVersion === "2.0") {
+ if ("validatorUrl" in opts.swaggerOptions) {
+ return this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
+ } else if (this.model.url.indexOf("localhost") > 0) {
+ return this.model.validatorUrl = null;
+ } else {
+ return this.model.validatorUrl = "http://online.swagger.io/validator";
+ }
+ }
+ };
+
+ MainView.prototype.render = function() {
+ var auth, button, counter, id, name, resource, resources, _i, _len, _ref;
+ if (this.model.securityDefinitions) {
+ for (name in this.model.securityDefinitions) {
+ auth = this.model.securityDefinitions[name];
+ if (auth.type === "apiKey" && $("#apikey_button").length === 0) {
+ button = new ApiKeyButton({
+ model: auth
+ }).render().el;
+ $('.auth_main_container').append(button);
+ }
+ if (auth.type === "basicAuth" && $("#basic_auth_button").length === 0) {
+ button = new BasicAuthButton({
+ model: auth
+ }).render().el;
+ $('.auth_main_container').append(button);
+ }
+ }
+ }
+ $(this.el).html(Handlebars.templates.main(this.model));
+ resources = {};
+ counter = 0;
+ _ref = this.model.apisArray;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ resource = _ref[_i];
+ id = resource.name;
+ while (typeof resources[id] !== 'undefined') {
+ id = id + "_" + counter;
+ counter += 1;
+ }
+ resource.id = id;
+ resources[id] = resource;
+ this.addResource(resource, this.model.auths);
+ }
+ $('.propWrap').hover(function() {
+ return $('.optionsWrapper', $(this)).show();
+ }, function() {
+ return $('.optionsWrapper', $(this)).hide();
+ });
+ return this;
+ };
+
+ MainView.prototype.addResource = function(resource, auths) {
+ var resourceView;
+ resource.id = resource.id.replace(/\s/g, '_');
+ resourceView = new ResourceView({
+ model: resource,
+ tagName: 'li',
+ id: 'resource_' + resource.id,
+ className: 'resource',
+ auths: auths,
+ swaggerOptions: this.options.swaggerOptions
+ });
+ return $('#resources').append(resourceView.render().el);
+ };
+
+ MainView.prototype.clear = function() {
+ return $(this.el).html('');
+ };
+
+ return MainView;
+
+})(Backbone.View);
+
+this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " <textarea class='body-textarea' readonly='readonly' name='"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "'>"
+ + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
+ + "</textarea>\n";
+},"3":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"4":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " "
+ + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
+ + "\n";
+},"6":function(depth0,helpers,partials,data) {
+ return " (empty)\n";
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "</td>\n<td>\n";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "</td>\n<td class=\"markdown\">";
+ stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "</td>\n<td>";
+ stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
+},"useData":true});
+this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "'>"
+ + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
+ + "</textarea>\n";
+},"3":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"4":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " "
+ + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
+ + "\n";
+},"6":function(depth0,helpers,partials,data) {
+ return " (empty)\n";
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "</td>\n<td>\n";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "</td>\n<td class=\"markdown\">";
+ stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "</td>\n<td>";
+ stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
+},"useData":true});
+var OperationView,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ __hasProp = {}.hasOwnProperty;
+
+OperationView = (function(_super) {
+ __extends(OperationView, _super);
+
+ function OperationView() {
+ return OperationView.__super__.constructor.apply(this, arguments);
+ }
+
+ OperationView.prototype.invocationUrl = null;
+
+ OperationView.prototype.events = {
+ 'submit .sandbox': 'submitOperation',
+ 'click .submit': 'submitOperation',
+ 'click .response_hider': 'hideResponse',
+ 'click .toggleOperation': 'toggleOperationContent',
+ 'mouseenter .api-ic': 'mouseEnter',
+ 'mouseout .api-ic': 'mouseExit'
+ };
+
+ OperationView.prototype.initialize = function(opts) {
+ if (opts == null) {
+ opts = {};
+ }
+ this.auths = opts.auths;
+ this.parentId = this.model.parentId;
+ this.nickname = this.model.nickname;
+ return this;
+ };
+
+ OperationView.prototype.mouseEnter = function(e) {
+ var elem, hgh, pos, scMaxX, scMaxY, scX, scY, wd, x, y;
+ elem = $(this.el).find('.content');
+ x = e.pageX;
+ y = e.pageY;
+ scX = $(window).scrollLeft();
+ scY = $(window).scrollTop();
+ scMaxX = scX + $(window).width();
+ scMaxY = scY + $(window).height();
+ wd = elem.width();
+ hgh = elem.height();
+ if (x + wd > scMaxX) {
+ x = scMaxX - wd;
+ }
+ if (x < scX) {
+ x = scX;
+ }
+ if (y + hgh > scMaxY) {
+ y = scMaxY - hgh;
+ }
+ if (y < scY) {
+ y = scY;
+ }
+ pos = {};
+ pos.top = y;
+ pos.left = x;
+ elem.css(pos);
+ return $(e.currentTarget.parentNode).find('#api_information_panel').show();
+ };
+
+ OperationView.prototype.mouseExit = function(e) {
+ return $(e.currentTarget.parentNode).find('#api_information_panel').hide();
+ };
+
+ OperationView.prototype.render = function() {
+ var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, modelAuths, o, param, ref, responseContentTypeView, responseSignatureView, schema, schemaObj, scopeIndex, signatureModel, statusCode, successResponse, type, v, value, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2, _ref3, _ref4;
+ isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
+ if (!isMethodSubmissionSupported) {
+ this.model.isReadOnly = true;
+ }
+ this.model.description = this.model.description || this.model.notes;
+ if (this.model.description) {
+ this.model.description = this.model.description.replace(/(?:\r\n|\r|\n)/g, '<br />');
+ }
+ this.model.oauth = null;
+ modelAuths = this.model.authorizations || this.model.security;
+ if (modelAuths) {
+ if (Array.isArray(modelAuths)) {
+ for (_i = 0, _len = modelAuths.length; _i < _len; _i++) {
+ auths = modelAuths[_i];
+ for (key in auths) {
+ auth = auths[key];
+ for (a in this.auths) {
+ auth = this.auths[a];
+ if (auth.type === 'oauth2') {
+ this.model.oauth = {};
+ this.model.oauth.scopes = [];
+ _ref = auth.value.scopes;
+ for (k in _ref) {
+ v = _ref[k];
+ scopeIndex = auths[key].indexOf(k);
+ if (scopeIndex >= 0) {
+ o = {
+ scope: k,
+ description: v
+ };
+ this.model.oauth.scopes.push(o);
+ }
+ }
+ }
+ }
+ }
+ }
+ } else {
+ for (k in modelAuths) {
+ v = modelAuths[k];
+ if (k === "oauth2") {
+ if (this.model.oauth === null) {
+ this.model.oauth = {};
+ }
+ if (this.model.oauth.scopes === void 0) {
+ this.model.oauth.scopes = [];
+ }
+ for (_j = 0, _len1 = v.length; _j < _len1; _j++) {
+ o = v[_j];
+ this.model.oauth.scopes.push(o);
+ }
+ }
+ }
+ }
+ }
+ if (typeof this.model.responses !== 'undefined') {
+ this.model.responseMessages = [];
+ _ref1 = this.model.responses;
+ for (code in _ref1) {
+ value = _ref1[code];
+ schema = null;
+ schemaObj = this.model.responses[code].schema;
+ if (schemaObj && schemaObj['$ref']) {
+ schema = schemaObj['$ref'];
+ if (schema.indexOf('#/definitions/') === 0) {
+ schema = schema.substring('#/definitions/'.length);
+ }
+ }
+ this.model.responseMessages.push({
+ code: code,
+ message: value.description,
+ responseModel: schema
+ });
+ }
+ }
+ if (typeof this.model.responseMessages === 'undefined') {
+ this.model.responseMessages = [];
+ }
+ signatureModel = null;
+ if (this.model.successResponse) {
+ successResponse = this.model.successResponse;
+ for (key in successResponse) {
+ value = successResponse[key];
+ this.model.successCode = key;
+ if (typeof value === 'object' && typeof value.createJSONSample === 'function') {
+ signatureModel = {
+ sampleJSON: JSON.stringify(value.createJSONSample(), void 0, 2),
+ isParam: false,
+ signature: value.getMockSignature()
+ };
+ }
+ }
+ } else if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
+ signatureModel = {
+ sampleJSON: this.model.responseSampleJSON,
+ isParam: false,
+ signature: this.model.responseClassSignature
+ };
+ }
+ $(this.el).html(Handlebars.templates.operation(this.model));
+ if (signatureModel) {
+ responseSignatureView = new SignatureView({
+ model: signatureModel,
+ tagName: 'div'
+ });
+ $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
+ } else {
+ this.model.responseClassSignature = 'string';
+ $('.model-signature', $(this.el)).html(this.model.type);
+ }
+ contentTypeModel = {
+ isParam: false
+ };
+ contentTypeModel.consumes = this.model.consumes;
+ contentTypeModel.produces = this.model.produces;
+ _ref2 = this.model.parameters;
+ for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
+ param = _ref2[_k];
+ type = param.type || param.dataType || '';
+ if (typeof type === 'undefined') {
+ schema = param.schema;
+ if (schema && schema['$ref']) {
+ ref = schema['$ref'];
+ if (ref.indexOf('#/definitions/') === 0) {
+ type = ref.substring('#/definitions/'.length);
+ } else {
+ type = ref;
+ }
+ }
+ }
+ if (type && type.toLowerCase() === 'file') {
+ if (!contentTypeModel.consumes) {
+ contentTypeModel.consumes = 'multipart/form-data';
+ }
+ }
+ param.type = type;
+ }
+ responseContentTypeView = new ResponseContentTypeView({
+ model: contentTypeModel
+ });
+ $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
+ _ref3 = this.model.parameters;
+ for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
+ param = _ref3[_l];
+ this.addParameter(param, contentTypeModel.consumes);
+ }
+ _ref4 = this.model.responseMessages;
+ for (_m = 0, _len4 = _ref4.length; _m < _len4; _m++) {
+ statusCode = _ref4[_m];
+ this.addStatusCode(statusCode);
+ }
+ return this;
+ };
+
+ OperationView.prototype.addParameter = function(param, consumes) {
+ var paramView;
+ param.consumes = consumes;
+ paramView = new ParameterView({
+ model: param,
+ tagName: 'tr',
+ readOnly: this.model.isReadOnly
+ });
+ return $('.operation-params', $(this.el)).append(paramView.render().el);
+ };
+
+ OperationView.prototype.addStatusCode = function(statusCode) {
+ var statusCodeView;
+ statusCodeView = new StatusCodeView({
+ model: statusCode,
+ tagName: 'tr'
+ });
+ return $('.operation-status', $(this.el)).append(statusCodeView.render().el);
+ };
+
+ OperationView.prototype.submitOperation = function(e) {
+ var error_free, form, isFileUpload, map, o, opts, val, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2;
+ if (e != null) {
+ e.preventDefault();
+ }
+ form = $('.sandbox', $(this.el));
+ error_free = true;
+ form.find("input.required").each(function() {
+ $(this).removeClass("error");
+ if (jQuery.trim($(this).val()) === "") {
+ $(this).addClass("error");
+ $(this).wiggle({
+ callback: (function(_this) {
+ return function() {
+ return $(_this).focus();
+ };
+ })(this)
+ });
+ return error_free = false;
+ }
+ });
+ form.find("textarea.required").each(function() {
+ $(this).removeClass("error");
+ if (jQuery.trim($(this).val()) === "") {
+ $(this).addClass("error");
+ $(this).wiggle({
+ callback: (function(_this) {
+ return function() {
+ return $(_this).focus();
+ };
+ })(this)
+ });
+ return error_free = false;
+ }
+ });
+ if (error_free) {
+ map = {};
+ opts = {
+ parent: this
+ };
+ isFileUpload = false;
+ _ref = form.find("input");
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ o = _ref[_i];
+ if ((o.value != null) && jQuery.trim(o.value).length > 0) {
+ map[o.name] = o.value;
+ }
+ if (o.type === "file") {
+ map[o.name] = o.files[0];
+ isFileUpload = true;
+ }
+ }
+ _ref1 = form.find("textarea");
+ for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
+ o = _ref1[_j];
+ if ((o.value != null) && jQuery.trim(o.value).length > 0) {
+ map[o.name] = o.value;
+ }
+ }
+ _ref2 = form.find("select");
+ for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
+ o = _ref2[_k];
+ val = this.getSelectedValue(o);
+ if ((val != null) && jQuery.trim(val).length > 0) {
+ map[o.name] = val;
+ }
+ }
+ opts.responseContentType = $("div select[name=responseContentType]", $(this.el)).val();
+ opts.requestContentType = $("div select[name=parameterContentType]", $(this.el)).val();
+ $(".response_throbber", $(this.el)).show();
+ if (isFileUpload) {
+ return this.handleFileUpload(map, form);
+ } else {
+ return this.model["do"](map, opts, this.showCompleteStatus, this.showErrorStatus, this);
+ }
+ }
+ };
+
+ OperationView.prototype.success = function(response, parent) {
+ return parent.showCompleteStatus(response);
+ };
+
+ OperationView.prototype.handleFileUpload = function(map, form) {
+ var bodyParam, el, headerParams, o, obj, param, params, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3;
+ _ref = form.serializeArray();
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ o = _ref[_i];
+ if ((o.value != null) && jQuery.trim(o.value).length > 0) {
+ map[o.name] = o.value;
+ }
+ }
+ bodyParam = new FormData();
+ params = 0;
+ _ref1 = this.model.parameters;
+ for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
+ param = _ref1[_j];
+ if (param.paramType === 'form' || param["in"] === 'formData') {
+ if (param.type.toLowerCase() !== 'file' && map[param.name] !== void 0) {
+ bodyParam.append(param.name, map[param.name]);
+ }
+ }
+ }
+ headerParams = {};
+ _ref2 = this.model.parameters;
+ for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
+ param = _ref2[_k];
+ if (param.paramType === 'header') {
+ headerParams[param.name] = map[param.name];
+ }
+ }
+ _ref3 = form.find('input[type~="file"]');
+ for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
+ el = _ref3[_l];
+ if (typeof el.files[0] !== 'undefined') {
+ bodyParam.append($(el).attr('name'), el.files[0]);
+ params += 1;
+ }
+ }
+ this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), delete headerParams['Content-Type'], this.model.urlify(map, false)) : this.model.urlify(map, true);
+ $(".request_url", $(this.el)).html("<pre></pre>");
+ $(".request_url pre", $(this.el)).text(this.invocationUrl);
+ obj = {
+ type: this.model.method,
+ url: this.invocationUrl,
+ headers: headerParams,
+ data: bodyParam,
+ dataType: 'json',
+ contentType: false,
+ processData: false,
+ error: (function(_this) {
+ return function(data, textStatus, error) {
+ return _this.showErrorStatus(_this.wrap(data), _this);
+ };
+ })(this),
+ success: (function(_this) {
+ return function(data) {
+ return _this.showResponse(data, _this);
+ };
+ })(this),
+ complete: (function(_this) {
+ return function(data) {
+ return _this.showCompleteStatus(_this.wrap(data), _this);
+ };
+ })(this)
+ };
+ if (window.authorizations) {
+ window.authorizations.apply(obj);
+ }
+ if (params === 0) {
+ obj.data.append("fake", "true");
+ }
+ jQuery.ajax(obj);
+ return false;
+ };
+
+ OperationView.prototype.wrap = function(data) {
+ var h, headerArray, headers, i, o, _i, _len;
+ headers = {};
+ headerArray = data.getAllResponseHeaders().split("\r");
+ for (_i = 0, _len = headerArray.length; _i < _len; _i++) {
+ i = headerArray[_i];
+ h = i.match(/^([^:]*?):(.*)$/);
+ if (!h) {
+ h = [];
+ }
+ h.shift();
+ if (h[0] !== void 0 && h[1] !== void 0) {
+ headers[h[0].trim()] = h[1].trim();
+ }
+ }
+ o = {};
+ o.content = {};
+ o.content.data = data.responseText;
+ o.headers = headers;
+ o.request = {};
+ o.request.url = this.invocationUrl;
+ o.status = data.status;
+ return o;
+ };
+
+ OperationView.prototype.getSelectedValue = function(select) {
+ var opt, options, _i, _len, _ref;
+ if (!select.multiple) {
+ return select.value;
+ } else {
+ options = [];
+ _ref = select.options;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ opt = _ref[_i];
+ if (opt.selected) {
+ options.push(opt.value);
+ }
+ }
+ if (options.length > 0) {
+ return options;
+ } else {
+ return null;
+ }
+ }
+ };
+
+ OperationView.prototype.hideResponse = function(e) {
+ if (e != null) {
+ e.preventDefault();
+ }
+ $(".response", $(this.el)).slideUp();
+ return $(".response_hider", $(this.el)).fadeOut();
+ };
+
+ OperationView.prototype.showResponse = function(response) {
+ var prettyJson;
+ prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "<br>");
+ return $(".response_body", $(this.el)).html(escape(prettyJson));
+ };
+
+ OperationView.prototype.showErrorStatus = function(data, parent) {
+ return parent.showStatus(data);
+ };
+
+ OperationView.prototype.showCompleteStatus = function(data, parent) {
+ return parent.showStatus(data);
+ };
+
+ OperationView.prototype.formatXml = function(xml) {
+ var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
+ reg = /(>)(<)(\/*)/g;
+ wsexp = /[ ]*(.*)[ ]+\n/g;
+ contexp = /(<.+>)(.+\n)/g;
+ xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
+ pad = 0;
+ formatted = '';
+ lines = xml.split('\n');
+ indent = 0;
+ lastType = 'other';
+ transitions = {
+ 'single->single': 0,
+ 'single->closing': -1,
+ 'single->opening': 0,
+ 'single->other': 0,
+ 'closing->single': 0,
+ 'closing->closing': -1,
+ 'closing->opening': 0,
+ 'closing->other': 0,
+ 'opening->single': 1,
+ 'opening->closing': 0,
+ 'opening->opening': 1,
+ 'opening->other': 1,
+ 'other->single': 0,
+ 'other->closing': -1,
+ 'other->opening': 0,
+ 'other->other': 0
+ };
+ _fn = function(ln) {
+ var fromTo, j, key, padding, type, types, value;
+ types = {
+ single: Boolean(ln.match(/<.+\/>/)),
+ closing: Boolean(ln.match(/<\/.+>/)),
+ opening: Boolean(ln.match(/<[^!?].*>/))
+ };
+ type = ((function() {
+ var _results;
+ _results = [];
+ for (key in types) {
+ value = types[key];
+ if (value) {
+ _results.push(key);
+ }
+ }
+ return _results;
+ })())[0];
+ type = type === void 0 ? 'other' : type;
+ fromTo = lastType + '->' + type;
+ lastType = type;
+ padding = '';
+ indent += transitions[fromTo];
+ padding = ((function() {
+ var _j, _ref, _results;
+ _results = [];
+ for (j = _j = 0, _ref = indent; 0 <= _ref ? _j < _ref : _j > _ref; j = 0 <= _ref ? ++_j : --_j) {
+ _results.push(' ');
+ }
+ return _results;
+ })()).join('');
+ if (fromTo === 'opening->closing') {
+ return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
+ } else {
+ return formatted += padding + ln + '\n';
+ }
+ };
+ for (_i = 0, _len = lines.length; _i < _len; _i++) {
+ ln = lines[_i];
+ _fn(ln);
+ }
+ return formatted;
+ };
+
+ OperationView.prototype.showStatus = function(response) {
+ var code, content, contentType, e, headers, json, opts, pre, response_body, response_body_el, url;
+ if (response.content === void 0) {
+ content = response.data;
+ url = response.url;
+ } else {
+ content = response.content.data;
+ url = response.request.url;
+ }
+ headers = response.headers;
+ contentType = null;
+ if (headers) {
+ contentType = headers["Content-Type"] || headers["content-type"];
+ if (contentType) {
+ contentType = contentType.split(";")[0].trim();
+ }
+ }
+ $(".response_body", $(this.el)).removeClass('json');
+ $(".response_body", $(this.el)).removeClass('xml');
+ if (!content) {
+ code = $('<code />').text("no content");
+ pre = $('<pre class="json" />').append(code);
+ } else if (contentType === "application/json" || /\+json$/.test(contentType)) {
+ json = null;
+ try {
+ json = JSON.stringify(JSON.parse(content), null, " ");
+ } catch (_error) {
+ e = _error;
+ json = "can't parse JSON. Raw result:\n\n" + content;
+ }
+ code = $('<code />').text(json);
+ pre = $('<pre class="json" />').append(code);
+ } else if (contentType === "application/xml" || /\+xml$/.test(contentType)) {
+ code = $('<code />').text(this.formatXml(content));
+ pre = $('<pre class="xml" />').append(code);
+ } else if (contentType === "text/html") {
+ code = $('<code />').html(_.escape(content));
+ pre = $('<pre class="xml" />').append(code);
+ } else if (/^image\//.test(contentType)) {
+ pre = $('<img>').attr('src', url);
+ } else {
+ code = $('<code />').text(content);
+ pre = $('<pre class="json" />').append(code);
+ }
+ response_body = pre;
+ $(".request_url", $(this.el)).html("<pre></pre>");
+ $(".request_url pre", $(this.el)).text(url);
+ $(".response_code", $(this.el)).html("<pre>" + response.status + "</pre>");
+ $(".response_body", $(this.el)).html(response_body);
+ $(".response_headers", $(this.el)).html("<pre>" + _.escape(JSON.stringify(response.headers, null, " ")).replace(/\n/g, "<br>") + "</pre>");
+ $(".response", $(this.el)).slideDown();
+ $(".response_hider", $(this.el)).show();
+ $(".response_throbber", $(this.el)).hide();
+ response_body_el = $('.response_body', $(this.el))[0];
+ opts = this.options.swaggerOptions;
+ if (opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold) {
+ return response_body_el;
+ } else {
+ return hljs.highlightBlock(response_body_el);
+ }
+ };
+
+ OperationView.prototype.toggleOperationContent = function() {
+ var elem;
+ elem = $('#' + Docs.escapeResourceName(this.parentId + "_" + this.nickname + "_content"));
+ if (elem.is(':visible')) {
+ return Docs.collapseOperation(elem);
+ } else {
+ return Docs.expandOperation(elem);
+ }
+ };
+
+ return OperationView;
+
+})(Backbone.View);
+
+var ParameterContentTypeView,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ __hasProp = {}.hasOwnProperty;
+
+ParameterContentTypeView = (function(_super) {
+ __extends(ParameterContentTypeView, _super);
+
+ function ParameterContentTypeView() {
+ return ParameterContentTypeView.__super__.constructor.apply(this, arguments);
+ }
+
+ ParameterContentTypeView.prototype.initialize = function() {};
+
+ ParameterContentTypeView.prototype.render = function() {
+ var template;
+ template = this.template();
+ $(this.el).html(template(this.model));
+ $('label[for=parameterContentType]', $(this.el)).text('Parameter content type:');
+ return this;
+ };
+
+ ParameterContentTypeView.prototype.template = function() {
+ return Handlebars.templates.parameter_content_type;
+ };
+
+ return ParameterContentTypeView;
+
+})(Backbone.View);
+
+this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"2":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " <input type=\"file\" name='"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "'/>\n";
+},"4":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"5":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " <textarea class='body-textarea required' placeholder='(required)' name='"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "'>"
+ + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
+ + "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
+},"7":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " <textarea class='body-textarea required' placeholder='(required)' name='"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
+},"9":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"10":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " <input class='parameter' class='required' type='file' name='"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "'/>\n";
+},"12":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(13, data),"inverse":this.program(15, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"13":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " <input class='parameter required' minlength='1' name='"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "' placeholder='(required)' type='text' value='"
+ + escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
+ + "'/>\n";
+},"15":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return " <input class='parameter required' minlength='1' name='"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "' placeholder='(required)' type='text' value=''/>\n";
+},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "</td>\n<td>\n";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "</td>\n<td>\n <strong><span class=\"markdown\">";
+ stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "</span></strong>\n</td>\n<td>";
+ stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
+},"useData":true});
+this["Handlebars"]["templates"]["parameter_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "";
+ stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"2":function(depth0,helpers,partials,data) {
+ var stack1, lambda=this.lambda, buffer = " <option value=\"";
+ stack1 = lambda(depth0, depth0);
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "\">";
+ stack1 = lambda(depth0, depth0);
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "</option>\n";
+},"4":function(depth0,helpers,partials,data) {
+ return " <option value=\"application/json\">application/json</option>\n";
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "<label for=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "</select>\n";
+},"useData":true});
+var ParameterView,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ __hasProp = {}.hasOwnProperty;
+
+ParameterView = (function(_super) {
+ __extends(ParameterView, _super);
+
+ function ParameterView() {
+ return ParameterView.__super__.constructor.apply(this, arguments);
+ }
+
+ ParameterView.prototype.initialize = function() {
+ return Handlebars.registerHelper('isArray', function(param, opts) {
+ if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
+ return opts.fn(this);
+ } else {
+ return opts.inverse(this);
+ }
+ });
+ };
+
+ ParameterView.prototype.render = function() {
+ var contentTypeModel, isParam, parameterContentTypeView, ref, responseContentTypeView, schema, signatureModel, signatureView, template, type;
+ type = this.model.type || this.model.dataType;
+ if (typeof type === 'undefined') {
+ schema = this.model.schema;
+ if (schema && schema['$ref']) {
+ ref = schema['$ref'];
+ if (ref.indexOf('#/definitions/') === 0) {
+ type = ref.substring('#/definitions/'.length);
+ } else {
+ type = ref;
+ }
+ }
+ }
+ this.model.type = type;
+ this.model.paramType = this.model["in"] || this.model.paramType;
+ if (this.model.paramType === 'body' || this.model["in"] === 'body') {
+ this.model.isBody = true;
+ }
+ if (type && type.toLowerCase() === 'file') {
+ this.model.isFile = true;
+ }
+ this.model["default"] = this.model["default"] || this.model.defaultValue;
+ if (this.model.allowableValues) {
+ this.model.isList = true;
+ }
+ template = this.template();
+ $(this.el).html(template(this.model));
+ signatureModel = {
+ sampleJSON: this.model.sampleJSON,
+ isParam: true,
+ signature: this.model.signature
+ };
+ if (this.model.sampleJSON) {
+ signatureView = new SignatureView({
+ model: signatureModel,
+ tagName: 'div'
+ });
+ $('.model-signature', $(this.el)).append(signatureView.render().el);
+ } else {
+ $('.model-signature', $(this.el)).html(this.model.signature);
+ }
+ isParam = false;
+ if (this.model.isBody) {
+ isParam = true;
+ }
+ contentTypeModel = {
+ isParam: isParam
+ };
+ contentTypeModel.consumes = this.model.consumes;
+ if (isParam) {
+ parameterContentTypeView = new ParameterContentTypeView({
+ model: contentTypeModel
+ });
+ $('.parameter-content-type', $(this.el)).append(parameterContentTypeView.render().el);
+ } else {
+ responseContentTypeView = new ResponseContentTypeView({
+ model: contentTypeModel
+ });
+ $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
+ }
+ return this;
+ };
+
+ ParameterView.prototype.template = function() {
+ if (this.model.isList) {
+ return Handlebars.templates.param_list;
+ } else {
+ if (this.options.readOnly) {
+ if (this.model.required) {
+ return Handlebars.templates.param_readonly_required;
+ } else {
+ return Handlebars.templates.param_readonly;
+ }
+ } else {
+ if (this.model.required) {
+ return Handlebars.templates.param_required;
+ } else {
+ return Handlebars.templates.param;
+ }
+ }
+ }
+ };
+
+ return ParameterView;
+
+})(Backbone.View);
+
+var ResourceView,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ __hasProp = {}.hasOwnProperty;
+
+ResourceView = (function(_super) {
+ __extends(ResourceView, _super);
+
+ function ResourceView() {
+ return ResourceView.__super__.constructor.apply(this, arguments);
+ }
+
+ ResourceView.prototype.initialize = function(opts) {
+ if (opts == null) {
+ opts = {};
+ }
+ this.auths = opts.auths;
+ if ("" === this.model.description) {
+ this.model.description = null;
+ }
+ if (this.model.description != null) {
+ return this.model.summary = this.model.description;
+ }
+ };
+
+ ResourceView.prototype.render = function() {
+ var counter, id, methods, operation, _i, _len, _ref;
+ methods = {};
+ $(this.el).html(Handlebars.templates.resource(this.model));
+ _ref = this.model.operationsArray;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ operation = _ref[_i];
+ counter = 0;
+ id = operation.nickname;
+ while (typeof methods[id] !== 'undefined') {
+ id = id + "_" + counter;
+ counter += 1;
+ }
+ methods[id] = operation;
+ operation.nickname = id;
+ operation.parentId = this.model.id;
+ this.addOperation(operation);
+ }
+ $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
+ $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));
+ $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource'));
+ return this;
+ };
+
+ ResourceView.prototype.addOperation = function(operation) {
+ var operationView;
+ operation.number = this.number;
+ operationView = new OperationView({
+ model: operation,
+ tagName: 'li',
+ className: 'endpoint',
+ swaggerOptions: this.options.swaggerOptions,
+ auths: this.auths
+ });
+ $('.endpoints', $(this.el)).append(operationView.render().el);
+ return this.number++;
+ };
+
+ ResourceView.prototype.callDocs = function(fnName, e) {
+ e.preventDefault();
+ return Docs[fnName](e.currentTarget.getAttribute('data-id'));
+ };
+
+ return ResourceView;
+
+})(Backbone.View);
+
+this["Handlebars"]["templates"]["resource"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
+ return " : ";
+ },"3":function(depth0,helpers,partials,data) {
+ var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
+ return "<li>\n <a href='"
+ + escapeExpression(((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"url","hash":{},"data":data}) : helper)))
+ + "'>Raw</a>\n </li>";
+},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var stack1, helper, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, blockHelperMissing=helpers.blockHelperMissing, buffer = "<div class='heading'>\n <h2>\n <a href='#!/"
+ + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
+ + "' class=\"toggleEndpointList\" data-id=\""
+ + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
+ + "\">"
+ + escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ + "</a> ";
+ stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(options={"name":"summary","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
+ if (!helpers.summary) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
+ if (stack1 != null) { buffer += stack1; }
+ stack1 = ((helper = (helper = helpers.summary || (depth0 != null ? depth0.summary : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"summary","hash":{},"data":data}) : helper));
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/"
+ + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
+ + "' id='endpointListTogger_"
+ + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
+ + "' class=\"toggleEndpointList\" data-id=\""
+ + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
+ + "\">Show/Hide</a>\n </li>\n <li>\n <a href='#' class=\"collapseResource\" data-id=\""
+ + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
+ + "\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' class=\"expandResource\" data-id=\""
+ + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
+ + "\">\n Expand Operations\n </a>\n </li>\n ";
+ stack1 = ((helper = (helper = helpers.url || (depth0 != null ? depth0.url : depth0)) != null ? helper : helperMissing),(options={"name":"url","hash":{},"fn":this.program(3, data),"inverse":this.noop,"data":data}),(typeof helper === functionType ? helper.call(depth0, options) : helper));
+ if (!helpers.url) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "\n </ul>\n</div>\n<ul class='endpoints' id='"
+ + escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
+ + "_endpoint_list' style='display:none'>\n\n</ul>\n";
+},"useData":true});
+var ResponseContentTypeView,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ __hasProp = {}.hasOwnProperty;
+
+ResponseContentTypeView = (function(_super) {
+ __extends(ResponseContentTypeView, _super);
+
+ function ResponseContentTypeView() {
+ return ResponseContentTypeView.__super__.constructor.apply(this, arguments);
+ }
+
+ ResponseContentTypeView.prototype.initialize = function() {};
+
+ ResponseContentTypeView.prototype.render = function() {
+ var template;
+ template = this.template();
+ $(this.el).html(template(this.model));
+ $('label[for=responseContentType]', $(this.el)).text('Response Content Type');
+ return this;
+ };
+
+ ResponseContentTypeView.prototype.template = function() {
+ return Handlebars.templates.response_content_type;
+ };
+
+ return ResponseContentTypeView;
+
+})(Backbone.View);
+
+this["Handlebars"]["templates"]["response_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "";
+ stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer;
+},"2":function(depth0,helpers,partials,data) {
+ var stack1, lambda=this.lambda, buffer = " <option value=\"";
+ stack1 = lambda(depth0, depth0);
+ if (stack1 != null) { buffer += stack1; }
+ buffer += "\">";
+ stack1 = lambda(depth0, depth0);
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "</option>\n";
+},"4":function(depth0,helpers,partials,data) {
+ return " <option value=\"application/json\">application/json</option>\n";
+ },"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var stack1, buffer = "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
+ stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "</select>\n";
+},"useData":true});
+var SignatureView,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ __hasProp = {}.hasOwnProperty;
+
+SignatureView = (function(_super) {
+ __extends(SignatureView, _super);
+
+ function SignatureView() {
+ return SignatureView.__super__.constructor.apply(this, arguments);
+ }
+
+ SignatureView.prototype.events = {
+ 'click a.description-link': 'switchToDescription',
+ 'click a.snippet-link': 'switchToSnippet',
+ 'mousedown .snippet': 'snippetToTextArea'
+ };
+
+ SignatureView.prototype.initialize = function() {};
+
+ SignatureView.prototype.render = function() {
+ var template;
+ template = this.template();
+ $(this.el).html(template(this.model));
+ this.switchToSnippet();
+ this.isParam = this.model.isParam;
+ if (this.isParam) {
+ $('.notice', $(this.el)).text('Click to set as parameter value');
+ }
+ return this;
+ };
+
+ SignatureView.prototype.template = function() {
+ return Handlebars.templates.signature;
+ };
+
+ SignatureView.prototype.switchToDescription = function(e) {
+ if (e != null) {
+ e.preventDefault();
+ }
+ $(".snippet", $(this.el)).hide();
+ $(".description", $(this.el)).show();
+ $('.description-link', $(this.el)).addClass('selected');
+ return $('.snippet-link', $(this.el)).removeClass('selected');
+ };
+
+ SignatureView.prototype.switchToSnippet = function(e) {
+ if (e != null) {
+ e.preventDefault();
+ }
+ $(".description", $(this.el)).hide();
+ $(".snippet", $(this.el)).show();
+ $('.snippet-link', $(this.el)).addClass('selected');
+ return $('.description-link', $(this.el)).removeClass('selected');
+ };
+
+ SignatureView.prototype.snippetToTextArea = function(e) {
+ var textArea;
+ if (this.isParam) {
+ if (e != null) {
+ e.preventDefault();
+ }
+ textArea = $('textarea', $(this.el.parentNode.parentNode.parentNode));
+ if ($.trim(textArea.val()) === '') {
+ return textArea.val(this.model.sampleJSON);
+ }
+ }
+ };
+
+ return SignatureView;
+
+})(Backbone.View);
+
+this["Handlebars"]["templates"]["signature"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div>\n<ul class=\"signature-nav\">\n <li><a class=\"description-link\" href=\"#\">Model</a></li>\n <li><a class=\"snippet-link\" href=\"#\">Model Schema</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n <div class=\"description\">\n ";
+ stack1 = ((helper = (helper = helpers.signature || (depth0 != null ? depth0.signature : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signature","hash":{},"data":data}) : helper));
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "\n </div>\n\n <div class=\"snippet\">\n <pre><code>"
+ + escapeExpression(((helper = (helper = helpers.sampleJSON || (depth0 != null ? depth0.sampleJSON : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"sampleJSON","hash":{},"data":data}) : helper)))
+ + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
+},"useData":true});
+var StatusCodeView,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ __hasProp = {}.hasOwnProperty;
+
+StatusCodeView = (function(_super) {
+ __extends(StatusCodeView, _super);
+
+ function StatusCodeView() {
+ return StatusCodeView.__super__.constructor.apply(this, arguments);
+ }
+
+ StatusCodeView.prototype.initialize = function() {};
+
+ StatusCodeView.prototype.render = function() {
+ var responseModel, responseModelView, template;
+ template = this.template();
+ $(this.el).html(template(this.model));
+ if (swaggerUi.api.models.hasOwnProperty(this.model.responseModel)) {
+ responseModel = {
+ sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),
+ isParam: false,
+ signature: swaggerUi.api.models[this.model.responseModel].getMockSignature()
+ };
+ responseModelView = new SignatureView({
+ model: responseModel,
+ tagName: 'div'
+ });
+ $('.model-signature', this.$el).append(responseModelView.render().el);
+ } else {
+ $('.model-signature', this.$el).html('');
+ }
+ return this;
+ };
+
+ StatusCodeView.prototype.template = function() {
+ return Handlebars.templates.status_code;
+ };
+
+ return StatusCodeView;
+
+})(Backbone.View);
+
+this["Handlebars"]["templates"]["status_code"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
+ var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td width='15%' class='code'>"
+ + escapeExpression(((helper = (helper = helpers.code || (depth0 != null ? depth0.code : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"code","hash":{},"data":data}) : helper)))
+ + "</td>\n<td>";
+ stack1 = ((helper = (helper = helpers.message || (depth0 != null ? depth0.message : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"message","hash":{},"data":data}) : helper));
+ if (stack1 != null) { buffer += stack1; }
+ return buffer + "</td>\n<td width='50%'><span class=\"model-signature\" /></td>";
+},"useData":true}); \ No newline at end of file
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/swagger-ui.min.js b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/swagger-ui.min.js
new file mode 100644
index 0000000..edd853a
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/api-doc/swagger-ui.min.js
@@ -0,0 +1,17 @@
+/*
+ * 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.
+ */
+function clippyCopiedCallback(){$("#api_key_copied").fadeIn().delay(1e3).fadeOut()}$(function(){$.fn.vAlign=function(){return this.each(function(){var e=$(this).height(),t=$(this).parent().height(),n=(t-e)/2;$(this).css("margin-top",n)})},$.fn.stretchFormtasticInputWidthToParent=function(){return this.each(function(){var e=$(this).closest("form").innerWidth(),t=parseInt($(this).closest("form").css("padding-left"),10)+parseInt($(this).closest("form").css("padding-right"),10),n=parseInt($(this).css("padding-left"),10)+parseInt($(this).css("padding-right"),10);$(this).css("width",e-t-n)})},$("form.formtastic li.string input, form.formtastic textarea").stretchFormtasticInputWidthToParent(),$("ul.downplayed li div.content p").vAlign(),$("form.sandbox").submit(function(){var e=!0;return $(this).find("input.required").each(function(){$(this).removeClass("error"),""==$(this).val()&&($(this).addClass("error"),$(this).wiggle(),e=!1)}),e})}),log=function(){log.history=log.history||[],log.history.push(arguments),this.console&&console.log(Array.prototype.slice.call(arguments)[0])},Function.prototype.bind&&console&&"object"==typeof console.log&&["log","info","warn","error","assert","dir","clear","profile","profileEnd"].forEach(function(e){console[e]=this.bind(console[e],console)},Function.prototype.call);var Docs={shebang:function(){var e=$.param.fragment().split("/");switch(e.shift(),e.length){case 1:var t="resource_"+e[0];Docs.expandEndpointListForResource(e[0]),$("#"+t).slideto({highlight:!1});break;case 2:Docs.expandEndpointListForResource(e[0]),$("#"+t).slideto({highlight:!1});var n=e.join("_"),a=n+"_content";Docs.expandOperation($("#"+a)),$("#"+n).slideto({highlight:!1})}},toggleEndpointListForResource:function(e){var t=$("li#resource_"+Docs.escapeResourceName(e)+" ul.endpoints");t.is(":visible")?Docs.collapseEndpointListForResource(e):Docs.expandEndpointListForResource(e)},expandEndpointListForResource:function(e){var e=Docs.escapeResourceName(e);if(""==e)return void $(".resource ul.endpoints").slideDown();$("li#resource_"+e).addClass("active");var t=$("li#resource_"+e+" ul.endpoints");t.slideDown()},collapseEndpointListForResource:function(e){var e=Docs.escapeResourceName(e);if(""==e)return void $(".resource ul.endpoints").slideUp();$("li#resource_"+e).removeClass("active");var t=$("li#resource_"+e+" ul.endpoints");t.slideUp()},expandOperationsForResource:function(e){return Docs.expandEndpointListForResource(e),""==e?void $(".resource ul.endpoints li.operation div.content").slideDown():void $("li#resource_"+Docs.escapeResourceName(e)+" li.operation div.content").each(function(){Docs.expandOperation($(this))})},collapseOperationsForResource:function(e){return Docs.expandEndpointListForResource(e),""==e?void $(".resource ul.endpoints li.operation div.content").slideUp():void $("li#resource_"+Docs.escapeResourceName(e)+" li.operation div.content").each(function(){Docs.collapseOperation($(this))})},escapeResourceName:function(e){return e.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g,"\\$&")},expandOperation:function(e){e.slideDown()},collapseOperation:function(e){e.slideUp()}};this.Handlebars=this.Handlebars||{},this.Handlebars.templates=this.Handlebars.templates||{},this.Handlebars.templates.apikey_button_view=Handlebars.template({compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return"<!--div class='auth_button' id='apikey_button'><img class='auth_icon' alt='apply api key' src='images/apikey.jpeg'></div-->\n<div class='auth_container' id='apikey_container'>\n <div class='key_input_container'>\n <div class='auth_label'>"+l((s=null!=(s=t.keyName||(null!=e?e.keyName:e))?s:r,typeof s===i?s.call(e,{name:"keyName",hash:{},data:a}):s))+'</div>\n <input placeholder="api_key" class="auth_input" id="input_apiKey_entry" name="apiKey" type="text"/>\n <div class=\'auth_submit\'><a class=\'auth_submit_button\' id="apply_api_key" href="#">apply</a></div>\n </div>\n</div>\n\n'},useData:!0});var SwaggerUi,__extends=function(e,t){function n(){this.constructor=e}for(var a in t)__hasProp.call(t,a)&&(e[a]=t[a]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},__hasProp={}.hasOwnProperty;SwaggerUi=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return __extends(t,e),t.prototype.dom_id="swagger_ui",t.prototype.options=null,t.prototype.api=null,t.prototype.headerView=null,t.prototype.mainView=null,t.prototype.initialize=function(e){return null==e&&(e={}),null!=e.dom_id&&(this.dom_id=e.dom_id,delete e.dom_id),null==e.supportedSubmitMethods&&(e.supportedSubmitMethods=["get","put","post","delete","head","options","patch"]),null==$("#"+this.dom_id)&&$("body").append('<div id="'+this.dom_id+'"></div>'),this.options=e,this.options.success=function(e){return function(){return e.render()}}(this),this.options.progress=function(e){return function(t){return e.showMessage(t)}}(this),this.options.failure=function(e){return function(t){return e.onLoadFailure(t)}}(this),this.headerView=new HeaderView({el:$("#header")}),this.headerView.on("update-swagger-ui",function(e){return function(t){return e.updateSwaggerUi(t)}}(this))},t.prototype.setOption=function(e,t){return this.options[e]=t},t.prototype.getOption=function(e){return this.options[e]},t.prototype.updateSwaggerUi=function(e){return this.options.url=e.url,this.load()},t.prototype.load=function(){var e,t;return null!=(t=this.mainView)&&t.clear(),e=this.options.url,e&&0!==e.indexOf("http")&&(e=this.buildUrl(window.location.href.toString(),e)),this.options.url=e,this.headerView.update(e),this.api=new SwaggerClient(this.options)},t.prototype.collapseAll=function(){return Docs.collapseEndpointListForResource("")},t.prototype.listAll=function(){return Docs.collapseOperationsForResource("")},t.prototype.expandAll=function(){return Docs.expandOperationsForResource("")},t.prototype.render=function(){switch(this.showMessage("Finished Loading Resource Information. Rendering Swagger UI..."),this.mainView=new MainView({model:this.api,el:$("#"+this.dom_id),swaggerOptions:this.options}).render(),this.showMessage(),this.options.docExpansion){case"full":this.expandAll();break;case"list":this.listAll()}return this.renderGFM(),this.options.onComplete&&this.options.onComplete(this.api,this),setTimeout(function(){return function(){return Docs.shebang()}}(this),100)},t.prototype.buildUrl=function(e,t){var n,a;return 0===t.indexOf("/")?(a=e.split("/"),e=a[0]+"//"+a[2],e+t):(n=e.length,e.indexOf("?")>-1&&(n=Math.min(n,e.indexOf("?"))),e.indexOf("#")>-1&&(n=Math.min(n,e.indexOf("#"))),e=e.substring(0,n),-1!==e.indexOf("/",e.length-1)?e+t:e+"/"+t)},t.prototype.showMessage=function(e){return null==e&&(e=""),$("#message-bar").removeClass("message-fail"),$("#message-bar").addClass("message-success"),$("#message-bar").html(e)},t.prototype.onLoadFailure=function(e){var t;return null==e&&(e=""),$("#message-bar").removeClass("message-success"),$("#message-bar").addClass("message-fail"),t=$("#message-bar").html(e),null!=this.options.onFailure&&this.options.onFailure(e),t},t.prototype.renderGFM=function(e){return null==e&&(e=""),$(".markdown").each(function(){return $(this).html(marked($(this).html()))})},t}(Backbone.Router),window.SwaggerUi=SwaggerUi,this.Handlebars.templates.basic_auth_button_view=Handlebars.template({compiler:[6,">= 2.0.0-beta.1"],main:function(){return'<div class=\'auth_button\' id=\'basic_auth_button\'><img class=\'auth_icon\' src=\'images/password.jpeg\'></div>\n<div class=\'auth_container\' id=\'basic_auth_container\'>\n <div class=\'key_input_container\'>\n <div class="auth_label">Username</div>\n <input placeholder="username" class="auth_input" id="input_username" name="username" type="text"/>\n <div class="auth_label">Password</div>\n <input placeholder="password" class="auth_input" id="input_password" name="password" type="password"/>\n <div class=\'auth_submit\'><a class=\'auth_submit_button\' id="apply_basic_auth" href="#">apply</a></div>\n </div>\n</div>\n\n'},useData:!0}),Handlebars.registerHelper("sanitize",function(e){return e=e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,""),new Handlebars.SafeString(e)}),this.Handlebars.templates.content_type=Handlebars.template({1:function(e,t,n,a){var s,i="";return s=t.each.call(e,null!=e?e.produces:e,{name:"each",hash:{},fn:this.program(2,a),inverse:this.noop,data:a}),null!=s&&(i+=s),i},2:function(e){var t,n=this.lambda,a=' <option value="';return t=n(e,e),null!=t&&(a+=t),a+='">',t=n(e,e),null!=t&&(a+=t),a+"</option>\n"},4:function(){return' <option value="application/json">application/json</option>\n'},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,a){var s,i='<label for="contentType"></label>\n<select name="contentType">\n';return s=t["if"].call(e,null!=e?e.produces:e,{name:"if",hash:{},fn:this.program(1,a),inverse:this.program(4,a),data:a}),null!=s&&(i+=s),i+"</select>\n"},useData:!0});var ApiKeyButton,__extends=function(e,t){function n(){this.constructor=e}for(var a in t)__hasProp.call(t,a)&&(e[a]=t[a]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},__hasProp={}.hasOwnProperty;ApiKeyButton=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return __extends(t,e),t.prototype.initialize=function(){},t.prototype.render=function(){var e;return e=this.template(),$(this.el).html(e(this.model)),this},t.prototype.events={"click #apikey_button":"toggleApiKeyContainer","click #apply_api_key":"applyApiKey"},t.prototype.applyApiKey=function(){var e;return window.authorizations.add(this.model.name,new ApiKeyAuthorization(this.model.name,$("#input_apiKey_entry").val(),this.model["in"])),window.swaggerUi.load(),e=$("#apikey_container").show()},t.prototype.toggleApiKeyContainer=function(){var e;return $("#apikey_container").length>0?(e=$("#apikey_container").first(),e.is(":visible")?e.hide():($(".auth_container").hide(),e.show())):void 0},t.prototype.template=function(){return Handlebars.templates.apikey_button_view},t}(Backbone.View),this.Handlebars.templates.main=Handlebars.template({1:function(e,t,n,a){var s,i=this.lambda,r=this.escapeExpression,l=' <div class="info_title">'+r(i(null!=(s=null!=e?e.info:e)?s.title:s,e))+'</div>\n <div class="info_description markdown">';return s=i(null!=(s=null!=e?e.info:e)?s.description:s,e),null!=s&&(l+=s),l+="</div>\n ",s=t["if"].call(e,null!=(s=null!=e?e.info:e)?s.termsOfServiceUrl:s,{name:"if",hash:{},fn:this.program(2,a),inverse:this.noop,data:a}),null!=s&&(l+=s),l+="\n ",s=t["if"].call(e,null!=(s=null!=(s=null!=e?e.info:e)?s.contact:s)?s.name:s,{name:"if",hash:{},fn:this.program(4,a),inverse:this.noop,data:a}),null!=s&&(l+=s),l+="\n ",s=t["if"].call(e,null!=(s=null!=(s=null!=e?e.info:e)?s.contact:s)?s.url:s,{name:"if",hash:{},fn:this.program(6,a),inverse:this.noop,data:a}),null!=s&&(l+=s),l+="\n ",s=t["if"].call(e,null!=(s=null!=(s=null!=e?e.info:e)?s.contact:s)?s.email:s,{name:"if",hash:{},fn:this.program(8,a),inverse:this.noop,data:a}),null!=s&&(l+=s),l+="\n ",s=t["if"].call(e,null!=(s=null!=e?e.info:e)?s.license:s,{name:"if",hash:{},fn:this.program(10,a),inverse:this.noop,data:a}),null!=s&&(l+=s),l+"\n"},2:function(e){var t,n=this.lambda,a=this.escapeExpression;return'<div class="info_tos"><a href="'+a(n(null!=(t=null!=e?e.info:e)?t.termsOfServiceUrl:t,e))+'">Terms of service</a></div>'},4:function(e){var t,n=this.lambda,a=this.escapeExpression;return"<div class='info_name'>Created by "+a(n(null!=(t=null!=(t=null!=e?e.info:e)?t.contact:t)?t.name:t,e))+"</div>"},6:function(e){var t,n=this.lambda,a=this.escapeExpression;return"<div class='info_url'>See more at <a href=\""+a(n(null!=(t=null!=(t=null!=e?e.info:e)?t.contact:t)?t.url:t,e))+'">'+a(n(null!=(t=null!=(t=null!=e?e.info:e)?t.contact:t)?t.url:t,e))+"</a></div>"},8:function(e){var t,n=this.lambda,a=this.escapeExpression;return"<div class='info_email'><a href=\"mailto:"+a(n(null!=(t=null!=(t=null!=e?e.info:e)?t.contact:t)?t.email:t,e))+"?subject="+a(n(null!=(t=null!=e?e.info:e)?t.title:t,e))+'">Contact the developer</a></div>'},10:function(e){var t,n=this.lambda,a=this.escapeExpression;return"<div class='info_license'><a href='"+a(n(null!=(t=null!=(t=null!=e?e.info:e)?t.license:t)?t.url:t,e))+"'>"+a(n(null!=(t=null!=(t=null!=e?e.info:e)?t.license:t)?t.name:t,e))+"</a></div>"},12:function(e){var t,n=this.lambda,a=this.escapeExpression;return' , <span style="font-variant: small-caps">api version</span>: '+a(n(null!=(t=null!=e?e.info:e)?t.version:t,e))+"\n "},14:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return' <span style="float:right"><a href="'+l((s=null!=(s=t.validatorUrl||(null!=e?e.validatorUrl:e))?s:r,typeof s===i?s.call(e,{name:"validatorUrl",hash:{},data:a}):s))+"/debug?url="+l((s=null!=(s=t.url||(null!=e?e.url:e))?s:r,typeof s===i?s.call(e,{name:"url",hash:{},data:a}):s))+'"><img id="validator" src="'+l((s=null!=(s=t.validatorUrl||(null!=e?e.validatorUrl:e))?s:r,typeof s===i?s.call(e,{name:"validatorUrl",hash:{},data:a}):s))+"?url="+l((s=null!=(s=t.url||(null!=e?e.url:e))?s:r,typeof s===i?s.call(e,{name:"url",hash:{},data:a}):s))+'"></a>\n </span>\n'},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,a){var s,i,r="function",l=t.helperMissing,o=this.escapeExpression,p="<div class='info' id='api_info'>\n";return s=t["if"].call(e,null!=e?e.info:e,{name:"if",hash:{},fn:this.program(1,a),inverse:this.noop,data:a}),null!=s&&(p+=s),p+="</div>\n<div class='container' id='resources_container'>\n <ul id='resources'></ul>\n\n <div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: "+o((i=null!=(i=t.basePath||(null!=e?e.basePath:e))?i:l,typeof i===r?i.call(e,{name:"basePath",hash:{},data:a}):i))+"\n",s=t["if"].call(e,null!=(s=null!=e?e.info:e)?s.version:s,{name:"if",hash:{},fn:this.program(12,a),inverse:this.noop,data:a}),null!=s&&(p+=s),p+="]\n",s=t["if"].call(e,null!=e?e.validatorUrl:e,{name:"if",hash:{},fn:this.program(14,a),inverse:this.noop,data:a}),null!=s&&(p+=s),p+" </h4>\n </div>\n</div>\n"},useData:!0});var BasicAuthButton,__extends=function(e,t){function n(){this.constructor=e}for(var a in t)__hasProp.call(t,a)&&(e[a]=t[a]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},__hasProp={}.hasOwnProperty;BasicAuthButton=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return __extends(t,e),t.prototype.initialize=function(){},t.prototype.render=function(){var e;return e=this.template(),$(this.el).html(e(this.model)),this},t.prototype.events={"click #basic_auth_button":"togglePasswordContainer","click #apply_basic_auth":"applyPassword"},t.prototype.applyPassword=function(){var e,t,n;return n=$(".input_username").val(),t=$(".input_password").val(),window.authorizations.add(this.model.type,new PasswordAuthorization("basic",n,t)),window.swaggerUi.load(),e=$("#basic_auth_container").hide()},t.prototype.togglePasswordContainer=function(){var e;return $("#basic_auth_container").length>0?(e=$("#basic_auth_container").show(),e.is(":visible")?e.slideUp():($(".auth_container").hide(),e.show())):void 0},t.prototype.template=function(){return Handlebars.templates.basic_auth_button_view},t}(Backbone.View),this.Handlebars.templates.operation=Handlebars.template({1:function(){return"deprecated"},3:function(){return" <h4>Warning: Deprecated</h4>\n"},5:function(e,t,n,a){var s,i,r="function",l=t.helperMissing,o=' <h4>Implementation Notes</h4>\n <p class="markdown">';return i=null!=(i=t.description||(null!=e?e.description:e))?i:l,s=typeof i===r?i.call(e,{name:"description",hash:{},data:a}):i,null!=s&&(o+=s),o+"</p>\n"},7:function(){return' <div class="auth">\n <span class="api-ic ic-error"></span>'},9:function(e,t,n,a){var s,i=' <div id="api_information_panel" style="top: 526px; left: 776px; display: none;">\n';return s=t.each.call(e,e,{name:"each",hash:{},fn:this.program(10,a),inverse:this.noop,data:a}),null!=s&&(i+=s),i+" </div>\n"},10:function(e){var t,n=this.lambda,a=this.escapeExpression,s=" <div title='";return t=n(null!=e?e.description:e,e),null!=t&&(s+=t),s+"'>"+a(n(null!=e?e.scope:e,e))+"</div>\n"},12:function(){return"</div>"},14:function(){return' <div class=\'access\'>\n <span class="api-ic ic-off" title="click to authenticate"></span>\n </div>\n'},16:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return" <h4>Response Class (Status "+l((s=null!=(s=t.successCode||(null!=e?e.successCode:e))?s:r,typeof s===i?s.call(e,{name:"successCode",hash:{},data:a}):s))+')</h4>\n <p><span class="model-signature" /></p>\n <br/>\n <div class="response-content-type" />\n'},18:function(){return' <h4>Parameters</h4>\n <table class=\'fullwidth\'>\n <thead>\n <tr>\n <th style="width: 100px; max-width: 100px">Parameter</th>\n <th style="width: 310px; max-width: 310px">Value</th>\n <th style="width: 200px; max-width: 200px">Description</th>\n <th style="width: 100px; max-width: 100px">Parameter Type</th>\n <th style="width: 220px; max-width: 230px">Data Type</th>\n </tr>\n </thead>\n <tbody class="operation-params">\n\n </tbody>\n </table>\n'},20:function(){return" <div style='margin:0;padding:0;display:inline'></div>\n <h4>Response Messages</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n <th>Response Model</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n"},22:function(){return""},24:function(){return" <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <span class='response_throbber' style='display:none'></span>\n </div>\n"},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,a){var s,i,r,l="function",o=t.helperMissing,p=this.escapeExpression,u=t.blockHelperMissing,h="\n <ul class='operations' >\n <li class='"+p((i=null!=(i=t.method||(null!=e?e.method:e))?i:o,typeof i===l?i.call(e,{name:"method",hash:{},data:a}):i))+" operation' id='"+p((i=null!=(i=t.parentId||(null!=e?e.parentId:e))?i:o,typeof i===l?i.call(e,{name:"parentId",hash:{},data:a}):i))+"_"+p((i=null!=(i=t.nickname||(null!=e?e.nickname:e))?i:o,typeof i===l?i.call(e,{name:"nickname",hash:{},data:a}):i))+"'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/"+p((i=null!=(i=t.parentId||(null!=e?e.parentId:e))?i:o,typeof i===l?i.call(e,{name:"parentId",hash:{},data:a}):i))+"/"+p((i=null!=(i=t.nickname||(null!=e?e.nickname:e))?i:o,typeof i===l?i.call(e,{name:"nickname",hash:{},data:a}):i))+'\' class="toggleOperation">'+p((i=null!=(i=t.method||(null!=e?e.method:e))?i:o,typeof i===l?i.call(e,{name:"method",hash:{},data:a}):i))+"</a>\n </span>\n <span class='path'>\n <a href='#!/"+p((i=null!=(i=t.parentId||(null!=e?e.parentId:e))?i:o,typeof i===l?i.call(e,{name:"parentId",hash:{},data:a}):i))+"/"+p((i=null!=(i=t.nickname||(null!=e?e.nickname:e))?i:o,typeof i===l?i.call(e,{name:"nickname",hash:{},data:a}):i))+"' class=\"toggleOperation ";return s=t["if"].call(e,null!=e?e.deprecated:e,{name:"if",hash:{},fn:this.program(1,a),inverse:this.noop,data:a}),null!=s&&(h+=s),h+='">'+p((i=null!=(i=t.path||(null!=e?e.path:e))?i:o,typeof i===l?i.call(e,{name:"path",hash:{},data:a}):i))+"</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/"+p((i=null!=(i=t.parentId||(null!=e?e.parentId:e))?i:o,typeof i===l?i.call(e,{name:"parentId",hash:{},data:a}):i))+"/"+p((i=null!=(i=t.nickname||(null!=e?e.nickname:e))?i:o,typeof i===l?i.call(e,{name:"nickname",hash:{},data:a}):i))+'\' class="toggleOperation">',i=null!=(i=t.summary||(null!=e?e.summary:e))?i:o,s=typeof i===l?i.call(e,{name:"summary",hash:{},data:a}):i,null!=s&&(h+=s),h+="</a>\n </li>\n </ul>\n </div>\n <div class='content' id='"+p((i=null!=(i=t.parentId||(null!=e?e.parentId:e))?i:o,typeof i===l?i.call(e,{name:"parentId",hash:{},data:a}):i))+"_"+p((i=null!=(i=t.nickname||(null!=e?e.nickname:e))?i:o,typeof i===l?i.call(e,{name:"nickname",hash:{},data:a}):i))+"_content' style='display:none'>\n",s=t["if"].call(e,null!=e?e.deprecated:e,{name:"if",hash:{},fn:this.program(3,a),inverse:this.noop,data:a}),null!=s&&(h+=s),s=t["if"].call(e,null!=e?e.description:e,{name:"if",hash:{},fn:this.program(5,a),inverse:this.noop,data:a}),null!=s&&(h+=s),i=null!=(i=t.oauth||(null!=e?e.oauth:e))?i:o,r={name:"oauth",hash:{},fn:this.program(7,a),inverse:this.noop,data:a},s=typeof i===l?i.call(e,r):i,t.oauth||(s=u.call(e,s,r)),null!=s&&(h+=s),h+="\n",s=t.each.call(e,null!=e?e.oauth:e,{name:"each",hash:{},fn:this.program(9,a),inverse:this.noop,data:a}),null!=s&&(h+=s),h+=" ",i=null!=(i=t.oauth||(null!=e?e.oauth:e))?i:o,r={name:"oauth",hash:{},fn:this.program(12,a),inverse:this.noop,data:a},s=typeof i===l?i.call(e,r):i,t.oauth||(s=u.call(e,s,r)),null!=s&&(h+=s),h+="\n",i=null!=(i=t.oauth||(null!=e?e.oauth:e))?i:o,r={name:"oauth",hash:{},fn:this.program(14,a),inverse:this.noop,data:a},s=typeof i===l?i.call(e,r):i,t.oauth||(s=u.call(e,s,r)),null!=s&&(h+=s),s=t["if"].call(e,null!=e?e.type:e,{name:"if",hash:{},fn:this.program(16,a),inverse:this.noop,data:a}),null!=s&&(h+=s),h+=" <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n",s=t["if"].call(e,null!=e?e.parameters:e,{name:"if",hash:{},fn:this.program(18,a),inverse:this.noop,data:a}),null!=s&&(h+=s),s=t["if"].call(e,null!=e?e.responseMessages:e,{name:"if",hash:{},fn:this.program(20,a),inverse:this.noop,data:a}),null!=s&&(h+=s),s=t["if"].call(e,null!=e?e.isReadOnly:e,{name:"if",hash:{},fn:this.program(22,a),inverse:this.program(24,a),data:a}),null!=s&&(h+=s),h+" </form>\n <div class='response' style='display:none'>\n <h4>Request URL</h4>\n <div class='block request_url'></div>\n <h4>Response Body</h4>\n <div class='block response_body'></div>\n <h4>Response Code</h4>\n <div class='block response_code'></div>\n <h4>Response Headers</h4>\n <div class='block response_headers'></div>\n </div>\n </div>\n </li>\n </ul>\n"},useData:!0});var ContentTypeView,__extends=function(e,t){function n(){this.constructor=e}for(var a in t)__hasProp.call(t,a)&&(e[a]=t[a]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},__hasProp={}.hasOwnProperty;ContentTypeView=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return __extends(t,e),t.prototype.initialize=function(){},t.prototype.render=function(){var e;return e=this.template(),$(this.el).html(e(this.model)),$("label[for=contentType]",$(this.el)).text("Response Content Type"),this},t.prototype.template=function(){return Handlebars.templates.content_type},t}(Backbone.View),this.Handlebars.templates.param=Handlebars.template({1:function(e,t,n,a){var s,i="";return s=t["if"].call(e,null!=e?e.isFile:e,{name:"if",hash:{},fn:this.program(2,a),inverse:this.program(4,a),data:a}),null!=s&&(i+=s),i},2:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return' <input type="file" name=\''+l((s=null!=(s=t.name||(null!=e?e.name:e))?s:r,typeof s===i?s.call(e,{name:"name",hash:{},data:a}):s))+'\'/>\n <div class="parameter-content-type" />\n'},4:function(e,t,n,a){var s,i="";return s=t["if"].call(e,null!=e?e["default"]:e,{name:"if",hash:{},fn:this.program(5,a),inverse:this.program(7,a),data:a}),null!=s&&(i+=s),i},5:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return" <textarea class='body-textarea' name='"+l((s=null!=(s=t.name||(null!=e?e.name:e))?s:r,typeof s===i?s.call(e,{name:"name",hash:{},data:a}):s))+"'>"+l((s=null!=(s=t["default"]||(null!=e?e["default"]:e))?s:r,typeof s===i?s.call(e,{name:"default",hash:{},data:a}):s))+'</textarea>\n <br />\n <div class="parameter-content-type" />\n'},7:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return" <textarea class='body-textarea' name='"+l((s=null!=(s=t.name||(null!=e?e.name:e))?s:r,typeof s===i?s.call(e,{name:"name",hash:{},data:a}):s))+'\'></textarea>\n <br />\n <div class="parameter-content-type" />\n'},9:function(e,t,n,a){var s,i="";return s=t["if"].call(e,null!=e?e.isFile:e,{name:"if",hash:{},fn:this.program(2,a),inverse:this.program(10,a),data:a}),null!=s&&(i+=s),i},10:function(e,t,n,a){var s,i="";return s=t["if"].call(e,null!=e?e["default"]:e,{name:"if",hash:{},fn:this.program(11,a),inverse:this.program(13,a),data:a}),null!=s&&(i+=s),i},11:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return" <input class='parameter' minlength='0' name='"+l((s=null!=(s=t.name||(null!=e?e.name:e))?s:r,typeof s===i?s.call(e,{name:"name",hash:{},data:a}):s))+"' placeholder='' type='text' value='"+l((s=null!=(s=t["default"]||(null!=e?e["default"]:e))?s:r,typeof s===i?s.call(e,{name:"default",hash:{},data:a}):s))+"'/>\n"},13:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return" <input class='parameter' minlength='0' name='"+l((s=null!=(s=t.name||(null!=e?e.name:e))?s:r,typeof s===i?s.call(e,{name:"name",hash:{},data:a}):s))+"' placeholder='' type='text' value=''/>\n"},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,a){var s,i,r="function",l=t.helperMissing,o=this.escapeExpression,p="<td class='code'>"+o((i=null!=(i=t.name||(null!=e?e.name:e))?i:l,typeof i===r?i.call(e,{name:"name",hash:{},data:a}):i))+"</td>\n<td>\n\n";return s=t["if"].call(e,null!=e?e.isBody:e,{name:"if",hash:{},fn:this.program(1,a),inverse:this.program(9,a),data:a}),null!=s&&(p+=s),p+='\n</td>\n<td class="markdown">',i=null!=(i=t.description||(null!=e?e.description:e))?i:l,s=typeof i===r?i.call(e,{name:"description",hash:{},data:a}):i,null!=s&&(p+=s),p+="</td>\n<td>",i=null!=(i=t.paramType||(null!=e?e.paramType:e))?i:l,s=typeof i===r?i.call(e,{name:"paramType",hash:{},data:a}):i,null!=s&&(p+=s),p+'</td>\n<td>\n <span class="model-signature"></span>\n</td>\n'},useData:!0});var HeaderView,__extends=function(e,t){function n(){this.constructor=e}for(var a in t)__hasProp.call(t,a)&&(e[a]=t[a]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},__hasProp={}.hasOwnProperty;HeaderView=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return __extends(t,e),t.prototype.events={"click #show-pet-store-icon":"showPetStore","click #show-wordnik-dev-icon":"showWordnikDev","click #explore":"showCustom","keyup #input_baseUrl":"showCustomOnKeyup","keyup #input_apiKey":"showCustomOnKeyup"},t.prototype.initialize=function(){},t.prototype.showPetStore=function(){return this.trigger("update-swagger-ui",{url:"http://petstore.swagger.wordnik.com/api/api-docs"})},t.prototype.showWordnikDev=function(){return this.trigger("update-swagger-ui",{url:"http://api.wordnik.com/v4/resources.json"})},t.prototype.showCustomOnKeyup=function(e){return 13===e.keyCode?this.showCustom():void 0},t.prototype.showCustom=function(e){return null!=e&&e.preventDefault(),this.trigger("update-swagger-ui",{url:$("#input_baseUrl").val(),apiKey:$("#input_apiKey").val()})},t.prototype.update=function(e,t,n){return null==n&&(n=!1),$("#input_baseUrl").val(e),n?this.trigger("update-swagger-ui",{url:e}):void 0},t}(Backbone.View),this.Handlebars.templates.param_list=Handlebars.template({1:function(){return" multiple='multiple'"},3:function(){return""},5:function(e,t,n,a){var s,i="";return s=t["if"].call(e,null!=e?e["default"]:e,{name:"if",hash:{},fn:this.program(3,a),inverse:this.program(6,a),data:a}),null!=s&&(i+=s),i},6:function(e,t,n,a){var s,i=t.helperMissing,r="";return s=(t.isArray||e&&e.isArray||i).call(e,e,{name:"isArray",hash:{},fn:this.program(3,a),inverse:this.program(7,a),data:a}),null!=s&&(r+=s),r},7:function(){return" <option selected=\"\" value=''></option>\n"},9:function(e,t,n,a){var s,i="";return s=t["if"].call(e,null!=e?e.isDefault:e,{name:"if",hash:{},fn:this.program(10,a),inverse:this.program(12,a),data:a}),null!=s&&(i+=s),i},10:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return' <option selected="" value=\''+l((s=null!=(s=t.value||(null!=e?e.value:e))?s:r,typeof s===i?s.call(e,{name:"value",hash:{},data:a}):s))+"'>"+l((s=null!=(s=t.value||(null!=e?e.value:e))?s:r,typeof s===i?s.call(e,{name:"value",hash:{},data:a}):s))+" (default)</option>\n"},12:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return" <option value='"+l((s=null!=(s=t.value||(null!=e?e.value:e))?s:r,typeof s===i?s.call(e,{name:"value",hash:{},data:a}):s))+"'>"+l((s=null!=(s=t.value||(null!=e?e.value:e))?s:r,typeof s===i?s.call(e,{name:"value",hash:{},data:a}):s))+"</option>\n"},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,a){var s,i,r="function",l=t.helperMissing,o=this.escapeExpression,p="<td class='code'>"+o((i=null!=(i=t.name||(null!=e?e.name:e))?i:l,typeof i===r?i.call(e,{name:"name",hash:{},data:a}):i))+"</td>\n<td>\n <select ";return s=(t.isArray||e&&e.isArray||l).call(e,e,{name:"isArray",hash:{},fn:this.program(1,a),inverse:this.noop,data:a}),null!=s&&(p+=s),p+=" class='parameter' name='"+o((i=null!=(i=t.name||(null!=e?e.name:e))?i:l,typeof i===r?i.call(e,{name:"name",hash:{},data:a}):i))+"'>\n",s=t["if"].call(e,null!=e?e.required:e,{name:"if",hash:{},fn:this.program(3,a),inverse:this.program(5,a),data:a}),null!=s&&(p+=s),s=t.each.call(e,null!=(s=null!=e?e.allowableValues:e)?s.descriptiveValues:s,{name:"each",hash:{},fn:this.program(9,a),inverse:this.noop,data:a}),null!=s&&(p+=s),p+=' </select>\n</td>\n<td class="markdown">',i=null!=(i=t.description||(null!=e?e.description:e))?i:l,s=typeof i===r?i.call(e,{name:"description",hash:{},data:a}):i,null!=s&&(p+=s),p+="</td>\n<td>",i=null!=(i=t.paramType||(null!=e?e.paramType:e))?i:l,s=typeof i===r?i.call(e,{name:"paramType",hash:{},data:a}):i,null!=s&&(p+=s),p+'</td>\n<td><span class="model-signature"></span></td>'},useData:!0});var MainView,__extends=function(e,t){function n(){this.constructor=e}for(var a in t)__hasProp.call(t,a)&&(e[a]=t[a]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},__hasProp={}.hasOwnProperty;MainView=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}var n;return __extends(t,e),n={alpha:function(e,t){return e.path.localeCompare(t.path)},method:function(e,t){return e.method.localeCompare(t.method)}},t.prototype.initialize=function(e){var t,n,a,s;null==e&&(e={}),this.model.auths=[],s=this.model.securityDefinitions;for(n in s)a=s[n],t={name:n,type:a.type,value:a},this.model.auths.push(t);return"2.0"===this.model.swaggerVersion?this.model.validatorUrl="validatorUrl"in e.swaggerOptions?e.swaggerOptions.validatorUrl:this.model.url.indexOf("localhost")>0?null:"http://online.swagger.io/validator":void 0},t.prototype.render=function(){var e,t,n,a,s,i,r,l,o,p;if(this.model.securityDefinitions)for(s in this.model.securityDefinitions)e=this.model.securityDefinitions[s],"apiKey"===e.type&&0===$("#apikey_button").length&&(t=new ApiKeyButton({model:e}).render().el,$(".auth_main_container").append(t)),"basicAuth"===e.type&&0===$("#basic_auth_button").length&&(t=new BasicAuthButton({model:e}).render().el,$(".auth_main_container").append(t));for($(this.el).html(Handlebars.templates.main(this.model)),r={},n=0,p=this.model.apisArray,l=0,o=p.length;o>l;l++){for(i=p[l],a=i.name;"undefined"!=typeof r[a];)a=a+"_"+n,n+=1;
+i.id=a,r[a]=i,this.addResource(i,this.model.auths)}return $(".propWrap").hover(function(){return $(".optionsWrapper",$(this)).show()},function(){return $(".optionsWrapper",$(this)).hide()}),this},t.prototype.addResource=function(e,t){var n;return e.id=e.id.replace(/\s/g,"_"),n=new ResourceView({model:e,tagName:"li",id:"resource_"+e.id,className:"resource",auths:t,swaggerOptions:this.options.swaggerOptions}),$("#resources").append(n.render().el)},t.prototype.clear=function(){return $(this.el).html("")},t}(Backbone.View),this.Handlebars.templates.param_readonly=Handlebars.template({1:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return" <textarea class='body-textarea' readonly='readonly' name='"+l((s=null!=(s=t.name||(null!=e?e.name:e))?s:r,typeof s===i?s.call(e,{name:"name",hash:{},data:a}):s))+"'>"+l((s=null!=(s=t["default"]||(null!=e?e["default"]:e))?s:r,typeof s===i?s.call(e,{name:"default",hash:{},data:a}):s))+"</textarea>\n"},3:function(e,t,n,a){var s,i="";return s=t["if"].call(e,null!=e?e["default"]:e,{name:"if",hash:{},fn:this.program(4,a),inverse:this.program(6,a),data:a}),null!=s&&(i+=s),i},4:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return" "+l((s=null!=(s=t["default"]||(null!=e?e["default"]:e))?s:r,typeof s===i?s.call(e,{name:"default",hash:{},data:a}):s))+"\n"},6:function(){return" (empty)\n"},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,a){var s,i,r="function",l=t.helperMissing,o=this.escapeExpression,p="<td class='code'>"+o((i=null!=(i=t.name||(null!=e?e.name:e))?i:l,typeof i===r?i.call(e,{name:"name",hash:{},data:a}):i))+"</td>\n<td>\n";return s=t["if"].call(e,null!=e?e.isBody:e,{name:"if",hash:{},fn:this.program(1,a),inverse:this.program(3,a),data:a}),null!=s&&(p+=s),p+='</td>\n<td class="markdown">',i=null!=(i=t.description||(null!=e?e.description:e))?i:l,s=typeof i===r?i.call(e,{name:"description",hash:{},data:a}):i,null!=s&&(p+=s),p+="</td>\n<td>",i=null!=(i=t.paramType||(null!=e?e.paramType:e))?i:l,s=typeof i===r?i.call(e,{name:"paramType",hash:{},data:a}):i,null!=s&&(p+=s),p+'</td>\n<td><span class="model-signature"></span></td>\n'},useData:!0}),this.Handlebars.templates.param_readonly_required=Handlebars.template({1:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return" <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"+l((s=null!=(s=t.name||(null!=e?e.name:e))?s:r,typeof s===i?s.call(e,{name:"name",hash:{},data:a}):s))+"'>"+l((s=null!=(s=t["default"]||(null!=e?e["default"]:e))?s:r,typeof s===i?s.call(e,{name:"default",hash:{},data:a}):s))+"</textarea>\n"},3:function(e,t,n,a){var s,i="";return s=t["if"].call(e,null!=e?e["default"]:e,{name:"if",hash:{},fn:this.program(4,a),inverse:this.program(6,a),data:a}),null!=s&&(i+=s),i},4:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return" "+l((s=null!=(s=t["default"]||(null!=e?e["default"]:e))?s:r,typeof s===i?s.call(e,{name:"default",hash:{},data:a}):s))+"\n"},6:function(){return" (empty)\n"},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,a){var s,i,r="function",l=t.helperMissing,o=this.escapeExpression,p="<td class='code required'>"+o((i=null!=(i=t.name||(null!=e?e.name:e))?i:l,typeof i===r?i.call(e,{name:"name",hash:{},data:a}):i))+"</td>\n<td>\n";return s=t["if"].call(e,null!=e?e.isBody:e,{name:"if",hash:{},fn:this.program(1,a),inverse:this.program(3,a),data:a}),null!=s&&(p+=s),p+='</td>\n<td class="markdown">',i=null!=(i=t.description||(null!=e?e.description:e))?i:l,s=typeof i===r?i.call(e,{name:"description",hash:{},data:a}):i,null!=s&&(p+=s),p+="</td>\n<td>",i=null!=(i=t.paramType||(null!=e?e.paramType:e))?i:l,s=typeof i===r?i.call(e,{name:"paramType",hash:{},data:a}):i,null!=s&&(p+=s),p+'</td>\n<td><span class="model-signature"></span></td>\n'},useData:!0});var OperationView,__extends=function(e,t){function n(){this.constructor=e}for(var a in t)__hasProp.call(t,a)&&(e[a]=t[a]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},__hasProp={}.hasOwnProperty;OperationView=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return __extends(t,e),t.prototype.invocationUrl=null,t.prototype.events={"submit .sandbox":"submitOperation","click .submit":"submitOperation","click .response_hider":"hideResponse","click .toggleOperation":"toggleOperationContent","mouseenter .api-ic":"mouseEnter","mouseout .api-ic":"mouseExit"},t.prototype.initialize=function(e){return null==e&&(e={}),this.auths=e.auths,this.parentId=this.model.parentId,this.nickname=this.model.nickname,this},t.prototype.mouseEnter=function(e){var t,n,a,s,i,r,l,o,p,u;return t=$(this.el).find(".content"),p=e.pageX,u=e.pageY,r=$(window).scrollLeft(),l=$(window).scrollTop(),s=r+$(window).width(),i=l+$(window).height(),o=t.width(),n=t.height(),p+o>s&&(p=s-o),r>p&&(p=r),u+n>i&&(u=i-n),l>u&&(u=l),a={},a.top=u,a.left=p,t.css(a),$(e.currentTarget.parentNode).find("#api_information_panel").show()},t.prototype.mouseExit=function(e){return $(e.currentTarget.parentNode).find("#api_information_panel").hide()},t.prototype.render=function(){var e,t,n,a,s,i,r,l,o,p,u,h,c,d,m,f,y,g,v,_,w,b,x,k,O,C,S,P,T,D,H,M,E,R,V,N,U,A;if(i=jQuery.inArray(this.model.method,this.model.supportedSubmitMethods())>=0,i||(this.model.isReadOnly=!0),this.model.description=this.model.description||this.model.notes,this.model.description&&(this.model.description=this.model.description.replace(/(?:\r\n|\r|\n)/g,"<br />")),this.model.oauth=null,o=this.model.authorizations||this.model.security)if(Array.isArray(o))for(k=0,P=o.length;P>k;k++){n=o[k];for(l in n){t=n[l];for(e in this.auths)if(t=this.auths[e],"oauth2"===t.type){this.model.oauth={},this.model.oauth.scopes=[],R=t.value.scopes;for(r in R)b=R[r],y=n[l].indexOf(r),y>=0&&(p={scope:r,description:b},this.model.oauth.scopes.push(p))}}}else for(r in o)if(b=o[r],"oauth2"===r)for(null===this.model.oauth&&(this.model.oauth={}),void 0===this.model.oauth.scopes&&(this.model.oauth.scopes=[]),O=0,T=b.length;T>O;O++)p=b[O],this.model.oauth.scopes.push(p);if("undefined"!=typeof this.model.responses){this.model.responseMessages=[],V=this.model.responses;for(a in V)x=V[a],m=null,f=this.model.responses[a].schema,f&&f.$ref&&(m=f.$ref,0===m.indexOf("#/definitions/")&&(m=m.substring("#/definitions/".length))),this.model.responseMessages.push({code:a,message:x.description,responseModel:m})}if("undefined"==typeof this.model.responseMessages&&(this.model.responseMessages=[]),g=null,this.model.successResponse){_=this.model.successResponse;for(l in _)x=_[l],this.model.successCode=l,"object"==typeof x&&"function"==typeof x.createJSONSample&&(g={sampleJSON:JSON.stringify(x.createJSONSample(),void 0,2),isParam:!1,signature:x.getMockSignature()})}else this.model.responseClassSignature&&"string"!==this.model.responseClassSignature&&(g={sampleJSON:this.model.responseSampleJSON,isParam:!1,signature:this.model.responseClassSignature});for($(this.el).html(Handlebars.templates.operation(this.model)),g?(d=new SignatureView({model:g,tagName:"div"}),$(".model-signature",$(this.el)).append(d.render().el)):(this.model.responseClassSignature="string",$(".model-signature",$(this.el)).html(this.model.type)),s={isParam:!1},s.consumes=this.model.consumes,s.produces=this.model.produces,N=this.model.parameters,C=0,D=N.length;D>C;C++)u=N[C],w=u.type||u.dataType||"","undefined"==typeof w&&(m=u.schema,m&&m.$ref&&(h=m.$ref,w=0===h.indexOf("#/definitions/")?h.substring("#/definitions/".length):h)),w&&"file"===w.toLowerCase()&&(s.consumes||(s.consumes="multipart/form-data")),u.type=w;for(c=new ResponseContentTypeView({model:s}),$(".response-content-type",$(this.el)).append(c.render().el),U=this.model.parameters,S=0,H=U.length;H>S;S++)u=U[S],this.addParameter(u,s.consumes);for(A=this.model.responseMessages,E=0,M=A.length;M>E;E++)v=A[E],this.addStatusCode(v);return this},t.prototype.addParameter=function(e,t){var n;return e.consumes=t,n=new ParameterView({model:e,tagName:"tr",readOnly:this.model.isReadOnly}),$(".operation-params",$(this.el)).append(n.render().el)},t.prototype.addStatusCode=function(e){var t;return t=new StatusCodeView({model:e,tagName:"tr"}),$(".operation-status",$(this.el)).append(t.render().el)},t.prototype.submitOperation=function(e){var t,n,a,s,i,r,l,o,p,u,h,c,d,m,f,y;if(null!=e&&e.preventDefault(),n=$(".sandbox",$(this.el)),t=!0,n.find("input.required").each(function(){return $(this).removeClass("error"),""===jQuery.trim($(this).val())?($(this).addClass("error"),$(this).wiggle({callback:function(e){return function(){return $(e).focus()}}(this)}),t=!1):void 0}),n.find("textarea.required").each(function(){return $(this).removeClass("error"),""===jQuery.trim($(this).val())?($(this).addClass("error"),$(this).wiggle({callback:function(e){return function(){return $(e).focus()}}(this)}),t=!1):void 0}),t){for(s={},r={parent:this},a=!1,m=n.find("input"),o=0,h=m.length;h>o;o++)i=m[o],null!=i.value&&jQuery.trim(i.value).length>0&&(s[i.name]=i.value),"file"===i.type&&(s[i.name]=i.files[0],a=!0);for(f=n.find("textarea"),p=0,c=f.length;c>p;p++)i=f[p],null!=i.value&&jQuery.trim(i.value).length>0&&(s[i.name]=i.value);for(y=n.find("select"),u=0,d=y.length;d>u;u++)i=y[u],l=this.getSelectedValue(i),null!=l&&jQuery.trim(l).length>0&&(s[i.name]=l);return r.responseContentType=$("div select[name=responseContentType]",$(this.el)).val(),r.requestContentType=$("div select[name=parameterContentType]",$(this.el)).val(),$(".response_throbber",$(this.el)).show(),a?this.handleFileUpload(s,n):this.model["do"](s,r,this.showCompleteStatus,this.showErrorStatus,this)}},t.prototype.success=function(e,t){return t.showCompleteStatus(e)},t.prototype.handleFileUpload=function(e,t){var n,a,s,i,r,l,o,p,u,h,c,d,m,f,y,g,v,_,w;for(g=t.serializeArray(),p=0,d=g.length;d>p;p++)i=g[p],null!=i.value&&jQuery.trim(i.value).length>0&&(e[i.name]=i.value);for(n=new FormData,o=0,v=this.model.parameters,u=0,m=v.length;m>u;u++)l=v[u],("form"===l.paramType||"formData"===l["in"])&&"file"!==l.type.toLowerCase()&&void 0!==e[l.name]&&n.append(l.name,e[l.name]);for(s={},_=this.model.parameters,h=0,f=_.length;f>h;h++)l=_[h],"header"===l.paramType&&(s[l.name]=e[l.name]);for(w=t.find('input[type~="file"]'),c=0,y=w.length;y>c;c++)a=w[c],"undefined"!=typeof a.files[0]&&(n.append($(a).attr("name"),a.files[0]),o+=1);return this.invocationUrl=this.model.supportHeaderParams()?(s=this.model.getHeaderParams(e),delete s["Content-Type"],this.model.urlify(e,!1)):this.model.urlify(e,!0),$(".request_url",$(this.el)).html("<pre></pre>"),$(".request_url pre",$(this.el)).text(this.invocationUrl),r={type:this.model.method,url:this.invocationUrl,headers:s,data:n,dataType:"json",contentType:!1,processData:!1,error:function(e){return function(t){return e.showErrorStatus(e.wrap(t),e)}}(this),success:function(e){return function(t){return e.showResponse(t,e)}}(this),complete:function(e){return function(t){return e.showCompleteStatus(e.wrap(t),e)}}(this)},window.authorizations&&window.authorizations.apply(r),0===o&&r.data.append("fake","true"),jQuery.ajax(r),!1},t.prototype.wrap=function(e){var t,n,a,s,i,r,l;for(a={},n=e.getAllResponseHeaders().split("\r"),r=0,l=n.length;l>r;r++)s=n[r],t=s.match(/^([^:]*?):(.*)$/),t||(t=[]),t.shift(),void 0!==t[0]&&void 0!==t[1]&&(a[t[0].trim()]=t[1].trim());return i={},i.content={},i.content.data=e.responseText,i.headers=a,i.request={},i.request.url=this.invocationUrl,i.status=e.status,i},t.prototype.getSelectedValue=function(e){var t,n,a,s,i;if(e.multiple){for(n=[],i=e.options,a=0,s=i.length;s>a;a++)t=i[a],t.selected&&n.push(t.value);return n.length>0?n:null}return e.value},t.prototype.hideResponse=function(e){return null!=e&&e.preventDefault(),$(".response",$(this.el)).slideUp(),$(".response_hider",$(this.el)).fadeOut()},t.prototype.showResponse=function(e){var t;return t=JSON.stringify(e,null," ").replace(/\n/g,"<br>"),$(".response_body",$(this.el)).html(escape(t))},t.prototype.showErrorStatus=function(e,t){return t.showStatus(e)},t.prototype.showCompleteStatus=function(e,t){return t.showStatus(e)},t.prototype.formatXml=function(e){var t,n,a,s,i,r,l,o,p,u,h,c,d;for(o=/(>)(<)(\/*)/g,u=/[ ]*(.*)[ ]+\n/g,t=/(<.+>)(.+\n)/g,e=e.replace(o,"$1\n$2$3").replace(u,"$1\n").replace(t,"$1\n$2"),l=0,n="",i=e.split("\n"),a=0,s="other",p={"single->single":0,"single->closing":-1,"single->opening":0,"single->other":0,"closing->single":0,"closing->closing":-1,"closing->opening":0,"closing->other":0,"opening->single":1,"opening->closing":0,"opening->opening":1,"opening->other":1,"other->single":0,"other->closing":-1,"other->opening":0,"other->other":0},h=function(e){var t,i,r,l,o,u,h;return u={single:Boolean(e.match(/<.+\/>/)),closing:Boolean(e.match(/<\/.+>/)),opening:Boolean(e.match(/<[^!?].*>/))},o=function(){var e;e=[];for(r in u)h=u[r],h&&e.push(r);return e}()[0],o=void 0===o?"other":o,t=s+"->"+o,s=o,l="",a+=p[t],l=function(){var e,t,n;for(n=[],i=e=0,t=a;t>=0?t>e:e>t;i=t>=0?++e:--e)n.push(" ");return n}().join(""),"opening->closing"===t?n=n.substr(0,n.length-1)+e+"\n":n+=l+e+"\n"},c=0,d=i.length;d>c;c++)r=i[c],h(r);return n},t.prototype.showStatus=function(e){var t,n,a,s,i,r,l,o,p,u,h;if(void 0===e.content?(n=e.data,h=e.url):(n=e.content.data,h=e.request.url),i=e.headers,a=null,i&&(a=i["Content-Type"]||i["content-type"],a&&(a=a.split(";")[0].trim())),$(".response_body",$(this.el)).removeClass("json"),$(".response_body",$(this.el)).removeClass("xml"),n)if("application/json"===a||/\+json$/.test(a)){r=null;try{r=JSON.stringify(JSON.parse(n),null," ")}catch(c){s=c,r="can't parse JSON. Raw result:\n\n"+n}t=$("<code />").text(r),o=$('<pre class="json" />').append(t)}else"application/xml"===a||/\+xml$/.test(a)?(t=$("<code />").text(this.formatXml(n)),o=$('<pre class="xml" />').append(t)):"text/html"===a?(t=$("<code />").html(_.escape(n)),o=$('<pre class="xml" />').append(t)):/^image\//.test(a)?o=$("<img>").attr("src",h):(t=$("<code />").text(n),o=$('<pre class="json" />').append(t));else t=$("<code />").text("no content"),o=$('<pre class="json" />').append(t);return p=o,$(".request_url",$(this.el)).html("<pre></pre>"),$(".request_url pre",$(this.el)).text(h),$(".response_code",$(this.el)).html("<pre>"+e.status+"</pre>"),$(".response_body",$(this.el)).html(p),$(".response_headers",$(this.el)).html("<pre>"+_.escape(JSON.stringify(e.headers,null," ")).replace(/\n/g,"<br>")+"</pre>"),$(".response",$(this.el)).slideDown(),$(".response_hider",$(this.el)).show(),$(".response_throbber",$(this.el)).hide(),u=$(".response_body",$(this.el))[0],l=this.options.swaggerOptions,l.highlightSizeThreshold&&e.data.length>l.highlightSizeThreshold?u:hljs.highlightBlock(u)},t.prototype.toggleOperationContent=function(){var e;return e=$("#"+Docs.escapeResourceName(this.parentId+"_"+this.nickname+"_content")),e.is(":visible")?Docs.collapseOperation(e):Docs.expandOperation(e)},t}(Backbone.View);var ParameterContentTypeView,__extends=function(e,t){function n(){this.constructor=e}for(var a in t)__hasProp.call(t,a)&&(e[a]=t[a]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},__hasProp={}.hasOwnProperty;ParameterContentTypeView=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return __extends(t,e),t.prototype.initialize=function(){},t.prototype.render=function(){var e;return e=this.template(),$(this.el).html(e(this.model)),$("label[for=parameterContentType]",$(this.el)).text("Parameter content type:"),this},t.prototype.template=function(){return Handlebars.templates.parameter_content_type},t}(Backbone.View),this.Handlebars.templates.param_required=Handlebars.template({1:function(e,t,n,a){var s,i="";return s=t["if"].call(e,null!=e?e.isFile:e,{name:"if",hash:{},fn:this.program(2,a),inverse:this.program(4,a),data:a}),null!=s&&(i+=s),i},2:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return' <input type="file" name=\''+l((s=null!=(s=t.name||(null!=e?e.name:e))?s:r,typeof s===i?s.call(e,{name:"name",hash:{},data:a}):s))+"'/>\n"},4:function(e,t,n,a){var s,i="";return s=t["if"].call(e,null!=e?e["default"]:e,{name:"if",hash:{},fn:this.program(5,a),inverse:this.program(7,a),data:a}),null!=s&&(i+=s),i},5:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return" <textarea class='body-textarea required' placeholder='(required)' name='"+l((s=null!=(s=t.name||(null!=e?e.name:e))?s:r,typeof s===i?s.call(e,{name:"name",hash:{},data:a}):s))+"'>"+l((s=null!=(s=t["default"]||(null!=e?e["default"]:e))?s:r,typeof s===i?s.call(e,{name:"default",hash:{},data:a}):s))+'</textarea>\n <br />\n <div class="parameter-content-type" />\n'},7:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return" <textarea class='body-textarea required' placeholder='(required)' name='"+l((s=null!=(s=t.name||(null!=e?e.name:e))?s:r,typeof s===i?s.call(e,{name:"name",hash:{},data:a}):s))+'\'></textarea>\n <br />\n <div class="parameter-content-type" />\n'},9:function(e,t,n,a){var s,i="";return s=t["if"].call(e,null!=e?e.isFile:e,{name:"if",hash:{},fn:this.program(10,a),inverse:this.program(12,a),data:a}),null!=s&&(i+=s),i},10:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return" <input class='parameter' class='required' type='file' name='"+l((s=null!=(s=t.name||(null!=e?e.name:e))?s:r,typeof s===i?s.call(e,{name:"name",hash:{},data:a}):s))+"'/>\n"},12:function(e,t,n,a){var s,i="";return s=t["if"].call(e,null!=e?e["default"]:e,{name:"if",hash:{},fn:this.program(13,a),inverse:this.program(15,a),data:a}),null!=s&&(i+=s),i},13:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return" <input class='parameter required' minlength='1' name='"+l((s=null!=(s=t.name||(null!=e?e.name:e))?s:r,typeof s===i?s.call(e,{name:"name",hash:{},data:a}):s))+"' placeholder='(required)' type='text' value='"+l((s=null!=(s=t["default"]||(null!=e?e["default"]:e))?s:r,typeof s===i?s.call(e,{name:"default",hash:{},data:a}):s))+"'/>\n"},15:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return" <input class='parameter required' minlength='1' name='"+l((s=null!=(s=t.name||(null!=e?e.name:e))?s:r,typeof s===i?s.call(e,{name:"name",hash:{},data:a}):s))+"' placeholder='(required)' type='text' value=''/>\n"},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,a){var s,i,r="function",l=t.helperMissing,o=this.escapeExpression,p="<td class='code required'>"+o((i=null!=(i=t.name||(null!=e?e.name:e))?i:l,typeof i===r?i.call(e,{name:"name",hash:{},data:a}):i))+"</td>\n<td>\n";return s=t["if"].call(e,null!=e?e.isBody:e,{name:"if",hash:{},fn:this.program(1,a),inverse:this.program(9,a),data:a}),null!=s&&(p+=s),p+='</td>\n<td>\n <strong><span class="markdown">',i=null!=(i=t.description||(null!=e?e.description:e))?i:l,s=typeof i===r?i.call(e,{name:"description",hash:{},data:a}):i,null!=s&&(p+=s),p+="</span></strong>\n</td>\n<td>",i=null!=(i=t.paramType||(null!=e?e.paramType:e))?i:l,s=typeof i===r?i.call(e,{name:"paramType",hash:{},data:a}):i,null!=s&&(p+=s),p+'</td>\n<td><span class="model-signature"></span></td>\n'},useData:!0}),this.Handlebars.templates.parameter_content_type=Handlebars.template({1:function(e,t,n,a){var s,i="";return s=t.each.call(e,null!=e?e.consumes:e,{name:"each",hash:{},fn:this.program(2,a),inverse:this.noop,data:a}),null!=s&&(i+=s),i},2:function(e){var t,n=this.lambda,a=' <option value="';return t=n(e,e),null!=t&&(a+=t),a+='">',t=n(e,e),null!=t&&(a+=t),a+"</option>\n"},4:function(){return' <option value="application/json">application/json</option>\n'},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,a){var s,i='<label for="parameterContentType"></label>\n<select name="parameterContentType">\n';return s=t["if"].call(e,null!=e?e.consumes:e,{name:"if",hash:{},fn:this.program(1,a),inverse:this.program(4,a),data:a}),null!=s&&(i+=s),i+"</select>\n"},useData:!0});var ParameterView,__extends=function(e,t){function n(){this.constructor=e}for(var a in t)__hasProp.call(t,a)&&(e[a]=t[a]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},__hasProp={}.hasOwnProperty;ParameterView=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return __extends(t,e),t.prototype.initialize=function(){return Handlebars.registerHelper("isArray",function(e,t){return"array"===e.type.toLowerCase()||e.allowMultiple?t.fn(this):t.inverse(this)})},t.prototype.render=function(){var e,t,n,a,s,i,r,l,o,p;return p=this.model.type||this.model.dataType,"undefined"==typeof p&&(i=this.model.schema,i&&i.$ref&&(a=i.$ref,p=0===a.indexOf("#/definitions/")?a.substring("#/definitions/".length):a)),this.model.type=p,this.model.paramType=this.model["in"]||this.model.paramType,("body"===this.model.paramType||"body"===this.model["in"])&&(this.model.isBody=!0),p&&"file"===p.toLowerCase()&&(this.model.isFile=!0),this.model["default"]=this.model["default"]||this.model.defaultValue,this.model.allowableValues&&(this.model.isList=!0),o=this.template(),$(this.el).html(o(this.model)),r={sampleJSON:this.model.sampleJSON,isParam:!0,signature:this.model.signature},this.model.sampleJSON?(l=new SignatureView({model:r,tagName:"div"}),$(".model-signature",$(this.el)).append(l.render().el)):$(".model-signature",$(this.el)).html(this.model.signature),t=!1,this.model.isBody&&(t=!0),e={isParam:t},e.consumes=this.model.consumes,t?(n=new ParameterContentTypeView({model:e}),$(".parameter-content-type",$(this.el)).append(n.render().el)):(s=new ResponseContentTypeView({model:e}),$(".response-content-type",$(this.el)).append(s.render().el)),this},t.prototype.template=function(){return this.model.isList?Handlebars.templates.param_list:this.options.readOnly?this.model.required?Handlebars.templates.param_readonly_required:Handlebars.templates.param_readonly:this.model.required?Handlebars.templates.param_required:Handlebars.templates.param},t}(Backbone.View);var ResourceView,__extends=function(e,t){function n(){this.constructor=e}for(var a in t)__hasProp.call(t,a)&&(e[a]=t[a]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},__hasProp={}.hasOwnProperty;ResourceView=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return __extends(t,e),t.prototype.initialize=function(e){return null==e&&(e={}),this.auths=e.auths,""===this.model.description&&(this.model.description=null),null!=this.model.description?this.model.summary=this.model.description:void 0},t.prototype.render=function(){var e,t,n,a,s,i,r;for(n={},$(this.el).html(Handlebars.templates.resource(this.model)),r=this.model.operationsArray,s=0,i=r.length;i>s;s++){for(a=r[s],e=0,t=a.nickname;"undefined"!=typeof n[t];)t=t+"_"+e,e+=1;n[t]=a,a.nickname=t,a.parentId=this.model.id,this.addOperation(a)}return $(".toggleEndpointList",this.el).click(this.callDocs.bind(this,"toggleEndpointListForResource")),$(".collapseResource",this.el).click(this.callDocs.bind(this,"collapseOperationsForResource")),$(".expandResource",this.el).click(this.callDocs.bind(this,"expandOperationsForResource")),this},t.prototype.addOperation=function(e){var t;return e.number=this.number,t=new OperationView({model:e,tagName:"li",className:"endpoint",swaggerOptions:this.options.swaggerOptions,auths:this.auths}),$(".endpoints",$(this.el)).append(t.render().el),this.number++},t.prototype.callDocs=function(e,t){return t.preventDefault(),Docs[e](t.currentTarget.getAttribute("data-id"))},t}(Backbone.View),this.Handlebars.templates.resource=Handlebars.template({1:function(){return" : "},3:function(e,t,n,a){var s,i="function",r=t.helperMissing,l=this.escapeExpression;return"<li>\n <a href='"+l((s=null!=(s=t.url||(null!=e?e.url:e))?s:r,typeof s===i?s.call(e,{name:"url",hash:{},data:a}):s))+"'>Raw</a>\n </li>"},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,a){var s,i,r,l="function",o=t.helperMissing,p=this.escapeExpression,u=t.blockHelperMissing,h="<div class='heading'>\n <h2>\n <a href='#!/"+p((i=null!=(i=t.id||(null!=e?e.id:e))?i:o,typeof i===l?i.call(e,{name:"id",hash:{},data:a}):i))+'\' class="toggleEndpointList" data-id="'+p((i=null!=(i=t.id||(null!=e?e.id:e))?i:o,typeof i===l?i.call(e,{name:"id",hash:{},data:a}):i))+'">'+p((i=null!=(i=t.name||(null!=e?e.name:e))?i:o,typeof i===l?i.call(e,{name:"name",hash:{},data:a}):i))+"</a> ";return i=null!=(i=t.summary||(null!=e?e.summary:e))?i:o,r={name:"summary",hash:{},fn:this.program(1,a),inverse:this.noop,data:a},s=typeof i===l?i.call(e,r):i,t.summary||(s=u.call(e,s,r)),null!=s&&(h+=s),i=null!=(i=t.summary||(null!=e?e.summary:e))?i:o,s=typeof i===l?i.call(e,{name:"summary",hash:{},data:a}):i,null!=s&&(h+=s),h+="\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/"+p((i=null!=(i=t.id||(null!=e?e.id:e))?i:o,typeof i===l?i.call(e,{name:"id",hash:{},data:a}):i))+"' id='endpointListTogger_"+p((i=null!=(i=t.id||(null!=e?e.id:e))?i:o,typeof i===l?i.call(e,{name:"id",hash:{},data:a}):i))+'\' class="toggleEndpointList" data-id="'+p((i=null!=(i=t.id||(null!=e?e.id:e))?i:o,typeof i===l?i.call(e,{name:"id",hash:{},data:a}):i))+'">Show/Hide</a>\n </li>\n <li>\n <a href=\'#\' class="collapseResource" data-id="'+p((i=null!=(i=t.id||(null!=e?e.id:e))?i:o,typeof i===l?i.call(e,{name:"id",hash:{},data:a}):i))+'">\n List Operations\n </a>\n </li>\n <li>\n <a href=\'#\' class="expandResource" data-id="'+p((i=null!=(i=t.id||(null!=e?e.id:e))?i:o,typeof i===l?i.call(e,{name:"id",hash:{},data:a}):i))+'">\n Expand Operations\n </a>\n </li>\n ',i=null!=(i=t.url||(null!=e?e.url:e))?i:o,r={name:"url",hash:{},fn:this.program(3,a),inverse:this.noop,data:a},s=typeof i===l?i.call(e,r):i,t.url||(s=u.call(e,s,r)),null!=s&&(h+=s),h+"\n </ul>\n</div>\n<ul class='endpoints' id='"+p((i=null!=(i=t.id||(null!=e?e.id:e))?i:o,typeof i===l?i.call(e,{name:"id",hash:{},data:a}):i))+"_endpoint_list' style='display:none'>\n\n</ul>\n"},useData:!0});var ResponseContentTypeView,__extends=function(e,t){function n(){this.constructor=e}for(var a in t)__hasProp.call(t,a)&&(e[a]=t[a]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},__hasProp={}.hasOwnProperty;ResponseContentTypeView=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return __extends(t,e),t.prototype.initialize=function(){},t.prototype.render=function(){var e;return e=this.template(),$(this.el).html(e(this.model)),$("label[for=responseContentType]",$(this.el)).text("Response Content Type"),this},t.prototype.template=function(){return Handlebars.templates.response_content_type},t}(Backbone.View),this.Handlebars.templates.response_content_type=Handlebars.template({1:function(e,t,n,a){var s,i="";return s=t.each.call(e,null!=e?e.produces:e,{name:"each",hash:{},fn:this.program(2,a),inverse:this.noop,data:a}),null!=s&&(i+=s),i},2:function(e){var t,n=this.lambda,a=' <option value="';return t=n(e,e),null!=t&&(a+=t),a+='">',t=n(e,e),null!=t&&(a+=t),a+"</option>\n"},4:function(){return' <option value="application/json">application/json</option>\n'},compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,a){var s,i='<label for="responseContentType"></label>\n<select name="responseContentType">\n';return s=t["if"].call(e,null!=e?e.produces:e,{name:"if",hash:{},fn:this.program(1,a),inverse:this.program(4,a),data:a}),null!=s&&(i+=s),i+"</select>\n"},useData:!0});var SignatureView,__extends=function(e,t){function n(){this.constructor=e}for(var a in t)__hasProp.call(t,a)&&(e[a]=t[a]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},__hasProp={}.hasOwnProperty;SignatureView=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return __extends(t,e),t.prototype.events={"click a.description-link":"switchToDescription","click a.snippet-link":"switchToSnippet","mousedown .snippet":"snippetToTextArea"},t.prototype.initialize=function(){},t.prototype.render=function(){var e;return e=this.template(),$(this.el).html(e(this.model)),this.switchToSnippet(),this.isParam=this.model.isParam,this.isParam&&$(".notice",$(this.el)).text("Click to set as parameter value"),this},t.prototype.template=function(){return Handlebars.templates.signature},t.prototype.switchToDescription=function(e){return null!=e&&e.preventDefault(),$(".snippet",$(this.el)).hide(),$(".description",$(this.el)).show(),$(".description-link",$(this.el)).addClass("selected"),$(".snippet-link",$(this.el)).removeClass("selected")},t.prototype.switchToSnippet=function(e){return null!=e&&e.preventDefault(),$(".description",$(this.el)).hide(),$(".snippet",$(this.el)).show(),$(".snippet-link",$(this.el)).addClass("selected"),$(".description-link",$(this.el)).removeClass("selected")},t.prototype.snippetToTextArea=function(e){var t;return this.isParam&&(null!=e&&e.preventDefault(),t=$("textarea",$(this.el.parentNode.parentNode.parentNode)),""===$.trim(t.val()))?t.val(this.model.sampleJSON):void 0},t}(Backbone.View),this.Handlebars.templates.signature=Handlebars.template({compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,a){var s,i,r="function",l=t.helperMissing,o=this.escapeExpression,p='<div>\n<ul class="signature-nav">\n <li><a class="description-link" href="#">Model</a></li>\n <li><a class="snippet-link" href="#">Model Schema</a></li>\n</ul>\n<div>\n\n<div class="signature-container">\n <div class="description">\n ';return i=null!=(i=t.signature||(null!=e?e.signature:e))?i:l,s=typeof i===r?i.call(e,{name:"signature",hash:{},data:a}):i,null!=s&&(p+=s),p+'\n </div>\n\n <div class="snippet">\n <pre><code>'+o((i=null!=(i=t.sampleJSON||(null!=e?e.sampleJSON:e))?i:l,typeof i===r?i.call(e,{name:"sampleJSON",hash:{},data:a}):i))+'</code></pre>\n <small class="notice"></small>\n </div>\n</div>\n\n'},useData:!0});var StatusCodeView,__extends=function(e,t){function n(){this.constructor=e}for(var a in t)__hasProp.call(t,a)&&(e[a]=t[a]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},__hasProp={}.hasOwnProperty;StatusCodeView=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return __extends(t,e),t.prototype.initialize=function(){},t.prototype.render=function(){var e,t,n;return n=this.template(),$(this.el).html(n(this.model)),swaggerUi.api.models.hasOwnProperty(this.model.responseModel)?(e={sampleJSON:JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(),null,2),isParam:!1,signature:swaggerUi.api.models[this.model.responseModel].getMockSignature()},t=new SignatureView({model:e,tagName:"div"}),$(".model-signature",this.$el).append(t.render().el)):$(".model-signature",this.$el).html(""),this},t.prototype.template=function(){return Handlebars.templates.status_code},t}(Backbone.View),this.Handlebars.templates.status_code=Handlebars.template({compiler:[6,">= 2.0.0-beta.1"],main:function(e,t,n,a){var s,i,r="function",l=t.helperMissing,o=this.escapeExpression,p="<td width='15%' class='code'>"+o((i=null!=(i=t.code||(null!=e?e.code:e))?i:l,typeof i===r?i.call(e,{name:"code",hash:{},data:a}):i))+"</td>\n<td>";return i=null!=(i=t.message||(null!=e?e.message:e))?i:l,s=typeof i===r?i.call(e,{name:"message",hash:{},data:a}):i,null!=s&&(p+=s),p+"</td>\n<td width='50%'><span class=\"model-signature\" /></td>"},useData:!0}); \ No newline at end of file
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/banner.txt b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/banner.txt
new file mode 100644
index 0000000..dfbe316
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/banner.txt
@@ -0,0 +1,25 @@
+====
+ 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.
+====
+
+
+ wso2 bps rest api
+ 88
+ .d8888b. dP. .dP .d8888b. 88d8b.d8b. 88d888b. 88 .d8888b.
+ 88ooood8 `8bd8' 88' `88 88'`88'`88 88' `88 88 88ooood8
+ 88. ... .d88b. 88. .88 88 88 88 88. .88 88 88. ...
+ `88888P' dP' `dP `88888P8 dP dP dP 88Y888P' dP `88888P'
+ 88
+ dP
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/config.properties b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/config.properties
new file mode 100644
index 0000000..580277f
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/config.properties
@@ -0,0 +1,16 @@
+#
+# 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.
+#
+
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/migrations.xml b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/migrations.xml
new file mode 100644
index 0000000..1d07c9a
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/migrations.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+
+<databaseChangeLog
+ xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
+ http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
+
+ <changeSet id="1" author="codahale">
+ <createTable tableName="book">
+ <column name="id" type="bigint" autoIncrement="true">
+ <constraints primaryKey="true" nullable="false"/>
+ </column>
+ <column name="name" type="varchar(255)">
+ <constraints nullable="false"/>
+ </column>
+ <column name="type" type="varchar(255)"/>
+ <column name="price" type="NUMERIC(20,2)"/>
+ </createTable>
+ </changeSet>
+</databaseChangeLog>
diff --git a/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/wso2-config.properties b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/wso2-config.properties
new file mode 100644
index 0000000..f66210e
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-core/wso2bpel-mgr/src/main/resources/wso2-config.properties
@@ -0,0 +1,24 @@
+#
+# 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.
+#
+
+wso2.host=localhost
+wso2.http.port=9443
+wso2.http.authenticator.username=admin
+wso2.http.authenticator.password=admin
+wso2.path=F:/wso2bps-3.5.1/wso2bps-3.5.1
+wso2.uploadfile.path=F:/wso2bps-3.5.1/wso2bps-3.5.1/tmp/bpeluploads
+wso2.ssl.jks.file=F:/wso2bps-3.5.1/wso2bps-3.5.1/repository/resources/security/wso2carbon.jks
+wso2.ssl.trustStorePassword=wso2carbon \ No newline at end of file
diff --git a/wso2/wso2bpel-ext/wso2bpel-parent/pom.xml b/wso2/wso2bpel-ext/wso2bpel-parent/pom.xml
new file mode 100644
index 0000000..0d52f97
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-parent/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.openo.common-services.common-utilities.wso2bpel-ext</groupId>
+ <artifactId>wso2bpelparent-lite</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>wso2bpelparent-lite</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>wso2bpelparent-aggregator</artifactId>
+ <name>common-services-common-utilities/wso2bpel-ext/wso2bpel-parent</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>wso2bpelparent</module>
+ <module>wso2bpelparent-lite</module>
+ </modules>
+</project>
diff --git a/wso2/wso2bpel-ext/wso2bpel-parent/wso2bpelparent-lite/pom.xml b/wso2/wso2bpel-ext/wso2bpel-parent/wso2bpelparent-lite/pom.xml
new file mode 100644
index 0000000..8189977
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-parent/wso2bpelparent-lite/pom.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.openo.oparent</groupId>
+ <artifactId>oparent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../../../../oparent</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.openo.common-services.common-utilities.wso2bpel-ext</groupId>
+ <artifactId>wso2bpelparent-lite</artifactId>
+ <name>common-services-common-utilities/wso2bpel-ext/wso2bpel-parent/wso2bpelparent-lite</name>
+ <packaging>pom</packaging>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.3</version>
+ <configuration>
+ <verbose>true</verbose>
+ <fork>true</fork>
+ <compilerVersion>1.7</compilerVersion>
+ <source>1.7</source>
+ <target>1.7</target>
+ <encoding>UTF-8</encoding>
+ <debug>true</debug>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <archive>
+ <addMavenDescriptor>false</addMavenDescriptor>
+ </archive>
+ <forceCreation>true</forceCreation>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.10</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.7</version>
+ <configuration>
+ <encoding>UTF-8</encoding>
+ <nonFilteredFileExtensions>
+ <nonFilteredFileExtension>pdf</nonFilteredFileExtension>
+ <nonFilteredFileExtension>swf</nonFilteredFileExtension>
+ <nonFilteredFileExtension>exe</nonFilteredFileExtension>
+ <nonFilteredFileExtension>png</nonFilteredFileExtension>
+ <nonFilteredFileExtension>gif</nonFilteredFileExtension>
+ <nonFilteredFileExtension>jpg</nonFilteredFileExtension>
+ <nonFilteredFileExtension>jpeg</nonFilteredFileExtension>
+ <nonFilteredFileExtension>bmp</nonFilteredFileExtension>
+ <nonFilteredFileExtension>eot</nonFilteredFileExtension>
+ <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
+ <nonFilteredFileExtension>svg</nonFilteredFileExtension>
+ <nonFilteredFileExtension>woff</nonFilteredFileExtension>
+ <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
+ <nonFilteredFileExtension>mso</nonFilteredFileExtension>
+ <nonFilteredFileExtension>wmz</nonFilteredFileExtension>
+ <nonFilteredFileExtension>emz</nonFilteredFileExtension>
+ <nonFilteredFileExtension>otf</nonFilteredFileExtension>
+ </nonFilteredFileExtensions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.10</version>
+ </plugin>
+ <plugin>
+ <groupId>com.mycila</groupId>
+ <artifactId>license-maven-plugin</artifactId>
+ <version>3.0.rc1</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.8</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/wso2/wso2bpel-ext/wso2bpel-parent/wso2bpelparent/pom.xml b/wso2/wso2bpel-ext/wso2bpel-parent/wso2bpelparent/pom.xml
new file mode 100644
index 0000000..606977b
--- /dev/null
+++ b/wso2/wso2bpel-ext/wso2bpel-parent/wso2bpelparent/pom.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.openo.common-services.common-utilities.wso2bpel-ext</groupId>
+ <artifactId>wso2bpelparent-lite</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../wso2bpelparent-lite</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>wso2bpelparent</artifactId>
+ <name>common-services-common-utilities/wso2bpel-ext/wso2bpel-parent/wso2bpelparent</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <dropwizard.version>0.8.0</dropwizard.version>
+ <swagger.version>1.5.3</swagger.version>
+ <lombok.version>1.16.4</lombok.version>
+ <jersey.version>2.22.2</jersey.version>
+ <jaxrs.consumer.version>5.0</jaxrs.consumer.version>
+ <gson.version>2.2.4</gson.version>
+ <junit.version>4.10</junit.version>
+ <org.powermock.version>1.4.10</org.powermock.version>
+ <org.apache.ant.version>1.8.2</org.apache.ant.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-core</artifactId>
+ <version>${dropwizard.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-assets</artifactId>
+ <version>${dropwizard.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard</groupId>
+ <artifactId>dropwizard-hibernate</artifactId>
+ <version>${dropwizard.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-jersey2-jaxrs</artifactId>
+ <version>${swagger.version}</version>
+ </dependency>
+ <!-- lombok -->
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>${lombok.version}</version>
+ </dependency>
+ <!-- jersey -->
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-server</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-multipart</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-servlet-core</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+ <!-- consumer -->
+ <dependency>
+ <groupId>com.eclipsesource.jaxrs</groupId>
+ <artifactId>consumer</artifactId>
+ <version>${jaxrs.consumer.version}</version>
+ </dependency>
+ <!-- gson -->
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>${gson.version}</version>
+ </dependency>
+ <!-- UT -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ <version>${org.powermock.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ <version>${org.powermock.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>${org.apache.ant.version}</version>
+ </dependency>
+ <!-- UT end -->
+ </dependencies>
+ </dependencyManagement>
+</project>