Search in sources :

Example 1 with SchemaMetadataV3

use of water.api.schemas3.SchemaMetadataV3 in project h2o-3 by h2oai.

the class MetadataHandler method listSchemas.

/** Fetch the metadata for all the Schemas. */
// called through reflection by RequestServer
@SuppressWarnings("unused")
public MetadataV3 listSchemas(int version, MetadataV3 docs) {
    Map<String, Class<? extends Schema>> ss = SchemaServer.schemas();
    docs.schemas = new SchemaMetadataV3[ss.size()];
    // NOTE: this will throw an exception if the classname isn't found:
    int i = 0;
    for (Class<? extends Schema> schema_class : ss.values()) {
        // No hardwired version! YAY!  FINALLY!
        Schema schema = Schema.newInstance(schema_class);
        // get defaults
        try {
            Iced impl = (Iced) schema.getImplClass().newInstance();
            schema.fillFromImpl(impl);
        } catch (Exception e) {
        // ignore if create fails; this can happen for abstract classes
        }
        docs.schemas[i++] = new SchemaMetadataV3(new SchemaMetadata(schema));
    }
    return docs;
}
Also used : SchemaMetadataV3(water.api.schemas3.SchemaMetadataV3) Iced(water.Iced) MalformedURLException(java.net.MalformedURLException)

Example 2 with SchemaMetadataV3

use of water.api.schemas3.SchemaMetadataV3 in project h2o-3 by h2oai.

the class MetadataHandler method fetchSchemaMetadata.

/** Fetch the metadata for a Schema by its simple Schema name (e.g., "DeepLearningParametersV2"). */
// called through reflection by RequestServer
@SuppressWarnings("unused")
public MetadataV3 fetchSchemaMetadata(int version, MetadataV3 docs) {
    if ("void".equals(docs.schemaname)) {
        docs.schemas = new SchemaMetadataV3[0];
        return docs;
    }
    docs.schemas = new SchemaMetadataV3[1];
    // NOTE: this will throw an exception if the classname isn't found:
    Schema schema = Schema.newInstance(docs.schemaname);
    // get defaults
    try {
        Iced impl = (Iced) schema.getImplClass().newInstance();
        schema.fillFromImpl(impl);
    } catch (Exception e) {
    // ignore if create fails; this can happen for abstract classes
    }
    SchemaMetadataV3 meta = new SchemaMetadataV3(new SchemaMetadata(schema));
    docs.schemas[0] = meta;
    return docs;
}
Also used : SchemaMetadataV3(water.api.schemas3.SchemaMetadataV3) Iced(water.Iced) MalformedURLException(java.net.MalformedURLException)

Example 3 with SchemaMetadataV3

use of water.api.schemas3.SchemaMetadataV3 in project h2o-3 by h2oai.

the class MetadataHandler method fetchSchemaMetadataByClass.

/** Fetch the metadata for a Schema by its full internal classname, e.g. "hex.schemas.DeepLearningV2.DeepLearningParametersV2".  TODO: Do we still need this? */
@Deprecated
// called through reflection by RequestServer
@SuppressWarnings("unused")
public MetadataV3 fetchSchemaMetadataByClass(int version, MetadataV3 docs) {
    docs.schemas = new SchemaMetadataV3[1];
    // NOTE: this will throw an exception if the classname isn't found:
    SchemaMetadataV3 meta = new SchemaMetadataV3(SchemaMetadata.createSchemaMetadata(docs.classname));
    docs.schemas[0] = meta;
    return docs;
}
Also used : SchemaMetadataV3(water.api.schemas3.SchemaMetadataV3)

Aggregations

SchemaMetadataV3 (water.api.schemas3.SchemaMetadataV3)3 MalformedURLException (java.net.MalformedURLException)2 Iced (water.Iced)2