Search in sources :

Example 6 with HelixRestNamespace

use of org.apache.helix.rest.common.HelixRestNamespace in project helix by apache.

the class HelixRestMain method constructNamespaceFromConfigFile.

private static void constructNamespaceFromConfigFile(String filePath, List<HelixRestNamespace> namespaces) throws IOException {
    Yaml yaml = new Yaml();
    @SuppressWarnings("unchecked") ArrayList<Map<String, String>> configs = (ArrayList<Map<String, String>>) yaml.load(new FileInputStream(new File(filePath)));
    for (Map<String, String> config : configs) {
        // Currently we don't support adding default namespace through yaml manifest so all
        // namespaces created here will not be default
        // TODO: support specifying default namespace from config file
        namespaces.add(new HelixRestNamespace(config.get(HelixRestNamespace.HelixRestNamespaceProperty.NAME.name()), HelixRestNamespace.HelixMetadataStoreType.valueOf(config.get(HelixRestNamespace.HelixRestNamespaceProperty.METADATA_STORE_TYPE.name())), config.get(HelixRestNamespace.HelixRestNamespaceProperty.METADATA_STORE_ADDRESS.name()), false));
    }
}
Also used : ArrayList(java.util.ArrayList) HelixRestNamespace(org.apache.helix.rest.common.HelixRestNamespace) Map(java.util.Map) File(java.io.File) Yaml(org.yaml.snakeyaml.Yaml) FileInputStream(java.io.FileInputStream)

Aggregations

HelixRestNamespace (org.apache.helix.rest.common.HelixRestNamespace)6 ArrayList (java.util.ArrayList)5 Map (java.util.Map)2 HelixException (org.apache.helix.HelixException)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 URI (java.net.URI)1 List (java.util.List)1 GET (javax.ws.rs.GET)1 CommandLine (org.apache.commons.cli.CommandLine)1 CommandLineParser (org.apache.commons.cli.CommandLineParser)1 GnuParser (org.apache.commons.cli.GnuParser)1 Options (org.apache.commons.cli.Options)1 ParseException (org.apache.commons.cli.ParseException)1 AuditLogger (org.apache.helix.rest.server.auditlog.AuditLogger)1 FileBasedAuditLogger (org.apache.helix.rest.server.auditlog.auditloggers.FileBasedAuditLogger)1 Server (org.eclipse.jetty.server.Server)1 ServletContextHandler (org.eclipse.jetty.servlet.ServletContextHandler)1 DeploymentContext (org.glassfish.jersey.test.DeploymentContext)1