示例#1
0
 private ModelNode getAddConnectorOp(
     Connector conn, String keyPEMFile, String certPEMFile, String keyStoreFile, String password) {
   ModelNode op =
       createOpNode("subsystem=web/connector=test-" + conn.getName() + "-connector", "add");
   op.get("socket-binding").set("test-" + conn.getName());
   op.get("scheme").set(conn.getScheme());
   op.get("protocol").set(conn.getProtocol());
   op.get("secure").set(conn.isSecure());
   op.get("enabled").set(true);
   if (conn.isSecure()) {
     ModelNode ssl = new ModelNode();
     if (conn.equals(Connector.HTTPSNATIVE)) {
       ssl.get("certificate-key-file").set(keyPEMFile);
       ssl.get("certificate-file").set(certPEMFile);
     } else {
       ssl.get("certificate-key-file").set(keyStoreFile);
     }
     ssl.get("password").set(password);
     op.get("ssl").set(ssl);
   }
   return op;
 }
示例#2
0
  /**
   * Create a description of the current search graph in GraphViz (dot) format. Nodes are identified
   * and printed by giving the underlying variable assignments and an indicator whether the node is
   * currently marked as proven. For each connector and each child variable, an arc from the parent
   * to the child is drawn, labelled with the protagonist operator to which the connector
   * corresponds.
   *
   * @param complete True if the complete graph should be drawn, and false if only marked connectors
   *     should be followed
   * @return A string containing the complete GraphViz (dot) description
   */
  public String createOutputStateSpace(boolean complete) {
    List<AOStarNode> seenNodes = new LinkedList<AOStarNode>();
    List<Connector> seenConnectors = new LinkedList<Connector>();
    Queue<AOStarNode> queue = new LinkedList<AOStarNode>();
    queue.offer(search.stateNodeMap.get(Global.problem.getSingleInitialState().uniqueID));

    while (!queue.isEmpty()) {
      AOStarNode node = queue.poll();
      seenNodes.add(node);

      Collection<Connector> connectors = null;
      if (complete) {
        connectors = node.outgoingConnectors;
      } else {
        connectors = new ArrayList<Connector>();
        if (node.markedConnector != null) {
          connectors.add(node.markedConnector);
        }
      }

      for (Connector connector : connectors) {
        seenConnectors.add(connector);
        for (AOStarNode next : connector.children) {
          if (!seenNodes.contains(next) && !queue.contains(next)) {
            queue.offer(next);
          }
        }
      }
    }

    StringBuffer buffer = new StringBuffer();

    buffer.append("digraph {\n");

    for (AOStarNode node : seenNodes) {
      buffer.append(node.index);
      buffer.append(" [ peripheries=\"1\", shape=\"rectangle\", ");
      if (node.isGoalNode) {
        buffer.append("fontcolor=\"white\", style=\"filled\", fillcolor=\"blue\", ");
      } else {
        if (!node.isProven()) {
          if (node.isDisproven() && !node.isExpanded()) {
            buffer.append("style=\"filled\", fillcolor=\"red\", ");
          } else if ((node.isDisproven() && node.isExpanded())) {
            buffer.append("style=\"filled,rounded\", fillcolor=\"red\", ");
          } else if (!node.isExpanded()) {
            buffer.append("style=\"filled\", fillcolor=\"yellow\", ");
          } else {
            buffer.append("style=\"rounded\", ");
          }
        } else {
          if (!node.isExpanded()) {
            buffer.append("style=\"filled\", fillcolor=\"green\", ");
          } else {
            buffer.append("style=\"filled,rounded\", fillcolor=\"green\", ");
          }
        }
      }
      buffer.append("label=\"");
      buffer.append("index: " + node.index + "\\n");
      buffer.append("cost estimate: " + node.costEstimate + "\\n");
      if (Global.problem.isFullObservable) {
        for (int i = 0; i < ((ExplicitState) node.state).size - 1; i++) {
          String tmp =
              Global.problem
                  .propositionNames
                  .get(i)
                  .get(((ExplicitState) node.state).variableValueAssignment.get(i));
          if (!tmp.startsWith("(not")) {
            buffer.append(tmp);
            buffer.append("\\n");
          }
        }
        buffer.append(
            Global.problem
                .propositionNames
                .get(((ExplicitState) node.state).size - 1)
                .get(
                    ((ExplicitState) node.state)
                        .variableValueAssignment.get(((ExplicitState) node.state).size - 1)));
      }
      buffer.append("\" ]\n");
    }
    for (Connector connector : seenConnectors) {
      for (AOStarNode next : connector.children) {
        buffer.append(connector.parent.index);
        buffer.append(" -> ");
        buffer.append(next.index);
        buffer.append(" [ label=\"");
        buffer.append(connector.operator.getName());
        buffer.append("\"");
        if (complete && connector.equals(connector.parent.markedConnector) && connector.isSafe) {
          buffer.append(", style=\"bold\", color=\"red:blue\" ");
        } else if (complete
            && connector.equals(connector.parent.markedConnector)
            && !connector.isSafe) {
          buffer.append(", style=\"bold\", color=\"red\" ");
        } else if (connector.isSafe) {
          buffer.append(", style=\"bold\", color=\"blue\" ");
        }
        buffer.append(" ]\n");
      }
    }
    buffer.append("}\n");
    return buffer.toString();
  }