use of psiprobe.model.ApplicationResource in project psi-probe by psi-probe.
the class ListAllJdbcResourceGroupsController method handleRequestInternal.
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
List<DataSourceInfoGroup> dataSourceGroups = new ArrayList<>();
List<DataSourceInfo> dataSources = new ArrayList<>();
List<ApplicationResource> privateResources = getContainerWrapper().getPrivateDataSources();
List<ApplicationResource> globalResources = getContainerWrapper().getGlobalDataSources();
// filter out anything that is not a datasource
// and use only those datasources that are properly configured
// as aggregated totals would not make any sense otherwise
filterValidDataSources(privateResources, dataSources);
filterValidDataSources(globalResources, dataSources);
// sort datasources by JDBC URL
Collections.sort(dataSources, new Comparator<DataSourceInfo>() {
@Override
public int compare(DataSourceInfo ds1, DataSourceInfo ds2) {
String jdbcUrl1 = ds1.getJdbcUrl();
String jdbcUrl2 = ds2.getJdbcUrl();
return jdbcUrl1.compareToIgnoreCase(jdbcUrl2);
}
});
// group datasources by JDBC URL and calculate aggregated totals
DataSourceInfoGroup dsGroup = null;
for (DataSourceInfo ds : dataSources) {
if (dsGroup == null || !dsGroup.getJdbcUrl().equalsIgnoreCase(ds.getJdbcUrl())) {
dsGroup = new DataSourceInfoGroup().builder(ds);
dataSourceGroups.add(dsGroup);
} else {
dsGroup.addDataSourceInfo(ds);
}
}
return new ModelAndView(getViewName(), "dataSourceGroups", dataSourceGroups);
}
use of psiprobe.model.ApplicationResource in project psi-probe by psi-probe.
the class ListAllJdbcResourcesController method handleRequestInternal.
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse httpServletResponse) throws Exception {
boolean supportsGlobal = getContainerWrapper().getResourceResolver().supportsGlobalResources();
boolean supportsPrivate = getContainerWrapper().getResourceResolver().supportsPrivateResources();
boolean supportsDataSourceLookup = getContainerWrapper().getResourceResolver().supportsDataSourceLookup();
List<ApplicationResource> privateResources = getContainerWrapper().getPrivateDataSources();
List<ApplicationResource> globalResources = getContainerWrapper().getGlobalDataSources();
return new ModelAndView(getViewName()).addObject("supportsGlobal", supportsGlobal).addObject("supportsPrivate", supportsPrivate).addObject("supportsDSLookup", supportsDataSourceLookup).addObject("privateResources", privateResources).addObject("globalResources", globalResources);
}
use of psiprobe.model.ApplicationResource in project psi-probe by psi-probe.
the class Tomcat85ContainerAdapter method addContextResource.
@Override
public void addContextResource(Context context, List<ApplicationResource> resourceList, boolean contextBound) {
NamingResourcesImpl namingResources = context.getNamingResources();
for (ContextResource contextResource : namingResources.findResources()) {
ApplicationResource resource = new ApplicationResource();
logger.info("reading resource: {}", contextResource.getName());
resource.setApplicationName(context.getName());
resource.setName(contextResource.getName());
resource.setType(contextResource.getType());
resource.setScope(contextResource.getScope());
resource.setAuth(contextResource.getAuth());
resource.setDescription(contextResource.getDescription());
resourceList.add(resource);
}
}
use of psiprobe.model.ApplicationResource in project psi-probe by psi-probe.
the class Tomcat85ContainerAdapter method addContextResourceLink.
@Override
public void addContextResourceLink(Context context, List<ApplicationResource> resourceList, boolean contextBound) {
NamingResourcesImpl namingResources = context.getNamingResources();
for (ContextResourceLink link : namingResources.findResourceLinks()) {
ApplicationResource resource = new ApplicationResource();
logger.debug("reading resourceLink: {}", link.getName());
resource.setApplicationName(context.getName());
resource.setName(link.getName());
resource.setType(link.getType());
resource.setLinkTo(link.getGlobal());
registerGlobalResourceAccess(link);
resourceList.add(resource);
}
}
use of psiprobe.model.ApplicationResource in project psi-probe by psi-probe.
the class Tomcat10ContainerAdapter method addContextResource.
@Override
public void addContextResource(Context context, List<ApplicationResource> resourceList, boolean contextBound) {
NamingResourcesImpl namingResources = context.getNamingResources();
for (ContextResource contextResource : namingResources.findResources()) {
ApplicationResource resource = new ApplicationResource();
logger.info("reading resource: {}", contextResource.getName());
resource.setApplicationName(context.getName());
resource.setName(contextResource.getName());
resource.setType(contextResource.getType());
resource.setScope(contextResource.getScope());
resource.setAuth(contextResource.getAuth());
resource.setDescription(contextResource.getDescription());
resourceList.add(resource);
}
}
Aggregations