Package org.infoglue.deliver.util

Examples of org.infoglue.deliver.util.Timer


      if(componentModelClassName != null && !componentModelClassName.equals(""))
      {
        templateController.getDeliveryContext().getUsageListeners().add(templateController.getComponentLogic().getComponentDeliveryContext());
        try
        {
          Timer t = new Timer();
          DigitalAssetVO asset = templateController.getAsset(component.getContentId(), "jar");
         
          String path = templateController.getAssetFilePathForAssetWithId(asset.getId());
          if(logger.isDebugEnabled())
            logger.debug("path: " + path);
          if(path != null && !path.equals(""))
          {
            try
            {
              File jarFile = new File(path);
              if(logger.isDebugEnabled())
                logger.debug("jarFile:" + jarFile.exists());
              URL url = jarFile.toURL();
              URLClassLoader child = new URLClassLoader(new URL[]{url}, this.getClass().getClassLoader());

              Class c = child.loadClass(componentModelClassName);
              boolean isOk = ComponentModel.class.isAssignableFrom(c);
              if(logger.isDebugEnabled())
                logger.debug("isOk:" + isOk + " for " + componentModelClassName);
              if(isOk)
              {
                if(logger.isDebugEnabled())
                  logger.debug("Calling prepare on '" + componentModelClassName + "'");
                ComponentModel componentModel = (ComponentModel)c.newInstance();
                componentModel.prepare(componentString, templateController, component.getModel());
              }
            }
            catch (Exception e)
            {
              logger.error("Failed loading custom class from asset JAR. Trying normal class loader. Error:" + e.getMessage());
              ComponentModel componentModel = (ComponentModel)Thread.currentThread().getContextClassLoader().loadClass(componentModelClassName).newInstance();
              componentModel.prepare(componentString, templateController, component.getModel());
            }
          }
          else
          {
            ComponentModel componentModel = (ComponentModel)Thread.currentThread().getContextClassLoader().loadClass(componentModelClassName).newInstance();
            componentModel.prepare(componentString, templateController, component.getModel());
          }
          if(logger.isDebugEnabled())
            t.printElapsedTime("Invoking custome class took");
        }
        catch (Exception e)
        {
          logger.error("The component '" + component.getName() + "' stated that class: " + componentModelClassName + " should be used as model. An exception was thrown when it was invoked: " + e.getMessage(), e)
        }
View Full Code Here


      String mapKey = "" + parentSiteNodeVO.getId() + "_" + componentXML.hashCode() + "_" + id + "_"  + siteNodeId + "_" + component.getId() + "_components";
     
      Map components = (Map)CacheController.getCachedObjectFromAdvancedCache("componentPropertyCache", mapKey);
      if(components == null)
      {
        Timer t = new Timer();
       
        //DOM4j
        /*
        Document document = domBuilder.getDocument(componentXML);
        components = getComponentWithDOM4j(db, document.getRootElement(), id, templateController, component);
        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("INHERITING COMPONENTS WITH DOM4J", t.getElapsedTime());
        */
       
           //XPP3
            XmlInfosetBuilder builder = XmlInfosetBuilder.newInstance();
            XmlDocument doc = builder.parseReader(new StringReader( componentXML ) );
        components = getComponentWithXPP3(db, builder, doc.getDocumentElement(), id, templateController, component);
        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("INHERITING COMPONENTS WITH XPP3", t.getElapsedTime());
       
        //System.out.println("components:" + components);
        String hashCode = "" + components.get(id + "_hashCode");
        String path = "" + components.get(id + "_xpath");
        templateController.getDeliveryContext().addUsedContent("content_" + parentSiteNodeVO.getMetaInfoContentId() + "_ComponentStructureDependency");
View Full Code Here

      else
        components = (List)componentsCandidate;
    }
    else
    {
      Timer t = new Timer();
     
      //logger.info("key:" + key);
      String componentXPath = "component[@name='" + slotName + "']";
      //logger.info("componentXPath:" + componentXPath);
     
View Full Code Here

      return repositories;
    }

  public Set<RepositoryVO> getRepositoryVOListFromServerName(Database db, String serverName, String portNumber, String repositoryName, String url) throws SystemException, Exception
    {
    Timer t = new Timer();
    t.setActive(false);
   
      Set<RepositoryVO> repositories = new HashSet<RepositoryVO>();
     
      String niceURIEncoding = CmsPropertyHandler.getNiceURIEncoding();
        if(niceURIEncoding == null || niceURIEncoding.length() == 0)
            niceURIEncoding = "UTF-8";
       
      List cachedRepositories = (List)CacheController.getCachedObject("masterRepository", "allDNSRepositories");
    if(cachedRepositories == null)
    {
        cachedRepositories = new ArrayList();

          OQLQuery oql = db.getOQLQuery( "SELECT r FROM org.infoglue.cms.entities.management.impl.simple.RepositoryImpl r WHERE is_defined(r.dnsName) ORDER BY r.repositoryId");
          QueryResults results = oql.execute(Database.READONLY);
   
          while (results.hasMore())
          {
              Repository repository = (Repository) results.next();
              cachedRepositories.add(repository.getValueObject());
          }
         
          results.close();
      oql.close();

      if(cachedRepositories.size() > 0)
        CacheController.cacheObject("masterRepository", "allDNSRepositories", cachedRepositories);
    }
   
    Iterator repositoriesIterator = cachedRepositories.iterator();
        while (repositoriesIterator.hasNext())
        {
            RepositoryVO repositoryVO = (RepositoryVO) repositoriesIterator.next();
            String fullDnsNames = repositoryVO.getDnsName();

            String workingPath = null;
            int workingPathIndex = fullDnsNames.indexOf("workingPath=");
            if(workingPathIndex > -1)
            {
              workingPath = fullDnsNames.substring(workingPathIndex + 12);
              int workingPathEndIndex = workingPath.indexOf(",");
              if(workingPathEndIndex > -1)
                workingPath = workingPath.substring(0, workingPathEndIndex);
            }
            String livePath = null;
            int livePathIndex = fullDnsNames.indexOf("path=");
            if(livePathIndex > -1)
            {
              livePath = fullDnsNames.substring(livePathIndex + 5);
              int livePathEndIndex = livePath.indexOf(",");
              if(livePathEndIndex > -1)
                livePath = livePath.substring(0, livePathEndIndex);
            }

            if(CmsPropertyHandler.getOperatingMode().equals("0"))
            {
              String workingPathAlternative1 = workingPath;
              if(workingPathAlternative1 != null)
                workingPathAlternative1 = URLEncoder.encode(workingPathAlternative1, niceURIEncoding);
              String workingPathAlternative2 = workingPath;
              if(workingPathAlternative2 != null)
                workingPathAlternative2 = URLEncoder.encode(workingPathAlternative2, (niceURIEncoding.indexOf("8859") > -1 ? "utf-8" : "iso-8859-1")).replaceAll("\\+", "%20");
              if(workingPath != null && url.indexOf(workingPath) == -1 && url.indexOf(workingPathAlternative1) == -1 && url.indexOf(workingPathAlternative2) == -1)
              {
                logger.info("This repo had a working path but the url did not include any sign of it - let's skip it");
                continue;
              }
          }
            else if(CmsPropertyHandler.getOperatingMode().equals("3"))
            {
              String livePathAlternative1 = livePath;
              if(livePathAlternative1 != null)
                livePathAlternative1 = URLEncoder.encode(livePathAlternative1, niceURIEncoding);
              String livePathAlternative2 = livePath;
              if(livePathAlternative2 != null)
                livePathAlternative2 = URLEncoder.encode(livePathAlternative2, (niceURIEncoding.indexOf("8859") > -1 ? "utf-8" : "iso-8859-1")).replaceAll("\\+", "%20");
             
              if(livePath != null && url.indexOf(livePath) == -1 && url.indexOf(livePathAlternative1) == -1 && url.indexOf(livePathAlternative2) == -1)
              {
                logger.info("This repo had a live path but the url did not include any sign of it - let's skip it");
                continue;
              }
          }
           
            String[] dnsNames = splitStrings(fullDnsNames.replaceAll("\\[.*?\\]", ""));

            if(logger.isInfoEnabled())
              logger.info("dnsNames:" + dnsNames);
           
            for (int i=0;i<dnsNames.length;i++)
            {
              if(logger.isInfoEnabled())
                logger.info("dnsNames["+i+"]:" + dnsNames[i]);
                String dnsName = dnsNames[i];
               
                if(dnsName.indexOf("undefined") > -1)
                  continue;
               
                int index = dnsName.indexOf("working=,");
                int indexMode = dnsName.indexOf("working=");
                if(CmsPropertyHandler.getOperatingMode().equals("2"))
                {   
                  index = dnsName.indexOf("preview=,");
                  indexMode = dnsName.indexOf("preview=");
                }
                else if(CmsPropertyHandler.getOperatingMode().equals("3"))
                {
                  index = dnsName.indexOf("live=,");
                  indexMode = dnsName.indexOf("live=");
                }

                boolean noHostName = (indexMode == -1);
               
                if(logger.isInfoEnabled())
                  logger.info("" + index + ":" + indexMode + ":" + noHostName + ":" + dnsName + " for operationMode:" + CmsPropertyHandler.getOperatingMode());
              if(/*!noHostName && */index == -1 && indexMode == -1 && dnsName.indexOf("=") > -1)
              {
              if(logger.isInfoEnabled())
                  logger.info("Skipping this name [" + dnsName + "] as it was not a dnsName targeted toward this mode.");
                continue;
              }
             
              int protocolIndex = dnsName.indexOf("://");
                if(protocolIndex > -1)
                    dnsName = dnsName.substring(protocolIndex + 3);

              int portIndex = dnsName.indexOf(":");
                if(portIndex > -1)
                    dnsName = dnsName.substring(0, portIndex);

                logger.info("Matching only server name - removed protocol if there:" + dnsName);
                if(logger.isInfoEnabled())
                  logger.info("dnsName:" + dnsName + ", serverName:" + serverName + ", repositoryName:" + repositoryName);
               
                if(logger.isInfoEnabled())
                {
                  logger.info("dnsName.indexOf(':'):" + dnsName.indexOf(":"));
                  logger.info("dnsName.indexOf(serverName) == 0:" + dnsName.indexOf(serverName));
                  logger.info("dnsName.indexOf(serverName + ':' + portNumber):" + dnsName.indexOf(serverName + ":" + portNumber));
                  logger.info("index:" + index);
                  logger.info("indexMode:" + indexMode);
                }
               
              if((dnsName.indexOf(":") == -1 && dnsName.indexOf(serverName) == 0) || dnsName.indexOf(serverName + ":" + portNumber) == 0 || index > -1 || indexMode == -1)
                {
                  if(repositoryName != null && repositoryName.length() > 0)
                  {
                      logger.info("Has to check repositoryName also:" + repositoryVO.getName() + "=" + repositoryName + "=" + serverName);
                        if(repositoryVO.getName().equalsIgnoreCase(repositoryName))
                        {
                          if((dnsName.indexOf(":") == -1 && dnsName.indexOf(serverName) == 0) || dnsName.indexOf(serverName + ":" + portNumber) == 0)
                          {
                            //System.out.println("Adding " + repositoryVO.getName() + ":" + dnsName);
                            if(logger.isInfoEnabled())
                                logger.info("Adding " + repositoryVO.getName());
            
                            repositories.add(repositoryVO);
                          }
                        }
                    }
                  else
                  {
                    logger.info("dnsName:" + dnsName);
                    logger.info("serverName:" + serverName);
                      if(dnsName.startsWith(serverName))
                      {
                        logger.info("Adding 2:" + repositoryVO.getName() + "=" + repositoryName + "=" + serverName);
                             repositories.add(repositoryVO);
                      }
                      /*
                      logger.warn("Adding 2:" + repositoryVO.getName() + "=" + repositoryName);
                    repositories.add(repositoryVO);
                    */
                  }
              }
            }
        }
       
        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("Getting all repos", t.getElapsedTime());

        return repositories;
    }
View Full Code Here

    return navTitle;
  }
 
    public Integer getSiteNodeId(Database db, InfoGluePrincipal infogluePrincipal, Integer repositoryId, String path, String attributeName, Integer parentSiteNodeId, Integer languageId, DeliveryContext deliveryContext) throws SystemException, Exception
    {
      Timer t = new Timer();
        /*
        logger.info("repositoryId:" + repositoryId);
        logger.info("navigationTitle:" + navigationTitle);
        logger.info("parentSiteNodeId:" + parentSiteNodeId);
        logger.info("languageId:" + languageId);
View Full Code Here

        //System.out.println("Returning cached");
        return siteNodeVOList;
      }
      else
      {
        Timer t = new Timer();
        
        ContentTypeDefinitionVO ctdVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithName("Meta info", db);
        List<ContentTypeAttribute> attributes = (List<ContentTypeAttribute>)ContentTypeDefinitionController.getController().getContentTypeAttributes(ctdVO.getSchemaValue());
       
          StringBuffer SQL = new StringBuffer();
        if(CmsPropertyHandler.getUseShortTableNames() != null && CmsPropertyHandler.getUseShortTableNames().equalsIgnoreCase("true"))
        {
           SQL.append("CALL SQL select sn.siNoId, sn.name, sn.publishDateTime, sn.expireDateTime, sn.isBranch, sn.parentsiNoId, sn.metaInfoContentId, sn.repositoryId, sn.siNoTypeDefId, sn.creator, (select count(*) from cmSiNo sn2 where sn2.parentsiNoId = sn.siNoId) AS childCount, snv.siNoVerId, snv.stateId, snv.isProtected, snv.versionModifier, snv.modifiedDateTime, cv.languageId, ");
           //SQL.append("concat ");
        //SQL.append("( ");
        //SQL.append("  concat ");
        //SQL.append("  ( ");
          
           /*
        StringBuffer attributesSB = new StringBuffer();
        int i = 0;
        for(ContentTypeAttribute attribute : attributes)
        {
          if(!attribute.getName().equals("ComponentStructure"))
          {
            attributesSB.append("   \n '");
            if(i > 0)
              attributesSB.append("igcomma");
         
            attributesSB.append("" + attribute.getName() + "='||SUBSTR(verValue,INSTR(verValue,'<" + attribute.getName() + "><![CDATA[')+" + (attribute.getName().length() + 11) + ",INSTR(verValue,']]></" + attribute.getName() + ">') - (INSTR(verValue,'<" + attribute.getName() + "><![CDATA[') + " + (attribute.getName().length() + 11) + ")) ||");
          }
          i++;
        }
        attributesSB.deleteCharAt(attributesSB.length()-1).deleteCharAt(attributesSB.length()-1);
        //System.out.println("attributesSB:" + attributesSB);
        SQL.append(attributesSB.toString());
        */
           SQL.append(" cv.verValue ");
        //SQL.append("  ) ");
        //SQL.append(") AS attributes ");
        SQL.append(" AS attributes ");
        SQL.append("from ");
        SQL.append("(");
        SQL.append("select sn1.siNoId, sn1.name, sn1.publishDateTime, sn1.expireDateTime, sn1.isBranch, sn1.parentsiNoId, sn1.metaInfoContentId, sn1.repositoryId, sn1.siNoTypeDefId, sn1.creator from cmSiNo sn1 where sn1.parentsiNoId = " + siteNodeId + " ");
        if(levelsToPopulate > 1)
        {
          SQL.append("UNION ");
          SQL.append("select sn2.siNoId, sn2.name, sn2.publishDateTime, sn2.expireDateTime, sn2.isBranch, sn2.parentsiNoId, sn2.metaInfoContentId, sn2.repositoryId, sn2.siNoTypeDefId, sn2.creator ");
          SQL.append("from ");
          SQL.append("(");
          SQL.append("  select sn1.siNoId, sn1.name, sn1.publishDateTime, sn1.expireDateTime, sn1.isBranch, sn1.parentsiNoId, sn1.metaInfoContentId, sn1.repositoryId, sn1.siNoTypeDefId, sn1.creator from cmSiNo sn1 where sn1.parentsiNoId = " + siteNodeId + " ");
          SQL.append(") sn1, cmSiNo sn2 where sn2.parentsiNoId = sn1.siNoId ");
        }
        if(levelsToPopulate > 2)
        {
          SQL.append("UNION ");
          SQL.append("select sn3.siNoId, sn3.name, sn3.publishDateTime, sn3.expireDateTime, sn3.isBranch, sn3.parentsiNoId, sn3.metaInfoContentId, sn3.repositoryId, sn3.siNoTypeDefId, sn3.creator ");
          SQL.append("from ");
          SQL.append(" (");
          SQL.append("  select sn2.siNoId, sn2.name, sn2.publishDateTime, sn2.expireDateTime, sn2.isBranch, sn2.parentsiNoId, sn2.metaInfoContentId, sn2.repositoryId, sn2.siNoTypeDefId, sn2.creator ");
          SQL.append("  from ");
          SQL.append("  (");
          SQL.append("    select sn1.siNoId, sn1.name, sn1.publishDateTime, sn1.expireDateTime, sn1.isBranch, sn1.parentsiNoId, sn1.metaInfoContentId, sn1.repositoryId, sn1.siNoTypeDefId, sn1.creator from cmSiNo sn1 where sn1.parentsiNoId = " + siteNodeId + " ");
          SQL.append("  ) sn1, cmSiNo sn2 where sn2.parentsiNoId = sn1.siNoId ");
          SQL.append(") sn2, cmSiNo sn3 where sn3.parentsiNoId = sn2.siNoId ");
        }
        if(levelsToPopulate > 3)
        {
          SQL.append("UNION ");
          SQL.append("select sn4.siNoId, sn4.name, sn4.publishDateTime, sn4.expireDateTime, sn4.isBranch, sn4.parentsiNoId, sn4.metaInfoContentId, sn4.repositoryId, sn4.siNoTypeDefId, sn4.creator ");
          SQL.append("from ");
          SQL.append("(");
          SQL.append("  select sn3.siNoId, sn3.name, sn3.publishDateTime, sn3.expireDateTime, sn3.isBranch, sn3.parentsiNoId, sn3.metaInfoContentId, sn3.repositoryId, sn3.siNoTypeDefId, sn3.creator ");
          SQL.append("  from ");
          SQL.append("  (");
          SQL.append("    select sn2.siNoId, sn2.name, sn2.publishDateTime, sn2.expireDateTime, sn2.isBranch, sn2.parentsiNoId, sn2.metaInfoContentId, sn2.repositoryId, sn2.siNoTypeDefId, sn2.creator ");
          SQL.append("    from ");
          SQL.append("   (");
          SQL.append("     select sn1.siNoId, sn1.name, sn1.publishDateTime, sn1.expireDateTime, sn1.isBranch, sn1.parentsiNoId, sn1.metaInfoContentId, sn1.repositoryId, sn1.siNoTypeDefId, sn1.creator from cmSiNo sn1 where sn1.parentsiNoId = " + siteNodeId + " ");
          SQL.append("   ) sn1, cmSiNo sn2 where sn2.parentsiNoId = sn1.siNoId ");
          SQL.append(" ) sn2, cmSiNo sn3 where sn3.parentsiNoId = sn2.siNoId ");
          SQL.append(" ) sn3, cmSiNo sn4 where sn4.parentsiNoId = sn3.siNoId ");
        }
       
        SQL.append(") sn, cmSiNoVer snv, cmContVer cv ");
        SQL.append("where ");
        SQL.append("snv.siNoId = sn.siNoId AND ");
        SQL.append("cv.contId = sn.metaInfoContentId AND ");
        SQL.append("cv.contVerId in (select max(contVerId) from cmContVer cv2 where cv2.contId=cv.contId group by cv2.languageId) ");
        SQL.append("AND snv.siNoVerId = ( ");
        SQL.append("  select max(siNoVerId) from cmSiNoVer snv2 ");
        SQL.append("  WHERE ");
        SQL.append("  snv2.siNoId = snv.siNoId AND ");
        SQL.append("  snv2.isActive = $1 AND snv2.stateId >= $2 ");
        SQL.append(") ");
        SQL.append("order by sn.parentSiNoId asc, sn.name ASC AS org.infoglue.cms.entities.structure.impl.simple.SmallestSiteNodeImpl");       
      }
        else
        {
           SQL.append("CALL SQL select sn.siteNodeId, sn.name, sn.publishDateTime, sn.expireDateTime, sn.isBranch, sn.parentsiteNodeId, sn.metaInfoContentId, sn.repositoryId, sn.siteNodeTypeDefinitionId, sn.creator, (select count(*) from cmSiteNode sn2 where sn2.parentsiteNodeId = sn.siteNodeId) AS childCount, snv.siteNodeVersionId, snv.stateId, snv.isProtected, snv.versionModifier, snv.modifiedDateTime, cv.languageId, ");
           /*
           SQL.append("concat ");
        SQL.append("( ");
        SQL.append("  concat ");
        SQL.append("  ( ");
       
        StringBuffer attributesSB = new StringBuffer();
        int i = 0;
        for(ContentTypeAttribute attribute : attributes)
        {
          if(!attribute.getName().equals("ComponentStructure"))
          {
            attributesSB.append("   \n '");
            if(i > 0)
              attributesSB.append("igcomma");
         
            attributesSB.append("" + attribute.getName() + "=',SUBSTR(versionValue,INSTR(versionValue,'<" + attribute.getName() + "><![CDATA[')+" + (attribute.getName().length() + 11) + ",INSTR(versionValue,']]></" + attribute.getName() + ">') - (INSTR(versionValue,'<" + attribute.getName() + "><![CDATA[') + " + (attribute.getName().length() + 11) + ")),");
          }
          i++;
        }
        attributesSB.deleteCharAt(attributesSB.length()-1);
        //System.out.println("attributesSB:" + attributesSB);
        SQL.append(attributesSB.toString());
       
        SQL.append("  ) ");
        SQL.append(") AS attributes ");
        */
           SQL.append(" cv.versionValue AS attributes ");
          
        SQL.append("from ");
        SQL.append("(");
        SQL.append("select sn1.siteNodeId, sn1.name, sn1.publishDateTime, sn1.expireDateTime, sn1.isBranch, sn1.parentsiteNodeId, sn1.metaInfoContentId, sn1.repositoryId, sn1.siteNodeTypeDefinitionId, sn1.creator from cmSiteNode sn1 where sn1.parentsiteNodeId = " + siteNodeId + " ");
        if(levelsToPopulate > 1)
        {
          SQL.append("UNION ");
          SQL.append("select sn2.siteNodeId, sn2.name, sn2.publishDateTime, sn2.expireDateTime, sn2.isBranch, sn2.parentsiteNodeId, sn2.metaInfoContentId, sn2.repositoryId, sn2.siteNodeTypeDefinitionId, sn2.creator ");
          SQL.append("from ");
          SQL.append("(");
          SQL.append("  select sn1.siteNodeId, sn1.name, sn1.publishDateTime, sn1.expireDateTime, sn1.isBranch, sn1.parentsiteNodeId, sn1.metaInfoContentId, sn1.repositoryId, sn1.siteNodeTypeDefinitionId, sn1.creator from cmSiteNode sn1 where sn1.parentsiteNodeId = " + siteNodeId + " ");
          SQL.append(") sn1, cmSiteNode sn2 where sn2.parentsiteNodeId = sn1.siteNodeId ");
        }
        if(levelsToPopulate > 2)
        {
          SQL.append("UNION ");
          SQL.append("select sn3.siteNodeId, sn3.name, sn3.publishDateTime, sn3.expireDateTime, sn3.isBranch, sn3.parentsiteNodeId, sn3.metaInfoContentId, sn3.repositoryId, sn3.siteNodeTypeDefinitionId, sn3.creator ");
          SQL.append("from ");
          SQL.append(" (");
          SQL.append("  select sn2.siteNodeId, sn2.name, sn2.publishDateTime, sn2.expireDateTime, sn2.isBranch, sn2.parentsiteNodeId, sn2.metaInfoContentId, sn2.repositoryId, sn2.siteNodeTypeDefinitionId, sn2.creator ");
          SQL.append("  from ");
          SQL.append("  (");
          SQL.append("    select sn1.siteNodeId, sn1.name, sn1.publishDateTime, sn1.expireDateTime, sn1.isBranch, sn1.parentsiteNodeId, sn1.metaInfoContentId, sn1.repositoryId, sn1.siteNodeTypeDefinitionId, sn1.creator from cmSiteNode sn1 where sn1.parentsiteNodeId = " + siteNodeId + " ");
          SQL.append("  ) sn1, cmSiteNode sn2 where sn2.parentsiteNodeId = sn1.siteNodeId ");
          SQL.append(") sn2, cmSiteNode sn3 where sn3.parentsiteNodeId = sn2.siteNodeId ");
        }
        if(levelsToPopulate > 3)
        {
          SQL.append("UNION ");
          SQL.append("select sn4.siteNodeId, sn4.name, sn4.publishDateTime, sn4.expireDateTime, sn4.isBranch, sn4.parentsiteNodeId, sn4.metaInfoContentId, sn4.repositoryId, sn4.siteNodeTypeDefinitionId, sn4.creator ");
          SQL.append("from ");
          SQL.append("(");
          SQL.append("  select sn3.siteNodeId, sn3.name, sn3.publishDateTime, sn3.expireDateTime, sn3.isBranch, sn3.parentsiteNodeId, sn3.metaInfoContentId, sn3.repositoryId, sn3.siteNodeTypeDefinitionId, sn3.creator ");
          SQL.append("  from ");
          SQL.append("  (");
          SQL.append("    select sn2.siteNodeId, sn2.name, sn2.publishDateTime, sn2.expireDateTime, sn2.isBranch, sn2.parentsiteNodeId, sn2.metaInfoContentId, sn2.repositoryId, sn2.siteNodeTypeDefinitionId, sn2.creator ");
          SQL.append("    from ");
          SQL.append("   (");
          SQL.append("     select sn1.siteNodeId, sn1.name, sn1.publishDateTime, sn1.expireDateTime, sn1.isBranch, sn1.parentsiteNodeId, sn1.metaInfoContentId, sn1.repositoryId, sn1.siteNodeTypeDefinitionId, sn1.creator from cmSiteNode sn1 where sn1.parentsiteNodeId = " + siteNodeId + " ");
          SQL.append("   ) sn1, cmSiteNode sn2 where sn2.parentsiteNodeId = sn1.siteNodeId ");
          SQL.append(" ) sn2, cmSiteNode sn3 where sn3.parentsiteNodeId = sn2.siteNodeId ");
          SQL.append(" ) sn3, cmSiteNode sn4 where sn4.parentsiteNodeId = sn3.siteNodeId ");
        }
       
        SQL.append(") sn, cmSiteNodeVersion snv, cmContentVersion cv ");
        SQL.append("where ");
        SQL.append("snv.siteNodeId = sn.siteNodeId AND ");
        SQL.append("cv.contentId = sn.metaInfoContentId AND ");
        SQL.append("cv.contentVersionId in (select max(contentVersionId) from cmContentVersion cv2 where cv2.contentId=cv.contentId group by cv2.languageId) ");
        SQL.append("AND snv.siteNodeVersionId = ( ");
        SQL.append("  select max(siteNodeVersionId) from cmSiteNodeVersion snv2 ");
        SQL.append("  WHERE ");
        SQL.append("  snv2.siteNodeId = snv.siteNodeId AND ");
        SQL.append("  snv2.isActive = $1 AND snv2.stateId >= $2 ");
        SQL.append(") ");
        SQL.append("order by sn.parentsiteNodeId asc, sn.name ASC AS org.infoglue.cms.entities.structure.impl.simple.SmallestSiteNodeImpl");
        }
       
        logger.info("\n\n" + SQL);
        logger.info("Running SQL QUERY for children to " + siteNodeId + " and possibly below");
        //Thread.dumpStack();
       
        //logger.info("SQL:" + SQL);
        //logger.info("siteNodeId:" + siteNodeId);
        OQLQuery oql = db.getOQLQuery(SQL.toString());
      //oql.bind(siteNodeId);
      oql.bind(true);
      oql.bind(getOperatingMode());
       
        QueryResults results = oql.execute(Database.READONLY);
        t.printElapsedTime("Query took");
        //RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getChildSiteNodes part 1", t.getElapsedTime());
       
        Map<Integer,SiteNodeVO> allSiteNodeVOMap = new HashMap<Integer,SiteNodeVO>();
       
        Integer parentSiteNodeId = null;
        siteNodeVOList = new ArrayList<SiteNodeVO>();
      CacheController.cacheObjectInAdvancedCache("childPagesCache", ""+siteNodeId, siteNodeVOList, new String[] {CacheController.getPooledString(3, siteNodeId)}, true);
      //populatedSiteNodeVOList.put(siteNodeId, siteNodeVOList);

      String groupKey1 = null;
      String groupKey2 = null;
     
      while (results.hasMore())
          {
            SiteNode siteNode = (SiteNode)results.next();
           
        String siteNodeCacheKey = "" + siteNode.getValueObject().getId();
        CacheController.cacheObjectInAdvancedCache("siteNodeCache", siteNodeCacheKey, siteNode.getValueObject());

            String versionValue = siteNode.getValueObject().getAttributes();
            Integer contentId = siteNode.getValueObject().getMetaInfoContentId();
            Integer languageId = siteNode.getValueObject().getLanguageId();
            Integer contentVersionId = siteNode.getValueObject().getContentVersionId();
            if(versionValue == null)
            {
              logger.info("Null version for " + siteNode.getSiteNodeId() + ":" + siteNode.getValueObject().getSiteNodeVersionId());
            }
            else
            {
              groupKey1 = CacheController.getPooledString(2, contentVersionId);
              groupKey2 = CacheController.getPooledString(1, contentId);
             
              for(ContentTypeAttribute attribute : attributes)
          {
                if(!attribute.getName().equals("ComponentStructure"))
                {
                  String attributeKey = "" + siteNode.getId() + "_" + languageId + "_" + attribute.getName();
                  String attributeKeyContentId = "c_" + siteNode.getMetaInfoContentId() + "_" + languageId + "_" + attribute.getName();
                  //System.out.println("Caching empty on " + attributeKey);
                    CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKey, "", new String[]{groupKey1, groupKey2}, true);
                    CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKeyContentId, "", new String[]{groupKey1, groupKey2}, true);
                  }
          }
         
              for(ContentTypeAttribute attribute : attributes)
              {
                //if(!attribute.getName().equals("ComponentStructure"))
                //{
                  String value = ContentDeliveryController.getContentDeliveryController().getAttributeValue(versionValue, attribute.getName(), false);
   
                  String attributeKey = "" + siteNode.getId() + "_" + languageId + "_" + attribute.getName();
                  String attributeKeyContentId = "c_" + siteNode.getMetaInfoContentId() + "_" + languageId + "_" + attribute.getName();
                  //System.out.println("Caching " + value + " on " + attributeKey);
                    CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKey, value, new String[]{groupKey1, groupKey2}, true);
                    CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKeyContentId, value, new String[]{groupKey1, groupKey2}, true);
                    //}
              }   
            }
            /*
            if(attributesString != null)
            {
              String[] attributesArray = attributesString.split("igcomma");
              for(String attr : attributesArray)
              {
                if(attr != null && !attr.equals(""))
                {
                  String name = attr.substring(0, attr.indexOf("="));
                  String value = attr.substring(attr.indexOf("=") + 1);
   
                  String attributeKey = "" + siteNode.getId() + "_" + languageId + "_" + name;
                  String attributeKeyContentId = "c_" + siteNode.getMetaInfoContentId() + "_" + languageId + "_" + name;
                  //System.out.println("Caching " + name + "=" + value + " on " + attributeKey);
                    CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKey, value, new String[]{groupKey1, groupKey2}, true);
                    CacheController.cacheObjectInAdvancedCache("metaInfoContentAttributeCache", attributeKeyContentId, value, new String[]{groupKey1, groupKey2}, true);
                }
              }           
            }
            else
              System.out.println("Error null on " + siteNode.getId());
            */
            //if(allSiteNodeVOMap.get(siteNode.getId()) != null)
            //{
            //  allSiteNodeVOMap.get(siteNode.getId()).addAttributes(siteNode.getValueObject().getLanguageId(), siteNode.getValueObject().getAttributes());
            //  continue;
            //}
           
            allSiteNodeVOMap.put(siteNode.getId(), siteNode.getValueObject());
            //System.out.println("siteNode:" + siteNode.getName());
        if(isValidSiteNode(siteNode, db))
            {
          //System.out.println("Caching empty list initially on " + siteNode.getId());
          //CacheController.cacheObjectInAdvancedCache("childPagesCache", ""+siteNode.getId(), new ArrayList<SiteNodeVO>(), new String[] {groupKey1, groupKey2, CacheController.getPooledString(3, siteNode.getId())}, true);
          //populatedSiteNodeVOList.put(siteNode.getId(), new ArrayList<SiteNodeVO>());
          if(parentSiteNodeId != null && !siteNode.getValueObject().getParentSiteNodeId().equals(parentSiteNodeId))
          {
            //System.out.println("Caching list:" + siteNodeVOList + " on " + parentSiteNodeId);
            CacheController.cacheObjectInAdvancedCache("childPagesCache", ""+parentSiteNodeId, siteNodeVOList, new String[] {groupKey1, groupKey2, CacheController.getPooledString(3, parentSiteNodeId)}, true);
            //populatedSiteNodeVOList.put(parentSiteNodeId, siteNodeVOList);
            siteNodeVOList = new ArrayList<SiteNodeVO>();
          }
          parentSiteNodeId = siteNode.getValueObject().getParentSiteNodeId();
          siteNodeVOList.add(siteNode.getValueObject());
        }
        }
      //System.out.println("Caching list:" + siteNodeVOList + " on " + parentSiteNodeId);
      if(groupKey1 == null) groupKey1 = "";
      if(groupKey2 == null) groupKey2 = "";
      CacheController.cacheObjectInAdvancedCache("childPagesCache", ""+parentSiteNodeId, siteNodeVOList, new String[] {groupKey1, groupKey2, CacheController.getPooledString(3, parentSiteNodeId)}, true);
      //populatedSiteNodeVOList.put(parentSiteNodeId, siteNodeVOList);
        //RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getChildSiteNodes part 2", t.getElapsedTime());
        t.printElapsedTime("Read took");

      results.close();
      oql.close();
     
      //System.out.println("SIZE:" + populatedSiteNodeVOList.size());
View Full Code Here

        logger.info("There was a cached list of child sitenodes:" + siteNodeVOList.size());
      }
      else
      {
           //logger.info("Querying for children to siteNode " + siteNodeId);
           Timer t = new Timer();
          
            siteNodeVOList = new ArrayList();
         
            StringBuffer SQL = new StringBuffer();
          if(CmsPropertyHandler.getUseShortTableNames() != null && CmsPropertyHandler.getUseShortTableNames().equalsIgnoreCase("true"))
          {
             SQL.append("CALL SQL select sn.siNoId, sn.name, sn.publishDateTime, sn.expireDateTime, sn.isBranch, sn.isDeleted, sn.parentSiNoId, sn.metaInfoContentId, sn.repositoryId, sn.siNoTypeDefId, sn.creator, (select count(*) from cmSiNo sn2 where sn2.parentSiNoId = sn.siNoId) AS childCount, snv.siNoVerId, snv.sortOrder, snv.isHidden, snv.stateId, snv.isProtected, snv.versionModifier, snv.modifiedDateTime, 0 AS languageId, '' as attributes from cmSiNo sn, cmSiNoVer snv ");
             SQL.append("where ");
             SQL.append("sn.parentSiNoId = $1 ");
             SQL.append("AND sn.isDeleted = $2 ");
             SQL.append("AND snv.siNoId = sn.siNoId ");
             SQL.append("AND snv.siNoVerId = ( ");
             SQL.append("  select max(siNoVerId) from cmSiNoVer snv2 ");
             SQL.append("  WHERE ");
             SQL.append("  snv2.siNoId = snv.siNoId AND ");
             SQL.append("  snv2.isActive = $3 AND snv2.stateId >= $4 ");
             SQL.append("  ) ");
             if(nameFilter != null && !nameFilter.equals(""))
               SQL.append(" AND sn.name LIKE $5 ");
             //if(!showHidden)
             //  SQL.append(" AND snv.isHidden = 0 ");
             SQL.append("order by snv.sortOrder, sn.name ASC, sn.siNoId DESC AS org.infoglue.cms.entities.structure.impl.simple.SmallestSiteNodeImpl");
          }
          else
          {
             SQL.append("CALL SQL select sn.siteNodeId, sn.name, sn.publishDateTime, sn.expireDateTime, sn.isBranch, sn.isDeleted, sn.parentSiteNodeId, sn.metaInfoContentId, sn.repositoryId, sn.siteNodeTypeDefinitionId, sn.creator, (select count(*) from cmSiteNode sn2 where sn2.parentSiteNodeId = sn.siteNodeId) AS childCount, snv.siteNodeVersionId, snv.sortOrder, snv.isHidden, snv.stateId, snv.isProtected, snv.versionModifier, snv.modifiedDateTime, 0 AS languageId, '' as attributes from cmSiteNode sn, cmSiteNodeVersion snv ");
             SQL.append("where ");
             SQL.append("sn.parentSiteNodeId = $1 ");
             SQL.append("AND sn.isDeleted = $2 ");
             SQL.append("AND snv.siteNodeId = sn.siteNodeId ");
             SQL.append("AND snv.siteNodeVersionId = ( ");
             SQL.append("  select max(siteNodeVersionId) from cmSiteNodeVersion snv2 ");
             SQL.append("  WHERE ")
             SQL.append("  snv2.siteNodeId = snv.siteNodeId AND ");
             SQL.append("  snv2.isActive = $3 AND snv2.stateId >= $4 ");
             SQL.append("  ) ");
             if(nameFilter != null && !nameFilter.equals(""))
               SQL.append(" AND sn.name LIKE $5 ");
             //if(!showHidden)
             //  SQL.append(" AND snv.isHidden = 0 ");
             SQL.append("order by snv.sortOrder, sn.name ASC, sn.siteNodeId DESC AS org.infoglue.cms.entities.structure.impl.simple.SmallestSiteNodeImpl");       
          }
 
          logger.info("SQL:" + SQL);
          //logger.info("siteNodeId:" + siteNodeId);
          OQLQuery oql = db.getOQLQuery(SQL.toString());
        oql.bind(siteNodeId);
        oql.bind(false);
        oql.bind(true);
        oql.bind(getOperatingMode());
        if(nameFilter != null && !nameFilter.equals(""))
          oql.bind(nameFilter);
         
          QueryResults results = oql.execute(Database.READONLY);
          //RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getChildSiteNodes part 1", t.getElapsedTime());
         
        while (results.hasMore())
            {
              SiteNode siteNode = (SiteNode)results.next();
              t.getElapsedTime();
             
              if(isValidSiteNode(siteNode, db))
              {
                if(CmsPropertyHandler.getAllowLocalizedSortAndVisibilityProperties() && languageId != null && deliveryContext != null)
                {
View Full Code Here

      logger.info("There was a cached list of child sitenodes:" + siteNodeVOList.size());
    }
    else
    {
         //logger.info("Querying for children to siteNode " + siteNodeId);
         Timer t = new Timer();
        
          siteNodeVOList = new ArrayList();
       
          StringBuffer SQL = new StringBuffer();
        if(CmsPropertyHandler.getUseShortTableNames() != null && CmsPropertyHandler.getUseShortTableNames().equalsIgnoreCase("true"))
View Full Code Here

  private static Boolean configurationFinished = null;

    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
    {      
     
        Timer t = new Timer();

        long end, start = System.currentTimeMillis();
        HttpServletRequest httpRequest = (HttpServletRequest) servletRequest;
        HttpServletResponse httpResponse = (HttpServletResponse) servletResponse;
       
      httpRequest.setAttribute("originalFullURL", getOriginalFullURL(httpRequest));

        /*
        Enumeration enAttr = httpRequest.getAttributeNames();
        while(enAttr.hasMoreElements()){
         String attributeName = (String)enAttr.nextElement();
         System.out.println("Attribute Name - "+attributeName+", Value - "+(httpRequest.getAttribute(attributeName)).toString());
        }

        System.out.println("To out-put All the request parameters received from request - ");

        Enumeration enParams = httpRequest.getParameterNames();
        while(enParams.hasMoreElements()){
         String paramName = (String)enParams.nextElement();
         System.out.println("Attribute Name - "+paramName+", Value - "+httpRequest.getParameter(paramName));
        }

        Enumeration headerNames = httpRequest.getHeaderNames();
        while(headerNames.hasMoreElements()) {
          String headerName = (String)headerNames.nextElement();
          System.out.println(headerName + " = " + httpRequest.getHeader(headerName));
        }
        */
       
        if(httpRequest.getParameter("igEncodingTest") != null && !httpRequest.getParameter("igEncodingTest").equals(""))
          logger.warn("httpRequest:" + httpRequest.getParameter("name"));
       
    if(!CmsPropertyHandler.getIsValidSetup() && (httpRequest.getRequestURI().indexOf("Install") == -1 && httpRequest.getRequestURI().indexOf("/script") == -1 && httpRequest.getRequestURI().indexOf("/css") == -1 && httpRequest.getRequestURI().indexOf("/images") == -1))
      httpResponse.sendRedirect("" + httpRequest.getContextPath() + "/Install!input.action");
           
        String enableNiceURI = CmsPropertyHandler.getEnableNiceURI();
        if (enableNiceURI == null)
            enableNiceURI = "false";

        validateCmsProperties(httpRequest);
        String requestURI = URLDecoder.decode(getContextRelativeURI(httpRequest), "UTF-8");
        if(logger.isInfoEnabled())
          logger.info("requestURI:" + requestURI);

        try
        {
          //System.out.println("requestURI:" + requestURI);
      if(logger.isInfoEnabled())
            logger.info("requestURI before decoding:" + requestURI);
           
      requestURI = URLDecoder.decode(requestURI, CmsPropertyHandler.getURIEncoding());
      if(logger.isInfoEnabled())
            logger.info("requestURI after decoding:" + requestURI);

          String fromEncoding = CmsPropertyHandler.getURIEncoding();
      String toEncoding = "utf-8";
      String testRequestURI = new String(requestURI.getBytes(fromEncoding), toEncoding);
      if(testRequestURI.indexOf((char)65533) == -1)
        requestURI = testRequestURI;
      //System.out.println("requestURI:" + requestURI);
        }
        catch (Exception e)
        {
          logger.warn("Error checking for unicode chars:" + e.getMessage());
    }
       
        if(logger.isInfoEnabled())
          logger.info("requestURI after encoding check:" + requestURI);

        try
        {
          if(requestURI.indexOf(CmsPropertyHandler.getDigitalAssetBaseUrl() + "/protected") > -1)
          {
              throw new Exception("Not allowed to view protected assets...");
          }
         
          String remainingURI = httpRequest.getParameter("remainingURI");
          if (enableNiceURI.equalsIgnoreCase("true") && (!uriMatcher.matches(requestURI) || remainingURI != null))
          {
              while(CmsPropertyHandler.getActuallyBlockOnBlockRequests() && RequestAnalyser.getRequestAnalyser().getBlockRequests())
              {
                if(logger.isInfoEnabled())
                  logger.info("Queing up requests as cache eviction are taking place..");
                try { Thread.sleep(10); } catch (Exception e) {}
              }

              RequestAnalyser.getRequestAnalyser().incNumberOfCurrentRequests(null);

              HttpSession httpSession = httpRequest.getSession(true);
 
              Set<RepositoryVO> repositoryVOList = null;
              Integer languageId = null;
 
              Database db = CastorDatabaseService.getDatabase();
         
              BaseDeliveryController.beginTransaction(db);
             
              try
              {
                  repositoryVOList = getRepositoryId(httpRequest, db);
                  if(logger.isInfoEnabled())
                    logger.info("repositoryVOList:" + repositoryVOList.size());
           
                languageId = getLanguageId(httpRequest, httpSession, repositoryVOList, requestURI, db);
             
                  Integer siteNodeId = null;
                  if(languageId != null)
                  {
                  String[] nodeNames = splitString(requestURI, "/");
                  logger.info("nodeNames:" + nodeNames.length);
                 
                  List<String> nodeNameList = new ArrayList<String>();
                  for(int i=0; i<nodeNames.length; i++)
                  {
                    String nodeName = nodeNames[i];
                    if(nodeName.indexOf(".cid") == -1)
                    {
                      nodeNameList.add(nodeName);
                    }
                  }

                  nodeNames = new String[nodeNameList.size()];
                  nodeNames = nodeNameList.toArray(nodeNames);
                 
                  //logger.info("RepositoryId.: "+repositoryId);
                  //logger.info("LanguageId...: "+languageId);
                  //logger.info("RequestURI...: "+requestURI);
     
                    InfoGluePrincipal infoGluePrincipal = (InfoGluePrincipal) httpSession.getAttribute("infogluePrincipal");
                    if (infoGluePrincipal == null)
                    {
                        try
                        {
                            infoGluePrincipal = (InfoGluePrincipal) CacheController.getCachedObject("userCache", "anonymous");
                            if (infoGluePrincipal == null)
                            {
                                Map arguments = new HashMap();
                        arguments.put("j_username", CmsPropertyHandler.getAnonymousUser());
                        arguments.put("j_password", CmsPropertyHandler.getAnonymousPassword());
                      infoGluePrincipal = (InfoGluePrincipal)ExtranetController.getController().getAuthenticatedPrincipal(db, arguments);
                      if(infoGluePrincipal != null)
                        CacheController.cacheObject("userCache", "anonymous", infoGluePrincipal);
                            }
                            //this.principal = ExtranetController.getController().getAuthenticatedPrincipal("anonymous", "anonymous");
   
                        }
                        catch (Exception e)
                        {
                          BaseDeliveryController.rollbackTransaction(db);
                            throw new SystemException("There was no anonymous user found in the system. There must be - add the user anonymous/anonymous and try again.", e);
                        }
                    }
   
                    String siteNodeIdString = httpRequest.getParameter("siteNodeId");
                  if(siteNodeIdString != null && !siteNodeIdString.equals("") && remainingURI != null && !remainingURI.equals(""))
                    {
                      nodeNames = splitString(remainingURI, "/");
                    logger.info("nodeNames:" + nodeNames.length);
                   
                    nodeNameList = new ArrayList<String>();
                    for(int i=0; i<nodeNames.length; i++)
                    {
                      String nodeName = nodeNames[i];
                      if(nodeName.indexOf(".cid") == -1)
                      {
                        nodeNameList.add(nodeName);
                      }
                    }

                    nodeNames = new String[nodeNameList.size()];
                    nodeNames = nodeNameList.toArray(nodeNames);
                   
                        DeliveryContext deliveryContext = DeliveryContext.getDeliveryContext();
                        siteNodeId = NodeDeliveryController.getSiteNodeIdFromBaseSiteNodeIdAndPath(db, infoGluePrincipal, nodeNames, attributeName, deliveryContext, httpSession, languageId, siteNodeIdString, remainingURI);
                    }
                    else
                    {
                      Iterator repositorVOListIterator = repositoryVOList.iterator();
                      while(repositorVOListIterator.hasNext())
                      {
                          RepositoryVO repositoryVO = (RepositoryVO)repositorVOListIterator.next();
                          logger.info("Getting node from:" + repositoryVO.getName());
                         
                          //TODO
                          DeliveryContext deliveryContext = DeliveryContext.getDeliveryContext();
                          siteNodeId = NodeDeliveryController.getSiteNodeIdFromPath(db, infoGluePrincipal, repositoryVO, nodeNames, attributeName, deliveryContext, httpSession, languageId);
                         
                          if(deliveryContext.getLanguageId() != null && !deliveryContext.getLanguageId().equals(languageId))
                          {
                            languageId = deliveryContext.getLanguageId();
                              httpSession.setAttribute(FilterConstants.LANGUAGE_ID, languageId);
                          }
                         
                          if(siteNodeId != null)
                              break;
                      }
                    }
                  }
                 
                  BaseDeliveryController.rollbackTransaction(db);

                  end = System.currentTimeMillis();
                 
                  if(siteNodeId == null)
                  {
                      String redirectUrl = RedirectController.getController().getRedirectUrl(httpRequest);
                      if(redirectUrl != null && redirectUrl.length() > 0)
                      {
              int redirectStatusCode = CmsPropertyHandler.getRedirectStatusCode();
              String encodedRedirectUrl = httpResponse.encodeRedirectURL(redirectUrl);
              httpResponse.setStatus(redirectStatusCode);
              httpResponse.setHeader("Location", encodedRedirectUrl);
              return;
                      }
                     
                String extraInformation = "Referer: " + httpRequest.getHeader("Referer") + "\n";
                extraInformation += "UserAgent: " + httpRequest.getHeader("User-Agent") + "\n";
                extraInformation += "User IP: " + httpRequest.getRemoteAddr();
               
                logger.info("Could not map URI " + requestURI + " against any page on this website." + "\n" + extraInformation);
                throw new PageNotFoundException("Could not map URI " + requestURI + " against any page on this website.");                       
                  }
                  else
                      logger.info("Mapped URI " + requestURI + " --> " + siteNodeId + " in " + (end - start) + "ms");
                 
                  Integer contentId = getContentId(httpRequest);
                 
                  HttpServletRequest wrappedHttpRequest = prepareRequest(httpRequest, siteNodeId, languageId, contentId);
              
                   RequestAnalyser.getRequestAnalyser().registerComponentStatistics("ViewPageFilter before ViewPage", t.getElapsedTime());
                 
                  wrappedHttpRequest.getRequestDispatcher("/ViewPage.action").forward(wrappedHttpRequest, httpResponse);
              }
              catch (SystemException e)
              {
                  BaseDeliveryController.rollbackTransaction(db);
          if (e instanceof PageNotFoundException)
          {
            logger.info("Failed to resolve siteNodeId: " + e.getMessage());
          }
          else
          {
                    logger.error("Failed to resolve siteNodeId:" + e.getMessage());
                    logger.warn("Failed to resolve siteNodeId:" + e.getMessage(), e);
          }
                  if (handleSystemRedirects(httpRequest, httpResponse))
                    {
            return;
                    }
                    else
                    {
                    throw new ServletException(e);
                }
              }
        catch (Exception e)
        {
          BaseDeliveryController.rollbackTransaction(db);

          if (e instanceof PageNotFoundException)
          {
            logger.info("Failed to resolve siteNodeId: " + e.getMessage());
          }
          else if (e instanceof ServletException)
          {
            logger.error("Failed to resolve siteNodeId: " + e.getMessage());
          }
          else
          {
            logger.error("Failed to resolve siteNodeId: " + e.getMessage(), e);
          }
          if(logger.isInfoEnabled())
            logger.info("Failed to resolve siteNodeId: " + e.getMessage(), e);
          if (handleSystemRedirects(httpRequest, httpResponse))
          {
            return;
          }
          else
          {
            throw new ServletException(e);
          }
        }
              finally
              {
                try
                {
                  BaseDeliveryController.closeDatabase(db);
                }
                catch (Exception e)
                {
                  e.printStackTrace();
          }
                  RequestAnalyser.getRequestAnalyser().decNumberOfCurrentRequests(-1);
              }
             
          }
          else
          {
            //filterChain.doFilter(httpRequest, httpResponse);
            if(!httpResponse.isCommitted())
            {
              try
              {
                filterChain.doFilter(httpRequest, httpResponse);
              }
              catch (Exception e)
              {
                logger.error("Response was committed - could not continue filter chains:" + e.getMessage());
              }
            }
           
          }   
        }
        catch (SystemException se)
        {
          if(!httpResponse.isCommitted())
          {
              httpRequest.setAttribute("responseCode", "500");
              httpRequest.setAttribute("error", se);
              httpRequest.getRequestDispatcher("/ErrorPage.action").forward(httpRequest, httpResponse);
          }
          else
            logger.error("Error and response was committed:" + se.getMessage(), se);
        }
        catch (Exception e)
        {
          if(!httpResponse.isCommitted())
          {
          httpRequest.setAttribute("responseCode", "404");
              httpRequest.setAttribute("error", e);
              httpRequest.getRequestDispatcher("/ErrorPage.action").forward(httpRequest, httpResponse);
          }
          else
              logger.error("Error and response was committed:" + e.getMessage(), e);
      }
       
        if(httpRequest.getRequestURL().indexOf("digitalAssets") == -1)
          RequestAnalyser.getRequestAnalyser().registerComponentStatistics("ViewPageFilter", t.getElapsedTime());
    }
View Full Code Here

            }
            catch (NumberFormatException e) {}
        }
        else
        {
          Timer t = new Timer();
          Iterator repositoryVOListIterator = repositoryVOList.iterator();
          outer: while(repositoryVOListIterator.hasNext())
          {
            RepositoryVO repositoryVO = (RepositoryVO)repositoryVOListIterator.next();
            String dnsName = repositoryVO.getDnsName();
View Full Code Here

TOP

Related Classes of org.infoglue.deliver.util.Timer

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.