Package de.innovationgate.webgate.api

Examples of de.innovationgate.webgate.api.WGDatabase$WGDatabaseStatistics


            String dbkey = getOption("dbkey");
            if (dbkey == null) {
                throw new TaskException("No dbkey provided");
            }
           
            WGDatabase db = (WGDatabase) jobContext.getWgaCore().getContentdbs().get(dbkey);
            if (db == null) {
                throw new TaskException("Database of key " + dbkey + " not connected");
            }
            db.openSession();
           
            String fileName = getOption("filename");
            file = new File(fileName);
            if (!file.exists()) {
                throw new TaskException("Dump file does not exist :" + file.getPath());
View Full Code Here


            String dbkey = (String) getOption("dbkey");
            if (dbkey == null) {
                throw new TaskException("No dbkey provided");
            }
           
            WGDatabase db = (WGDatabase) jobContext.getWgaCore().getContentdbs().get(dbkey);
            if (db == null) {
                throw new TaskException("Database of key " + dbkey + " not connected");
            }
            db.openSession();
           
            String filter = (String) getOption("filter");
            String fileName = (String) getOption("filename");
            if (fileName == null) {
                throw new TaskException("Option 'filename' not specified");
View Full Code Here

 
  public static String getViewList(javax.servlet.jsp.PageContext pageContext) throws WGException {
    String dbKey = pageContext.getRequest().getParameter("dbKey");
    //String newBI = pageContext.getRequest().getParameter("NewBI");
    if(dbKey == null) return "";
    WGDatabase database = getDB(pageContext,dbKey);
       
    //String username = database.getSessionContext().getUser();
    boolean isAuthor = (database.getSessionContext().getAccessLevel() > WGDatabase.ACCESSLEVEL_NOACCESS);
    boolean isEditor = (database.getSessionContext().getAccessLevel() >= WGDatabase.ACCESSLEVEL_EDITOR);
    //boolean isDesigner = (database.getSessionContext().getAccessLevel() >= WGDatabase.ACCESSLEVEL_EDITOR_DESIGNER);
    StringBuffer html = new StringBuffer("");   
   
    /*
    int majVer = de.innovationgate.wgpublisher.WGACore.WGAPUBLISHER_MAJOR_VERSION;
View Full Code Here

    if(dbKey == null) return "<option>Missing Parameter dbKey</option>";
    if(helper == null) return "<option>Appliction was not initialized</option>";
    if(helper.getDatabaseKeys() == null) return "<option>No DBs</option>";
    if(helper.getDatabaseKeys().size()== 0) return "<option>No DBs</option>";
 
    WGDatabase database = helper.openDatabase(dbKey);   
   
    if(database == null) return "<option>Database with dbKey " + dbKey + " not found</option>";
   
    String domain = (String)database.getAttribute(de.innovationgate.wgpublisher.WGACore.DBATTRIB_DOMAIN);
    WGSessionContext sc = database.getSessionContext();
    String username = sc.getUser();
    String password = sc.getPassword();
   
    Iterator dbs = null;
    WGACore wgaCore = helper.getCore();
    List allDBs = new ArrayList(wgaCore.getContentdbs().values());
       
    Collections.sort(allDBs , new dbComparator());
    WGFactory.getInstance().closeSessions();
 
    dbs = allDBs.iterator();
 
    StringBuffer html = new StringBuffer("");
    String dbk = "";         
   
    while (dbs.hasNext()) {     
      boolean hasAccess = false;   
      database = (WGDatabase) dbs.next();
     
      if( database.hasFeature(WGDatabase.FEATURE_FULLCONTENTFEATURES)  ){
         
        database.openSession(username, password);
       
        if( database.isSessionOpen() ){     
          hasAccess = true; //wgaCore.isAuthor(database, pageContext.getRequest().getRemoteAddr(), LicenseManager.LICENSENAME_AUTHOR_BI);
        }   
     
        String dbDom = (String)database.getAttribute(de.innovationgate.wgpublisher.WGACore.DBATTRIB_DOMAIN);       
        if( dbDom != null && dbDom.equalsIgnoreCase(domain) ){
          dbk = (String) database.getAttribute(WGACore.DBATTRIB_DBKEY);
          if( database.hasFeature(WGDatabase.FEATURE_EDITABLE)
            && database.hasFeature(WGDatabase.FEATURE_HIERARCHICAL)
            && database.getRoles().contains(WGDatabase.ROLE_DESIGN)){       
           
              html.append("<option class=\"standardForm\" value=\"");
              html.append("?dbKey=");
              html.append(dbk);
           
              String sLogger = WGACore.DBATTRIB_LOGGER;
              html.append("&domain=");
              html.append(database.getAttribute(WGACore.DBATTRIB_DOMAIN));
           
              //html.append("&dominoURL=");
              //html.append(database.getCreationOptions().get(de.innovationgate.webgate.api.domino.WGDatabaseImpl.COPTION_DOMINO_URL));
              if(hasAccess) {
                html.append("&access=1");
              }
              else{             
                html.append("&access=0");     
              }
   
              html.append("\"");
              if(database.getAttribute(WGACore.DBATTRIB_DBKEY).equals(dbKey)){ 
                html.append(" selected")
              }
              html.append(">");
           
              if(hasAccess) {
                html.append(database.getTitle());
                //html.append(username);
                html.append(" (")
                html.append(dbk);
                html.append(")");             
              }
View Full Code Here

  private static class dbComparator implements Comparator{
   
    public int compare(Object o1, Object o2){
      if ( o1 instanceof WGDatabase && o2 instanceof WGDatabase ) {
     
        WGDatabase wg1 = (WGDatabase) o1;
        WGDatabase wg2 = (WGDatabase) o2;
               
        String title1 = wg1.getTitle();
        String title2 = wg2.getTitle();
     
        if ( title1 != null && title2 != null ) {
          return        
            title1.compareTo( title2 );
        }       
View Full Code Here

     
  public static String getUsername(javax.servlet.jsp.PageContext pageContext, String dbKey, String format) throws WGException {
   
    HashMap hm = (HashMap)pageContext.getSession().getAttribute(de.innovationgate.wgpublisher.WGPDispatcher.SESSION_LOGINS);
   
    WGDatabase db = getDB(pageContext, dbKey);
   
    if(hm==null) return "";
    if(hm.isEmpty()) return "";
    if(dbKey.equals("")) return "";             

     
    String fullUsername = db.getSessionContext().getUser();
   
    WGFactory.getInstance().closeSessions();
   
    if(format!=null){
      if(format.equals("")){
View Full Code Here

  }
 
  public static String getPassword(javax.servlet.jsp.PageContext pageContext, String dbKey) throws WGException  {
   
    HashMap hm = (HashMap) pageContext.getSession().getAttribute(de.innovationgate.wgpublisher.WGPDispatcher.SESSION_LOGINS);
    WGDatabase db = getDB(pageContext, dbKey)
   
    String domain = (String) db.getAttribute(WGACore.DBATTRIB_DOMAIN);
    if(hm==null) return "";
    if(hm.isEmpty()) return "";
         
    DBLoginInfo li = (DBLoginInfo) hm.get(domain);
    return li.getPassword();
View Full Code Here

    if (elementIdx >= elements.size()) {
      return elementIdx;
    }
       
        String designDBKey = core.getDesignDatabaseKey(this.databaseKey);
        WGDatabase originalDesignDB = (WGDatabase) core.getContentdbs().get(designDBKey);
   
    String layoutKeyCandidate = ((String) elements.get(elementIdx)).toLowerCase();
   
    if (layoutKeyCandidate.equals("default")) {
      layoutKeyCandidate = null;
View Full Code Here

            // In browser interface we add a custom value to the cache key, so BI caches and Non-Bi caches differ (B000059DA)
            if (status.isBrowserInterface()) {
                status._currentCacheKey = status._currentCacheKey + "###BROWSER-INTERFACE";
            }

            WGDatabase db = this.getTMLContext().content().getDatabase();

            // Look if the current cache is in evaluation right now, wait for 10 seconds
            int sleepTimes = 0;      
            String cacheLockKey = buildCacheLockKey();
            int waitTimeout = 60;
            try {
                waitTimeout = Integer.parseInt(getWaittimeout());
            }
            catch (NumberFormatException e) {
                addWarning("Cannot parse waittimeout as number: " + getWaittimeout());
            }
           
            if (currentlyEvaluatedCaches.containsKey(cacheLockKey)) {
               
                // If we are allowed to serve stale data while the cache processes, we serve the current content of the cache
                boolean serveStaleData = db.getBooleanAttribute(WGACore.DBATTRIB_WEBTMLCACHE_SERVESTALEDATA, true);
                if (serveStaleData) {
                    String content = null;
                    try {
                        content = getCore().getWebTMLCache().getCache(db.getDbReference(), status._currentCacheId, status._currentCacheKey, new Date(Long.MIN_VALUE));
                    }
                    catch (CacheException e) {
                        getTMLContext().getlog().error("Exception retrieving WebTML cache data for key " + getTMLContext().db().getDbReference() + "/" + status._currentCacheId + "/" + status._currentCacheKey, e);
                    }
                    if (content != null) {
                       
                        // Tell all ranges above us to have a cache latency of 1 minute, so cached stale data is updated after this time
                        Range.Status ancestor = status;
                        while ((ancestor = (Range.Status) ancestor.getAncestorTag(Range.class)) != null) {
                            ancestor.cacheLatency = 1;
                        }
                       
                        status._currentCacheKey = null;
                        status._currentCacheId = null;
                        status.servedStale = true;
                        this.setEvalBody(false);
                        this.setResult(content);
                        return;
                    }
                }
               
                // Else we wait until cache calculation is completed or we run into the timeout
                while (currentlyEvaluatedCaches.containsKey(cacheLockKey)) {
                   
                    Long cacheTime = (Long) currentlyEvaluatedCaches.get(cacheLockKey);
                    if( cacheTime != null ){
                    long cacheTimeout = cacheTime.longValue() + (1000 * 60 * 15);
                      if (System.currentTimeMillis() > cacheTimeout) {
                          log.warn("Former cache creation of key '" + status._currentCacheKey + "' took more than 15 minutes. Removing synchronisation lock now");
                          currentlyEvaluatedCaches.remove(cacheLockKey);
                          break;
                      }
                    }
                    try {
                        Thread.sleep(1000);
                    }
                    catch (InterruptedException e) {
                    }
                    sleepTimes++;
                    if (sleepTimes > waitTimeout) {
                        log.warn("Waiting for cache creation of key '" + cacheLockKey + "' timed out after " + waitTimeout + " second(s). Tag is canceled.");
                        this.addWarning("Waiting for cache creation of key '" + cacheLockKey + "' timed out after " + waitTimeout + " second(s). Tag is canceled.", true);
                        this.setEvalBody(false);
                        this.setCancelTag(true);
                        this.setResult("This section is currently recalculated. Please try again later.");
                        return;
                    }
                }
            }
           
            currentlyEvaluatedCaches.put(cacheLockKey, new Long(System.currentTimeMillis()));

         
            // Try to retrieve cache
            Date testedDate = getCore().getDeployer().getLastChangedOrDeployed(db);
            String content = null;
            try {
                content = getCore().getWebTMLCache().getCache(db.getDbReference(), status._currentCacheId, status._currentCacheKey, testedDate);
            }
            catch (CacheException e) {
                getTMLContext().getlog().error("Exception retrieving WebTML cache data for key "  + getTMLContext().db().getDbReference() + "/" + status._currentCacheId + "/" + status._currentCacheKey, e);
            }
           
View Full Code Here

                catch (JDBCConnectionException e) {
                }
            }
        }
       
        WGDatabase importSource = null;
        if (migrateToCS5) {
            try {
                importSource = prepareCSDump(db, getHsqlBaseFile(path), user, pwd, csVersion);
            }
            catch (Exception e) {
View Full Code Here

TOP

Related Classes of de.innovationgate.webgate.api.WGDatabase$WGDatabaseStatistics

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.