use of org.codehaus.enunciate.Facet in project data-access by pentaho.
the class ConnectionService method createDatabaseConnection.
/**
* Create a database connection
*
* @param driver
* String name of the driver to use
* @param url
* String name of the url used to create the connection.
*
* @return IDatabaseConnection for the given parameters
*/
@GET
@Path("/createDatabaseConnection")
@Produces({ APPLICATION_JSON })
@Facet(name = "Unsupported")
public IDatabaseConnection createDatabaseConnection(@QueryParam("driver") String driver, @QueryParam("url") String url) {
for (IDatabaseDialect dialect : dialectService.getDatabaseDialects()) {
if (dialect.getNativeDriver() != null && dialect.getNativeDriver().equals(driver)) {
if (dialect.getNativeJdbcPre() != null && url.startsWith(dialect.getNativeJdbcPre())) {
return dialect.createNativeConnection(url);
}
}
}
// if no native driver was found, create a custom dialect object.
IDatabaseConnection conn = genericDialect.createNativeConnection(url);
conn.getAttributes().put(GenericDatabaseDialect.ATTRIBUTE_CUSTOM_DRIVER_CLASS, driver);
return conn;
}
use of org.codehaus.enunciate.Facet 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;
}
use of org.codehaus.enunciate.Facet in project data-access by pentaho.
the class DatasourceResource method getAnalysisDatasourceInfo.
/**
* Get the data source wizard info (parameters) for a specific data source wizard id
*
* @param dswId
* String id for a data source wizard
*
* @return Response containing the parameter list
*/
@GET
@Path("/{catalogId : .+}/getAnalysisDatasourceInfo")
@Produces(WILDCARD)
@Facet(name = "Unsupported")
public Response getAnalysisDatasourceInfo(@PathParam("catalogId") String catalogId) {
IMondrianCatalogService mondrianCatalogService = PentahoSystem.get(IMondrianCatalogService.class, PentahoSessionHolder.getSession());
MondrianCatalog catalog = mondrianCatalogService.getCatalog(catalogId, PentahoSessionHolder.getSession());
if (catalog == null) {
logger.warn("Catalog " + catalogId + " doesn't exist");
return Response.status(Response.Status.BAD_REQUEST).build();
}
// dataSourceInfo can contain XML-escaped characters
String parameters = prepareDataSourceInfo(catalog.getDataSourceInfo());
// after preparation, parameters have escaped only quotes
return Response.ok().entity(parameters).build();
}
Aggregations