1 /* 2 * Licensed under the GPL License. You may not use this file except in compliance with the License. 3 * You may obtain a copy of the License at 4 * 5 * https://www.gnu.org/licenses/old-licenses/gpl-2.0.html 6 * 7 * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 8 * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 9 * PURPOSE. 10 */ 11 package psiprobe.beans; 12 13 import java.util.List; 14 15 import javax.management.MBeanServer; 16 import javax.naming.NamingException; 17 import javax.sql.DataSource; 18 19 import org.apache.catalina.Context; 20 21 import psiprobe.model.ApplicationResource; 22 23 /** 24 * Interface of beans that retrieve information about "resources" of application server. Typically 25 * those resources would be datasources. 26 */ 27 public interface ResourceResolver { 28 29 /** 30 * Standalone Tomcat supports declaration of application-local resources. In that case it makes 31 * sense to associate display of resource/datasource information with the owner application. JBoss 32 * on other hand can only declare "global" resources, which alters the way resource information is 33 * displayed (and accessed). 34 * 35 * @return true if datasources can be associated with applications, otherwise false. 36 * 37 * @see #getApplicationResources(Context, ContainerWrapperBean) 38 */ 39 boolean supportsPrivateResources(); 40 41 /** 42 * Most servlet containers support global resources, but for those that do not, this returns 43 * false. 44 * 45 * @return true if the servlet container supports global resources, otherwise false. 46 * 47 * @see #getApplicationResources() 48 */ 49 boolean supportsGlobalResources(); 50 51 /** 52 * Indicates whether this servlet container exposes datasources via 53 * {@link #lookupDataSource(Context, String, ContainerWrapperBean) JNDI}. 54 * 55 * @return true if the servlet container supports datasource lookup 56 */ 57 boolean supportsDataSourceLookup(); 58 59 /** 60 * Gets the application resources. 61 * 62 * @return the application resources 63 * 64 * @throws NamingException the naming exception 65 */ 66 List<ApplicationResource> getApplicationResources() throws NamingException; 67 68 /** 69 * Gets the application resources. 70 * 71 * @param context the context 72 * @param containerWrapper the container wrapper 73 * 74 * @return the application resources 75 * 76 * @throws NamingException the naming exception 77 */ 78 List<ApplicationResource> getApplicationResources(Context context, 79 ContainerWrapperBean containerWrapper) throws NamingException; 80 81 /** 82 * Reset resource. 83 * 84 * @param context the context 85 * @param resourceName the resource name 86 * @param containerWrapper the container wrapper 87 * 88 * @return true, if successful 89 * 90 * @throws NamingException the naming exception 91 */ 92 boolean resetResource(Context context, String resourceName, ContainerWrapperBean containerWrapper) 93 throws NamingException; 94 95 /** 96 * Lookup data source. 97 * 98 * @param context the context 99 * @param resourceName the resource name 100 * @param containerWrapper the container wrapper 101 * 102 * @return the data source 103 * 104 * @throws NamingException the naming exception 105 */ 106 DataSource lookupDataSource(Context context, String resourceName, 107 ContainerWrapperBean containerWrapper) throws NamingException; 108 109 /** 110 * Method that gets {@link MBeanServer} instance that is "default" for the current environment. It 111 * is preferably to use this method to locate the "default" {@link MBeanServer} implementation. 112 * 113 * @return "default" {@link MBeanServer} instance for the current environment 114 */ 115 MBeanServer getMBeanServer(); 116 }