Package org.xmlBlaster.client.qos

Examples of org.xmlBlaster.client.qos.ConnectReturnQos


    { log.severe("Could not initialize I_XmlBlasterAccess: " + ex.toString());
      ex.printStackTrace();
    }
    try
    { ConnectQos qos = new ConnectQos(glob,PARTIAL_USERNAME, RIGHT_PASSWORD);
      ConnectReturnQos conRetQos = con.connect(qos, null);
      con.disconnect(null);
    }
    catch(Exception ex)
    { log.info("Could not connect: " + ex.toString());
      ex.printStackTrace();
View Full Code Here


    catch(Exception ex)
    { log.severe("Could not initialize I_XmlBlasterAccess");
    }
    try
    { ConnectQos qos = new ConnectQos(glob,RIGHT_USERNAME, RIGHT_PASSWORD);
      ConnectReturnQos conRetQos = con.connect(qos, null);
      con.disconnect(null);
    }
    catch(Exception ex)
    { log.info("Could not connect");
      isValue = false;
View Full Code Here

    catch(Exception ex)
    { log.severe("Could not initialize I_XmlBlasterAccess");
    }
    try
    { ConnectQos qos = new ConnectQos(glob,WRONG_USERNAME, WRONG_PASSWORD);
      ConnectReturnQos conRetQos = con.connect(qos, null);
      con.disconnect(null);
      assertTrue("Could connect although it should not have been possible with the specified username and password",isValue);
    }
    catch(Exception ex)
    { isValue = true;
View Full Code Here

    catch(Exception ex)
    { log.severe("Could not initialize I_XmlBlasterAccess");
    }
    try
    { ConnectQos qos = new ConnectQos(glob,WRONG_USERNAME, WRONG_PASSWORD);
      ConnectReturnQos conRetQos = con.connect(qos, null);
      con.disconnect(null);
    }
    catch(Exception ex)
    { log.info("Could not connect");
      isValue = false;
View Full Code Here

         // setup the sender client ...
            sender = glob.getXmlBlasterAccess();

            ConnectQos qos = new ConnectQos(sender.getGlobal(), senderName, "secret");
            ConnectReturnQos conRetQos = sender.connect(qos, null); // Login to xmlBlaster

            log.info("Sender connected to xmlBlaster " + conRetQos.getSessionName().getRelativeName());
         }


         {  // setup the receiver client which processes the request (usually another process) ...
            Global globReceiver = glob.getClone(null);
            receiver = globReceiver.getXmlBlasterAccess();

            ConnectQos qos = new ConnectQos(receiver.getGlobal(), receiverName, "secret");
            ConnectReturnQos conRetQos = receiver.connect(qos, new I_Callback() {
               public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
                  log.info(receiverName+": Receiving asynchronous message '" + updateKey.getOid() + "' in receiver default handler");
                  log.info(receiverName+": Received: " + updateKey.toXml() + "\n <content>" + new String(content) + "</content>" + updateQos.toXml());

                  if (updateKey.isInternal()) return "";
                  if (updateQos.isErased()) return "";
                  try {
                     String tempTopicOid = updateQos.getClientProperty(Constants.JMS_REPLY_TO, ""); // __jms:JMSReplyTo
                     log.info(receiverName+": Got request, using topic '" + tempTopicOid + "' for response");

                     // Send reply back ...
                     PublishKey pk = new PublishKey(receiver.getGlobal(), tempTopicOid, "text/plain", "1.0");
                     PublishQos pq = new PublishQos(receiver.getGlobal());
                     MsgUnit msgUnit = new MsgUnit(pk, "On doubt no ultimate truth, my dear.", pq);
                     //try { Thread.sleep(8000); } catch (InterruptedException e) { e.printStackTrace(); }
                     PublishReturnQos retQos = receiver.publish(msgUnit);
                     log.info(receiverName+": Published reply message using temporary topic " + retQos.getKeyOid());
                  }
                  catch (XmlBlasterException e) {
                     log.severe(receiverName+": Sending reply to " + updateQos.getSender() + " failed: " + e.getMessage());
                  }
                  return "";
               }
            })// Login to xmlBlaster, default handler for updates

            log.info("Receiver connected to xmlBlaster " + conRetQos.getSessionName().getRelativeName());
         }

         // Send a message to 'receiver' and block for the reply
         PublishKey pk = new PublishKey(sender.getGlobal(), "requestForEnlightenment");
         PublishQos pq = new PublishQos(sender.getGlobal());
View Full Code Here

               String key = (String)it.next();
               qos.addClientProperty(key, connectQosClientPropertyMap.get(key).toString());
            }
         }
         log.info("ConnectQos is " + qos.toXml());
         ConnectReturnQos crq = con.connect(qos, this)// Login to xmlBlaster, register for updates
         // crq can be null if '-dispatch/connection/doSendConnect false' is set
         log.info("Connect success as " + ((crq==null)?" faked connect":crq.toXml()));

         subscribe(); // first time

         if (shutdownCbServer) {
            Global.waitOnKeyboardHit("Hit a key to shutdown callback server");
View Full Code Here

         log.warning("You are already logged in, no relogin possible.");
         return "";
      }
      String retQos_literal = this.authenticate.connect(this.addressServer, connectQos);

      this.connectReturnQos = new ConnectReturnQos(this.glob, retQos_literal);
      this.sessionId = this.connectReturnQos.getSecretSessionId();

      if (log.isLoggable(Level.FINE)) log.fine("connect("+this.connectReturnQos.getData().getAddress().getType()+")" + this.connectReturnQos.getSessionName().toString());
      return retQos_literal;
   }
View Full Code Here

         SubscribeQos sQos = new SubscribeQos(this.glob);
         sQos.setWantLocal(false);
         ConnectQos qos = new ConnectQos(glob, "InternalConnector", "connector");

         ConnectReturnQos rQos = this.xmlBlasterAccess.connect(qos, this);
         log.info("Connect: " + rQos.toString());
         this.xmlBlasterAccess.subscribe(subKey, sQos);
         log.info("internal JMX Connector ready and waiting...");
      } catch (Exception ex) {
         log.severe("Error when invoking internal Server for Connector: "
               + ex.toString());
View Full Code Here

            public void reachedAliveSync(ConnectionStateEnum oldState, I_XmlBlasterAccess connection) {
               log.severe("DEBUG ONLY: Changed from connection state " + oldState + " to " + ConnectionStateEnum.ALIVE + " in sync");
            }
         });

         ConnectReturnQos connectReturnQos = xmlBlasterAccess.connect(null, new I_Callback() {
               public String update(String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) {
                  log.info("UPDATE: Receiving asynchronous callback message " + updateKey.toXml() + "\n" + updateQos.toXml());
                  return "";
               }
            })// Login to xmlBlaster, default handler for updates
         if (xmlBlasterAccess.isAlive()) {
            log.info("Successfully connected to xmlBlaster");
         }
         else {
            log.info("We continue in fail safe mode: " + connectReturnQos.toXml());
         }

         {
            log.info("Hit a key to subscribe on topic " + oid);
            try { System.in.read(); } catch(java.io.IOException e) {}
View Full Code Here

TOP

Related Classes of org.xmlBlaster.client.qos.ConnectReturnQos

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.