예제 #1
0
  public static Map computeLevels(
      Map vertexLevelMap, DigraphIteration digraph, Object root, boolean longest) {
    if (vertexLevelMap == null) vertexLevelMap = new HashMap();

    MutableInteger rootLevel = (MutableInteger) vertexLevelMap.get(root);
    if (rootLevel == null) {
      rootLevel = new MutableInteger(0);
      vertexLevelMap.put(root, rootLevel);
    }

    for (ArcIterator i = digraph.outgoingIterator(root); i.hasNext(); ) {
      i.next();
      Object child = i.getDestination();
      int childLevelCandidate = rootLevel.intValue() + 1;
      MutableInteger childLevel = (MutableInteger) vertexLevelMap.get(child);
      if (childLevel == null) {
        childLevel = new MutableInteger(childLevelCandidate);
        vertexLevelMap.put(child, childLevel);
        computeLevels(vertexLevelMap, digraph, child, longest);
      } else if ((longest && childLevel.intValue() < childLevelCandidate)
          || (!longest && childLevel.intValue() > childLevelCandidate)) {
        childLevel.setValue(childLevelCandidate);
        computeLevels(vertexLevelMap, digraph, child, longest);
      }
    }

    return vertexLevelMap;
  }
예제 #2
0
 public static boolean isAcyclic(Digraph digraph) {
   int order = digraph.order();
   if (order == 0) return true;
   Set spanned = new HashSet(order);
   DepthFirstStampSearch dfs = new DepthFirstStampSearch(digraph, digraph.vertexIterator().next());
   for (Iterator i = digraph.vertexIterator(); i.hasNext(); ) {
     Object dfsRoot = i.next();
     if (spanned.contains(dfsRoot)) continue;
     dfs.reset(dfsRoot);
     Map dfsOrders = dfs.traverse(new HashMap(digraph.order()));
     for (Iterator j = dfsOrders.entrySet().iterator(); j.hasNext(); ) {
       Map.Entry entry = (Map.Entry) j.next();
       Object origin = entry.getKey();
       DepthFirstStampSearch.OrderPair orgOrders =
           (DepthFirstStampSearch.OrderPair) entry.getValue();
       spanned.add(origin);
       for (ArcIterator k = digraph.outgoingIterator(origin); k.hasNext(); ) {
         k.next();
         Object dst = k.getDestination();
         DepthFirstStampSearch.OrderPair dstOrders =
             (DepthFirstStampSearch.OrderPair) dfsOrders.get(dst);
         if (dstOrders.getPostOrder() > orgOrders.getPostOrder()) return false;
       }
     }
     if (dfsOrders.size() == order) break;
   }
   return true;
 }
예제 #3
0
 /**
  * Return the request parameters as a Map<String,String>. Only the first value of multivalued
  * parameters is included.
  */
 Map<String, String> getParamsAsMap() {
   Map<String, String> map = new HashMap<String, String>();
   for (Enumeration en = req.getParameterNames(); en.hasMoreElements(); ) {
     String name = (String) en.nextElement();
     map.put(name, req.getParameter(name));
   }
   return map;
 }
예제 #4
0
  public static Map shiftLevelsDown(Map vertexLevelMap, DigraphIteration digraph, Object root) {
    int minChildLevel = Integer.MAX_VALUE;
    for (ArcIterator i = digraph.outgoingIterator(root); i.hasNext(); ) {
      i.next();
      Object child = i.getDestination();
      shiftLevelsDown(vertexLevelMap, digraph, child);
      MutableInteger childLevel = (MutableInteger) vertexLevelMap.get(child);
      minChildLevel =
          (minChildLevel <= childLevel.intValue() ? minChildLevel : childLevel.intValue());
    }

    if (minChildLevel != Integer.MAX_VALUE) {
      MutableInteger rootLevel = (MutableInteger) vertexLevelMap.get(root);
      rootLevel.setValue(minChildLevel - 1);
    }

    return vertexLevelMap;
  }
예제 #5
0
 protected boolean hasNoRoleParsm(String roleName) {
   String noRoleParam = noRoleParams.get(roleName);
   return (noRoleParam != null && !StringUtil.isNullString(req.getParameter(noRoleParam)));
 }
예제 #6
0
 static {
   noRoleParams.put(ROLE_USER_ADMIN, "noadmin");
   noRoleParams.put(ROLE_CONTENT_ADMIN, "nocontent");
   noRoleParams.put(ROLE_AU_ADMIN, "noau");
   noRoleParams.put(ROLE_DEBUG, "nodebug");
 }
예제 #7
0
  private void customizeNodes(ConfigProcessor processor, CIJob job)
      throws JDOMException, PhrescoException {

    // SVN url customization
    if (SVN.equals(job.getRepoType())) {
      S_LOGGER.debug("This is svn type project!!!!!");
      processor.changeNodeValue(SCM_LOCATIONS_REMOTE, job.getSvnUrl());
    } else if (GIT.equals(job.getRepoType())) {
      S_LOGGER.debug("This is git type project!!!!!");
      processor.changeNodeValue(SCM_USER_REMOTE_CONFIGS_URL, job.getSvnUrl());
      processor.changeNodeValue(SCM_BRANCHES_NAME, job.getBranch());
      // cloned workspace
    } else if (CLONED_WORKSPACE.equals(job.getRepoType())) {
      S_LOGGER.debug("Clonned workspace selected!!!!!!!!!!");
      processor.useClonedScm(job.getUsedClonnedWorkspace(), SUCCESSFUL);
    }

    // Schedule expression customization
    processor.changeNodeValue(TRIGGERS_SPEC, job.getScheduleExpression());

    // Triggers Implementation
    List<String> triggers = job.getTriggers();

    processor.createTriggers(TRIGGERS, triggers, job.getScheduleExpression());

    // if the technology is java stanalone and functional test , goal have to specified in post
    // build step only
    if (job.isEnablePostBuildStep() && FUNCTIONAL_TEST.equals(job.getOperation())) {
      // Maven command customization
      processor.changeNodeValue(GOALS, CI_FUNCTIONAL_ADAPT.trim());
    } else {
      // Maven command customization
      processor.changeNodeValue(GOALS, job.getMvnCommand());
    }

    // Recipients customization
    Map<String, String> email = job.getEmail();

    // Failure Reception list
    processor.changeNodeValue(
        TRIGGER_FAILURE_EMAIL_RECIPIENT_LIST, (String) email.get(FAILURE_EMAILS));

    // Success Reception list
    processor.changeNodeValue(
        TRIGGER_SUCCESS__EMAIL_RECIPIENT_LIST, (String) email.get(SUCCESS_EMAILS));

    // enable collabnet file release plugin integration
    if (job.isEnableBuildRelease()) {
      S_LOGGER.debug("Enablebling collabnet file release plugin ");
      processor.enableCollabNetBuildReleasePlugin(job);
    }

    // use clonned scm
    if (CLONED_WORKSPACE.equals(job.getRepoType())) {
      S_LOGGER.debug("using cloned workspace ");
      processor.useClonedScm(job.getUsedClonnedWorkspace(), SUCCESSFUL);
    }

    // clone workspace for future use
    if (job.isCloneWorkspace()) {
      S_LOGGER.debug("Clonning the workspace ");
      processor.cloneWorkspace(ALL_FILES, SUCCESSFUL, TAR);
    }

    // Build Other projects
    if (StringUtils.isNotEmpty(job.getDownStreamProject())) {
      S_LOGGER.debug("Enabling downstream project!!!!!!");
      processor.buildOtherProjects(job.getDownStreamProject());
    }

    // pom location specifier
    if (StringUtils.isNotEmpty(job.getPomLocation())) {
      S_LOGGER.debug("POM location changing " + job.getPomLocation());
      processor.updatePOMLocation(job.getPomLocation());
    }

    if (job.isEnablePostBuildStep()) {
      System.out.println("java stanalone technology with functional test enabled!!!!!!!");
      String mvnCommand = job.getMvnCommand();
      String[] ciAdapted =
          mvnCommand.split(CI_FUNCTIONAL_ADAPT); // java stanalone functional test alone
      for (String ciCommand : ciAdapted) {
        S_LOGGER.debug("ciCommand...." + ciCommand);
      }
      // iterate over loop
      processor.enablePostBuildStep(job.getPomLocation(), ciAdapted[1]);
    }

    if (job.isEnablePreBuildStep()) {
      System.out.println("java stanalone technology with functional test enabled!!!!!!!");
      // iterate over loop
      List<String> prebuildStepCommands = job.getPrebuildStepCommands();
      for (String prebuildStepCommand : prebuildStepCommands) {
        processor.enablePreBuildStep(job.getPomLocation(), prebuildStepCommand);
      }
    }
  }