All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kurento.tree.server.debug.KmsTopologyGrapher Maven / Gradle / Ivy

/*
 * (C) Copyright 2016 Kurento (http://kurento.org/)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package org.kurento.tree.server.debug;

import java.io.IOException;
import java.util.List;

import org.kurento.tree.server.kms.Kms;
import org.kurento.tree.server.kmsmanager.KmsManager;

public class KmsTopologyGrapher {

  public static void showTopologyGraphic(KmsManager kmsManager) throws IOException {
    showTopologyGraphic(kmsManager.getKmss());
  }

  public static void showTopologyGraphic(List kmss) throws IOException {

    // GraphViz gv = generateTopologyGraphViz(kmss);
    //
    // System.out.println(gv.getDotSource());
    //
    // Path file = Files.createTempFile("kmsTopology", ".pdf");
    //
    // gv.writeGraphToFile(gv.getGraph(gv.getDotSource(), "pdf"), file.toFile());
    //
    // Desktop.getDesktop().open(file.toFile());
  }

  public static String createSvgTopologyGrapher(KmsManager manager) {
    return createSvgTopologyGrapher(manager, true);
  }

  public static String createSvgTopologyGrapher(KmsManager manager, boolean xmlHeader) {

    // GraphViz gv = generateTopologyGraphViz(manager.getKmss());
    //
    // // System.out.println(gv.getDotSource());
    //
    // String svg = new String(gv.getGraph(gv.getDotSource(), "svg"));
    // if (!xmlHeader) {
    // int titleIndex = svg.indexOf("