Search in sources :

Example 6 with JsonDecoder

use of com.yahoo.slime.JsonDecoder in project vespa by vespa-engine.

the class ProjectBundleClassPaths method load.

static ProjectBundleClassPaths load(byte[] bytes) {
    Slime slime = new Slime();
    new JsonDecoder().decode(slime, bytes);
    Inspector inspector = slime.get();
    BundleClasspathMapping mainBundle = BundleClasspathMapping.load(inspector.field("mainBundle"));
    Inspector dependenciesInspector = inspector.field("providedDependencies");
    List<BundleClasspathMapping> providedDependencies = new ArrayList<>();
    for (int i = 0; i < dependenciesInspector.entries(); i++) {
        providedDependencies.add(BundleClasspathMapping.load(dependenciesInspector.entry(i)));
    }
    return new ProjectBundleClassPaths(mainBundle, providedDependencies);
}
Also used : JsonDecoder(com.yahoo.slime.JsonDecoder) ArrayList(java.util.ArrayList) Inspector(com.yahoo.slime.Inspector) Slime(com.yahoo.slime.Slime)

Aggregations

JsonDecoder (com.yahoo.slime.JsonDecoder)6 Slime (com.yahoo.slime.Slime)6 Inspector (com.yahoo.slime.Inspector)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 Test (org.junit.Test)2 HttpResponse (com.yahoo.container.jdisc.HttpResponse)1 Value (com.yahoo.data.access.simple.Value)1 SlimeAdapter (com.yahoo.data.access.slime.SlimeAdapter)1 ArrayTraverser (com.yahoo.slime.ArrayTraverser)1 ArrayList (java.util.ArrayList)1