Search in sources :

Example 1 with AnalysisType

use of org.batfish.coordinator.AnalysisMetadataMgr.AnalysisType in project batfish by batfish.

the class WorkMgr method listAnalyses.

/**
 * Returns the Analysis names which exist in the container and match the {@link AnalysisType}
 *
 * @param containerName Container name
 * @param analysisType {@link AnalysisType} requested
 * @return {@link Set} of container names
 */
public SortedSet<String> listAnalyses(String containerName, AnalysisType analysisType) {
    Path containerDir = getdirContainer(containerName);
    Path analysesDir = containerDir.resolve(BfConsts.RELPATH_ANALYSES_DIR);
    if (!Files.exists(analysesDir)) {
        return ImmutableSortedSet.of();
    }
    SortedSet<String> analyses = CommonUtil.getSubdirectories(analysesDir).stream().map(subdir -> subdir.getFileName().toString()).filter(aName -> selectAnalysis(aName, analysisType, containerName)).collect(ImmutableSortedSet.toImmutableSortedSet(Comparator.naturalOrder()));
    return analyses;
}
Also used : Path(java.nio.file.Path) SortedSet(java.util.SortedSet) AnalysisType(org.batfish.coordinator.AnalysisMetadataMgr.AnalysisType) BfConsts(org.batfish.common.BfConsts) MediaType(javax.ws.rs.core.MediaType) TestrigMetadata(org.batfish.datamodel.TestrigMetadata) References(io.opentracing.References) Answer(org.batfish.datamodel.answers.Answer) Map(java.util.Map) Pair(org.batfish.common.Pair) Path(java.nio.file.Path) ObjectWriter(com.fasterxml.jackson.databind.ObjectWriter) TaskStatus(org.batfish.common.BfConsts.TaskStatus) Set(java.util.Set) Settings(org.batfish.coordinator.config.Settings) UUID(java.util.UUID) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) Task(org.batfish.common.Task) Executors(java.util.concurrent.Executors) UriComponent(org.glassfish.jersey.uri.UriComponent) List(java.util.List) Stream(java.util.stream.Stream) Response(javax.ws.rs.core.Response) Warnings(org.batfish.common.Warnings) WorkItemBuilder(org.batfish.common.util.WorkItemBuilder) Question(org.batfish.datamodel.questions.Question) Entry(java.util.Map.Entry) ProcessingException(javax.ws.rs.ProcessingException) WorkStatusCode(org.batfish.common.CoordConsts.WorkStatusCode) SortedMap(java.util.SortedMap) ExceptionUtils(org.apache.commons.lang3.exception.ExceptionUtils) BatfishLogger(org.batfish.common.BatfishLogger) CommonUtil(org.batfish.common.util.CommonUtil) Client(javax.ws.rs.client.Client) WorkType(org.batfish.coordinator.WorkDetails.WorkType) BatfishException(org.batfish.common.BatfishException) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) AnalysisMetadata(org.batfish.datamodel.AnalysisMetadata) BatfishObjectMapper(org.batfish.common.util.BatfishObjectMapper) AbstractCoordinator(org.batfish.common.plugin.AbstractCoordinator) LinkedList(java.util.LinkedList) Nullable(javax.annotation.Nullable) ImmutableSortedSet(com.google.common.collect.ImmutableSortedSet) ZipUtility(org.batfish.common.util.ZipUtility) WorkItem(org.batfish.common.WorkItem) Files(java.nio.file.Files) JSONObject(org.codehaus.jettison.json.JSONObject) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) GlobalTracer(io.opentracing.util.GlobalTracer) IOException(java.io.IOException) JSONArray(org.codehaus.jettison.json.JSONArray) AnswerStatus(org.batfish.datamodel.answers.AnswerStatus) SpanContext(io.opentracing.SpanContext) TimeUnit(java.util.concurrent.TimeUnit) ParseVendorConfigurationAnswerElement(org.batfish.datamodel.answers.ParseVendorConfigurationAnswerElement) TreeMap(java.util.TreeMap) Paths(java.nio.file.Paths) JSONException(org.codehaus.jettison.json.JSONException) ActiveSpan(io.opentracing.ActiveSpan) WebTarget(javax.ws.rs.client.WebTarget) Container(org.batfish.common.Container) Comparator(java.util.Comparator) QueueType(org.batfish.coordinator.WorkQueueMgr.QueueType) UnzipUtility(org.batfish.common.util.UnzipUtility) InputStream(java.io.InputStream)

Aggregations

JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)1 ImmutableSortedSet (com.google.common.collect.ImmutableSortedSet)1 ActiveSpan (io.opentracing.ActiveSpan)1 References (io.opentracing.References)1 SpanContext (io.opentracing.SpanContext)1 GlobalTracer (io.opentracing.util.GlobalTracer)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 Instant (java.time.Instant)1 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1