Пример #1
0
  @SuppressWarnings("unused") // called through reflection by RequestServer
  /**
   * Fetch the metadata for a Schema by its simple Schema name (e.g., "DeepLearningParametersV2").
   */
  public MetadataV3 fetchSchemaMetadata(int version, MetadataV3 docs) {
    if ("void".equals(docs.schemaname)) {
      docs.schemas = new SchemaMetadataBase[0];
      return docs;
    }

    docs.schemas = new SchemaMetadataBase[1];
    // NOTE: this will throw an exception if the classname isn't found:
    SchemaMetadataBase meta =
        (SchemaMetadataBase)
            Schema.schema(version, SchemaMetadata.class)
                .fillFromImpl(new SchemaMetadata(Schema.newInstance(docs.schemaname)));
    docs.schemas[0] = meta;
    return docs;
  }
Пример #2
0
 @SuppressWarnings("unused") // called through reflection by RequestServer
 @Deprecated
 /**
  * Fetch the metadata for a Schema by its full internal classname, e.g.
  * "hex.schemas.DeepLearningV2.DeepLearningParametersV2". TODO: Do we still need this?
  */
 public MetadataV3 fetchSchemaMetadataByClass(int version, MetadataV3 docs) {
   docs.schemas = new SchemaMetadataBase[1];
   // NOTE: this will throw an exception if the classname isn't found:
   SchemaMetadataBase meta =
       (SchemaMetadataBase)
           Schema.schema(version, SchemaMetadata.class)
               .fillFromImpl(SchemaMetadata.createSchemaMetadata(docs.classname));
   docs.schemas[0] = meta;
   return docs;
 }
Пример #3
0
  @SuppressWarnings("unused") // called through reflection by RequestServer
  /** Fetch the metadata for all the Schemas. */
  public MetadataV3 listSchemas(int version, MetadataV3 docs) {
    Map<String, Class<? extends Schema>> ss = Schema.schemas();
    docs.schemas = new SchemaMetadataBase[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!
      docs.schemas[i++] =
          (SchemaMetadataBase)
              Schema.schema(version, SchemaMetadata.class)
                  .fillFromImpl(new SchemaMetadata(Schema.newInstance(schema_class)));
    }
    return docs;
  }