mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
Make app coord svc namespace ext point
This commit is contained in:
parent
bd0649af96
commit
de8dc8f425
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2016-2017 Basis Technology Corp.
|
||||
* Copyright 2011-2017 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -19,15 +19,15 @@
|
||||
package org.sleuthkit.autopsy.coordinationservice;
|
||||
|
||||
/**
|
||||
* Root node for Autopsy coordination service namespace.
|
||||
* Interface for providers of application-level coordination service namespaces.
|
||||
*/
|
||||
public final class CoordinationServiceNamespace {
|
||||
private static final String ROOT = "autopsy";
|
||||
public interface AppCoordinationServiceNamespace {
|
||||
|
||||
public static String getRoot() {
|
||||
return ROOT;
|
||||
}
|
||||
/**
|
||||
* Gets the name of the root node of the namespace for the application.
|
||||
*
|
||||
* @return The name of the root node for the application namespace.
|
||||
*/
|
||||
public String getAppNamespaceRoot();
|
||||
|
||||
private CoordinationServiceNamespace() {
|
||||
}
|
||||
}
|
@ -19,7 +19,9 @@
|
||||
package org.sleuthkit.autopsy.coordinationservice;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.apache.curator.RetryPolicy;
|
||||
@ -34,6 +36,7 @@ import org.apache.zookeeper.KeeperException.NoNodeException;
|
||||
import org.apache.zookeeper.WatchedEvent;
|
||||
import org.apache.zookeeper.ZooDefs;
|
||||
import org.apache.zookeeper.ZooKeeper;
|
||||
import org.openide.util.Lookup;
|
||||
import org.sleuthkit.autopsy.core.UserPreferences;
|
||||
|
||||
/**
|
||||
@ -92,7 +95,13 @@ public final class CoordinationService {
|
||||
* @return The name of the root node for the application namespace.
|
||||
*/
|
||||
public static String getAppNamespaceRoot() {
|
||||
return DEFAULT_NAMESPACE_ROOT;
|
||||
Collection<? extends AppCoordinationServiceNamespace> providers = Lookup.getDefault().lookupAll(AppCoordinationServiceNamespace.class);
|
||||
Iterator<? extends AppCoordinationServiceNamespace> it = providers.iterator();
|
||||
if (it.hasNext()) {
|
||||
return it.next().getAppNamespaceRoot();
|
||||
} else {
|
||||
return DEFAULT_NAMESPACE_ROOT;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user