Package org.infoglue.cms.entities.management

Examples of org.infoglue.cms.entities.management.RepositoryVO


    }
   
    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);
View Full Code Here


    QueryResults results = oql.execute(Database.READONLY);
   
    if (results.hasMore())
    {
      Repository repository = (Repository)results.next();
      RepositoryVO repositoryVO = repository.getValueObject();
      repositoryVOList.add(repositoryVO);
    }

    results.close();
    oql.close();
View Full Code Here

    return repositoryVOList; 
  }

  public RepositoryVO getRepositoryVOWithName(String name, Database db)
  {
    RepositoryVO repository = null;
   
    try
    {
      OQLQuery oql = db.getOQLQuery("SELECT f FROM org.infoglue.cms.entities.management.impl.simple.RepositoryImpl f WHERE f.name = $1");
      oql.bind(name);
View Full Code Here

                    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);
                         
View Full Code Here

        {
          Timer t = new Timer();
          Iterator repositoryVOListIterator = repositoryVOList.iterator();
          outer: while(repositoryVOListIterator.hasNext())
          {
            RepositoryVO repositoryVO = (RepositoryVO)repositoryVOListIterator.next();
            String dnsName = repositoryVO.getDnsName();
            String serverName = request.getServerName();
            int startIndex = dnsName.indexOf(serverName);
            int lastStartIndex = -1;
            if(startIndex > -1)
            {
View Full Code Here

          }

          Set<RepositoryVO> repositoryVOList = getRepositoryId(this.getRequest());
          if(repositoryVOList != null && repositoryVOList.size() > 0)
          {
            RepositoryVO repositoryVO = (RepositoryVO)repositoryVOList.toArray()[0];
            String localErrorUrl = getErrorUrl(repositoryVO.getId());
            if(localErrorUrl != null)
              errorUrl = localErrorUrl;
          }
         
          if(errorUrl == null || errorUrl.indexOf("@errorUrl@") > -1)
View Full Code Here

  {
      CmsPropertyHandler.setApplicationName("cms");

      try
      {
          RepositoryVO repositoryVO = new RepositoryVO();
        repositoryVO.setName("Repository_" + Math.random());
        repositoryVO.setDescription("The testcase made a new repository...");
        repositoryVO.setDnsName("");
        newRepositoryVO = RepositoryController.getController().create(repositoryVO);
        assertNotNull(newRepositoryVO.getId());
        assertNotNull(newRepositoryVO);
      }
      catch(Exception e)
View Full Code Here

   */
  public static Integer getRepoId()
  {
    try
    {
      RepositoryVO repo = RepositoryController.getController().getFirstRepositoryVO();
      return repo.getId();
    }
    catch (SystemException e)
    {
      e.printStackTrace();
      return new Integer(1);
View Full Code Here

        SiteNodeVO siteNodeVO = NodeDeliveryController.getNodeDeliveryController(siteNodeId, languageId, contentId, deliveryContext).getSiteNodeVO(db, siteNodeId);
        String dnsName = CmsPropertyHandler.getWebServerAddress();
        if(siteNodeVO != null)
        {
          RepositoryVO repositoryVO = RepositoryController.getController().getRepositoryVOWithId(siteNodeVO.getRepositoryId(), db);
          if(repositoryVO.getDnsName() != null && !repositoryVO.getDnsName().equals(""))
            dnsName = repositoryVO.getDnsName();
        }
        /*
        SiteNode siteNode = NodeDeliveryController.getNodeDeliveryController(siteNodeId, languageId, contentId).getSiteNode(db, siteNodeId);
        String dnsName = CmsPropertyHandler.getWebServerAddress();
        if(siteNode != null && siteNode.getRepository().getDnsName() != null && !siteNode.getRepository().getDnsName().equals(""))
View Full Code Here

     
      SiteNodeVO siteNodeVO = NodeDeliveryController.getNodeDeliveryController(null, deliveryContext.getLanguageId(), null, deliveryContext).getSiteNodeVO(db, siteNodeId);
      String dnsName = CmsPropertyHandler.getWebServerAddress();
      if(siteNodeVO != null)
      {
        RepositoryVO repositoryVO = RepositoryController.getController().getRepositoryVOWithId(siteNodeVO.getRepositoryId(), db);
        if(repositoryVO.getDnsName() != null && !repositoryVO.getDnsName().equals(""))
          dnsName = repositoryVO.getDnsName();
      }
      /*
      SiteNode siteNode = NodeDeliveryController.getNodeDeliveryController(null, deliveryContext.getLanguageId(), null).getSiteNode(db, siteNodeId);
      String dnsName = CmsPropertyHandler.getWebServerAddress();
      if(siteNode != null && siteNode.getRepository().getDnsName() != null && !siteNode.getRepository().getDnsName().equals(""))
View Full Code Here

TOP

Related Classes of org.infoglue.cms.entities.management.RepositoryVO

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.