Search in sources :

Example 1 with DefaultDatabaseConnectionList

use of org.pentaho.ui.database.event.DefaultDatabaseConnectionList in project data-access by pentaho.

the class DatabaseConnectionListReaderWriter method readFrom.

@Override
public IDatabaseConnectionList readFrom(Class<IDatabaseConnectionList> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException {
    JSONDeserializer<DefaultDatabaseConnectionList> jsonD = new JSONDeserializer<DefaultDatabaseConnectionList>();
    jsonD.use("databaseType", DatabaseType.class);
    return jsonD.deserialize(new InputStreamReader(entityStream), DefaultDatabaseConnectionList.class);
}
Also used : InputStreamReader(java.io.InputStreamReader) DefaultDatabaseConnectionList(org.pentaho.ui.database.event.DefaultDatabaseConnectionList) JSONDeserializer(flexjson.JSONDeserializer)

Example 2 with DefaultDatabaseConnectionList

use of org.pentaho.ui.database.event.DefaultDatabaseConnectionList in project data-access by pentaho.

the class ConnectionService method getConnections.

/**
 * Returns the list of database connections
 *
 * @return List of database connections
 *
 * @throws ConnectionServiceException
 */
@GET
@Path("/list")
@Produces({ APPLICATION_JSON })
@Facet(name = "Unsupported")
public IDatabaseConnectionList getConnections() throws ConnectionServiceException {
    IDatabaseConnectionList databaseConnections = new DefaultDatabaseConnectionList();
    List<IDatabaseConnection> conns = connectionService.getConnections(true);
    databaseConnections.setDatabaseConnections(conns);
    return databaseConnections;
}
Also used : DefaultDatabaseConnectionList(org.pentaho.ui.database.event.DefaultDatabaseConnectionList) IDatabaseConnectionList(org.pentaho.ui.database.event.IDatabaseConnectionList) IDatabaseConnection(org.pentaho.database.model.IDatabaseConnection) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) Facet(org.codehaus.enunciate.Facet)

Aggregations

DefaultDatabaseConnectionList (org.pentaho.ui.database.event.DefaultDatabaseConnectionList)2 JSONDeserializer (flexjson.JSONDeserializer)1 InputStreamReader (java.io.InputStreamReader)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 Facet (org.codehaus.enunciate.Facet)1 IDatabaseConnection (org.pentaho.database.model.IDatabaseConnection)1 IDatabaseConnectionList (org.pentaho.ui.database.event.IDatabaseConnectionList)1