class SerializableMetadataProvider extends MemoryMetadataProvider implements IHopMetadataProvider {

  public String toJson() throws HopException {

    JSONObject jStore = new JSONObject();

    // What is the list of available classes?
    //
    for (Class<IHopMetadata> metadataClass : getMetadataClasses()) {
      IHopMetadataSerializer<IHopMetadata> serializer = getSerializer( metadataClass );
      HopMetadata hopMetadata = metadataClass.getAnnotation( HopMetadata.class );
      if (hopMetadata==null) {
        throw new HopException("Error: class "+metadataClass+" is not annotated with "+HopMetadata.class.getName());
      }
      String classKey = hopMetadata.key();

      JSONArray jClass = new JSONArray();

      JsonMetadataParser parser = new JsonMetadataParser( metadataClass, this );

      // Loop over the available objects of the class and copy the information over to the JSON store.
      // They are stored under plugin IDs...
      //
      for (String name : serializer.listObjectNames()) {
        Object object = serializer.load( name );
        JSONObject jObject = parser.getJsonObject( (IHopMetadata) object );
        jClass.add(jObject);
      }

      jStore.put( classKey, jClass );

    }
    return jStore.toJSONString();
  }

  public  SerializableMetadataProvider();
  public  SerializableMetadataProvider( IHopMetadataProvider source);
  public  SerializableMetadataProvider( String storeJson);

}