Package org.xmlBlaster.util.qos

Examples of org.xmlBlaster.util.qos.ClientProperty


      int numberOfColumns = meta.getColumnCount();
      int count = getRowCount();
      SqlRow row = new SqlRow(this.info, count);
      getRows().add(row);
      for (int i=1; i<=numberOfColumns; i++) {
         ClientProperty prop = buildClientProperty(meta, rs, i);
         if (prop.getValueRaw() != null)
            row.setColumn(prop);
      }
      if (transformer != null) {
         Map attr = transformer.transform(rs, count);
         if (attr != null)
View Full Code Here


      for (int i=0; i < cols.length; i++) {
         if (cols[i].getFkCol() != null) {
            log.warning("The column '" + cols[i].getTable() + "." + cols[i].getColName() + " has a fK '" + cols[i].getFkTable() + "." + cols[i].getFkCol() + "'");
            return null;
         }
         ClientProperty prop = cols[i].generateRandomObject();
         if (prop == null) {
            log.warning("The column '" + cols[i].getTable() + "." + cols[i].getColName() + " has an unprocessable type '" + SqlColumn.getSqlTypeAsText(cols[i].getSqlType()) + "'");
            return null;
         }
         row.setColumn(prop);
View Full Code Here

               return "OK"; // we don't want to stop the dispatcher
            }
         }
         // 1. This is a response from an sql statement which has been previously sent to the slaves.
         else if (this.sqlTopic != null && updateKey.getOid().equals(this.sqlTopic)) {
            ClientProperty prop = (ClientProperty)updateQos.getClientProperties().get(STATEMENT_ID_ATTR);
            if (prop == null) {
               log.severe("The statement id is not specified, can not process it");
               return "OK"; // we don't want to stop the dispatcher
            }
            String reqId = prop.getStringValue();
            SqlStatement sqlStatement = (SqlStatement)this.sqlStatementMap.get(reqId);
            if (sqlStatement == null) {
               log.severe("The statement with id '" + reqId + "' has not been found");
               return "OK"; // we don't want to stop the dispatcher
            }

            prop = (ClientProperty)updateQos.getClientProperties().get(EXCEPTION_ATTR);
            String response = null;
            boolean isException = false;
            if (prop != null) {
               response = prop.getStringValue();
               isException = true;
            }
            prop = (ClientProperty)updateQos.getClientProperties().get(MASTER_ATTR);
            if (prop != null) { // then it is the response from the master
               String replPrefix = prop.getStringValue();
               if (response == null)
                  response = new String(content);
               sqlStatement.setResponse(replPrefix, response, isException);
            }
            else {
View Full Code Here

      StringBuffer buf = new StringBuffer(numOfChars);
      for (int i=0; i < numOfChars; i++) {
         int val = 32 + random.nextInt(96);
         buf.append((char)val);
      }
      return new ClientProperty(this.colName, null, null, buf.toString());
   }
View Full Code Here

      return new ClientProperty(this.colName, null, null, buf.toString());
   }
  
   private final ClientProperty nextNumber(Random random, int max) {
      int val = random.nextInt(max);
      return new ClientProperty(this.colName, null, null, "" + val);
   }
View Full Code Here

   private final ClientProperty nextDate(Random random) {
      int val = random.nextInt(87600);
      long time = System.currentTimeMillis() - (5L*365*24*3600*1000L);
      time += (60000L * val);
      Timestamp ts = new Timestamp(time);
      return new ClientProperty(this.colName, null, null, ts.toString());
   }
View Full Code Here

         return null;
      if (sqlType == Types.OTHER)
         return null;

      Random random = new Random(System.currentTimeMillis());
      ClientProperty ret = new ClientProperty(this.colName, null, null);
      if (sqlType == Types.BOOLEAN) {
         ret.setValue("" + random.nextBoolean());
         return ret;
      }
      if (sqlType == Types.CHAR)
         return nextChar(random, 1);
      if (sqlType == Types.BINARY)
View Full Code Here

    */
   public final String publishCreate(int counter, SqlInfo updateInfo, long newReplKey, String destination) throws Exception {
      log.info("publishCreate invoked for counter '" + counter + "'");
      SqlDescription description = updateInfo.getDescription();
     
      description.setAttribute(new ClientProperty(CREATE_COUNTER_KEY, "int",
            null, "" + counter));
      description.setAttribute(new ClientProperty(EXTRA_REPL_KEY_ATTR, null, null, "" + newReplKey));
      if (counter == 0) {
         description.setCommand(CREATE_ACTION);
         description.setAttribute(new ClientProperty(
               ACTION_ATTR, null, null,
               CREATE_ACTION));
      } else {
         description.setCommand(REPLICATION_CMD);
         description.setAttribute(new ClientProperty(
               ACTION_ATTR, null, null,
               INSERT_ACTION));
      }

      Map map = new HashMap();
View Full Code Here

      if (!this.initialDumpAsXml)
      return oldContent;
      SqlInfo sqlInfo = new SqlInfo(this.info);
      SqlDescription description = new SqlDescription(this.info);
      description.setCommand(INITIAL_XML_CMD);
      ClientProperty prop = (ClientProperty)clientProperties.get(FILENAME_ATTR);
     
      if (prop != null)
         description.setAttribute(prop);
      prop = (ClientProperty)clientProperties.get(TIMESTAMP_ATTR);
     
      if (prop != null)
         description.setAttribute(prop);

      prop = XBMessage.get(XBConnectionMetaData.JMSX_GROUP_SEQ, clientProperties);
      if (prop != null) {
         prop = new ClientProperty(XBConnectionMetaData.JMSX_GROUP_SEQ, null, null, prop.getStringValue());
         description.setAttribute(prop);
      }
     
      prop = XBMessage.get(XBConnectionMetaData.JMSX_GROUP_EOF, clientProperties);
      if (prop != null) {
         prop = new ClientProperty(XBConnectionMetaData.JMSX_GROUP_EOF, null, null, prop.getStringValue());
         description.setAttribute(prop);
      }
     
      prop = XBMessage.get(XBConnectionMetaData.JMSX_GROUP_EX, clientProperties);
      if (prop != null) {
         prop = new ClientProperty(XBConnectionMetaData.JMSX_GROUP_EX, null, null, prop.getStringValue());
         description.setAttribute(prop);
      }
     
      prop = new ClientProperty(DUMP_CONTENT_ATTR, oldContent);
      description.setAttribute(prop);
      sqlInfo.setDescription(description);
      String ret = sqlInfo.toXml("");
      if (log.isLoggable(Level.FINEST))
         log.finest(ret);
View Full Code Here

   private static final void addCopyOfAttributesAndColumns(SqlRow source, SqlRow dest) {
      String[] names = source.getAttributeNames();
      if (names != null && names.length > 0) {
         for (int i=0; i < names.length; i++) {
            ClientProperty prop = source.getAttribute(names[i]);
            ClientProperty newProp = new ClientProperty(prop.getName(), prop.getType(), prop.getEncoding());
            newProp.setValueRaw(prop.getValueRaw());
            dest.setAttribute(newProp);
         }
      }
      names = source.getColumnNames();
      if (names != null && names.length > 0) {
         for (int i=0; i < names.length; i++) {
            ClientProperty prop = source.getColumn(names[i]);
            ClientProperty newProp = new ClientProperty(prop.getName(), prop.getType(), prop.getEncoding());
            newProp.setValueRaw(prop.getValueRaw());
            dest.setColumn(newProp);
         }
      }
   }
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.qos.ClientProperty

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.