init commit: adding wso2 mb as wso2iot- broker

This commit is contained in:
GPrathap 2016-11-09 09:45:34 +05:30
parent da7929c5a3
commit 0ce49684fc
514 changed files with 59267 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,69 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head> <script type="text/javascript" src="../../carbon/googleanalytics/js/jquery.min.js"></script>
<script type="text/javascript" src="../../carbon/googleanalytics/js/googleAnalyticsProcessor.js"></script>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>StratosLive</title>
<link href="style.css" rel="stylesheet" type="text/css" media="all" />
<link rel="icon" href="images/favicon.ico" type="image/x-icon"/>
<meta name="description" content="WSO2 is the lean enterprise middleware company, delivering the only complete open source enterprise SOA middleware stack available internally and in the cloud." />
<meta name="keywords" content="cloud, platform-as-a-service, PaaS" />
</head>
<body>
<div id="main-content">
<div id="header">
<div class="logo"><img src="images/logo.gif"/></div>
</div>
<div id="content">
<div class="intro">
<div class="register">
<a href="https://stratoslive.wso2.com/carbon/tenant-register/select_domain.jsp"><img src="images/register.gif"/></a>
<a href="../carbon/sso-acs/redirect_ajaxprocessor.jsp"><img src="images/sign-in.gif"/></a>
</div>
<p>WSO2 MB brings Event Driven Architecture capabilities to WSO2 Carbon platform. It provides WS-Eventing, JMS and SQS interfaces to client. It uses Apache Qpid as the underling broker which supports AMQP.</p>
</div>
<div class="clear"></div>
<div class="features">
<h2>Features</h2>
<div class="feature feature-left">
<img src="images/feature-01-icon.gif"/>
<h2>Bring CEP to SOA</h2>
<p>
Bring CEP to SOA by processing XML events and produce results as XML events.
</p>
</div>
<div class="feature">
<img src="images/feature-02-icon.gif"/>
<h2>Registry Storage</h2>
<p>
Ability to define different event streams, queries and out put streams and store them in the registry as a bucket.
</p>
</div>
<div class="feature">
<img src="images/feature-03-icon.gif"/>
<h2>Esper and Fusion</h2>
<p>
Support Esper and fusion back end runtimes.
</p>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div id="footer">
<div class="footer-links">
<a href="http://www.wso2.com/cloud/services/terms-of-use" target="_blank">Terms of Service</a> | <a href="http://www.wso2.com/cloud/services/privacy-policy" target="_blank">Privacy Policy</a> | <a href="http://www.wso2.com/cloud/services/support" target="_blank">Support</a>
</div>
<div class="powered">
<span>Powered by</span><img src="images/powered-logo.gif" alt="ESB"/>
</div>
<span class="copyright">&copy;stratoslive.wso2.com copyright 2010-2011 WSO2, Inc. </span>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,46 @@
body { font-family: "Calibri","Lucida Grande","Lucida Sans","Microsoft Sans Serif","Lucida Sans Unicode","Verdana","Sans-serif","trebuchet ms"; font-size: .85em; line-height: 135%; color: #434343; margin: 0px; padding: 0px; background-color: #94C8EC;}
p { }
td { }
a:link { text-decoration: none; }
a:visited { text-decoration: none; }
a:hover { text-decoration: none; }
a:active { text-decoration: none; }
a img { border: 0px; }
div
.clear { clear: both; }
div#main-content { width: 960px; margin: auto; background-image: url(images/top.gif); background-repeat: no-repeat; background-position: left top; }
div#header { height: 125px; }
div.logo { float: left; margin-top: 35px; }
div.sign-in { float: right; margin-top: 35px; }
div#content { background-color: #ffffff; background-image: url(images/content-bg.gif); background-repeat: repeat-y; background-position: left top; }
div.intro { padding: 35px; padding-top: 10px; padding-bottom: 20px; font-size: 125%; line-height: 130%; float: left; background-image: url(images/intro-bg.gif); background-position: left bottom; background-repeat: no-repeat; }
div.intro p { margin-top: 0px; margin-bottom: 0px; }
div.register { float: right; margin-left: 40px; margin-top: 0px; margin-right: 0px; width: 400px; text-align: center;}
div.register a img { margin-bottom: 7px; }
div.register a:hover img { opacity:0.7;filter:alpha(opacity=70) }
div.features { margin-top: 20px; }
div.features h2 { margin-top: 0px; margin-bottom: 0px; font-size: 24px; color: #003A63; margin-left: 35px; margin-right: 35px; border-bottom: solid 0px #79BDE8; padding-bottom: 10px; background-image: url(images/title-bg.gif); background-repeat: no-repeat; background-position: left bottom; }
div.feature { float: left; width: 230px; margin-left: 30px; margin-top: 7px; padding: 20px; text-align: left; }
div.feature img { float: left; margin-right: 10px; width: 64px; }
div.feature h2 { margin-top: 0px; margin-bottom: 7px; color: #0499CC; font-size: 140%; line-height: 110%; font-weight: normal; border-bottom: 0px; margin-left: 0px; margin-right: 0px; padding-bottom: 0px; background-image: none; }
div.feature p { margin-top: 0px; padding-top: 0px; }
div.feature-left { margin-left: 41px; }
div#footer { height: 80px; background-image: url(images/bottom.gif); background-position: left top; background-repeat: no-repeat; padding-top: 25px; }
div#footer div.powered { color: #333333; float: right; font-size: 85%; margin-right: 10px; }
div#footer div.powered span { float: left; line-height: 23px; margin-right: 5px; }
div.footer-links { padding-bottom: 5px; padding-left: 10px; border-bottom: solid 1px #4E84C4; margin-bottom: 10px; color: #4E84C4; }
div#footer span.copyright { font-size: 90%; padding-left: 10px; }

View File

@ -0,0 +1,293 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 2009, 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.
-->
<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">
<parent>
<groupId>org.wso2.iot</groupId>
<artifactId>wso2iot-broker-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wso2iot-broker</artifactId>
<packaging>pom</packaging>
<name>WSO2 IoT Broker Distribution</name>
<url>http://wso2.com/products/message-broker</url>
<description>WSO2 IoT Broker Distribution</description>
<dependencies>
<dependency>
<groupId>org.apache.rampart</groupId>
<artifactId>rampart</artifactId>
<type>mar</type>
</dependency>
<dependency>
<groupId>slf4j.wso2</groupId>
<artifactId>slf4j</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.andes.wso2</groupId>
<artifactId>andes-client</artifactId>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs.wso2</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.commons</groupId>
<artifactId>org.wso2.carbon.event.client</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.commons</groupId>
<artifactId>org.wso2.carbon.event.client.stub</artifactId>
</dependency>
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.0-alpha-4</version>
<inherited>false</inherited>
<executions>
<execution>
<id>unpack-wso2carbon</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wso2.carbon</groupId>
<artifactId>wso2carbon-core</artifactId>
<version>${carbon.kernel.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>target</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>extract-docs-from-components</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<property name="tempdir" value="target/docs-temp" />
<mkdir dir="${tempdir}" />
<unzip dest="${tempdir}">
<fileset dir="target">
<include name="wso2iot-broker-${product.wso2iot.broker.version}.zip" />
</fileset>
</unzip>
<!-- Disabling default way of checking authorizations due to https://wso2.org/jira/browse/IDENTITY-3489-->
<replace file="target/wso2carbon-core-${carbon.kernel.version}/repository/conf/user-mgt.xml" token="&lt;Property name=&quot;GetAllRolesOfUserEnabled&quot;&gt;true&lt;/Property&gt;" value="&lt;!--Property name=&quot;GetAllRolesOfUserEnabled&quot;&gt;true&lt;/Property--&gt;" />
<copy todir="target/wso2carbon-core-${carbon.kernel.version}/repository/components/" overwrite="false">
<fileset dir="${tempdir}/wso2iot-broker-${product.wso2iot.broker.version}/repository/components/">
</fileset>
</copy>
<unzip dest="${tempdir}">
<fileset dir="target/wso2carbon-core-${carbon.kernel.version}/repository/components/plugins/">
<include name="*.ui*.jar" />
</fileset>
</unzip>
<move todir="${tempdir}/web/" includeemptydirs="false">
<fileset dir="${tempdir}/web/">
<exclude name="**/yui/**" />
<!--<exclude name="**/tenant-login/**" />-->
<exclude name="**/codepress/**" />
<exclude name="**/editarea/**" />
<exclude name="**/ajax/**" />
<exclude name="**/WEB-INF/**" />
<include name="**/*.html" />
</fileset>
<mapper type="glob" from="*.html" to="*.xml" />
</move>
<mkdir dir="src/site/xdoc" />
<copy todir="src/site/xdoc" overwrite="false" includeemptydirs="false">
<fileset dir="${tempdir}/web">
<exclude name="**/yui/**" />
<exclude name="**/codepress/**" />
<exclude name="**/editarea/**" />
<exclude name="**/ajax/**" />
<exclude name="**/WEB-INF/**" />
<exclude name="**/*.html" />
<exclude name="**/*.js" />
<exclude name="**/*.jsp" />
<exclude name="**/*.xsl" />
<exclude name="*.*" />
</fileset>
</copy>
<copy todir="target/site/" overwrite="false" includeemptydirs="false">
<fileset dir="src/site/xdoc/">
<include name="**/images/*.*" />
</fileset>
</copy>
<!--<delete dir="${tempdir}" />-->
<property name="tempdir2" value="target/identity-ui" />
<mkdir dir="${tempdir2}" />
<!--Moving "Users and Roles" to Configure Tab-->
<unzip src="target/wso2carbon-core-${carbon.kernel.version}/repository/components/plugins/org.wso2.carbon.user.mgt.ui_${carbon.identity.framework.version}.jar" dest="${tempdir2}" />
<replace file="${tempdir2}/META-INF/component.xml" token="&lt;parent-menu&gt;identity_menu&lt;/parent-menu&gt;" value="&lt;parent-menu&gt;configure_menu&lt;/parent-menu&gt;" />
<zip destfile="target/wso2carbon-core-${carbon.kernel.version}/repository/components/plugins/org.wso2.carbon.user.mgt.ui_${carbon.identity.framework.version}.jar" basedir="${tempdir2}" />
<!--Moving "User Stores" menu to Configure Tab-->
<delete dir="${tempdir2}" />
<mkdir dir="${tempdir2}" />
<unzip src="target/wso2carbon-core-${carbon.kernel.version}/repository/components/plugins/org.wso2.carbon.identity.user.store.configuration.ui_${carbon.identity.framework.version}.jar" dest="${tempdir2}" />
<replace file="${tempdir2}/META-INF/component.xml" token="&lt;parent-menu&gt;identity_menu&lt;/parent-menu&gt;" value="&lt;parent-menu&gt;configure_menu&lt;/parent-menu&gt;" />
<zip destfile="target/wso2carbon-core-${carbon.kernel.version}/repository/components/plugins/org.wso2.carbon.identity.user.store.configuration.ui_${carbon.identity.framework.version}.jar" basedir="${tempdir2}" />
<!--Moving "Keystores" menu to Configure Tab-->
<delete dir="${tempdir2}" />
<mkdir dir="${tempdir2}" />
<unzip src="target/wso2carbon-core-${carbon.kernel.version}/repository/components/plugins/org.wso2.carbon.security.mgt.ui_${carbon.identity.framework.version}.jar" dest="${tempdir2}" />
<replace file="${tempdir2}/META-INF/component.xml" token="&lt;parent-menu&gt;manage_menu&lt;/parent-menu&gt;" value="&lt;parent-menu&gt;configure_menu&lt;/parent-menu&gt;" />
<zip destfile="target/wso2carbon-core-${carbon.kernel.version}/repository/components/plugins/org.wso2.carbon.security.mgt.ui_${carbon.identity.framework.version}.jar" basedir="${tempdir2}" />
</tasks>
</configuration>
</execution>
<execution>
<id>clean_target</id>
<phase>install</phase>
<configuration>
<tasks>
<delete dir="target/archive-tmp" />
<delete dir="target/dependency-maven-plugin-markers" />
<delete dir="target/maven-archiver" />
<delete dir="target/wso2carbon-core-${carbon.kernel.version}" />
<delete dir="target/sources" />
<delete dir="target/site" />
<delete dir="src/site" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.4</version>
<reportSets>
<reportSet>
<reports>
<report>index</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</reportPlugins>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>site</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-2</version>
<executions>
<execution>
<id>pre_dist</id>
<phase>test</phase>
<goals>
<goal>attached</goal>
</goals>
<configuration>
<filters>
<filter>${basedir}/src/main/assembly/filter.properties</filter>
</filters>
<descriptors>
<descriptor>src/main/assembly/dist.xml</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>dist</id>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
<configuration>
<filters>
<filter>${basedir}/src/main/assembly/filter.properties</filter>
</filters>
<descriptors>
<descriptor>src/main/assembly/bin.xml</descriptor>
</descriptors>
<archiverConfig>
<defaultDirectoryMode>0775</defaultDirectoryMode>
<directoryMode>0775</directoryMode>
<defaultFileMode>0644</defaultFileMode>
<fileMode>0644</fileMode>
</archiverConfig>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,513 @@
<?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.
-->
<assembly>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>target/wso2carbon-core-${carbon.kernel.version}</directory>
<outputDirectory>wso2iot-broker-${pom.version}</outputDirectory>
<excludes>
<exclude>**/*.sh</exclude>
<exclude>**/*.bat</exclude>
<exclude>**/log4j.properties</exclude>
<exclude>**/services/sample01.aar</exclude>
<exclude>**/repository/services/version/**</exclude>
<exclude>**/version.txt</exclude>
<exclude>**/LICENSE.txt</exclude>
<exclude>**/launch.ini</exclude>
<exclude>**/README.txt</exclude>
<exclude>**/carbon.xml</exclude>
<exclude>**/master-datasources.xml</exclude>
<exclude>**/release-notes.html</exclude>
<exclude>**/repository/conf/axis2/axis2.xml</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>target/wso2carbon-core-${carbon.kernel.version}</directory>
<outputDirectory>wso2iot-broker-${pom.version}</outputDirectory>
<excludes>
<exclude>**/wso2server.sh</exclude>
<exclude>**/wso2server.bat</exclude>
</excludes>
<includes>
<include>**/*.sh</include>
<include>**/native/*</include>
</includes>
<fileMode>755</fileMode>
</fileSet>
<!--copying db scripts-->
<fileSet>
<directory>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/service-provider/
</directory>
<outputDirectory>${pom.artifactId}-${pom.version}/dbscripts/service-provider
</outputDirectory>
<includes>
<include>**/**.sql</include>
</includes>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<!--copying tenant-mgt.xml-->
<fileSet>
<directory>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/multitenancy/
</directory>
<outputDirectory>${pom.artifactId}-${pom.version}/repository/conf</outputDirectory>
<includes>
<include>**/tenant-mgt.xml</include>
</includes>
<fileMode>644</fileMode>
</fileSet>
<!-- MB SQL scripts -->
<fileSet>
<directory>../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/mb-store
</directory>
<outputDirectory>wso2iot-broker-${pom.version}/dbscripts/mb-store</outputDirectory>
<includes>
<include>**/*.*</include>
</includes>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<!-- End - MB SQL scripts -->
<!--samples set of product-->
<fileSet>
<directory>../../modules/samples/product/JmsQueueClient</directory>
<outputDirectory>wso2iot-broker-${pom.version}/samples/JmsQueueClient</outputDirectory>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>../../modules/samples/product/JmsTopicClient</directory>
<outputDirectory>wso2iot-broker-${pom.version}/samples/JmsTopicClient</outputDirectory>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>../../modules/samples/product/JmsMessageListenerClient</directory>
<outputDirectory>wso2iot-broker-${pom.version}/samples/JmsMessageListenerClient
</outputDirectory>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>../../modules/samples/product/HierarchicalTopicsSubscriber</directory>
<outputDirectory>wso2iot-broker-${pom.version}/samples/HierarchicalTopicsSubscriber
</outputDirectory>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>../../modules/samples/product/DurableTopicSubscriber</directory>
<outputDirectory>wso2iot-broker-${pom.version}/samples/DurableTopicSubscriber
</outputDirectory>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>../../modules/samples/product/OldJmsClientSample</directory>
<outputDirectory>wso2iot-broker-${pom.version}/samples/OldJmsClientSample</outputDirectory>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>../../modules/samples/product/services</directory>
<outputDirectory>wso2iot-broker-${pom.version}/samples/services</outputDirectory>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>../../modules/samples/product/JmsSelectors</directory>
<outputDirectory>wso2iot-broker-${pom.version}/samples/JmsSelectors</outputDirectory>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<!-- MQTT Samples -->
<fileSet>
<directory>../../modules/samples/product/SimpleMqttClient</directory>
<outputDirectory>wso2iot-broker-${pom.version}/samples/SimpleMqttClient</outputDirectory>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>../../modules/samples/product/MqttChatClient</directory>
<outputDirectory>wso2iot-broker-${pom.version}/samples/MqttChatClient</outputDirectory>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>../../modules/samples/product/MqttIoTSample</directory>
<outputDirectory>wso2iot-broker-${pom.version}/samples/MqttIoTSample</outputDirectory>
</fileSet>
<fileSet>
<directory>../../modules/samples/product/MqttRetainSample</directory>
<outputDirectory>wso2iot-broker-${pom.version}/samples/MqttRetainSample</outputDirectory>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>../../modules/samples/product/TransactionalPublisher</directory>
<outputDirectory>wso2iot-broker-${pom.version}/samples/TransactionalPublisher</outputDirectory>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>../../modules/samples/product/PerMessageAcknowledgeSample</directory>
<outputDirectory>wso2iot-broker-${pom.version}/samples/PerMessageAcknowledgeSample</outputDirectory>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>../../modules/samples/product/RedeliveryDelaySample</directory>
<outputDirectory>wso2iot-broker-${pom.version}/samples/RedeliveryDelaySample</outputDirectory>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>../../modules/samples/product/JmsExpirationSample</directory>
<outputDirectory>wso2iot-broker-${pom.version}/samples/JmsExpirationSample</outputDirectory>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<!-- messaging related configurations -->
<fileSet>
<directory>
../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/
</directory>
<outputDirectory>wso2iot-broker-${pom.version}/repository/conf
</outputDirectory>
<includes>
<include>**/broker.xml</include>
</includes>
<fileMode>644</fileMode>
</fileSet>
<!--QPID related configurations-->
<fileSet>
<directory>
../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/advanced/
</directory>
<outputDirectory>wso2iot-broker-${pom.version}/repository/conf/advanced</outputDirectory>
<includes>
<include>**/qpid-config.xml</include>
<include>**/qpid-virtualhosts.xml</include>
<include>**/qpid-jmxremote.access</include>
</includes>
<fileMode>644</fileMode>
</fileSet>
<!--Multitenancy related file -->
<fileSet>
<directory>
../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/multitenancy/
</directory>
<outputDirectory>wso2iot-broker-${pom.version}/repository/conf/multitenancy</outputDirectory>
<includes>
<include>**/stratos.xml</include>
<include>**/multitenancy-packages.xml</include>
<include>**/usage-throttling-agent-config.xml</include>
<include>**/cloud-services-desc.xml</include>
</includes>
<fileMode>644</fileMode>
</fileSet>
<!-- copy the landing page webapp -->
<fileSet>
<directory>lib/home</directory>
<outputDirectory>
wso2iot-broker-${pom.version}/repository/deployment/server/webapps/STRATOS_ROOT
</outputDirectory>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>
../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/identity/
</directory>
<outputDirectory>wso2iot-broker-${pom.version}/dbscripts/identity</outputDirectory>
<includes>
<include>**/*.sql</include>
</includes>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>../styles/service/src/main/resources/web/styles/css</directory>
<outputDirectory>${pom.artifactId}-${pom.version}/resources/allthemes/Default/admin
</outputDirectory>
<includes>
<include>**/**.css</include>
</includes>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>../styles/service/src/main/resources/web/styles/images</directory>
<outputDirectory>${pom.artifactId}-${pom.version}/resources/allthemes/Default/images
</outputDirectory>
<includes>
<include>**/**.gif</include>
<include>**/**.png</include>
</includes>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>
../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/metrics/
</directory>
<outputDirectory>wso2iot-broker-${pom.version}/dbscripts/metrics</outputDirectory>
<includes>
<include>**/*.sql</include>
</includes>
<fileMode>644</fileMode>
<directoryMode>775</directoryMode>
</fileSet>
<fileSet>
<directory>src/main/conf</directory>
<!--<outputDirectory>${pom.artifactId}-${pom.version}/repository/conf</outputDirectory>-->
<outputDirectory>wso2iot-broker-${pom.version}/repository/conf</outputDirectory>
<includes>
<include>**/broker.xml</include>
</includes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>wso2iot-broker-${pom.version}/repository/deployment/client/modules
</outputDirectory>
<includes>
<include>org.apache.rampart:rampart:mar</include>
</includes>
</dependencySet>
<dependencySet>
<outputDirectory>wso2iot-broker-${pom.version}/client-lib</outputDirectory>
<includes>
<include>org.wso2.andes.wso2:andes-client:jar</include>
<include>org.apache.geronimo.specs.wso2:geronimo-jms_1.1_spec:jar</include>
<include>org.wso2.carbon:org.wso2.carbon.event.client.stub:jar</include>
<include>org.wso2.carbon:org.wso2.carbon.event.client:jar</include>
<include>slf4j.wso2:slf4j:jar</include>
<include>log4j:log4j:jar</include>
<include>org.wso2.securevault:org.wso2.securevault:jar</include>
<include>org.wso2.carbon:org.wso2.carbon.logging:jar</include>
</includes>
</dependencySet>
<dependencySet>
<outputDirectory>wso2iot-broker-${pom.version}/repository/lib</outputDirectory>
<includes>
<include>jline:jline:jar</include>
</includes>
</dependencySet>
</dependencySets>
<files>
<file>
<source>src/main/conf/axis2.xml</source>
<outputDirectory>wso2iot-broker-${pom.version}/repository/conf/axis2</outputDirectory>
<filtered>true</filtered>
<fileMode>644</fileMode>
</file>
<file>
<source>src/main/conf/hazelcast.properties</source>
<outputDirectory>wso2iot-broker-${pom.version}/repository/conf/</outputDirectory>
<filtered>true</filtered>
<fileMode>644</fileMode>
</file>
<!--<file>
<source>target/wso2carbon-core-${carbon.kernel.version}/repository/conf/carbon.xml</source>
<outputDirectory>wso2iot-broker-${pom.version}/repository/conf/</outputDirectory>
<filtered>true</filtered>
</file>-->
<file>
<source>src/main/conf/carbon.xml
</source>
<outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/</outputDirectory>
<filtered>true</filtered>
</file>
<file>
<source>src/main/conf/messaging-event-broker.xml</source>
<outputDirectory>wso2iot-broker-${pom.version}/repository/conf</outputDirectory>
</file>
<file>
<source>src/main/resources/wso2server.sh</source>
<outputDirectory>wso2iot-broker-${pom.version}/bin/</outputDirectory>
<filtered>true</filtered>
<fileMode>755</fileMode>
</file>
<!--copying master-datasources.xml -->
<file>
<source>src/main/conf/master-datasources.xml</source>
<outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/datasources/</outputDirectory>
<fileMode>644</fileMode>
</file>
<file>
<source>
../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/repository/database/WSO2MB_DB.h2.db
</source>
<outputDirectory>${pom.artifactId}-${pom.version}/repository/database/</outputDirectory>
<fileMode>644</fileMode>
</file>
<file>
<source>src/main/resources/log4j.properties</source>
<outputDirectory>wso2iot-broker-${pom.version}/repository/conf</outputDirectory>
<filtered>true</filtered>
<fileMode>755</fileMode>
</file>
<!-- Setting jamm javaagent in bam -->
<file>
<source>src/main/resources/launch.ini</source>
<outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/etc</outputDirectory>
<filtered>true</filtered>
<fileMode>644</fileMode>
</file>
<file>
<source>src/main/resources/wso2server.bat</source>
<outputDirectory>wso2iot-broker-${pom.version}/bin/</outputDirectory>
<filtered>true</filtered>
<fileMode>755</fileMode>
</file>
<file>
<source>src/main/resources/LICENSE.txt</source>
<outputDirectory>wso2iot-broker-${pom.version}</outputDirectory>
<filtered>true</filtered>
<fileMode>644</fileMode>
</file>
<file>
<source>src/main/resources/README.txt</source>
<outputDirectory>wso2iot-broker-${pom.version}</outputDirectory>
<filtered>true</filtered>
<fileMode>644</fileMode>
</file>
<file>
<source>src/main/resources/release-notes.xml</source>
<outputDirectory>wso2iot-broker-${pom.version}</outputDirectory>
<destName>release-notes.html</destName>
<fileMode>644</fileMode>
</file>
<file>
<source>target/wso2carbon-core-${carbon.kernel.version}/bin/README.txt</source>
<outputDirectory>wso2iot-broker-${pom.version}/bin/</outputDirectory>
<filtered>true</filtered>
<fileMode>644</fileMode>
</file>
<file>
<source>target/wso2carbon-core-${carbon.kernel.version}/bin/version.txt</source>
<outputDirectory>wso2iot-broker-${pom.version}/bin/</outputDirectory>
<filtered>true</filtered>
<fileMode>644</fileMode>
</file>
<file>
<source>
../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/etc/logging-config.xml
</source>
<outputDirectory>wso2iot-broker-${pom.version}/repository/conf/etc/</outputDirectory>
<fileMode>644</fileMode>
</file>
<!--<file>
<source>
../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/identity.xml
</source>
<outputDirectory>wso2iot-broker-${pom.version}/repository/conf/</outputDirectory>
<filtered>true</filtered>
</file>-->
<!-- <file>
<source>../../modules/samples/product/services/EventSinkService/EventSinkService.aar
</source>
<outputDirectory>wso2iot-broker-${pom.version}/repository/deployment/server/axis2services/
</outputDirectory>
<fileMode>644</fileMode>
</file>-->
<file>
<source>../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/metrics.properties</source>
<outputDirectory>wso2iot-broker-${pom.version}/repository/conf/</outputDirectory>
<filtered>false</filtered>
<fileMode>644</fileMode>
</file>
<file>
<source>src/main/conf/metrics.xml</source>
<outputDirectory>wso2iot-broker-${pom.version}/repository/conf/</outputDirectory>
<filtered>false</filtered>
<fileMode>644</fileMode>
</file>
<file>
<source>../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/datasources/metrics-datasources.xml</source>
<outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/datasources/</outputDirectory>
<fileMode>644</fileMode>
</file>
<file>
<source>../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/repository/database/WSO2METRICS_DB.h2.db</source>
<outputDirectory>${pom.artifactId}-${pom.version}/repository/database/</outputDirectory>
<fileMode>644</fileMode>
</file>
<!-- Cipher Tool Files -->
<file>
<source>src/main/conf/cipher-text.properties</source>
<outputDirectory>wso2iot-broker-${pom.version}/repository/conf/security</outputDirectory>
<filtered>true</filtered>
<fileMode>644</fileMode>
</file>
<file>
<source>src/main/conf/cipher-tool.properties</source>
<outputDirectory>wso2iot-broker-${pom.version}/repository/conf/security</outputDirectory>
<filtered>true</filtered>
<fileMode>644</fileMode>
</file>
<file>
<source>../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/bin/ciphertool.sh</source>
<outputDirectory>${pom.artifactId}-${pom.version}/bin</outputDirectory>
<fileMode>755</fileMode>
</file>
<file>
<source>../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/bin/ciphertool.bat</source>
<outputDirectory>${pom.artifactId}-${pom.version}/bin</outputDirectory>
<fileMode>644</fileMode>
</file>
<file>
<source>../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/lib/org.wso2.ciphertool-${cipher.tool.version}.jar</source>
<outputDirectory>${pom.artifactId}-${pom.version}/lib</outputDirectory>
<fileMode>644</fileMode>
</file>
<!--End of Cipher Tool Files-->
<file>
<source>../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/identity/identity.xml</source>
<outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/identity</outputDirectory>
<fileMode>644</fileMode>
</file>
<file>
<source>
../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/data-bridge/data-agent-config.xml
</source>
<outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/data-bridge</outputDirectory>
<filtered>true</filtered>
<fileMode>644</fileMode>
</file>
<!-- Copying broker.xml -->
<file>
<source>src/main/conf/broker.xml</source>
<!-- <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf</outputDirectory>-->
<outputDirectory>wso2iot-broker-${pom.version}/repository/conf</outputDirectory>
<fileMode>644</fileMode>
</file>
</files>
</assembly>

View File

@ -0,0 +1,36 @@
<!--
~ 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.
-->
<assembly>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<!-- Copying p2 profile and osgi bundles-->
<fileSet>
<directory>../p2-profile/target/wso2carbon-core-${carbon.kernel.version}/repository/components</directory>
<outputDirectory>wso2iot-broker-${pom.version}/repository/components</outputDirectory>
<excludes>
<exclude>**/eclipse.ini</exclude>
<exclude>**/*.lock</exclude>
<exclude>**/.data</exclude>
<exclude>**/.settings</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>

View File

@ -0,0 +1,6 @@
product.name=WSO2 Message Broker
product.key=MB
product.version=1.0.0.SNAPSHOT
carbon.version=4.9.0
mb.version=1.0.0.SNAPSHOT
default.server.role=MessageBroker

View File

@ -0,0 +1,725 @@
<!--
~ Copyright (c) 2015, 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.
-->
<axisconfig name="AxisJava2.0">
<!-- ================================================= -->
<!-- Globally engaged modules -->
<!-- ================================================= -->
<module ref="addressing"/>
<!-- ================================================= -->
<!-- Parameters -->
<!-- ================================================= -->
<parameter name="hotdeployment">${hotdeployment}</parameter>
<parameter name="hotupdate">${hotupdate}</parameter>
<parameter name="enableMTOM" locked="false">optional</parameter>
<parameter name="cacheAttachments">true</parameter>
<parameter name="attachmentDIR">work/mtom</parameter>
<parameter name="sizeThreshold">4000</parameter>
<parameter name="EnableChildFirstClassLoading">${childfirstCL}</parameter>
<!--
The exposeServiceMetadata parameter decides whether the metadata (WSDL, schema, policy) of
the services deployed on Axis2 should be visible when ?wsdl, ?wsdl2, ?xsd, ?policy requests
are received.
This parameter can be defined in the axi2.xml file, in which case this will be applicable
globally, or in the services.xml files, in which case, it will be applicable to the
Service groups and/or services, depending on the level at which the parameter is declared.
This value of this parameter defaults to true.
-->
<parameter name="exposeServiceMetadata">true</parameter>
<!--If turned on with use the Accept header of the request to determine the contentType of the
response-->
<parameter name="httpContentNegotiation">true</parameter>
<!--
Defines how the persistence of WS-ReliableMessaging is handled
Possible value are: inmemory & persistent
-->
<!-- Following parameter will completely disable REST handling in both the servlets-->
<parameter name="disableREST" locked="false">false</parameter>
<parameter name="Sandesha2StorageManager">inmemory</parameter>
<!-- This deployment interceptor will be called whenever before a module is initialized or
service is deployed -->
<listener class="org.wso2.carbon.core.deployment.DeploymentInterceptor"/>
<!-- setting servicePath. contextRoot is defined in the carbon.xml file -->
<!-- modification of this variable should be accompanied by the change in 'ServerURL' in carbon.xml file -->
<parameter name="servicePath">services</parameter>
<!--the directory in which .aar services are deployed inside axis2 repository-->
<parameter name="ServicesDirectory">axis2services</parameter>
<!--the directory in which modules are deployed inside axis2 repository-->
<parameter name="ModulesDirectory">axis2modules</parameter>
<parameter name="userAgent" locked="true">
WSO2 Message Broker-3.0.0-SNAPSHOT
</parameter>
<parameter name="server" locked="true">
WSO2 Message Broker-3.0.0-SNAPSHOT
</parameter>
<!-- ========================================================================-->
<!--During a fault, stacktrace can be sent with the fault message. The following flag will control -->
<!--that behaviour.-->
<parameter name="sendStacktraceDetailsWithFaults">false</parameter>
<!--If there aren't any information available to find out the fault reason, we set the message of the expcetion-->
<!--as the faultreason/Reason. But when a fault is thrown from a service or some where, it will be -->
<!--wrapped by different levels. Due to this the initial exception message can be lost. If this flag-->
<!--is set then, Axis2 tries to get the first exception and set its message as the faultreason/Reason.-->
<parameter name="DrillDownToRootCauseForFaultReason">false</parameter>
<!--Set the flag to true if you want to enable transport level session mangment-->
<parameter name="manageTransportSession">true</parameter>
<!-- Synapse Configuration file -->
<parameter name="SynapseConfig.ConfigurationFile" locked="false">
./repository/deployment/server/synapse-configs
</parameter>
<!-- Synapse Home parameter -->
<parameter name="SynapseConfig.HomeDirectory" locked="false">.</parameter>
<!-- Resolve root used to resolve synapse references like schemas inside a WSDL -->
<parameter name="SynapseConfig.ResolveRoot" locked="false">.</parameter>
<!-- Synapse Server name parameter -->
<parameter name="SynapseConfig.ServerName" locked="false">WSO2 Carbon Server</parameter>
<!--By default, JAXWS services are created by reading annotations. WSDL and schema are generated-->
<!--using a separate WSDL generator only when ?wsdl is called. Therefore, even if you engage-->
<!--policies etc.. to AxisService, it doesn't appear in the WSDL. By setting the following property-->
<!--to true, you can create the AxisService using the generated WSDL and remove the need for a-->
<!--WSDL generator. When ?wsdl is called, WSDL is generated in the normal way.-->
<parameter name="useGeneratedWSDLinJAXWS">${jaxwsparam}</parameter>
<!-- Deployer for the dataservice. -->
<!--<deployer extension="dbs" directory="dataservices" class="org.wso2.dataservices.DBDeployer"/>-->
<!-- Axis1 deployer for Axis2-->
<!--<deployer extension="wsdd" class="org.wso2.carbon.axis1services.Axis1Deployer" directory="axis1services"/>-->
<!-- POJO service deployer for Jar -->
<!--<deployer extension="jar" class="org.apache.axis2.deployment.POJODeployer" directory="pojoservices"/>-->
<!-- POJO service deployer for Class -->
<!--<deployer extension="class" class="org.apache.axis2.deployment.POJODeployer" directory="pojoservices"/>-->
<!-- JAXWS service deployer -->
<!--<deployer extension=".jar" class="org.apache.axis2.jaxws.framework.JAXWSDeployer" directory="servicejars"/>-->
<!-- ================================================= -->
<!-- Message Receivers -->
<!-- ================================================= -->
<!--This is the Default Message Receiver for the system , if you want to have MessageReceivers for -->
<!--all the other MEP implement it and add the correct entry to here , so that you can refer from-->
<!--any operation -->
<!--Note : You can ovride this for particular service by adding the same element with your requirement-->
<messageReceivers>
<messageReceiver mep="http://www.w3.org/ns/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
<messageReceiver mep="http://www.w3.org/ns/wsdl/robust-in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
<messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</messageReceivers>
<messageFormatters>
<messageFormatter contentType="application/x-www-form-urlencoded"
class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
<messageFormatter contentType="multipart/form-data"
class="org.apache.axis2.transport.http.MultipartFormDataFormatter"/>
<messageFormatter contentType="application/xml"
class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
<messageFormatter contentType="text/xml"
class="org.apache.axis2.transport.http.SOAPMessageFormatter"/>
<messageFormatter contentType="application/soap+xml"
class="org.apache.axis2.transport.http.SOAPMessageFormatter"/>
<!--JSON Message Formatters-->
<!--messageFormatter contentType="application/json"
class="org.apache.axis2.json.JSONMessageFormatter"/-->
<messageFormatter contentType="application/json"
class="org.apache.axis2.json.gson.JsonFormatter" />
<messageFormatter contentType="application/json/badgerfish"
class="org.apache.axis2.json.JSONBadgerfishMessageFormatter"/>
<!--messageFormatter contentType="text/javascript"
class="org.apache.axis2.json.JSONMessageFormatter"/-->
<messageFormatter contentType="text/javascript"
class="org.apache.axis2.json.gson.JsonFormatter" />
<!--messageFormatter contentType="application/x-www-form-urlencoded"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<!--messageFormatter contentType="multipart/form-data"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<!--messageFormatter contentType="application/xml"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<!--messageFormatter contentType="text/html"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<!--messageFormatter contentType="application/soap+xml"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<!--messageFormatter contentType="x-application/hessian"
class="org.apache.synapse.format.hessian.HessianMessageFormatter"/-->
<!--<messageFormatter contentType="">
class="org.apache.synapse.format.hessian.HessianMessageFormatter"/-->
</messageFormatters>
<messageBuilders>
<messageBuilder contentType="application/xml"
class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
<messageBuilder contentType="application/x-www-form-urlencoded"
class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
<messageBuilder contentType="multipart/form-data"
class="org.apache.axis2.builder.MultipartFormDataBuilder"/>
<!--JSON Message Builders-->
<!--messageBuilder contentType="application/json"
class="org.apache.axis2.json.JSONOMBuilder"/-->
<messageBuilder contentType="application/json"
class="org.apache.axis2.json.gson.JsonBuilder" />
<messageBuilder contentType="application/json/badgerfish"
class="org.apache.axis2.json.JSONBadgerfishOMBuilder"/>
<!--messageBuilder contentType="text/javascript"
class="org.apache.axis2.json.JSONOMBuilder"/-->
<messageBuilder contentType="text/javascript"
class="org.apache.axis2.json.gson.JsonBuilder" />
<!--messageBuilder contentType="application/xml"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<!--messageBuilder contentType="application/x-www-form-urlencoded"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<!--messageBuilder contentType="multipart/form-data"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<!--messageBuilder contentType="multipart/related"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<!--messageBuilder contentType="application/soap+xml"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<!--messageBuilder contentType="text/plain"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<!--messageBuilder contentType="text/xml"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<!--messageFormatter contentType="text/plain"
class="org.apache.axis2.format.PlainTextBuilder"/-->
<!--messageBuilder contentType="x-application/hessian"
class="org.apache.synapse.format.hessian.HessianMessageBuilder"/-->
</messageBuilders>
<!-- ================================================= -->
<!-- In Transports -->
<!-- ================================================= -->
<transportReceiver name="http"
class="org.wso2.carbon.core.transports.http.HttpTransportListener">
<!--
Uncomment the following if you are deploying this within an application server. You
need to specify the HTTP port of the application server
-->
<parameter name="port">9763</parameter>
<!--
Uncomment the following to enable any proxy like Apache2 mod_proxy or any load balancer. The port on the proxy server like Apache is 80
in this case.
-->
<!--<parameter name="proxyPort">80</parameter>-->
</transportReceiver>
<!--Please uncomment this in Multiple Instance Scenario if you want to use NIO Transport Recievers and
Remove the current transport REceivers in axis2.xml -->
<!--transportReceiver name="http" class="org.apache.synapse.transport.nhttp.HttpCoreNIOListener">
<parameter name="port" locked="false">8280</parameter>
<parameter name="non-blocking" locked="false">true</parameter>
</transportReceiver>
<transportReceiver name="https" class="org.apache.synapse.transport.nhttp.HttpCoreNIOSSLListener">
<parameter name="port" locked="false">8243</parameter>
<parameter name="non-blocking" locked="false">true</parameter>
<parameter name="keystore" locked="false">
<KeyStore>
<Location>repository/resources/security/wso2carbon.jks</Location>
<Type>JKS</Type>
<Password>wso2carbon</Password>
<KeyPassword>wso2carbon</KeyPassword>
</KeyStore>
</parameter>
<parameter name="truststore" locked="false">
<TrustStore>
<Location>repository/resources/security/client-truststore.jks</Location>
<Type>JKS</Type>
<Password>wso2carbon</Password>
</TrustStore>
</parameter>
</transportReceiver-->
<transportReceiver name="https"
class="org.wso2.carbon.core.transports.http.HttpsTransportListener">
<!--
Uncomment the following if you are deploying this within an application server. You
need to specify the HTTPS port of the application server
-->
<parameter name="port">9443</parameter>
<!--
Uncomment the following to enable any proxy like Apache2 mod_proxy or any load balancer. The port on a proxy server like Apache is 443
in this case.
-->
<!--<parameter name="proxyPort">443</parameter>-->
</transportReceiver>
<!--
Uncomment the following segment to enable TCP transport.
Note : Addressing module should be engaged for TCP transport to work
-->
<!--<transportReceiver name="tcp"
class="org.apache.axis2.transport.tcp.TCPServer">
<parameter name="port">6667</parameter>
</transportReceiver>-->
<!--
To Enable Mail Transport Listener, please uncomment the following.
-->
<!--<transportReceiver name="mailto" class="org.apache.axis2.transport.mail.MailTransportListener">
</transportReceiver>-->
<!--
Uncomment this and configure as appropriate for JMS transport support,
after setting up your JMS environment (e.g. ActiveMQ)
-->
<!--<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="myTopicConnectionFactory">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</parameter>
</parameter>
<parameter name="myQueueConnectionFactory">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
</parameter>
<parameter name="default">
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
</parameter>
</transportReceiver>-->
<!--Uncomment this and configure as appropriate for JMS transport support with Apache Qpid -->
<!--transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="myTopicConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.qpid.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
</parameter>
<parameter name="myQueueConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.qpid.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
<parameter name="default" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.qpid.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
</transportReceiver-->
<!--Uncomment this and configure as appropriate for JMS transport support with WSO2 MB 3.x.x -->
<!--transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="myTopicConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
</parameter>
<parameter name="myQueueConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
<parameter name="default" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">repository/conf/jndi.properties</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
</transportReceiver-->
<!-- ================================================= -->
<!-- Out Transports -->
<!-- ================================================= -->
<!--<transportSender name="tcp"
class="org.apache.axis2.transport.tcp.TCPTransportSender"/>-->
<transportReceiver name="local"
class="org.wso2.carbon.core.transports.local.CarbonLocalTransportReceiver"/>
<transportSender name="local"
class="org.wso2.carbon.core.transports.local.CarbonLocalTransportSender"/>
<!--<transportSender name="jms"
class="org.apache.axis2.transport.jms.JMSSender"/>-->
<transportSender name="http"
class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
<parameter name="PROTOCOL">HTTP/1.1</parameter>
<parameter name="Transfer-Encoding">chunked</parameter>
<!-- This parameter has been added to overcome problems encounted in SOAP action parameter -->
<parameter name="OmitSOAP12Action">true</parameter>
</transportSender>
<transportSender name="https"
class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
<parameter name="PROTOCOL">HTTP/1.1</parameter>
<parameter name="Transfer-Encoding">chunked</parameter>
<!-- This parameter has been added to overcome problems encounted in SOAP action parameter -->
<parameter name="OmitSOAP12Action">true</parameter>
</transportSender>
<!-- To enable mail transport sender, ncomment the following and change the parameters
accordingly-->
<!--<transportSender name="mailto"
class="org.apache.axis2.transport.mail.MailTransportSender">
<parameter name="mail.smtp.from">wso2demomail@gmail.com</parameter>
<parameter name="mail.smtp.user">wso2demomail</parameter>
<parameter name="mail.smtp.password">mailpassword</parameter>
<parameter name="mail.smtp.host">smtp.gmail.com</parameter>
<parameter name="mail.smtp.port">587</parameter>
<parameter name="mail.smtp.starttls.enable">true</parameter>
<parameter name="mail.smtp.auth">true</parameter>
</transportSender>-->
<!--Please uncomment this in Multiple Instance Scenario if you want to use NIO sender -->
<!--
<transportSender name="http" class="org.apache.synapse.transport.nhttp.HttpCoreNIOSender">
<parameter name="non-blocking" locked="false">true</parameter>
</transportSender>
<transportSender name="https" class="org.apache.synapse.transport.nhttp.HttpCoreNIOSSLSender">
<parameter name="non-blocking" locked="false">true</parameter>
<parameter name="keystore" locked="false">
<KeyStore>
<Location>repository/resources/security/wso2carbon.jks</Location>
<Type>JKS</Type>
<Password>wso2carbon</Password>
<KeyPassword>wso2carbon</KeyPassword>
</KeyStore>
</parameter>
<parameter name="truststore" locked="false">
<TrustStore>
<Location>repository/resources/security/client-truststore.jks</Location>
<Type>JKS</Type>
<Password>wso2carbon</Password>
</TrustStore>
</parameter>
</transportSender>
-->
<!-- ================================================= -->
<!-- Phases -->
<!-- ================================================= -->
<phaseOrder type="InFlow">
<!-- System pre defined phases -->
<!--
The MsgInObservation phase is used to observe messages as soon as they are
received. In this phase, we could do some things such as SOAP message tracing & keeping
track of the time at which a particular message was received
NOTE: This should be the very first phase in this flow
-->
<phase name="MsgInObservation"/>
<phase name="Validation"/>
<phase name="Transport">
<handler name="RequestURIBasedDispatcher"
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
<order phase="Transport"/>
</handler>
<handler name="SOAPActionBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
<order phase="Transport"/>
</handler>
<handler name="RequestURIOperationDispatcher"
class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher" />
<handler name="JSONMessageHandler"
class="org.apache.axis2.json.gson.JSONMessageHandler" />
</phase>
<phase name="Addressing">
<handler name="AddressingBasedDispatcher"
class="org.wso2.carbon.core.multitenancy.MultitenantAddressingBasedDispatcher">
<order phase="Addressing"/>
</handler>
</phase>
<phase name="Ghost">
<handler name="GhostDispatcher"
class="org.wso2.carbon.core.dispatchers.GhostDispatcher"/>
</phase>
<phase name="Security"/>
<phase name="PreDispatch"/>
<phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
<handler name="RequestURIBasedDispatcher"
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
<handler name="SOAPActionBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
<handler name="SOAPMessageBodyBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
<handler name="HTTPLocationBasedDispatcher"
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
</phase>
<!-- System pre defined phases -->
<phase name="RMPhase"/>
<phase name="OpPhase"/>
<!-- After Postdispatch phase module author or or service author can add any phase he want -->
<phase name="OperationInPhase"/>
</phaseOrder>
<phaseOrder type="OutFlow">
<!-- Handlers related to unified-endpoint component are added to the UEPPhase -->
<phase name="UEPPhase"/>
<phase name="RMPhase"/>
<phase name="OpPhase"/>
<!-- user can add his own phases to this area -->
<phase name="OperationOutPhase"/>
<!--system predefined phase-->
<!--these phase will run irrespective of the service-->
<phase name="PolicyDetermination"/>
<phase name="MessageOut"/>
<phase name="Security"/>
<!--
The MsgOutObservation phase is used to observe messages just before the
responses are sent out. In this phase, we could do some things such as SOAP message
tracing & keeping track of the time at which a particular response was sent.
NOTE: This should be the very last phase in this flow
-->
<phase name="MsgOutObservation"/>
<!--Following phase is added to publish stats -->
<phase name="StatReporting"/>
</phaseOrder>
<phaseOrder type="InFaultFlow">
<!-- System pre defined phases -->
<!--
The MsgInObservation phase is used to observe messages as soon as they are
received. In this phase, we could do some things such as SOAP message tracing & keeping
track of the time at which a particular message was received
NOTE: This should be the very first phase in this flow
-->
<phase name="MsgInObservation"/>
<phase name="Validation"/>
<phase name="Transport">
<handler name="RequestURIBasedDispatcher"
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
<order phase="Transport"/>
</handler>
<handler name="SOAPActionBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
<order phase="Transport"/>
</handler>
</phase>
<phase name="Addressing">
<handler name="AddressingBasedDispatcher"
class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
<order phase="Addressing"/>
</handler>
</phase>
<phase name="Ghost">
<handler name="GhostDispatcher"
class="org.wso2.carbon.core.dispatchers.GhostDispatcher"/>
</phase>
<phase name="Security"/>
<phase name="PreDispatch"/>
<phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
<handler name="RequestURIBasedDispatcher"
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
<handler name="SOAPActionBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
<handler name="SOAPMessageBodyBasedDispatcher"
class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
<handler name="HTTPLocationBasedDispatcher"
class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
</phase>
<phase name="RMPhase"/>
<phase name="OpPhase"/>
<!-- user can add his own phases to this area -->
<phase name="OperationInFaultPhase"/>
</phaseOrder>
<phaseOrder type="OutFaultFlow">
<!-- Handlers related to unified-endpoint component are added to the UEPPhase -->
<phase name="UEPPhase"/>
<phase name="RMPhase"/>
<!-- user can add his own phases to this area -->
<phase name="OperationOutFaultPhase"/>
<phase name="PolicyDetermination"/>
<phase name="MessageOut"/>
<phase name="Security"/>
<phase name="Transport"/>
<!--
The MsgOutObservation phase is used to observe messages just before the
responses are sent out. In this phase, we could do some things such as SOAP message
tracing & keeping track of the time at which a particular response was sent.
NOTE: This should be the very last phase in this flow
-->
<phase name="MsgOutObservation"/>
<!--Following phase is added to publish stats -->
<phase name="StatReporting"/>
</phaseOrder>
<clustering class="org.wso2.carbon.core.clustering.hazelcast.HazelcastClusteringAgent"
enable="false">
<!--
This parameter indicates whether the cluster has to be automatically initalized
when the AxisConfiguration is built. If set to "true" the initialization will not be
done at that stage, and some other party will have to explictly initialize the cluster.
-->
<parameter name="AvoidInitiation">true</parameter>
<!--
The membership scheme used in this setup. The only values supported at the moment are
"multicast" and "wka"
1. multicast - membership is automatically discovered using multicasting
2. wka - Well-Known Address based multicasting. Membership is discovered with the help
of one or more nodes running at a Well-Known Address. New members joining a
cluster will first connect to a well-known node, register with the well-known node
and get the membership list from it. When new members join, one of the well-known
nodes will notify the others in the group. When a member leaves the cluster or
is deemed to have left the cluster, it will be detected by the Group Membership
Service (GMS) using a TCP ping mechanism.
-->
<parameter name="membershipScheme">multicast</parameter>
<!--<parameter name="licenseKey">xxx</parameter>-->
<!--<parameter name="mgtCenterURL">http://localhost:8081/mancenter/</parameter>-->
<!--
The clustering domain/group. Nodes in the same group will belong to the same multicast
domain. There will not be interference between nodes in different groups.
-->
<parameter name="domain">wso2.carbon.domain</parameter>
<!-- The multicast address to be used -->
<!--<parameter name="mcastAddress">228.0.0.4</parameter>-->
<!-- The multicast port to be used -->
<parameter name="mcastPort">45564</parameter>
<parameter name="mcastTTL">100</parameter>
<parameter name="mcastTimeout">60</parameter>
<!--
The IP address of the network interface to which the multicasting has to be bound to.
Multicasting would be done using this interface.
-->
<!--
<parameter name="mcastBindAddress">127.0.0.1</parameter>
-->
<!-- The host name or IP address of this member -->
<parameter name="localMemberHost">127.0.0.1</parameter>
<!--
The bind adress of this member. The difference between localMemberHost & localMemberBindAddress
is that localMemberHost is the one that is advertised by this member, while localMemberBindAddress
is the address to which this member is bound to.
-->
<!--
<parameter name="localMemberBindAddress">127.0.0.1</parameter>
-->
<!--
The TCP port used by this member. This is the port through which other nodes will
contact this member
-->
<parameter name="localMemberPort">4000</parameter>
<!--
The bind port of this member. The difference between localMemberPort & localMemberBindPort
is that localMemberPort is the one that is advertised by this member, while localMemberBindPort
is the port to which this member is bound to.
-->
<!--
<parameter name="localMemberBindPort">4001</parameter>
-->
<!--
Properties specific to this member
-->
<parameter name="properties">
<property name="backendServerURL" value="https://${hostName}:${httpsPort}/services/"/>
<property name="mgtConsoleURL" value="https://${hostName}:${httpsPort}/"/>
<property name="subDomain" value="worker"/>
</parameter>
<!--
Following parameters will load custom Hazelcast data serializers.
-->
<parameter name="hazelcastSerializers">
<serializer typeClass="org.wso2.andes.server.cluster.coordination.hazelcast.custom.serializer.wrapper.TreeSetLongWrapper">org.wso2.andes.server.cluster.coordination.hazelcast.custom.serializer.TreeSetLongWrapperSerializer</serializer>
<serializer typeClass="org.wso2.andes.server.cluster.coordination.hazelcast.custom.serializer.wrapper.TreeSetSlotWrapper">org.wso2.andes.server.cluster.coordination.hazelcast.custom.serializer.TreeSetSlotWrapperSerializer</serializer>
<serializer typeClass="org.wso2.andes.server.cluster.coordination.hazelcast.custom.serializer.wrapper.HashmapStringTreeSetWrapper">org.wso2.andes.server.cluster.coordination.hazelcast.custom.serializer.HashMapStringTreeSetWrapperSerializer</serializer>
</parameter>
<!--
The list of static or well-known members. These entries will only be valid if the
"membershipScheme" above is set to "wka"
-->
<members>
<member>
<hostName>127.0.0.1</hostName>
<port>4000</port>
</member>
</members>
<!--
Enable the groupManagement entry if you need to run this node as a cluster manager.
Multiple application domains with different GroupManagementAgent implementations
can be defined in this section.
-->
<groupManagement enable="false">
<applicationDomain name="wso2.as.domain"
description="AS group"
agent="org.wso2.carbon.core.clustering.hazelcast.HazelcastGroupManagementAgent"
subDomain="worker"
port="2222"/>
</groupManagement>
</clustering>
</axisconfig>

View File

@ -0,0 +1,575 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 2015, 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.
-->
<!-- This is the root configuration file of WSO2 Message Broker (MB). Links to configurations of
associated libraries are also specified here.
[Note for developers] - If you intend to rename or modify a property name, remember to update
relevant, org.wso2.andes.configuration.enums.AndesConfiguration, enum value using the Xpath
expression of the property.
This file is ciphertool compliant. Refer PRODUCT_HOME/repository/conf/security/cipher-text.properties for examples.-->
<broker>
<coordination>
<!-- You can override the cluster node identifier of this MB node using the nodeID.
If it is left as "default", the default node ID will be generated for it. (Using IP + UUID).
The node ID of each member should ALWAYS be unique.-->
<nodeID>default</nodeID>
<!-- Thrift is used to maintain and sync slot (message groups) ranges between MB nodes. -->
<thriftServerHost>localhost</thriftServerHost>
<thriftServerPort>7611</thriftServerPort>
<thriftSOTimeout>0</thriftSOTimeout>
<!--Thrift server reconnect timeout. Value specified in SECONDS-->
<thriftServerReconnectTimeout>5</thriftServerReconnectTimeout>
<!-- Hazelcast reliable topics are used to share all notifications across the MB cluster (e.g. subscription
changes), And this property defines the time-to-live for a notification since its creation. (in Seconds) -->
<clusterNotificationTimeout>10</clusterNotificationTimeout>
<!-- Configurations related RDBMS based coordination algorithm -->
<rdbmsBasedCoordination enabled="false">
<!-- Heartbeat interval used in the RDBMS base coordination algorithm in milliseconds -->
<heartbeatInterval>5000</heartbeatInterval>
<!-- Time to wait before informing others about coordinator change in milliseconds. This value should be
larger than a database read time including network latency and should be less than heartbeatInterval -->
<coordinatorEntryCreationWaitTime>3000</coordinatorEntryCreationWaitTime>
<!-- Time interval used to poll database for membership related events in milliseconds. -->
<eventPollingInterval>4000</eventPollingInterval>
</rdbmsBasedCoordination>
<!-- Enabling this will make the cluster notifications such as Queue changes(additions and deletions),
Subscription changes, etc. sent within the cluster be synchronized using RDBMS. If set to false, Hazelcast
will be used for this purpose.-->
<RDBMSBasedClusterEventSynchronization enabled="false">
<!--Specifies the interval at which, the cluster events will be read from the database. Needs to be
declared in milliseconds. Setting this to a very low value could downgrade the performance where as
setting this to a large value could increase the time taken for a cluster event to be synchronized in
all the nodes in a cluster.-->
<eventSyncInterval>1000</eventSyncInterval>
</RDBMSBasedClusterEventSynchronization>
</coordination>
<!-- You can enable/disable specific messaging transports in this section. By default all
transports are enabled. This section also allows you to customize the messaging flows used
within WSO2 MB. NOT performance related, but logic related. -->
<transports>
<amqp enabled="true">
<bindAddress>0.0.0.0</bindAddress>
<defaultConnection enabled="true" port="5672" />
<sslConnection enabled="true" port="8672">
<keyStore>
<location>repository/resources/security/wso2carbon.jks</location>
<password>wso2carbon</password>
<certType>SunX509</certType>
</keyStore>
<trustStore>
<location>repository/resources/security/client-truststore.jks</location>
<password>wso2carbon</password>
<certType>SunX509</certType>
</trustStore>
</sslConnection>
<maximumRedeliveryAttempts>10</maximumRedeliveryAttempts>
<allowSharedTopicSubscriptions>false</allowSharedTopicSubscriptions>
<allowStrictNameValidation>true</allowStrictNameValidation>
<!-- Refer repository/conf/advanced/qpid-config.xml for further AMQP-specific configurations.-->
</amqp>
<mqtt enabled="true">
<bindAddress>0.0.0.0</bindAddress>
<defaultConnection enabled="true" port="1883" />
<sslConnection enabled="true" port="8883">
<keyStore>
<location>repository/resources/security/wso2carbon.jks</location>
<password>wso2carbon</password>
<certType>SunX509</certType>
</keyStore>
<trustStore>
<location>repository/resources/security/client-truststore.jks</location>
<password>wso2carbon</password>
<certType>SunX509</certType>
</trustStore>
</sslConnection>
<!--All receiving events/messages will be in this ring buffer. Ring buffer size
of MQTT inbound event disruptor. Default is set to 32768 (1024 * 32)
Having a large ring buffer will have a increase memory usage and will improve performance
and vise versa -->
<inboundBufferSize>32768</inboundBufferSize>
<!-- Messages delivered to clients will be placed in this ring buffer.
Ring buffer size of MQTT delivery event disruptor. Default is set to 32768 (1024 * 32)
Having a large ring buffer will have a increase memory usage and will improve performance
and vise versa -->
<deliveryBufferSize>32768</deliveryBufferSize>
<security>
<!--
Instructs the MQTT server whether clients should always send credentials
when establishing a connection.
Possible values:
OPTIONAL: This is the default value. MQTT clients may or may not send
credentials. If a client sends credentials server will
validates it.
If client doesn't send credentials then server will not
authenticate, but allows client to establish the connection.
This behavior adheres to MQTT 3.1 specification.
REQUIRED: Clients should always provide credentials when connecting.
If client doesn't send credentials or they are invalid
server rejects the connection.
-->
<authentication>REQUIRED</authentication>
<!--Class name of the authenticator to use. class should
inherit from org.dna.mqtt.moquette.server.IAuthenticator
Note: default implementation authenticates against carbon user store
based on supplied username/password
-->
<authenticator class="org.wso2.carbon.andes.authentication.andes.OAuth2BasedMQTTAuthenticator">
<property name="hostURL">https://localhost:9443/services/OAuth2TokenValidationService</property>
<property name="username">admin</property>
<property name="password">admin</property>
<property name="maxConnectionsPerHost">10</property>
<property name="maxTotalConnections">150</property>
</authenticator>
<!--
Instructs the MQTT server whether clients should be authorized before either publishing or subscribing
Possible values:
NOT_REQUIRED: This is the default value. MQTT clients will skip the authorization check
REQUIRED: Clients will authorized before publishing. this will execute the class given in authorzier
Note: authentication should be REQUIRED for authorization to be REQUIRED.
-->
<authorization>REQUIRED</authorization>
<!--Class name of the authorizer to use. class should
inherit from org.dna.mqtt.moquette.server.IAutherizer
Note: default implementation authorizes against carbon permission with the topic.
-->
<!--connectionPermission is required for a user to connect to broker-->
<authorizer class="org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.DeviceAccessBasedMQTTAuthorizer">
<property name="connectionPermission">/permission/admin/device-mgt/user</property>
<property name="adminPermission">/permission/admin/device-mgt/admin</property>
<property name="MQTTSubscriberScopeIdentifier">mqtt-subscriber</property>
<property name="MQTTPublisherScopeIdentifier">mqtt-subscriber</property>
<property name="devicemgtScopeIdentifier">device-mgt</property>
</authorizer>
</security>
</mqtt>
</transports>
<!-- Depending on the database type selected in master-datasources.xml, you must enable the
relevant Data access classes here. Currently WSO2 MB Supports RDBMS(any RDBMS store).
These stores are accessed for two purposes.
1. For message persistence ("messageStore")
2. To persist and access other information relevant to messaging protocols.("contextStore").-->
<!-- By default WSO2 MB runs with H2 persistent store. If you plan to use a different
store, point to the relevant dataSource or uncomment the database appropriately.
RDBMS
=====
If you are running an RDBMS you can use the existing RDBMS implementation of stores
by pointing to the correct data source by updating the property "dataSource".
Data source entry should be present in
<MB_HOME>/repository/conf/datasources/master-datasources.xml.
-->
<persistence>
<!-- RDBMS MB Store Configuration -->
<messageStore class="org.wso2.andes.store.rdbms.RDBMSMessageStoreImpl">
<property name="dataSource">WSO2MBStoreDB</property>
<property name="storeUnavailableSQLStateClasses">08</property>
<property name="integrityViolationSQLStateClasses">23,27,44</property>
<property name="dataErrorSQLStateClasses">21,22</property>
<property name="transactionRollbackSQLStateClasses">40</property>
</messageStore>
<contextStore class="org.wso2.andes.store.rdbms.RDBMSAndesContextStoreImpl">
<property name="dataSource">WSO2MBStoreDB</property>
<property name="storeUnavailableSQLStateClasses">08</property>
<property name="integrityViolationSQLStateClasses">23,27,44</property>
<property name="dataErrorSQLStateClasses">21,22</property>
<property name="transactionRollbackSQLStateClasses">40</property>
</contextStore>
<cache>
<!-- Size of the messages cache in MBs. Setting '0' will disable the cache. -->
<size>256</size>
<!-- Expected concurrency for the cache (4 is guava default) -->
<concurrencyLevel>4</concurrencyLevel>
<!--Number of seconds cache will keep messages after they are
added (unless they are consumed and deleted).-->
<expirySeconds>2</expirySeconds>
<!--Reference type used to hold messages in memory.
weak - Using java weak references ( - results higher cache misses)
strong - ordinary references ( - higher cache hits, but not good if server
is going to run with limited heap size + under severe load).
-->
<valueReferenceType>strong</valueReferenceType>
<!--Prints cache statistics in 2 minute intervals
in carbon log ( and console)-->
<printStats>false</printStats>
</cache>
<!-- This class decides how unique IDs are generated for the MB node. This id generator is
expected to be thread safe and a implementation of interface
org.wso2.andes.server.cluster.coordination.MessageIdGenerator
NOTE: This is NOT used in MB to generate message IDs. -->
<idGenerator>org.wso2.andes.server.cluster.coordination.TimeStampBasedMessageIdGenerator</idGenerator>
<!-- This is the Task interval (in SECONDS) to check whether communication
is healthy between message store (/Database) and this server instance. -->
<storeHealthCheckInterval>10</storeHealthCheckInterval>
</persistence>
<!--Publisher transaction related configurations.-->
<transaction>
<!--Maximum batch size (Messages) for a transaction. Exceeding this limit will result
in a failure in the subsequent commit request. Default is set to 10MB. Limit is
calculated considering the payload of messages-->
<maxBatchSizeInBytes>10000000</maxBatchSizeInBytes>
</transaction>
<!-- This section allows you to tweak memory and processor allocations used by WSO2 MB.
Broken down by critical processes so you have a clear view of which parameters to change in
different scenarios. -->
<performanceTuning>
<slots>
<!--
If message publishers are slow, time taken to fill the slot (up to <windowSize>) will be longer.
This will add an latency to messages. Therefore broker will mark the slot as
ready to deliver before even the slot is entirely filled after specified time.
NOTE: specified in milliseconds.
-->
<messageAccumulationTimeout>2000</messageAccumulationTimeout>
<!--Rough estimate for size of a slot-->
<windowSize>1000</windowSize>
<!-- Time interval which broker check for slots that can be marked as 'ready to deliver'
(- slots which have a aged more than 'messageAccumulationTimeout')
NOTE: specified in milliseconds.
-->
<timerPeriod>1000</timerPeriod>
<!--Number of SlotDeliveryWorker threads that should be started-->
<workerThreadCount>5</workerThreadCount>
</slots>
<delivery>
<!-- Maximum number of undelivered messages that can have in memory. Increasing this
value increase the possibility of out of memory scenario but performance will be
improved -->
<maxNumberOfReadButUndeliveredMessages>1000</maxNumberOfReadButUndeliveredMessages>
<!-- This is the ring buffer size of the delivery disruptor. This value should be a
power of 2 (E.g. 1024, 2048, 4096). Use a small ring size if you want to reduce the
memory usage. -->
<ringBufferSize>4096</ringBufferSize>
<!--Number of parallel readers used to used to read content from message store.
Increasing this value will speed-up the message sending mechanism. But the load
on the data store will increase. -->
<parallelContentReaders>5</parallelContentReaders>
<!-- Number of parallel decompression handlers used to decompress messages before send to subscribers.
Increasing this value will speed-up the message decompressing mechanism. But the system load
will increase. -->
<parallelDecompressionHandlers>5</parallelDecompressionHandlers>
<!-- Number of parallel delivery handlers used to send messages to subscribers.
Increasing this value will speed-up the message sending mechanism. But the system load
will increase. -->
<parallelDeliveryHandlers>5</parallelDeliveryHandlers>
<!-- The size of the batch represents, at a given time the number of messages that could
be retrieved from the database. -->
<contentReadBatchSize>65000</contentReadBatchSize>
<contentCache>
<!-- Specify the maximum number of entries the cache may contain. -->
<maximumSize>100</maximumSize>
<!-- Specify the time in seconds that each entry should be
automatically removed from the cache after the entry's creation. -->
<expiryTime>120</expiryTime>
</contentCache>
<!--When delivering topic messages to multiple topic
subscribers one of following stratigies can be choosen.
1. DISCARD_NONE - Broker do not loose any message to any subscriber.
When there are slow subscribers this can cause broker
go Out of Memory.
2. SLOWEST_SUB_RATE - Broker deliver to the speed of the slowest
topic subscriber. This can cause fast subscribers
to starve. But eliminate Out of Memory issue.
3. DISCARD_ALLOWED - Broker will try best to deliver. To eliminate Out
of Memory threat broker limits sent but not acked message
count to <maxUnackedMessages>.
If it is breached, and <deliveryTimeout> is also
breached message can either be lost or actually
sent but ack is not honoured.
-->
<topicMessageDeliveryStrategy>
<strategyName>DISCARD_NONE</strategyName>
<!-- If you choose DISCARD_ALLOWED topic message delivery strategy,
broker keep messages in memory until ack is done until this timeout.
If an ack is not received under this timeout, ack will be simulated
internally and real acknowledgement is discarded.
deliveryTimeout is in seconds -->
<deliveryTimeout>60</deliveryTimeout>
</topicMessageDeliveryStrategy>
</delivery>
<ackHandling>
<!--Number of message acknowledgement handlers to process acknowledgements concurrently.
These acknowledgement handlers will batch and process acknowledgements. -->
<ackHandlerCount>1</ackHandlerCount>
<!--Maximum batch size of the acknowledgement handler. Andes process acknowledgements in
batches using Disruptor Increasing the batch size reduces the number of calls made to
database by MB. Depending on the database optimal batch size this value should be set.
Batches will be of the maximum batch size mostly in high throughput scenarios.
Underlying implementation use Disruptor for batching hence will batch message at a
lesser value than this in low throughput scenarios -->
<ackHandlerBatchSize>100</ackHandlerBatchSize>
<!-- Message delivery from server to the client will be paused temporarily if number of
delivered but unacknowledged message count reaches this size. Should be set considering
message consume rate. This is to avoid overwhelming slow subscribers. -->
<maxUnackedMessages>1000</maxUnackedMessages>
</ackHandling>
<contentHandling>
<!-- Within Andes there are content chunk handlers which convert incoming large content
chunks into max content chunk size allowed by Andes core. These handlers run in parallel
converting large content chunks to smaller chunks.
If the protocol specific content chunk size is different from the max chunk size allowed
by Andes core and there are significant number of large messages published, then having
multiple handlers will increase performance. -->
<contentChunkHandlerCount>3</contentChunkHandlerCount>
<!-- Andes core will store message content chunks according to this chunk size. Different
database will have limits and performance gains by tuning this parameter.
For instance in MySQL the maximum table column size for content is less than 65534, which
is the default chunk size of AMQP. By changing this parameter to a lesser value we can
store large content chunks converted to smaller content chunks within the DB with this
parameter. -->
<maxContentChunkSize>65500</maxContentChunkSize>
<!-- This is the configuration to allow compression of message contents, before store messages
into the database.-->
<allowCompression>false</allowCompression>
<!-- This is the configuration to change the value of the content compression threshold (in bytes).
Message contents less than this value will not compress, even compression is enabled. The recommended
message size of the smallest message before compression is 13bytes. Compress messages smaller than
13bytes will expand the message size by 0.4% -->
<contentCompressionThreshold>1000</contentCompressionThreshold>
</contentHandling>
<inboundEvents>
<!--Number of parallel writers used to write content to message store. Increasing this
value will speed-up the message receiving mechanism. But the load on the data store will
increase.-->
<parallelMessageWriters>1</parallelMessageWriters>
<!--Size of the Disruptor ring buffer for inbound event handling. For publishing at
higher rates increasing the buffer size may give some advantage on keeping messages in
memory and write.
NOTE: Buffer size should be a value of power of two -->
<bufferSize>65536</bufferSize>
<!--Maximum batch size of the batch write operation for inbound messages. MB internals
use Disruptor to batch events. Hence this batch size is set to avoid database requests
with high load (with big batch sizes) to write messages. This need to be configured in
high throughput messaging scenarios to regulate the hit on database from MB -->
<messageWriterBatchSize>70</messageWriterBatchSize>
<!--Timeout for waiting for a queue purge event to end to get the purged count. Doesn't
affect actual purging. If purge takes time, increasing the value will improve the
possibility of retrieving the correct purged count. Having a lower value doesn't stop
purge event. Getting the purged count is affected by this -->
<purgedCountTimeout>180</purgedCountTimeout>
<!--Number of parallel writers used to write content to message store for transaction
based publishing. Increasing this value will speedup commit duration for a transaction.
But the load on the data store will increase.-->
<transactionMessageWriters>1</transactionMessageWriters>
</inboundEvents>
<!--Message expiration can be set for each messages which are published to Wso2 MB.
After the expiration time, the messages will not be delivered to the consumers. Eventually
they got deleted inside the MB.-->
<messageExpiration>
<!-- When messages delivered, in the delivery path messages were checked whether they are
already expired. If expired at that time add that message to a queue for a future batch
delete. This interval decides on the time gap between the batch deletes. Time interval
specified in seconds.-->
<preDeliveryExpiryDeletionInterval>10</preDeliveryExpiryDeletionInterval>
<!-- Periodically check the database for new expired messages which were not assigned to
any slot delivery worker so far and delete them. This interval decides on the time gap between
the periodic message deletion. Time interval specified in seconds.-->
<periodicMessageDeletionInterval>900</periodicMessageDeletionInterval>
<!-- When checking the database for expired messages, the messages which were handled by the slot
delivery worker should no be touched since that mess up the slot delivery worker functionality.
Those messages anyways get caught at the message delivery path. So there is a need to have a safe
buffer of slots which can be allocated to a slot delivery worker in the near future. The specified
number of slots from the last assigned should not be touched by the periodic deletion task.-->
<safetySlotCount>3</safetySlotCount>
</messageExpiration>
</performanceTuning>
<!-- This section is about how you want to view messaging statistics from the admin console and
how you plan to interact with it. -->
<managementConsole>
<!--Maximum number of messages to be fetched per page using Andes message browser when browsing
queues/dlc -->
<messageBrowsePageSize>100</messageBrowsePageSize>
<!-- This property defines the maximum message content length that can be displayed at the
management console when browsing queues. If the message length exceeds the value, a
truncated content will be displayed with a statement "message content too large to display."
at the end. default value is 100000 (can roughly display a 100KB message.)
* NOTE : Increasing this value could cause delays when loading the message content page.-->
<maximumMessageDisplayLength>100000</maximumMessageDisplayLength>
<!--Enable users to reroute all messages from a specific destination(queue or durable topic) to a specific
queue.-->
<allowReRouteAllInDLC>false</allowReRouteAllInDLC>
</managementConsole>
<!-- Memory and resource exhaustion is something we should prevent and recover from.
This section allows you to specify the threshold at which to reduce/stop frequently intensive
operations within MB temporarily. -->
<!--
highLimit - flow control is enabled when message chunk pending to be handled by inbound
disruptor reaches above this limit
lowLimit - flow control is disabled (if enabled) when message chunk pending to be handled
by inbound disruptor reaches below this limit
-->
<flowControl>
<!-- This is the global buffer limits which enable/disable the flow control globally -->
<global>
<lowLimit>800</lowLimit>
<highLimit>8000</highLimit>
</global>
<!-- This is the channel specific buffer limits which enable/disable the flow control locally.
-->
<bufferBased>
<lowLimit>100</lowLimit>
<highLimit>1000</highLimit>
</bufferBased>
</flowControl>
<slotManagement>
<!--Set slot storage mode (RDBMS/HazelCast)-->
<storage>RDBMS</storage>
</slotManagement>
<!--
Message broker keeps track of all messages it has received as groups. These groups are termed
'Slots' (To know more information about Slots and message broker install please refer to online wiki).
Size of a slot is loosely determined by the configuration <windowSize> (and the number of
parallel publishers for specific topic/queue). Message broker cluster (or in single node) keeps
track of slots which constitutes for a large part of operating state before the cluster went down.
When first message broker node of the cluster starts up, it will read the database to recreate
the internal state to previous state.
-->
<recovery>
<!--
There could be multiple storage queues worked before entire cluster (or single node) went down.
We need to recover all remaining messages of each storage queue when first node startup and we can
read remaining message concurrently of each storage queue. Default value to set here to 5. You can
increase this value based on number of storage queues exist. Please use optimal value based on
number of storage queues to speed up warm startup.
-->
<concurrentStorageQueueReads>5</concurrentStorageQueueReads>
<!-- Virtual host sync interval seconds in for the Virtual host syncing Task which will
sync the Virtual host details across the cluster -->
<vHostSyncTaskInterval>900</vHostSyncTaskInterval>
<!--
Enables network partition detection ( and surrounding functionality, such
as disconnecting subscriptions, enabling error based flow control if the
minimal node count becomes less than configured value.
-->
<networkPartitionsDetection enabled = "false">
<!--
The minimum node count the cluster should maintain for this node to
operate. if cluster size becomes less that configured value
This node will not accept any incoming traffic ( and disconnect
subscriptions) etc.
-->
<minimumClusterSize>1</minimumClusterSize>
</networkPartitionsDetection>
</recovery>
<!--
Specifies the deployment mode for the broker node (and cluster). Possible values {default, standalone}.
default - Broker node will decide to run HA (master/slave) or fully distributed mode. Decision is taken based
on the node has a clustering mechanism enabled or not. If the node is not configured to join a cluster
it will run in HA mode (refer to axis2.xml for more information). If the node can join a cluster it
will start in fully clustered mode.
standalone - This is the simplest mode a broker can be started. Node will assume datastore is not shared with
another node. Therefore it will not try to coordinate with other nodes (possibly non-existent) to
provide HA or clustering.
-->
<deployment>
<mode>default</mode>
</deployment>
</broker>

View File

@ -0,0 +1,677 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
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 Message Broker</Name>
<!--
machine readable unique key to identify each product
-->
<ServerKey>MB</ServerKey>
<!--
Product Version
-->
<Version>3.2.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>MessageBroker</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>3</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>
<!--
This is the proxy port of the worker cluster. These need to be configured in a scenario where
manager node is not exposed through the load balancer through which the workers are exposed
therefore doesn't have a proxy port.
<WorkerHttpProxyPort>80</WorkerHttpProxyPort>
<WorkerHttpsProxyPort>443</WorkerHttpsProxyPort>
-->
</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>true</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-->
<XSSPreventionConfig>
<Enabled>true</Enabled>
<Rule>allow</Rule>
<Patterns>
<!--Pattern></Pattern-->
</Patterns>
</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>
<!-- FileNameRegEx is used to validate the file input/upload/write-out names.
e.g.
<FileNameRegEx>^(?!(?:CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(?:\.[^.])?$)[^&lt;&gt:"/\\|?*\x00-\x1F][^&lt;&gt:"/\\|?*\x00-\x1F\ .]$</FileNameRegEx>
-->
<!--<FileNameRegEx></FileNameRegEx>-->
<!--
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. Enable 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://product-dist.wso2.com/p2/carbon/releases/wilkes/</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>

View File

@ -0,0 +1,18 @@
# By default, This file contains the secret alias names and the plain text passwords enclosed with '[]' brackets
# In Production environments, It is recommend to replace these plain text password by the encrypted values. CipherTool can be used for it.
Carbon.Security.KeyStore.Password=[wso2carbon]
Carbon.Security.KeyStore.KeyPassword=[wso2carbon]
Carbon.Security.TrustStore.Password=[wso2carbon]
UserManager.AdminUser.Password=[admin]
Datasources.WSO2_CARBON_DB.Configuration.Password=[wso2carbon]
Server.Service.Connector.keystorePass=[wso2carbon]
# MB-Specific
Datasources.WSO2_MB_STORE_DB.Configuration.Password=[wso2carbon]
#AMQP / MQTT JKS store passwords
transports.amqp.sslConnection.keyStore.password=[wso2carbon]
transports.amqp.sslConnection.trustStore.password=[wso2carbon]
transports.mqtt.sslConnection.keyStore.password=[wso2carbon]
transports.mqtt.sslConnection.trustStore.password=[wso2carbon]

View File

@ -0,0 +1,21 @@
# Important: This properties file contains all the aliases to be used in carbon components. If any property need to be secured, you need to add alias name, file name and the xpath as follows:.
# The value goes as, the <file_name>//<xpath>,<true/false>
# where <file_name> - is the file (along with the file path) to be secured,
# <xpath> - is the xpath to the property value to be secured
# <true / false> - This is true if the last parameter in the xpath is parameter (starts with [ and ends with ]) and you want its value to be replaced with "password"
Carbon.Security.KeyStore.Password=repository/conf/carbon.xml//Server/Security/KeyStore/Password,false
Carbon.Security.KeyStore.KeyPassword=repository/conf/carbon.xml//Server/Security/KeyStore/KeyPassword,false
Carbon.Security.TrustStore.Password=repository/conf/carbon.xml//Server/Security/TrustStore/Password,false
UserManager.AdminUser.Password=repository/conf/user-mgt.xml//UserManager/Realm/Configuration/AdminUser/Password,false
Datasources.WSO2_CARBON_DB.Configuration.Password=repository/conf/datasources/master-datasources.xml//datasources-configuration/datasources/datasource[name='WSO2_CARBON_DB']/definition[@type='RDBMS']/configuration/password,false
Server.Service.Connector.keystorePass=repository/conf/tomcat/catalina-server.xml//Server/Service/Connector[@keystorePass],true
# MB-Specific
Datasources.WSO2_MB_STORE_DB.Configuration.Password=repository/conf/datasources/master-datasources.xml//datasources-configuration/datasources/datasource[name='WSO2_MB_STORE_DB']/definition/configuration/password,false
#AMQP / MQTT JKS store passwords
transports.amqp.sslConnection.keyStore.password=repository/conf/broker.xml//broker/transports/amqp/sslConnection/keyStore/password,true
transports.amqp.sslConnection.trustStore.password=repository/conf/broker.xml//broker/transports/amqp/sslConnection/trustStore/password,true
transports.mqtt.sslConnection.keyStore.password=repository/conf/broker.xml//broker/transports/mqtt/sslConnection/keyStore/password,true
transports.mqtt.sslConnection.trustStore.password=repository/conf/broker.xml//broker/transports/mqtt/sslConnection/trustStore/password,true

View File

@ -0,0 +1,2 @@
hazelcast.max.no.heartbeat.seconds=600
hazelcast.shutdownhook.enabled=false

View File

@ -0,0 +1,209 @@
<datasources-configuration>
<providers>
<provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
</providers>
<datasources>
<!-- 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-->
<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>
</configuration>
</definition>
</datasource>
<!-- WSO2 MB embedded H2 Store -->
<datasource>
<name>WSO2_MB_STORE_DB</name>
<description>The datasource used for message broker database</description>
<jndiConfig>
<name>WSO2MBStoreDB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:h2:repository/database/WSO2MB_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>
<!-- MySQL data source -->
<!--
<datasource>
<name>WSO2_MB_STORE_DB</name>
<jndiConfig>
<name>WSO2MBStoreDB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<url>jdbc:mysql://localhost/wso2_mb</url>
<username>root</username>
<password>root</password>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<minIdle>5</minIdle>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
<defaultAutoCommit>false</defaultAutoCommit>
</configuration>
</definition>
</datasource>
-->
<!-- MSSQL server -->
<!-- Please enable any one of the following datasource based on your MSSQL driver library -->
<!-- JTDS datasource -->
<!--
<datasource>
    <name>WSO2_MB_STORE_DB</name>
    <jndiConfig>
        <name>WSO2MBStoreDB</name>
    </jndiConfig>
    <definition type="RDBMS">
<configuration>
<url>jdbc:jtds:sqlserver://localhost:1433/wso2_mb</url>
<username>sa</username>
<password>sa</password>
<driverClassName>net.sourceforge.jtds.jdbc.Driver</driverClassName>
<maxActive>200</maxActive>
<maxWait>60000</maxWait>
<minIdle>5</minIdle>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
<defaultAutoCommit>false</defaultAutoCommit>
</configuration>
    </definition>
</datasource>
-->
<!-- SQLServerXA datasource -->
<!--
<datasource>
    <name>WSO2_MB_STORE_DB</name>
    <jndiConfig>
        <name>WSO2MBStoreDB</name>
    </jndiConfig>
    <definition type="RDBMS">
        <configuration>
<defaultAutoCommit>false</defaultAutoCommit>
            <dataSourceClassName>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</dataSourceClassName>
            <dataSourceProps>
<property name = "URL">jdbc:sqlserver://localhost/SQLExpress:1433</property>
<property name="databaseName">wso2_mb</property>
                <property name="user">sa</property>
                <property name="password">sa</property>
            </dataSourceProps>
        </configuration>
    </definition>
</datasource>
-->
<!-- Oracle datasource -->
<!--
<datasource>
<name>WSO2_MB_STORE_DB</name>
<jndiConfig>
<name>WSO2MBStoreDB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
<url>jdbc:oracle:thin:@localhost:1521/orcl</url>
<maxActive>100</maxActive>
<maxWait>60000</maxWait>
<minIdle>5</minIdle>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1 FROM DUAL</validationQuery>
<validationInterval>30000</validationInterval>
<username>scott</username>
<password>tiger</password>
<defaultAutoCommit>false</defaultAutoCommit>
</configuration>
</definition>
</datasource>
-->
<!-- Postgresql datasource -->
<!--
<datasource>
    <name>WSO2_MB_STORE_DB</name>
    <jndiConfig>
        <name>WSO2MBStoreDB</name>
    </jndiConfig>
    <definition type="RDBMS">
<configuration>
<url>jdbc:postgresql://localhost/wso2_mb</url>
<username>postgres</username>
<password>postgres</password>
<driverClassName>org.postgresql.Driver</driverClassName>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
<defaultAutoCommit>false</defaultAutoCommit>
</configuration>
    </definition>
</datasource>
-->
</datasources>
</datasources-configuration>

View File

@ -0,0 +1,44 @@
<!--
This is the configuration file for the carbon event broker component. this configuration file configures the various subsystems of the event
broker component and parameters.
-->
<eventBrokerConfig xmlns="http://wso2.org/carbon/event/broker">
<eventBroker name="carbonEventBroker" class="org.wso2.carbon.andes.event.core.internal.CarbonEventBrokerFactory">
<!-- topic manager implementation class.-->
<topicManager name="TopicManager"
class="org.wso2.carbon.andes.event.core.internal.subscription.registry.RegistryTopicManagerServiceFactory">
<!-- root node of the topic tree -->
<topicStoragePath>event/topics</topicStoragePath>
</topicManager>
<!-- subscription manager implementation. subscription manager persist the
subscriptions at the registry. users can configure the topics root node and the topicIndex path -->
<subscriptionManager name="subscriptionManager"
class="org.wso2.carbon.andes.event.core.internal.subscription.registry.RegistrySubscriptionManagerFactory">
<topicStoragePath>event/topics</topicStoragePath>
<indexStoragePath>event/topicIndex</indexStoragePath>
</subscriptionManager>
<!-- delivery manager implementation. delivery manager does actual delivery part of the event broker -->
<deliveryManager name="deliveryManager"
class="org.wso2.carbon.andes.event.core.internal.delivery.jms.QpidJMSDeliveryManagerFactory"
type="local">
<!-- <remoteMessageBroker>
<hostName>localhost</hostName>
<servicePort>9443</servicePort>
<webContext>/</webContext>
<userName>admin</userName>
<password>admin</password>
<qpidPort>5672</qpidPort>
<clientID>clientID</clientID>
<virtualHostName>carbon</virtualHostName>
</remoteMessageBroker> -->
</deliveryManager>
<!-- when publishing an event event broker uses a separate thread pool with an executor. following parameters configure different parameters of that -->
<eventPublisher>
<minSpareThreads>5</minSpareThreads>
<maxThreads>50</maxThreads>
<maxQueuedRequests>1000</maxQueuedRequests>
<keepAliveTime>1000</keepAliveTime>
</eventPublisher>
</eventBroker>
</eventBrokerConfig>

View File

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright 2015 WSO2 Inc. (http://wso2.org)
~
~ 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 configuration file for metrics
-->
<Metrics xmlns="http://wso2.org/projects/carbon/metrics.xml">
<!--
Enable Metrics
-->
<Enabled>true</Enabled>
<!--
Metrics reporting configurations
-->
<Reporting>
<JMX>
<Enabled>true</Enabled>
</JMX>
<Console>
<Enabled>false</Enabled>
<!-- Polling Period in seconds.
This is the period for polling metrics from the metric registry and
printing in the console -->
<PollingPeriod>60</PollingPeriod>
</Console>
<CSV>
<Enabled>false</Enabled>
<Location>${carbon.home}/repository/logs/metrics/</Location>
<!-- Polling Period in seconds.
This is the period for polling metrics from the metric registry and
update CSV files in the given location -->
<PollingPeriod>60</PollingPeriod>
</CSV>
<JDBC>
<Enabled>true</Enabled>
<!-- Source of Metrics, which will be used to
identify each metric in database -->
<!-- Commented to use the hostname
<Source>Carbon</Source>
-->
<!--
JNDI name of the data source to be used by the JDBC Reporter.
This data source should be defined in a *-datasources.xml
file in conf/datasources directory.
-->
<DataSourceName>jdbc/WSO2MetricsDB</DataSourceName>
<!-- Polling Period in seconds.
This is the period for polling metrics from the metric registry and
updating the database with the values -->
<PollingPeriod>60</PollingPeriod>
<ScheduledCleanup>
<!--
Schedule regular deletion of metrics data older than a set number of days.
It is strongly recommended that you enable this job to ensure your metrics tables do not get extremely
large. Deleting data older than seven days should be sufficient.
-->
<Enabled>true</Enabled>
<!-- This is the period for each cleanup operation in seconds -->
<ScheduledCleanupPeriod>86400</ScheduledCleanupPeriod>
<!-- The scheduled job will cleanup all data older than the specified days -->
<DaysToKeep>7</DaysToKeep>
</ScheduledCleanup>
</JDBC>
<DAS>
<Enabled>false</Enabled>
<!-- Source of Metrics, which will be used to
identify each metric sent in the streams -->
<!-- Commented to use the hostname
<Source>Carbon</Source>
-->
<!-- Polling Period in seconds.
This is the period for polling metrics from the metric registry and
sending events via the Data Publisher -->
<PollingPeriod>60</PollingPeriod>
<!-- The type used with Data Publisher -->
<Type>thrift</Type>
<!-- Data Receiver URL used by the Data Publisher -->
<ReceiverURL>tcp://localhost:7612</ReceiverURL>
<!-- Authentication URL for the Data Publisher -->
<!-- <AuthURL>ssl://localhost:7711</AuthURL> -->
<Username>admin</Username>
<Password>admin</Password>
<!-- Path for Data Agent Configuration -->
<DataAgentConfigPath>repository/conf/data-bridge/data-agent-config.xml</DataAgentConfigPath>
</DAS>
</Reporting>
</Metrics>

View File

@ -0,0 +1,392 @@
This product is licensed by WSO2 Inc. under Apache License 2.0. The license
can be downloaded from the following locations:
http://www.apache.org/licenses/LICENSE-2.0.html
http://www.apache.org/licenses/LICENSE-2.0.txt
This product also contains software under different licenses. This table below
all the contained libraries (jar files) and the license under which they are
provided to you.
At the bottom of this file is a table that shows what each license indicated
below is and where the actual text of the license can be found.
Name Type License
---------------------------------------------------------------------------------------------------------
abdera_1.0.0.wso2v3.jar bundle apache2 907
activation-1.1.1.jar jarinbundle cddl1 552
addressing-1.6.1-wso2v16.mar bundle apache2 6272
ajaxtags_1.3.0.beta-rc7-wso2v1.jar bundle apache2 905
andes-client-3.1.1.jar bundle apache2 1629
andes_3.1.1.jar bundle apache2 1630
annogen_0.1.0.wso2v1.jar bundle apache2 942
ant-contrib-1.0b3.jar jar apache2 549
antlr-runtime_3.2.0.wso2v1.jar bundle bsd 817
antlr_3.2.0.wso2v1.jar bundle bsd 838
ant_1.7.0.wso2v1.jar bundle apache2 1012
apache-zookeeper_3.3.4.wso2v1.jar bundle apache2 4219
authenticator_0.7.0.wso2v1.jar bundle apache2 700
axiom_1.2.11.wso2v9.jar bundle apache2 5426
axis2-json_1.6.1.wso2v16.jar bundle apache2 6270
axis2-transport-jms_1.1.0.wso2v14.jar bundle apache2 5915
axis2-transport-rabbitmq-amqp_1.1.0.wso2v14.jar bundle apache2 5914
axis2_1.6.1.wso2v16.jar bundle apache2 6269
backport-util-concurrent_3.1.0.wso2v1.jar bundle apache2 1007
bcprov-jdk15-132.jar jar apache2 285
bcprov-jdk15on-1.49.jar jarinbundle bouncy 1069
bcprov-jdk15on_1.49.0.wso2v2.jar bundle bouncy 3640
com.google.gson_2.3.1.jar bundle apache2 1143
com.google.gson_2.5.0.jar bundle bsd 1621
com.google.guava_13.0.1.jar apache2
com.google.guava_15.0.0.jar bundle apache2 792
com.google.guava_19.0.0.jar bundle apache2 1627
commons-beanutils-1.7.0.jar jarinbundle apache2 383
commons-beanutils-1.8.0.jar jarinbundle apache2 292
commons-beanutils_1.8.0.wso2v1.jar bundle apache2 688
commons-cli_1.2.0.wso2v1.jar bundle apache2 922
commons-codec_1.4.0.wso2v1.jar bundle apache2 980
commons-collections_3.2.2.wso2v1.jar bundle apache2 6268
commons-configuration_1.6.0.wso2v1.jar bundle apache2 933
commons-dbcp_1.4.0.wso2v1.jar bundle apache2 962
commons-digester-1.8.1.jar jarinbundle apache2 347
commons-digester-1.8.jar jarinbundle apache2 384
commons-digester_1.8.1.wso2v1.jar bundle apache2 857
commons-fileupload_1.2.2.wso2v1.jar bundle apache2 830
commons-httpclient_3.1.0.wso2v2.jar bundle apache2 760
commons-io_2.0.0.wso2v2.jar bundle apache2 678
commons-io_2.4.0.wso2v1.jar bundle apache2 4217
commons-lang-2.6.0.wso2v1.jar bundle apache2 664
commons-lang_2.6.0.wso2v1.jar bundle apache2 940
commons-pool_1.5.6.wso2v1.jar bundle apache2 1009
compass_2.0.1.wso2v2.jar bundle apache2 897
disruptor_3.3.2.wso2v2.jar bundle apache2 4377
dom4j-1.6.1.jar jarinbundle bsd 1177
encoder_1.2.0.wso2v1.jar bundle apache2 4030
geronimo-jaxws_2.2_spec-1.0.jar bundle apache2 395
geronimo-jms_1.1_spec-1.1.0.wso2v1.jar bundle apache2 661
geronimo-jta_1.1_spec-1.1.jar jar apache2 1066
geronimo-saaj_1.3_spec_1.0.0.wso2v3.jar bundle apache2 893
h2-1.2.140-wso2v3.jar bundle epl1
h2-database-engine_1.2.140.wso2v3.jar bundle epl1 697
hazelcast_3.5.2.wso2v1.jar bundle apache2 5423
hector-core_1.1.4.wso2v1.jar bundle apache2 2878
high-scale-lib_1.0.0.wso2v1.jar bundle apache2 4216
httpclient_4.3.1.wso2v2.jar bundle apache2 4214
httpcore_4.3.3.wso2v1.jar bundle apache2 3638
httpmime_4.3.1.wso2v2.jar bundle apache2 4375
icu4j-3.8.jar jarinbundle icu 321
io.dropwizard.metrics.core_3.1.2.jar bundle apache2 1305
io.dropwizard.metrics.jvm_3.1.2.jar bundle apache2 1302
javasysmon_0.3.3.wso2v1.jar bundle bsd 721
javax.cache.wso2_4.4.3.jar bundle apache2 1583
jaxb_2.2.5.wso2v1.jar bundle cddl1 883
jdbc-pool_7.0.34.wso2v2.jar bundle apache2 3637
jericho-html-2.4.jar jarinbundle epl1 363
jettison_1.3.4.wso2v1.jar bundle apache2 2162
jline-1.0.jar bundle bsd 805
json_1.0.0.wso2v1.jar bundle apache2 2361
json_2.0.0.wso2v1.jar bundle apache2 971
jsr311-api-1.1.1.jar jarinbundle cddl1 553
jstl_1.2.1.wso2v2.jar bundle cddl1 2204
kaptcha_2.3.0.wso2v1.jar bundle apache2 854
libthrift_0.7.0.wso2v2.jar bundle apache2 912
libthrift_0.9.2.wso2v1.jar bundle apache2 5912
localizer-1.0.jar jarinbundle apache2 551
log4j-1.2.13.jar jar apache2 583
lucene_5.2.1.wso2v1.jar bundle apache2 4502
neethi_2.0.4.wso2v5.jar bundle apache2 6267
netty-all_4.0.23.wso2v1.jar bundle apache2 4689
noggit_0.6.0.wso2v1.jar bundle apache2 4211
opencsv-1.8.jar jarinbundle apache2 368
opencsv_1.8.0.wso2v1.jar bundle apache2 928
opensaml-1.1.406.jar jarinbundle apache2 351
opensaml-2.4.1.jar jarinbundle apache2 349
opensaml2_2.4.1.wso2v1.jar bundle apache2 864
openws-1.4.1.jar jarinbundle apache2 350
org.apache.commons.configuration_1.10.0.jar bundle apache2 1510
org.apache.felix.gogo.command_0.10.0.v201209301215.jar bundle apache2 1134
org.apache.felix.gogo.runtime_0.10.0.v201209301036.jar bundle apache2 1133
org.apache.felix.gogo.shell_0.10.0.v201212101605.jar bundle apache2 1132
org.eclipse.core.contenttype_3.4.200.v20130326-1255.jar bundle epl1 1131
org.eclipse.core.expressions_3.4.500.v20130515-1343.jar bundle epl1 1130
org.eclipse.core.jobs_3.5.300.v20130429-1813.jar bundle epl1 1129
org.eclipse.core.runtime_3.9.0.v20130326-1255.jar bundle epl1 1128
org.eclipse.ecf.filetransfer_5.0.0.v20130604-1622.jar bundle epl1 1127
org.eclipse.ecf.identity_3.2.0.v20130604-1622.jar bundle epl1 1126
org.eclipse.ecf.provider.filetransfer.httpclient_4.0.200.v20120319-0616.jar bundle epl1 289
org.eclipse.ecf.provider.filetransfer_3.2.0.v20130604-1622.jar bundle epl1 1125
org.eclipse.ecf_3.2.0.v20130604-1622.jar bundle epl1 1124
org.eclipse.equinox.app_1.3.100.v20130327-1442.jar bundle epl1 1123
org.eclipse.equinox.common_3.6.200.v20130402-1505.jar bundle epl1 1122
org.eclipse.equinox.concurrent_1.1.0.v20130327-1442.jar bundle epl1 1121
org.eclipse.equinox.console_1.0.100.v20130429-0953.jar bundle epl1 1120
org.eclipse.equinox.ds_1.4.101.v20130813-1853.jar bundle epl1 1119
org.eclipse.equinox.frameworkadmin.equinox_1.0.500.v20130327-2119.jar bundle epl1 1118
org.eclipse.equinox.frameworkadmin_2.0.100.v20130327-2119.jar bundle epl1 1117
org.eclipse.equinox.http.helper_1.1.0.wso2v1.jar bundle epl1 839
org.eclipse.equinox.http.servlet_1.1.400.v20130418-1354.jar bundle epl1 1116
org.eclipse.equinox.jsp.jasper_1.0.400.v20120522-2049.jar bundle epl1 388
org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar bundle epl1 1115
org.eclipse.equinox.p2.artifact.repository_1.1.100.v20110519.jar bundle epl1 337
org.eclipse.equinox.p2.console_1.0.300.v20130327-2119.jar bundle epl1 1114
org.eclipse.equinox.p2.core_2.3.0.v20130327-2119.jar bundle epl1 1113
org.eclipse.equinox.p2.director.app_1.0.300.v20130819-1621.jar bundle epl1 1112
org.eclipse.equinox.p2.directorywatcher_1.0.300.v20130327-2119.jar bundle epl1 1110
org.eclipse.equinox.p2.director_2.3.0.v20130526-0335.jar bundle epl1 1111
org.eclipse.equinox.p2.engine_2.3.0.v20130526-2122-wso2v1.jar bundle epl1 3873
org.eclipse.equinox.p2.extensionlocation_1.2.100.v20130327-2119.jar bundle epl1 1109
org.eclipse.equinox.p2.garbagecollector_1.0.200.v20130327-2119.jar bundle epl1 1108
org.eclipse.equinox.p2.jarprocessor_1.0.300.v20130327-2119.jar bundle epl1 1107
org.eclipse.equinox.p2.metadata.repository_1.2.100.v20130327-2119.jar bundle epl1 1106
org.eclipse.equinox.p2.metadata_2.2.0.v20130523-1557.jar bundle epl1 1105
org.eclipse.equinox.p2.publisher_1.2.0.v20110511.jar bundle epl1 306
org.eclipse.equinox.p2.repository.tools_2.1.0.v20130327-2119.jar bundle epl1 1104
org.eclipse.equinox.p2.repository_2.3.0.v20130412-2032.jar bundle epl1 1103
org.eclipse.equinox.p2.touchpoint.eclipse_2.1.0.v20110511-wso2v1.jar bundle epl1 703
org.eclipse.equinox.p2.touchpoint.natives_1.1.100.v20130327-2119.jar bundle epl1 1102
org.eclipse.equinox.p2.transport.ecf_1.0.100.v20110902-0807.jar bundle epl1 369
org.eclipse.equinox.p2.updatechecker_1.1.200.v20130327-2119.jar bundle epl1 1101
org.eclipse.equinox.p2.updatesite_1.0.400.v20130515-2028.jar bundle epl1 1100
org.eclipse.equinox.preferences_3.5.100.v20130422-1538.jar bundle epl1 1099
org.eclipse.equinox.registry_3.5.301.v20130717-1549.jar bundle epl1 1098
org.eclipse.equinox.security_1.2.0.v20130424-1801.jar bundle epl1 1097
org.eclipse.equinox.simpleconfigurator.manipulator_2.0.0.v20130327-2119.jar bundle epl1 1096
org.eclipse.equinox.simpleconfigurator_1.0.400.v20130327-2119.jar bundle epl1 1095
org.eclipse.equinox.util_1.0.500.v20130404-1337.jar bundle epl1 1094
org.eclipse.jdt.core.compiler.batch_3.10.2.v20150120-1634.jar bundle epl1 1141
org.eclipse.osgi.services_3.3.100.v20130513-1956.jar bundle epl1 1093
org.eclipse.osgi_3.9.1.v20130814-1242.jar bundle epl1 1092
org.restlet_2.3.0.wso2v1.jar bundle apache2 4501
org.sat4j.core_2.3.5.v201308161310.jar bundle epl1+lgpl21091
org.sat4j.pb_2.3.5.v201308161310.jar bundle epl1+lgpl21090
org.wso2.carbon.addressing_4.4.3.jar bundle apache2 6699
org.wso2.carbon.andes.admin_3.1.1.jar bundle apache2 7159
org.wso2.carbon.andes.authentication_3.1.1.jar bundle apache2 7158
org.wso2.carbon.andes.authorization_3.1.1.jar bundle apache2 7157
org.wso2.carbon.andes.cluster.mgt.ui_3.1.1.jar bundle apache2 7156
org.wso2.carbon.andes.cluster.mgt_3.1.1.jar bundle apache2 7155
org.wso2.carbon.andes.commons_3.1.1.jar bundle apache2 7154
org.wso2.carbon.andes.core_3.1.1.jar bundle apache2 7153
org.wso2.carbon.andes.event.admin_3.1.1.jar bundle apache2 7152
org.wso2.carbon.andes.event.core_3.1.1.jar bundle apache2 7151
org.wso2.carbon.andes.event.stub_3.1.1.jar bundle apache2 7150
org.wso2.carbon.andes.event.ui_3.1.1.jar bundle apache2 7149
org.wso2.carbon.andes.mgt.stub_3.1.1.jar bundle apache2 7148
org.wso2.carbon.andes.stub_3.1.1.jar bundle apache2 7147
org.wso2.carbon.andes.ui_3.1.1.jar bundle apache2 7146
org.wso2.carbon.andes_3.1.1.jar bundle apache2 7145
org.wso2.carbon.application.deployer_4.4.3.jar bundle apache2 6677
org.wso2.carbon.application.upload_4.4.8.jar bundle apache2 5829
org.wso2.carbon.authenticator.proxy_4.4.3.jar bundle apache2 6675
org.wso2.carbon.authenticator.stub_4.4.3.jar bundle apache2 6674
org.wso2.carbon.base_4.4.3.jar bundle apache2 6671
org.wso2.carbon.bootstrap-4.4.3.jar bundle apache2 6505
org.wso2.carbon.captcha.mgt_4.2.0.jar bundle apache2 2154
org.wso2.carbon.cluster.mgt.core_4.4.3.jar bundle apache2 6667
org.wso2.carbon.core.bootup.validator_4.4.3.jar bundle apache2 6665
org.wso2.carbon.core.commons.stub_4.4.3.jar bundle apache2 6663
org.wso2.carbon.core.common_4.4.3.jar bundle apache2 6664
org.wso2.carbon.core.services_4.4.3.jar bundle apache2 6662
org.wso2.carbon.core_4.4.3.jar bundle apache2 6661
org.wso2.carbon.databridge.agent.thrift_4.4.8.jar bundle apache2 5896
org.wso2.carbon.databridge.commons.thrift_4.4.8.jar bundle apache2 5895
org.wso2.carbon.databridge.commons_4.4.8.jar bundle apache2 5894
org.wso2.carbon.event.client_4.4.8.jar bundle apache2 5815
org.wso2.carbon.feature.mgt.core_4.4.3.jar bundle apache2 6655
org.wso2.carbon.feature.mgt.services_4.4.3.jar bundle apache2 6654
org.wso2.carbon.feature.mgt.stub_4.4.3.jar bundle apache2 6653
org.wso2.carbon.feature.mgt.ui_4.4.3.jar bundle apache2 6652
org.wso2.carbon.framework.exporter_4.4.3.jar bundle apache2 6650
org.wso2.carbon.i18n_4.4.3.jar bundle apache2 6648
org.wso2.carbon.identity.account.mgt.menu.ui_4.5.6.jar bundle apache2 5224
org.wso2.carbon.identity.authenticator.saml2.sso.common_4.5.6.jar bundle apache2 5223
org.wso2.carbon.identity.authenticator.saml2.sso.stub_4.5.6.jar bundle apache2 5222
org.wso2.carbon.identity.authenticator.saml2.sso.ui_4.5.6.jar bundle apache2 5221
org.wso2.carbon.identity.authenticator.saml2.sso_4.5.6.jar bundle apache2 5220
org.wso2.carbon.identity.base_4.5.6.jar bundle apache2 5219
org.wso2.carbon.identity.menu.ui_4.5.6.jar bundle apache2 5216
org.wso2.carbon.identity.sso.saml.stub_4.5.6.jar bundle apache2 5213
org.wso2.carbon.identity.user.store.configuration.deployer_4.5.6.jar bundle apache2 5212
org.wso2.carbon.identity.user.store.configuration.stub_4.5.6.jar bundle apache2 5211
org.wso2.carbon.identity.user.store.configuration.ui_4.5.6.jar bundle apache2 5210
org.wso2.carbon.identity.user.store.configuration_4.5.6.jar bundle apache2 5209
org.wso2.carbon.identity.user.store.remote_4.5.6.jar bundle apache2 5893
org.wso2.carbon.java2wsdl.ui_4.4.8.jar bundle apache2 5892
org.wso2.carbon.java2wsdl_4.4.8.jar bundle apache2 5891
org.wso2.carbon.logging-4.4.1.jar bundle apache2 3984
org.wso2.carbon.logging-4.4.3.jar bundle apache2 6507
org.wso2.carbon.logging.admin.stub_4.4.8.jar bundle apache2 5747
org.wso2.carbon.logging.admin.ui_4.4.8.jar bundle apache2 5746
org.wso2.carbon.logging.service_4.4.8.jar bundle apache2 5745
org.wso2.carbon.logging.view.stub_4.4.8.jar bundle apache2 5744
org.wso2.carbon.logging.view.ui_4.4.8.jar bundle apache2 5743
org.wso2.carbon.logging_4.4.3.jar bundle apache2 6600
org.wso2.carbon.messageflows.stub_4.4.8.jar bundle apache2 5890
org.wso2.carbon.messageflows.ui_4.4.8.jar bundle apache2 5889
org.wso2.carbon.messageflows_4.4.8.jar bundle apache2 5888
org.wso2.carbon.messaging.metrics.ui_3.1.1.jar bundle apache2 7144
org.wso2.carbon.metrics.common_1.2.0.jar bundle apache2 6889
org.wso2.carbon.metrics.das.reporter_1.2.0.jar bundle apache2 6888
org.wso2.carbon.metrics.data.common_1.2.0.jar bundle apache2 6912
org.wso2.carbon.metrics.data.service.stub_1.2.0.jar bundle apache2 6911
org.wso2.carbon.metrics.data.service_1.2.0.jar bundle apache2 6910
org.wso2.carbon.metrics.impl_1.2.0.jar bundle apache2 6887
org.wso2.carbon.metrics.jdbc.reporter_1.2.0.jar bundle apache2 6909
org.wso2.carbon.metrics.manager_1.2.0.jar bundle apache2 6886
org.wso2.carbon.metrics.view.ui_1.2.0.jar bundle apache2 6908
org.wso2.carbon.ndatasource.common_4.4.3.jar bundle apache2 6562
org.wso2.carbon.ndatasource.core_4.4.3.jar bundle apache2 6561
org.wso2.carbon.ndatasource.rdbms_4.4.3.jar bundle apache2 6560
org.wso2.carbon.osgi.security_4.4.3.jar bundle apache2 6559
org.wso2.carbon.p2.touchpoint_4.4.3.jar bundle apache2 6558
org.wso2.carbon.queuing_4.4.3.jar bundle apache2 6554
org.wso2.carbon.registry.admin.api_4.5.0.jar bundle apache2 5886
org.wso2.carbon.registry.api_4.4.3.jar bundle apache2 6553
org.wso2.carbon.registry.common.ui_4.5.0.jar bundle apache2 5885
org.wso2.carbon.registry.common_4.5.0.jar bundle apache2 5884
org.wso2.carbon.registry.core_4.4.3.jar bundle apache2 6552
org.wso2.carbon.registry.indexing_4.5.0.jar bundle apache2 5883
org.wso2.carbon.registry.properties.stub_4.5.0.jar bundle apache2 5882
org.wso2.carbon.registry.properties.ui_4.5.0.jar bundle apache2 5881
org.wso2.carbon.registry.properties_4.5.0.jar bundle apache2 5880
org.wso2.carbon.registry.resource.stub_4.5.0.jar bundle apache2 5879
org.wso2.carbon.registry.resource.ui_4.5.0.jar bundle apache2 5878
org.wso2.carbon.registry.resource_4.5.0.jar bundle apache2 5877
org.wso2.carbon.registry.search.stub_4.5.0.jar bundle apache2 5876
org.wso2.carbon.registry.search.ui_4.5.0.jar bundle apache2 5875
org.wso2.carbon.registry.search_4.5.0.jar bundle apache2 5874
org.wso2.carbon.registry.server_4.4.3.jar bundle apache2 6551
org.wso2.carbon.registry.servlet_4.5.0.jar bundle apache2 5873
org.wso2.carbon.roles.mgt.stub_4.4.3.jar bundle apache2 6545
org.wso2.carbon.roles.mgt.ui_4.4.3.jar bundle apache2 6544
org.wso2.carbon.roles.mgt_4.4.3.jar bundle apache2 6543
org.wso2.carbon.securevault_4.4.3.jar bundle apache2 6542
org.wso2.carbon.security.mgt.stub_4.5.6.jar bundle apache2 5072
org.wso2.carbon.security.mgt.ui_4.5.6.jar bundle apache2 5071
org.wso2.carbon.security.mgt_4.5.6.jar bundle apache2 5070
org.wso2.carbon.server-4.4.3.jar bundle apache2 6506
org.wso2.carbon.server.admin.common_4.4.3.jar bundle apache2 6535
org.wso2.carbon.server.admin.stub_4.4.3.jar bundle apache2 6534
org.wso2.carbon.server.admin.ui_4.4.3.jar bundle apache2 6533
org.wso2.carbon.server.admin_4.4.3.jar bundle apache2 6532
org.wso2.carbon.statistics.stub_4.4.8.jar bundle apache2 5872
org.wso2.carbon.statistics.ui_4.4.8.jar bundle apache2 5871
org.wso2.carbon.statistics_4.4.8.jar bundle apache2 5870
org.wso2.carbon.tenant.common.stub_4.4.8.jar bundle apache2 5725
org.wso2.carbon.tenant.common_4.4.8.jar bundle apache2 5724
org.wso2.carbon.tenant.deployment_4.4.4.jar bundle apache2 5869
org.wso2.carbon.tenant.dispatcher_4.4.4.jar bundle apache2 5868
org.wso2.carbon.tenant.keystore.mgt_4.4.4.jar bundle apache2 5867
org.wso2.carbon.tenant.mgt.core_4.4.4.jar bundle apache2 5866
org.wso2.carbon.tenant.mgt.stub_4.4.4.jar bundle apache2 5865
org.wso2.carbon.tenant.mgt.ui_4.4.4.jar bundle apache2 5864
org.wso2.carbon.tenant.mgt_4.4.4.jar bundle apache2 5863
org.wso2.carbon.tenant.redirector.servlet.stub_4.4.4.jar bundle apache2 5862
org.wso2.carbon.tenant.redirector.servlet.ui_4.4.4.jar bundle apache2 5861
org.wso2.carbon.tenant.redirector.servlet_4.4.4.jar bundle apache2 5860
org.wso2.carbon.tenant.sso.redirector.ui_4.4.4.jar bundle apache2 5859
org.wso2.carbon.tenant.theme.mgt_4.4.4.jar bundle apache2 5858
org.wso2.carbon.tenant.throttling.agent_4.4.4.jar bundle apache2 5857
org.wso2.carbon.tenant.usage.agent_4.4.4.jar bundle apache2 5856
org.wso2.carbon.throttling.agent.stub_4.4.8.jar bundle apache2 5855
org.wso2.carbon.tomcat.ext_4.4.3.jar bundle apache2 6529
org.wso2.carbon.tomcat_4.4.3.jar bundle apache2 6528
org.wso2.carbon.tools.wsdlvalidator.ui_4.4.8.jar bundle apache2 5854
org.wso2.carbon.tools.wsdlvalidator_4.4.8.jar bundle apache2 5853
org.wso2.carbon.tracer.stub_4.4.8.jar bundle apache2 5852
org.wso2.carbon.tracer.ui_4.4.8.jar bundle apache2 5851
org.wso2.carbon.tracer_4.4.8.jar bundle apache2 5850
org.wso2.carbon.tryit.ui_4.4.8.jar bundle apache2 5723
org.wso2.carbon.tryit_4.4.8.jar bundle apache2 5721
org.wso2.carbon.ui.menu.general_4.4.3.jar bundle apache2 6527
org.wso2.carbon.ui.menu.registry_4.4.1.jar bundle apache2 4394
org.wso2.carbon.ui.menu.stratos_2.2.0.jar bundle apache2 2202
org.wso2.carbon.ui.menu.tools_4.4.1.jar bundle apache2 4066
org.wso2.carbon.ui_4.4.3.jar bundle apache2 6526
org.wso2.carbon.um.ws.api.stub_4.5.6.jar bundle apache2 5849
org.wso2.carbon.um.ws.api_4.5.6.jar bundle apache2 5848
org.wso2.carbon.um.ws.service_4.5.6.jar bundle apache2 5847
org.wso2.carbon.user.api_4.4.3.jar bundle apache2 6522
org.wso2.carbon.user.core_4.4.3.jar bundle apache2 6521
org.wso2.carbon.user.mgt.common_4.5.6.jar bundle apache2 5057
org.wso2.carbon.user.mgt.stub_4.5.6.jar bundle apache2 5056
org.wso2.carbon.user.mgt.ui_4.5.6.jar bundle apache2 5055
org.wso2.carbon.user.mgt_4.5.6.jar bundle apache2 5054
org.wso2.carbon.utils_4.4.3.jar bundle apache2 6515
org.wso2.carbon.wsdl2code.stub_4.4.8.jar bundle apache2 5846
org.wso2.carbon.wsdl2code.ui_4.4.8.jar bundle apache2 5845
org.wso2.carbon.wsdl2code_4.4.8.jar bundle apache2 5844
org.wso2.carbon.wsdl2form-4.4.8.jar bundle apache2 5722
org.wso2.ciphertool-1.0.0-wso2v3.jar bundle apache2 4038
org.wso2.mb.samples.mqtt.iot-3.0.0.jar bundle apache2 7139
org.wso2.mb.samples.mqtt.retain.sample-3.0.0.jar bundle apache2 7140
org.wso2.mb.samples.mqtt.simple-3.0.0-SNAPSHOT.jar bundle apache2 7141
org.wso2.mb.styles_3.1.0.jar bundle apache2 7161
org.wso2.securevault-1.0.0-wso2v2.jar bundle apache2 3537
org.wso2.securevault_1.0.0.wso2v2.jar bundle apache2 768
org.wso2.stratos.mb.dashboard.ui_3.1.0.jar bundle apache2 7160
pdepublishing-ant.jar jar epl1 524
pdepublishing.jar jar epl1 525
perf4j_0.9.12.wso2v1.jar bundle apache2 832
poi-ooxml_3.9.0.wso2v3.jar bundle apache2 3592
poi-scratchpad_3.9.0.wso2v1.jar bundle apache2 2205
poi_3.9.0.wso2v1.jar bundle apache2 2017
rampart-1.6.1-wso2v10.mar bundle apache2 2375
rampart-core_1.6.1.wso2v16.jar bundle apache2 5051
rampart-policy_1.6.1.wso2v16.jar bundle apache2 5050
rampart-trust_1.6.1.wso2v16.jar bundle apache2 5049
slf4j-1.5.10.wso2v1.jar bundle mit 3209
slf4j.api_1.6.1.jar bundle mit 354
slf4j.api_1.7.13.jar bundle mit 1606
slf4j.log4j12_1.6.1.jar bundle mit 346
slf4j.log4j12_1.7.13.jar bundle mit 1605
solr_5.2.1.wso2v1.jar bundle apache2 4384
spatial4j_0.4.1.wso2v1.jar bundle apache2 4045
spring.framework_3.2.9.wso2v1.jar bundle apache2 4044
stax2-api-3.1.4.jar bundle bsd 1089
tcpmon-1.0.jar jar bsd 255
tiles-jsp_2.0.5.wso2v1.jar bundle apache2 989
tomcat-annotations-api-7.0.59.jar jar apache2 1088
tomcat-catalina-ha_7.0.59.wso2v1.jar bundle apache2 3829
tomcat-el-api_7.0.59.wso2v1.jar bundle apache2 3828
tomcat-jsp-api_7.0.59.wso2v1.jar bundle apache2 3827
tomcat-juli-7.0.59.jar jar apache2 1086
tomcat-servlet-api_7.0.59.wso2v1.jar bundle apache2 3826
tomcat_7.0.59.wso2v3.jar bundle apache2 3985
uddi4j-1.0.1.jar jarinbundle ibmpl 406
wadl-core-1.1.3.wso2v2.jar bundle apache2 4069
woden_1.0.0.M9-wso2v1.jar bundle apache2 3755
woodstox-core-asl-4.4.1.jar bundle apache2 1087
wsdl-validator_1.2.0.wso2v1.jar bundle epl1 1175
wsdl4j_1.6.2.wso2v4.jar bundle apache2 745
wss4j_1.5.11.wso2v11.jar bundle apache2 5040
xalan-2.7.1.wso2v1.jar bundle apache2 659
xercesImpl-2.8.1.wso2v2.jar bundle apache2 663
xml-apis-1.3.04.wso2v2.jar bundle apache2 662
xmlbeans-2.3.0.jar jarinbundle apache2 344
xmlbeans_2.3.0.wso2v1.jar bundle apache2 749
XmlSchema_1.4.7.wso2v3.jar bundle apache2 3585
xmltooling-1.3.1.jar jarinbundle apache2 348
The license types used by the above libraries and their information is given below:
bouncy Bouncy Castle License
http://www.bouncycastle.org/licence.html
bsd Berkeley License
http://www.opensource.org/licenses/bsd-license.php
apache2 Apache License Version 2.0
http://www.apache.org/licenses/LICENSE-2.0.html
ibmpl IBM Public License 1.0
http://www.ibm.com/developerworks/library/os-ipl.html
mit MIT License
http://www.opensource.org/licenses/mit-license.php
cddl1 Common Development and Distribution License
http://www.opensource.org/licenses/cddl1.php
icu ICU License
http://source.icu-project.org/repos/icu/icu/trunk/license.html
epl1+lgpl2 EPL1 + LGPL2
http://www.eclipse.org/legal/epl-v10.html + http://www.gnu.org/licenses/licenses.html
epl1 Eclipse Public License
http://www.eclipse.org/legal/epl-v10.html

View File

@ -0,0 +1,177 @@
#WSO2 Message Broker
Welcome to the WSO2 Message broker.
WSO2 MB is a lightweight and easy-to-use Open Source Distributed Message Brokering
Server (MB) which is available under the Apache Software License v2.0.
This is based on the revolutionary WSO2 Carbon [Middleware a' la carte]
framework. All the major features have been developed as pluggable Carbon
components.
<h2>Key Features of WSO2 MB</h2>
WSO2 Message Broker brings messaging and eventing capabilities into your SOA framework.
The latest version of this product possesses following key features. All these features
can be used as standalone message broker or as a distributed message brokering system.
WSO2 Message Broker compatible with Advanced Message Queuing Protocol (AMQP)(0-91))
and Message Queuing Telemetry Transport Protocol (MQTT) v 3.1.1.
<ul>
<li> JMS Queuing support </li>
<li> JMS Pub/Sub mechanism for topics </li>
<li> Hierarchical Topics Subscriptions </li>
<li> Queue Message browsing with added UI support </li>
<li> Message Re-Delivery Tries Configuration </li>
<li> Message Re delivery Header Field support </li>
<li> Sample text message sender tool in UI </li>
<li> Queue purging support </li>
<li> Simple clustering machanism based on carbon clustering </li>
<li> Ability to view details of the cluster using Management Console </li>
<li> Message delivery fine tuning capabilities </li>
<li> Relational databases as a storage machanism </li>
</ul>
<h2>System Requirements</h2>
<ol>
<li> Minimum memory - 2GB </li>
<li> Processor - Pentium 800MHz or equivalent at minimum </li>
<li> Java SE Development Kit 1.7 or higher </li>
<li> The Management Console requires you to enable Javascript of the Web browser,
with MS IE 7. In addition to JavaScript, ActiveX should also be enabled
with IE. This can be achieved by setting your security level to
medium or lower. </li>
<li> To compile and run the sample clients, an Ant version is required. Ant 1.7.0
version is recommended. </li>
<li> To build WSO2 MB from the Source distribution, it is necessary that you have
JDK 7 and Maven 3.0.4 or later </li>
</ol>
For more details see
https://docs.wso2.com/display/MB320/Installation+Prerequisites
<h2>Installation & Running</h2>
<ol>
<li> Extract the wso2mb-3.2.0.zip and go to the extracted directory </li>
<li> Run the wso2server.sh or wso2server.bat as appropriate </li>
<li> Point your favourite browser to
https://localhost:9443/carbon
</li>
<li> Use the following username and password to login
username : admin
password : admin
</li>
</ol>
<h2>WSO2 MB 3.2.0 distribution directory structure</h2>
CARBON_HOME
|-- bin <folder>
|-- dbscripts <folder>
|-- client-lib <folder>
|-- lib <folder>
|-- repository <folder>
| |-- components <folder>
| |-- conf <folder>
| |-- Advanced <folder>
|-- datasources <folder>
| |-- database <folder>
| |-- deployment <folder>
| |-- logs <folder>
| |-- tenants <folder>
| |-- resources <folder>
| |-- security <folder>
|-- tmp <folder>
|-- LICENSE.txt <file>
|-- README.txt <file>
`-- release-notes.html <file>
- bin
Contains various scripts .sh & .bat scripts
- dbscripts
Contains the SQL scripts for setting up the database on a variety of
Database Management Systems, including H2, Derby, MSSQL, MySQL abd
Oracle.
- client-lib
Contains required libraries for JMS,Event Clients
- lib
Contains the basic set of libraries required to start-up WSO2 MB
in standalone mode
- repository
The repository where services and modules deployed in WSO2 MB
are stored.
- components
Contains OSGi bundles and configurations
- conf
Contains configuration files
- datasources
contains configuration for setting up databases.
- database
Contains the database
- deployment
Contains Axis2 deployment details
- logs
Contains all log files created during execution
- tenants
Contains tenant details
- resources
Contains additional resources that may be required
- security
Contains security resources
- tmp
Used for storing temporary files, and is pointed to by the
java.io.tmpdir System property
- LICENSE.txt
Apache License 2.0 under which WSO2 MB is distributed.
- README.txt
This document.
<h2>Support</h2>
WSO2 Inc. offers a variety of development and production support
programs, ranging from Web-based support up through normal business
hours, to premium 24x7 phone support.
For additional support information please refer to http://wso2.com/support/
For more information on WSO2 MB, visit the WSO2 Oxygen Tank (http://wso2.org)
For more details and to take advantage of this unique opportunity please visit
http://wso2.com/support/
Thank you for your interest in WSO2 Message Broker.
<h2>Known Issues</h2>
https://wso2.org/jira/issues/?filter=12509
WSO2 Message Broker is compatible with AMQP 0-91 version only.
<h2> Build Status </h2>
| Branch | Build Status |
| :------------ |:-------------
| Java 7 | [![Build Status](https://wso2.org/jenkins/job/product-mb/badge/icon)](https://wso2.org/jenkins/job/product-mb) |
| Java 8 | [![Build Status](https://wso2.org/jenkins/job/product-mb__java8/badge/icon)](https://wso2.org/jenkins/job/product-mb__java8/) |
(c) 2015, WSO2 Inc.

View File

@ -0,0 +1,205 @@
================================================================================
WSO2 Message Broker Server 3.2.0
================================================================================
Welcome to the WSO2 MB 3.1.0 release
WSO2 MB is a lightweight and easy-to-use Open Source Distributed Message Brokering
Server (MB) which is available under the Apache Software License v2.0.
This is based on the revolutionary WSO2 Carbon [Middleware a' la carte]
framework. All the major features have been developed as pluggable Carbon
components.
Key Features of WSO2 MB
==================================
WSO2 Message Broker brings messaging and eventing capabilities into your SOA framework.
The latest version of this product possesses following key features. All these features
can be used as standalone message broker or as a distributed message brokering system.
WSO2 Message Broker compatible with Advanced Message Queuing Protocol (AMQP)(0-91))
and Message Queuing Telemetry Transport Protocol (MQTT) v 3.1.1.
• JMS Queuing support
• JMS Pub/Sub mechanism for topics
• Hierarchical Topics Subscriptions
• Queue Message browsing with added UI support
• Message Re-Delivery Tries Configuration
• Message Re delivery Header Field support
• Sample text message sender tool in UI
• Queue purging support
• Simple clustering machanism based on carbon clustering
• Ability to view details of the cluster using Management Console
• Message delivery fine tuning capabilities
• Relational databases as a storage machanism
System Requirements
=======================
1. Minimum memory - 2GB
2. Processor - Pentium 800MHz or equivalent at minimum
3. Java SE Development Kit 1.7 or higher
4. The Management Console requires you to enable Javascript of the Web browser,
with MS IE 7. In addition to JavaScript, ActiveX should also be enabled
with IE. This can be achieved by setting your security level to
medium or lower.
5. To compile and run the sample clients, an Ant version is required. Ant 1.7.0
version is recommended
6. To build WSO2 MB from the Source distribution, it is necessary that you have
JDK 7 and Maven 3.0.4 or later
For more details see
https://docs.wso2.com/display/MB310/Installation+Prerequisites
Installation & Running
==================================
1. Extract the wso2mb-3.1.0.zip and go to the extracted directory
2. Run the wso2server.sh or wso2server.bat as appropriate
3. Point your favourite browser to
https://localhost:9443/carbon
4. Use the following username and password to login
username : admin
password : admin
WSO2 MB 3.1.0 distribution directory structure
=============================================
CARBON_HOME
|-- bin <folder>
|-- dbscripts <folder>
|-- client-lib <folder>
|-- lib <folder>
|-- repository <folder>
| |-- components <folder>
| |-- conf <folder>
| |-- Advanced <folder>
|-- datasources <folder>
| |-- database <folder>
| |-- deployment <folder>
| |-- logs <folder>
| |-- tenants <folder>
| |-- resources <folder>
| |-- security <folder>
|-- tmp <folder>
|-- LICENSE.txt <file>
|-- README.txt <file>
`-- release-notes.html <file>
- bin
Contains various scripts .sh & .bat scripts
- dbscripts
Contains the SQL scripts for setting up the database on a variety of
Database Management Systems, including H2, Derby, MSSQL, MySQL abd
Oracle.
- client-lib
Contains required libraries for JMS,Event Clients
- lib
Contains the basic set of libraries required to start-up WSO2 MB
in standalone mode
- repository
The repository where services and modules deployed in WSO2 MB
are stored.
- components
Contains OSGi bundles and configurations
- conf
Contains configuration files
- datasources
contains configuration for setting up databases.
- database
Contains the database
- deployment
Contains Axis2 deployment details
- logs
Contains all log files created during execution
- tenants
Contains tenant details
- resources
Contains additional resources that may be required
- security
Contains security resources
- tmp
Used for storing temporary files, and is pointed to by the
java.io.tmpdir System property
- LICENSE.txt
Apache License 2.0 under which WSO2 MB is distributed.
- README.txt
This document.
Support
==================================
WSO2 Inc. offers a variety of development and production support
programs, ranging from Web-based support up through normal business
hours, to premium 24x7 phone support.
For additional support information please refer to http://wso2.com/support/
For more information on WSO2 MB, visit the WSO2 Oxygen Tank (http://wso2.org)
For more details and to take advantage of this unique opportunity please visit
http://wso2.com/support/
Thank you for your interest in WSO2 Message Broker.
Known Issues
==================================
https://wso2.org/jira/issues/?filter=12509
WSO2 Message Broker is compatible with AMQP 0-91 version only.
Crypto Notice
==================================
This distribution includes cryptographic software. The country in
which you currently reside may have restrictions on the import,
possession, use, and/or re-export to another country, of
encryption software. BEFORE using any encryption software, please
check your country's laws, regulations and policies concerning the
import, possession, or use, and re-export of encryption software, to
see if this is permitted. See <http://www.wassenaar.org/> for more
information.
The U.S. Government Department of Commerce, Bureau of Industry and
Security (BIS), has classified this software as Export Commodity
Control Number (ECCN) 5D002.C.1, which includes information security
software using or performing cryptographic functions with asymmetric
algorithms. The form and manner of this Apache Software Foundation
distribution makes it eligible for export under the License Exception
ENC Technology Software Unrestricted (TSU) exception (see the BIS
Export Administration Regulations, Section 740.13) for both object
code and source code.
The following provides more details on the included cryptographic
software:
Apache Rampart : http://ws.apache.org/rampart/
Apache WSS4J : http://ws.apache.org/wss4j/
Apache Santuario : http://santuario.apache.org/
Bouncycastle : http://www.bouncycastle.org/
--------------------------------------------------------------------------------
(c) Copyright 2015 WSO2 Inc.

View File

@ -0,0 +1,249 @@
# Eclipse Runtime Configuration Overrides
# These properties are loaded prior to starting the framework and can also be used to override System Properties
# @null is a special value used to override and clear the framework's copy of a System Property prior to starting the framework
# "*" can be used together with @null to clear System Properties that match a prefix name.
osgi.*=@null
org.osgi.*=@null
eclipse.*=@null
osgi.parentClassloader=app
osgi.contextClassLoaderParent=app
# When osgi.clean is set to "true", any cached data used by the OSGi framework
# will be wiped clean. This will clean the caches used to store bundle
# dependency resolution and eclipse extension registry data. Using this
# option will force OSGi framework to reinitialize these caches.
# The following setting is put in place to get rid of the problems
# faced when re-starting the system. Please note that, when this setting is
# true, if you manually start a bundle, it would not be available when
# you re-start the system. To avid this, copy the bundle jar to the plugins
# folder, before you re-start the system.
osgi.clean=true
# Uncomment the following line to turn on Eclipse Equinox debugging.
# You may also edit the osgi-debug.options file and fine tune the debugging
# options to suite your needs.
#osgi.debug=./repository/conf/osgi-debug.options
# Following system property allows us to control the public JDK packages exported through the system bundle.
org.osgi.framework.system.packages=javax.accessibility,\
javax.activity,\
javax.crypto,\
javax.crypto.interfaces,\
javax.crypto.spec,\
javax.imageio,\
javax.imageio.event,\
javax.imageio.metadata,\
javax.imageio.plugins.bmp,\
javax.imageio.plugins.jpeg,\
javax.imageio.spi,\
javax.imageio.stream,\
javax.jms,\
javax.management,\
javax.management.loading,\
javax.management.modelmbean,\
javax.management.monitor,\
javax.management.openmbean,\
javax.management.relation,\
javax.management.remote,\
javax.management.remote.rmi,\
javax.management.timer,\
javax.naming,\
javax.naming.directory,\
javax.naming.event,\
javax.naming.ldap,\
javax.naming.spi,\
javax.net,\
javax.net.ssl,\
javax.print,\
javax.print.attribute,\
javax.print.attribute.standard,\
javax.print.event,\
javax.rmi,\
javax.rmi.CORBA,\
javax.rmi.ssl,\
javax.script,\
javax.security.auth,\
javax.security.auth.callback,\
javax.security.auth.kerberos,\
javax.security.auth.login,\
javax.security.auth.spi,\
javax.security.auth.x500,\
javax.security.cert,\
javax.security.sasl,\
javax.sound.midi,\
javax.sound.midi.spi,\
javax.sound.sampled,\
javax.sound.sampled.spi,\
javax.sql,\
javax.sql.rowset,\
javax.sql.rowset.serial,\
javax.sql.rowset.spi,\
javax.swing,\
javax.swing.border,\
javax.swing.colorchooser,\
javax.swing.event,\
javax.swing.filechooser,\
javax.swing.plaf,\
javax.swing.plaf.basic,\
javax.swing.plaf.metal,\
javax.swing.plaf.multi,\
javax.swing.plaf.synth,\
javax.swing.table,\
javax.swing.text,\
javax.swing.text.html,\
javax.swing.text.html.parser,\
javax.swing.text.rtf,\
javax.swing.tree,\
javax.swing.undo,\
javax.transaction,\
javax.transaction.xa,\
javax.xml.namespace,\
javax.xml.parsers,\
javax.xml.transform,\
javax.xml.transform.stream,\
javax.xml.transform.dom,\
javax.xml.transform.sax,\
javax.xml,\
javax.xml.validation,\
javax.xml.datatype,\
javax.xml.xpath,\
javax.activation,\
com.sun.activation.registries,\
com.sun.activation.viewers,\
org.ietf.jgss,\
org.omg.CORBA,\
org.omg.CORBA_2_3,\
org.omg.CORBA_2_3.portable,\
org.omg.CORBA.DynAnyPackage,\
org.omg.CORBA.ORBPackage,\
org.omg.CORBA.portable,\
org.omg.CORBA.TypeCodePackage,\
org.omg.CosNaming,\
org.omg.CosNaming.NamingContextExtPackage,\
org.omg.CosNaming.NamingContextPackage,\
org.omg.Dynamic,\
org.omg.DynamicAny,\
org.omg.DynamicAny.DynAnyFactoryPackage,\
org.omg.DynamicAny.DynAnyPackage,\
org.omg.IOP,\
org.omg.IOP.CodecFactoryPackage,\
org.omg.IOP.CodecPackage,\
org.omg.Messaging,\
org.omg.PortableInterceptor,\
org.omg.PortableInterceptor.ORBInitInfoPackage,\
org.omg.PortableServer,\
org.omg.PortableServer.CurrentPackage,\
org.omg.PortableServer.POAManagerPackage,\
org.omg.PortableServer.POAPackage,\
org.omg.PortableServer.portable,\
org.omg.PortableServer.ServantLocatorPackage,\
org.omg.SendingContext,\
org.omg.stub.java.rmi,\
org.w3c.dom,\
org.w3c.dom.bootstrap,\
org.w3c.dom.css,\
org.w3c.dom.events,\
org.w3c.dom.html,\
org.w3c.dom.ls,\
org.w3c.dom.ranges,\
org.w3c.dom.stylesheets,\
org.w3c.dom.traversal,\
org.w3c.dom.views ,\
org.xml.sax,\
org.xml.sax.ext,\
org.xml.sax.helpers,\
org.apache.xerces.xpointer,\
org.apache.xerces.xni.grammars,\
org.apache.xerces.impl.xs.util,\
org.apache.xerces.jaxp.validation,\
org.apache.xerces.impl.dtd.models,\
org.apache.xerces.impl.xpath,\
org.apache.xerces.dom3.as,\
org.apache.xerces.impl.dv.xs,\
org.apache.xerces.util,\
org.apache.xerces.impl.xs.identity,\
org.apache.xerces.impl.xs.opti,\
org.apache.xerces.jaxp,\
org.apache.xerces.impl.dv,\
org.apache.xerces.xs.datatypes,\
org.apache.xerces.dom.events,\
org.apache.xerces.impl.msg,\
org.apache.xerces.xni,\
org.apache.xerces.impl.xs,\
org.apache.xerces.impl,\
org.apache.xerces.impl.io,\
org.apache.xerces.xinclude,\
org.apache.xerces.jaxp.datatype,\
org.apache.xerces.parsers,\
org.apache.xerces.impl.dv.util,\
org.apache.xerces.xni.parser,\
org.apache.xerces.impl.xs.traversers,\
org.apache.xerces.impl.dv.dtd,\
org.apache.xerces.xs,\
org.apache.xerces.impl.dtd,\
org.apache.xerces.impl.validation,\
org.apache.xerces.impl.xs.models,\
org.apache.xerces.impl.xpath.regex,\
org.apache.xml.serialize,\
org.apache.xerces.dom,\
org.apache.xalan,\
org.apache.xalan.xslt,\
org.apache.xalan.templates,\
org.apache.xalan.xsltc,\
org.apache.xalan.xsltc.cmdline,\
org.apache.xalan.xsltc.cmdline.getopt,\
org.apache.xalan.xsltc.trax,\
org.apache.xalan.xsltc.dom,\
org.apache.xalan.xsltc.runtime,\
org.apache.xalan.xsltc.runtime.output,\
org.apache.xalan.xsltc.util,\
org.apache.xalan.xsltc.compiler,\
org.apache.xalan.xsltc.compiler.util,\
org.apache.xalan.serialize,\
org.apache.xalan.client,\
org.apache.xalan.res,\
org.apache.xalan.transformer,\
org.apache.xalan.extensions,\
org.apache.xalan.lib,\
org.apache.xalan.lib.sql,\
org.apache.xalan.processor,\
org.apache.xalan.trace,\
org.apache.xml.dtm,\
org.apache.xml.dtm.ref,\
org.apache.xml.dtm.ref.sax2dtm,\
org.apache.xml.dtm.ref.dom2dtm,\
org.apache.xml.utils,\
org.apache.xml.utils.res,\
org.apache.xml.res,\
org.apache.xml.serializer,\
org.apache.xml.serializer.utils,\
org.apache.xpath,\
org.apache.xpath.domapi,\
org.apache.xpath.objects,\
org.apache.xpath.patterns,\
org.apache.xpath.jaxp,\
org.apache.xpath.res,\
org.apache.xpath.operations,\
org.apache.xpath.functions,\
org.apache.xpath.axes,\
org.apache.xpath.compiler,\
org.apache.xml.resolver,\
org.apache.xml.resolver.tools,\
org.apache.xml.resolver.helpers,\
org.apache.xml.resolver.readers,\
org.apache.xml.resolver.etc,\
org.apache.xml.resolver.apps,\
javax.xml.ws,\
javax.xml.bind,\
javax.xml.bind.annotation,\
javax.annotation,\
javax.jws,\
javax.jws.soap,\
javax.xml.soap,\
com.sun.xml.internal.messaging.saaj.soap.ver1_1,\
com.sun.xml.internal.messaging.saaj.soap,\
com.sun.tools.internal.ws.spi,\
org.github.jamm,\
org.wso2.carbon.bootstrap

View File

@ -0,0 +1,239 @@
#
# Copyright 2009-2015 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 log4j configuration file used by WSO2 Carbon
#
# IMPORTANT : Please do not remove or change the names of any
# of the Appenders defined here. The layout pattern & log file
# can be changed using the WSO2 Carbon Management Console, and those
# settings will override the settings in this file.
#
log4j.rootLogger=INFO, CARBON_CONSOLE, CARBON_LOGFILE, CARBON_MEMORY, CARBON_SYS_LOG
log4j.logger.AUDIT_LOG=INFO, AUDIT_LOGFILE
log4j.logger.org.apache.axis2.wsdl.codegen.writer.PrettyPrinter=ERROR, CARBON_LOGFILE, CARBON_MEMORY
log4j.logger.org.apache.axis2.clustering=INFO, CARBON_CONSOLE, CARBON_LOGFILE
log4j.logger.org.apache=INFO, CARBON_LOGFILE, CARBON_MEMORY
log4j.logger.org.apache.catalina=WARN
log4j.logger.org.apache.tomcat=WARN
log4j.logger.org.wso2.carbon.apacheds=WARN
log4j.logger.org.apache.directory.server.ldap=WARN
log4j.logger.org.apache.directory.server.core.event=WARN
log4j.logger.com.atomikos=INFO,ATOMIKOS
log4j.logger.org.quartz=WARN
log4j.logger.org.apache.jackrabbit.webdav=WARN
log4j.logger.org.apache.juddi=ERROR
log4j.logger.org.apache.commons.digester.Digester=WARN
log4j.logger.org.apache.jasper.compiler.TldLocationsCache=WARN
log4j.logger.org.apache.qpid=WARN
log4j.logger.org.apache.qpid.server.Main=INFO
log4j.logger.qpid.message=WARN
log4j.logger.qpid.message.broker.listening=INFO
log4j.logger.org.apache.tiles=WARN
log4j.logger.org.apache.commons.httpclient=ERROR
log4j.logger.org.apache.coyote=WARN
log4j.logger.org.apache.solr=ERROR
log4j.logger.org.infinispan=WARN
log4j.logger.org.jgroups=ERROR
log4j.logger.org.wso2=INFO
log4j.logger.org.apache.axis2.enterprise=FATAL, CARBON_LOGFILE, CARBON_MEMORY
log4j.logger.org.opensaml.xml=WARN, CARBON_LOGFILE, CARBON_MEMORY
log4j.logger.org.apache.directory.shared.ldap=WARN, CARBON_LOGFILE, CARBON_MEMORY
log4j.logger.org.apache.directory.server.ldap.handlers=WARN, CARBON_LOGFILE, CARBON_MEMORY
#Following are to remove false error messages from startup (IS)
log4j.logger.org.apache.directory.shared.ldap.entry.DefaultServerAttribute=FATAL, CARBON_LOGFILE, CARBON_MEMORY
log4j.logger.org.apache.directory.server.core.DefaultDirectoryService=ERROR, CARBON_LOGFILE, CARBON_MEMORY
log4j.logger.org.apache.directory.shared.ldap.ldif.LdifReader=ERROR, CARBON_LOGFILE, CARBON_MEMORY
log4j.logger.org.apache.directory.server.ldap.LdapProtocolHandler=ERROR, CARBON_LOGFILE, CARBON_MEMORY
log4j.logger.org.apache.directory.server.core=ERROR, CARBON_LOGFILE, CARBON_MEMORY
#Hive Related Log configurations
log4j.logger.DataNucleus=ERROR
log4j.logger.Datastore=ERROR
log4j.logger.Datastore.Schema=ERROR
log4j.logger.JPOX.Datastore=ERROR
log4j.logger.JPOX.Plugin=ERROR
log4j.logger.JPOX.MetaData=ERROR
log4j.logger.JPOX.Query=ERROR
log4j.logger.JPOX.General=ERROR
log4j.logger.JPOX.Enhancer=ERROR
log4j.logger.org.apache.hadoop.hive=WARN
log4j.logger.hive=WARN
log4j.logger.ExecMapper=WARN
log4j.logger.ExecReducer=WARN
#andes specific
log4j.logger.org.wso2.andes.server.handler.ConnectionStartOkMethodHandler=WARN
log4j.logger.org.wso2.andes.server.handler.ChannelOpenHandler=WARN
log4j.logger.org.wso2.andes.server.handler.ChannelCloseHandler=WARN
log4j.logger.org.wso2.andes.server.AMQChannel=WARN
log4j.logger.org.wso2.andes.server.handler.ConnectionCloseMethodHandler=WARN
log4j.logger.org.wso2.andes.server.handler.QueueDeclareHandler=WARN
log4j.logger.org.wso2.andes.server.handler.QueueBindHandler=WARN
log4j.logger.org.wso2.andes.server.virtualhost.VirtualHostConfigRecoveryHandler=WARN
log4j.logger.org.wso2.andes.amqp.QpidAndesBridge=WARN
log4j.logger.trace.messages=TRACE,CARBON_TRACE_LOGFILE
#trace level logs for WSO2 Message Broker
#log4j.logger.org.wso2.andes.server.trace=TRACE,CARBON_TRACE_LOGFILE
# Uncomment to enable MessageTracer
log4j.logger.org.wso2.andes.tools.utils.MessageTracer=INFO,CARBON_TRACE_LOGFILE
#Andes logs for troubleshooting
#log4j.logger.org.wso2.andes.kernel.MessageFlusher=DEBUG
#log4j.logger.org.wso2.andes.kernel.slot.SlotDeliveryWorker=DEBUG
#log4j.logger.org.wso2.andes.amqp.QpidAndesBridge=DEBUG
#log4j.logger.org.wso2.andes.server.AMQChannel=DEBUG
#log4j.logger.org.wso2.andes.kernel.slot.SlotDeliveryWorkerManager=DEBUG
#log4j.logger.org.wso2.andes.kernel.distruptor.inbound.MessageWriter=DEBUG
#log4j.logger.org.wso2.andes.kernel.distruptor.inbound.AckHandler=DEBUG
#log4j.logger.org.wso2.andes.kernel.distruptor.inbound.StateEventHandler=DEBUG
#log4j.logger.org.wso2.andes.kernel.slot.SlotManagerClusterMode=DEBUG
#log4j.logger.org.wso2.andes.subscription.LocalSubscription=DEBUG
#log4j.logger.org.wso2.andes.subscription.SubscriptionStore=DEBUG
#MQTT specific
#log4j.logger.org.dna.mqtt.wso2.AndesMQTTBridge=DEBUG
#log4j.logger.org.dna.mqtt.moquette.messaging.spi.impl.ProtocolProcessor=DEBUG
# DAS_AGENT is set to be a Custom Log Appender.
#log4j.appender.DAS_AGENT=org.wso2.carbon.analytics.shared.data.agents.log4j.appender.LogEventAppender
# DAS_AGENT uses PatternLayout.
#log4j.appender.DAS_AGENT.layout=org.wso2.carbon.analytics.shared.data.agents.log4j.util.TenantAwarePatternLayout
#log4j.appender.DAS_AGENT.columnList=%D,%S,%A,%d,%c,%p,%m,%H,%I,%Stacktrace
#log4j.appender.DAS_AGENT.userName=admin
#log4j.appender.DAS_AGENT.password=admin
#log4j.appender.DAS_AGENT.url=tcp://localhost:7612
#log4j.appender.DAS_AGENT.maxTolerableConsecutiveFailure=5
#log4j.appender.DAS_AGENT.streamDef=loganalyzer:1.0.0
log4j.additivity.org.apache.axis2.clustering=false
log4j.additivity.com.atomikos=false
# CARBON_CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CARBON_CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CARBON_CONSOLE.layout=org.wso2.carbon.utils.logging.TenantAwarePatternLayout
# ConversionPattern will be overridden by the configuration setting in the DB
log4j.appender.CARBON_CONSOLE.layout.ConversionPattern=[%d] %P%5p {%c} - %x %m%n
log4j.appender.CARBON_CONSOLE.layout.TenantPattern=%U%@%D[%T]
log4j.appender.CARBON_CONSOLE.threshold=DEBUG
# The memory appender for logging
log4j.appender.CARBON_MEMORY=org.wso2.carbon.logging.service.appender.CarbonMemoryAppender
log4j.appender.CARBON_MEMORY.bufferSize=2000
log4j.appender.CARBON_MEMORY.layout=org.wso2.carbon.utils.logging.TenantAwarePatternLayout
# ConversionPattern will be overridden by the configuration setting in the DB
log4j.appender.CARBON_MEMORY.layout.ConversionPattern=TID: [%T] [%S] [%d] %P%5p {%c} - %x %m {%c}%n
log4j.appender.CARBON_MEMORY.layout.TenantPattern=%U%@%D [%T] [%S]
log4j.appender.CARBON_MEMORY.columnList=%T,%S,%A,%d,%c,%p,%m,%H,%I,%Stacktrace
log4j.appender.CARBON_MEMORY.threshold=DEBUG
# CARBON_LOGFILE is set to be a DailyRollingFileAppender using a PatternLayout.
log4j.appender.CARBON_LOGFILE=org.apache.log4j.DailyRollingFileAppender
# Log file will be overridden by the configuration setting in the DB
# This path should be relative to WSO2 Carbon Home
log4j.appender.CARBON_LOGFILE.File=${carbon.home}/repository/logs/${instance.log}/wso2carbon${instance.log}.log
log4j.appender.CARBON_LOGFILE.Append=true
log4j.appender.CARBON_LOGFILE.layout=org.wso2.carbon.utils.logging.TenantAwarePatternLayout
# ConversionPattern will be overridden by the configuration setting in the DB
log4j.appender.CARBON_LOGFILE.layout.ConversionPattern=TID: [%T] [%S] [%d] %P%5p {%c} - %x %m {%c}%n
log4j.appender.CARBON_LOGFILE.layout.TenantPattern=%U%@%D [%T] [%S]
log4j.appender.CARBON_LOGFILE.threshold=DEBUG
log4j.appender.CARBON_SYS_LOG = org.apache.log4j.net.SyslogAppender
log4j.appender.CARBON_SYS_LOG.layout=org.apache.log4j.PatternLayout
log4j.appender.CARBON_SYS_LOG.layout.ConversionPattern=[%d] %5p {%c} - %x %m {%c}%n
log4j.appender.CARBON_SYS_LOG.SyslogHost=localhost
log4j.appender.CARBON_SYS_LOG.Facility=USER
log4j.appender.CARBON_SYS_LOG.threshold=DEBUG
# LOGEVENT is set to be a LogEventAppender using a PatternLayout to send logs to LOGEVENT
log4j.appender.LOGEVENT=org.wso2.carbon.logging.appender.LogEventAppender
log4j.appender.LOGEVENT.url=tcp://10.100.3.103:7611
log4j.appender.LOGEVENT.layout=org.wso2.carbon.utils.logging.TenantAwarePatternLayout
log4j.appender.LOGEVENT.columnList=%T,%S,%A,%d,%c,%p,%m,%H,%I,%Stacktrace
log4j.appender.LOGEVENT.userName=admin
log4j.appender.LOGEVENT.password=admin
# Appender config to CARBON_TRACE_LOGFILE
log4j.appender.CARBON_TRACE_LOGFILE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.CARBON_TRACE_LOGFILE.File=${carbon.home}/repository/logs/${instance.log}/wso2carbon-trace-messages${instance.log}.log
log4j.appender.CARBON_TRACE_LOGFILE.Append=true
log4j.appender.CARBON_TRACE_LOGFILE.layout=org.wso2.carbon.utils.logging.TenantAwarePatternLayout
log4j.appender.CARBON_TRACE_LOGFILE.layout.ConversionPattern=[%d] %P%5p {%c} - %x %m {%c}%n
log4j.appender.CARBON_TRACE_LOGFILE.layout.TenantPattern=%U%@%D [%T] [%S]
log4j.appender.CARBON_TRACE_LOGFILE.threshold=TRACE
log4j.additivity.trace.messages=false
# Appender config to AUDIT_LOGFILE
log4j.appender.AUDIT_LOGFILE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.AUDIT_LOGFILE.File=${carbon.home}/repository/logs/audit.log
log4j.appender.AUDIT_LOGFILE.Append=true
log4j.appender.AUDIT_LOGFILE.layout=org.wso2.carbon.utils.logging.TenantAwarePatternLayout
log4j.appender.AUDIT_LOGFILE.layout.ConversionPattern=[%d] %P%5p - %x %m %n
log4j.appender.AUDIT_LOGFILE.layout.TenantPattern=%U%@%D [%T] [%S]
log4j.appender.AUDIT_LOGFILE.threshold=INFO
log4j.additivity.AUDIT_LOG=false
# Appender config to send Atomikos transaction logs to new log file tm.out.
log4j.appender.ATOMIKOS = org.apache.log4j.RollingFileAppender
log4j.appender.ATOMIKOS.File = repository/logs/tm.out
log4j.appender.ATOMIKOS.Append = true
log4j.appender.ATOMIKOS.layout = org.apache.log4j.PatternLayout
log4j.appender.ATOMIKOS.layout.ConversionPattern=%p %t %c - %m%n
# This file is used to override the default logger settings, and is used to remove unwanted logs from Shindig appearing on the console.
# Specification of Handler used by Console Logger
handlers=java.util.logging.ConsoleHandler
# Replacing default INFO level with SEVERE
java.util.logging.ConsoleHandler.level=SEVERE
# moquette-log properties
log4j.logger.org.dna.mqtt=INFO
log4j.logger.org.dna.mqtt.moquette.messaging.spi.impl.ProtocolProcessor=INFO
log4j.logger.org.dna.mqtt.moquette.messaging.spi.impl.SimpleMessaging=WARN
#Protocol parsing
log4j.logger.org.dna.mqtt.moquette.server.netty.NettyMQTTHandler=WARN
#log4j.logger.org.dna.mqtt.moquette.server.netty.NettyMQTTHandler=DEBUG
log4j.logger.org.dna.mqtt.moquette.parser.netty=WARN
#Storage server
#log4j.logger.org.dna.mqtt.moquette.messaging.spi.impl.subscriptions.SubscriptionsStore=DEBUG
#log4j.logger.org.dna.mqtt.moquette.messaging.spi.impl.HawtDBStorageService=DEBUG
# stdout appender is set to be a ConsoleAppender.
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
#log4j.appender.stdout.Threshold=WARN
#log4j.appender.stdout.Threshold=INFO
#log4j.appender.stdout.Threshold=DEBUG
#log4j.appender.stdout.Threshold=TRACE
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%-4r [%t] %-5p %c{1} %x - %m%n
#file appender
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.Threshold=INFO
log4j.appender.file.File=wso2carbon.log
log4j.appender.file.MaxFileSize=1MB
log4j.appender.file.MaxBackupIndex=1
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%-4r [%t] %-5p %c{1} %x - %m%n

View File

@ -0,0 +1,223 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 2009, 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.
-->
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=iso-8859-1" http-equiv="content-type"/>
<title>WSO2 Message Broker 3.1.0 Released!</title>
<link href="css/mb-docs.css" rel="stylesheet"/>
<link href="styles/dist-docs.css" rel="stylesheet" type="text/css"
media="all"/>
</head>
<body>
<div id="header">
</div>
<div id="main-content">
<h1>WSO2 Message Broker (MB) 3.1.0 Released!</h1>
<p>
The WSO2 Message Broker team is pleased to announce the 3.1.0 release of WSO2 Message Broker (MB).
</p>
<p>WSO2 MB is a lightweight and easy-to-use Open Source Distributed Message Brokering
Server (MB) which is available under the Apache Software License v2.0.
This is based on the revolutionary WSO2 Carbon [Middleware a' la carte]
framework. All the major features have been developed as pluggable Carbon
components.
</p>
<p>
WSO2 MB v 3.1.0 is developed on top of the revolutionary
<a href="http://wso2.org/projects/carbon">WSO2 Carbon platform</a> (Middleware a' la carte),
an OSGi based framework that provides seamless modularity to your SOA via
componentization. This release also contains many new features and a range of optional
components (add-ons) that can be installed to customize the behavior of the MB. Further, any
existing features of the MB which are not required to your environment can be easily
removed using the underlying provisioning framework of Carbon. In brief, WSO2 MB can
be fully customized and tailored to meet your exact SOA needs.
</p>
<p>
You can download this distribution from
<a href="http://wso2.org/downloads/message-broker">
http://wso2.org/downloads/message-broker
</a>
</p>
<h2>How to Run </h2>
<ol>
<li>Extract the downloaded zip</li>
<li>Go to the bin directory in the extracted folder</li>
<li>Run the wso2server.sh or wso2server.bat as appropriate</li>
<li>Point your browser to the URL https://localhost:9443/carbon</li>
<li>Use "admin", "admin" as the username and password to login as an admin</li>
<li>If you need to start the OSGi console with the server use the property
-DosgiConsole when starting the server. </li>
</ol>
<h2>New Features of WSO2 MB 3.1.0</h2>
<p>This release of Message Broker comes with a horde of new features and bug fixes. </p>
<h2>New Features</h2>
<p><a href="https://wso2.org/jira/browse/MB-1592">MB-1592</a> Support for PostgreSQL as the Message Store </p>
<p><a href="https://wso2.org/jira/browse/MB-1588">MB-615</a> Forcefully Delete and Subscriptions </p>
<h2>Key Features of WSO2 Message Broker</h2>
<p>WSO2 Message Broker brings messaging and eventing capabilities into your SOA
framework. Message Broker contains all the previously available features except
SQS support. Those are :
</p>
<ul>
<li>JMS Queuing support</li>
<li>JMS Pub/Sub mechanism for topics</li>
<li>Hierarchical Topics Subscriptions</li>
<li>Queue Message browsing with added UI support</li>
<li>Message Re-Delivery Tries Configuration</li>
<li>Message Re delivery Header Field support</li>
<li>Sample text message sender tool in UI</li>
<li>Queue purging support</li>
<li>Simple clustering machanism based on carbon clustering</li>
<li>Ability to view details of the cluster using Management Console</li>
<li>Message delivery fine tuning capabilities</li>
<li>Relational databases as a storage machanism</li>
</ul>
<p>The underlying JMS engine handles WS-Eventing/JMS synchronisation that enables
exposing and consuming your events using two different standard API's.
</p>
<h2>Project Resources</h2>
<ul>
<li>
<strong>Home page:</strong>
<a href="http://wso2.com/products/message-broker/">
http://wso2.com/products/message-broker/
</a>
</li>
<li>
<strong>Wiki:</strong>
<a href="https://docs.wso2.com/display/MB310/WSO2+Message+Broker+Documentation">
https://docs.wso2.com/display/MB310/WSO2+Message+Broker+Documentation
</a>
</li>
<li>
<strong>JIRA-Issue Tracker:</strong>
<a href="https://wso2.org/jira/browse/MB">https://wso2.org/jira/browse/MB</a>
</li>
</ul>
<h2>Bugs Fixed in This Release</h2>
<p>
This release of WSO2 MB comes with a number of bug fixes, both in the base
framework and the MB specific components. All the issues which have been
fixed in MB v 3.1.0 are recorded at following locations:
</p>
<ul>
<li><a href="https://wso2.org/jira/issues/?filter=12639">
Fixed MB specific issues</a></li>
</ul>
<h2>Known Issues</h2>
<p>
All the open issues pertaining to WSO2 MB v 3.1.0 are reported at following
locations:
</p>
<ul>
<li><a href="https://wso2.org/jira/issues/?filter=12509">
WSO2 MB 3.1.0 component issues</a></li>
</ul>
<h2>How You Can Contribute</h2>
<h3>
Mailing Lists
</h3>
<p>
Join our mailing list and correspond with the developers directly.
</p>
<ul>
<li>
Developer List :
<a href="mailto:dev@wso2.org">dev@wso2.org</a>
|
<a href="mailto:dev-request@wso2.org?subject=subscribe">Subscribe</a>
|
<a href="http://wso2.org/mailarchive/carbon-dev/">Mail Archive</a>
</li>
<li>
User List :
<a href="http://stackoverflow.com/questions/tagged/wso2">StackOverflow.com</a>
</li>
</ul>
<h3>
Reporting Issues
</h3>
<p>
WSO2 encourages you to report issues and your enhancement requests for the
WSO2 MB using the public<a
href="https://wso2.org/jira/browse/MB"> JIRA</a>.
</p>
<p>
You can also watch how they are resolved, and comment on the progress..
</p>
<h2>Support</h2>
<p>We are committed to ensuring that your enterprise middleware deployment is completely
supported from evaluation to production. Our unique approach ensures that all
support leverages our open development methodology and is provided by the very same
engineers who build the technology.
</p>
<p>For more details and to take advantage of this unique opportunity please visit
<a href="http://wso2.com/support/">http://wso2.com/support/</a>
</p>
<p>For more information on WSO2 MB Please see<a
href="http://wso2.com/products/message-broker/">
http://wso2.com/products/message-broker/</a>, visit the WSO2 Oxygen Tank developer
portal for additional
resources.
</p>
<p>Thank you for your interest in WSO2 Message Broker.
</p>
<p>
<i>-- The WSO2 MB Team --</i>
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,177 @@
@echo off
REM ---------------------------------------------------------------------------
REM Copyright 2005-2009 WSO2, Inc. http://www.wso2.org
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 ---------------------------------------------------------------------------
rem Main Script for WSO2 Carbon
rem
rem Environment Variable Prequisites
rem
rem CARBON_HOME Home of CARBON installation. If not set I will try
rem to figure it out.
rem
rem JAVA_HOME Must point at your Java Development Kit installation.
rem
rem JAVA_OPTS (Optional) Java runtime options used when the commands
rem is executed.
rem ---------------------------------------------------------------------------
rem ----- if JAVA_HOME is not set we're not happy ------------------------------
:checkJava
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
goto checkServer
:noJavaHome
echo "You must set the JAVA_HOME variable before running CARBON."
goto end
rem ----- Only set CARBON_HOME if not already set ----------------------------
:checkServer
rem %~sdp0 is expanded pathname of the current script under NT with spaces in the path removed
if "%CARBON_HOME%"=="" set CARBON_HOME=%~sdp0..
SET curDrive=%cd:~0,1%
SET wsasDrive=%CARBON_HOME:~0,1%
if not "%curDrive%" == "%wsasDrive%" %wsasDrive%:
rem find CARBON_HOME if it does not exist due to either an invalid value passed
rem by the user or the %0 problem on Windows 9x
if not exist "%CARBON_HOME%\bin\version.txt" goto noServerHome
set AXIS2_HOME=%CARBON_HOME%
goto updateClasspath
:noServerHome
echo CARBON_HOME is set incorrectly or CARBON could not be located. Please set CARBON_HOME.
goto end
rem ----- update classpath -----------------------------------------------------
:updateClasspath
setlocal EnableDelayedExpansion
cd %CARBON_HOME%
set CARBON_CLASSPATH=
FOR %%C in ("%CARBON_HOME%\bin\*.jar") DO set CARBON_CLASSPATH=!CARBON_CLASSPATH!;".\bin\%%~nC%%~xC"
set CARBON_CLASSPATH="%JAVA_HOME%\lib\tools.jar";%CARBON_CLASSPATH%;
FOR %%D in ("%CARBON_HOME%\lib\commons-lang*.jar") DO set CARBON_CLASSPATH=!CARBON_CLASSPATH!;".\lib\%%~nD%%~xD"
rem ----- Process the input command -------------------------------------------
rem Slurp the command line arguments. This loop allows for an unlimited number
rem of arguments (up to the command line limit, anyway).
:setupArgs
if ""%1""=="""" goto doneStart
if ""%1""==""-run"" goto commandLifecycle
if ""%1""==""--run"" goto commandLifecycle
if ""%1""==""run"" goto commandLifecycle
if ""%1""==""-restart"" goto commandLifecycle
if ""%1""==""--restart"" goto commandLifecycle
if ""%1""==""restart"" goto commandLifecycle
if ""%1""==""debug"" goto commandDebug
if ""%1""==""-debug"" goto commandDebug
if ""%1""==""--debug"" goto commandDebug
if ""%1""==""version"" goto commandVersion
if ""%1""==""-version"" goto commandVersion
if ""%1""==""--version"" goto commandVersion
shift
goto setupArgs
rem ----- commandVersion -------------------------------------------------------
:commandVersion
shift
type "%CARBON_HOME%\bin\version.txt"
type "%CARBON_HOME%\bin\wso2carbon-version.txt"
goto end
rem ----- commandDebug ---------------------------------------------------------
:commandDebug
shift
set DEBUG_PORT=%1
if "%DEBUG_PORT%"=="" goto noDebugPort
if not "%JAVA_OPTS%"=="" echo Warning !!!. User specified JAVA_OPTS will be ignored, once you give the --debug option.
set JAVA_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=%DEBUG_PORT%
echo Please start the remote debugging client to continue...
goto findJdk
:noDebugPort
echo Please specify the debug port after the --debug option
goto end
rem ----- commandLifecycle -----------------------------------------------------
:commandLifecycle
goto findJdk
:doneStart
if "%OS%"=="Windows_NT" @setlocal
if "%OS%"=="WINNT" @setlocal
rem ---------- Handle the SSL Issue with proper JDK version --------------------
rem find the version of the jdk
:findJdk
set CMD=RUN %*
:checkJdk17
"%JAVA_HOME%\bin\java" -version 2>&1 | findstr /r "1.[7|8]" >NUL
IF ERRORLEVEL 1 goto unknownJdk
goto jdk17
:unknownJdk
echo Starting WSO2 Carbon (in unsupported JDK)
echo [ERROR] CARBON is supported only on JDK 1.7 and 1.8
goto jdk17
:jdk17
goto runServer
rem ----------------- Execute The Requested Command ----------------------------
:runServer
cd %CARBON_HOME%
rem ------------------ Remove tmp folder on startup -----------------------------
set TMP_DIR=%CARBON_HOME%\tmp
rmdir "%TMP_DIR%" /s /q
rem ---------- Add jars to classpath ----------------
set CARBON_CLASSPATH=.\lib;%CARBON_CLASSPATH%
set JAVA_ENDORSED=".\lib\endorsed";"%JAVA_HOME%\jre\lib\endorsed";"%JAVA_HOME%\lib\endorsed"
set CMD_LINE_ARGS=-Xbootclasspath/a:%CARBON_XBOOTCLASSPATH% -Xms1024m -Xmx2048m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="%CARBON_HOME%\repository\logs\heap-dump.hprof" -Dcom.sun.management.jmxremote -classpath %CARBON_CLASSPATH% %JAVA_OPTS% -Djava.endorsed.dirs=%JAVA_ENDORSED% -DandesConfig=broker.xml -Dcarbon.registry.root=/ -Dcarbon.home="%CARBON_HOME%" -Dwso2.server.standalone=true -Djava.command="%JAVA_HOME%\bin\java" -Djava.opts="%JAVA_OPTS%" -Djava.io.tmpdir="%CARBON_HOME%\tmp" -Dcatalina.base="%CARBON_HOME%\lib\tomcat" -Dwso2.carbon.xml=%CARBON_HOME%\repository\conf\carbon.xml -Dwso2.registry.xml="%CARBON_HOME%\repository\conf\registry.xml" -Dwso2.user.mgt.xml="%CARBON_HOME%\repository\conf\user-mgt.xml" -Dwso2.transports.xml="%CARBON_HOME%\repository\conf\mgt-transports.xml" -Djava.util.logging.config.file="%CARBON_HOME%\repository\conf\log4j.properties" -Dcarbon.config.dir.path="%CARBON_HOME%\repository\conf" -Dcarbon.logs.path="%CARBON_HOME%\repository\logs" -Dcomponents.repo="%CARBON_HOME%\repository\components" -Dconf.location="%CARBON_HOME%\repository\conf" -Dcom.atomikos.icatch.file="%CARBON_HOME%\lib\transactions.properties" -Dcom.atomikos.icatch.hide_init_file_path="true" -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dcom.sun.jndi.ldap.connect.pool.authentication=simple -Dcom.sun.jndi.ldap.connect.pool.timeout=3000 -Dorg.terracotta.quartz.skipUpdateCheck=true -Dcarbon.classpath=%CARBON_CLASSPATH% -Dfile.encoding=UTF8
:runJava
echo JAVA_HOME environment variable is set to %JAVA_HOME%
echo CARBON_HOME environment variable is set to %CARBON_HOME%
"%JAVA_HOME%\bin\java" %CMD_LINE_ARGS% org.wso2.carbon.bootstrap.Bootstrap %CMD%
if "%ERRORLEVEL%"=="121" goto runJava
:end
goto endlocal
:endlocal
:END

View File

@ -0,0 +1,308 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Copyright 2005-2012 WSO2, Inc. http://www.wso2.org
#
# 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.
# ----------------------------------------------------------------------------
# Main Script for the WSO2 Carbon Server
#
# Environment Variable Prequisites
#
# CARBON_HOME Home of WSO2 Carbon installation. If not set I will try
# to figure it out.
#
# JAVA_HOME Must point at your Java Development Kit installation.
#
# JAVA_OPTS (Optional) Java runtime options used when the commands
# is executed.
#
# NOTE: Borrowed generously from Apache Tomcat startup scripts.
# -----------------------------------------------------------------------------
# OS specific support. $var _must_ be set to either true or false.
#ulimit -n 100000
cygwin=false;
darwin=false;
os400=false;
mingw=false;
case "`uname`" in
CYGWIN*) cygwin=true;;
MINGW*) mingw=true;;
OS400*) os400=true;;
Darwin*) darwin=true
if [ -z "$JAVA_VERSION" ] ; then
JAVA_VERSION="CurrentJDK"
else
echo "Using Java version: $JAVA_VERSION"
fi
if [ -z "$JAVA_HOME" ] ; then
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home
fi
;;
esac
# resolve links - $0 may be a softlink
PRG="$0"
while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
# Get standard environment variables
PRGDIR=`dirname "$PRG"`
# Only set CARBON_HOME if not already set
[ -z "$CARBON_HOME" ] && CARBON_HOME=`cd "$PRGDIR/.." ; pwd`
# Set AXIS2_HOME. Needed for One Click JAR Download
AXIS2_HOME=$CARBON_HOME
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CARBON_HOME" ] && CARBON_HOME=`cygpath --unix "$CARBON_HOME"`
[ -n "$AXIS2_HOME" ] && CARBON_HOME=`cygpath --unix "$CARBON_HOME"`
fi
# For OS400
if $os400; then
# Set job priority to standard for interactive (interactive - 6) by using
# the interactive priority - 6, the helper threads that respond to requests
# will be running at the same priority as interactive jobs.
COMMAND='chgjob job('$JOBNAME') runpty(6)'
system $COMMAND
# Enable multi threading
QIBM_MULTI_THREADED=Y
export QIBM_MULTI_THREADED
fi
# For Migwn, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$CARBON_HOME" ] &&
CARBON_HOME="`(cd "$CARBON_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
[ -n "$AXIS2_HOME" ] &&
CARBON_HOME="`(cd "$CARBON_HOME"; pwd)`"
# TODO classpath?
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD=java
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly."
echo " CARBON cannot execute $JAVACMD"
exit 1
fi
# if JAVA_HOME is not set we're not happy
if [ -z "$JAVA_HOME" ]; then
echo "You must set the JAVA_HOME variable before running CARBON."
exit 1
fi
if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
PID=`cat "$CARBON_HOME"/wso2carbon.pid`
fi
# ----- Process the input command ----------------------------------------------
args=""
for c in $*
do
if [ "$c" = "--debug" ] || [ "$c" = "-debug" ] || [ "$c" = "debug" ]; then
CMD="--debug"
continue
elif [ "$CMD" = "--debug" ]; then
if [ -z "$PORT" ]; then
PORT=$c
fi
elif [ "$c" = "--stop" ] || [ "$c" = "-stop" ] || [ "$c" = "stop" ]; then
CMD="stop"
elif [ "$c" = "--start" ] || [ "$c" = "-start" ] || [ "$c" = "start" ]; then
CMD="start"
elif [ "$c" = "--version" ] || [ "$c" = "-version" ] || [ "$c" = "version" ]; then
CMD="version"
elif [ "$c" = "--restart" ] || [ "$c" = "-restart" ] || [ "$c" = "restart" ]; then
CMD="restart"
elif [ "$c" = "--test" ] || [ "$c" = "-test" ] || [ "$c" = "test" ]; then
CMD="test"
else
args="$args $c"
fi
done
if [ "$CMD" = "--debug" ]; then
if [ "$PORT" = "" ]; then
echo " Please specify the debug port after the --debug option"
exit 1
fi
if [ -n "$JAVA_OPTS" ]; then
echo "Warning !!!. User specified JAVA_OPTS will be ignored, once you give the --debug option."
fi
CMD="RUN"
JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=$PORT"
echo "Please start the remote debugging client to continue..."
elif [ "$CMD" = "start" ]; then
if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
if ps -p $PID > /dev/null ; then
echo "Process is already running"
exit 0
fi
fi
export CARBON_HOME=$CARBON_HOME
# using nohup sh to avoid erros in solaris OS.TODO
nohup sh $CARBON_HOME/bin/wso2server.sh $args > /dev/null 2>&1 &
exit 0
elif [ "$CMD" = "stop" ]; then
export CARBON_HOME=$CARBON_HOME
kill -term `cat $CARBON_HOME/wso2carbon.pid`
exit 0
elif [ "$CMD" = "restart" ]; then
export CARBON_HOME=$CARBON_HOME
kill -term `cat $CARBON_HOME/wso2carbon.pid`
process_status=0
pid=`cat $CARBON_HOME/wso2carbon.pid`
while [ "$process_status" -eq "0" ]
do
sleep 1;
ps -p$pid 2>&1 > /dev/null
process_status=$?
done
# using nohup sh to avoid erros in solaris OS.TODO
nohup sh $CARBON_HOME/bin/wso2server.sh $args > /dev/null 2>&1 &
exit 0
elif [ "$CMD" = "test" ]; then
JAVACMD="exec "$JAVACMD""
elif [ "$CMD" = "version" ]; then
cat $CARBON_HOME/bin/version.txt
cat $CARBON_HOME/bin/wso2carbon-version.txt
exit 0
fi
# ---------- Handle the SSL Issue with proper JDK version --------------------
jdk_17=`$JAVA_HOME/bin/java -version 2>&1 | grep "1.[7|8]"`
if [ "$jdk_17" = "" ]; then
echo " Starting WSO2 Carbon (in unsupported JDK)"
echo " [ERROR] CARBON is supported only on JDK 1.7 and 1.8"
fi
CARBON_XBOOTCLASSPATH=""
for f in "$CARBON_HOME"/lib/xboot/*.jar
do
if [ "$f" != "$CARBON_HOME/lib/xboot/*.jar" ];then
CARBON_XBOOTCLASSPATH="$CARBON_XBOOTCLASSPATH":$f
fi
done
JAVA_ENDORSED_DIRS="$CARBON_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed"
CARBON_CLASSPATH=""
if [ -e "$JAVA_HOME/lib/tools.jar" ]; then
CARBON_CLASSPATH="$JAVA_HOME/lib/tools.jar"
fi
for f in "$CARBON_HOME"/bin/*.jar
do
if [ "$f" != "$CARBON_HOME/bin/*.jar" ];then
CARBON_CLASSPATH="$CARBON_CLASSPATH":$f
fi
done
for t in "$CARBON_HOME"/lib/commons-lang*.jar
do
CARBON_CLASSPATH="$CARBON_CLASSPATH":$t
done
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
CARBON_HOME=`cygpath --absolute --windows "$CARBON_HOME"`
AXIS2_HOME=`cygpath --absolute --windows "$CARBON_HOME"`
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
CARBON_CLASSPATH=`cygpath --path --windows "$CARBON_CLASSPATH"`
CARBON_XBOOTCLASSPATH=`cygpath --path --windows "$CARBON_XBOOTCLASSPATH"`
fi
# ----- Execute The Requested Command -----------------------------------------
echo JAVA_HOME environment variable is set to $JAVA_HOME
echo CARBON_HOME environment variable is set to $CARBON_HOME
cd "$CARBON_HOME"
TMP_DIR=$CARBON_HOME/tmp
if [ -d "$TMP_DIR" ]; then
rm -rf "$TMP_DIR"
fi
START_EXIT_STATUS=121
status=$START_EXIT_STATUS
#To monitor a Carbon server in remote JMX mode on linux host machines, set the below system property.
# -Djava.rmi.server.hostname="your.IP.goes.here"
while [ "$status" = "$START_EXIT_STATUS" ]
do
$JAVACMD \
-Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
-Xms2048m -Xmx2048m -XX:MaxPermSize=256m \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:HeapDumpPath="$CARBON_HOME/repository/logs/heap-dump.hprof" \
$JAVA_OPTS \
-DandesConfig=broker.xml \
-Dcom.sun.management.jmxremote \
-classpath "$CARBON_CLASSPATH" \
-Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
-Djava.io.tmpdir="$CARBON_HOME/tmp" \
-Dcatalina.base="$CARBON_HOME/lib/tomcat" \
-Dwso2.server.standalone=true \
-Dcarbon.registry.root=/ \
-Djava.command="$JAVACMD" \
-Dcarbon.home="$CARBON_HOME" \
-Djava.util.logging.config.file="$CARBON_HOME/repository/conf/log4j.properties" \
-Dcarbon.config.dir.path="$CARBON_HOME/repository/conf" \
-Dcomponents.repo="$CARBON_HOME/repository/components/plugins" \
-Dconf.location="$CARBON_HOME/repository/conf"\
-Dcom.atomikos.icatch.file="$CARBON_HOME/lib/transactions.properties" \
-Dcom.atomikos.icatch.hide_init_file_path=true \
-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false \
-Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true \
-Dcom.sun.jndi.ldap.connect.pool.authentication=simple \
-Dcom.sun.jndi.ldap.connect.pool.timeout=3000 \
-Dorg.terracotta.quartz.skipUpdateCheck=true \
-Djava.security.egd=file:/dev/./urandom \
-Dfile.encoding=UTF8 \
-Djava.net.preferIPv4Stack=true \
-Dcom.ibm.cacheLocalHost=true \
org.wso2.carbon.bootstrap.Bootstrap $*
status=$?
done

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 2009, 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.
-->
<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">
<parent>
<groupId>org.wso2.iot</groupId>
<artifactId>wso2iot-broker-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wso2iot-broker-features-parent</artifactId>
<packaging>pom</packaging>
<name>WSO2 MB Features Parent</name>
<url>http://wso2.com/products/message-broker</url>
<description>WSO2 Message Broker Server Features Parent</description>
<licenses>
<license>
<name>Apache License Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
</license>
</licenses>
<modules>
<module>product</module>
<module>service</module>
</modules>
</project>

View File

@ -0,0 +1,217 @@
################################################################################
# Copyright 2009 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.
################################################################################
providerName=WSO2 Inc.
########################## license properties ##################################
licenseURL=http://www.apache.org/licenses/LICENSE-2.0
license=\
Apache License\n\
Version 2.0, January 2004\n\
http://www.apache.org/licenses/\n\
\n\
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\
\n\
1. Definitions.\n\
\n\
"License" shall mean the terms and conditions for use, reproduction,\n\
and distribution as defined by Sections 1 through 9 of this document.\n\
\n\
"Licensor" shall mean the copyright owner or entity authorized by\n\
the copyright owner that is granting the License.\n\
\n\
"Legal Entity" shall mean the union of the acting entity and all\n\
other entities that control, are controlled by, or are under common\n\
control with that entity. For the purposes of this definition,\n\
"control" means (i) the power, direct or indirect, to cause the\n\
direction or management of such entity, whether by contract or\n\
otherwise, or (ii) ownership of fifty percent (50%) or more of the\n\
outstanding shares, or (iii) beneficial ownership of such entity.\n\
\n\
"You" (or "Your") shall mean an individual or Legal Entity\n\
exercising permissions granted by this License.\n\
\n\
"Source" form shall mean the preferred form for making modifications,\n\
including but not limited to software source code, documentation\n\
source, and configuration files.\n\
\n\
"Object" form shall mean any form resulting from mechanical\n\
transformation or translation of a Source form, including but\n\
not limited to compiled object code, generated documentation,\n\
and conversions to other media types.\n\
\n\
"Work" shall mean the work of authorship, whether in Source or\n\
Object form, made available under the License, as indicated by a\n\
copyright notice that is included in or attached to the work\n\
(an example is provided in the Appendix below).\n\
\n\
"Derivative Works" shall mean any work, whether in Source or Object\n\
form, that is based on (or derived from) the Work and for which the\n\
editorial revisions, annotations, elaborations, or other modifications\n\
represent, as a whole, an original work of authorship. For the purposes\n\
of this License, Derivative Works shall not include works that remain\n\
separable from, or merely link (or bind by name) to the interfaces of,\n\
the Work and Derivative Works thereof.\n\
\n\
"Contribution" shall mean any work of authorship, including\n\
the original version of the Work and any modifications or additions\n\
to that Work or Derivative Works thereof, that is intentionally\n\
submitted to Licensor for inclusion in the Work by the copyright owner\n\
or by an individual or Legal Entity authorized to submit on behalf of\n\
the copyright owner. For the purposes of this definition, "submitted"\n\
means any form of electronic, verbal, or written communication sent\n\
to the Licensor or its representatives, including but not limited to\n\
communication on electronic mailing lists, source code control systems,\n\
and issue tracking systems that are managed by, or on behalf of, the\n\
Licensor for the purpose of discussing and improving the Work, but\n\
excluding communication that is conspicuously marked or otherwise\n\
designated in writing by the copyright owner as "Not a Contribution."\n\
\n\
"Contributor" shall mean Licensor and any individual or Legal Entity\n\
on behalf of whom a Contribution has been received by Licensor and\n\
subsequently incorporated within the Work.\n\
\n\
2. Grant of Copyright License. Subject to the terms and conditions of\n\
this License, each Contributor hereby grants to You a perpetual,\n\
worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n\
copyright license to reproduce, prepare Derivative Works of,\n\
publicly display, publicly perform, sublicense, and distribute the\n\
Work and such Derivative Works in Source or Object form.\n\
\n\
3. Grant of Patent License. Subject to the terms and conditions of\n\
this License, each Contributor hereby grants to You a perpetual,\n\
worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n\
(except as stated in this section) patent license to make, have made,\n\
use, offer to sell, sell, import, and otherwise transfer the Work,\n\
where such license applies only to those patent claims licensable\n\
by such Contributor that are necessarily infringed by their\n\
Contribution(s) alone or by combination of their Contribution(s)\n\
with the Work to which such Contribution(s) was submitted. If You\n\
institute patent litigation against any entity (including a\n\
cross-claim or counterclaim in a lawsuit) alleging that the Work\n\
or a Contribution incorporated within the Work constitutes direct\n\
or contributory patent infringement, then any patent licenses\n\
granted to You under this License for that Work shall terminate\n\
as of the date such litigation is filed.\n\
\n\
4. Redistribution. You may reproduce and distribute copies of the\n\
Work or Derivative Works thereof in any medium, with or without\n\
modifications, and in Source or Object form, provided that You\n\
meet the following conditions:\n\
\n\
(a) You must give any other recipients of the Work or\n\
Derivative Works a copy of this License; and\n\
\n\
(b) You must cause any modified files to carry prominent notices\n\
stating that You changed the files; and\n\
\n\
(c) You must retain, in the Source form of any Derivative Works\n\
that You distribute, all copyright, patent, trademark, and\n\
attribution notices from the Source form of the Work,\n\
excluding those notices that do not pertain to any part of\n\
the Derivative Works; and\n\
\n\
(d) If the Work includes a "NOTICE" text file as part of its\n\
distribution, then any Derivative Works that You distribute must\n\
include a readable copy of the attribution notices contained\n\
within such NOTICE file, excluding those notices that do not\n\
pertain to any part of the Derivative Works, in at least one\n\
of the following places: within a NOTICE text file distributed\n\
as part of the Derivative Works; within the Source form or\n\
documentation, if provided along with the Derivative Works; or,\n\
within a display generated by the Derivative Works, if and\n\
wherever such third-party notices normally appear. The contents\n\
of the NOTICE file are for informational purposes only and\n\
do not modify the License. You may add Your own attribution\n\
notices within Derivative Works that You distribute, alongside\n\
or as an addendum to the NOTICE text from the Work, provided\n\
that such additional attribution notices cannot be construed\n\
as modifying the License.\n\
\n\
You may add Your own copyright statement to Your modifications and\n\
may provide additional or different license terms and conditions\n\
for use, reproduction, or distribution of Your modifications, or\n\
for any such Derivative Works as a whole, provided Your use,\n\
reproduction, and distribution of the Work otherwise complies with\n\
the conditions stated in this License.\n\
\n\
5. Submission of Contributions. Unless You explicitly state otherwise,\n\
any Contribution intentionally submitted for inclusion in the Work\n\
by You to the Licensor shall be under the terms and conditions of\n\
this License, without any additional terms or conditions.\n\
Notwithstanding the above, nothing herein shall supersede or modify\n\
the terms of any separate license agreement you may have executed\n\
with Licensor regarding such Contributions.\n\
\n\
6. Trademarks. This License does not grant permission to use the trade\n\
names, trademarks, service marks, or product names of the Licensor,\n\
except as required for reasonable and customary use in describing the\n\
origin of the Work and reproducing the content of the NOTICE file.\n\
\n\
7. Disclaimer of Warranty. Unless required by applicable law or\n\
agreed to in writing, Licensor provides the Work (and each\n\
Contributor provides its Contributions) on an "AS IS" BASIS,\n\
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n\
implied, including, without limitation, any warranties or conditions\n\
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n\
PARTICULAR PURPOSE. You are solely responsible for determining the\n\
appropriateness of using or redistributing the Work and assume any\n\
risks associated with Your exercise of permissions under this License.\n\
\n\
8. Limitation of Liability. In no event and under no legal theory,\n\
whether in tort (including negligence), contract, or otherwise,\n\
unless required by applicable law (such as deliberate and grossly\n\
negligent acts) or agreed to in writing, shall any Contributor be\n\
liable to You for damages, including any direct, indirect, special,\n\
incidental, or consequential damages of any character arising as a\n\
result of this License or out of the use or inability to use the\n\
Work (including but not limited to damages for loss of goodwill,\n\
work stoppage, computer failure or malfunction, or any and all\n\
other commercial damages or losses), even if such Contributor\n\
has been advised of the possibility of such damages.\n\
\n\
9. Accepting Warranty or Additional Liability. While redistributing\n\
the Work or Derivative Works thereof, You may choose to offer,\n\
and charge a fee for, acceptance of support, warranty, indemnity,\n\
or other liability obligations and/or rights consistent with this\n\
License. However, in accepting such obligations, You may act only\n\
on Your own behalf and on Your sole responsibility, not on behalf\n\
of any other Contributor, and only if You agree to indemnify,\n\
defend, and hold each Contributor harmless for any liability\n\
incurred by, or claims asserted against, such Contributor by reason\n\
of your accepting any such warranty or additional liability.\n\
\n\
END OF TERMS AND CONDITIONS\n
######################### copyright properties #################################
copyrightURL=TODO
copyright=\
Copyright 2012 WSO2, Inc. (http://wso2.com)\n\
\n\
Licensed under the Apache License, Version 2.0 (the "License");\n\
you may not use this file except in compliance with the License.\n\
You may obtain a copy of the License at\n\
\n\
http://www.apache.org/licenses/LICENSE-2.0\n\
\n\
Unless required by applicable law or agreed to in writing, software\n\
distributed under the License is distributed on an "AS IS" BASIS,\n\
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\
See the License for the specific language governing permissions and\n\
limitations under the License.\n

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 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.
-->
<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">
<parent>
<groupId>org.wso2.iot</groupId>
<artifactId>wso2iot-broker-product-features</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.iot.broker.styles.feature</artifactId>
<packaging>pom</packaging>
<name>WSO2 MB - Styles Features</name>
<url>http://wso2.org</url>
<dependencies>
<dependency>
<groupId>org.wso2.iot</groupId>
<artifactId>org.wso2.iot.broker.styles</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId>
<version>${carbon.p2.plugin.version}</version>
<executions>
<execution>
<id>p2-feature-generation</id>
<phase>package</phase>
<goals>
<goal>p2-feature-gen</goal>
</goals>
<configuration>
<id>org.wso2.iot.broker.styles</id>
<propertiesFile>../feature.properties</propertiesFile>
<adviceFile>
<properties>
<propertyDef>org.wso2.carbon.p2.category.type:console
</propertyDef>
<propertyDef>org.eclipse.equinox.p2.type.group:false
</propertyDef>
</properties>
</adviceFile>
<bundles>
<bundleDef>org.wso2.iot:org.wso2.iot.broker.styles</bundleDef>
</bundles>
<importFeatures>
<importFeatureDef>org.wso2.carbon.core.ui:${carbon.kernel.version}</importFeatureDef>
</importFeatures>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 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.
-->
<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">
<parent>
<groupId> org.wso2.iot</groupId>
<artifactId>wso2iot-broker-features-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wso2iot-broker-product-features</artifactId>
<packaging>pom</packaging>
<name>WSO2 MB Features Aggregator Module</name>
<description>Features specific to the WSO2 MB</description>
<modules>
<module>org.wso2.iot.broker.styles.feature</module>
</modules>
</project>

View File

@ -0,0 +1,217 @@
################################################################################
# Copyright 2009 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.
################################################################################
providerName=WSO2 Inc.
########################## license properties ##################################
licenseURL=http://www.apache.org/licenses/LICENSE-2.0
license=\
Apache License\n\
Version 2.0, January 2004\n\
http://www.apache.org/licenses/\n\
\n\
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\
\n\
1. Definitions.\n\
\n\
"License" shall mean the terms and conditions for use, reproduction,\n\
and distribution as defined by Sections 1 through 9 of this document.\n\
\n\
"Licensor" shall mean the copyright owner or entity authorized by\n\
the copyright owner that is granting the License.\n\
\n\
"Legal Entity" shall mean the union of the acting entity and all\n\
other entities that control, are controlled by, or are under common\n\
control with that entity. For the purposes of this definition,\n\
"control" means (i) the power, direct or indirect, to cause the\n\
direction or management of such entity, whether by contract or\n\
otherwise, or (ii) ownership of fifty percent (50%) or more of the\n\
outstanding shares, or (iii) beneficial ownership of such entity.\n\
\n\
"You" (or "Your") shall mean an individual or Legal Entity\n\
exercising permissions granted by this License.\n\
\n\
"Source" form shall mean the preferred form for making modifications,\n\
including but not limited to software source code, documentation\n\
source, and configuration files.\n\
\n\
"Object" form shall mean any form resulting from mechanical\n\
transformation or translation of a Source form, including but\n\
not limited to compiled object code, generated documentation,\n\
and conversions to other media types.\n\
\n\
"Work" shall mean the work of authorship, whether in Source or\n\
Object form, made available under the License, as indicated by a\n\
copyright notice that is included in or attached to the work\n\
(an example is provided in the Appendix below).\n\
\n\
"Derivative Works" shall mean any work, whether in Source or Object\n\
form, that is based on (or derived from) the Work and for which the\n\
editorial revisions, annotations, elaborations, or other modifications\n\
represent, as a whole, an original work of authorship. For the purposes\n\
of this License, Derivative Works shall not include works that remain\n\
separable from, or merely link (or bind by name) to the interfaces of,\n\
the Work and Derivative Works thereof.\n\
\n\
"Contribution" shall mean any work of authorship, including\n\
the original version of the Work and any modifications or additions\n\
to that Work or Derivative Works thereof, that is intentionally\n\
submitted to Licensor for inclusion in the Work by the copyright owner\n\
or by an individual or Legal Entity authorized to submit on behalf of\n\
the copyright owner. For the purposes of this definition, "submitted"\n\
means any form of electronic, verbal, or written communication sent\n\
to the Licensor or its representatives, including but not limited to\n\
communication on electronic mailing lists, source code control systems,\n\
and issue tracking systems that are managed by, or on behalf of, the\n\
Licensor for the purpose of discussing and improving the Work, but\n\
excluding communication that is conspicuously marked or otherwise\n\
designated in writing by the copyright owner as "Not a Contribution."\n\
\n\
"Contributor" shall mean Licensor and any individual or Legal Entity\n\
on behalf of whom a Contribution has been received by Licensor and\n\
subsequently incorporated within the Work.\n\
\n\
2. Grant of Copyright License. Subject to the terms and conditions of\n\
this License, each Contributor hereby grants to You a perpetual,\n\
worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n\
copyright license to reproduce, prepare Derivative Works of,\n\
publicly display, publicly perform, sublicense, and distribute the\n\
Work and such Derivative Works in Source or Object form.\n\
\n\
3. Grant of Patent License. Subject to the terms and conditions of\n\
this License, each Contributor hereby grants to You a perpetual,\n\
worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n\
(except as stated in this section) patent license to make, have made,\n\
use, offer to sell, sell, import, and otherwise transfer the Work,\n\
where such license applies only to those patent claims licensable\n\
by such Contributor that are necessarily infringed by their\n\
Contribution(s) alone or by combination of their Contribution(s)\n\
with the Work to which such Contribution(s) was submitted. If You\n\
institute patent litigation against any entity (including a\n\
cross-claim or counterclaim in a lawsuit) alleging that the Work\n\
or a Contribution incorporated within the Work constitutes direct\n\
or contributory patent infringement, then any patent licenses\n\
granted to You under this License for that Work shall terminate\n\
as of the date such litigation is filed.\n\
\n\
4. Redistribution. You may reproduce and distribute copies of the\n\
Work or Derivative Works thereof in any medium, with or without\n\
modifications, and in Source or Object form, provided that You\n\
meet the following conditions:\n\
\n\
(a) You must give any other recipients of the Work or\n\
Derivative Works a copy of this License; and\n\
\n\
(b) You must cause any modified files to carry prominent notices\n\
stating that You changed the files; and\n\
\n\
(c) You must retain, in the Source form of any Derivative Works\n\
that You distribute, all copyright, patent, trademark, and\n\
attribution notices from the Source form of the Work,\n\
excluding those notices that do not pertain to any part of\n\
the Derivative Works; and\n\
\n\
(d) If the Work includes a "NOTICE" text file as part of its\n\
distribution, then any Derivative Works that You distribute must\n\
include a readable copy of the attribution notices contained\n\
within such NOTICE file, excluding those notices that do not\n\
pertain to any part of the Derivative Works, in at least one\n\
of the following places: within a NOTICE text file distributed\n\
as part of the Derivative Works; within the Source form or\n\
documentation, if provided along with the Derivative Works; or,\n\
within a display generated by the Derivative Works, if and\n\
wherever such third-party notices normally appear. The contents\n\
of the NOTICE file are for informational purposes only and\n\
do not modify the License. You may add Your own attribution\n\
notices within Derivative Works that You distribute, alongside\n\
or as an addendum to the NOTICE text from the Work, provided\n\
that such additional attribution notices cannot be construed\n\
as modifying the License.\n\
\n\
You may add Your own copyright statement to Your modifications and\n\
may provide additional or different license terms and conditions\n\
for use, reproduction, or distribution of Your modifications, or\n\
for any such Derivative Works as a whole, provided Your use,\n\
reproduction, and distribution of the Work otherwise complies with\n\
the conditions stated in this License.\n\
\n\
5. Submission of Contributions. Unless You explicitly state otherwise,\n\
any Contribution intentionally submitted for inclusion in the Work\n\
by You to the Licensor shall be under the terms and conditions of\n\
this License, without any additional terms or conditions.\n\
Notwithstanding the above, nothing herein shall supersede or modify\n\
the terms of any separate license agreement you may have executed\n\
with Licensor regarding such Contributions.\n\
\n\
6. Trademarks. This License does not grant permission to use the trade\n\
names, trademarks, service marks, or product names of the Licensor,\n\
except as required for reasonable and customary use in describing the\n\
origin of the Work and reproducing the content of the NOTICE file.\n\
\n\
7. Disclaimer of Warranty. Unless required by applicable law or\n\
agreed to in writing, Licensor provides the Work (and each\n\
Contributor provides its Contributions) on an "AS IS" BASIS,\n\
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n\
implied, including, without limitation, any warranties or conditions\n\
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n\
PARTICULAR PURPOSE. You are solely responsible for determining the\n\
appropriateness of using or redistributing the Work and assume any\n\
risks associated with Your exercise of permissions under this License.\n\
\n\
8. Limitation of Liability. In no event and under no legal theory,\n\
whether in tort (including negligence), contract, or otherwise,\n\
unless required by applicable law (such as deliberate and grossly\n\
negligent acts) or agreed to in writing, shall any Contributor be\n\
liable to You for damages, including any direct, indirect, special,\n\
incidental, or consequential damages of any character arising as a\n\
result of this License or out of the use or inability to use the\n\
Work (including but not limited to damages for loss of goodwill,\n\
work stoppage, computer failure or malfunction, or any and all\n\
other commercial damages or losses), even if such Contributor\n\
has been advised of the possibility of such damages.\n\
\n\
9. Accepting Warranty or Additional Liability. While redistributing\n\
the Work or Derivative Works thereof, You may choose to offer,\n\
and charge a fee for, acceptance of support, warranty, indemnity,\n\
or other liability obligations and/or rights consistent with this\n\
License. However, in accepting such obligations, You may act only\n\
on Your own behalf and on Your sole responsibility, not on behalf\n\
of any other Contributor, and only if You agree to indemnify,\n\
defend, and hold each Contributor harmless for any liability\n\
incurred by, or claims asserted against, such Contributor by reason\n\
of your accepting any such warranty or additional liability.\n\
\n\
END OF TERMS AND CONDITIONS\n
######################### copyright properties #################################
copyrightURL=TODO
copyright=\
Copyright 2012 WSO2, Inc. (http://wso2.com)\n\
\n\
Licensed under the Apache License, Version 2.0 (the "License");\n\
you may not use this file except in compliance with the License.\n\
You may obtain a copy of the License at\n\
\n\
http://www.apache.org/licenses/LICENSE-2.0\n\
\n\
Unless required by applicable law or agreed to in writing, software\n\
distributed under the License is distributed on an "AS IS" BASIS,\n\
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\
See the License for the specific language governing permissions and\n\
limitations under the License.\n

View File

@ -0,0 +1,82 @@
<!--
~ 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.
-->
<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">
<parent>
<groupId>org.wso2.iot</groupId>
<artifactId>wso2stratos-mb-features</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.stratos.mb.dashboard.ui.feature</artifactId>
<packaging>pom</packaging>
<name>WSO2 Stratos Message Broker - Dashboard UI Features</name>
<url>http://wso2.org</url>
<dependencies>
<dependency>
<groupId>org.wso2.iot</groupId>
<artifactId>org.wso2.stratos.mb.dashboard.ui</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.ui.menu.stratos</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId>
<version>${carbon.p2.plugin.version}</version>
<executions>
<execution>
<id>p2-feature-generation</id>
<phase>package</phase>
<goals>
<goal>p2-feature-gen</goal>
</goals>
<configuration>
<id>org.wso2.stratos.mb.dashboard.ui</id>
<propertiesFile>../etc/feature.properties</propertiesFile>
<adviceFile>
<properties>
<propertyDef>org.wso2.carbon.p2.category.type:console
</propertyDef>
</properties>
</adviceFile>
<bundles>
<bundleDef>org.wso2.iot:org.wso2.stratos.mb.dashboard.ui</bundleDef>
<bundleDef>org.wso2.carbon:org.wso2.carbon.ui.menu.stratos
</bundleDef>
</bundles>
<importFeatures>
<importFeatureDef>org.wso2.carbon.core.ui:${carbon.kernel.version}
</importFeatureDef>
</importFeatures>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,71 @@
<!--
~ 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.
-->
<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">
<parent>
<groupId>org.wso2.iot</groupId>
<artifactId>wso2stratos-mb-features</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.stratos.mb.login.ui.feature</artifactId>
<packaging>pom</packaging>
<name>WSO2 Stratos Message Broker - Deployment Features</name>
<url>http://wso2.org</url>
<dependencies>
<dependency>
<groupId>org.wso2.iot</groupId>
<artifactId>org.wso2.stratos.mb.login.ui</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId>
<version>${carbon.p2.plugin.version}</version>
<executions>
<execution>
<id>p2-feature-generation</id>
<phase>package</phase>
<goals>
<goal>p2-feature-gen</goal>
</goals>
<configuration>
<id>org.wso2.stratos.mb.login.ui</id>
<propertiesFile>../etc/feature.properties</propertiesFile>
<adviceFile>
<properties>
<propertyDef>org.wso2.carbon.p2.category.type:console</propertyDef>
</properties>
</adviceFile>
<bundles>
<bundleDef>org.wso2.iot:org.wso2.stratos.mb.login.ui</bundleDef>
</bundles>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 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.
-->
<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">
<parent>
<groupId>org.wso2.iot</groupId>
<artifactId>wso2iot-broker-features-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wso2stratos-mb-features</artifactId>
<packaging>pom</packaging>
<name>WSO2 Stratos Message Broker - Features Aggregator Module</name>
<description>Features specific to the WSO2 Message Broker</description>
<modules>
<module>org.wso2.stratos.mb.login.ui.feature</module>
<module>org.wso2.stratos.mb.dashboard.ui.feature</module>
</modules>
</project>

View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 2005-2010, WSO2 Inc. (http://wso2.com) 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.
-->
<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">
<parent>
<groupId>org.wso2.iot</groupId>
<artifactId>wso2iot-broker-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wso2iot-broker-integration-tests</artifactId>
<packaging>pom</packaging>
<name>WSO2 MB - Integration Tests</name>
<url>http://wso2.com/products/message-broker/</url>
<description>WSO2 Message Broker Server Parent</description>
<modules>
<module>tests-common/admin-clients</module>
<module>tests-common/integration-tests-utils</module>
<module>tests-common/platform-tests-utils</module>
<module>tests-integration</module>
<module>tests-ui-integration</module>
<module>tests-platform</module>
</modules>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.andes.wso2</groupId>
<artifactId>andes</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.andes.wso2</groupId>
<artifactId>andes-client</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.messaging</groupId>
<artifactId>org.wso2.carbon.andes.event.stub</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.messaging</groupId>
<artifactId>org.wso2.carbon.andes.stub</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.wso2.iot</groupId>
<artifactId>wso2iot-broker-integration-tests</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<name>WSO2 MB - Integration Test Common Module</name>
<artifactId>org.wso2.iot.broker.integration.common.clients</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.wso2.carbon.automation</groupId>
<artifactId>org.wso2.carbon.automation.engine</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.utils</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs.wso2</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,352 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.clients;
import org.apache.log4j.Logger;
import org.wso2.mb.integration.common.clients.configurations.AndesJMSClientConfiguration;
import org.wso2.mb.integration.common.clients.configurations.AndesJMSConsumerClientConfiguration;
import org.wso2.mb.integration.common.clients.configurations.AndesJMSPublisherClientConfiguration;
import org.wso2.mb.integration.common.clients.exceptions.AndesClientException;
import org.wso2.mb.integration.common.clients.operations.utils.AndesClientOutputParser;
import org.wso2.mb.integration.common.clients.operations.utils.AndesClientUtils;
import javax.jms.JMSException;
import javax.naming.NamingException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* This class represents the Andes Client which is used to publish/consume JMS messages. The JMS
* publishers and consumers are created within this class with the help of a configuration file.
* This class also provides functionality which can be used to evaluate JMS message publishers and
* consumers.
*/
public class AndesClient {
/**
* The logger used to log information, warnings, errors, etc.
*/
private static Logger log = Logger.getLogger(AndesClient.class);
/**
* The delay between starting publishers or consumers
*/
private long startDelay = 0L;
/**
* The consumers that are started concurrently
*/
List<AndesJMSConsumer> consumers = new ArrayList<>();
/**
* The publishers that are started concurrently
*/
List<AndesJMSPublisher> publishers = new ArrayList<>();
/**
* Creates a single consumer or publisher based on the configuration passed
*
* @param config The configuration.
* @param createConsumersAndProducers True if the client needs to create connections, sessions
* and respecting receivers or consumers. False otherwise.
* @throws JMSException Thrown when creating the JMS sessions, connection and receiver
* or sender based on consumer or producer.
* @throws NamingException Thrown when invalid lookup is used in the initial context.
*/
public AndesClient(AndesJMSClientConfiguration config, boolean createConsumersAndProducers)
throws NamingException, JMSException, AndesClientException, IOException {
this(config, 1, createConsumersAndProducers);
}
/**
* The constructor used for creating multiple consumer or publishers based on the configuration
* passed.
*
* @param config The configuration.
* @param numberOfThreads The amount of publishers or consumers. This amount of
* threads will be started.
* @param createConsumersAndProducers True if the client needs to create connections, sessions
* and respective receivers or consumers. False otherwise.
* @throws JMSException Thrown when creating the JMS sessions, connection and receiver
* or sender based on consumer or producer.
* @throws NamingException Thrown when invalid lookup is used in the initial context.
* @throws AndesClientException Thrown when invalid number of threads are used.
*/
public AndesClient(AndesJMSClientConfiguration config, int numberOfThreads,
boolean createConsumersAndProducers)
throws IOException, JMSException, NamingException, AndesClientException {
if (0 < numberOfThreads) {
if (config instanceof AndesJMSConsumerClientConfiguration) {
AndesClientUtils.initializeReceivedMessagesPrintWriter(((AndesJMSConsumerClientConfiguration) config)
.getFilePathToWriteReceivedMessages());
}
if (config instanceof AndesJMSPublisherClientConfiguration) {
AndesClientUtils.initializePublishedPrintWriter(((AndesJMSPublisherClientConfiguration) config).getFilePathToWritePublishedMessages());
}
for (int i = 0; i < numberOfThreads; i++) {
if (config instanceof AndesJMSConsumerClientConfiguration) {
consumers
.add(new AndesJMSConsumer((AndesJMSConsumerClientConfiguration) config, createConsumersAndProducers));
} else if (config instanceof AndesJMSPublisherClientConfiguration) {
publishers
.add(new AndesJMSPublisher((AndesJMSPublisherClientConfiguration) config, createConsumersAndProducers));
}
}
} else {
throw new AndesClientException("The amount of subscribers cannot be less than 1. " +
"Value entered is " + Integer.toString(numberOfThreads));
}
}
/**
* Starts up the consumer(s) or publisher(s) to consume or publish messages.
*
* @throws JMSException Thrown when broker does not adhere to JMS functions.
* @throws IOException Thrown when trying to read contents from a file.
*/
public void startClient() throws AndesClientException, JMSException, IOException {
boolean isStartDelaySet = this.startDelay > 0L;
for (AndesJMSConsumer consumer : consumers) {
consumer.startClient();
if (isStartDelaySet) {
AndesClientUtils.sleepForInterval(this.startDelay);
}
}
for (AndesJMSPublisher publisher : publishers) {
publisher.startClient();
if (isStartDelaySet) {
AndesClientUtils.sleepForInterval(this.startDelay);
}
}
}
/**
* Stops the client from publishing or consuming messages.
*
* @throws JMSException Thrown when closing the connections, session and receiver or sender
* based on a consumer and a publisher.
*/
public void stopClient() throws JMSException {
for (AndesJMSConsumer consumer : consumers) {
consumer.stopClient();
}
for (AndesJMSPublisher publisher : publishers) {
publisher.stopClient();
}
log.info("TPS:" + this.getConsumerTPS() + " AverageLatency:" + this.getAverageLatency());
}
/**
* Gets the received messages for all consumers in the client.
*
* @return The total number of messages received for all consumers.
*/
public long getReceivedMessageCount() {
long allReceivedMessageCount = 0L;
for (AndesJMSConsumer consumer : consumers) {
allReceivedMessageCount = allReceivedMessageCount + consumer.getReceivedMessageCount().get();
}
return allReceivedMessageCount;
}
/**
* Gets the average transactions per second for consumer(s).
*
* @return The average TPS.
*/
public double getConsumerTPS() {
double tps = 0L;
for (AndesJMSConsumer consumer : consumers) {
tps = tps + consumer.getConsumerTPS();
}
return tps / consumers.size();
}
/**
* Gets the average latency for consumer(s).
*
* @return The average latency.
*/
public double getAverageLatency() {
double averageLatency = 0L;
for (AndesJMSConsumer consumer : consumers) {
averageLatency = averageLatency + consumer.getAverageLatency();
}
return averageLatency / consumers.size();
}
/**
* Gets the number of messages sent by the publisher(s).
*
* @return The number of messages.
*/
public long getSentMessageCount() {
long allSentMessageCount = 0L;
for (AndesJMSPublisher publisher : publishers) {
allSentMessageCount = allSentMessageCount + publisher.getSentMessageCount();
}
return allSentMessageCount;
}
/**
* Gets the average transactions per seconds for publisher(s). Suppressing "UnusedDeclaration"
* as the client acts as an service.
* Suppressing "UnusedDeclaration" as currently it is not being used within product-mb test
* cases. But the client can be exported so that any other use can use the client for publishing
* and subscribing messages.
*
* @return the average transactions per seconds.
*/
@SuppressWarnings("UnusedDeclaration")
public double getPublisherTPS() {
double tps = 0L;
for (AndesJMSPublisher publisher : publishers) {
tps = tps + publisher.getPublisherTPS();
}
return tps / publishers.size();
}
/**
* Gets the duplicated messages received for a single consumer. This is not valid when is comes
* to multiple consumers.
*
* @return A map of message identifiers and message content.
* @throws IOException Thrown when the received messages file is either missing or corrupted.
*/
public Map<Long, Integer> checkIfMessagesAreDuplicated()
throws IOException {
if (!consumers.isEmpty()) {
AndesClientUtils.flushPrintWriters();
AndesClientOutputParser andesClientOutputParser =
new AndesClientOutputParser(consumers.get(0).getConfig()
.getFilePathToWriteReceivedMessages());
return andesClientOutputParser.getDuplicatedMessages();
} else {
return null;
}
}
/**
* Checks whether the received messages are in order for a single consumer. This is not valid
* when is comes to multiple consumers.
*
* @return true if messages are in order, false otherwise.
* @throws IOException Thrown when the received messages file is either missing or corrupted.
*/
public boolean checkIfMessagesAreInOrder()
throws IOException {
if (!consumers.isEmpty()) {
AndesClientOutputParser andesClientOutputParser =
new AndesClientOutputParser(consumers.get(0).getConfig()
.getFilePathToWriteReceivedMessages());
return andesClientOutputParser.checkIfMessagesAreInOrder();
} else {
return false;
}
}
/**
* This method returns whether received messages are transacted for a single consumer. This is
* not valid when is comes to multiple consumers.
*
* @param operationOccurredIndex Index of the operated message most of the time last message.
* @return true if all messages are transacted, false otherwise.
*/
public boolean transactedOperation(long operationOccurredIndex)
throws IOException {
if (0 < consumers.size()) {
AndesClientOutputParser andesClientOutputParser =
new AndesClientOutputParser(consumers.get(0).getConfig()
.getFilePathToWriteReceivedMessages());
return andesClientOutputParser.transactedOperations(operationOccurredIndex);
} else {
return false;
}
}
/**
* This method will check whether received messages are ordered correctly for a single consumer
* when rollback. This is not valid when there are multiple consumers.
*
* @param messagesPerRollback number of messages per each rollback occurrence by subscriber.
* @return true if all messages are received in correct order after each rollback,
* false otherwise.
*/
public boolean checkIfTransactedRollbackPreservesOrder(long messagesPerRollback)
throws IOException {
if (0 < consumers.size()) {
AndesClientOutputParser andesClientOutputParser =
new AndesClientOutputParser(consumers.get(0).getConfig()
.getFilePathToWriteReceivedMessages());
return andesClientOutputParser.checkIfTransactedRollbackPreservesOrder(messagesPerRollback);
} else {
return false;
}
}
/**
* This method returns number of duplicate received messages for a single consumer. This is not
* valid when is comes to multiple consumers.
*
* @return The duplicate message count.
*/
public long getTotalNumberOfDuplicates()
throws IOException {
if (0 < consumers.size()) {
AndesClientOutputParser andesClientOutputParser =
new AndesClientOutputParser(consumers.get(0).getConfig()
.getFilePathToWriteReceivedMessages());
return andesClientOutputParser.numberDuplicatedMessages();
} else {
return -1L;
}
}
/**
* Sets the starting delay when starting publishers or consumers.
*
* @param startDelay The starting delay
*/
public void setStartDelay(long startDelay) {
this.startDelay = startDelay;
}
/**
* Gets the all the consumers created by the client.
* @return A {@link java.util.List} of
* {@link org.wso2.mb.integration.common.clients.AndesJMSConsumer}.
*/
public List<AndesJMSConsumer> getConsumers() {
return consumers;
}
/**
* Gets the all the publisher created by the client.
* @return A {@link java.util.List} of
* {@link org.wso2.mb.integration.common.clients.AndesJMSPublisher}.
*/
public List<AndesJMSPublisher> getPublishers() {
return publishers;
}
}

View File

@ -0,0 +1,95 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.clients;
import org.wso2.mb.integration.common.clients.configurations.AndesJMSClientConfiguration;
import org.wso2.mb.integration.common.clients.exceptions.AndesClientException;
import org.wso2.mb.integration.common.clients.operations.utils.AndesClientConstants;
import javax.jms.JMSException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.io.IOException;
import java.util.Properties;
/**
* The base class for JMS publishers and consumers. This class creates the initial context which
* is required in creating the publishers and consumers.
*/
public abstract class AndesJMSBase {
/**
* The configuration file used in creating the JMS publishers and consumers.
*/
protected final AndesJMSClientConfiguration jmsConfig;
/**
* The initial context used for creating the publishers and consumers.
*/
private InitialContext initialContext;
/**
* Creates the initial context.
*
* @param config The configuration.
* @throws NamingException
*/
protected AndesJMSBase(AndesJMSClientConfiguration config) throws NamingException {
this.jmsConfig = config;
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, AndesClientConstants.ANDES_ICF);
properties.put(AndesClientConstants.CF_NAME_PREFIX + AndesClientConstants.CF_NAME, jmsConfig.getConnectionString());
properties.put(jmsConfig.getExchangeType().getType() + "." + jmsConfig.getDestinationName(), jmsConfig.getDestinationName());
initialContext = new InitialContext(properties);
}
/**
* Gets the initial context.
*
* @return The initial context.
*/
public InitialContext getInitialContext() {
return initialContext;
}
/**
* Starts up the publisher or consumer.
*
* @throws JMSException
* @throws NamingException
* @throws IOException
*/
public abstract void startClient()
throws JMSException, NamingException, IOException, AndesClientException;
/**
* Stops the publisher or consumer
*
* @throws JMSException
*/
public abstract void stopClient() throws JMSException, AndesClientException;
/**
* Gets the configuration.
*
* @return The configuration.
*/
public abstract AndesJMSClientConfiguration getConfig();
}

View File

@ -0,0 +1,635 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.clients;
import org.apache.log4j.Logger;
import org.wso2.mb.integration.common.clients.configurations.AndesJMSConsumerClientConfiguration;
import org.wso2.mb.integration.common.clients.exceptions.AndesClientException;
import org.wso2.mb.integration.common.clients.operations.utils.AndesClientConstants;
import org.wso2.mb.integration.common.clients.operations.utils.AndesClientUtils;
import org.wso2.mb.integration.common.clients.operations.utils.ExchangeType;
import org.wso2.mb.integration.common.clients.operations.utils.JMSDeliveryStatus;
import javax.jms.Connection;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueReceiver;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.jms.TopicConnection;
import javax.jms.TopicConnectionFactory;
import javax.jms.TopicSession;
import javax.jms.TopicSubscriber;
import javax.naming.NamingException;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicLong;
/**
* The JMS message consumer used for creating a consumer, reading messages synchronously and also
* asynchronously.
*/
public class AndesJMSConsumer extends AndesJMSBase
implements Runnable, MessageListener {
/**
* The logger used in logging information, warnings, errors and etc.
*/
private static Logger log = Logger.getLogger(AndesJMSConsumer.class);
/**
* The configuration for the consumer
*/
private final AndesJMSConsumerClientConfiguration consumerConfig;
/**
* Timestamp for the first message consumed
*/
private long firstMessageConsumedTimestamp;
/**
* Timestamp of the last message consumes
*/
private long lastMessageConsumedTimestamp;
/**
* The amount of messages received by the the consumer
*/
private AtomicLong receivedMessageCount;
/**
* The addition of the time differences between the timestamp at which it got published and the
* timestamp at which it got consumed for each message consumed.
*/
private long totalLatency;
/**
* The JMS connection used to create the JMS sessions
*/
private Connection connection;
/**
* The JMS session used to create the JMS receiver
*/
private Session session;
/**
* The receiver used the consume the received messages
*/
private MessageConsumer receiver;
/**
* Creates a new JMS consumer with a given configuration.
*
* @param config The configuration.
* @param createConsumer Creates the connection, session and receiver.
* @throws NamingException
* @throws JMSException
*/
public AndesJMSConsumer(AndesJMSConsumerClientConfiguration config, boolean createConsumer)
throws NamingException, JMSException {
super(config);
receivedMessageCount = new AtomicLong(0);
// Sets the configuration
this.consumerConfig = config;
if (createConsumer) {
if (ExchangeType.QUEUE == this.consumerConfig.getExchangeType()) {
this.createQueueConnection();
} else if (ExchangeType.TOPIC == this.consumerConfig.getExchangeType()) {
this.createTopicConnection();
}
}
}
/**
* Creates a topic connection, session and receiver.
*
* @throws NamingException
* @throws JMSException
*/
private void createTopicConnection() throws NamingException, JMSException {
// Creates a topic connection, sessions and receiver
TopicConnectionFactory connFactory = (TopicConnectionFactory) super.getInitialContext()
.lookup(AndesClientConstants.CF_NAME);
TopicConnection topicConnection = connFactory.createTopicConnection();
topicConnection.setClientID(this.consumerConfig.getSubscriptionID());
topicConnection.start();
TopicSession topicSession;
// Sets acknowledgement mode
if (TopicSession.SESSION_TRANSACTED == this.consumerConfig.getAcknowledgeMode().getType()) {
topicSession = topicConnection
.createTopicSession(true, this.consumerConfig.getAcknowledgeMode().getType());
} else {
topicSession = topicConnection
.createTopicSession(false, this.consumerConfig.getAcknowledgeMode().getType());
}
Topic topic =
(Topic) super.getInitialContext().lookup(this.consumerConfig.getDestinationName());
connection = topicConnection;
session = topicSession;
// If topic is durable
if (this.consumerConfig.isDurable()) {
// If selectors exists
if (null != this.consumerConfig.getSelectors()) {
receiver = topicSession.createDurableSubscriber(topic, this.consumerConfig
.getSubscriptionID(), this.consumerConfig.getSelectors(), false);
} else {
receiver = topicSession
.createDurableSubscriber(topic, this.consumerConfig.getSubscriptionID());
}
} else {
// If selectors exists
if (null != this.consumerConfig.getSelectors()) {
receiver = topicSession
.createSubscriber(topic, this.consumerConfig.getSelectors(), false);
} else {
receiver = topicSession.createSubscriber(topic);
}
}
}
/**
* Creates a queue connection, session and receiver.
*
* @throws NamingException
* @throws JMSException
*/
private void createQueueConnection() throws NamingException, JMSException {
// Creates a queue connection, sessions and receiver
QueueConnectionFactory connFactory = (QueueConnectionFactory) super.getInitialContext()
.lookup(AndesClientConstants.CF_NAME);
QueueConnection queueConnection = connFactory.createQueueConnection();
queueConnection.start();
QueueSession queueSession;
// Sets acknowledgement mode
if (QueueSession.SESSION_TRANSACTED == this.consumerConfig.getAcknowledgeMode().getType()) {
queueSession = queueConnection
.createQueueSession(true, this.consumerConfig.getAcknowledgeMode().getType());
} else {
queueSession = queueConnection
.createQueueSession(false, this.consumerConfig.getAcknowledgeMode().getType());
}
Queue queue =
(Queue) super.getInitialContext().lookup(this.consumerConfig.getDestinationName());
connection = queueConnection;
session = queueSession;
// If selectors exists
if (null != this.consumerConfig.getSelectors()) {
receiver = queueSession.createReceiver(queue, this.consumerConfig.getSelectors());
} else {
receiver = queueSession.createReceiver(queue);
}
}
/**
* {@inheritDoc}
*/
@Override
public void startClient() throws AndesClientException, JMSException {
if (null != connection && null != session && null != receiver) {
log.info("Starting Consumer");
if (this.consumerConfig.isAsync()) {
// Use an asynchronous message listener
receiver.setMessageListener(this);
} else {
// Uses a thread to listen to messages
Thread consumerThread = new Thread(this);
consumerThread.start();
}
} else {
throw new AndesClientException("The connection, session and message receiver is not assigned.");
}
}
/**
* {@inheritDoc}
*/
@Override
public void stopClient(){
/**
* Using a separate thread as stopping the consumer on "onMessage" thread is not allowed.
*/
new Thread(new Runnable() {
@Override
public void run() {
if (null != connection && null != session && null != receiver) {
try {
log.info("Closing Consumer");
if (ExchangeType.TOPIC == consumerConfig.getExchangeType()) {
if (null != receiver) {
TopicSubscriber topicSubscriber = (TopicSubscriber) receiver;
topicSubscriber.close();
}
if (null != session) {
TopicSession topicSession = (TopicSession) session;
topicSession.close();
}
if (null != connection) {
TopicConnection topicConnection = (TopicConnection) connection;
topicConnection.close();
}
} else if (ExchangeType.QUEUE == consumerConfig.getExchangeType()) {
if (null != receiver) {
QueueReceiver queueReceiver = (QueueReceiver) receiver;
queueReceiver.close();
}
if (null != session) {
QueueSession queueSession = (QueueSession) session;
queueSession.close();
}
if (null != connection) {
QueueConnection queueConnection = (QueueConnection) connection;
queueConnection.stop();
queueConnection.close();
}
}
receiver = null;
session = null;
connection = null;
log.info("Consumer Closed");
} catch (JMSException e) {
log.error("Error in stopping client.", e);
throw new RuntimeException("Error in stopping client.", e);
}
}
}
}).start();
}
public void stopClientSync(){
if (null != connection && null != session && null != receiver) {
try {
log.info("Closing Consumer");
if (ExchangeType.TOPIC == consumerConfig.getExchangeType()) {
if (null != receiver) {
TopicSubscriber topicSubscriber = (TopicSubscriber) receiver;
topicSubscriber.close();
}
if (null != session) {
TopicSession topicSession = (TopicSession) session;
topicSession.close();
}
if (null != connection) {
TopicConnection topicConnection = (TopicConnection) connection;
topicConnection.close();
}
} else if (ExchangeType.QUEUE == consumerConfig.getExchangeType()) {
if (null != receiver) {
QueueReceiver queueReceiver = (QueueReceiver) receiver;
queueReceiver.close();
}
if (null != session) {
QueueSession queueSession = (QueueSession) session;
queueSession.close();
}
if (null != connection) {
QueueConnection queueConnection = (QueueConnection) connection;
queueConnection.stop();
queueConnection.close();
}
}
receiver = null;
session = null;
connection = null;
log.info("Consumer Closed");
} catch (JMSException e) {
log.error("Error in stopping client.", e);
throw new RuntimeException("Error in stopping client.", e);
}
}
}
/**
* Un-Subscribes and closes a consumers.
*
* @param stopClient true if the client needs to stopped after un-subscribing, false otherwise.
* @throws JMSException
*/
public void unSubscribe(final boolean stopClient) throws JMSException {
/**
* Using a separate thread as un-subscribing the consumer on "onMessage" thread is not allowed.
*/
new Thread(new Runnable() {
@Override
public void run() {
if (null != connection && null != session && null != receiver) {
try {
log.info("Un-subscribing Subscriber");
session.unsubscribe(consumerConfig.getSubscriptionID());
log.info("Subscriber Un-Subscribed");
if (stopClient) {
stopClient();
}
} catch (JMSException e) {
log.error("Error in removing subscription(un-subscribing).", e);
throw new RuntimeException("JMSException : Error in removing subscription(un-subscribing).", e);
}
} else {
AndesClientException andesClientException =
new AndesClientException("The connection, session and message receiver is not assigned.");
log.error("The connection, session and message receiver is not assigned.", andesClientException);
throw new RuntimeException("The connection, session and message receiver is not assigned.", andesClientException);
}
}
}).start();
}
/**
* {@inheritDoc}
*/
@Override
public void run() {
try {
boolean interrupted = false;
while (true) {
Message message = this.receiver.receive();
// We assume message receiving was interrupted if we receive null
if (null == message) {
interrupted = true;
break;
} else if ( processReceivedMessage(message)) {
break;
}
}
if (!interrupted) {
stopClientSync();
}
} catch (JMSException e) {
log.error("Error while receiving messages ", e);
throw new RuntimeException("JMSException : Error while listening to messages", e);
} catch (IOException e) {
log.error("Error while writing message to file", e);
throw new RuntimeException("IOException : Error while writing message to file\"", e);
}
}
/**
* {@inheritDoc}
*/
@Override
public void onMessage(Message message) {
try {
boolean success = this.processReceivedMessage(message);
if(success) {
stopClient();
}
} catch (JMSException e) {
log.error("Error while listening to messages", e);
throw new RuntimeException("Error while listening to messages", e);
} catch (IOException e) {
log.error("Error while writing message to file", e);
throw new RuntimeException("Error while listening to messages", e);
}
}
/**
* Processes the received messages. The processing includes the following actions. 1.
* Calculation of transactions per second. 2. Calculation of average latency for messages. 3.
* Message detail logging 4. Writes messages to a file. 5. Writes statistics to a file. 6.
* Closing and un-subscribing of client.
*
* @param message The {@link javax.jms.Message} to publish.
* @return true if client is stopped or un-subscribed, false otherwise.
* @throws JMSException
* @throws IOException
*/
private boolean processReceivedMessage(Message message)
throws JMSException, IOException {
if (null != message) {
long threadID = Thread.currentThread().getId();
// Calculating total latency
long currentTimeStamp = System.currentTimeMillis();
this.totalLatency = this.totalLatency + (currentTimeStamp - message.getJMSTimestamp());
// Setting timestamps for TPS calculation
if (0 == this.firstMessageConsumedTimestamp) {
this.firstMessageConsumedTimestamp = currentTimeStamp;
}
this.lastMessageConsumedTimestamp = currentTimeStamp;
// Incrementing message received count
this.receivedMessageCount.incrementAndGet();
JMSDeliveryStatus deliveryStatus;
// Gets whether the message is original or redelivered
if (message.getJMSRedelivered()) {
deliveryStatus = JMSDeliveryStatus.REDELIVERED;
} else {
deliveryStatus = JMSDeliveryStatus.ORIGINAL;
}
// Logging the received message
if (0 == this.receivedMessageCount.get() % this.consumerConfig
.getPrintsPerMessageCount()) {
log.info("[RECEIVE] ThreadID:" + threadID + " Destination(" + this.consumerConfig
.getExchangeType().getType() + "):" +
this.consumerConfig.getDestinationName() + " ReceivedMessageCount:" +
this.receivedMessageCount + " MessageToReceive:" +
this.consumerConfig
.getMaximumMessagesToReceived() + " Original/Redelivered:" + deliveryStatus
.getStatus());
}
// Writes the statistics
if (null != this.consumerConfig.getFilePathToWriteStatistics()) {
String statisticsString = Long.toString(currentTimeStamp) + "," + Double
.toString(this.getConsumerTPS()) + "," + Double
.toString(this.getAverageLatency());
AndesClientUtils.writeStatisticsToFile(statisticsString, this.consumerConfig
.getFilePathToWriteStatistics());
}
if (message instanceof TextMessage) {
TextMessage textMessage = (TextMessage) message;
// Writes the received messages
if (null != this.consumerConfig.getFilePathToWriteReceivedMessages()) {
AndesClientUtils
.writeReceivedMessagesToFile(textMessage.getText(), this.consumerConfig
.getFilePathToWriteReceivedMessages());
}
}
// Acknowledges messages
if (0 == this.receivedMessageCount.get() % this.consumerConfig
.getAcknowledgeAfterEachMessageCount()) {
if (Session.CLIENT_ACKNOWLEDGE == session.getAcknowledgeMode()) {
message.acknowledge();
log.info("Acknowledging message : " + message.getJMSMessageID());
}
}
if (0 == this.receivedMessageCount.get() % consumerConfig
.getCommitAfterEachMessageCount()) {
// Committing session
session.commit();
log.info("Committed session");
} else if (0 == this.receivedMessageCount.get() % consumerConfig
.getRollbackAfterEachMessageCount()) {
// Roll-backing session
session.rollback();
log.info("Roll-backed session");
}
if (this.receivedMessageCount.get() >= consumerConfig
.getUnSubscribeAfterEachMessageCount()) {
// Un-Subscribing consumer
unSubscribe(true);
// Waiting till consumer is un-subscribed so that no messages will be read.
AndesClientUtils.sleepForInterval(1000L);
return true;
} else if (this.receivedMessageCount.get() >= consumerConfig
.getMaximumMessagesToReceived()) {
return true;
}
// Delaying reading of messages
if (0 < consumerConfig.getRunningDelay()) {
try {
Thread.sleep(consumerConfig.getRunningDelay());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}
return false;
}
/**
* Gets the received message count for the consumer.
*
* @return The received message count.
*/
public AtomicLong getReceivedMessageCount() {
return this.receivedMessageCount;
}
/**
* Gets the consumer transactions per seconds.
*
* @return The consumer transactions per seconds.
*/
public double getConsumerTPS() {
if (0 == this.lastMessageConsumedTimestamp - this.firstMessageConsumedTimestamp) {
return this.receivedMessageCount.doubleValue() / (1D / 1000);
} else {
return this.receivedMessageCount
.doubleValue() / (((double) (this.lastMessageConsumedTimestamp - this.firstMessageConsumedTimestamp)) / 1000D);
}
}
/**
* Gets the average latency for the consumer in receiving messages.
*
* @return The average latency.
*/
public double getAverageLatency() {
if (0 == this.receivedMessageCount.doubleValue()) {
log.warn("No messages were received to calculate average latency.");
return 0D;
} else {
return (((double) this.totalLatency) / 1000D) / this.receivedMessageCount.doubleValue();
}
}
/**
* {@inheritDoc}
*/
@Override
public AndesJMSConsumerClientConfiguration getConfig() {
return this.consumerConfig;
}
/**
* Gets the JMS message consuming connection ({@link javax.jms.Connection}).
*
* @return A {@link javax.jms.Connection}
*/
public Connection getConnection() {
return this.connection;
}
/**
* Sets the JMS message consuming connection ({@link javax.jms.Connection}).
*
* @param connection A {@link javax.jms.Connection}.
*/
public void setConnection(Connection connection) {
this.connection = connection;
}
/**
* Gets the JMS message consuming session ({@link javax.jms.Session}).
*
* @return A {@link javax.jms.Session}.
*/
public Session getSession() {
return this.session;
}
/**
* Sets the JMS message consuming session ({@link javax.jms.Session}).
*
* @param session A {@link javax.jms.Session}.
*/
public void setSession(Session session) {
this.session = session;
}
/**
* Gets the JMS message consumer ({@link javax.jms.MessageConsumer}).
*
* @return A {@link javax.jms.MessageConsumer}.
*/
public MessageConsumer getReceiver() {
return this.receiver;
}
/**
* Sets the JMS message consumer ({@link javax.jms.MessageConsumer}).
*
* @param receiver A {@link javax.jms.MessageConsumer}.
*/
public void setReceiver(MessageConsumer receiver) {
this.receiver = receiver;
}
}

View File

@ -0,0 +1,437 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.clients;
import org.apache.log4j.Logger;
import org.wso2.mb.integration.common.clients.configurations.AndesJMSPublisherClientConfiguration;
import org.wso2.mb.integration.common.clients.configurations.JMSHeaderProperty;
import org.wso2.mb.integration.common.clients.configurations.JMSHeaderPropertyType;
import org.wso2.mb.integration.common.clients.exceptions.AndesClientException;
import org.wso2.mb.integration.common.clients.operations.utils.AndesClientConstants;
import org.wso2.mb.integration.common.clients.operations.utils.AndesClientUtils;
import org.wso2.mb.integration.common.clients.operations.utils.JMSMessageType;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.NamingException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.List;
/**
* The JMS message publisher used for creating a publisher and for publishing JMS messages.
*/
public class AndesJMSPublisher extends AndesJMSBase implements Runnable {
/**
* The logger used in logging information, warnings, errors and etc.
*/
private static Logger log = Logger.getLogger(AndesJMSPublisher.class);
/**
* The configuration for the publisher
*/
private AndesJMSPublisherClientConfiguration publisherConfig;
/**
* The amount of messages sent by the publisher
*/
private long sentMessageCount;
/**
* The timestamp at which the first message was published
*/
private long firstMessagePublishTimestamp;
/**
* The timestamp at which the last message was published
*/
private long lastMessagePublishTimestamp;
/**
* The connection which is used to create the JMS session
*/
private Connection connection;
/**
* The session which is used to create the JMS message producer
*/
private Session session;
/**
* The message producer which produces/sends messages
*/
private MessageProducer sender;
/**
* Message content which is needed to be published. The value will depend on the configuration.
*/
private String messageContentFromFile = null;
/**
* Creates a new JMS publisher with a given configuration.
*
* @param config The configuration
* @param createPublisher Creates connection, session and sender.
* @throws NamingException
* @throws JMSException
*/
public AndesJMSPublisher(AndesJMSPublisherClientConfiguration config, boolean createPublisher)
throws NamingException, JMSException {
super(config);
// Sets the configuration
this.publisherConfig = config;
// Creates a JMS connection, sessions and sender
if (createPublisher) {
ConnectionFactory connFactory = (ConnectionFactory) super.getInitialContext()
.lookup(AndesClientConstants.CF_NAME);
connection = connFactory.createConnection();
connection.start();
if(config.isTransactionalSession()) {
this.session = connection.createSession(true, 0);
} else {
this.session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
}
Destination destination = (Destination) super.getInitialContext()
.lookup(this.publisherConfig.getDestinationName());
this.sender = this.session.createProducer(destination);
}
}
/**
* {@inheritDoc}
*/
@Override
public void startClient() throws AndesClientException, IOException {
if (null != connection && null != session && null != sender) {
//reading message content from file
if (null != this.publisherConfig.getReadMessagesFromFilePath()) {
this.getMessageContentFromFile();
}
Thread subscriberThread = new Thread(this);
subscriberThread.start();
} else {
throw new AndesClientException("The connection, session and message sender is not assigned.");
}
}
/**
* {@inheritDoc}
*/
@Override
public void stopClient() throws JMSException {
if (null != connection && null != session && null != sender) {
long threadID = Thread.currentThread().getId();
log.info("Closing publisher | ThreadID : " + threadID);
this.sender.close();
this.session.close();
this.connection.close();
this.sender = null;
this.session = null;
this.connection = null;
log.info("Publisher closed | ThreadID : " + threadID);
}
}
/**
* Reads message content from a file which is used as the message content to when publishing
* messages.
*
* @throws IOException
*/
public void getMessageContentFromFile() throws IOException {
if (null != this.publisherConfig.getReadMessagesFromFilePath()) {
BufferedReader br = new BufferedReader(new FileReader(this.publisherConfig
.getReadMessagesFromFilePath()));
try {
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
sb.append(line);
sb.append('\n');
line = br.readLine();
}
// Remove the last appended next line since there is no next line.
sb.replace(sb.length() - 1, sb.length() + 1, "");
messageContentFromFile = sb.toString();
} finally {
br.close();
}
}
}
/**
* {@inheritDoc}
*/
@Override
public void run() {
try {
Message message = null;
long threadID = Thread.currentThread().getId();
while (this.sentMessageCount < this.publisherConfig.getNumberOfMessagesToSend()) {
// Creating a JMS message
if (JMSMessageType.TEXT == this.publisherConfig.getJMSMessageType()) {
if (null != this.publisherConfig.getReadMessagesFromFilePath()) {
message = this.session.createTextMessage(this.messageContentFromFile);
} else {
message = this.session.createTextMessage(MessageFormat
.format(AndesClientConstants.PUBLISH_MESSAGE_FORMAT, this.sentMessageCount, threadID));
}
} else if (JMSMessageType.BYTE == this.publisherConfig.getJMSMessageType()) {
message = this.session.createBytesMessage();
} else if (JMSMessageType.MAP == this.publisherConfig.getJMSMessageType()) {
MapMessage mapMessage = this.session.createMapMessage();
if (null != this.publisherConfig.getReadMessagesFromFilePath()) {
String[] entries = this.messageContentFromFile.split(System.getProperty("line.separator"));
for (int i = 0; i < entries.length; i++) {
mapMessage.setString("key" + i, entries[i]);
}
}
message = mapMessage;
} else if (JMSMessageType.OBJECT == this.publisherConfig.getJMSMessageType()) {
message = this.session.createObjectMessage();
} else if (JMSMessageType.STREAM == this.publisherConfig.getJMSMessageType()) {
message = this.session.createStreamMessage();
}
//set JMS message type
String jmsType = publisherConfig.getJMSType();
if(message!= null && null != jmsType && !jmsType.isEmpty()) {
message.setJMSType(jmsType);
}
//set JMS header properties
setMessageProperties(message);
if (null != message) {
this.sender.send(message, DeliveryMode.PERSISTENT, 0, this.publisherConfig
.getJMSMessageExpiryTime());
// need to commit if transactional
if(getConfig().isTransactionalSession()) {
session.commit();
}
if (message instanceof TextMessage && null != this.publisherConfig.getFilePathToWritePublishedMessages()){
AndesClientUtils.writePublishedMessagesToFile(((TextMessage) message)
.getText(), this.publisherConfig.getFilePathToWritePublishedMessages());
}
this.sentMessageCount++;
// TPS calculation
long currentTimeStamp = System.currentTimeMillis();
if (0 == this.firstMessagePublishTimestamp) {
this.firstMessagePublishTimestamp = currentTimeStamp;
}
this.lastMessagePublishTimestamp = currentTimeStamp;
if (0 == this.sentMessageCount % this.publisherConfig
.getPrintsPerMessageCount()) {
// Logging the sent message details.
if (null != this.publisherConfig.getReadMessagesFromFilePath()) {
log.info("[SEND]" + " (FROM FILE) ThreadID:" +
threadID + " Destination(" + this.publisherConfig
.getExchangeType().getType() + "):" +
this.publisherConfig
.getDestinationName() + " SentMessageCount:" +
this.sentMessageCount + " CountToSend:" +
this.publisherConfig.getNumberOfMessagesToSend());
} else {
log.info("[SEND]" + " (INBUILT MESSAGE) ThreadID:" +
threadID + " Destination(" + this.publisherConfig
.getExchangeType().getType() + "):" +
this.publisherConfig
.getDestinationName() + " SentMessageCount:" +
this.sentMessageCount + " CountToSend:" +
this.publisherConfig.getNumberOfMessagesToSend());
}
}
// Writing statistics
if (null != this.publisherConfig.getFilePathToWriteStatistics()) {
String statisticsString =
",,,," + Long.toString(currentTimeStamp) + "," + Double
.toString(this.getPublisherTPS());
AndesClientUtils
.writeStatisticsToFile(statisticsString, this.publisherConfig
.getFilePathToWriteStatistics());
}
// Delaying the publishing of messages
if (0 < this.publisherConfig.getRunningDelay()) {
try {
Thread.sleep(this.publisherConfig.getRunningDelay());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}
}
this.stopClient();
} catch (JMSException e) {
throw new RuntimeException("Error while publishing messages", e);
} catch (IOException e) {
throw new RuntimeException("Error while writing statistics", e);
}
}
/**
* Set JMS Headers to the message according to publisher configuration
*
* @param message message to set properties
*/
private void setMessageProperties(Message message) throws JMSException {
List<JMSHeaderProperty> headerPropertyList = publisherConfig.getJMSHeaderProperties();
for (JMSHeaderProperty jmsHeaderProperty : headerPropertyList) {
JMSHeaderPropertyType type = jmsHeaderProperty.getType();
String propertyKey = jmsHeaderProperty.getKey();
Object propertyValue = jmsHeaderProperty.getValue();
switch (type) {
case OBJECT:
message.setObjectProperty(propertyKey, propertyValue);
break;
case BYTE:
message.setByteProperty(propertyKey, (Byte) propertyValue);
break;
case BOOLEAN:
message.setBooleanProperty(propertyKey, (Boolean) propertyValue);
break;
case DOUBLE:
message.setDoubleProperty(propertyKey, (Double) propertyValue);
break;
case FLOAT:
message.setFloatProperty(propertyKey, (Float) propertyValue);
break;
case SHORT:
message.setShortProperty(propertyKey, (Short) propertyValue);
break;
case STRING:
message.setStringProperty(propertyKey, (String) propertyValue);
break;
case INTEGER:
message.setIntProperty(propertyKey, (Integer) propertyValue);
break;
case LONG:
message.setLongProperty(propertyKey, (Long) propertyValue);
break;
}
}
}
/**
* Gets the published message count.
*
* @return The published message count.
*/
public long getSentMessageCount() {
return this.sentMessageCount;
}
/**
* Gets the transactions per seconds for publisher.
*
* @return The transactions per second.
*/
public double getPublisherTPS() {
if (0 == this.lastMessagePublishTimestamp - this.firstMessagePublishTimestamp) {
return ((double) this.sentMessageCount) / (1D / 1000);
} else {
return ((double) this.sentMessageCount) / (((double) (this.lastMessagePublishTimestamp - this.firstMessagePublishTimestamp)) / 1000);
}
}
/**
* {@inheritDoc}
*/
@Override
public AndesJMSPublisherClientConfiguration getConfig() {
return this.publisherConfig;
}
/**
* Gets the JMS message sending connection ({@link javax.jms.Connection}).
*
* @return A {@link javax.jms.Connection}
*/
public Connection getConnection() {
return this.connection;
}
/**
* Sets the JMS message sending connection ({@link javax.jms.Connection}).
*
* @param connection A {@link javax.jms.Connection}.
*/
public void setConnection(Connection connection) {
this.connection = connection;
}
/**
* Gets the JMS message sending session ({@link javax.jms.Session}).
*
* @return A {@link javax.jms.Session}.
*/
public Session getSession() {
return this.session;
}
/**
* Sets the JMS message sending session ({@link javax.jms.Session}).
*
* @param session A {@link javax.jms.Session}.
*/
public void setSession(Session session) {
this.session = session;
}
/**
* Gets the JMS message producer ({@link javax.jms.MessageProducer}).
*
* @return A {@link javax.jms.MessageProducer}.
*/
public MessageProducer getSender() {
return this.sender;
}
/**
* Sets the JMS message producer ({@link javax.jms.MessageProducer}). Suppressing
* "UnusedDeclaration" as the client acts as a service.
*
* @param sender A {@link javax.jms.MessageProducer}.
*/
@SuppressWarnings("UnusedDeclaration")
public void setSender(MessageProducer sender) {
this.sender = sender;
}
}

View File

@ -0,0 +1,256 @@
/*
* Copyright (c) 2014, 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.
*/
package org.wso2.mb.integration.common.clients;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.persist.MqttDefaultFilePersistence;
import org.wso2.mb.integration.common.clients.operations.mqtt.callback.CallbackHandler;
import java.io.File;
import java.util.List;
/**
* Basic MQTT client which handles the operations around MQTT clients.
* - Handling fields
* - Handling message counts
* <p/>
* Each MQTT client with different publish/subscribe mechanism should extend from this.
*/
public abstract class AndesMQTTClient implements Runnable {
/**
* The MQTT callback handler which handles message arrival, delivery complete and connection loss requests.
*/
private final CallbackHandler callbackHandler;
/**
* unique identifier for mqtt client - less than or equal to 23 characters
*/
protected final String mqttClientID;
/**
* Connection options that are required to create a connection to a MQTT server
*/
protected final MqttConnectOptions connectionOptions;
/**
* Message broker MQTT URL
*/
protected final String brokerUrl;
/**
* The topic the messages needs to send to / received from
*/
protected final String topic;
/**
* The quality of service to send/receive messages *
*/
protected final QualityOfService qos;
/**
* MQTT retain parameter
* When retain enabled with published topic message, it should retained for future subscribers
* for the same topic.
*/
protected final boolean retain;
/**
* Store messages until server fetches them.
* Need a random value on this path to ensure that the same persistence store is not used by two clients.
*/
protected final MqttDefaultFilePersistence dataStore =
new MqttDefaultFilePersistence(System.getProperty("java.io.tmpdir") + File.separator + Math.random());
/**
* Create a mqtt client initializing mqtt options.
*
* @param configuration MQTT configurations
* @param clientID The unique client Id
* @param topic Topic to subscribe/publish to
* @param qos The quality of service
* @param callbackHandler Callback Handler to handle receiving messages/message sending ack
*/
public AndesMQTTClient(MQTTClientConnectionConfiguration configuration, String clientID, String topic,
QualityOfService qos, CallbackHandler callbackHandler) {
//Initializing the variables locally
this.brokerUrl = configuration.getBrokerURL();
this.mqttClientID = clientID;
String password = configuration.getBrokerPassword();
String userName = configuration.getBrokerUserName();
this.topic = topic;
this.qos = qos;
this.retain = configuration.isRetain();
// Construct the connection options object that contains connection parameters
// such as cleanSession and LWT
connectionOptions = new MqttConnectOptions();
connectionOptions.setCleanSession(configuration.isCleanSession());
if (null != password) {
connectionOptions.setPassword(password.toCharArray());
}
if (null != userName) {
connectionOptions.setUserName(userName);
}
// Set callback handler
this.callbackHandler = callbackHandler;
}
/**
* Publish messages to mqtt server.
*
* @param payload Data to send
* @param noOfMessages Number of message to send
* @throws MqttException
*/
protected abstract void publish(byte[] payload, int noOfMessages) throws MqttException;
/**
* Subscribe to the requested topic
* The {@link QualityOfService} specified is the maximum level that messages will be sent to the client at.
* For instance if QoS {@link QualityOfService#LEAST_ONCE} is specified, any messages originally published at QoS
* {@link QualityOfService#EXACTLY_ONCE} will be downgraded to {@link QualityOfService#MOST_ONCE} when delivering
* to the client but messages published at {@link QualityOfService#LEAST_ONCE} and {@link
* QualityOfService#MOST_ONCE} will be received at the same level they were published at.
*
* @throws MqttException
*/
public abstract void subscribe() throws MqttException;
/**
* Subscribe to a given topic.
*
* @param topicName The topic to subscribe to
* @throws MqttException
*/
public abstract void subscribe(String topicName) throws MqttException;
/**
* Un-subscribe from the topic.
*
* @throws MqttException
*/
public abstract void unsubscribe() throws MqttException;
/**
* Un-subscribe from a given topic.
*
* @param topic The topic to un-subscribe from.
* @throws MqttException
*/
public abstract void unsubscribe(String topic) throws MqttException;
/**
* Get the received message count from the callback handler to validate message receiving is successful.
*
* @return Received message count
*/
public int getReceivedMessageCount() {
int messageCount = 0;
if (null != callbackHandler) {
messageCount = callbackHandler.getReceivedMessageCount();
}
return messageCount;
}
/**
* Get the sent message count from the callback handler to validate message sending is successful.
*
* @return The sent message count.
*/
public int getSentMessageCount() {
int messageCount = 0;
if (null != callbackHandler) {
messageCount = callbackHandler.getSentMessageCount();
}
return messageCount;
}
/**
* Shutdown the mqtt client. Call this whenever the system exits, test cases are finished or disconnect hook is
* called.
*
* @throws MqttException
*/
public abstract void disconnect() throws MqttException;
/**
* Connect a mqtt client to the server with given options.
*
* @throws MqttException
*/
public abstract void connect() throws MqttException;
/**
* Get the mqtt client Id. Use this to print client Id into logs whenever necessary.
*
* @return MQTT client Id
*/
public String getMqttClientID() {
return mqttClientID;
}
/**
* Use this to validate if connection to server is still active.
*
* @return Is MQTT client connected to the server
*/
public abstract boolean isConnected();
/**
* Get the topic name this MQTT client is connected to.
*
* @return The topic name
*/
public String getTopic() {
return topic;
}
/**
* Get the MQTT callback handler for the client.
*
* @return The callback handler
*/
public CallbackHandler getCallbackHandler() {
return callbackHandler;
}
/**
* Check if the subscriber is subscribed to a topic
*
* @return Is Subscribed
*/
public abstract boolean isSubscribed();
/**
* Get all the received messages through this client.
* Use this if want to validate message content.
*
* @return Received messages.
*/
public abstract List<MqttMessage> getReceivedMessages();
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2014, 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.
*/
package org.wso2.mb.integration.common.clients;
/**
* The MQTT client mode to use.
*/
public enum ClientMode {
/**
* All the server calls will be synchronous. The control will not be returned until the call is successful.
*/
BLOCKING,
/**
* All the server calls are asynchronous. The control is immediately returned and the server call will be made
* asynchronously.
*/
ASYNC
}

View File

@ -0,0 +1,134 @@
/*
* Copyright (c) 2014, 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.
*/
package org.wso2.mb.integration.common.clients;
/**
* The configurations that needs to be passed to MQTT client.
*/
public class MQTTClientConnectionConfiguration {
/**
* The protocol used by the broker.
* tcp, udp .etc
*/
private String brokerProtocol = null;
/**
* Broker host address.
* eg :- 127.0.0.1
*/
private String brokerHost = null;
/**
* Broker working port.
* eg :- 1883
*/
private String brokerPort = null;
/**
* The password to connect to the broker.
*/
private String brokerPassword = null;
/**
* The username to connect to the broker.
*/
private String brokerUserName = null;
/**
* MQTT retain parameter
*
* When retain enabled with published topic message, it should retained for future subscribers
* for the same topic.
*/
private boolean retain = false;
/**
* MQTT clean session parameter.
* <p/>
* When a client is connected to a broker, and if it has been previously connected and that session information
* is available in the broker, clean session = true will discard previous session information.
*/
private boolean cleanSession = false;
public boolean isCleanSession() {
return cleanSession;
}
public void setCleanSession(boolean cleanSession) {
this.cleanSession = cleanSession;
}
public boolean isRetain() {
return retain;
}
public void setRetain(boolean retain) {
this.retain = retain;
}
public String getBrokerProtocol() {
return brokerProtocol;
}
public void setBrokerProtocol(String brokerProtocol) {
this.brokerProtocol = brokerProtocol;
}
public String getBrokerHost() {
return brokerHost;
}
public void setBrokerHost(String brokerHost) {
this.brokerHost = brokerHost;
}
public String getBrokerPort() {
return brokerPort;
}
public void setBrokerPort(String brokerPort) {
this.brokerPort = brokerPort;
}
public String getBrokerPassword() {
return brokerPassword;
}
public void setBrokerPassword(String brokerPassword) {
this.brokerPassword = brokerPassword;
}
public String getBrokerUserName() {
return brokerUserName;
}
public void setBrokerUserName(String brokerUserName) {
this.brokerUserName = brokerUserName;
}
/**
* Generate the broker URL using the given configurations.
*
* @return The broker URL
*/
public String getBrokerURL() {
return brokerProtocol + "://" + brokerHost + ":" + brokerPort;
}
}

View File

@ -0,0 +1,596 @@
/*
* Copyright (c) 2014, 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.
*/
package org.wso2.mb.integration.common.clients;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.wso2.carbon.automation.engine.context.AutomationContext;
import org.wso2.mb.integration.common.clients.operations.mqtt.async.MQTTAsyncPublisherClient;
import org.wso2.mb.integration.common.clients.operations.mqtt.async.MQTTAsyncSubscriberClient;
import org.wso2.mb.integration.common.clients.operations.mqtt.blocking.MQTTBlockingPublisherClient;
import org.wso2.mb.integration.common.clients.operations.mqtt.blocking.MQTTBlockingSubscriberClient;
import javax.xml.xpath.XPathExpressionException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
/**
* Handle all MQTT operations for MQTT tests.
* Create a new instance of this per each test case.
*/
public class MQTTClientEngine {
/**
* Keeps all the publishers created through the engine
*/
private final List<AndesMQTTClient> publisherList = new ArrayList<AndesMQTTClient>();
/**
* Keep all the subscribers created through the engine
*/
private final List<AndesMQTTClient> subscriberList = new ArrayList<AndesMQTTClient>();
/**
* Subscriber client thread executor, executes runnable subscribers
*/
private final ExecutorService clientControlSubscriptionThreads = Executors.newFixedThreadPool(10);
/**
* Publisher client thread executor, executes runnable publishers
*/
private final ExecutorService clientControlPublisherThreads = Executors.newFixedThreadPool(10);
private final Log log = LogFactory.getLog(MQTTClientEngine.class);
private static final int MILLISECONDS_TO_A_SECOND = 1000;
/**
* The executor service to invoke scheduled jobs
*/
private final ScheduledExecutorService scheduleExecutor = Executors.newScheduledThreadPool(1);
/**
* Schedule which publishes send/receive TPS
*/
private ScheduledFuture tpsPublisherSchedule;
/**
* The received message count there was when the previous TPS calculation happened
*/
private int previousReceivedMessageCount;
/**
* The sent message count there was when the previous TPS calculation happened
*/
private int previousSentMessageCount;
/**
* Initialises the client engine attaching a disconnect hook to close all the opened connection.
* Initialises TPS publishing mechanism.
*/
public MQTTClientEngine() {
startTPSPublisher();
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
try {
shutdown();
log.info("All mqtt clients have been disconnected.");
} catch (MqttException e) {
log.error("Error occurred invoking disconnect for " + this.getName(), e);
}
}
});
}
/**
* Generate a unique client Id for MQTT clients.
* Randomize current timestamp.
*
* @return A unique Id
*/
public String generateClientID() {
String clientId = RandomStringUtils.random(MQTTConstants.CLIENT_ID_LENGTH, String.valueOf(System
.currentTimeMillis()));
log.info("ClientID generated : " + clientId);
return clientId;
}
/**
* Create a MQTT subscriber. Use when a subscriber with specific MQTTClientConnectionConfiguration is required.
*
* @param configuration MQTT configurations for the subscriber
* @param topicName Topic to subscribe to
* @param qos Quality of Service
* @param saveMessages Save receiving messages
* @param clientMode Client connection mode
* @throws MqttException
*/
public void createSubscriberConnection(MQTTClientConnectionConfiguration configuration,
String topicName, QualityOfService qos,
boolean saveMessages, ClientMode clientMode) throws MqttException {
AndesMQTTClient mqttClient;
if (ClientMode.ASYNC == clientMode) {
mqttClient = new MQTTAsyncSubscriberClient(configuration, generateClientID(), topicName, qos, saveMessages);
subscriberList.add(mqttClient);
clientControlSubscriptionThreads.execute(mqttClient);
} else if (ClientMode.BLOCKING == clientMode) {
mqttClient = new MQTTBlockingSubscriberClient(configuration, generateClientID(), topicName, qos,
saveMessages);
subscriberList.add(mqttClient);
mqttClient.run();
} else {
// Using else since only the above two scenarios are handled. If a new client mode is included,
// handle it before this
throw new MqttException(new Throwable("Unidentified clientMode : " + clientMode));
}
waitForSubscribersToSubscribe();
}
/**
* Method which can be used to override the auto generated client ID for a specific subscriber.
*
* @param configuration MQTT configurations for the subscriber
* @param topicName Topic to subscribe to
* @param qos Quality of Service
* @param saveMessages Save receiving messages
* @param clientMode Client connection mode
* @param clientID Unique identifier for the client hosting the subscription
*/
public void createSubscriberConnection(MQTTClientConnectionConfiguration configuration,
String topicName, QualityOfService qos,
boolean saveMessages, ClientMode clientMode, String clientID) throws
MqttException {
AndesMQTTClient mqttClient;
if (ClientMode.ASYNC == clientMode) {
mqttClient = new MQTTAsyncSubscriberClient(configuration, clientID, topicName, qos, saveMessages);
subscriberList.add(mqttClient);
clientControlSubscriptionThreads.execute(mqttClient);
} else if (ClientMode.BLOCKING == clientMode) {
mqttClient = new MQTTBlockingSubscriberClient(configuration, clientID, topicName, qos,
saveMessages);
subscriberList.add(mqttClient);
mqttClient.run();
} else {
// Using else since only the above two scenarios are handled. If a new client mode is included,
// handle it before this
throw new MqttException(new Throwable("Unidentified clientMode : " + clientMode));
}
waitForSubscribersToSubscribe();
}
/**
* Create a given number of subscribers.
*
* @param topicName Topic to subscribe to
* @param qos Quality of Service
* @param noOfSubscribers Number of subscriber connections to create
* @param saveMessages Save receiving messages
* @param clientMode Client connection mode
* @throws MqttException
*/
public void createSubscriberConnection(String topicName, QualityOfService qos, int noOfSubscribers,
boolean saveMessages, ClientMode clientMode,
AutomationContext automationContext)
throws MqttException, XPathExpressionException {
MQTTClientConnectionConfiguration configurations = getConfigurations(automationContext);
for (int i = 0; i < noOfSubscribers; i++) {
createSubscriberConnection(configurations, topicName, qos, saveMessages, clientMode);
}
}
/**
* Create a given number of subscribers.
*
* @param topicName Topic to subscribe to
* @param qos Quality of Service
* @param noOfSubscribers Number of subscriber connections to create
* @param saveMessages Save receiving messages
* @param clientMode Client connection mode
* @param configuration Configuration to use
* @throws MqttException
*/
public void createSubscriberConnection(String topicName, QualityOfService qos, int noOfSubscribers,
boolean saveMessages, ClientMode clientMode,
MQTTClientConnectionConfiguration configuration) throws MqttException {
for (int i = 0; i < noOfSubscribers; i++) {
createSubscriberConnection(configuration, topicName, qos, saveMessages, clientMode);
}
}
/**
* Wait until all the subscriber are subscribed to the topics and ready to receive messages.
* Before creating publishers, this should be called otherwise while subscribers are being subscribed publishers
* will start to publish and those messages will be lost.
*/
private void waitForSubscribersToSubscribe() {
while (!isAllSubscribersSubscribed()) {
try {
TimeUnit.SECONDS.sleep(1L);
} catch (InterruptedException e) {
log.error("Error waiting until subscribers subscribe to topics.", e);
}
log.info("Waiting for subscribers to create connection");
}
}
/**
* Check if all the subscribers are subscribed to the topics and ready to receive messages.
*
* @return Is all subscribers subscribed to their topics
*/
private boolean isAllSubscribersSubscribed() {
boolean subscribed = true;
for (AndesMQTTClient subscriberClient : subscriberList) {
if (!subscriberClient.isSubscribed()) {
subscribed = false;
break;
}
}
return subscribed;
}
/**
* Create a MQTT publisher. Use when a publisher with specific MQTTClientConnectionConfiguration is required.
*
* @param configuration MQTT MQTT configurations for the publisher
* @param topicName Topic to publish to
* @param qos Quality of Service
* @param payload Payload of the sending message
* @param noOfMessages Number of message to send
* @param clientMode Client connection mode
* @throws MqttException
*/
public void createPublisherConnection(MQTTClientConnectionConfiguration configuration,
String topicName, QualityOfService qos, byte[] payload,
int noOfMessages, ClientMode clientMode) throws MqttException {
AndesMQTTClient mqttClient;
if (ClientMode.ASYNC == clientMode) {
mqttClient = new MQTTAsyncPublisherClient(configuration, generateClientID(), topicName, qos, payload,
noOfMessages);
publisherList.add(mqttClient);
clientControlPublisherThreads.execute(mqttClient);
} else if (ClientMode.BLOCKING == clientMode) {
mqttClient = new MQTTBlockingPublisherClient(configuration, generateClientID(), topicName, qos, payload,
noOfMessages);
publisherList.add(mqttClient);
mqttClient.run();
} else {
// Using else since only the above two scenarios are handled. If a new client mode is included,
// handle it before this
throw new MqttException(new Throwable("Unidentified ClientMode : " + clientMode));
}
}
/**
* Create a given number of publishers.
*
* @param topicName Topic to publish to
* @param qos Quality of Service
* @param payload Payload of the sending message
* @param noOfPublishers Number of publisher connections to create
* @param noOfMessages Number of message to send
* @param clientMode Client connection mode
* @throws MqttException
*/
public void createPublisherConnection(String topicName, QualityOfService qos, byte[] payload,
int noOfPublishers, int noOfMessages, ClientMode clientMode,
AutomationContext automationContext)
throws MqttException, XPathExpressionException {
createPublisherConnection(topicName, qos, payload, noOfPublishers, noOfMessages, clientMode,
getConfigurations(automationContext));
}
/**
* Create a given number of publishers.
*
* @param topicName Topic to publish to
* @param qos Quality of Service
* @param payload Payload of the sending message
* @param noOfPublishers Number of publisher connections to create
* @param noOfMessages Number of message to send
* @param clientMode Client connection mode
* @param configuration Configuration to use.
* @throws MqttException
*/
public void createPublisherConnection(String topicName, QualityOfService qos, byte[] payload,
int noOfPublishers, int noOfMessages, ClientMode clientMode,
MQTTClientConnectionConfiguration configuration) throws MqttException {
for (int i = 0; i < noOfPublishers; i++) {
createPublisherConnection(configuration, topicName, qos, payload, noOfMessages, clientMode);
}
}
/**
* Retrieve default MQTT client configurations. Always retrieve configurations from this unless there is a
* specific requirement.
*
* @return Default MQTTClientConnectionConfigurations
*/
private MQTTClientConnectionConfiguration getDefaultConfigurations() {
MQTTClientConnectionConfiguration configuration = new MQTTClientConnectionConfiguration();
configuration.setBrokerHost(MQTTConstants.BROKER_HOST);
configuration.setBrokerProtocol(MQTTConstants.BROKER_PROTOCOL);
configuration.setBrokerPort(MQTTConstants.BROKER_PORT);
configuration.setBrokerPassword(MQTTConstants.BROKER_PASSWORD);
configuration.setBrokerUserName(MQTTConstants.BROKER_USER_NAME);
configuration.setCleanSession(true);
return configuration;
}
/**
* Retrieve default MQTT client configurations and change if there are configuration changes in
* automation xml.
*
* @return Default MQTTClientConnectionConfigurations
*/
public MQTTClientConnectionConfiguration getConfigurations(AutomationContext automationContext)
throws XPathExpressionException {
MQTTClientConnectionConfiguration configuration = getDefaultConfigurations();
String brokerHost = automationContext.getInstance().getHosts().get("default");
if (!brokerHost.isEmpty()) {
configuration.setBrokerHost(brokerHost);
}
if(!automationContext.getInstance().getPorts().get("mqtt").isEmpty()) {
configuration.setBrokerPort(automationContext.getInstance().getPorts().get("mqtt"));
}
return configuration;
}
/**
* Get received messages from all subscriber clients.
*
* @return Received messages
*/
public List<MqttMessage> getReceivedMessages() {
List<MqttMessage> receivedMessages = new ArrayList<MqttMessage>();
for (AndesMQTTClient subscriber : subscriberList) {
receivedMessages.addAll(subscriber.getReceivedMessages());
}
return receivedMessages;
}
/**
* Get received message count from all subscribers.
*
* @return Received message count
*/
public int getReceivedMessageCount() {
int count = 0;
for (AndesMQTTClient subscriber : subscriberList) {
count = count + subscriber.getReceivedMessageCount();
}
return count;
}
/**
* Get sent message count from all publishers.
*
* @return Sent message count
*/
public int getSentMessageCount() {
int count = 0;
for (AndesMQTTClient publisher : publisherList) {
count = count + publisher.getSentMessageCount();
}
return count;
}
/**
* Get all the subscribers.
* Use if needed to directly handle subscribers.
*
* @return MQTTSubscriberClient list
*/
public List<AndesMQTTClient> getSubscriberList() {
return subscriberList;
}
/**
* Get all the publishers.
* Use if needed to directly handle publishers.
*
* @return MQTTPublisherClient list
*/
public List<AndesMQTTClient> getPublisherList() {
return publisherList;
}
/**
* Wait for subscribers to receive all the messages and disconnect all clients.
* Use in test cases before doing assertions so message send/receive will be completed before assertions.
*
* @see MQTTClientEngine#waitUntilAllMessageReceived()
*
* @throws MqttException
*/
public void waitUntilAllMessageReceivedAndShutdownClients() throws MqttException {
waitUntilAllMessageReceived();
shutdown();
}
/**
* Wait for subscribers to receive all the messages that have been sent.
* Use in test cases before doing assertions so message send/receive will be completed before assertions
* but needs the clients to be connected for further cases.
* <p/>
* Detect all the messages are received by checking message count in each 10 second iterations.
* If message count doesn't change in two consecutive rounds it will be decided that all the messages that the
* server has sent is received.
* <p/>
* If no messages are received, will lookout for 20 seconds for message and return.
*/
public void waitUntilAllMessageReceived() {
int previousMessageCount = 0;
int currentMessageCount = -1;
// Check each 10 second if new messages have been received, if not disconnect clients.
// If no message are received this will wait for 20 seconds before shutting down clients.
while (currentMessageCount != previousMessageCount) {
try {
TimeUnit.SECONDS.sleep(10);
} catch (InterruptedException e) {
log.error("Error waiting for receiving messages.", e);
}
previousMessageCount = currentMessageCount;
currentMessageCount = getReceivedMessageCount();
}
}
/**
* Wait for subscriber to receive given number of messages and exit.
* Use in test cases before doing assertions so message send/receive will be completed before
* assertions.
* <p/>
* This method will exit regardless of the number of messages received if maximum wait time
* is reached.
*
* @param expectedNumberOfMessages expected number of messages to be received by subscriber.
* @param maxWaitTime maximum wait time in milliseconds before stop waiting for messages.
* @throws org.eclipse.paho.client.mqttv3.MqttException
*/
public void waitUntilExpectedNumberOfMessagesReceived(int expectedNumberOfMessages,
long maxWaitTime) throws MqttException {
// max system wait time
long maxWaitSystemTime = System.currentTimeMillis() + maxWaitTime;
// this loop will exit if system time is larger or equal than maximum system wait time.
while (System.currentTimeMillis() <= maxWaitSystemTime) {
try {
TimeUnit.MILLISECONDS.sleep(2000L);
} catch (InterruptedException e) {
log.error("Error waiting for receiving messages.", e);
}
// if expected number of messages received by the subscriber it will break the loop.
// without waiting further.
if (expectedNumberOfMessages <= getReceivedMessageCount()) {
log.info("Expected message count received by subscriber.");
break;
}
}
}
/**
* Calculate the TPS for the last (messageCount) messages.
*
* @param timeDiffMillis Time took in milliseconds to receive (messageCount) messages.
* @return Transactions Per Second
*/
private double calculateTPS(long timeDiffMillis, int messageCount) {
return ((double) messageCount) / ((double) timeDiffMillis / MILLISECONDS_TO_A_SECOND);
}
/**
* Start publishing message send/receive TPS.
*/
private void startTPSPublisher() {
// scheduling each second will be too much details, but greater than 10 will be too less details, hence 5
final int scheduleTimeInSeconds = 5;
tpsPublisherSchedule = scheduleExecutor.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
int currentReceivedMessageCount = getReceivedMessageCount();
int currentSentMessageCount = getSentMessageCount();
if (currentReceivedMessageCount != previousReceivedMessageCount) {
double receiveTPS = calculateTPS(scheduleTimeInSeconds * MILLISECONDS_TO_A_SECOND,
currentReceivedMessageCount - previousReceivedMessageCount);
log.info("Message Receiving TPS for the last " + scheduleTimeInSeconds + " seconds : " +
receiveTPS);
previousReceivedMessageCount = currentReceivedMessageCount;
}
if (currentSentMessageCount != previousSentMessageCount) {
double sentTPS = calculateTPS(scheduleTimeInSeconds * MILLISECONDS_TO_A_SECOND,
currentSentMessageCount - previousSentMessageCount);
log.info("Message Sending TPS for the last " + scheduleTimeInSeconds + " seconds : " + sentTPS);
previousSentMessageCount = currentSentMessageCount;
}
}
}, 0, scheduleTimeInSeconds, TimeUnit.SECONDS);
}
/**
* Shutdown all the clients.
* Invoke when message send/receive is complete or shutdown hook is triggered.
*
* @throws MqttException
*/
public void shutdown() throws MqttException {
for (AndesMQTTClient subscriberClient : subscriberList) {
subscriberClient.disconnect();
}
for (AndesMQTTClient publisherClient : publisherList) {
publisherClient.disconnect();
}
tpsPublisherSchedule.cancel(true);
scheduleExecutor.shutdown();
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2014, 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.
*/
package org.wso2.mb.integration.common.clients;
/**
* Constants for MQTT tests.
*/
public class MQTTConstants {
public static final String BROKER_PROTOCOL = "tcp";
public static final String BROKER_HOST = "localhost";
public static final String BROKER_PORT = "1883";
public static final String BROKER_PASSWORD = "admin";
public static final String BROKER_USER_NAME = "admin";
public static final byte[] TEMPLATE_PAYLOAD = "hello".getBytes();
public static final byte[] EMPTY_PAYLOAD = "".getBytes();
/**
* Maximum length of a MQTT client Id defined by MQTT 3.1 specifications
*/
public static final int CLIENT_ID_LENGTH = 23;
// Print message send/receive details on each 1000 messages
public static final int MESSAGE_PRINT_LIMIT = 1000;
/***
* Timeout for an MQTT client to connect to the broker.
*/
public static final long CLIENT_CONNECT_TIMEOUT = 1000;
}

View File

@ -0,0 +1,70 @@
/*
* Copyright (c) 2014, 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.
*/
package org.wso2.mb.integration.common.clients;
/**
* The quality of service levels in MQTT.
*/
public enum QualityOfService {
/**
* The message is delivered at most once, or it may not be delivered at all. Its delivery across the network is
* not acknowledged. The message is not stored. The message could be lost if the client is disconnected,
* or if the server fails. QoS0 is the fastest mode of transfer. It is sometimes called "fire and forget".
*/
MOST_ONCE(0),
/**
* The message is always delivered at least once. It might be delivered multiple times if there is a failure
* before an acknowledgment is received by the sender. The message must be stored locally at the sender,
* until the sender receives confirmation that the message has been published by the receiver. The message is
* stored in case the message must be sent again.
*/
LEAST_ONCE(1),
/**
* The message is always delivered exactly once. The message must be stored locally at the sender,
* until the sender receives confirmation that the message has been published by the receiver. The message is
* stored in case the message must be sent again. QoS2 is the safest, but slowest mode of transfer. A more
* sophisticated handshaking and acknowledgement sequence is used than for QoS1 to ensure no duplication of
* messages occurs.
*/
EXACTLY_ONCE(2);
private final int qos;
/**
* Initialize with the given Quality of Service.
*
* @param qos The quality of service level
*/
private QualityOfService(int qos) {
this.qos = qos;
}
/**
* Get the corresponding value for the given quality of service.
* Retrieve this value whenever quality of service level needs to feed into external libraries.
*
* @return The integer representation of this quality of service
*/
public int getValue() {
return qos;
}
}

View File

@ -0,0 +1,526 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.clients.configurations;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.XMLConfiguration;
import org.wso2.mb.integration.common.clients.operations.utils.AndesClientConstants;
import org.wso2.mb.integration.common.clients.exceptions.AndesClientConfigurationException;
import org.wso2.mb.integration.common.clients.operations.utils.ExchangeType;
/**
* This class acts as a configuration class for the Andes Client. The class contains configuration
* that is common for both JMS publishers and consumer. The configuration mentioned are related to
* JMS only.
*/
public class AndesJMSClientConfiguration implements Cloneable {
/**
* The destination name to be used when a configuration is not passed to the client.
*/
private static final String TEMP_DESTINATION_NAME = "temporaryDestination";
/**
* The AMQP transport port.
*/
private int port;
/**
* The host name for the AMQP transport.
*/
private String hostName;
/**
* The user name used when creating the AMQP connection string. Publishing/Consuming of JMS will
* be done under this username.
*/
private String userName;
/**
* The password used when creating the AMQP connection string.
*/
private String password;
/**
* The connection string used for publishing/consuming jms messages
*/
private String connectionString;
/**
* The exchange type used to describe the destination type
*/
private ExchangeType exchangeType;
/**
* The destination name for which messages are published/consumed
*/
private String destinationName;
/**
* The amount of console logging for a certain message count
*/
private long printsPerMessageCount;
/**
* A delay value which can be used to delay of publishing/consuming jms messages
*/
private long runningDelay;
/**
* The file path to write statistics. Statistics include TPS, latency, etc.
*/
private String filePathToWriteStatistics;
/**
* The query string for the amqp connection string. Used during SSL connections.
*/
private String queryStringForConnection = "";
/**
* The empty constructor which will create a queue related test case.
*/
public AndesJMSClientConfiguration() {
this(ExchangeType.QUEUE, TEMP_DESTINATION_NAME);
}
/**
* Creates a connection string with the default username, password, hostname, port. Also sets
* the exchange type and destination name for publishing/consuming jms messages.
*
* @param exchangeType The exchange type.
* @param destinationName The destination name.
*/
public AndesJMSClientConfiguration(ExchangeType exchangeType, String destinationName) {
this(AndesClientConstants.DEFAULT_USERNAME, AndesClientConstants.DEFAULT_PASSWORD,
AndesClientConstants.DEFAULT_HOST_NAME, AndesClientConstants.DEFAULT_PORT,
exchangeType, destinationName);
}
/**
* Creates a connection string with default username, password and a given host name, port. Also
* sets exchangeType and destination name used for publishing/consuming jms messages.
*
* @param hostName The host name used in the AMQP transport connection string.
* @param port The port used in the AMQP transport connection string.
* @param exchangeType The exchange type used for publishing/consuming jms messages.
* @param destinationName The destination name used for publishing/consuming jms messages.
*/
public AndesJMSClientConfiguration(String hostName, int port, ExchangeType exchangeType,
String destinationName) {
this(AndesClientConstants.DEFAULT_USERNAME, AndesClientConstants.DEFAULT_PASSWORD, hostName,
port, exchangeType, destinationName);
}
/**
* Creates a connection string with default username, password, hostname and a given port. Also
* sets exchangeType and destination name used for publishing/consuming jms messages.
*
* @param port The port used in the AMQP transport connection string.
* @param exchangeType The exchange type used for publishing/consuming jms messages.
* @param destinationName The destination name used for publishing/consuming jms messages.
*/
public AndesJMSClientConfiguration(int port, ExchangeType exchangeType,
String destinationName) {
this(AndesClientConstants.DEFAULT_USERNAME, AndesClientConstants.DEFAULT_PASSWORD,
AndesClientConstants.DEFAULT_HOST_NAME, port, exchangeType, destinationName);
}
/**
* Creates a connection string with a given username, password, exchange type
* and destination name.
*
* @param userName The username to be used in creating the connection string.
* @param password The password to be used in creating the connection string.
* @param exchangeType The exchange type.
* @param destinationName The destination name.
*/
public AndesJMSClientConfiguration(String userName, String password,ExchangeType exchangeType,
String destinationName) {
this(userName, password, AndesClientConstants.DEFAULT_HOST_NAME,
AndesClientConstants.DEFAULT_PORT, exchangeType, destinationName);
}
/**
* Creates a connection string with a given port, username, password, exchange type
* and destination name.
*
* @param userName The username to be used in creating the connection string.
* @param password The password to be used in creating the connection string.
* @param exchangeType The exchange type.
* @param destinationName The destination name.
*/
public AndesJMSClientConfiguration(int port, String userName, String password,ExchangeType exchangeType,
String destinationName) {
this(userName, password, AndesClientConstants.DEFAULT_HOST_NAME,
port, exchangeType, destinationName);
}
/**
* Creates a connection string with a given username, password, hostname, port, exchange type
* and destination name.
*
* @param userName The username to be used in creating the connection string.
* @param password The password to be used in creating the connection string.
* @param hostName The host name to be used in creating the connection string.
* @param port The AMQP transport port used in creating the connection string
* @param exchangeType The exchange type.
* @param destinationName The destination name.
*/
public AndesJMSClientConfiguration(String userName, String password, String hostName,
int port, ExchangeType exchangeType,
String destinationName) {
// Setting values for exchange type and destination name
this.exchangeType = exchangeType;
this.destinationName = destinationName;
// Creating connection string
this.userName = userName;
this.password = password;
this.hostName = hostName;
this.port = port;
this.createConnectionString();
// Setting default values
this.printsPerMessageCount = 1L;
this.runningDelay = 0L;
}
/**
* Creates a connection string using an xml file.
*
* @param xmlConfigFilePath The file path for the xml configuration file.
* @throws AndesClientConfigurationException
*/
public AndesJMSClientConfiguration(String xmlConfigFilePath)
throws AndesClientConfigurationException {
try {
XMLConfiguration config = new XMLConfiguration(xmlConfigFilePath);
// Setting values for exchange type and destination name
this.exchangeType = ExchangeType.valueOf(config.getString("base.exchangeType", "QUEUE"));
this.destinationName = config.getString("base.destinationName", TEMP_DESTINATION_NAME);
// Creating connection string
this.userName =
config.getString("base.userName", AndesClientConstants.DEFAULT_USERNAME);
this.password =
config.getString("base.password", AndesClientConstants.DEFAULT_PASSWORD);
this.hostName =
config.getString("base.hostName", AndesClientConstants.CARBON_VIRTUAL_HOST_NAME);
this.port = config.getInt("base.port", AndesClientConstants.DEFAULT_PORT);
this.queryStringForConnection = config.getString("base.queryStringForConnection", "");
this.createConnectionString();
// Setting default values
this.printsPerMessageCount = config.getLong("base.printsPerMessageCount", 1L);
this.runningDelay = config.getLong("base.runningDelay", 0L);
} catch (ConfigurationException e) {
throw new AndesClientConfigurationException("Error in reading xml configuration file. Make sure the file exists.", e);
} catch (IllegalArgumentException e) {
throw new AndesClientConfigurationException("Invalid exchange type used. Use either 'QUEUE' or 'TOPIC'.", e);
}
}
/**
* Copy constructor for the client.
*
* @param config The configuration file.
*/
public AndesJMSClientConfiguration(
AndesJMSClientConfiguration config) {
this.connectionString = config.getConnectionString();
this.exchangeType = config.getExchangeType();
this.destinationName = config.getDestinationName();
this.printsPerMessageCount = config.getPrintsPerMessageCount();
this.runningDelay = config.getRunningDelay();
}
/**
* Creates an SSL connection string with a given username, password, hostname, port, exchange
* type and destination name.
*
* @param userName The username to be used in creating the connection string.
* @param password The password to be used in creating the connection string.
* @param hostName The host name to be used in creating the connection string.
* @param port The AMQP transport port used in creating the connection string
* @param exchangeType The exchange type.
* @param destinationName The destination name.
* @param sslAlias The ssl alias to use in ssl connection.
* @param trustStorePath The file path for trust store to use in ssl connection.
* @param trustStorePassword The trust store password to use in ssl connection.
* @param keyStorePath The file path for key store to use in ssl connection.
* @param keyStorePassword The key store password to use in ssl connection.
*/
public AndesJMSClientConfiguration(String userName, String password, String hostName, int port,
ExchangeType exchangeType, String destinationName,
String sslAlias,
String trustStorePath, String trustStorePassword,
String keyStorePath, String keyStorePassword) {
// Setting values for exchange type and destination name
this.exchangeType = exchangeType;
this.destinationName = destinationName;
// Creating connection string
this.userName = userName;
this.password = password;
this.hostName = hostName;
this.port = port;
if ((keyStorePath == null) || (keyStorePassword == null)) {
this.queryStringForConnection = "?ssl='true'" +
"&ssl_cert_alias='" + sslAlias + "'&trust_store='" + trustStorePath +
"'&trust_store_password='" + trustStorePassword + "'";
} else {
this.queryStringForConnection = "?ssl='true'" +
"&ssl_cert_alias='" + sslAlias + "'&trust_store='" + trustStorePath +
"'&trust_store_password='" +
trustStorePassword + "'&key_store='" + keyStorePath +
"'&key_store_password='" + keyStorePassword + "'";
}
this.createConnectionString();
// Setting default values
this.printsPerMessageCount = 1L;
this.runningDelay = 0L;
}
/**
* Creates an AMQP connection string.
*/
private void createConnectionString() {
this.connectionString = "amqp://" + this.userName + ":" + this.password + "@" +
AndesClientConstants.CARBON_CLIENT_ID + "/" +
AndesClientConstants.CARBON_VIRTUAL_HOST_NAME +
"?brokerlist='tcp://" +
this.hostName + ":" + this.port + this.queryStringForConnection + "'";
}
/**
* Sets user name for the AMQP connection string
*
* @param userName The user name.
*/
public void setUserName(String userName) {
this.userName = userName;
this.createConnectionString();
}
/**
* Sets password for the AMQP connection string
*
* @param password The password
*/
public void setPassword(String password) {
this.password = password;
this.createConnectionString();
}
/**
* Sets host name for the AMQP connection string.
* Suppressing "UnusedDeclaration" warning as the client can be exported and used.
*
* @param hostName The host name
*/
@SuppressWarnings("UnusedDeclaration")
public void setHostName(String hostName) {
this.hostName = hostName;
this.createConnectionString();
}
/**
* Sets the AMQP connection string port.
*
* @param port the port.
*/
public void setPort(int port) {
this.port = port;
this.createConnectionString();
}
/**
* Gets the user name used in the AMQP connection string.
*
* @return The user name.
*/
public String getUserName() {
return this.userName;
}
/**
* Gets the password used in the AMQP connection string.
*
* @return The password.
*/
public String getPassword() {
return this.password;
}
/**
* Gets the host name used in the AMQP connection string.
* Suppressing "UnusedDeclaration" warning as the client can be exported and used.
*
* @return The host name.
*/
@SuppressWarnings("UnusedDeclaration")
public String getHostName() {
return this.hostName;
}
/**
* Gets the port used in the AMQP connection string.
*
* @return The port name.
*/
public int getPort() {
return this.port;
}
/**
* Gets the AMQP connection string.
*
* @return The connection string.
*/
public String getConnectionString() {
return connectionString;
}
/**
* Sets the AMQP transport connection string.
*
* @param connectionString The connection string.
*/
public void setConnectionString(String connectionString) {
this.connectionString = connectionString;
}
/**
* Gets the exchange type used for publishing/consuming jms messages.
*
* @return The exchange type
*/
public ExchangeType getExchangeType() {
return exchangeType;
}
/**
* Sets the exchange type used for publishing/consuming jms messages Suppressing
* "UnusedDeclaration" as this is a configuration
*
* @param exchangeType The exchange type
*/
@SuppressWarnings("UnusedDeclaration")
public void setExchangeType(ExchangeType exchangeType) {
this.exchangeType = exchangeType;
}
/**
* Gets the destination name for publishing/consuming jms messages.
*
* @return The destination name.
*/
public String getDestinationName() {
return destinationName;
}
/**
* Sets the destination name for publishing/consuming jms messages.
*
* @param destinationName The destination name
*/
public void setDestinationName(String destinationName) {
this.destinationName = destinationName;
}
/**
* Gets the number of console logging per message count
*
* @return The number of console logging per message count
*/
public long getPrintsPerMessageCount() {
return this.printsPerMessageCount;
}
/**
* Sets the number of console logging per message count
*
* @param printsPerMessageCount The number of console logging per message count
* @throws org.wso2.mb.integration.common.clients.exceptions.AndesClientConfigurationException
*/
public void setPrintsPerMessageCount(long printsPerMessageCount) throws
AndesClientConfigurationException {
if (0 < printsPerMessageCount) {
this.printsPerMessageCount = printsPerMessageCount;
} else {
throw new AndesClientConfigurationException("Prints per message count cannot be less than one");
}
}
/**
* Gets the delay used in publishing/consuming messages in milliseconds.
*
* @return the delay used in publishing/consuming messages in milliseconds.
*/
public long getRunningDelay() {
return runningDelay;
}
/**
* Sets the delay used in publishing/consuming messages in milliseconds.
*
* @param runningDelay The delay used in publishing/consuming messages in milliseconds.
* @throws org.wso2.mb.integration.common.clients.exceptions.AndesClientConfigurationException
*/
public void setRunningDelay(long runningDelay) throws AndesClientConfigurationException {
if (0 <= runningDelay) {
this.runningDelay = runningDelay;
} else {
throw new AndesClientConfigurationException("Running delay cannot be less than 0");
}
}
/**
* Gets the file path to write statistics such as TPS, Average latency against Timestamp.
*
* @return The file path used for writing statistics.
*/
public String getFilePathToWriteStatistics() {
return filePathToWriteStatistics;
}
/**
* Sets the file path to write statistics such as TPS, Average latency against Timestamp
* Suppressing "UnusedDeclaration" as this is a configuration
*
* @param filePathToPrintStatistics The file path used for writing statistics.
*/
@SuppressWarnings("UnusedDeclaration")
public void setFilePathToWriteStatistics(String filePathToPrintStatistics) {
this.filePathToWriteStatistics = filePathToPrintStatistics;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return "ConnectionString=" + this.connectionString + "\n" + "ExchangeType=" +
this.exchangeType + "\n" + "PrintsPerMessageCount=" + this.printsPerMessageCount
+"\n" + "DestinationName=" + this.destinationName +
"\n" + "RunningDelay=" + this.runningDelay + "\n";
}
}

View File

@ -0,0 +1,551 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.clients.configurations;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.XMLConfiguration;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.wso2.mb.integration.common.clients.exceptions.AndesClientConfigurationException;
import org.wso2.mb.integration.common.clients.operations.utils.ExchangeType;
import org.wso2.mb.integration.common.clients.operations.utils.JMSAcknowledgeMode;
/**
* This class represents the Andes client consumer configuration. The class contains properties
* related to JMS message consuming.
*/
public class AndesJMSConsumerClientConfiguration extends AndesJMSClientConfiguration {
/**
* The logger used in logging information, warnings, errors and etc.
*/
private static Logger log = Logger.getLogger(AndesJMSConsumerClientConfiguration.class);
/**
* Message count at which the consumer un-subscribes.
*/
private long unSubscribeAfterEachMessageCount = Long.MAX_VALUE;
/**
* Message count at which the session is rolled back.
*/
private long rollbackAfterEachMessageCount = Long.MAX_VALUE;
/**
* Message count at which the session is committed.
*/
private long commitAfterEachMessageCount = Long.MAX_VALUE;
/**
* Message count at which a message is acknowledge.
*/
private long acknowledgeAfterEachMessageCount = Long.MAX_VALUE;
/**
* The file path to write received messages.
*/
private String filePathToWriteReceivedMessages = null;
/**
* Maximum messages to receiver.
*/
private long maximumMessagesToReceived = Long.MAX_VALUE;
/**
* Subscription ID for durable topics.
*/
private String subscriptionID = null;
/**
* Whether the subscriber is durable.
*/
private boolean durable = false;
/**
* The acknowledge mode for messages.
*/
private JMSAcknowledgeMode acknowledgeMode = JMSAcknowledgeMode.AUTO_ACKNOWLEDGE;
/**
* Whether the consumer is asynchronously reading messages. Asynchronous message reading implies
* that it uses {@link javax.jms.MessageListener} to listen to receiving messages. Synchronous
* message reading will use a while loop inside a thread.
*/
private boolean async = false;
/**
* JMS selectors string for filtering.
*/
private String selectors = null;
/**
* Creates a consumer configuration with default values.
*/
public AndesJMSConsumerClientConfiguration() {
super();
}
/**
* Creates a consumer with a given exchange type and destination with default connection string.
*
* @param exchangeType The exchange type.
* @param destinationName The destination name.
*/
public AndesJMSConsumerClientConfiguration(
ExchangeType exchangeType, String destinationName) {
super(exchangeType, destinationName);
}
/**
* Creates a consumer with a given host name, port for connection string and exchange type and
* destination name.
*
* @param hostName The host name for connection string.
* @param port The port for the connection string.
* @param exchangeType The exchange type.
* @param destinationName The destination name.
*/
public AndesJMSConsumerClientConfiguration(String hostName, int port,
ExchangeType exchangeType,
String destinationName) {
super(hostName, port, exchangeType, destinationName);
}
/**
* Creates a consumer with a given port for connection string and exchange type and
* destination name.
*
* @param port The port for the connection string.
* @param exchangeType The exchange type.
* @param destinationName The destination name.
*/
public AndesJMSConsumerClientConfiguration( int port,
ExchangeType exchangeType,
String destinationName) {
super(port, exchangeType, destinationName);
}
/**
* Creates a consumer with a given username, password, for connection
* string and exchange type and destination name.
*
* @param userName The user name for the connection string.
* @param password The password for the connection string.
* @param exchangeType The exchange type.
* @param destinationName The destination name.
*/
public AndesJMSConsumerClientConfiguration(String userName, String password,
ExchangeType exchangeType,
String destinationName) {
super(userName, password, exchangeType, destinationName);
}
/**
* Creates a consumer with a given port, username, password, for connection
* string and exchange type and destination name.
*
* @param userName The user name for the connection string.
* @param password The password for the connection string.
* @param exchangeType The exchange type.
* @param destinationName The destination name.
*/
public AndesJMSConsumerClientConfiguration(int port, String userName, String password,
ExchangeType exchangeType,
String destinationName) {
super(port, userName, password, exchangeType, destinationName);
}
/**
* Creates a consumer with a given user name, password, host name, port for connection
* string and exchange type and destination name.
*
* @param userName The user name for the connection string.
* @param password The password for the connection string.
* @param hostName The host name for the connection string.
* @param port The port for the connection string.
* @param exchangeType The exchange type.
* @param destinationName The destination name.
*/
public AndesJMSConsumerClientConfiguration(String userName, String password,
String hostName, int port,
ExchangeType exchangeType,
String destinationName) {
super(userName, password, hostName, port, exchangeType, destinationName);
}
/**
* Creates a configuration for a consumer using an xml file.
*
* @param xmlConfigFilePath The file path for the xml configuration file path.
* @throws AndesClientConfigurationException
*/
public AndesJMSConsumerClientConfiguration(String xmlConfigFilePath)
throws AndesClientConfigurationException {
super(xmlConfigFilePath);
try {
XMLConfiguration config = new XMLConfiguration(xmlConfigFilePath);
this.unSubscribeAfterEachMessageCount = config.getLong("base.consumer.unSubscribeAfterEachMessageCount", Long.MAX_VALUE);
this.rollbackAfterEachMessageCount = config.getLong("base.consumer.rollbackAfterEachMessageCount", Long.MAX_VALUE);
this.commitAfterEachMessageCount = config.getLong("base.consumer.commitAfterEachMessageCount", Long.MAX_VALUE);
this.acknowledgeAfterEachMessageCount = config.getLong("base.consumer.acknowledgeAfterEachMessageCount", Long.MAX_VALUE);
this.filePathToWriteReceivedMessages = config.getString("base.consumer.filePathToWriteReceivedMessages", null);
this.maximumMessagesToReceived = config.getLong("base.consumer.maximumMessagesToReceived", Long.MAX_VALUE);
this.subscriptionID = config.getString("base.consumer.subscriptionID", null);
this.durable = config.getBoolean("base.consumer.durable", false);
this.async = config.getBoolean("base.consumer.async", true);
this.selectors = config.getString("base.consumer.selectors", null);
this.acknowledgeMode = JMSAcknowledgeMode.valueOf(config.getString("base.consumer.acknowledgeMode", "AUTO_ACKNOWLEDGE"));
} catch (ConfigurationException e) {
throw new AndesClientConfigurationException("Error in reading xml configuration file. Make sure the file exists.", e);
} catch (IllegalArgumentException e) {
throw new AndesClientConfigurationException("Invalid acknowledge mode used. Use a value either of the values : SESSION_TRANSACTED, AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE", e);
}
}
/**
* The copy constructor for the JMS base class. This will copy all attributes defined in another
* configuration only for the base client.
*
* @param config The configuration to be copied.
*/
public AndesJMSConsumerClientConfiguration(
AndesJMSClientConfiguration config) {
super(config);
}
/**
* Creates a JMS message consumer with a given AMQP transport connection string for SSL and a
* given exchange type and destination.
*
* @param userName The user name for the connection string.
* @param password The password for the connection string.
* @param hostName The host name for the connection string.
* @param port The port for the connection string.
* @param exchangeType The exchange type.
* @param destinationName The destination name.
* @param sslAlias The ssl alias to use in ssl connection.
* @param trustStorePath The file path for trust store to use in ssl connection.
* @param trustStorePassword The trust store password to use in ssl connection.
* @param keyStorePath The file path for key store to use in ssl connection.
* @param keyStorePassword The key store password to use in ssl connection.
*/
public AndesJMSConsumerClientConfiguration(String userName, String password, String hostName,
int port,
ExchangeType exchangeType, String destinationName,
String sslAlias, String trustStorePath,
String trustStorePassword, String keyStorePath,
String keyStorePassword) {
super(userName, password, hostName, port, exchangeType, destinationName, sslAlias,
trustStorePath, trustStorePassword, keyStorePath, keyStorePassword);
}
/**
* Gets the message count to un-subscribe the consumer.
*
* @return The message count to un-subscribe the consumer.
*/
public long getUnSubscribeAfterEachMessageCount() {
return unSubscribeAfterEachMessageCount;
}
/**
* Sets message count to un-subscribe the consumer.
*
* @param unSubscribeAfterEachMessageCount The message count to un-subscribe the consumer.
* @throws org.wso2.mb.integration.common.clients.exceptions.AndesClientConfigurationException
*/
public void setUnSubscribeAfterEachMessageCount(long unSubscribeAfterEachMessageCount)
throws AndesClientConfigurationException {
if (0 < unSubscribeAfterEachMessageCount) {
this.unSubscribeAfterEachMessageCount = unSubscribeAfterEachMessageCount;
} else {
throw new AndesClientConfigurationException("Value cannot be less than 0");
}
}
/**
* Gets the message count at which the session should be rolled-back.
*
* @return The message count at which the session should be rolled-back.
*/
public long getRollbackAfterEachMessageCount() {
return rollbackAfterEachMessageCount;
}
/**
* Sets message count at which the session should be rolled-back.
*
* @param rollbackAfterEachMessageCount The message count at which the session should be
* rolled-back.
* @throws org.wso2.mb.integration.common.clients.exceptions.AndesClientConfigurationException
*/
public void setRollbackAfterEachMessageCount(long rollbackAfterEachMessageCount)
throws AndesClientConfigurationException {
if (0 < rollbackAfterEachMessageCount) {
this.rollbackAfterEachMessageCount = rollbackAfterEachMessageCount;
} else {
throw new AndesClientConfigurationException("Value cannot be less than 0");
}
}
/**
* Gets the message count at which the session should be committed.
*
* @return The message count at which the session should be committed.
*/
public long getCommitAfterEachMessageCount() {
return commitAfterEachMessageCount;
}
/**
* Sets the message count at which the session should be committed.
*
* @param commitAfterEachMessageCount The message count at which the session should be
* committed.
* @throws org.wso2.mb.integration.common.clients.exceptions.AndesClientConfigurationException
*/
public void setCommitAfterEachMessageCount(long commitAfterEachMessageCount)
throws AndesClientConfigurationException {
if (0 < commitAfterEachMessageCount) {
this.commitAfterEachMessageCount = commitAfterEachMessageCount;
} else {
throw new AndesClientConfigurationException("Value cannot be less than 0");
}
}
/**
* Gets the message count at which a message should be acknowledged after.
*
* @return The the message count at which a message should be acknowledged after.
*/
public long getAcknowledgeAfterEachMessageCount() {
return acknowledgeAfterEachMessageCount;
}
/**
* Sets the message count at which a message should be acknowledged after.
*
* @param acknowledgeAfterEachMessageCount The the message count at which a message should be
* acknowledged after.
* @throws org.wso2.mb.integration.common.clients.exceptions.AndesClientConfigurationException
*/
public void setAcknowledgeAfterEachMessageCount(long acknowledgeAfterEachMessageCount)
throws AndesClientConfigurationException {
if (0 < acknowledgeAfterEachMessageCount) {
this.acknowledgeAfterEachMessageCount = acknowledgeAfterEachMessageCount;
} else {
throw new AndesClientConfigurationException("Value cannot be less than 0");
}
}
/**
* Gets the file path where the received messages should be written to,
*
* @return The file path where the received messages should be written to,
*/
public String getFilePathToWriteReceivedMessages() {
return filePathToWriteReceivedMessages;
}
/**
* Sets the file path where the received messages should be written to,
*
* @param filePathToWriteReceivedMessages The file path where the received messages should be
* written to,
*/
public void setFilePathToWriteReceivedMessages(String filePathToWriteReceivedMessages) {
this.filePathToWriteReceivedMessages = filePathToWriteReceivedMessages;
}
/**
* Gets the maximum number of messages to received.
*
* @return The maximum number of messages to received.
*/
public long getMaximumMessagesToReceived() {
return this.maximumMessagesToReceived;
}
/**
* Sets the maximum number of messages to received.
*
* @param maximumMessagesToReceived The maximum number of messages to received.
* @throws org.wso2.mb.integration.common.clients.exceptions.AndesClientConfigurationException
*/
public void setMaximumMessagesToReceived(long maximumMessagesToReceived)
throws AndesClientConfigurationException {
if (0 < maximumMessagesToReceived) {
this.maximumMessagesToReceived = maximumMessagesToReceived;
} else {
throw new AndesClientConfigurationException("The maximum number of messages to receive " +
"cannot be less than 1");
}
}
/**
* Gets the subscription ID.
*
* @return The subscription ID.
*/
public String getSubscriptionID() {
return subscriptionID;
}
/**
* Sets the subscription ID
*
* @param subscriptionID The subscription ID
* @throws org.wso2.mb.integration.common.clients.exceptions.AndesClientConfigurationException
*/
public void setSubscriptionID(String subscriptionID) throws AndesClientConfigurationException {
if (this.durable) {
if (StringUtils.isNotEmpty(subscriptionID)) {
this.subscriptionID = subscriptionID;
} else {
throw new AndesClientConfigurationException("Subscription ID cannot be null or empty " +
"for an durable topic");
}
} else {
this.subscriptionID = subscriptionID;
log.warn("Setting subscription ID for non-durable topics. Subscription ID is not " +
"necessary for non-durable topics or queues");
}
}
/**
* Checks whether the subscriber/consumer is durable.
*
* @return true if subscriber/consumer is durable, false otherwise.
*/
public boolean isDurable() {
return durable;
}
/**
* Sets values for a durable subscription
*
* @param durable True if subscription is durable, false otherwise.
* @param subscriptionID The subscription ID.
* @throws org.wso2.mb.integration.common.clients.exceptions.AndesClientConfigurationException
*/
public void setDurable(boolean durable, String subscriptionID) throws
AndesClientConfigurationException {
if (durable) {
if (StringUtils.isNotEmpty(subscriptionID)) {
this.subscriptionID = subscriptionID;
} else {
throw new AndesClientConfigurationException("Subscription ID cannot be null or empty " +
"for an durable topic");
}
}
this.durable = durable;
}
/**
* Gets acknowledge mode for messages.
*
* @return The acknowledge mode for messages.
*/
public JMSAcknowledgeMode getAcknowledgeMode() {
return acknowledgeMode;
}
/**
* Sets acknowledge mode for messages.
*
* @param acknowledgeMode The acknowledge mode for messages.
* @throws org.wso2.mb.integration.common.clients.exceptions.AndesClientConfigurationException
*/
public void setAcknowledgeMode(JMSAcknowledgeMode acknowledgeMode)
throws AndesClientConfigurationException {
this.acknowledgeMode = acknowledgeMode;
}
/**
* Checks whether consumer is asynchronously reading messages.
*
* @return true if messages are read asynchronously, false otherwise. Asynchronously message
* reading implies that it uses {@link javax.jms.MessageListener} to listen to receiving
* messages.
*/
public boolean isAsync() {
return async;
}
/**
* Sets the consumer to read message asynchronously. Asynchronously message
* reading implies that it uses {@link javax.jms.MessageListener} to listen to receiving
* messages.
* Suppressing "UnusedDeclaration" as this is a configuration
*
* @param async true if messages should be read asynchronously, false otherwise.
*/
@SuppressWarnings("UnusedDeclaration")
public void setAsync(boolean async) {
this.async = async;
}
/**
* Gets the selectors query used by the consumer for filtering.
*
* @return The selectors query used by the consumer for filtering.
*/
public String getSelectors() {
return selectors;
}
/**
* Sets the selectors query used by the consumer for filtering.
*
* @param selectors The selectors query used by the consumer for filtering.
*/
public void setSelectors(String selectors) {
this.selectors = selectors;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return super.toString() +
"UnSubscribeAfterEachMessageCount=" + this.unSubscribeAfterEachMessageCount + "\n" +
"RollbackAfterEachMessageCount=" + this.rollbackAfterEachMessageCount + "\n" +
"CommitAfterEachMessageCount=" + this.commitAfterEachMessageCount + "\n" +
"AcknowledgeAfterEachMessageCount=" + this.acknowledgeAfterEachMessageCount + "\n" +
"FilePathToWriteReceivedMessages=" + this.filePathToWriteReceivedMessages + "\n" +
"MaximumMessagesToReceived=" + this.maximumMessagesToReceived + "\n" +
"SubscriptionID=" + this.subscriptionID + "\n" +
"Durable=" + this.durable + "\n" +
"AcknowledgeMode=" + this.acknowledgeMode + "\n" +
"Async=" + this.async + "\n" +
"Selectors=" + this.selectors + "\n";
}
/**
* {@inheritDoc}
*/
@Override
public AndesJMSConsumerClientConfiguration clone() throws CloneNotSupportedException {
return (AndesJMSConsumerClientConfiguration) super.clone();
}
}

View File

@ -0,0 +1,426 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.clients.configurations;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.XMLConfiguration;
import org.wso2.mb.integration.common.clients.exceptions.AndesClientConfigurationException;
import org.wso2.mb.integration.common.clients.operations.utils.ExchangeType;
import org.wso2.mb.integration.common.clients.operations.utils.JMSMessageType;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
/**
* This class represents the Andes client publisher configuration. The class contains properties
* related to JMS message publishing/sending.
*/
public class AndesJMSPublisherClientConfiguration extends AndesJMSClientConfiguration {
/**
* File path to read a string content which would be used to as message content when publishing.
*/
private String readMessagesFromFilePath = null;
/**
* JMS message type. Text will be used as default message type.
*/
private JMSMessageType jmsMessageType = JMSMessageType.TEXT;
/**
* Number of messages to be sent by the publisher.
*/
private long numberOfMessagesToSend = 10L;
/**
* The message expiry time.
*/
private long jmsMessageExpiryTime = 0L;
/**
* File path to write messages that are being published
*/
private String filePathToWritePublishedMessages = null;
/**
* Whether the session needs to be transactional or not.
*/
private boolean transactionalSession;
/**
* List of JMS Header properties to set when publishing message
*/
private List<JMSHeaderProperty> JMSHeaderProperties;
/**
* Holds JMSType property to set for JMS messages published
*/
private String JMSType;
/**
* Creates a connection string with default properties.
*/
public AndesJMSPublisherClientConfiguration() {
super();
}
/**
* Creates a publisher with a given exchange type and destination with default connection
* string.
*
* @param exchangeType The exchange type.
* @param destinationName The destination name.
*/
public AndesJMSPublisherClientConfiguration(
ExchangeType exchangeType, String destinationName) {
super(exchangeType, destinationName);
JMSHeaderProperties = new ArrayList<JMSHeaderProperty>(5);
}
/**
* Creates a publisher with a given host name, port for connection string and exchange type and
* destination name.
*
* @param hostName The host name for connection string.
* @param port The port for the connection string.
* @param exchangeType The exchange type.
* @param destinationName The destination name.
*/
public AndesJMSPublisherClientConfiguration(String hostName, int port,
ExchangeType exchangeType,
String destinationName) {
super(hostName, port, exchangeType, destinationName);
JMSHeaderProperties = new ArrayList<JMSHeaderProperty>(5);
}
/**
* Creates a publisher with a given host name, port for connection string and exchange type and
* destination name.
*
* @param port The port for the connection string.
* @param exchangeType The exchange type.
* @param destinationName The destination name.
*/
public AndesJMSPublisherClientConfiguration(int port,
ExchangeType exchangeType,
String destinationName) {
super(port, exchangeType, destinationName);
JMSHeaderProperties = new ArrayList<JMSHeaderProperty>(5);
}
/**
* Creates a publisher with a given username, password, for connection
* string and exchange type and destination name.
*
* @param userName The user name for the connection string.
* @param password The password for the connection string.
* @param exchangeType The exchange type.
* @param destinationName The destination name.
*/
public AndesJMSPublisherClientConfiguration(String userName, String password,
ExchangeType exchangeType,
String destinationName) {
super(userName, password, exchangeType, destinationName);
JMSHeaderProperties = new ArrayList<JMSHeaderProperty>(5);
}
/**
* Creates a publisher with a given port, username, password, for connection
* string and exchange type and destination name.
*
* @param userName The user name for the connection string.
* @param password The password for the connection string.
* @param exchangeType The exchange type.
* @param destinationName The destination name.
*/
public AndesJMSPublisherClientConfiguration(int port, String userName, String password,
ExchangeType exchangeType,
String destinationName) {
super(port, userName, password, exchangeType, destinationName);
JMSHeaderProperties = new ArrayList<JMSHeaderProperty>(5);
}
/**
* Creates a publisher with a given user name, password, host name, password for connection
* string and exchange type and destination name.
*
* @param userName The user name for the connection string.
* @param password The password for the connection string.
* @param hostName The host name for the connection string.
* @param port The port for the connection string.
* @param exchangeType The exchange type.
* @param destinationName The destination name.
*/
public AndesJMSPublisherClientConfiguration(String userName, String password,
String hostName, int port,
ExchangeType exchangeType,
String destinationName) {
super(userName, password, hostName, port, exchangeType, destinationName);
JMSHeaderProperties = new ArrayList<JMSHeaderProperty>(5);
}
/**
* Creates a configuration for a publisher using an xml file.
*
* @param xmlConfigFilePath The file path for the xml configuration file path.
* @throws AndesClientConfigurationException
*/
public AndesJMSPublisherClientConfiguration(String xmlConfigFilePath)
throws AndesClientConfigurationException {
super(xmlConfigFilePath);
try {
XMLConfiguration config = new XMLConfiguration(xmlConfigFilePath);
numberOfMessagesToSend = config.getLong("base.publisher.numberOfMessagesToSend", 10L);
jmsMessageExpiryTime = config.getLong("base.publisher.jmsMessageExpiryTime", 0L);
readMessagesFromFilePath = config.getString("base.publisher.readMessagesFromFilePath", null);
jmsMessageType = JMSMessageType.valueOf(config.getString("base.publisher.jmsMessageType", "TEXT"));
filePathToWritePublishedMessages = config.getString("base.publisher.filePathToWritePublishedMessages", null);
JMSHeaderProperties = new ArrayList<JMSHeaderProperty>(5);
} catch (ConfigurationException e) {
throw new AndesClientConfigurationException("Error in reading xml configuration file. Make sure the file exists.", e);
} catch (IllegalArgumentException e) {
throw new AndesClientConfigurationException("Invalid message type used. Use either 'TEXT', 'BYTE', 'MAP', 'OBJECT' or 'STREAM'.", e);
}
}
/**
* The copy constructor for the JMS base class. This will copy all attributes defined in another
* configuration only for the base client.
*
* @param config The configuration to be copied.
*/
public AndesJMSPublisherClientConfiguration(
AndesJMSClientConfiguration config) {
super(config);
JMSHeaderProperties = new ArrayList<JMSHeaderProperty>(5);
}
/**
* Creates a JMS message publisher with a given AMQP transport connection string for SSL and a
* given exchange type and destination.
*
* @param userName The user name for the connection string.
* @param password The password for the connection string.
* @param hostName The host name for the connection string.
* @param port The port for the connection string.
* @param exchangeType The exchange type.
* @param destinationName The destination name.
* @param sslAlias The ssl alias to use in ssl connection.
* @param trustStorePath The file path for trust store to use in ssl connection.
* @param trustStorePassword The trust store password to use in ssl connection.
* @param keyStorePath The file path for key store to use in ssl connection.
* @param keyStorePassword The key store password to use in ssl connection.
*/
public AndesJMSPublisherClientConfiguration(String userName, String password, String hostName,
int port,
ExchangeType exchangeType, String destinationName,
String sslAlias, String trustStorePath,
String trustStorePassword, String keyStorePath,
String keyStorePassword) {
super(userName, password, hostName, port, exchangeType, destinationName, sslAlias,
trustStorePath, trustStorePassword, keyStorePath, keyStorePassword);
JMSHeaderProperties = new ArrayList<JMSHeaderProperty>(5);
}
/**
* Gets the file path to read a string content which would be used to as message content when
* publishing.
*
* @return The file path.
*/
public String getReadMessagesFromFilePath() {
return readMessagesFromFilePath;
}
/**
* Sets the file path to read a string content which would be used to as message content when
* publishing.
*
* @param readMessagesFromFilePath The file path.
* @throws org.wso2.mb.integration.common.clients.exceptions.AndesClientConfigurationException
* @throws FileNotFoundException
*/
public void setReadMessagesFromFilePath(String readMessagesFromFilePath)
throws AndesClientConfigurationException, FileNotFoundException {
File messagesFilePath = new File(readMessagesFromFilePath);
if (messagesFilePath.exists() && !messagesFilePath.isDirectory()) {
this.readMessagesFromFilePath = readMessagesFromFilePath;
} else {
throw new FileNotFoundException("File is missing : " + messagesFilePath);
}
}
/**
* Gets JMS message type.
*
* @return JMS message type.
*/
public JMSMessageType getJMSMessageType() {
return jmsMessageType;
}
/**
* Set a header property to the messages published
*
* @param key key of the header
* @param value value of the header
* @param type type of the header (Boolean, Integer, Long etc)
*/
public void setJMSHeaderProperty(String key, Object value, JMSHeaderPropertyType type) {
JMSHeaderProperties.add(new JMSHeaderProperty(key, value, type));
}
/**
* Set JMS Type to be set for publishing messages
* @link https://docs.oracle.com/javaee/6/api/javax/jms/Message.html#setJMSType(java.lang.String)
*
* @param jmsType jmsType to set
*/
public void setJMSType(String jmsType) {
this.JMSType = jmsType;
}
/**
* Get JMS type
*
* @return JMS type as a string
*/
public String getJMSType() {
return JMSType;
}
/**
* Sets JMS message type.
*
* @param jmsMessageType JMS message type
*/
public void setJMSMessageType(JMSMessageType jmsMessageType) {
this.jmsMessageType = jmsMessageType;
}
/**
* Gets the number of messages to be sent by the publisher.
*
* @return The number of messages.
*/
public long getNumberOfMessagesToSend() {
return numberOfMessagesToSend;
}
/**
* Sets the number of messages to be sent by the publisher
*
* @param numberOfMessagesToSend The number of messages.
* @throws org.wso2.mb.integration.common.clients.exceptions.AndesClientConfigurationException
*/
public void setNumberOfMessagesToSend(long numberOfMessagesToSend)
throws AndesClientConfigurationException {
if (0 < numberOfMessagesToSend) {
this.numberOfMessagesToSend = numberOfMessagesToSend;
} else {
throw new AndesClientConfigurationException("The number of messages to send cannot be less" +
" than 1");
}
}
/**
* Gets the file path where published messages are written.
*
* @return The file path.
*/
public String getFilePathToWritePublishedMessages() {
return filePathToWritePublishedMessages;
}
/**
* Sets the file path to write messages that are being published by the client.
* Suppressing "UnusedDeclaration" warning as the client can be exported and used.
*
* @param filePathToWritePublishedMessages The file path
*/
@SuppressWarnings("UnusedDeclaration")
public void setFilePathToWritePublishedMessages(String filePathToWritePublishedMessages) {
this.filePathToWritePublishedMessages = filePathToWritePublishedMessages;
}
/**
* Gets the messages expiry time.
*
* @return The message expiry time.
*/
public long getJMSMessageExpiryTime() {
return jmsMessageExpiryTime;
}
/**
* Sets the message expiry time.
*
* @param jmsMessageExpiryTime The message expiry time.
* @throws org.wso2.mb.integration.common.clients.exceptions.AndesClientConfigurationException
*/
public void setJMSMessageExpiryTime(long jmsMessageExpiryTime) throws
AndesClientConfigurationException {
if (0 <= jmsMessageExpiryTime) {
this.jmsMessageExpiryTime = jmsMessageExpiryTime;
} else {
throw new AndesClientConfigurationException("Message expiry time cannot be less than 0");
}
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return super.toString() +
"ReadMessagesFromFilePath=" + this.readMessagesFromFilePath + "\n" +
"JmsMessageType=" + this.jmsMessageType + "\n" +
"NumberOfMessagesToSend=" + this.numberOfMessagesToSend + "\n" +
"JmsMessageExpiryTime=" + this.jmsMessageExpiryTime + "\n";
}
/**
* {@inheritDoc}
*/
@Override
public AndesJMSPublisherClientConfiguration clone() throws CloneNotSupportedException {
return (AndesJMSPublisherClientConfiguration) super.clone();
}
/**
* Whether the session needs to be transactional or not.
*/
public boolean isTransactionalSession() {
return transactionalSession;
}
/**
* Set the session transactional. This is for publishers
* @param transactionalSession true if session needs to be transactional and false otherwise
*/
public void setTransactionalSession(boolean transactionalSession) {
this.transactionalSession = transactionalSession;
}
public List<JMSHeaderProperty> getJMSHeaderProperties() {
return JMSHeaderProperties;
}
}

View File

@ -0,0 +1,74 @@
/*
*
* Copyright (c) 2015, 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.
* /
*/
package org.wso2.mb.integration.common.clients.configurations;
/**
* This class represents configuration of a JMS Header property. JMS sender reads them and set
* when sending a JMS message to the provider
*/
public class JMSHeaderProperty {
private String key;
private Object value;
private JMSHeaderPropertyType type;
/**
* Create a new JMSHeaderProperty.
*
* @param key key of the header to be set to message
* @param value value of the header to be set to message
* @param type type of the header to be set to message
*/
public JMSHeaderProperty(String key, Object value, JMSHeaderPropertyType type) {
this.key = key;
this.value = value;
this.type = type;
}
/**
* Get Key of the header property
*
* @return key as a string
*/
public String getKey() {
return key;
}
/**
* Get value of the header property
*
* @return value as a Object
*/
public Object getValue() {
return value;
}
/**
* Get property of the header property. Long, String, Integer etc
*
* @return Property type
*/
public JMSHeaderPropertyType getType() {
return type;
}
}

View File

@ -0,0 +1,46 @@
/*
*
* Copyright (c) 2015, 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.
* /
*/
package org.wso2.mb.integration.common.clients.configurations;
/**
* Keeps the type of the JMS header property. According to JMS spec headers of different types
* can be set
*/
public enum JMSHeaderPropertyType {
OBJECT,
SHORT,
STRING,
INTEGER,
LONG,
BOOLEAN,
BYTE,
DOUBLE,
FLOAT
}

View File

@ -0,0 +1,73 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.clients.exceptions;
/**
* Exception class for andes client configuration.
*/
public class AndesClientConfigurationException extends Exception {
/**
* Error message for exception
*/
public String errorMessage;
/**
* Creates Andes configuration exception
*/
public AndesClientConfigurationException() {
}
/**
* Creates Andes configuration exception with error message
*
* @param message Error message
*/
public AndesClientConfigurationException(String message) {
super(message);
errorMessage = message;
}
/**
* Creates Andes configuration exception with error message and throwable
*
* @param message Error message
* @param cause The throwable
*/
public AndesClientConfigurationException(String message, Throwable cause) {
super(message, cause);
errorMessage = message;
}
/**
* Creates Andes configuration exception with throwable.
*
* @param cause The throwable
*/
public AndesClientConfigurationException(Throwable cause) {
super(cause);
}
/**
* {@inheritDoc}
*/
@Override
public String getMessage() {
return errorMessage;
}
}

View File

@ -0,0 +1,55 @@
package org.wso2.mb.integration.common.clients.exceptions;
/**
* Exception class for andes client.
*/
public class AndesClientException extends Exception {
/**
* Error message for exception
*/
public String errorMessage;
/**
* Creates Andes exception
*/
public AndesClientException() {
}
/**
* Creates Andes exception with error message
*
* @param message Error message
*/
public AndesClientException(String message) {
super(message);
errorMessage = message;
}
/**
* Creates Andes exception with error message and throwable
*
* @param message Error message
* @param cause The throwable
*/
public AndesClientException(String message, Throwable cause) {
super(message, cause);
errorMessage = message;
}
/**
* Creates Andes exception with throwable.
*
* @param cause The throwable
*/
public AndesClientException(Throwable cause) {
super(cause);
}
/**
* {@inheritDoc}
*/
@Override
public String getMessage() {
return errorMessage;
}
}

View File

@ -0,0 +1,165 @@
/*
* Copyright (c) 2005-2014, 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.
*/
package org.wso2.mb.integration.common.clients.operations.clients;
import org.apache.axis2.AxisFault;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.wso2.carbon.andes.stub.AndesAdminServiceBrokerManagerAdminException;
import org.wso2.carbon.andes.stub.AndesAdminServiceStub;
import org.wso2.carbon.andes.stub.admin.types.Message;
import org.wso2.carbon.andes.stub.admin.types.Queue;
import org.wso2.carbon.andes.stub.admin.types.QueueRolePermission;
import org.wso2.mb.integration.common.clients.operations.clients.utils.AuthenticateStubUtil;
import java.rmi.RemoteException;
/**
* Andes Admin Client is a client which is used to contact the Andes Admin services
*/
public class AndesAdminClient {
String backendUrl = null;
String sessionCookie = null;
AndesAdminServiceStub stub = null;
public static final String PUBLISHER_ROLE = "publisher";
/**
* Initializes Andes Admin Client
*
* @param backendUrl the backend url
* @param sessionCookie the session cookie string
* @throws AxisFault
*/
public AndesAdminClient(String backendUrl, String sessionCookie) throws AxisFault {
this.backendUrl = backendUrl + "AndesAdminService";
this.sessionCookie = sessionCookie;
stub = new AndesAdminServiceStub(this.backendUrl);
AuthenticateStubUtil.authenticateStub(sessionCookie, stub);
}
/**
* Creates a new queue
*
* @param queue new queue name
* @throws AndesAdminServiceBrokerManagerAdminException
* @throws RemoteException
*/
public void createQueue(String queue)
throws AndesAdminServiceBrokerManagerAdminException, RemoteException {
// Add permission to be able to publish
QueueRolePermission queueRolePermission = new QueueRolePermission();
queueRolePermission.setRoleName(PUBLISHER_ROLE);
queueRolePermission.setAllowedToConsume(true);
queueRolePermission.setAllowedToPublish(true);
stub.addQueueAndAssignPermission(queue, new QueueRolePermission[]{queueRolePermission});
}
/**
* Gets messages in a queue
*
* @param queue the queue name
* @param startingIndex starting index of the messages to be returned
* @param maximumMessageCount maximum number of messages to return
* @return an array of messages
* @throws AndesAdminServiceBrokerManagerAdminException
* @throws RemoteException
*/
public Message[] browseQueue(String queue, int startingIndex, int maximumMessageCount)
throws AndesAdminServiceBrokerManagerAdminException, RemoteException {
return stub.browseQueue(queue, startingIndex, maximumMessageCount);
}
/**
* Deletes a queue
*
* @param queue the queue name
* @throws AndesAdminServiceBrokerManagerAdminException
* @throws RemoteException
*/
public void deleteQueue(String queue)
throws AndesAdminServiceBrokerManagerAdminException, RemoteException {
stub.deleteQueue(queue);
}
/**
* Deletes all messages in a queue
*
* @param queue the name of the queue
* @throws RemoteException
*/
public void purgeQueue(String queue)
throws RemoteException, AndesAdminServiceBrokerManagerAdminException {
stub.purgeMessagesOfQueue(queue);
}
/**
* Get queue object by queue name
*
* @param name the name of the queue
* @return a queue
* @throws RemoteException
* @throws AndesAdminServiceBrokerManagerAdminException
*/
public Queue getQueueByName(String name)
throws RemoteException, AndesAdminServiceBrokerManagerAdminException {
return stub.getQueueByName(name);
}
/**
* Updating permissions for a queue. Permissions may include publish, consume etc
*
* @param queueName queue name
* @param permissions new permissions
* @throws AndesAdminServiceBrokerManagerAdminException
* @throws RemoteException
*/
public void updatePermissionForQueue(String queueName, QueueRolePermission permissions)
throws AndesAdminServiceBrokerManagerAdminException, RemoteException {
stub.updatePermission(queueName, new QueueRolePermission[]{permissions});
}
/**
* Adding session cookie to service client options
*
* @param client the service client
* @throws AxisFault
*/
private void configureCookie(ServiceClient client) throws AxisFault {
if (sessionCookie != null) {
Options option = client.getOptions();
option.setManageSession(true);
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING,
sessionCookie);
}
}
/**
* Get dead letter channel queue
*
* @return queue
* @throws AndesAdminServiceBrokerManagerAdminException
* @throws java.rmi.RemoteException
*/
public Queue getDlcQueue() throws AndesAdminServiceBrokerManagerAdminException,
java.rmi.RemoteException {
return stub.getDLCQueue();
}
}

View File

@ -0,0 +1,129 @@
/*
* Copyright (c) 2005-2014, 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.
*/
package org.wso2.mb.integration.common.clients.operations.clients;
import org.apache.axis2.AxisFault;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.wso2.carbon.andes.event.stub.core.TopicNode;
import org.wso2.carbon.andes.event.stub.core.TopicRolePermission;
import org.wso2.carbon.andes.event.stub.service.AndesEventAdminServiceEventAdminException;
import org.wso2.carbon.andes.event.stub.service.AndesEventAdminServiceStub;
import java.rmi.RemoteException;
/**
* Topic Admin Client is a client which is used to contact the Topic Admin services
*/
public class TopicAdminClient {
String backendUrl = null;
String SessionCookie = null;
AndesEventAdminServiceStub stub = null;
/**
* Initializes Topic Admin Client
*
* @param backendUrl the backend url
* @param sessionCookie the session cookie string
* @throws AxisFault
*/
public TopicAdminClient(String backendUrl, String sessionCookie) throws AxisFault {
this.backendUrl = backendUrl + "AndesEventAdminService.AndesEventAdminServiceHttpsSoap12Endpoint";
this.SessionCookie = sessionCookie;
stub = new AndesEventAdminServiceStub(this.backendUrl);
configureCookie(stub._getServiceClient());
}
/**
* Adds a new topic
*
* @param newTopicName new topic name
* @throws AndesEventAdminServiceEventAdminException
* @throws RemoteException
*/
public void addTopic(String newTopicName)
throws AndesEventAdminServiceEventAdminException, RemoteException {
stub.addTopic(newTopicName);
}
/**
* Removes a topic
*
* @param topicName topic name
* @throws AndesEventAdminServiceEventAdminException
* @throws RemoteException
*/
public void removeTopic(String topicName)
throws AndesEventAdminServiceEventAdminException, RemoteException {
stub.removeTopic(topicName);
}
/**
* Get topic node by topic name
*
* @param topicName the topic name
* @return a topic node
* @throws AndesEventAdminServiceEventAdminException
* @throws RemoteException
*/
public TopicNode getTopicByName(String topicName)
throws AndesEventAdminServiceEventAdminException, RemoteException {
TopicNode[] topicNodes = stub.getAllTopics().getChildren();
if (topicNodes != null && topicNodes.length > 0) {
for (TopicNode topicNode : topicNodes) {
if (topicNode.getTopicName().equalsIgnoreCase(topicName)) {
return topicNode;
}
}
}
return null;
}
/**
* Updating permissions for a topic. Permissions may include publish, consume etc
*
* @param topicName topic name
* @param permissions new permissions
* @throws AndesEventAdminServiceEventAdminException
* @throws RemoteException
*/
public void updatePermissionForTopic(String topicName, TopicRolePermission permissions)
throws AndesEventAdminServiceEventAdminException, RemoteException {
stub.updatePermission(topicName, new TopicRolePermission[]{permissions});
}
/**
* Adding session cookie to service client options
*
* @param client the service client
* @throws AxisFault
*/
private void configureCookie(ServiceClient client) throws AxisFault {
if (SessionCookie != null) {
Options option = client.getOptions();
option.setManageSession(true);
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING,
SessionCookie);
}
}
}

View File

@ -0,0 +1,68 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.clients.operations.clients.utils;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.client.Stub;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.utils.CarbonUtils;
/**
* This class is used to authenticate a web services so that it's stubs can be used.
* @see <a href="https://github.com/wso2/carbon-platform-integration-utils/blob/master/common-admin-clients/src/main/java/org/wso2/carbon/integration/common/admin/client/utils/AuthenticateStubUtil.java">AuthenticateStubUtil</a>
* for more other mehtods.
*/
public class AuthenticateStubUtil {
/**
* Info logger.
*/
private static final Log log = LogFactory.getLog(AuthenticateStubUtil.class);
/**
* Stub authentication method
*
* @param stub valid stub
* @param sessionCookie session cookie
*/
public static void authenticateStub(String sessionCookie, Stub stub) {
long soTimeout = 5 * 60 * 1000; // Three minutes
ServiceClient client = stub._getServiceClient();
Options option = client.getOptions();
option.setManageSession(true);
option.setTimeOutInMilliSeconds(soTimeout);
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie);
if (log.isDebugEnabled()) {
log.debug("AuthenticateStub : Stub created with session " + sessionCookie);
}
}
/**
* Authenticate the given web service stub against the Product user manager. This
* will make it possible to use the stub for invoking Product admin services.
*
* @param stub Axis2 service stub which needs to be authenticated
*/
public static void authenticateStub(String userName, String password, Stub stub) {
CarbonUtils.setBasicAccessSecurityHeaders(userName, password, stub._getServiceClient());
}
}

View File

@ -0,0 +1,186 @@
/*
* Copyright (c) 2014, 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.
*/
package org.wso2.mb.integration.common.clients.operations.mqtt.async;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.paho.client.mqttv3.*;
import org.wso2.mb.integration.common.clients.QualityOfService;
import org.wso2.mb.integration.common.clients.AndesMQTTClient;
import org.wso2.mb.integration.common.clients.MQTTClientConnectionConfiguration;
import org.wso2.mb.integration.common.clients.operations.mqtt.blocking.AndesMQTTBlockingClient;
import org.wso2.mb.integration.common.clients.operations.mqtt.callback.CallbackHandler;
/**
* Asynchronous publish/subscribe MQTT client.
* <p/>
* Each asynchronous publisher/subscriber should extend from this.
*/
public abstract class AndesMQTTAsyncClient extends AndesMQTTClient {
private final static Log log = LogFactory.getLog(AndesMQTTBlockingClient.class);
// Basic asynchronous mqtt client
protected MqttAsyncClient mqttClient;
/**
* Create a mqtt client initializing mqtt options.
*
* @param configuration MQTT configurations
* @param clientID The unique client Id
* @param topic Topic to subscribe/publish to
* @param qos The quality of service
* @param callbackHandler Callback Handler to handle receiving messages/message sending ack
* @throws MqttException
*/
public AndesMQTTAsyncClient(MQTTClientConnectionConfiguration configuration, String clientID, String topic,
QualityOfService qos, CallbackHandler callbackHandler) throws MqttException {
super(configuration, clientID, topic, qos, callbackHandler);
// Construct MQTT client
mqttClient = new MqttAsyncClient(this.brokerUrl, clientID, dataStore);
// Connect to the MQTT server
connect();
mqttClient.setCallback(callbackHandler);
}
/**
* Publish message to broker using mqtt asynchronously.
*
* @param payload Data to send
* @param noOfMessages Number of message to send
* @throws MqttException
*/
protected void publish(byte[] payload, int noOfMessages) throws MqttException {
log.info("Publishing to topic : " + topic + " on qos : " + qos);
if (null != payload) {
// Create and configure message
MqttMessage message = new MqttMessage(payload);
message.setQos(qos.getValue());
message.setRetained(retain);
for (int i = 0; i < noOfMessages; i++) {
// Send message to server, control is either returned or blocked until it has been delivered to the
// server depending on the MqttClient type (Blocking/Async)meeting the specified quality of service.
mqttClient.publish(topic, message);
}
}
}
/**
* Subscribe to a topic in an asynchronous manner.
*
* @throws MqttException
*/
public void subscribe() throws MqttException {
log.info("Subscribing to topic \"" + topic + "\" qos " + qos);
IMqttToken subscriptionToken = mqttClient.subscribe(topic, qos.getValue());
// Wait until subscription is made. Otherwise test results will be unpredictable
subscriptionToken.waitForCompletion();
//Will need to wait to receive all messages - subscriber closes on disconnect
}
/**
* Asynchronously subscribe to a given topic.
*
* @param topicName The topic to subscribe to
* @throws MqttException
*/
@Override
public void subscribe(String topicName) throws MqttException {
log.info("Subscribing to topic \"" + topicName + "\" qos " + qos);
IMqttToken subscriptionToken = mqttClient.subscribe(topicName, qos.getValue());
// Wait until subscription is made. Otherwise test results will be unpredictable
subscriptionToken.waitForCompletion();
}
/**
* Un-subscribe from the topic.
*
* @throws MqttException
*/
public void unsubscribe() throws MqttException {
IMqttToken unsubscriptionToken = mqttClient.unsubscribe(topic);
// Wait until un-subscription is successful. Otherwise test results will be unpredictable.
unsubscriptionToken.waitForCompletion();
log.info("Subscriber for topic : " + topic + " un-subscribed");
}
/**
* {@inheritDoc}
*/
@Override
public void unsubscribe(String topic) throws MqttException {
IMqttToken unsubscriptionToken = mqttClient.unsubscribe(topic);
// Wait until un-subscription is successful. Otherwise test results will be unpredictable.
unsubscriptionToken.waitForCompletion();
log.info("Subscriber for topic : " + topic + " un-subscribed");
}
/**
* Shutdown the mqtt client. Call this whenever the system exits, test cases are finished or disconnect hook is
* called.
*
* @throws MqttException
*/
public void disconnect() throws MqttException {
if (isConnected()) {
IMqttToken disconnectionToken = mqttClient.disconnect();
// Wait until disconnect is complete
disconnectionToken.waitForCompletion();
log.info("Client " + mqttClientID + " Disconnected");
}
}
/**
* {@inheritDoc}
*/
@Override
public void connect() throws MqttException {
if (!isConnected()) {
log.info("Connecting to " + brokerUrl + " with client ID " + mqttClientID);
IMqttToken connectionToken = mqttClient.connect(connectionOptions);
// Wait until connection is complete. Otherwise test results will be unpredictable
connectionToken.waitForCompletion();
log.info("Client " + mqttClientID + " Connected");
}
}
/**
* Use this to validate if connection to server is still active.
*
* @return Is MQTT client connected to the server
*/
public boolean isConnected() {
return mqttClient.isConnected();
}
}

View File

@ -0,0 +1,94 @@
/*
* Copyright (c) 2014, 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.
*/
package org.wso2.mb.integration.common.clients.operations.mqtt.async;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.wso2.mb.integration.common.clients.QualityOfService;
import org.wso2.mb.integration.common.clients.MQTTClientConnectionConfiguration;
import org.wso2.mb.integration.common.clients.operations.mqtt.callback.CallbackHandler;
import java.util.Collections;
import java.util.List;
/**
* Asynchronous MQTT publisher client.
*/
public class MQTTAsyncPublisherClient extends AndesMQTTAsyncClient {
/** The payload to send as the message content **/
private byte[] messagePayLoad;
/** The number of messages to send **/
private int noOfMessages;
private static final Log log = LogFactory.getLog(MQTTAsyncPublisherClient.class);
/**
* Initialize publishing to mqtt.
*
* @param configuration MQTT configurations
* @param clientID Unique mqtt client Id
* @param topic Topic to publish to
* @param qos Quality of service
* @param payload Data to send
* @param noOfMessages Number of message to send
* @throws MqttException
*/
public MQTTAsyncPublisherClient(MQTTClientConnectionConfiguration configuration, String clientID, String topic,
QualityOfService qos, byte[] payload, int noOfMessages) throws MqttException {
super(configuration, clientID, topic, qos, new CallbackHandler());
messagePayLoad = payload;
this.noOfMessages = noOfMessages;
}
/**
* Start the publisher to publish to mqtt.
*/
@Override
public void run() {
try {
publish(messagePayLoad, noOfMessages);
} catch (MqttException e) {
log.error("Error publishing messages to " + getTopic() + " from " + getMqttClientID(), e);
}
}
/**
* Return subscription status as false since this is the publishing client.
*
* @return False
*/
@Override
public boolean isSubscribed() {
return false;
}
/**
* Return empty as this is the publisher client and does not accept any messages.
*
* @return empty message list
*/
@Override
public List<MqttMessage> getReceivedMessages() {
return Collections.emptyList();
}
}

View File

@ -0,0 +1,112 @@
/*
* Copyright (c) 2014, 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.
*/
package org.wso2.mb.integration.common.clients.operations.mqtt.async;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.wso2.mb.integration.common.clients.QualityOfService;
import org.wso2.mb.integration.common.clients.MQTTClientConnectionConfiguration;
import org.wso2.mb.integration.common.clients.operations.mqtt.callback.CallbackHandler;
import java.util.List;
/**
* Asynchronous MQTT subscriber client.
*/
public class MQTTAsyncSubscriberClient extends AndesMQTTAsyncClient {
private static final Log log = LogFactory.getLog(MQTTAsyncSubscriberClient.class);
// Listening to the server for message or not
private boolean subscribed = false;
/**
* Initialize subscribing to mqtt.
*
* @param configuration MQTT configurations
* @param clientID Unique mqtt client Id
* @param topic Topic to subscribe to
* @param qos Quality of Service
* @param saveMessages Save receiving messages
* @throws MqttException
*/
public MQTTAsyncSubscriberClient(MQTTClientConnectionConfiguration configuration, String clientID, String topic,
QualityOfService qos, boolean saveMessages) throws MqttException {
super(configuration, clientID, topic, qos, new CallbackHandler(saveMessages));
}
/**
* Get all the received messages through this client.
* Use this if want to validate message content.
*
* @return Received messages.
*/
public List<MqttMessage> getReceivedMessages() {
return getCallbackHandler().getReceivedMessages();
}
/**
* Invokes client and subscribes to the given topic.
*/
@Override
public void run() {
try {
subscribe();
subscribed = true;
} catch (MqttException e) {
log.error("Error subscribing to topic " + getTopic() + " from client " + getMqttClientID(), e);
}
}
/**
* Gracefully disconnect the client after un-subscribing to subscribed topic.
* Called through ClientEngine disconnect.
*
* @throws MqttException
*/
@Override
public void disconnect() throws MqttException {
CallbackHandler callbackHandler = getCallbackHandler();
if (isConnected()) {
if (null != callbackHandler) {
log.info("No of messages received for client " + getMqttClientID() + " : " + callbackHandler
.getReceivedMessageCount());
}
unsubscribe();
subscribed = false;
mqttClient.disconnect();
log.info("Client " + getMqttClientID() + " Disconnected");
}
}
/**
* Check if the subscriber is subscribed to a topic
*
* @return Is Subscribed
*/
public boolean isSubscribed() {
return subscribed;
}
}

View File

@ -0,0 +1,166 @@
/*
* Copyright (c) 2014, 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.
*/
package org.wso2.mb.integration.common.clients.operations.mqtt.blocking;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.wso2.mb.integration.common.clients.QualityOfService;
import org.wso2.mb.integration.common.clients.AndesMQTTClient;
import org.wso2.mb.integration.common.clients.MQTTClientConnectionConfiguration;
import org.wso2.mb.integration.common.clients.operations.mqtt.callback.CallbackHandler;
/**
* Blocking(synchronous) publish/subscribe MQTT client.
* <p/>
* Each blocking publisher/subscriber should extend from this.
*/
public abstract class AndesMQTTBlockingClient extends AndesMQTTClient {
private final static Log log = LogFactory.getLog(AndesMQTTBlockingClient.class);
protected MqttClient mqttClient;
/**
* Create a mqtt client initializing mqtt options.
*
* @param configuration MQTT configurations
* @param clientID The unique client Id
* @param topic Topic to subscribe/publish to
* @param qos The quality of service
* @param callbackHandler Callback Handler to handle receiving messages/message sending ack
* @throws MqttException
*/
public AndesMQTTBlockingClient(MQTTClientConnectionConfiguration configuration, String clientID, String topic,
QualityOfService qos, CallbackHandler callbackHandler) throws MqttException {
super(configuration, clientID, topic, qos, callbackHandler);
// Construct MQTT client
mqttClient = new MqttClient(this.brokerUrl, clientID, dataStore);
// Connect to the MQTT server
connect();
mqttClient.setCallback(callbackHandler);
}
/**
* Publish message to broker using mqtt synchronously.
*
* @param payload Data to send
* @param noOfMessages Number of message to send
* @throws MqttException
*/
protected void publish(byte[] payload, int noOfMessages) throws MqttException {
log.info("Publishing to topic : " + topic + " on qos : " + qos);
if (null != payload) {
// Create and configure message
MqttMessage message = new MqttMessage(payload);
message.setQos(qos.getValue());
message.setRetained(retain);
for (int i = 0; i < noOfMessages; i++) {
// Send message to server, control is either returned or blocked until it has been delivered to the
// server depending on the MqttClient type (Blocking/Async)meeting the specified quality of service.
mqttClient.publish(topic, message);
}
}
}
/**
* Subscribe to the requested topic in a synchronous manner.
*
* @throws MqttException
*/
public void subscribe() throws MqttException {
log.info("Subscribing to topic \"" + topic + "\" qos " + qos);
mqttClient.subscribe(topic, qos.getValue());
//Will need to wait to receive all messages - subscriber closes on disconnect
}
/**
* Synchronously subscribe to a given topic.
*
* @param topicName The topic to subscribe to
* @throws MqttException
*/
@Override
public void subscribe(String topicName) throws MqttException {
log.info("Subscribing to topic \"" + topicName + "\" on qos" + qos);
mqttClient.subscribe(topicName, qos.getValue());
}
/**
* Un-subscribe from the topic.
*
* @throws MqttException
*/
public void unsubscribe() throws MqttException {
mqttClient.unsubscribe(topic);
log.info("Subscriber for topic : " + topic + " un-subscribed");
}
/**
* {@inheritDoc}
*/
@Override
public void unsubscribe(String topic) throws MqttException {
mqttClient.unsubscribe(topic);
log.info("Subscriber for topic : " + topic + " un-subscribed");
}
/**
* Shutdown the mqtt client. Call this whenever the system exits, test cases are finished or disconnect hook is
* called.
*
* @throws MqttException
*/
public void disconnect() throws MqttException {
if (isConnected()) {
mqttClient.disconnect();
log.info("Client " + mqttClientID + " Disconnected");
}
}
/**
* {@inheritDoc}
*/
@Override
public void connect() throws MqttException {
log.info("Connecting to " + brokerUrl + " with client ID " + mqttClientID);
mqttClient.connect(connectionOptions);
log.info("Client " + mqttClientID + " Connected");
}
/**
* Use this to validate if connection to server is still active.
*
* @return Is MQTT client connected to the server
*/
public boolean isConnected() {
return mqttClient.isConnected();
}
}

View File

@ -0,0 +1,94 @@
/*
* Copyright (c) 2014, 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.
*/
package org.wso2.mb.integration.common.clients.operations.mqtt.blocking;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.wso2.mb.integration.common.clients.QualityOfService;
import org.wso2.mb.integration.common.clients.MQTTClientConnectionConfiguration;
import org.wso2.mb.integration.common.clients.operations.mqtt.callback.CallbackHandler;
import java.util.Collections;
import java.util.List;
/**
* Synchronous MQTT publishing client.
*/
public class MQTTBlockingPublisherClient extends AndesMQTTBlockingClient {
// The payload to send as message content
private byte[] messagePayLoad;
// The number of messages to send
private int noOfMessages;
private static final Log log = LogFactory.getLog(MQTTBlockingPublisherClient.class);
/**
* Initialize publishing to mqtt.
*
* @param configuration MQTT configurations
* @param clientID Unique mqtt client Id
* @param topic Topic to publish to
* @param qos Quality of service
* @param payload Data to send
* @param noOfMessages Number of message to send
* @throws MqttException
*/
public MQTTBlockingPublisherClient(MQTTClientConnectionConfiguration configuration, String clientID, String topic,
QualityOfService qos, byte[] payload, int noOfMessages) throws MqttException {
super(configuration, clientID, topic, qos, new CallbackHandler());
messagePayLoad = payload;
this.noOfMessages = noOfMessages;
}
/**
* Start the publisher to publish to mqtt.
*/
@Override
public void run() {
try {
publish(messagePayLoad, noOfMessages);
} catch (MqttException e) {
log.error("Error publishing messages to " + getTopic() + " from " + getMqttClientID(), e);
}
}
/**
* Return subscription status as false since this is the publishing client.
*
* @return False
*/
@Override
public boolean isSubscribed() {
return false;
}
/**
* Return empty as this is the publisher client and does not accept any messages.
*
* @return empty message list
*/
@Override
public List<MqttMessage> getReceivedMessages() {
return Collections.emptyList();
}
}

View File

@ -0,0 +1,113 @@
/*
* Copyright (c) 2014, 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.
*/
package org.wso2.mb.integration.common.clients.operations.mqtt.blocking;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.wso2.mb.integration.common.clients.QualityOfService;
import org.wso2.mb.integration.common.clients.MQTTClientConnectionConfiguration;
import org.wso2.mb.integration.common.clients.operations.mqtt.callback.CallbackHandler;
import java.util.List;
/**
* Synchronous MQTT subscriber client.
*/
public class MQTTBlockingSubscriberClient extends AndesMQTTBlockingClient {
private static final Log log = LogFactory.getLog(MQTTBlockingSubscriberClient.class);
// Listening to the server for message or not
private boolean subscribed = false;
/**
* Initialize subscribing to mqtt.
*
* @param configuration MQTT configurations
* @param clientID Unique mqtt client Id
* @param topic Topic to subscribe to
* @param qos Quality of Service
* @param saveMessages Save receiving messages
* @throws MqttException
*/
public MQTTBlockingSubscriberClient(MQTTClientConnectionConfiguration configuration, String clientID, String topic,
QualityOfService qos, boolean saveMessages) throws MqttException {
super(configuration, clientID, topic, qos, new CallbackHandler(saveMessages));
}
/**
* Get all the received messages through this client.
* Use this if want to validate message content.
*
* @return Received messages.
*/
public List<MqttMessage> getReceivedMessages() {
return getCallbackHandler().getReceivedMessages();
}
/**
* Invokes client and subscribes to the given topic.
*/
@Override
public void run() {
try {
subscribe();
subscribed = true;
} catch (MqttException e) {
log.error("Error subscribing to topic " + getTopic() + " from client " + getMqttClientID(), e);
}
}
/**
* Gracefully disconnect the client after un-subscribing to subscribed topic.
* Called through ClientEngine disconnect.
*
* @throws MqttException
*/
@Override
public void disconnect() throws MqttException {
CallbackHandler callbackHandler = getCallbackHandler();
if (isConnected()) {
if (null != callbackHandler) {
log.info("No of messages received for client " + getMqttClientID() + " : " + callbackHandler
.getReceivedMessageCount());
}
// Disconnecting forcefully without un-subscribing to prevent a publisher from blocking an un-subscribe
// process.
mqttClient.disconnect();
subscribed = false;
log.info("Client " + getMqttClientID() + " Disconnected");
}
}
/**
* Check if the subscriber is subscribed to a topic
*
* @return Is Subscribed
*/
public boolean isSubscribed() {
return subscribed;
}
}

View File

@ -0,0 +1,175 @@
/*
* Copyright (c) 2014, 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.
*/
package org.wso2.mb.integration.common.clients.operations.mqtt.callback;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.wso2.mb.integration.common.clients.MQTTConstants;
import java.util.ArrayList;
import java.util.List;
/**
* Callback handler to handle message arrival, delivery complete and connection lost.
* Keeps track of sent/received message counts.
*/
public class CallbackHandler implements MqttCallback {
private final Log log = LogFactory.getLog(CallbackHandler.class);
private boolean saveMessages = false;
private final List<MqttMessage> receivedMessages = new ArrayList<MqttMessage>();
private int receivedMessageCount;
private int sentMessageCount;
/**
* Saves the topic name for which the last message received if saveMessages is set to true.
*/
String lastTopicReceived;
/**
* Default constructor. Use this if you do not care about receiving message are saved or not.
*/
public CallbackHandler() {
}
/**
* Set saveMessages while initializing. Use this if you want to specifically want to save/not save receiving
* messages.
* <p/>
* Do not set saveMessages to true if you are expecting a large number of messages.
*
* @param saveReceivingMessages Save receiving message
*/
public CallbackHandler(boolean saveReceivingMessages) {
this.saveMessages = saveReceivingMessages;
}
/**
* Extract the received message count for the client.
*
* @return Received message count
*/
public int getReceivedMessageCount() {
return receivedMessageCount;
}
/**
* Handle losing connection with the server.
* Here we just print it to the test console.
*
* @param throwable Throwable connection lost
*/
@Override
public void connectionLost(Throwable throwable) {
log.error("Connection Lost - Client Disconnected", throwable);
}
/**
* Handle a receiving message from a server.
* The receiving message count will be updated. If save message flag is up, the received message will be saved.
*
* @param topic Topic message received from
* @param mqttMessage The mqtt message received
* @throws Exception
*/
@Override
public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception {
if (null != mqttMessage) {
if (saveMessages) {
receivedMessages.add(mqttMessage);
lastTopicReceived = topic;
log.info("Message arrived on " + topic + " : " + mqttMessage.toString());
}
incrementReceivedMessageCount();
int receivedMessageCount = getReceivedMessageCount();
if (receivedMessageCount % MQTTConstants.MESSAGE_PRINT_LIMIT == 0) {
log.info(receivedMessageCount + " messages received.");
}
} else {
log.warn("Empty message received by the callback handler on topic " + topic);
}
}
/**
* Handle delivery complete ack.
*
* @param iMqttDeliveryToken Delivery complete token
*/
@Override
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
incrementSentMessageCount();
int sentMessageCount = getSentMessageCount();
if (sentMessageCount % MQTTConstants.MESSAGE_PRINT_LIMIT == 0) {
log.info(sentMessageCount + " messages received.");
}
}
/**
* Increment the receiving message count.
* Use this instead of just incrementing so if threads are involved this method can be used to handle concurrency
* issues.
*/
private void incrementReceivedMessageCount() {
receivedMessageCount++;
}
/**
* Increment the sent message count.
* Use this instead of just incrementing so if threads are involved this method can be used to handle concurrency
* issues.
*/
private void incrementSentMessageCount() {
sentMessageCount++;
}
/**
* Retrieve the received messages. This will return a non empty value only if saveMessages flag is set.
*
* @return Received messages
*/
public List<MqttMessage> getReceivedMessages() {
return receivedMessages;
}
/**
* Get the sent message count.
*
* @return Sent message count
*/
public int getSentMessageCount() {
return sentMessageCount;
}
public String getLastTopicReceived() {
return lastTopicReceived;
}
}

View File

@ -0,0 +1,156 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.clients.operations.utils;
import java.io.File;
/**
* This class contains the constants that are being used by the andes client.
*/
public class AndesClientConstants {
/**
* Andes initial context factory.
*/
public static final String ANDES_ICF =
"org.wso2.andes.jndi.PropertiesFileInitialContextFactory";
/**
* Connection factory name prefix.
*/
public static final String CF_NAME_PREFIX = "connectionfactory.";
/**
* Andes connection factory name
*/
public static final String CF_NAME = "andesConnectionfactory";
/**
* WSO2 carbon factory name.
*/
public static final String CARBON_VIRTUAL_HOST_NAME = "carbon";
/**
* Carbon client ID.
*/
public static final String CARBON_CLIENT_ID = "carbon";
/**
* Default file path to write received messages by subscriber/consumer
*/
public static final String FILE_PATH_TO_WRITE_RECEIVED_MESSAGES =
System.getProperty("project.build.directory") + File.separator + "receivedMessages.txt";
/**
* Default file path to write statistics by subscriber/consumer and publisher Suppressing
* "UnusedDeclaration" as this may be used in client configuration
*/
@SuppressWarnings("UnusedDeclaration")
public static final String FILE_PATH_TO_WRITE_STATISTICS =
System.getProperty("framework.resource.location") + File.separator + "stats.csv";
/**
* Message publishing format
*/
public static final String PUBLISH_MESSAGE_FORMAT = "Sending Message:{0} ThreadID:{1}";
// please see usages prior editing
/**
* Default waiting time that is used to check whether the consumer has received messages.
*/
public static final long DEFAULT_RUN_TIME = 10000L;
/**
* Default waiting time that is used to check whether the consumer has received messages.
*/
public static final long DEFAULT_CLUSTER_SYNC_TIME = 1000;
/**
* Admin user name for AMQP connection string
*/
public static final String DEFAULT_USERNAME = "admin";
/**
* Admin password for AMQP connection string
*/
public static final String DEFAULT_PASSWORD = "admin";
/**
* Default host name for AMQP connection string
*/
public static final String DEFAULT_HOST_NAME = "127.0.0.1";
/**
* Default port for AMQP connections string
*/
public static final int DEFAULT_PORT = 5672;
/**
* File path to read message content for publishing
*/
public static final String MESSAGE_CONTENT_INPUT_FILE_PATH_1MB =
System.getProperty("framework.resource.location") + File.separator +
"MessageContentInput.txt";
/**
* File path to read message content for publishing
*/
public static final String MAP_MESSAGE_CONTENT_INPUT_FILE_PATH =
System.getProperty("framework.resource.location") + File.separator +
"MapMessageContentInput.txt";
/**
* File path to read message content for publishing
*/
public static final String MESSAGE_CONTENT_INPUT_FILE_PATH_WITHOUT_REPETITIONS_256KB =
System.getProperty("framework.resource.location") + File.separator +
"MessageContentInputWithoutRepetitions.txt";
/**
* File path creating a file.
*/
public static final String FILE_PATH_FOR_CREATING_A_NEW_FILE =
System.getProperty("project.build.directory") + File.separator + "newFile.txt";
/**
* File path for a file of size 1 kb.
*/
public static final String FILE_PATH_FOR_ONE_KB_SAMPLE_FILE =
System.getProperty("framework.resource.location") + "sample" + File.separator +
"sample_1KB_msg.xml";
/**
* The JMS property which stores routing key.
*/
public static final String JMS_ANDES_ROUTING_KEY_MESSAGE_PROPERTY = "JMS_ANDES_ROUTING_KEY";
/**
* JMS Property allowing to append routing key for messages.
*/
public static final String ANDES_SET_ROUTING_KEY = "AndesSetRoutingKey";
/**
* System property name of andes acknowledgement wait timeout
*/
public static final String ANDES_ACK_WAIT_TIMEOUT_PROPERTY = "AndesAckWaitTimeOut";
/**
* System property name of andes redelivery delay
*/
public static final String ANDES_REDELIVERY_DELAY_PROPERTY = "AndesRedeliveryDelay";
}

View File

@ -0,0 +1,382 @@
/*
* Copyright (c) 2005-2014, 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.
*/
package org.wso2.mb.integration.common.clients.operations.utils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.LineIterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* This class is used to get Andes Client outputs from parse file. The class provides evaluation
* functions for testing purposes.
*/
public class AndesClientOutputParser {
/**
* The logger used in logging information, warnings, errors and etc.
*/
private static Log log = LogFactory.getLog(AndesClientOutputParser.class);
/**
* Map that stored received messages. Used to check message duplication.
*/
private Map<Long, Integer> mapOfReceivedMessages = new HashMap<Long, Integer>();
/**
* List of received messages.
*/
private List<Long> messages = new ArrayList<Long>();
/**
* File path to parse received messages
*/
private String filePath = "";
/**
* Creates an output parse for andes with a give file path.
*
* @param filePath The file path for received messages.
* @throws IOException
*/
public AndesClientOutputParser(String filePath) throws IOException {
this.filePath = filePath;
parseFile();
}
/**
* Reads received messages from a file path and store the message ID in necessary data
* structures.
*
* @throws IOException
*/
private void parseFile() throws IOException {
try {
BufferedReader br = new BufferedReader(new FileReader(filePath));
try {
String line = br.readLine();
while (line != null) {
String tempSendMessageString = line.substring(AndesClientConstants.PUBLISH_MESSAGE_FORMAT.indexOf("Sending Message:") + "Sending Message:".length());
long messageIdentifier = Long.valueOf(tempSendMessageString.substring(0, tempSendMessageString
.indexOf(" ")).replace(",",""));
this.addMessage(messageIdentifier);
line = br.readLine();
}
} finally {
br.close();
}
} catch (FileNotFoundException e) {
log.error("Error " + filePath + " the file containing received messages couldn't found", e);
throw e;
} catch (IOException e) {
log.error("Error " + filePath + " the file cannot be read", e);
throw e;
}
}
/**
* Gets the map used for message duplication.
*
* @return A map of duplicated message IDs as key.
*/
public Map<Long, Integer> getDuplicatedMessages() {
Map<Long, Integer> messagesDuplicated = new HashMap<Long, Integer>();
for (Long messageIdentifier : mapOfReceivedMessages.keySet()) {
if (mapOfReceivedMessages.get(messageIdentifier) > 1) {
messagesDuplicated.put(messageIdentifier, mapOfReceivedMessages.get(messageIdentifier));
}
}
return messagesDuplicated;
}
/**
* Checks if messages are received in the correct order.
*
* @return true if messages are in order, false otherwise.
*/
public boolean checkIfMessagesAreInOrder() {
boolean result = true;
for (int count = 0; count < messages.size(); count++) {
if (messages.get(count) != (count)) {
result = false;
log.warn("Message order is broken at message " + messages.get(count));
break;
}
}
return result;
}
/**
* Prints missing message IDs.
* Suppressing "UnusedDeclaration" as this could be used for debugging purposes
*
* @param numberOfSentMessages Number of messages to print.
*/
@SuppressWarnings("UnusedDeclaration")
public void printMissingMessages(int numberOfSentMessages) {
log.info("Printing Missing Messages");
for (long count = 0; count < numberOfSentMessages; count++) {
if (mapOfReceivedMessages.get(count) == null) {
log.info("Missing message id:" + count + 1 + "\n");
}
}
}
/**
* Prints duplicated message IDs
* Suppressing "UnusedDeclaration" as this could be used for debugging purposes
*/
@SuppressWarnings("UnusedDeclaration")
public void printDuplicateMessages() {
log.info("Printing Duplicated Messages");
log.info(this.getDuplicatedMessages());
}
/**
* Prints the map that contains received messages.
* Suppressing "UnusedDeclaration" as this could be used for debugging purposes
*/
@SuppressWarnings("UnusedDeclaration")
public void printMessagesMap() {
log.info("Printing Received Messages");
log.info(mapOfReceivedMessages);
}
/**
* Adds received message IDs to a list and a map.
*
* @param messageIdentifier Received message ID.
*/
private void addMessage(Long messageIdentifier) {
if (mapOfReceivedMessages.get(messageIdentifier) == null) {
mapOfReceivedMessages.put(messageIdentifier, 1);
} else {
int currentCount = mapOfReceivedMessages.get(messageIdentifier);
mapOfReceivedMessages.put(messageIdentifier, currentCount + 1);
}
messages.add(messageIdentifier);
}
/**
* Prints received message IDs in sorted.
* Suppressing "UnusedDeclaration" as this could be used for debugging purposes
*/
@SuppressWarnings("UnusedDeclaration")
public void printMessagesSorted() {
log.info("Printing Sorted Messages");
List<Long> cloneOfMessages = new ArrayList<Long>();
cloneOfMessages.addAll(messages);
Collections.sort(cloneOfMessages);
log.info(cloneOfMessages);
}
/**
* Check whether all the messages are transacted
*
* @param operationOccurredIndex Index of the operation occurred message
* @return transactedResult
*/
public boolean transactedOperations(long operationOccurredIndex) throws FileNotFoundException {
boolean result = false;
int count = 0;
long firstMessageIdentifier = 0;
try {
BufferedReader br = new BufferedReader(new FileReader(filePath));
//Needed try/finally to close the file
try {
String line = br.readLine();
while (line != null) {
String tempSendMessageString = line.substring(AndesClientConstants.PUBLISH_MESSAGE_FORMAT.indexOf("Sending Message:") + "Sending Message:".length());
long messageIdentifier = Long.parseLong(tempSendMessageString.substring(0, tempSendMessageString.indexOf(" ")));
if (count == 0) {
firstMessageIdentifier = messageIdentifier;
}
if (count == (operationOccurredIndex)) {
if (messageIdentifier == firstMessageIdentifier) {
result = true;
}
}
line = br.readLine();
count++;
}
} catch (IOException e) {
log.error("Error while parsing the file containing received messages", e);
} finally {
try {
br.close();
} catch (IOException e) {
log.error("Error while closing the file containing received messages", e);
}
}
} catch (FileNotFoundException e) {
log.error("Error " + filePath + " the file containing received messages couldn't found", e);
throw e;
}
AndesClientUtils.flushPrintWriters();
return result;
}
/**
* Check whether all the messages are received in-order when subscriber rollbacks
* after certain number of messages.
*
* @param messagesPerRollback Number of messages received per rollback
* @return Result as true if transacted rollback operation has successfully
* preserved order of all messages.
*/
public boolean checkIfTransactedRollbackPreservesOrder(long messagesPerRollback)
throws FileNotFoundException {
boolean result = true;
int count = 0;
Long messageIdentifier;
int rollbackBatchIteration = 1;
boolean isFirstMessageBatch = true;
LineIterator iterator = null;
Map<Integer, Long> firstMessageBatch = new HashMap<Integer, Long>();
try {
iterator = FileUtils.lineIterator(new File(filePath));
String line = iterator.nextLine();
while (iterator.hasNext()) {
messageIdentifier = getMessageIdentifier(line);
if (firstMessageBatch.containsValue(messageIdentifier)) {
isFirstMessageBatch = false;
if (count != messagesPerRollback * rollbackBatchIteration) {
log.error("failed to check if rollback messages are received in order" +
" to due to first duplicated message count " + count +
" not equal to messages per each rollback." +
messagesPerRollback + ".");
result = false;
}
rollbackBatchIteration++;
}
if (!isFirstMessageBatch) {
for (int i = 0; i < messagesPerRollback; i++) {
messageIdentifier = getMessageIdentifier(line);
if (null != firstMessageBatch.get(i)) {
if (!firstMessageBatch.get(i).equals(messageIdentifier)) {
result = false;
log.error("Error in line :" + line +
".Rollback operation failed to keep message order.");
}
}
if (iterator.hasNext()) {
line = iterator.nextLine();
count++;
}
}
} else if (isFirstMessageBatch) {
firstMessageBatch.put(count, messageIdentifier);
line = iterator.nextLine();
count++;
}
}
} catch (FileNotFoundException e) {
log.error("Error " + filePath + " the file containing received messages couldn't found", e);
throw e;
} catch (IOException e) {
log.error("Error while parsing the file containing received messages", e);
} finally {
iterator.close();
}
AndesClientUtils.flushPrintWriters();
return result;
}
/**
* This method will return message identifier number extracted from given string line.
* sample string line "Sending Message:36 ThreadID:7,335".
*
* @param line string parameter which contains given line of a text file.
* @return messageIdentifier which can identify messages uniquely.
*/
private Long getMessageIdentifier(String line) {
String tempSendMessageString = line.substring(AndesClientConstants.
PUBLISH_MESSAGE_FORMAT.indexOf("Sending Message:") + "Sending Message:".length());
Long messageIdentifier = Long.parseLong(tempSendMessageString.
substring(0, tempSendMessageString.indexOf(" ")));
return messageIdentifier;
}
/**
* Parse the file and get the number of duplicate message IDs.
*
* @return Duplicated message ID count.
*/
public long numberDuplicatedMessages() {
long duplicateCount = 0;
List<Long> messagesDuplicated = new ArrayList<Long>();
try {
BufferedReader br = new BufferedReader(new FileReader(filePath));
//Needed try/finally to close the file
try {
String line = br.readLine();
while (line != null) {
String tempSendMessageString = line.substring(AndesClientConstants.PUBLISH_MESSAGE_FORMAT.indexOf("Sending Message:") + "Sending Message:".length());
long messageIdentifier = Long.parseLong(tempSendMessageString.substring(0, tempSendMessageString.indexOf(" ")));
if (messagesDuplicated.contains(messageIdentifier)) {
duplicateCount++;
} else {
messagesDuplicated.add(messageIdentifier);
}
line = br.readLine();
}
} catch (IOException e) {
log.error("Error while parsing the file containing received messages", e);
} finally {
try {
br.close();
} catch (IOException e) {
log.error("Error while closing the file containing received messages", e);
}
}
} catch (FileNotFoundException e) {
log.error("Error " + filePath + " the file containing received messages couldn't found", e);
}
return duplicateCount;
}
}

View File

@ -0,0 +1,363 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.clients.operations.utils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.wso2.mb.integration.common.clients.AndesClient;
import javax.jms.JMSException;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.concurrent.TimeUnit;
/**
* This class provides functionality to evaluate Andes Client consumers and publishers.
*/
public class AndesClientUtils {
/**
* The logger used in logging information, warnings, errors and etc.
*/
private static Logger log = Logger.getLogger(AndesClientUtils.class);
/**
* The print writer to print received messages to a file.
*/
private static PrintWriter receivedMessagePrintWriter;
/**
* The print writer to print statistics such as TPS for consumers and producers and also the
* average latency to a file.
*/
private static PrintWriter statisticsPrintWriter;
/**
* The print writer to print messages that are being sent by the publisher.
*/
private static PrintWriter publishedMessagePrintWriter;
/**
* Waits until no messages are received. The waiting is done by using a loop checking whether
* any new messages are received than the previous iteration. In each iteration it will wait for
* a certain time to make sure that message counter changes until no change is detected in the
* message counters.
*
* @param client The consumer client
* @param waitTimeTillMessageCounterChanges The amount of milliseconds to wait for new messages
* are received.
* @param expectedMessageCount Number of messages expected from the consumer
* @throws JMSException
*/
public static void waitForMessagesAndShutdown(AndesClient client,
long waitTimeTillMessageCounterChanges, long expectedMessageCount)
throws JMSException {
long previousMessageCount = 0;
long currentMessageCount = -1;
/**
* At each iteration it will check whether the message count has changed than the previous
* iteration
*/
while (currentMessageCount != previousMessageCount) {
try {
// Waits till the consumer client received more messages.
TimeUnit.MILLISECONDS.sleep(waitTimeTillMessageCounterChanges);
} catch (InterruptedException e) {
log.error("Error waiting for receiving messages.", e);
}
// Updating message counters
previousMessageCount = currentMessageCount;
currentMessageCount = client.getReceivedMessageCount();
}
log.info("Message count received by consumer : " + Long
.toString(client.getReceivedMessageCount()));
if (expectedMessageCount != currentMessageCount) {
// Stopping the consumer client
client.stopClient();
}
// Prints print writer contents to files.
flushPrintWriters();
}
/**
* Waits until no messages are received. The waiting is done by using a loop checking whether
* any new messages are received than the previous iteration. In each iteration it will wait for
* a certain time to make sure that message counter changes until no change is detected in the
* message counters.
*
* @param client The consumer client
* @param waitTimeTillMessageCounterChanges The amount of milliseconds to wait for new messages
* are received.
* @throws JMSException
*/
public static void waitForMessagesAndShutdown(AndesClient client,
long waitTimeTillMessageCounterChanges)
throws JMSException {
long previousMessageCount = 0;
long currentMessageCount = -1;
/**
* At each iteration it will check whether the message count has changed than the previous
* iteration
*/
while (currentMessageCount != previousMessageCount) {
try {
// Waits till the consumer client received more messages.
TimeUnit.MILLISECONDS.sleep(waitTimeTillMessageCounterChanges);
} catch (InterruptedException e) {
log.error("Error waiting for receiving messages.", e);
}
// Updating message counters
previousMessageCount = currentMessageCount;
currentMessageCount = client.getReceivedMessageCount();
}
log.info("Message count received by consumer : " + Long
.toString(client.getReceivedMessageCount()));
// Stopping the consumer client
client.stopClient();
// Prints print writer contents to files.
flushPrintWriters();
}
/**
* Shutdown the client gracefully without waiting.
*
* @param client The client to shutdown
* @throws JMSException
*/
public static void shutdownClient(AndesClient client) throws JMSException {
client.stopClient();
flushPrintWriters();
}
/**
* Sleeps for a certain time.
*
* @param milliseconds Sleep time in milliseconds.
*/
public static void sleepForInterval(long milliseconds) {
if (0 < milliseconds) {
try {
Thread.sleep(milliseconds);
} catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
}
}
/**
* Writes received messages to a file.
*
* @param content Message content to write.
* @param filePath File path where the message content should be written.
*/
public static void writeReceivedMessagesToFile(String content, String filePath)
throws IOException {
if (receivedMessagePrintWriter == null) {
initializeReceivedMessagesPrintWriter(filePath);
}
receivedMessagePrintWriter.println(content);
}
/**
* Writes statistics to a file.
*
* @param content Statistic content.
* @param filePath File path where the statistics should be written.
*/
public static void writeStatisticsToFile(String content, String filePath) throws IOException {
if (statisticsPrintWriter == null) {
initializeStatisticsPrintWriter(filePath);
}
statisticsPrintWriter.println(content);
}
/**
* Writes published messages to a file.
*
* @param content Statistic content.
* @param filePath File path where the statistics should be written.
*/
public static void writePublishedMessagesToFile(String content, String filePath) throws IOException {
if (publishedMessagePrintWriter == null) {
initializePublishedPrintWriter(filePath);
}
publishedMessagePrintWriter.println(content);
}
/**
* Initialize the message content print writer. This needs to be invoked before each test case.
*
* @param filePath The file path to write to.
*/
public static void initializeReceivedMessagesPrintWriter(String filePath) throws IOException {
if (StringUtils.isNotEmpty(filePath)) {
File writerFile = new File(filePath);
if (writerFile.exists() || writerFile.createNewFile()) {
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(filePath));
receivedMessagePrintWriter = new PrintWriter(bufferedWriter);
}
}
}
/**
* Initialize the statistics print writer. This needs to be invoked before each test case.
*
* @param filePath The file path to write to.
*/
public static void initializeStatisticsPrintWriter(String filePath) throws IOException {
if (StringUtils.isNotEmpty(filePath)) {
File writerFile = new File(filePath);
if (writerFile.exists() || writerFile.createNewFile()) {
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(filePath));
statisticsPrintWriter = new PrintWriter(bufferedWriter);
statisticsPrintWriter
.println("TIMESTAMP,CONSUMER_TPS,AVERAGE_LATENCY,,TIMESTAMP,PUBLISHER_TPS");
}
}
}
/**
* Initialize the published messages print writer. This needs to be invoked before each test
* case.
*
* @param filePath The file path to write to.
*/
public static void initializePublishedPrintWriter(String filePath) throws IOException {
if (StringUtils.isNotEmpty(filePath)) {
File writerFile = new File(filePath);
if (writerFile.exists() || writerFile.createNewFile()) {
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(filePath));
publishedMessagePrintWriter = new PrintWriter(bufferedWriter);
}
}
}
/**
* Prints print writers to file paths.
*/
public static void flushPrintWriters() {
if (null != receivedMessagePrintWriter) {
receivedMessagePrintWriter.flush();
}
if (null != statisticsPrintWriter) {
statisticsPrintWriter.flush();
}
if (null != publishedMessagePrintWriter) {
publishedMessagePrintWriter.flush();
}
}
/**
* Creates a file using a given file and a size.
*
* @param filePathToRead The file path to read contents from.
* @param filePathToCreate The path in which the contents should be written with a given size.
* @param sizeInKB The size of the file to be written in kilobytes.
*/
public static void createMockFile(String filePathToRead, String filePathToCreate,
int sizeInKB) {
String fileContentToBeWritten = "";
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(filePathToRead));
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
sb.append(line);
sb.append('\n');
line = br.readLine();
}
fileContentToBeWritten = sb.toString();
} catch (FileNotFoundException e) {
log.error("File to read sample string to create text file to send is not found", e);
} catch (IOException e) {
log.error("Error in reading sample file to create text file to send", e);
} finally {
try {
if (br != null) {
br.close();
}
} catch (IOException e) {
log.error("Error while closing buffered reader", e);
}
}
//If already exists, deleting the file
if (deleteRandomFile(filePathToCreate)) {
log.info("File requested to create already exists. Deleted file: " + filePathToCreate);
}
try {
File fileToCreate = new File(filePathToCreate);
boolean createFileSuccess = fileToCreate.createNewFile();
if (createFileSuccess) {
log.info("Successfully created a file to append content for sending at " + filePathToCreate);
}
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(filePathToCreate));
PrintWriter printWriter = new PrintWriter(bufferedWriter);
for (int count = 0; count < sizeInKB; count++) {
printWriter.append(fileContentToBeWritten);
}
printWriter.flush();
printWriter.close();
} catch (IOException e) {
log.error("Error. File to print received messages is not provided", e);
}
}
/**
* Deletes a random file.
*
* @param filePathToDelete The path in which the contents should be written with a given size.
*/
public static boolean deleteRandomFile(String filePathToDelete) {
File fileToDelete = new File(filePathToDelete);
boolean deleted = false;
if (fileToDelete.exists()) {
if (fileToDelete.delete()) {
deleted = true;
}
}
return deleted;
}
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.clients.operations.utils;
/**
* Enumeration for JMS exchange types.
*/
public enum ExchangeType {
/**
* Exchange types
*/
QUEUE("queue"), TOPIC("topic");
private String type;
/**
* Initializes enums
* @param type The exchange type as string.
*/
ExchangeType(String type) {
this.type = type;
}
/**
* Gets exchange string.
* @return The exchange string.
*/
public String getType() {
return type;
}
}

View File

@ -0,0 +1,66 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.clients.operations.utils;
/**
* Enumeration for acknowledge modes in JMS
*/
public enum JMSAcknowledgeMode {
/**
* @see <a href="http://docs.oracle.com/javaee/7/api/javax/jms/Session.html#SESSION_TRANSACTED">SESSION_TRANSACTED</a>
*/
SESSION_TRANSACTED(0),
/**
* @see <a href="http://docs.oracle.com/javaee/7/api/javax/jms/Session.html#AUTO_ACKNOWLEDGE">AUTO_ACKNOWLEDGE</a>
*/
AUTO_ACKNOWLEDGE(1),
/**
* @see <a href="http://docs.oracle.com/javaee/7/api/javax/jms/Session.html#CLIENT_ACKNOWLEDGE">CLIENT_ACKNOWLEDGE</a>
*/
CLIENT_ACKNOWLEDGE(2),
/**
* @see <a href="http://docs.oracle.com/javaee/7/api/javax/jms/Session.html#DUPS_OK_ACKNOWLEDGE">DUPS_OK_ACKNOWLEDGE</a>
*/
DUPS_OK_ACKNOWLEDGE(3),
/**
* Per message acknowledgement.
*/
PER_MESSAGE_ACKNOWLEDGE(259);
private int type;
/**
* Initializes acknowledge mode
* @param type Acknowledge mode as per JMS
*/
JMSAcknowledgeMode(int type) {
this.type = type;
}
/**
* Gets acknowledge mode
* @return The Acknowledge mode value
*/
public int getType() {
return type;
}
}

View File

@ -0,0 +1,124 @@
/*
* Copyright (c) 2005-2015, 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.
*/
package org.wso2.mb.integration.common.clients.operations.utils;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Properties;
public class JMSClientHelper {
/**
* Full qualified class name of the andes initial context factory
*/
public static final String ANDES_INITIAL_CONTEXT_FACTORY = "org.wso2.andes.jndi" +
".PropertiesFileInitialContextFactory";
/**
* Queue connection factory name used
*/
public static final String QUEUE_CONNECTION_FACTORY = "andesQueueConnectionfactory";
/**
* Topic connection factory name used
*/
public static final String TOPIC_CONNECTION_FACTORY = "andesTopicConnectionfactory";
/**
* Create a inital context with the given parameters
*
* @param username
* Username
* @param password
* Password
* @param brokerHost
* Hostname or IP address of the broker
* @param port
* Port used for AMQP transport
* @param queueName
* Queue name
* @return InitialContext
* @throws NamingException
*/
public static InitialContext getInitialContextForQueue(String username,
String password,
String brokerHost,
String port,
String queueName) throws NamingException {
Properties contextProperties = new Properties();
contextProperties.put(Context.INITIAL_CONTEXT_FACTORY, ANDES_INITIAL_CONTEXT_FACTORY);
String connectionString = getBrokerConnectionString(username, password, brokerHost, port);
contextProperties.put("connectionfactory." + QUEUE_CONNECTION_FACTORY, connectionString);
contextProperties.put("queue." + queueName, queueName);
return new InitialContext(contextProperties);
}
/**
* Create a inital context with the given parameters
*
* @param username
* Username
* @param password
* Password
* @param brokerHost
* Hostname or IP address of the broker
* @param port
* Port used for AMQP transport
* @param topicName
* Topic name
* @return InitialContext
* @throws NamingException
*/
public static InitialContext getInitialContextForTopic(String username,
String password,
String brokerHost,
String port,
String topicName) throws NamingException {
Properties contextProperties = new Properties();
contextProperties.put(Context.INITIAL_CONTEXT_FACTORY, ANDES_INITIAL_CONTEXT_FACTORY);
String connectionString = getBrokerConnectionString(username, password, brokerHost, port);
contextProperties.put("connectionfactory." + TOPIC_CONNECTION_FACTORY, connectionString);
contextProperties.put("topic." + topicName, topicName);
return new InitialContext(contextProperties);
}
/**
* Generate broker connection string
*
* @param userName
* Username
* @param password
* Password
* @param brokerHost
* Hostname of broker (E.g. localhost)
* @param port
* Port (E.g. 5672)
* @return Broker Connection String
*/
private static String getBrokerConnectionString(String userName, String password,
String brokerHost, String port) {
return "amqp://" + userName + ":" + password + "@clientID/carbon?brokerlist='tcp://"
+ brokerHost + ":" + port + "'";
}
}

View File

@ -0,0 +1,28 @@
package org.wso2.mb.integration.common.clients.operations.utils;
/**
*
*/
public enum JMSDeliveryStatus {
/**
* JMS delivery statuses.
*/
ORIGINAL("Original"), REDELIVERED("Redelivered");
private String status;
/**
* Initializes JMS delivery status
* @param status Delivery status.
*/
JMSDeliveryStatus(String status) {
this.status = status;
}
/**
* Gets JMS delivery status.
* @return Delivery status.
*/
public String getStatus() {
return status;
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.clients.operations.utils;
/**
* Enumeration for JMS message types.
*/
public enum JMSMessageType {
/**
* JMS message types.
*/
TEXT("text"), BYTE("byte"), MAP("map"), OBJECT("object"), STREAM("stream");
private String type;
/**
* Initializes JMS message type.
*
* @param type Message type.
*/
JMSMessageType(String type) {
this.type = type;
}
/**
* Gets JMS message type.
*
* @return The message type.
*/
public String getType() {
return type;
}
}

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.wso2.iot</groupId>
<artifactId>wso2iot-broker-integration-tests</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<name>WSO2 MB - Integration Test Common Utils Module</name>
<artifactId>org.wso2.iot.broker.integration.common.utils</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.wso2.carbon.automation</groupId>
<artifactId>org.wso2.carbon.automation.engine</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.wso2.iot</groupId>
<artifactId>org.wso2.iot.broker.integration.common.clients</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.automationutils</groupId>
<artifactId>org.wso2.carbon.integration.common.utils</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.authenticator.stub</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.automation</groupId>
<artifactId>org.wso2.carbon.automation.extensions</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-jxpath</groupId>
<artifactId>commons-jxpath</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.wso2.andes.wso2</groupId>
<artifactId>andes</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,104 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.utils.backend;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.XMLConfiguration;
import org.apache.commons.configuration.tree.xpath.XPathExpressionEngine;
import org.wso2.andes.configuration.enums.AndesConfiguration;
import org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException;
import org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager;
import java.io.File;
import java.io.IOException;
/**
* This class allows a test case to edit the main server configuration (currently broker.xml) and apply it to the
* server before execution.
*/
public class ConfigurationEditor {
/**
* File name prefix used for the updated configuration file.
*/
public static final String UPDATED_CONFIG_FILE_PREFIX = "updated_";
/**
* Configuration property holder
*/
public XMLConfiguration configuration;
/**
* File path of the original configuration file.
*/
public String originalConfigFilePath;
/**
* File path of the updated configuration file.
*/
public String updatedConfigFilePath;
public ConfigurationEditor(String originalConfigFilePath) throws ConfigurationException {
this.originalConfigFilePath = originalConfigFilePath;
configuration = new XMLConfiguration(this.originalConfigFilePath);
// Support XPath queries.
configuration.setExpressionEngine(new XPathExpressionEngine());
configuration.setDelimiterParsingDisabled(true); // If we don't do this,
// we can't add a new configuration to the compositeConfiguration by code.
}
/**
* Update a property in loaded original configuration
* @param property AndesConfiguration property.
* @param value New value to be set
* @return the set value
*/
public String updateProperty(AndesConfiguration property, String value) {
configuration.setProperty(property.get().getKeyInFile(),value);
return value;
}
/**
* Apply modified configuration and restart server
*
* @param serverConfigurationManager Server configuration manager object from automation engine.
* @return true if the update was successful.
* @throws IOException
* @throws AutomationUtilException
* @throws ConfigurationException
*/
public boolean applyUpdatedConfigurationAndRestartServer(ServerConfigurationManager serverConfigurationManager)
throws IOException, AutomationUtilException, ConfigurationException {
//Rename original configuration file to original_broker.xml
String originalConfigFileDirectory = originalConfigFilePath.substring(0,originalConfigFilePath.lastIndexOf(File.separator));
String originalConfigFileName = originalConfigFilePath.substring(originalConfigFilePath.lastIndexOf(File.separator));
updatedConfigFilePath = originalConfigFileDirectory + UPDATED_CONFIG_FILE_PREFIX + originalConfigFileName;
configuration.save(updatedConfigFilePath);
serverConfigurationManager.applyConfiguration(new File(updatedConfigFilePath), new File(originalConfigFilePath), true, true);
return true;
}
}

View File

@ -0,0 +1,146 @@
/*
* Copyright (c) 2005-2014, 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.
*/
package org.wso2.mb.integration.common.utils.backend;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.authenticator.stub.LoginAuthenticationExceptionException;
import org.wso2.carbon.automation.engine.context.AutomationContext;
import org.wso2.carbon.automation.engine.context.TestUserMode;
import org.wso2.carbon.automation.engine.frameworkutils.FrameworkPathUtil;
import org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager;
import org.xml.sax.SAXException;
import javax.xml.stream.XMLStreamException;
import javax.xml.xpath.XPathException;
import javax.xml.xpath.XPathExpressionException;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
/**
* Base class of all MB integration tests
*/
public class MBIntegrationBaseTest {
protected Log log = LogFactory.getLog(MBIntegrationBaseTest.class);
protected AutomationContext automationContext;
protected String backendURL;
protected ServerConfigurationManager serverManager = null;
/**
* Initialize the base test by initializing the automation context.
*
* @param userMode The testing user mode
* @throws XPathExpressionException
*/
protected void init(TestUserMode userMode) throws XPathExpressionException {
// org.apache.xerces.dom.ParentNode.nodeListItem which is used in AutomationContext
// does not guarantee thread safety.
// Hence to allow tests to run in parallel, this initialization should be synchronized
synchronized (this.getClass()) {
automationContext = new AutomationContext("MB", userMode);
backendURL = automationContext.getContextUrls().getBackEndUrl();
}
}
/**
* Restart the testing MB server in In-Memory H2 database mode by applying In-Memory database configurations
* in andes-virtualhosts-H2-mem.xml file.
*
* @throws Exception
*/
protected void restartServerWithH2MemMode() throws Exception {
serverManager = new ServerConfigurationManager(automationContext);
// Replace the broker.xml with the new configuration and restarts the server.
serverManager.applyConfiguration(new File(FrameworkPathUtil.getSystemResourceLocation() + File.separator +
"artifacts" + File.separator + "mb" + File.separator + "config" + File.separator +
"broker.xml"),
new File(ServerConfigurationManager.getCarbonHome() +
File.separator + "repository" + File.separator + "conf" + File.separator + "broker.xml"),
true, true);
}
/**
* Gracefully restart the current server which was deployed by the test suit. This can be used when a large
* amount or large size of messages are tested to clean up the server before or after the test.
*
* @throws Exception
*/
protected void restartServer()
throws Exception {
serverManager = new ServerConfigurationManager(automationContext);
serverManager.restartGracefully();
}
/**
* Returns wso2 https server port based on automation.xml configurations
* @throws Exception
*/
protected Integer getHttpsServerPort() throws XPathExpressionException {
return Integer.parseInt(automationContext.getInstance().getPorts().get("https"));
}
/**
* Returns AMQP port based on automation.xml configurations
* @throws Exception
*/
protected Integer getAMQPPort() throws XPathExpressionException {
return Integer.parseInt(automationContext.getInstance().getPorts().get("amqp"));
}
/**
* Returns AMQP port based on automation.xml configurations
* @throws Exception
*/
protected Integer getSecureAMQPPort() throws XPathExpressionException {
return Integer.parseInt(automationContext.getInstance().getPorts().get("sslamqp"));
}
/**
* Returns MQTT port based on automation.xml configurations
* @throws Exception
*/
protected Integer getMQTTPort() throws XPathExpressionException {
return Integer.parseInt(automationContext.getInstance().getPorts().get("mqtt"));
}
/**
* Returns JMX RMI Server port based on automation.xml configurations
* @throws Exception
*/
protected Integer getJMXServerPort() throws XPathExpressionException {
return Integer.parseInt(automationContext.getInstance().getPorts().get("jmxserver"));
}
/**
* Returns JMX RMI Registry port based on automation.xml configurations
* @throws Exception
*/
protected Integer getRMIRegistryPort() throws XPathExpressionException {
return Integer.parseInt(automationContext.getInstance().getPorts().get("rmiregistry"));
}
}

View File

@ -0,0 +1,206 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.utils.backend;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.wso2.carbon.automation.engine.context.AutomationContext;
import org.wso2.carbon.automation.engine.context.TestUserMode;
import org.wso2.carbon.automation.engine.frameworkutils.FrameworkPathUtil;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
import org.wso2.carbon.integration.common.utils.LoginLogoutClient;
import org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException;
import org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager;
import org.wso2.mb.integration.common.utils.ui.UIElementMapper;
import org.wso2.mb.integration.common.utils.ui.pages.login.LoginPage;
import javax.xml.xpath.XPathExpressionException;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
/**
* The following class is the base class for all the UI test cases for MB.
*/
public class MBIntegrationUiBaseTest {
private static final Log log = LogFactory.getLog(MBIntegrationUiBaseTest.class);
protected AutomationContext mbServer;
protected String sessionCookie;
protected String backendURL;
protected ServerConfigurationManager serverManager;
protected LoginLogoutClient loginLogoutClient;
protected WebDriver driver;
/** custom admin role name set with restartServerWithDifferentAdminRoleName() method */
protected static final String CUSTOM_ADMIN_ROLE_NAME = "administrator";
/**
* Initializes the automation context, login client, session cookie and the backend url by {@link org.wso2.carbon
* .automation.engine.context.TestUserMode#SUPER_TENANT_ADMIN}.
*
* @throws AutomationUtilException
* @throws MalformedURLException
* @throws XPathExpressionException
*/
protected void init() throws AutomationUtilException, IOException, XPathExpressionException {
mbServer = new AutomationContext("MB", TestUserMode.SUPER_TENANT_ADMIN);
loginLogoutClient = new LoginLogoutClient(mbServer);
sessionCookie = loginLogoutClient.login();
backendURL = mbServer.getContextUrls().getBackEndUrl();
this.driver = BrowserManager.getWebDriver();
}
/**
* Initializes the automation context, login client, session cookie and the backend url by a {@link org.wso2
* .carbon.automation.engine.context.TestUserMode}.
*
* @param testUserMode The testing user mode.
* @throws XPathExpressionException
* @throws AutomationUtilException
* @throws MalformedURLException
*/
protected void init(TestUserMode testUserMode) throws XPathExpressionException, AutomationUtilException,
MalformedURLException {
mbServer = new AutomationContext("MB", testUserMode);
loginLogoutClient = new LoginLogoutClient(mbServer);
sessionCookie = loginLogoutClient.login();
backendURL = mbServer.getContextUrls().getBackEndUrl();
this.driver = BrowserManager.getWebDriver();
}
/**
* Get current test user's Username according to the automation context
*
* @throws XPathExpressionException
*/
protected String getCurrentUserName() throws XPathExpressionException {
return mbServer.getContextTenant().getContextUser().getUserName();
}
/**
* Get current test user's password according to the automation context
*
* @throws XPathExpressionException
*/
protected String getCurrentPassword() throws XPathExpressionException {
return mbServer.getContextTenant().getContextUser().getPassword();
}
/**
* Return the admin user name of current context tenant
* @return admin name as a String
* @throws XPathExpressionException
*/
protected String getAdminUserName() throws XPathExpressionException {
return mbServer.getContextTenant().getTenantAdmin().getUserName();
}
/**
* Get the password of admin user of current context tenant
* @return password as a String
* @throws XPathExpressionException
*/
protected String getAdminPassword() throws XPathExpressionException {
return mbServer.getContextTenant().getTenantAdmin().getPassword();
}
/**
* Restart the testing MB server with WSO2 domain name set under user management
*
* @throws AutomationUtilException
* @throws XPathExpressionException
* @throws IOException
*/
protected void restartServerWithDomainName() throws AutomationUtilException, XPathExpressionException,
IOException {
serverManager = new ServerConfigurationManager(mbServer);
// Replace the user-mgt.xml with the new configuration and restarts the server.
serverManager.applyConfiguration(new File(FrameworkPathUtil.getSystemResourceLocation() + File.separator +
"artifacts" + File.separator + "mb" + File.separator + "config" + File.separator
+ "user-mgt.xml"), new File(ServerConfigurationManager.getCarbonHome() +
File.separator + "repository" + File.separator + "conf" + File.separator +
"user-mgt.xml"), true, true);
}
/**
* Restart the server with admin role name set to "administrator" instead of default value admin.
*
* @throws IOException
* @throws AutomationUtilException
* @throws XPathExpressionException
*/
protected void restartServerWithDifferentAdminRoleName() throws IOException, AutomationUtilException,
XPathExpressionException {
serverManager = new ServerConfigurationManager(mbServer);
// Replace the user-mgt.xml with the new configuration and restarts the server.
serverManager.applyConfiguration(new File(FrameworkPathUtil.getSystemResourceLocation() + File.separator +
"artifacts" + File.separator + "mb" + File.separator + "config" + File.separator
+ "user-mgt-admin-role-name.xml"), new File(ServerConfigurationManager.getCarbonHome() +
File.separator + "repository" + File.separator + "conf" + File.separator +
"user-mgt.xml"), true, true);
}
/**
* Restart the server with previous configuration.
*
* @throws IOException
* @throws AutomationUtilException
*/
protected void restartInPreviousConfiguration() throws IOException, AutomationUtilException {
serverManager.restoreToLastConfiguration(true);
}
/**
* Gets the default login url for management console.
* @return The URL.
*/
protected String getLoginURL() throws XPathExpressionException {
return mbServer.getContextUrls().getWebAppURLHttps() + "/carbon/admin/login.jsp";
}
/**
* Logs out from MB management console
*
* @return The login page.
* @throws IOException
*/
protected LoginPage logout() throws IOException {
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("home.mb.sign.out.xpath"))).click();
return new LoginPage(driver);
}
/**
* Returns MQTT port based on automation.xml configurations
* @throws XPathExpressionException
*/
protected Integer getMQTTPort() throws XPathExpressionException {
return Integer.parseInt(mbServer.getInstance().getPorts().get("mqtt"));
}
/**
* Returns MQTT port based on automation.xml configurations
* @throws XPathExpressionException
*/
protected Integer getAMQPPort() throws XPathExpressionException {
return Integer.parseInt(mbServer.getInstance().getPorts().get("amqp"));
}
}

View File

@ -0,0 +1,61 @@
/*
* Copyright (c) 2005-2014, 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.
*/
package org.wso2.mb.integration.common.utils.ui;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
* Read mapper.properties file and load it's uiElements into Properties object.
*/
public class UIElementMapper {
public static final Properties uiProperties = new Properties();
private static UIElementMapper instance;
static {
try {
setStream();
instance = new UIElementMapper();
} catch (IOException ioe){
throw new ExceptionInInitializerError("mapper stream not set. Failed to read file");
}
}
private UIElementMapper() {
}
public static UIElementMapper getInstance() {
return instance;
}
private static Properties setStream() throws IOException {
InputStream inputStream = UIElementMapper.class.getResourceAsStream("/mapper.properties");
if (inputStream.available() > 0) {
uiProperties.load(inputStream);
inputStream.close();
return uiProperties;
}
return null;
}
public String getElement(String key) {
return uiProperties.getProperty(key);
}
}

View File

@ -0,0 +1,83 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.utils.ui.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.wso2.mb.integration.common.utils.ui.UIElementMapper;
import org.wso2.mb.integration.common.utils.ui.pages.configure.ConfigurePage;
import org.wso2.mb.integration.common.utils.ui.pages.login.LoginPage;
import org.wso2.mb.integration.common.utils.ui.pages.monitor.MonitorPage;
import java.io.IOException;
/**
* The base class for all the pages. Navigation functions that can be done from any page should
* be implemented within this class (to avoid duplication of common functionality throughout
* pages).
*/
public abstract class MBPage {
/**
* Web driver used by selenium framework to do UI operations pragmatically
*/
protected WebDriver driver;
/**
* Constructor. Takes the reference of web driver instance.
*
* @param driver The selenium Web Driver
*/
protected MBPage(WebDriver driver) {
this.driver = driver;
}
/**
* Selects a Configuration tab and returns the configuration tab related page
*
* @return ConfigurePage The configuration page.
* @throws IOException
*/
public ConfigurePage getConfigurePage() throws IOException {
driver.findElement(By.id(UIElementMapper.getInstance().getElement("configure.tab.id"))).click();
return new ConfigurePage(driver);
}
/**
* Selects the Monitor tab and returns the monitor tab related page
*
* @return MonitorPage The monitoring page.
* @throws IOException
*/
public MonitorPage getMonitorPage() throws IOException {
driver.findElement(By.id(UIElementMapper.getInstance().getElement("mb.tab.button.monitor.id"))).click();
return new MonitorPage(driver);
}
/**
* Log out from current account and returns the LoginPage
*
* @return LoginPage The login page.
* @throws IOException
*/
public LoginPage logout() throws IOException {
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("home.mb.sign.out.xpath"))).click();
return new LoginPage(driver);
}
}

View File

@ -0,0 +1,96 @@
/*
* Copyright (c) 2005-2014, 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.
*/
package org.wso2.mb.integration.common.utils.ui.pages.configure;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.wso2.mb.integration.common.utils.ui.UIElementMapper;
import java.util.List;
/**
* Abstraction of the Add new tenant page of the UI.
*/
public class AddNewTenantPage {
private static final Log log = LogFactory.getLog(AddNewTenantPage.class);
private WebDriver driver;
public AddNewTenantPage(WebDriver driver) {
this.driver = driver;
// Check that we're on the right page.
if (!driver.findElement(By.id(UIElementMapper.getInstance()
.getElement("home.dashboard.middle.text"))).getText().contains("Register A New Organization")) {
throw new IllegalStateException("Not in add new tenant page.");
}
}
/**
* Add a new tenant
* @param domain domain of the tenant
* @param firstName tenant first name
* @param lastName tenant last name
* @param adminUserName admin users' user name
* @param adminPassword admin users' password
* @param adminPasswordRepeat admin users' password (if repeat password doesn't match operation
* must be unsuccessful)
* @param adminEmail admin users' email
* @return true if tenant successfully created. false otherwise
*/
public boolean add(final String domain, final String firstName, final String lastName,
final String adminUserName, final String adminPassword, final String adminPasswordRepeat, final String adminEmail) {
boolean isSuccessful = false;
// fill the form
driver.findElement(By.id(UIElementMapper.getInstance().getElement("add.tenant.domain.field.id"))).sendKeys(domain);
//todo implement usage plan select
// driver.findElement(By.id(UIElementMapper.getInstance().getElement("add.tenant.usage.plan.field.id"))).(usagePlanName);
driver.findElement(By.id(UIElementMapper.getInstance().getElement("add.tenant.first.name.field.id"))).sendKeys(firstName);
driver.findElement(By.id(UIElementMapper.getInstance().getElement("add.tenant.last.name.field.id"))).sendKeys(lastName);
driver.findElement(By.id(UIElementMapper.getInstance().getElement("add.tenant.admin.user.name.field.id"))).sendKeys(adminUserName);
driver.findElement(By.id(UIElementMapper.getInstance().getElement("add.tenant.admin.password.field.id"))).sendKeys(adminPassword);
driver.findElement(By.id(UIElementMapper.getInstance().getElement("add.tenant.admin.password.repeat.field.id"))).sendKeys(adminPasswordRepeat);
driver.findElement(By.id(UIElementMapper.getInstance().getElement("add.tenant.admin.email.field.id"))).sendKeys(adminEmail);
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("add.tenant.save.button.xpath"))).click();
// handle confirmation popup
String dialog = driver.getWindowHandle();
driver.switchTo().window(dialog);
if (driver.findElement(By.id(UIElementMapper.getInstance().getElement("mb.popup.dialog.id"))).getText().contains("successful")) {
isSuccessful = true; // got success confirmation box
}
// find ok button in popup dialog and click it
List<WebElement> buttonList = driver.findElements(By.tagName("button"));
for (WebElement okButton : buttonList) {
if (okButton.getText().compareToIgnoreCase("ok") == 0) {
okButton.click();
break;
}
}
return isSuccessful;
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2005-2014, 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.
*/
package org.wso2.mb.integration.common.utils.ui.pages.configure;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.wso2.mb.integration.common.utils.ui.UIElementMapper;
public class AddRoleStep1Page {
private static final Log log = LogFactory.getLog(AddRoleStep1Page.class);
private WebDriver driver;
public AddRoleStep1Page(WebDriver driver){
this.driver = driver;
if (!driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("usr.mgt.add.role.step1.sub.header.xpath")))
.getText().contains("Step 1 : Enter role details")) {
throw new IllegalStateException("This is not the Add Role step1 page");
}
}
public void setDetails(final String roleName) {
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("usr.mgt.add.role.step1.name.field.xpath"))).sendKeys(roleName);
}
public AddRoleStep2Page next() {
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("usr.mgt.add.role.step1.next.button.xpath"))).click();
return new AddRoleStep2Page(driver);
}
}

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2005-2014, 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.
*/
package org.wso2.mb.integration.common.utils.ui.pages.configure;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.wso2.mb.integration.common.utils.ui.UIElementMapper;
import java.util.List;
public class AddRoleStep2Page {
private static final Log log = LogFactory.getLog(AddRoleStep2Page.class);
private WebDriver driver;
public AddRoleStep2Page(WebDriver driver){
this.driver = driver;
if (!driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("usr.mgt.add.role.step2.sub.header.xpath")))
.getText().contains("Step 2 : Select permissions to add to Role")) {
throw new IllegalStateException("This is not the Add Role step2 page");
}
}
public void selectPermission(String permissionXpath) {
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement(permissionXpath))).click();
}
public AddRoleStep3Page next() {
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("usr.mgt.add.role.step2.next.button.xpath"))).click();
return new AddRoleStep3Page(driver);
}
}

View File

@ -0,0 +1,71 @@
/*
* Copyright (c) 2005-2014, 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.
*/
package org.wso2.mb.integration.common.utils.ui.pages.configure;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.wso2.mb.integration.common.utils.ui.UIElementMapper;
import java.util.List;
public class AddRoleStep3Page {
private static final Log log = LogFactory.getLog(AddRoleStep3Page.class);
private WebDriver driver;
public AddRoleStep3Page(WebDriver driver){
this.driver = driver;
if (!driver.findElement(By.xpath(UIElementMapper.getInstance()
.getElement("usr.mgt.add.role.step3.sub.header.xpath"))).getText().contains("Step 3")) {
throw new IllegalStateException("This is not the Add Role step3 page");
}
}
public boolean finish(){
boolean isSuccessful = false;
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("usr.mgt.add.role.step3.finish.button.xpath"))).click();
// handle delete confirmation popup
String dialog = driver.getWindowHandle();
driver = driver.switchTo().window(dialog);
WebElement e = driver.findElement(By.id("messagebox-info"));
if(e.findElement(By.tagName("p")).getText().contains("is added successfully")) {
isSuccessful = true;
}
// find ok button in popup dialog and click it
List<WebElement> buttonList = driver.findElements(By.tagName("button"));
for (WebElement okButton : buttonList) {
if (okButton.getText().compareToIgnoreCase("ok") == 0) {
okButton.click();
break;
}
}
dialog = driver.getWindowHandle();
driver = driver.switchTo().window(dialog);
return isSuccessful;
}
public void selectUsers(List<String> userXpathList) {
for(String userXpath: userXpathList){
driver.findElement(By.xpath(userXpath)).click();
}
}
}

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2005-2014, 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.
*/
package org.wso2.mb.integration.common.utils.ui.pages.configure;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.wso2.mb.integration.common.utils.ui.UIElementMapper;
import java.io.IOException;
public class AddSecondaryUserStorePage {
private static final Log log = LogFactory.getLog(AddSecondaryUserStorePage.class);
private WebDriver driver;
private UIElementMapper uiElementMapper;
public AddSecondaryUserStorePage(WebDriver driver) throws IOException {
this.driver = driver;
this.uiElementMapper = UIElementMapper.getInstance();
// Check that we're on the right page.
if (!driver.getCurrentUrl().contains("/userstore_config/userstore-config.jsp")) {
throw new IllegalStateException("This is not the \"Add Secondary User Store\" page");
}
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2005-2014, 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.
*/
package org.wso2.mb.integration.common.utils.ui.pages.configure;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.wso2.mb.integration.common.utils.ui.UIElementMapper;
public class AddUserStep1Page {
private static final Log log = LogFactory.getLog(AddUserStep1Page.class);
private WebDriver driver;
public AddUserStep1Page(WebDriver driver){
this.driver = driver;
if (!driver.findElement(By.xpath(UIElementMapper.getInstance()
.getElement("usr.mgt.add.user.step1.sub.header.xpath"))).getText().contains("Step 1 : Enter user name")) {
throw new IllegalStateException("This is not the add users step1 page");
}
}
public void addUserDetails(final String userName, final String password, final String repeatPassword) {
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("usr.mgt.add.user.step1.user.name.field.xpath")))
.sendKeys(userName);
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("usr.mgt.add.user.step1.password.field.xpath")))
.sendKeys(password);
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("usr.mgt.add.user.step1.password.repeat.field.xpath")))
.sendKeys(repeatPassword);
}
public AddUserStep2Page next() {
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("usr.mgt.add.user.step1.next.button.xpath"))).click();
return new AddUserStep2Page(driver);
}
}

View File

@ -0,0 +1,87 @@
/*
* Copyright (c) 2005-2014, 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.
*/
package org.wso2.mb.integration.common.utils.ui.pages.configure;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.wso2.mb.integration.common.utils.ui.UIElementMapper;
import org.wso2.mb.integration.common.utils.ui.pages.MBPage;
import java.util.List;
/**
* UI test class related to the second page of the queue add wizard of Management console
*/
public class AddUserStep2Page extends MBPage{
private static final Log log = LogFactory.getLog(AddUserStep2Page.class);
/**
* Checks whether the current page is the correct add user step 2 page. if not throws a
* runtime exception (IllegalStateException)
* @param driver WebDriver
*/
public AddUserStep2Page(WebDriver driver) {
super(driver);
if (!driver.findElement(By.xpath(UIElementMapper.getInstance()
.getElement("usr.mgt.add.user.step2.sub.header.xpath"))).getText().contains("Step 2 : Select roles of the user")) {
throw new IllegalStateException("This is not the Add User step2 page");
}
}
public boolean selectRole(final String role){
WebElement tableData = driver.findElement(By.xpath(UIElementMapper.getInstance()
.getElement("usr.mgt.add.user.step2.select.roles.td.xpath")));
List<WebElement> inputList = tableData.findElements(By.tagName("input"));
for(WebElement e: inputList){
if((e.getAttribute("type").compareTo("checkbox") == 0) && (e.getAttribute("value").compareTo(role) == 0)) {
e.click();
return true;
}
}
return false;
}
public boolean finish() {
boolean isSuccessful = false;
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("usr.mgt.add.user.step2.finish.button"))).click();
String dialog = driver.getWindowHandle();
driver = driver.switchTo().window(dialog);
WebElement e = driver.findElement(By.id("messagebox-info"));
if(e.findElement(By.tagName("p")).getText().contains("is added successfully")) {
isSuccessful = true;
}
// find ok button in popup dialog and click it
List<WebElement> buttonList = driver.findElements(By.tagName("button"));
for (WebElement okButton : buttonList) {
if (okButton.getText().compareToIgnoreCase("ok") == 0) {
okButton.click();
break;
}
}
dialog = driver.getWindowHandle();
driver = driver.switchTo().window(dialog);
return isSuccessful;
}
}

View File

@ -0,0 +1,79 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.utils.ui.pages.configure;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.wso2.mb.integration.common.utils.ui.UIElementMapper;
import java.io.IOException;
/**
* Abstraction of the Configuration tab page of the UI.
*/
public class ConfigurePage {
private WebDriver driver;
/**
* Initializes configuration page.
* @param driver The selenium web driver.
* @throws IOException
*/
public ConfigurePage(WebDriver driver) throws IOException {
this.driver = driver;
// Check that we're on the right page.
String attr = driver.findElement(By.id(UIElementMapper.getInstance().getElement("configure.panel.button.id"))).getAttribute("class");
if (attr.compareTo("menu-panel-buttons selected") != 0) {
throw new IllegalStateException("This is not the Configure page");
}
}
/**
* User store Management store page is selected from UI and returned
*
* @return The user management store page.
* @throws IOException
*/
public UserStoreManagementPage getUserStoreManagementPage() throws IOException {
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("configure.user.store.management.xpath"))).click();
return new UserStoreManagementPage(driver);
}
/**
* New Tenant creation page link is selected from Configure tab page in UI and AddNewTenantPage
* is returned
*
* @return The tenant adding page.
*/
public AddNewTenantPage getAddNewTenantPage() {
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("configure.multitenancy.add.new.tenant.xpath"))).click();
return new AddNewTenantPage(driver);
}
/**
* User Management page link is selected from Configure tab page in UI
*
* @return The user management page to add users and roles.
*/
public UserManagementPage getUserManagementPage() {
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("configure.users.and.roles.button.xpath"))).click();
return new UserManagementPage(driver);
}
}

View File

@ -0,0 +1,60 @@
/*
* Copyright (c) 2005-2014, 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.
*/
package org.wso2.mb.integration.common.utils.ui.pages.configure;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.wso2.mb.integration.common.utils.ui.pages.login.LoginPage;
import org.wso2.mb.integration.common.utils.ui.UIElementMapper;
import java.io.IOException;
/**
* This page represents Tenant Home page in MB management console.
*/
public class TenantHomePage {
private static final Log log = LogFactory.getLog(TenantHomePage.class);
private WebDriver driver;
/**
* This constructor test whether the web driver is in correct page.
* @param driver WebDriver
*/
public TenantHomePage(WebDriver driver){
this.driver = driver;
// Check that we're on the right page.
if (!driver.findElement(By.xpath(UIElementMapper.getInstance()
.getElement("mb.tenant.home.page.menu.header.xpath"))).getText().contains("Home")) {
throw new IllegalStateException("This is not the tenant home page");
}
}
/**
* Logout from home page. Login page is returned
* @return LoginPage
* @throws IOException
*/
public LoginPage logout() throws IOException {
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("mb.tenant.sign.out.xpath"))).click();
return new LoginPage(driver);
}
}

View File

@ -0,0 +1,67 @@
/*
* Copyright (c) 2015, 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.
*/
package org.wso2.mb.integration.common.utils.ui.pages.configure;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.wso2.mb.integration.common.utils.ui.UIElementMapper;
/**
* This class represents the user management class.
*/
public class UserManagementPage {
private WebDriver driver;
/**
* Creates a user management class.
*
* @param driver The selenium web driver.
*/
public UserManagementPage(WebDriver driver) {
this.driver = driver;
if (!driver.findElement(By.xpath(UIElementMapper.getInstance()
.getElement("configure.user.mgt.header.xpath"))).getText().contains("Add Users and Roles")) {
throw new IllegalStateException("This is not the User Management page");
}
}
/**
* Gets the first page in creating a new role
*
* @return The page that appears first when creating a new role
*/
public AddRoleStep1Page getAddRolePage() {
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("configure.usr.mgt.roles.link.xpath")))
.click();
return new AddRoleStep1Page(driver);
}
/**
* Gets the first page in creating a new new
*
* @return The page that appears first when creating a new user
*/
public AddUserStep1Page getAddNewUserPage() {
driver.findElement(By.xpath(UIElementMapper.getInstance().getElement("configure.usr.mgt.users.link.xpath")))
.click();
return new AddUserStep1Page(driver);
}
}

View File

@ -0,0 +1,48 @@
/*
* Copyright (c) 2005-2014, 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.
*/
package org.wso2.mb.integration.common.utils.ui.pages.configure;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.wso2.mb.integration.common.utils.ui.pages.configure.AddSecondaryUserStorePage;
import org.wso2.mb.integration.common.utils.ui.UIElementMapper;
import java.io.IOException;
public class UserStoreManagementPage {
private static final Log log = LogFactory.getLog(UserStoreManagementPage.class);
private WebDriver driver;
private UIElementMapper uiElementMapper;
public UserStoreManagementPage(WebDriver driver) throws IOException {
this.driver = driver;
this.uiElementMapper = UIElementMapper.getInstance();
// Check that we're on the right page.
if (!driver.findElement(By.id(uiElementMapper.getElement("configure.user.store.management.header.id")))
.getText().contains("Add New User Store")) {
throw new IllegalStateException("This is not the User Store Management page");
}
}
public AddSecondaryUserStorePage addSecondaryUserStore() throws IOException {
driver.findElement(By.xpath(uiElementMapper.getElement("configure.user.store.management.add.secondary.userstore"))).click();
return new AddSecondaryUserStorePage(driver);
}
}

View File

@ -0,0 +1,97 @@
/*
* Copyright (c) 2005-2014, 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.
*/
package org.wso2.mb.integration.common.utils.ui.pages.login;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.wso2.mb.integration.common.utils.ui.pages.configure.TenantHomePage;
import org.wso2.mb.integration.common.utils.ui.pages.main.HomePage;
import org.wso2.mb.integration.common.utils.ui.UIElementMapper;
import java.io.IOException;
/**
* Login page class - contains methods to login to wso2 products.
*/
public class LoginPage {
private static final Log log = LogFactory.getLog(LoginPage.class);
private WebDriver driver;
public LoginPage(WebDriver driver) throws IOException {
this.driver = driver;
// Check that we're on the right page.
if (!(driver.getCurrentUrl().contains("login.jsp"))) {
// Alternatively, we could navigate to the login page, perhaps logging out first
throw new IllegalStateException("This is not the login page");
}
}
/**
* Provide facility to log into the products using user credentials
*
* @param userName login user name
* @param password login password
* @return reference to Home page
* @throws java.io.IOException if mapper.properties file not found
*/
public HomePage loginAs(final String userName, final String password) throws IOException {
log.info("Login as " + userName);
WebElement userNameField = driver.findElement(By.id(UIElementMapper.getInstance()
.getElement("login.username.id")));
WebElement passwordField = driver.findElement(By.id(UIElementMapper.getInstance()
.getElement("login.password.id")));
userNameField.sendKeys(userName);
passwordField.sendKeys(password);
driver.findElement(By.className(UIElementMapper.getInstance().getElement("login.sign" +
".in.button"))).click();
driver.findElement(By.id(UIElementMapper.getInstance().getElement("main.tab.id"))).click();
return new HomePage(driver);
}
public TenantHomePage loginAsTenant(final String userName, final String domain, final String password){
log.info("Login as " + userName);
WebElement userNameField = driver.findElement(By.id(UIElementMapper.getInstance()
.getElement("login.username.id")));
WebElement passwordField = driver.findElement(By.id(UIElementMapper.getInstance()
.getElement("login.password.id")));
userNameField.sendKeys(userName + "@" + domain);
passwordField.sendKeys(password);
driver.findElement(By.className(UIElementMapper.getInstance().getElement("login.sign.in" +
".button"))).click();
driver.findElement(By.id(UIElementMapper.getInstance().getElement("main.tab.id"))).click();
return new TenantHomePage(driver);
}
}

View File

@ -0,0 +1,81 @@
/*
* 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.
*/
package org.wso2.mb.integration.common.utils.ui.pages.main;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.wso2.mb.integration.common.utils.ui.UIElementMapper;
import java.io.IOException;
/**
* This page represents 'Dead Letter Channel -> Browse' page in MB management console.
*/
public class DLCBrowsePage {
private static final Log log = LogFactory.getLog(DLCBrowsePage.class);
private WebDriver driver;
/**
* Retrieve Page consists DeadLetterChannel
*
* @param driver selenium web driver used to run the test
* @throws IOException if mapper.properties file not found
*/
public DLCBrowsePage(WebDriver driver) throws IOException {
this.driver = driver;
// Check that we're on the right page.
if (!driver.findElement(By.xpath(UIElementMapper.getInstance()
.getElement("home.dlc.header.xpath"))).getText()
.contains("Dead Letter Channel")) {
throw new IllegalStateException("This is not the DLC page");
}
}
/**
* Browse for content of DeadLetter Channel
* Retrieve 'Dead Letter Channel -> Browse -> Queue Content' page
*
* @return Content of DeadLetter Channel
* @throws IOException if mapper.properties file not found
*/
public DLCContentPage getDLCContent() throws IOException {
driver.findElement(By.xpath(UIElementMapper.getInstance()
.getElement("mb.dlc.browse.table.browse.button.xpath"))).click();
return new DLCContentPage(driver);
}
/**
* Check whether dead letter channel created or not
*
* @return true when dead letter channel created
*/
public boolean isDLCCreated() {
boolean isDLCCreated = false;
WebElement queueTable;
queueTable = driver.findElement(By.xpath(UIElementMapper.getInstance()
.getElement("mb.dlc.browse.table.xpath")));
if (queueTable != null) {
isDLCCreated = true;
}
return isDLCCreated;
}
}

Some files were not shown because too many files have changed in this diff Show More