diff --git a/src/main/java/kieker/analysis/TraceAnalysisConfiguration.java b/src/main/java/kieker/analysis/TraceAnalysisConfiguration.java index 520c9ad7f2fdcbb55f0a17b0d2a1e4b84436df34..464eca58d955f67f37fcc4ce8fdfc230ff7f92db 100644 --- a/src/main/java/kieker/analysis/TraceAnalysisConfiguration.java +++ b/src/main/java/kieker/analysis/TraceAnalysisConfiguration.java @@ -9,6 +9,9 @@ import java.util.List; import com.tinkerpop.blueprints.Graph; +import kieker.analysis.dev.nestedgraph.NestedGraph; +import kieker.analysis.dev.nestedgraphstages.NestedGraphFactory; +import kieker.analysis.dev.nestedgraphstages.NestedGraphPrinterStage; import kieker.analysis.stage.tracediagnosis.AllowedRecordsFilter; import kieker.analysis.stage.tracediagnosis.BeginEndOfMonitoringDetector; import kieker.analysis.stage.tracediagnosis.OperationCallHandlerComposite; @@ -29,6 +32,7 @@ import kieker.common.record.misc.KiekerMetadataRecord; import teetime.framework.Configuration; import teetime.stage.CollectorSink; import teetime.stage.MultipleInstanceOfFilter; +import teetime.stage.ObjectProducer; import teetime.stage.basic.distributor.Distributor; import teetime.stage.basic.distributor.strategy.CopyByReferenceStrategy; @@ -104,15 +108,11 @@ public class TraceAnalysisConfiguration extends Configuration { // TODO Temp Some examples for nested graphs - /* - * final NestedGraphFactory nestedGraphFactory = new NestedGraphFactory(); - * final ObjectProducer<PartitionGraph<Graph>> nestedGraphProducerStage = new ObjectProducer<>(1, nestedGraphFactory); - * // final NestedGraphMLWriter nestedGraphMLWriter = new NestedGraphMLWriter("example/temp/output"); - * final NestedGraphPrinterStage nestedGraphPrinterStage = new NestedGraphPrinterStage(); - * - * super.connectPorts(nestedGraphProducerStage.getOutputPort(), nestedGraphPrinterStage.getInputPort()); - * // super.connectPorts(nestedGraphProducerStage.getOutputPort(), nestedGraphMLWriter.getInputPort()); - */ + final NestedGraphFactory nestedGraphFactory = new NestedGraphFactory(); + final ObjectProducer<NestedGraph<Graph>> nestedGraphProducerStage = new ObjectProducer<>(1, nestedGraphFactory); + final NestedGraphPrinterStage nestedGraphPrinterStage = new NestedGraphPrinterStage(); + + super.connectPorts(nestedGraphProducerStage.getOutputPort(), nestedGraphPrinterStage.getInputPort()); } diff --git a/src/main/java/kieker/analysis/dev/nestedgraphstages/NestedGraphFactory.java b/src/main/java/kieker/analysis/dev/nestedgraphstages/NestedGraphFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..06d001d1cccd03cbc711865214a1e2a95efccdf9 --- /dev/null +++ b/src/main/java/kieker/analysis/dev/nestedgraphstages/NestedGraphFactory.java @@ -0,0 +1,43 @@ +package kieker.analysis.dev.nestedgraphstages; + +import com.tinkerpop.blueprints.Graph; +import com.tinkerpop.blueprints.Vertex; +import com.tinkerpop.blueprints.impls.tg.TinkerGraph; + +import kieker.analysis.dev.nestedgraph.NestedGraph; +import kieker.analysis.dev.nestedgraph.NestedGraphPartition; + +import teetime.util.ConstructorClosure; + +public class NestedGraphFactory implements ConstructorClosure<NestedGraph<Graph>> { + + @Override + public NestedGraph<Graph> create() { + + NestedGraph<Graph> graph = new NestedGraph<Graph>(new TinkerGraph()); + + Vertex entry = graph.addVertex("Entry"); + + NestedGraphPartition partitionBookstore = new NestedGraphPartition("Bookstore"); + graph.addPartition(partitionBookstore); + Vertex searchBook = graph.addVertexToPartition("searchBook()", partitionBookstore); + + NestedGraphPartition partitionCRM = new NestedGraphPartition("CRM"); + graph.addPartition(partitionCRM); + Vertex getOffers = graph.addVertexToPartition("getOffers()", partitionCRM); + Vertex customMethod = graph.addVertexToPartition("customMethod()", partitionCRM); + + NestedGraphPartition partitionCatalog = new NestedGraphPartition("Catalog"); + graph.addPartition(partitionCatalog); + Vertex getBook = graph.addVertexToPartition("getBook()", partitionCatalog); + + graph.addEdge(null, entry, searchBook, "100"); + graph.addEdge(null, searchBook, getBook, "100"); + graph.addEdge(null, searchBook, getOffers, "100"); + graph.addEdge(null, getOffers, getBook, "96"); + graph.addEdge(null, getOffers, customMethod, "0"); + + return graph; + } + +} diff --git a/src/main/java/kieker/analysis/dev/nestedgraphstages/NestedGraphPrinterStage.java b/src/main/java/kieker/analysis/dev/nestedgraphstages/NestedGraphPrinterStage.java new file mode 100644 index 0000000000000000000000000000000000000000..4adb233361cc4dd78fca5b5c06448a5a194c7cd5 --- /dev/null +++ b/src/main/java/kieker/analysis/dev/nestedgraphstages/NestedGraphPrinterStage.java @@ -0,0 +1,43 @@ +package kieker.analysis.dev.nestedgraphstages; + +import com.tinkerpop.blueprints.Edge; +import com.tinkerpop.blueprints.Graph; +import com.tinkerpop.blueprints.Vertex; + +import kieker.analysis.dev.nestedgraph.NestedGraph; +import kieker.analysis.dev.nestedgraph.NestedGraphPartition; + +import teetime.framework.AbstractConsumerStage; + +public class NestedGraphPrinterStage extends AbstractConsumerStage<NestedGraph<Graph>> { + + @Override + protected void execute(final NestedGraph<Graph> graph) { + + System.out.println("TOP LEVEL:"); + + for (Vertex vertex : graph.getVertices()) { + System.out.println(vertex); + } + + for (Edge edge : graph.getEdges()) { + System.out.println(edge); + } + + for (NestedGraphPartition partition : graph.getPartitions()) { + + System.out.println("PARTITION: " + partition.getName()); + + for (Vertex vertex : graph.getVerticesForPartition(partition)) { + System.out.println(vertex); + } + + for (Edge edge : graph.getEdgesForPartition(partition)) { + System.out.println(edge); + } + + } + + } + +}