Examples of SessionName


Examples of org.xmlBlaster.util.SessionName

   private SessionName sessionName;
   Logger log = Logger.getLogger(PtPDestination.class.getName());
  
   public PtPDestination(Global parentGlobal, String sessionName) {
      this.global = parentGlobal.getClone(null);
      this.sessionName = new SessionName(this.global, sessionName);
      this.updateInterceptor = new MsgInterceptor(this.global, log, null);
   }
View Full Code Here

Examples of org.xmlBlaster.util.SessionName

         }

         // Send a message to 'receiver'
         PublishKey pk = new PublishKey(sender.getGlobal(), "HelloWorld5", "text/plain", "1.0");
         PublishQos pq = new PublishQos(sender.getGlobal());
         pq.addDestination(new Destination(new SessionName(sender.getGlobal(), receiverName)));
         MsgUnit msgUnit = new MsgUnit(pk, "Hi", pq);
         PublishReturnQos retQos = sender.publish(msgUnit);
         log.info("Published message '" + retQos.getKeyOid() + "' to " + receiverName + ":\n" + msgUnit.toXml());
      }
      catch (XmlBlasterException e) {
View Full Code Here

Examples of org.xmlBlaster.util.SessionName

      } catch (XmlBlasterException e) {
         e.printStackTrace();
         return null;
      }
      if (con != null) {
         SessionName absoluteName = new SessionName(remoteGlob, ((XmlBlasterAccess) con).getContextNode()
               .getSessionNameCompatible());
         return absoluteName;
      }
      return null;
   }
View Full Code Here

Examples of org.xmlBlaster.util.SessionName

      SessionInfo sessionInfo = sessionHolder.getSessionInfo();
      if (sessionInfo == null) {
         log.warning("sessionInfo is null, will not authorize");
         return false;
      }
      SessionName sessionName = sessionInfo.getSessionName();
      if (sessionName == null) {
         log.warning("sessionName for '" + sessionInfo.toXml() + "' is null, will not authorize");
         return false;
      }
      String loginName = sessionName.getLoginName();
      if (loginName == null) {
         log.warning("loginName for '" + sessionName.toXml() + "' is null, will not authorize");
         return false;
      }
     
      Container container = (Container)this.containerCache.get(loginName);
      if (container == null) {
View Full Code Here

Examples of org.xmlBlaster.util.SessionName

  
   private void sendStatusInformation(String status) throws Exception {
      log.info("send status information '" + status + "'");
      I_XmlBlasterAccess conn = this.global.getXmlBlasterAccess();
      PublishKey pubKey = new PublishKey(this.global, this.statusTopic);
      Destination destination = new Destination(new SessionName(this.global, this.slaveSessionId));
      destination.forceQueuing(true);
      PublishQos pubQos = new PublishQos(this.global, destination);
      pubQos.setPersistent(true);
      MsgUnit msg = new MsgUnit(pubKey, status.getBytes(), pubQos);
      conn.publish(msg);
View Full Code Here

Examples of org.xmlBlaster.util.SessionName

   public void requestInitialData(String dbWatcherSessionId, boolean onlyRegister) throws Exception {
      log.info(this.name + " sends now an initial update request to the Master '" + dbWatcherSessionId + "'");
      I_XmlBlasterAccess conn = this.global.getXmlBlasterAccess();
      // no oid for this ptp message
      PublishKey pubKey = new PublishKey(this.global, REQUEST_INITIAL_DATA_TOPIC);
      Destination destination = new Destination(new SessionName(this.global, dbWatcherSessionId));
      destination.forceQueuing(true);
      PublishQos pubQos = new PublishQos(this.global, destination);
      pubQos.addClientProperty(ReplicationConstants.SLAVE_NAME, this.slaveSessionId);
      pubQos.addClientProperty(ReplicationConstants.REPL_VERSION, this.ownVersion);
      if (this.initialFilesLocation != null)
View Full Code Here

Examples of org.xmlBlaster.util.SessionName

         // sending the cancel op to the DbWatcher
         log.info(this.name + " sends now a cancel request to the Master '" + this.dbWatcherSessionName + "'");
         I_XmlBlasterAccess conn = this.global.getXmlBlasterAccess();
         // no oid for this ptp message
         PublishKey pubKey = new PublishKey(this.global, REQUEST_CANCEL_UPDATE_TOPIC);
         Destination destination = new Destination(new SessionName(this.global, this.dbWatcherSessionName));
         destination.forceQueuing(true);
         PublishQos pubQos = new PublishQos(this.global, destination);
         pubQos.addClientProperty(ReplicationConstants.SLAVE_NAME, this.slaveSessionId);
         pubQos.setPersistent(false);
         MsgUnit msg = new MsgUnit(pubKey, ReplicationConstants.REPL_REQUEST_CANCEL_UPDATE.getBytes(), pubQos);
View Full Code Here

Examples of org.xmlBlaster.util.SessionName

                     // New xbpostfix: "client/jack/session/1"
                     ReferenceEntry refEntry = (ReferenceEntry) ent;
                     // Reconstruct sessionName
                     // /node/heron/client/subscriberDummy <->
                     // clientsubscriberDummy1
                     SessionName sn = refEntry.getReceiver();
                     if (!transferClusterNode(sn.getNodeIdStr())) {
                        logToFile(relating + ": Ignoring wrong cluster node '"
                              + sn.getNodeIdStr() + "': "
                              + sn.getAbsoluteName());
                        return null;
                     }
                     // Fix pubSessionId if it was a PtP to subject
                     String queueName = refEntry.getStorageId().getOldPostfix();
                     // queueName=callback_nodeheronclientsubscriberDummy1
                     // subject_nodeheronclientsubscriberNotExist
                     String strippedLoginName = Global.getStrippedString(sn.getLoginName());
                     int pos = queueName.lastIndexOf(strippedLoginName);
                     if (pos != -1) {
                        String pubStr = queueName.substring(pos + strippedLoginName.length());
                        if (pubStr.length() > 0) { // has pubSessionId
                           try {
                              int pubSessionId = Integer.parseInt(pubStr);
                              sn = new SessionName(serverScopeThree, sn.getNodeId(), sn.getLoginName(), pubSessionId);
                           } catch (NumberFormatException e) {
                              logToFile(queueNamePattern + "[counter=" + processed + "]: SessionName problem queueName="
                                    + queueName + ": " + e.toString());
                              e.printStackTrace();
                           }
                        }
                     }
                     // logToFile(queueNamePattern + "[counter=" + counter
                     // + "]: queueName=" + queueName + " new=" +
                     // sn.getAbsoluteName() + " strippedLoginName=" +
                     // strippedLoginName + " oldPostfix=" +
                     // refEntry.getStorageId().getXBStore().getPostfix());
                     refEntry.setStorageId(new StorageId(serverScopeThree,
                           sn.getNodeId().getId()/* clusterNodeIdToTransfer */,
                           relating, sn));
                     /*
                      * } else { // Dangerous guess: String queueName =
                      * refEntry.getStorageId().getOldPostfix(); SessionName sn
                      * = SessionName.guessSessionName(serverScopeOne,
View Full Code Here

Examples of org.xmlBlaster.util.SessionName

                  String relating = oldStorageId.getXBStore().getType();
                  // reset nodeId to ""
                  // nodeId = oldStorageId.getXBStore().getNode();
                  StorageId storageId = null;
                  // sn is most time null
                  SessionName sender = entry.getSender();// entry.getMsgUnit().getQosData().getSender();
                  SessionName receiver = entry.getReceiver();
                  SessionName guessed = SessionName.guessSessionName(globalOne, null, queueName,
                        limitPositivePubToOneDigit);
                  if (receiver != null && receiver.isNodeIdExplicitlyGiven())
                     nodeId = receiver.getNodeIdStr();
                  else if (guessed != null && guessed.isNodeIdExplicitlyGiven())
                     nodeId = guessed.getNodeIdStr();
                  // else if (sn != null)
                  // nodeId = sn.getNodeIdStr();
                  // if (sn != null) {
                  // storageId = new StorageId(globalThree, nodeId, relating,
                  // sn);
                  // } else {
                     // xb_entries.queueName="connection_clientpublisherToHeron2"
                     // --->
                     // xbstore.xbpostfix="client/publisherToHeron/2"
                  SessionName sn = SessionName.guessSessionName(globalOne, nodeId, queueName,
                        limitPositivePubToOneDigit);
                     storageId = new StorageId(globalThree, nodeId, relating, sn);
                  // }
                  logToFile("storageId=" + storageId.getXBStore().toString() + " from: nodeId=" + nodeId + "sender="
                        + (sender == null ? null : sender.getAbsoluteName()) + " receiver="
View Full Code Here

Examples of org.xmlBlaster.util.SessionName

            final String globalKey = SocketExecutor.getGlobalKey(connectQosData.getSessionName());
            final String secretSessionId = null;
            final int pubSessionId = 1;
            // "client/avalon/session/1" (we are heron and want to re-use avalons connection)
            // Dangerous Precond: The remote cluster logs in with subjectId==his-nodeId and pubSessionId=1
            final SessionName sessionName = new SessionName(this.remoteGlob, null, nodeInfo.getId(), pubSessionId);
            SessionInfo myRemotePartnerLogin = this.fatherGlob.getRequestBroker().getAuthenticate(secretSessionId).getSessionInfo(sessionName);
            this.remoteGlob.addObjectEntry(globalKey, "dummyPlaceHolder");
            log.info(sessionName.toString() + " Adding initial 'dummyPlaceHolder' entryKey=" + globalKey + " global.instanceId=" +this.remoteGlob.getInstanceId() + "-" + remoteGlob.hashCode());
           
            if (myRemotePartnerLogin == null) {
               // Create the temporary SessionInfo until the real client arrives
               String[] args = new String[0]; //{ "-queue/connection/defaultPlugin", "RAM,1.0" };
               Global glob = this.remoteGlob; // Why?? .getClone(args);
               String type = "SOCKET";
               String version = "1.0";
               String rawAddress = "socket://:7607";
               boolean found = false;
               I_Driver[] drivers = this.fatherGlob.getPluginRegistry().getPluginsOfInterfaceI_Driver();//register(pluginInfo.getId(), plugin);//getProtocolPluginManager().getPlugin(type, version)
               for (int i=0; i<drivers.length; i++) {
                  if (drivers[i] instanceof SocketDriver) {
                     SocketDriver sd = (SocketDriver)drivers[i];
                     rawAddress = sd.getRawAddress();
                     type = sd.getType();
                     version = sd.getVersion();
                     found = true;
                  }
               }
               if (!found)
                  log.severe("No socket protocol driver found");
               // TODO: How to avoid configuring the password (pass a flag to Authenticate?)
               // TODO: Currently we can only configure loginName/password based credentials
               // cluster/securityService/avalon=<securityService type='htpasswd' version='1.0'><user>avalon</user><passwd>secret</passwd></securityService>
               String xml = this.fatherGlob.get("cluster/securityService/"+sessionName.getLoginName(), "", null, null);
               if ("".equals(xml)) {
                  log.severe("To bootstrap an initial session of " + sessionName.getLoginName() + " cluster slave you need to give his password like this (adjust the password and the type if necessary): " +
                        "cluster/securityService/" + sessionName.getLoginName() + "=<securityService type='htpasswd' version='1.0'><user>" + sessionName.getLoginName() + "</user><passwd>secret</passwd></securityService>");
                  return null;
               }
               SecurityQos securityQos = new SecurityQos(glob, xml);
               ConnectQos tmpQos = new ConnectQos(glob, sessionName.getRelativeName(), "");
               tmpQos.getData().setSecurityQos(securityQos);
               tmpQos.setSessionName(sessionName);
               ClientQueueProperty prop = new ClientQueueProperty(glob, null);
               prop.setType("RAM");
               Address address = new Address(glob);
               address.setDelay(40000L);
               address.setRetries(-1);
               address.setPingInterval(20000L);
               address.setType(type);
               address.setVersion(version);
               //address.addClientProperty(new ClientProperty("useRemoteLoginAsTunnel", true));
               address.addClientProperty(new ClientProperty("acceptRemoteLoginAsTunnel", true));
               address.setRawAddress(rawAddress); // Address to find ourself
               //address.addClientProperty(new ClientProperty("acceptRemoteLoginAsTunnel", "", "", ""+true));
               prop.setAddress(address);
               tmpQos.addClientQueueProperty(prop);
               CallbackAddress cbAddress = new CallbackAddress(glob);
               cbAddress.setDelay(40000L);
               cbAddress.setRetries(-1);
               cbAddress.setPingInterval(20000L);
               cbAddress.setDispatcherActive(false);
               cbAddress.setType(type);
               cbAddress.setVersion(version);
               //cbAddress.addClientProperty(new ClientProperty("useRemoteLoginAsTunnel", true));
               cbAddress.addClientProperty(new ClientProperty("acceptRemoteLoginAsTunnel", true));
               tmpQos.addCallbackAddress(cbAddress);
               tmpQos.setPersistent(true);
               glob.getXmlBlasterAccess().setServerNodeId(getId());
               log.info("Creating temporary session " + sessionName.getRelativeName() + " until real cluster node "
                     + glob.getXmlBlasterAccess().getServerNodeId() + " arrives");
               glob.getXmlBlasterAccess().connect(tmpQos, new I_Callback() {
                  public String update(String cbSessionId, UpdateKey updateKey,
                        byte[] content, UpdateQos updateQos)
                        throws XmlBlasterException {
                     return null;
                  }
               });
               glob.getXmlBlasterAccess().leaveServer(null);
               myRemotePartnerLogin = this.fatherGlob.getRequestBroker().getAuthenticate(secretSessionId).getSessionInfo(sessionName);
              
               if (myRemotePartnerLogin == null) {
                  log.severe("Can't create session " + sessionName.getAbsoluteName());
                  return null;
               }
            }
           
            DispatchManager mgr = myRemotePartnerLogin.getDispatchManager();
            if (mgr != null) {
               boolean fireInitial = true;
                mgr.addConnectionStatusListener(new I_ConnectionStatusListener() {
                   // The !remote! node has logged in (not our client connection)
                   public void toAlive(DispatchManager dispatchManager, ConnectionStateEnum oldState) {
                      SessionInfo myRemotePartnerLogin = fatherGlob.getRequestBroker().getAuthenticate(secretSessionId).getSessionInfo(sessionName);
                      if (myRemotePartnerLogin != null && myRemotePartnerLogin.getAddressServer() != null) {
                         Object obj = myRemotePartnerLogin.getAddressServer().getCallbackDriver();
                         if (obj != null && obj instanceof CallbackSocketDriver) {
                            // cbDriver.callbackAddress: socket://192.168.1.20:8920
                            CallbackSocketDriver cbDriver = (CallbackSocketDriver)myRemotePartnerLogin.getAddressServer().getCallbackDriver();
                            log.info("toAlive(" + sessionName.getAbsoluteName() + ")... found existing session to back-tunnel '" + getId() + "' on address '" + myRemotePartnerLogin.getAddressServer().getRawAddress() + "' protocol=" + myRemotePartnerLogin.getAddressServer().getType() + " cbDriver-Handler " + ((cbDriver.getHandler()==null)?"null":cbDriver.getHandler().getAddressServer().getRawAddress()));
                            //log.severe("Register toAlive: CallbackSocketDriver.handler=" + cbDriver.getHandler());
                            remoteGlob.addObjectEntry(globalKey, cbDriver.getHandler());
                            log.info(sessionName.toString() + " Adding toAlive '" + cbDriver.getHandler() + "' entryKey=" + globalKey + " global.instanceId=" + remoteGlob.getInstanceId() + "-" + remoteGlob.hashCode());
                         }
                         else {
                            log.info("toAlive(" + sessionName.getAbsoluteName() + ")... no  CallbackSocketDriver to back-tunnel '" + getId() + "' found");
                            remoteGlob.addObjectEntry(globalKey, "dummyPlaceHolder");
                            log.info(sessionName.toString() + " Adding toAlive 'dummyPlaceHolder' entryKey=" + globalKey + " global.instanceId=" + remoteGlob.getInstanceId() + "-" + remoteGlob.hashCode());
                         }
                      }
                      else {
                         log.info("toAlive(" + sessionName.getAbsoluteName() + ")... no  session to back-tunnel '" + getId() + "' found");
                         remoteGlob.addObjectEntry(globalKey, "dummyPlaceHolder");
                         log.info(sessionName.toString() + " Adding toAlive 'dummyPlaceHolder' (myRemotePartnerLogin=null) entryKey=" + globalKey + " global.instanceId=" + remoteGlob.getInstanceId() + "-" + remoteGlob.hashCode());
                      }
                   }
                   public void toPolling(DispatchManager dispatchManager, ConnectionStateEnum oldState) {
                      log.warning("toPolling(" + sessionName.getAbsoluteName() + ") for cluster back-tunnel ...");
                      remoteGlob.addObjectEntry(globalKey, "dummyPlaceHolder");
                      log.info(sessionName.toString() + " Adding toPolling 'dummyPlaceHolder' entryKey=" + globalKey + " global.instanceId=" + remoteGlob.getInstanceId() + "-" + remoteGlob.hashCode());
                      if (oldState == ConnectionStateEnum.ALIVE)
                        ping(); // Force our client connection to POLLING as
                                // well
                   }
                   public void toDead(DispatchManager dispatchManager, ConnectionStateEnum oldState, XmlBlasterException xmlBlasterException) {
                      log.severe("toDead(" + sessionName.getAbsoluteName() + ") for cluster back-tunnel ...");
                      remoteGlob.addObjectEntry(globalKey, "dummyPlaceHolder");
                      log.info(sessionName.toString() + " Adding toDead 'dummyPlaceHolder' entryKey=" + globalKey + " global.instanceId=" + remoteGlob.getInstanceId() + "-" + remoteGlob.hashCode());
                      if (oldState == ConnectionStateEnum.ALIVE)
                        ping(); // Force our client connection to POLLING
                   }
                   public void toAliveSync(DispatchManager dispatchManager, ConnectionStateEnum oldState) {
                   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.