Package de.innovationgate.webgate.api.utils

Examples of de.innovationgate.webgate.api.utils.MasterSessionTask


        // In case of a design changed event by a design provider we must spawn
        // the processing to a separate thread, bc. we cannot be sure that the
        // consumer db that uses the provider was opened, yet we cannot open it
        // in the same thread bc. this might be a security leak
       
        MasterSessionTask task = new MasterSessionTask(event.getDatabase()) {
            protected void exec(WGDatabase db) throws Throwable {
                try {
                    checkForUpdates(db);
                }
                catch (Exception e) {
                    _log.error("Error checking for system container update", e);
                }
            }
        };
        task.run();
               
    }
View Full Code Here


            if (!Groq.selectFrom(event.getUpdateLogs()).wherePropertyEquals("documentKey", SYSTEMFC_DOCKEY).hasNext()) {
                return;
            }
           
            // If so, we reread the definition in a master session task
            MasterSessionTask task = new MasterSessionTask(event.getDatabase()) {
                protected void exec(WGDatabase db) throws Throwable {
                    WGFileContainer system = db.getFileContainer("system");
                    if (system != null && system.getLastModified().getTime() > _definitionTime && system.hasFile(MODEL_FILE)) {
                        _core.getLog().info("Updating HDB model for database " + db.getDbReference());
                        readDefinition(system);
                    }
                }
            };
           
            task.runWithExceptions();
                  
        }
        catch (Throwable e) {
            _core.getLog().error("Error updating HDB model for database" + event.getDatabase().getDbReference(), e);
        }
View Full Code Here

        }

        boolean result = getCore().commitTransaction();
        if (result == true) {
            getSessionContext().setTransactionActive(false);
            MasterSessionTask performDBUpdates = new MasterSessionTask(this) {
               
                @Override
                protected void exec(WGDatabase db) throws Throwable {
                    db.checkDatabaseUpdates();                   
                }
            };
            try {
                performDBUpdates.runWithExceptions();
            }
            catch (Throwable e) {
                throw new WGBackendException("Unable to perform db update on transaction commit.", e);
            }
            return true;
View Full Code Here

        // cache management will happen automatically by WGDocument.save()
        if (designProvider instanceof WGVirtualDesignProvider) {
            return;
        }

        MasterSessionTask task = new MasterSessionTask(this) {
            protected void exec(WGDatabase db) throws Throwable {
                processChanges(event.getUpdateLogs());
            }
        };

        if (!task.run()) {
            WGFactory.getLogger().error("Exception on design change processing", task.getThrowable());
        }
    }
View Full Code Here

                   _notifying = true;
               }
              
               // Clear the cache of the slave db
               if (_slaveDB != null && _slaveDB.isConnected()) {
                   MasterSessionTask task = new MasterSessionTask(_slaveDB) {
                       protected void exec(WGDatabase db) throws Throwable {
                           fireUpdateChangeEvent(new WGDesignChangeEvent(DBDesignProvider.this, db, new ArrayList()));
                           db.refresh();
                       }
                   };
                   task.run();
               }
               return true;
    
           }
           else {
View Full Code Here

     * @throws WGAPIException
     */
    public void changeContentType(WGContentType contentType) throws WGAPIException {
     
      // master task to check for unreleased content
      MasterSessionTask checkUnreleasedContent = new MasterSessionTask(getDatabase()) {
      protected void exec(WGDatabase db) throws Throwable {
          Iterator contents = getAllContent().iterator();
          while (contents.hasNext()) {
            WGContent content = (WGContent) contents.next();
            if (!content.getStatus().equals(WGContent.STATUS_RELEASE)) {
              throw new WGIllegalStateException("ContentType cannot be changed bc. there is unreleased content in draft or review state.");
            }       
          }
       
      }       
      };
     
      // check for unreleased content
      try {
      checkUnreleasedContent.runWithExceptions();
    } catch (WGAPIException e)  {
      throw e;
    } catch (Throwable e) {
      throw new WGAPIException(e.getMessage(), e);
    }
View Full Code Here

                WGFactory.getLogger().error("Exception retrieving content count from " + getDocumentKey(), e);
            }
           
           
            // Techique 2: Retrieve number of contents from master session
            MasterSessionTask task = new MasterSessionTask(getDatabase()) {
                protected void exec(WGDatabase db) throws Throwable {
                    setResult(new Integer(WGStructEntry.this.getAllContent(true).size()));
                }
            };
           
            if (task.run() == true) {
                contentCount = ((Integer) task.getResult());;
            }
            else {
                throw new WGAPIException("Exception retrieving content count", task.getThrowable());
            }
        }
       
        return contentCount.intValue();
       
View Full Code Here

TOP

Related Classes of de.innovationgate.webgate.api.utils.MasterSessionTask

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.