OW2 Consortium joram

Compare Revisions

Ignore whitespace Rev 6428 → Rev 6429

/trunk/joram/samples/src/joram/build.xml
246,9 → 246,73
</target>
 
<!-- **************************************************
* Bridge tests based on real client configuration
************************************************** -->
<!-- EF Bridge server -->
<target name="efbridge_server" depends="simple_init"
description="--> Runs EF bridge server">
<antcall target="server">
<param name="sid" value="1"/>
<param name="a3.conf" value="${conf.dir}/efbridge_a3servers.xml"/>
<param name="osgi.conf" value="${conf.dir}/config_bridge.properties"/>
</antcall>
</target>
<!-- Setup the central server configuration -->
<target name="efbridge_admin" depends="simple_init"
description="--> Runs the EF bridge sample administration">
<java classname="efbridge.Admin"
failonerror="no" fork="yes"
dir="${run.dir}">
<classpath path="${project.class.path}"/>
</java>
</target>
 
<!-- Setup the bridge configuration -->
<target name="efbridge_adminxml" depends="simple_init"
description="--> Runs XML administration script for EF bridge sample">
<copy file="${src.dir}/efbridge/joramAdmin.xml" overwrite="true" todir="${run.dir}"/>
<java classname="org.objectweb.joram.client.jms.admin.AdminModule"
failonerror="no" fork="yes"
dir="${run.dir}">
<classpath path="${project.class.path}"/>
<arg line="./joramAdmin.xml"/>
</java>
</target>
 
<!-- Runs the efbridge producer -->
<target name="efbridge_producer" depends="init"
description="--> Runs the EF bridge sample producer">
<java classname="efbridge.Producer" failonerror="no" fork="yes"
dir="${run.dir}">
<classpath path="${project.class.path}"/>
</java>
</target>
 
<!-- Runs the efbridge consumer -->
<target name="efbridge_consumer" depends="init"
description="--> Runs the EF bridge sample consumer">
<java classname="efbridge.Consumer" failonerror="no" fork="yes"
dir="${run.dir}">
<classpath path="${project.class.path}"/>
</java>
</target>
 
<!-- **************************************************
* Classic Sample
************************************************** -->
 
<!-- Setup the classic configuration -->
<target name="test" depends="simple_init"
description="--> ">
<java classname="classic.test"
failonerror="no" fork="yes"
dir="${run.dir}">
<classpath path="${project.class.path}"/>
</java>
</target>
 
<!-- Runs the JoramAdmin class -->
<target name="joram_admin" depends="simple_init"
description="--> Runs the JoramAdmin with shutdown command">
/trunk/joram/samples/src/joram/efbridge/Producer.java
New file
0,0 → 1,60
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2014 - 2017 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Initial developer(s): ScalAgent Distributed Technologies
* Contributor(s):
*/
package efbridge;
 
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
 
/**
* Produces messages on the foreign destination.
*/
public class Producer {
 
public static void main(String[] args) throws Exception {
 
javax.naming.Context jndiCtx = new javax.naming.InitialContext();
Destination bridgeDest = (Destination) jndiCtx.lookup("distq");
ConnectionFactory bridgeCF = (ConnectionFactory) jndiCtx.lookup("bridgeCF");
jndiCtx.close();
 
Connection bridgeCnx = bridgeCF.createConnection();
Session bridgeSess = bridgeCnx.createSession(true, 0);
MessageProducer bridgeProducer = bridgeSess.createProducer(bridgeDest);
 
TextMessage msg = bridgeSess.createTextMessage();
 
for (int i = 1; i < 11; i++) {
msg.setText("Joram message number " + i + " sent through distribution bridge queue.");
System.out.println("send msg = " + msg.getText());
bridgeProducer.send(msg);
}
 
bridgeSess.commit();
 
bridgeCnx.close();
}
}
Property changes:
Added: svn:mime-type
+ text/plain
/trunk/joram/samples/src/joram/efbridge/Admin.java
New file
0,0 → 1,65
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2014 - 2017 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Initial developer(s): ScalAgent Distributed Technologies
* Contributor(s):
*/
package efbridge;
 
import javax.jms.ConnectionFactory;
 
import org.objectweb.joram.client.jms.Queue;
import org.objectweb.joram.client.jms.admin.AdminModule;
import org.objectweb.joram.client.jms.admin.JMSAcquisitionQueue;
import org.objectweb.joram.client.jms.admin.JMSDistributionQueue;
import org.objectweb.joram.client.jms.admin.User;
import org.objectweb.joram.client.jms.tcp.TcpConnectionFactory;
 
public class Admin {
public static void main(String[] args) throws Exception {
System.out.println();
System.out.println("Bridge administration...");
 
ConnectionFactory bridgeCF = TcpConnectionFactory.create("localhost", 16011);
 
AdminModule.connect(bridgeCF, "root", "root");
User.create("anonymous", "anonymous");
 
// Creating a Queue Distribution bridge on server 1:
Queue distq = JMSDistributionQueue.create(1, "queue");
distq.setFreeWriting();
System.out.println("joram distribution queue = " + distq);
 
// Creating a Queue Acquisition bridge on server 1:
Queue acqq = JMSAcquisitionQueue.create(1, "queue");
acqq.setFreeReading();
System.out.println("joram acquisition queue = " + acqq);
// bind foreign destination and connectionFactory
javax.naming.Context jndiCtx = new javax.naming.InitialContext();
jndiCtx.rebind("distq", distq);
jndiCtx.rebind("acqq", acqq);
jndiCtx.rebind("bridgeCF", bridgeCF);
jndiCtx.close();
 
AdminModule.disconnect();
System.out.println("Admin closed.");
}
}
Property changes:
Added: svn:mime-type
+ text/plain
/trunk/joram/samples/src/joram/efbridge/Consumer.java
New file
0,0 → 1,53
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2014 - 2017 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Initial developer(s): ScalAgent Distributed Technologies
* Contributor(s):
*/
package efbridge;
 
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.MessageConsumer;
import javax.jms.Session;
 
/**
* Consumes messages on a foreign destination through the JORAM bridge.
*/
public class Consumer {
 
public static void main(String[] args) throws Exception {
 
javax.naming.Context jndiCtx = new javax.naming.InitialContext();
Destination bridgeDest = (Destination) jndiCtx.lookup("acqq");
ConnectionFactory bridgeCF = (ConnectionFactory) jndiCtx.lookup("bridgeCF");
jndiCtx.close();
 
Connection bridgeCnx = bridgeCF.createConnection();
Session bridgeSess = bridgeCnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageConsumer bridgeCons = bridgeSess.createConsumer(bridgeDest);
bridgeCons.setMessageListener(new MsgListener("bridge"));
bridgeCnx.start();
System.in.read();
 
bridgeCnx.close();
}
}
Property changes:
Added: svn:mime-type
+ text/plain
/trunk/joram/samples/src/joram/efbridge/MsgListener.java
New file
0,0 → 1,49
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2014 - 2017 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Initial developer(s): ScalAgent Distributed Technologies
* Contributor(s):
*/
package efbridge;
 
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
 
/**
* Implements the <code>javax.jms.MessageListener</code> interface.
*/
public class MsgListener implements MessageListener {
String who;
public MsgListener(String who) {
this.who = who;
}
public void onMessage(Message msg) {
try {
if (msg instanceof TextMessage)
System.out.println(who + " receive on acquisition queue: " + ((TextMessage) msg).getText());
}
catch (JMSException exc) {
System.err.println("Exception in listener: " + exc);
}
}
}
Property changes:
Added: svn:mime-type
+ text/plain
/trunk/joram/samples/src/joram/efbridge/joramAdmin.xml
New file
0,0 → 1,52
<?xml version="1.0"?>
<!--
- Copyright (C) 2014 - 2017 ScalAgent Distributed Technologies
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-->
 
<JoramAdmin>
<TcpAdminModule host="localhost" port="16011" name="root" password="root">
<property name="connectingTimer" value="60"/>
</TcpAdminModule>
<InitialContext>
<property name="java.naming.factory.initial"
value="fr.dyade.aaa.jndi2.client.NamingContextFactory"/>
<property name="java.naming.factory.host" value="localhost"/>
<property name="java.naming.factory.port" value="16400"/>
</InitialContext>
 
<TcpConnectionFactory name="bridgeCF" host="localhost" port="16011">
<jndi name="bridgeCF"/>
</TcpConnectionFactory>
 
<User name="anonymous" password="anonymous"/>
<JMSDistributionQueue name="distq" foreign="queue" serverId="1">
<freeWriter/>
<jndi name="distq"/>
</JMSDistributionQueue>
 
<JMSAcquisitionQueue name="acqq" foreign="queue" serverId="1">
<freeReader/>
<freeWriter/>
<jndi name="acqq"/>
</JMSAcquisitionQueue>
</JoramAdmin>
Property changes:
Added: svn:mime-type
+ text/plain
/trunk/joram/samples/config/efbridge_a3servers.xml
New file
0,0 → 1,30
<?xml version="1.0"?>
<!--
- Copyright (C) 2014 - 2017 ScalAgent Distributed Technologies
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-->
<config>
<property name="Transaction" value="fr.dyade.aaa.ext.NGTransaction"/>
<server id="1" name="S1" hostname="localhost">
<service class="org.objectweb.joram.mom.proxies.ConnectionManager" args="root root" />
<service class="org.objectweb.joram.mom.proxies.tcp.TcpProxyService" args="16011" />
<!-- Service handling the connection to the foreign JMS server using "cf" connection factory -->
<service class="org.objectweb.joram.mom.dest.jms.JMSConnectionService" args="scn://localhost:16400/?name=cnx%26cf=cf%26jndiFactoryClass=fr.dyade.aaa.jndi2.client.NamingContextFactory" />
</server>
</config>
Property changes:
Added: svn:mime-type
+ text/plain