Package org.xmlBlaster.contrib.replication

Examples of org.xmlBlaster.contrib.replication.TableToWatchInfo


         // check if function and trigger are necessary (they are only if the
         // table has to be replicated.
         // it does not need this if the table only needs an initial synchronization.
         if (this.isDbWriteable) {
            TableToWatchInfo tableToWatch = getTableToWatch(conn, catalog, schema, table);
           
            if (tableToWatch != null) {
               boolean addTrigger = tableToWatch.isReplicate();
               if (addTrigger) { // create the function and trigger here
                  addTrigger(conn, tableToWatch, sqlInfo, false);
               }
               else
                  log.info("trigger will not be added since entry '" + tableToWatch.toXml() + "' will not be replicated");
            }
            else {
               log.info("table to watch '" + table + "' not found");
            }
         }
View Full Code Here


         if (!isSchemaRegistered(conn, schema)) {
            log.info("schema '" + schema + "' is not registered, going to add it");
            addSchemaToWatch(conn, catalog, schema);
         }
        
         TableToWatchInfo tableToWatch = getTableToWatch(conn, catalog, schema, tableName);
         if (!conn.getAutoCommit())
            conn.commit(); // to be sure it is a new transaction
         if (!force && tableToWatch != null && tableToWatch.isStatusOk(this, conn)) {
            // send it manually since table exits already and trigger is OK.
            log.info("table '" + tableName + "' is already registered, will add directly an entry in the ENTRIES Table");
            String destAttrName = "?";
            if (destinations == null || destinations.length == 0)
               destAttrName = "NULL";
            String sql = "{? = call " + this.replPrefix + "check_tables(NULL,?,?,?," + destAttrName + ")}"; // name text, content text)
            CallableStatement st = conn.prepareCall(sql);
            st.setString(2, schema);
            st.setString(3, tableName);
            st.setString(4, ReplicationConstants.CREATE_ACTION);
            if (destinations != null && destinations.length != 0) {
               String post = "</desc>";
               if (forceSend)
                  post = "<attr id='_forceSend'>true</attr>" + post;
               String destinationTxt = "<desc><attr id='_destination'>" + toString(destinations) + "</attr>" + post;
               st.setString(5, destinationTxt);
            }
            st.registerOutParameter(1, Types.VARCHAR);
            st.executeQuery();
            st.close();
            return false;
         }
         /*
         if (force) {
            if (isTableRegistered(conn, tableToWatch)) {
               log.info("table '" + tableName + "' is already registered and 'force' has been choosed. Will set its status to 'REMOVE'");
               tableToWatch.setStatus(TableToWatchInfo.STATUS_REMOVE);
               tableToWatch.storeStatus(this.replPrefix, this.dbPool);
            }
         }
         */
         // then it is either not OK or force true. or null
         if (tableToWatch != null) // then it is either not OK or force true. In both cases we need to remove old entry
            tableToWatch.removeFromDb(this.replPrefix, this.dbPool);
        
         if (triggerName == null)
            triggerName = this.replPrefix + tmp;
         triggerName = this.dbMetaHelper.getIdentifier(triggerName);
        
         long debug = 0;
         TableToWatchInfo finalTableToWatch = new TableToWatchInfo(catalog, schema, tableName);
         finalTableToWatch.setActions(actions);
         finalTableToWatch.setTrigger(triggerName);
         finalTableToWatch.setDebug((int)debug);
         finalTableToWatch.setReplKey(tmp);
         finalTableToWatch.store(this.replPrefix, this.dbPool, conn);
        
         return true;
      }
      catch (Throwable ex) {
         conn = removeFromPool(conn, ROLLBACK_YES);
View Full Code Here

         try {
            boolean force = false;
            String destination = null;
            boolean forceSend = false;
            TableToWatchInfo tableToWatch = new TableToWatchInfo(null, this.specificHelper.getOwnSchema(pool), tableName);
            tableToWatch.setActions("IDU");
            getDbSpecific().addTableToWatch(tableToWatch, force, new String[] { destination }, forceSend);
         }
         catch (Exception ex) {
            ex.printStackTrace();
            assertTrue("Testing if addition of table '" + tableName + "' to tables to replicate (" + this.replPrefix + "tables) succeeded: An exception should not occur here", false);
View Full Code Here

         String sql = null;
         try {
            boolean force = false;
            String destination = null;
            boolean forceSend = false;
            TableToWatchInfo tableToWatch = new TableToWatchInfo(null, this.specificHelper.getOwnSchema(pool), tableName);
            tableToWatch.setActions("IDU");
            getDbSpecific().addTableToWatch(tableToWatch, force, new String[] { destination }, forceSend);
         }
         catch (Exception ex) {
            ex.printStackTrace();
            assertTrue("Testing if addition of table '" + tableName + "' to tables to replicate (" + this.replPrefix + "tables) succeeded: An exception should not occur here", false);
View Full Code Here

         String sql = null;
         try {
            boolean force = false;
            String destination = null;
            boolean forceSend = false;
            TableToWatchInfo tableToWatch = new TableToWatchInfo(null, this.specificHelper.getOwnSchema(pool), tableName);
            tableToWatch.setActions("IDU");
            getDbSpecific().addTableToWatch(tableToWatch, force, new String[] { destination }, forceSend);
         }
         catch (Exception ex) {
            ex.printStackTrace();
            assertTrue("Testing if addition of table '" + tableName + "' to tables to replicate (" + this.replPrefix + "tables) succeeded: An exception should not occur here", false);
View Full Code Here

         String sql = null;
         try {
            boolean force = false;
            String destination = null;
            boolean forceSend = false;
            TableToWatchInfo tableToWatch = new TableToWatchInfo(null, this.specificHelper.getOwnSchema(pool), tableName);
            tableToWatch.setActions("IDU");
            getDbSpecific().addTableToWatch(tableToWatch, force, new String[] { destination }, forceSend);
         }
         catch (Exception ex) {
            ex.printStackTrace();
            assertTrue("Testing if addition of table '" + tableName + "' to tables to replicate (" + this.replPrefix + "tables) succeeded: An exception should not occur here", false);
View Full Code Here

         String sql = null;
         try {
            boolean force = false;
            String destination = null;
            boolean forceSend = false;
            TableToWatchInfo tableToWatch = new TableToWatchInfo(null, this.specificHelper.getOwnSchema(pool), tableName);
            tableToWatch.setActions("IDU");
            getDbSpecific().addTableToWatch(tableToWatch, force, new String[] { destination }, forceSend);
         }
         catch (Exception ex) {
            ex.printStackTrace();
            assertTrue("Testing if addition of table '" + tableName + "' to tables to replicate (" + this.replPrefix + "tables) succeeded: An exception should not occur here", false);
View Full Code Here

         String sql = null;
         try {
            boolean force = false;
            String destination = null;
            boolean forceSend = false;
            TableToWatchInfo tableToWatch = new TableToWatchInfo(null, this.specificHelper.getOwnSchema(pool), tableName);
            tableToWatch.setActions("IDU");
            getDbSpecific().addTableToWatch(tableToWatch, force, new String[] { destination }, forceSend);
         }
         catch (Exception ex) {
            ex.printStackTrace();
            assertTrue("Testing if addition of table '" + tableName + "' to tables to replicate (" + this.replPrefix + "tables) succeeded: An exception should not occur here", false);
View Full Code Here

         String sql = null;
         try {
            boolean force = false;
            String destination = null;
            boolean forceSend = false;
            TableToWatchInfo tableToWatch = new TableToWatchInfo(null, this.specificHelper.getOwnSchema(pool), tableName);
            tableToWatch.setActions("IDU");
            getDbSpecific().addTableToWatch(tableToWatch, force, new String[] { destination }, forceSend);
         }
         catch (Exception ex) {
            ex.printStackTrace();
            assertTrue("Testing if addition of table '" + tableName + "' to tables to replicate (" + this.replPrefix + "tables) succeeded: An exception should not occur here", false);
View Full Code Here

         String sql = null;
         try {
            boolean force = false;
            String destination = null;
            boolean forceSend = false;
            TableToWatchInfo tableToWatch = new TableToWatchInfo(null, this.specificHelper.getOwnSchema(pool), tableName);
            tableToWatch.setActions("IDU");
            getDbSpecific().addTableToWatch(tableToWatch, force, new String[] { destination }, forceSend);
         }
         catch (Exception ex) {
            ex.printStackTrace();
            assertTrue("Testing if addition of table '" + tableName + "' to tables to replicate (" + this.replPrefix + "tables) succeeded: An exception should not occur here", false);
View Full Code Here

TOP

Related Classes of org.xmlBlaster.contrib.replication.TableToWatchInfo

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.