Package org.xmlBlaster.util.xbformat

Examples of org.xmlBlaster.util.xbformat.XmlScriptParser


    */
   public Object xmlScriptInvoke(String literal) throws XmlBlasterException {
      if (log.isLoggable(Level.FINER))
         log.finer("xmlScriptInvoke: " + literal);
     
      XmlScriptParser parser = new XmlScriptParser();
      final I_ProgressListener progressListener = null;
      final I_PluginConfig pluginConfig = null;
      parser.init(glob, progressListener, pluginConfig);
      InputStream is = new ByteArrayInputStream(literal.getBytes());
      try {
         MsgInfo[] msgInfoArr = parser.parse(is);
         if (msgInfoArr != null) {
            for (int i=0; i < msgInfoArr.length; i++) {
               MsgInfo msgInfo = msgInfoArr[i];
               MethodName method = msgInfo.getMethodName();
               String sessionId = msgInfo.getSecretSessionId();
View Full Code Here


    */
   public Object xmlScriptInvoke(String literal) throws XmlBlasterException {
      if (log.isLoggable(Level.FINER))
         log.finer("xmlScriptInvoke: " + literal);
     
      XmlScriptParser parser = new XmlScriptParser();
      final I_ProgressListener progressListener = null;
      final I_PluginConfig pluginConfig = null;
      parser.init(glob, progressListener, pluginConfig);
     
      InputStream is = new ByteArrayInputStream(literal.getBytes());
      try {
         MsgInfo[] msgInfoArr = parser.parse(is);
         if (msgInfoArr != null) {
            for (int i=0; i < msgInfoArr.length; i++) {
               MsgInfo msgInfo = msgInfoArr[i];
               String sessionId = msgInfo.getSecretSessionId();
               String qos = msgInfo.getQos();
View Full Code Here

      String subDirName = subDirProp.getStringValue();
      if (subDirName == null || subDirName.trim().length() < 1)
         throw new Exception("updateManualTransfer: the mandatory property '" + ReplicationConstants.INITIAL_DATA_ID + "' was empty");
     
      String initialFilesLocation = this.info.get("replication.initialFilesLocation", "${user.home}/tmp");
      XmlScriptParser xmlScriptParser = new XmlScriptParser();
      xmlScriptParser.init(new Global(), null, null);

      DbWriter dbWriter = (DbWriter)this.info.getObject("org.xmlBlaster.contrib.dbwriter.DbWriter");
      if (dbWriter == null)
         throw new Exception("The DbWriter is not set in the info");
     
      File dirWhereToStore = ReplManagerPlugin.checkExistance(initialFilesLocation);
      File subDir = new File(dirWhereToStore, subDirName);
      if (!subDir.exists()) {
         String txt = "directory '" + subDir.getAbsolutePath() + "' does not exist";
         log.severe(txt);
         throw new Exception(txt);
      }
      if (!subDir.isDirectory()) {
         String txt = "file '" + subDir.getAbsolutePath() + "' is not a directory";
         log.severe(txt);
         throw new Exception(txt);
      }
     
      String[] files = subDir.list();
      log.info("retreiving '" + files.length + "' manual transferred data files from directory '" + subDir.getAbsolutePath() + "'");
      // alphabetical order guarantees correct sequence.
      TreeSet set = new TreeSet();
      for (int i=0; i < files.length; i++)
         set.add(files[i]);
      files = (String[])set.toArray(new String[set.size()]);
     
      for (int i=0; i < files.length; i++) {
         File file = new File(subDir, files[i]);
         if (!file.exists())
            throw new Exception("The entry nr. '" + i + "': file '" + file.getAbsolutePath() + "' does not exist");
         if (!file.isFile())
            throw new Exception("The entry nr. '" + i + "': file '" + file.getAbsolutePath() + "' is not a file");

         FileInputStream fis = new FileInputStream(file);
         MsgInfo[] msgInfos = xmlScriptParser.parse(fis);
         log.info("Processing entry " + i + " of " + files.length + ": '" + file.getAbsoluteFile() + "' which has " + msgInfos.length + "' msg");
         for (int j=0; j < msgInfos.length; j++) {
            MsgUnitRaw[] messages = msgInfos[j].getMessageArr();
            for (int k=0; k < messages.length; k++) {
               MsgUnit msgUnit = new MsgUnit(new Global(), messages[k].getKey(), messages[k].getContent(), messages[k].getQos());
View Full Code Here

         log.warning("File '" + file.getAbsolutePath() + "' exists already. Will overwrite it");
      FileOutputStream fos = new FileOutputStream(file);
      MsgUnitRaw msgUnitRaw = new MsgUnitRaw(msgUnit.getKey(), msgUnit.getContent(), msgUnit.getQos());
      MsgInfo msgInfo = new MsgInfo(this.global, MsgInfo.INVOKE_BYTE, MethodName.UPDATE_ONEWAY, this.slaveSessionId);
      msgInfo.addMessage(msgUnitRaw);
      XmlScriptParser parser = new XmlScriptParser();
      parser.init(new Global(), null, null);
      fos.write(parser.toLiteral(msgInfo).getBytes());
      fos.close();
      log.info("MsgUnit '" + msgUnit.getQosData().getRcvTimestamp().getTimestamp() + "' has been written to file '" + file.getAbsolutePath() + "'");
      return completeSubdirName;
   }
View Full Code Here

   /**
    * Called by plugin loader which calls init(Global, PluginInfo) thereafter.
    */
   public XmlScriptSerializer(Global glob, PluginInfo pluginInfo) throws XmlBlasterException {
      this.glob = glob;
      parser = new XmlScriptParser();
      parser.init(glob, null, pluginInfo);
   }
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.xbformat.XmlScriptParser

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.