Package org.objectweb.joram.client.jms

Examples of org.objectweb.joram.client.jms.Topic


    System.out.println("Classic administration...");

    AdminModule.connect("root", "root", 60);

    Queue queue = Queue.create("queue");
    Topic topic = Topic.create("topic");
   
    User.create("anonymous", "anonymous");

    queue.setFreeReading();
    topic.setFreeReading();
    queue.setFreeWriting();
    topic.setFreeWriting();

    javax.jms.ConnectionFactory cf =
      TcpConnectionFactory.create("localhost", 16010);
    javax.jms.QueueConnectionFactory qcf =
      QueueTcpConnectionFactory.create("localhost", 16010);
View Full Code Here


          if (className == null)
            className = "org.objectweb.joram.mom.dest.Topic";
          if (logger.isLoggable(BasicLevel.DEBUG))
            logger.log(BasicLevel.DEBUG,
                       "Topic.create(" + serverId + "," + name + "," + className + "," + properties + ")");
          Topic topic = (Topic) getWrapper().createTopic(serverId, name, className, properties);
          properties = null;

          configureDestination(topic);

          if (isSet(parent)) {
            // TODO (AF): may be we should search the parent topic: JNDI? Joram?
            if (topics.containsKey(parent)) {
              topic.setParent((Topic) topics.get(parent));
            } else {
              logger.log(BasicLevel.ERROR,
                   "Topic.create(): Unknown parent: " + parent);
            }
          }
          // Bind the topic in JNDI.
          // Be Careful, currently only one binding is handled.
          if (isSet(jndiName))
            toBind.put(jndiName, topic);
          jndiName = null;
          // Register the topic in order to handle it later (cluster, etc.)
          String name = topic.getAdminName();
          if (! isSet(name)) name = topic.getName();
          topics.put(name, topic);
          // Fix DMQ if any
          setDestinationDMQ(topic, dmq);
        } else if (rawName.equals(ELT_DMQUEUE)) {
          className = "org.objectweb.joram.mom.dest.Queue";
          if (logger.isLoggable(BasicLevel.DEBUG))
            logger.log(BasicLevel.DEBUG,
                       "DeadMQueue.create(" + serverId + "," + name + ")");

          DeadMQueue dmq = (DeadMQueue) getWrapper().createDeadMQueue(serverId, name);

          configureDestination(dmq);

          // Bind the destination in JNDI.
          // Be Careful, currently only one binding is handled.
          if (isSet(jndiName))
            toBind.put(jndiName, dmq);
          jndiName = null;
          // Register the DMQ in order to handle it later.
          if (isSet(name))
            dmqs.put(name, dmq);
        } else if (rawName.equals(ELT_PROPERTY)) {
        } else if (rawName.equals(ELT_READER)) {
          readers.add(user);
        } else if (rawName.equals(ELT_WRITER)) {
          writers.add(user);
        } else if (rawName.equals(ELT_FREEREADER)) {
        } else if (rawName.equals(ELT_FREEWRITER)) {
        } else if (rawName.equals(ELT_INITIALCONTEXT)) {
          try {
            jndiCtx = new javax.naming.InitialContext(properties);
          } catch (NamingException exc) {
            logger.log(BasicLevel.ERROR,"",exc);
          }
        } else if (rawName.equals(ELT_CLUSTER_ELEMENT)) {
        } else if (rawName.equals(ELT_CLUSTER_CF)) {
          Map.Entry entries[] = new Map.Entry [cluster.size()];
          cluster.entrySet().toArray(entries);
          ClusterConnectionFactory clusterCF = new ClusterConnectionFactory();

          for (int i=0; i<entries.length; i++) {
            ConnectionFactory cf = (ConnectionFactory) cfs.get(entries[i].getKey());
            clusterCF.addConnectionFactory((String) entries[i].getValue(), cf);
          }
          cluster.clear();

          // Bind the destination in JNDI.
          // Be Careful, currently only one binding is handled.
          if (isSet(jndiName))
            toBind.put(jndiName, clusterCF);
          jndiName = null;
        } else if (rawName.equals(ELT_CLUSTER_QUEUE)) {
          Map.Entry entries[] = new Map.Entry [cluster.size()];
          cluster.entrySet().toArray(entries);
          ClusterQueue clusterQueue = new ClusterQueue();
          clusterQueue.setWrapper(getWrapper());

          Queue root = null;
          for (int i=0; i<entries.length; i++) {
            Queue queue = (Queue) queues.get(entries[i].getKey());
            clusterQueue.addDestination((String) entries[i].getValue(), queue);
            if (i == 0)
              root = queue;
            else
              root.addClusteredQueue(queue);
          }
          cluster.clear();

          configureDestination(clusterQueue);
          // Bind the destination in JNDI.
          // Be Careful, currently only one binding is handled.
          if (isSet(jndiName))
            toBind.put(jndiName, clusterQueue);
          jndiName = null;
        } else if (rawName.equals(ELT_CLUSTER_TOPIC)) {
          Map.Entry entries[] = new Map.Entry [cluster.size()];
          cluster.entrySet().toArray(entries);
          ClusterTopic clusterTopic = new ClusterTopic();
          clusterTopic.setWrapper(getWrapper());

          Topic root = null;
          for (int i=0; i<entries.length; i++) {
            Topic topic = (Topic) topics.get(entries[i].getKey());
            clusterTopic.addDestination((String) entries[i].getValue(), topic);
            if (i == 0)
              root = topic;
            else
              root.addClusteredTopic(topic);
View Full Code Here

    User.create("anonymous", "anonymous", 0);
    User.create("anonymous", "anonymous", 2);

    // Creating the destinations on server 1:
    Queue queue = Queue.create(1);
    Topic topic = Topic.create(1);

    // Setting free access to the destinations:
    queue.setFreeReading();
    topic.setFreeReading();
    queue.setFreeWriting();
    topic.setFreeWriting();

    // Creating the connection factories for connecting to the servers 0 and 2:
    javax.jms.ConnectionFactory cf0 =
      TcpConnectionFactory.create("localhost", 16010);
    javax.jms.ConnectionFactory cf2 =
View Full Code Here

        "root", "root", 60,
        "org.objectweb.joram.client.jms.tcp.ReliableTcpClient",
        "org.objectweb.joram.shared.security.jaas.JonasIdentity");

    Queue queue = Queue.create("queue");
    Topic topic = Topic.create("topic");
   
    User user = User.create("anonymous", null, 0, "org.objectweb.joram.shared.security.jaas.JonasIdentity");

    queue.setReader(user);
    topic.setReader(user);
    queue.setWriter(user);
    topic.setWriter(user);

    javax.jms.ConnectionFactory cf =
      TcpConnectionFactory.create("localhost", 16010);
    ((org.objectweb.joram.client.jms.admin.AbstractConnectionFactory) cf).setIdentityClassName("org.objectweb.joram.shared.security.jaas.JonasIdentity");
    javax.jms.QueueConnectionFactory qcf =
View Full Code Here

    // Create a topic forwarding its messages to the configured email address.
    Properties prop = new Properties();
    prop.load(new FileInputStream("smtp.properties"));
    prop.put("distribution.className", "com.scalagent.joram.mom.dest.mail.MailDistribution");
    Topic topic = Topic.create(0, null, Destination.DISTRIBUTION_TOPIC, prop);

    // Create a queue getting its messages from the configured email address.
    prop = new Properties();
    prop.load(new FileInputStream("pop.properties"));
    prop.put("acquisition.className", "com.scalagent.joram.mom.dest.mail.MailAcquisition");
    Queue queue = Queue.create(0, null, Destination.ACQUISITION_QUEUE, prop);

    javax.jms.ConnectionFactory cf = TcpConnectionFactory.create("localhost", 16010);

    User.create("anonymous", "anonymous", 0);

    topic.setFreeWriting();

    queue.setFreeReading();

    javax.naming.Context jndiCtx = new javax.naming.InitialContext();
    jndiCtx.bind("cf", cf);
View Full Code Here

   */
  public String createTopic(short serverId,
                            String name,
                            String className,
                            Properties prop) throws AdminException, ConnectException {
    Topic topic = null;

    try {
      Context ctx = new InitialContext();
      topic = (Topic) ctx.lookup(name);
    } catch (javax.naming.NamingException exc) {
      String shortName = removePrefix(name);
      topic = (Topic) AdminModule.createTopic(serverId, shortName, className, prop);
      topic.setFreeReading();
      topic.setFreeWriting();

      if (logger.isLoggable(BasicLevel.INFO))
        logger.log(BasicLevel.INFO,
                   "  - Topic [" + shortName + "] has been created.");

      bind(name, topic);
    }

    return topic.registerMBean(jmxRootName);
  }
View Full Code Here

    AdminModule.connect("root", "root", 60);

    // Creating the JMS administered objects:       
    ConnectionFactory connFactory = TcpConnectionFactory.create("localhost", 16010);

    Topic topic = Topic.create(0);

    // Creating an access for user anonymous:
    User.create("anonymous", "anonymous", 0);

    // Setting free access to the topic:
    topic.setFreeReading();
    topic.setFreeWriting();

    // Binding objects in JNDI:
    javax.naming.Context jndiCtx = new javax.naming.InitialContext();
    jndiCtx.bind("factoryChat", connFactory);
    jndiCtx.bind("topicChat", topic);
View Full Code Here

    ConnectionFactory cf = HATcpConnectionFactory.create("hajoram://localhost:2560,localhost:2561,localhost:2562");
    ((HATcpConnectionFactory)cf).getParameters().connectingTimer = 30;
   
    AdminModule.connect(cf, "root", "root");
   
    Topic topic = Topic.create(0,"topic");

    AdminModule.disconnect();

    Connection cnx = cf.createConnection("anonymous", "anonymous");
    Session sess = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
View Full Code Here

    Queue queue = (Queue) getHermes().getDestination(dest.getName(), Domain.QUEUE);
       
    return queue.getPendingMessages();
       
      } else {
    Topic topic = (Topic) getHermes().getDestination(dest.getName(), Domain.TOPIC) ;
        
       
    throw new HermesException("Cannot get depth, " + dest.getName() + " is a topic");
      }
     
View Full Code Here

  
    public QueueBrowser createDurableSubscriptionBrowser(final DestinationConfig dConfig) throws JMSException
    {
  checkConnected() ;
  try {
      Topic topic = (Topic) getHermes().getSession().createTopic(dConfig.getName());
      checkConnected();
      final List messages= new ArrayList();
  
      int fin =0;
      String[] ids = topic.getSubscriberIds();
      for(int i=0;i< ids.length && fin == 0 ;i++){
    if(dConfig.getShortName() !=null && (dConfig.getShortName()).equals(ids[i])){
        User u = new User("user"+i,ids[i]);
        final Subscription[] subs = u.getSubscriptions() ;
        for (int j = 0 ; j < subs.length && fin == 0 ; j++) {
View Full Code Here

TOP

Related Classes of org.objectweb.joram.client.jms.Topic

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.