Search in sources :

Example 1 with IExportWriter

use of io.apiman.manager.api.exportimport.write.IExportWriter in project apiman by apiman.

the class ExportImportManager method doExport.

private void doExport() {
    IExportWriter writer = eiFactories.get(config.getProvider()).createWriter(config, exportLogger);
    exporter.init(writer);
    exporter.export();
}
Also used : IExportWriter(io.apiman.manager.api.exportimport.write.IExportWriter)

Example 2 with IExportWriter

use of io.apiman.manager.api.exportimport.write.IExportWriter in project apiman by apiman.

the class SystemResourceImpl method exportData.

/**
 * @see ISystemResource#exportData()
 */
@Override
public Response exportData() {
    final IApimanLogger exportLogger = ApimanLoggerFactory.getLogger(IExportWriter.class);
    StreamingOutput stream = new StreamingOutput() {

        @Override
        public void write(OutputStream os) throws IOException, WebApplicationException {
            IExportWriter writer = new JsonExportWriter(os, exportLogger);
            exporter.init(writer);
            exporter.export();
            os.flush();
        }
    };
    return Response.ok(stream, MediaType.APPLICATION_JSON).header("Content-Disposition", // $NON-NLS-1$ //$NON-NLS-2$
    "attachment; filename=api-manager-export.json").build();
}
Also used : JsonExportWriter(io.apiman.manager.api.exportimport.json.JsonExportWriter) IExportWriter(io.apiman.manager.api.exportimport.write.IExportWriter) OutputStream(java.io.OutputStream) StreamingOutput(javax.ws.rs.core.StreamingOutput) IApimanLogger(io.apiman.common.logging.IApimanLogger)

Aggregations

IExportWriter (io.apiman.manager.api.exportimport.write.IExportWriter)2 IApimanLogger (io.apiman.common.logging.IApimanLogger)1 JsonExportWriter (io.apiman.manager.api.exportimport.json.JsonExportWriter)1 OutputStream (java.io.OutputStream)1 StreamingOutput (javax.ws.rs.core.StreamingOutput)1