001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.geronimo.console.util;
018
019 import java.util.Map;
020 import javax.security.auth.Subject;
021 import javax.security.auth.login.LoginException;
022 import javax.security.auth.spi.LoginModule;
023
024 import org.apache.geronimo.gbean.AbstractName;
025 import org.apache.geronimo.gbean.GBeanData;
026 import org.apache.geronimo.kernel.Naming;
027 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
028 import org.apache.geronimo.kernel.repository.Artifact;
029 import org.apache.geronimo.management.AppClientModule;
030 import org.apache.geronimo.management.EJB;
031 import org.apache.geronimo.management.EJBModule;
032 import org.apache.geronimo.management.J2EEDeployedObject;
033 import org.apache.geronimo.management.J2EEModule;
034 import org.apache.geronimo.management.J2EEResource;
035 import org.apache.geronimo.management.JDBCDataSource;
036 import org.apache.geronimo.management.JDBCDriver;
037 import org.apache.geronimo.management.JDBCResource;
038 import org.apache.geronimo.management.JMSResource;
039 import org.apache.geronimo.management.Servlet;
040 import org.apache.geronimo.management.geronimo.J2EEApplication;
041 import org.apache.geronimo.management.geronimo.J2EEDomain;
042 import org.apache.geronimo.management.geronimo.J2EEServer;
043 import org.apache.geronimo.management.geronimo.JCAAdminObject;
044 import org.apache.geronimo.management.geronimo.JCAConnectionFactory;
045 import org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory;
046 import org.apache.geronimo.management.geronimo.JCAResource;
047 import org.apache.geronimo.management.geronimo.JVM;
048 import org.apache.geronimo.management.geronimo.ResourceAdapter;
049 import org.apache.geronimo.management.geronimo.ResourceAdapterModule;
050 import org.apache.geronimo.management.geronimo.WebModule;
051 import org.apache.geronimo.system.logging.SystemLog;
052
053 /**
054 * A helper interface to navigate between management objects. This is not
055 * complete; it will be expanded as necessary.
056 *
057 * @version $Rev: 706640 $ $Date: 2008-10-21 14:44:05 +0000 (Tue, 21 Oct 2008) $
058 */
059 public interface ManagementHelper {
060 // root properties
061 J2EEDomain[] getDomains();
062
063 // server properties
064 J2EEApplication[] getApplications(J2EEServer server);
065 AppClientModule[] getAppClients(J2EEServer server);
066 WebModule[] getWebModules(J2EEServer server);
067 EJBModule[] getEJBModules(J2EEServer server);
068 ResourceAdapterModule[] getRAModules(J2EEServer server);
069 ResourceAdapterModule[] getOutboundRAModules(J2EEServer server, String connectionFactoryInterface);
070 ResourceAdapterModule[] getOutboundRAModules(J2EEServer server, String[] connectionFactoryInterfaces);
071 ResourceAdapterModule[] getAdminObjectModules(J2EEServer server, String[] adminObjectInterfaces);
072 JCAManagedConnectionFactory[] getOutboundFactories(J2EEServer server, String connectionFactoryInterface);
073 JCAResource[] getJCAResources(J2EEServer server);
074 JDBCResource[] getJDBCResources(J2EEServer server);
075 JMSResource[] getJMSResources(J2EEServer server);
076 JVM[] getJavaVMs(J2EEServer server);
077 J2EEResource[] getResources(J2EEServer server);
078
079 // JVM properties
080 SystemLog getSystemLog(JVM jvm);
081
082 // application properties
083 J2EEModule[] getModules(J2EEApplication application);
084 AppClientModule[] getAppClients(J2EEApplication application);
085 WebModule[] getWebModules(J2EEApplication application);
086 EJBModule[] getEJBModules(J2EEApplication application);
087 ResourceAdapterModule[] getRAModules(J2EEApplication application);
088 JCAResource[] getJCAResources(J2EEApplication application);
089 JDBCResource[] getJDBCResources(J2EEApplication application);
090 JMSResource[] getJMSResources(J2EEApplication application);
091
092 // module properties
093 EJB[] getEJBs(EJBModule module);
094 Servlet[] getServlets(WebModule module);
095 ResourceAdapter[] getResourceAdapters(ResourceAdapterModule module);
096 JCAManagedConnectionFactory[] getOutboundFactories(ResourceAdapterModule module);
097 JCAManagedConnectionFactory[] getOutboundFactories(ResourceAdapterModule module, String connectionFactoryInterface);
098 JCAManagedConnectionFactory[] getOutboundFactories(ResourceAdapterModule module, String[] connectionFactoryInterfaces);
099 //todo: create an interface for admin objects
100 JCAAdminObject[] getAdminObjects(ResourceAdapterModule module, String[] adminObjectInterfaces);
101
102 // resource adapter properties
103 JCAResource[] getRAResources(ResourceAdapter adapter);
104
105 // resource properties
106 JDBCDataSource[] getDataSource(JDBCResource resource);
107 JDBCDriver[] getDriver(JDBCDataSource dataSource);
108 JCAConnectionFactory[] getConnectionFactories(JCAResource resource);
109 JCAManagedConnectionFactory getManagedConnectionFactory(JCAConnectionFactory factory);
110
111 // Generic utility methods
112 Object getObject(AbstractName abstractName);
113 Artifact getConfigurationNameFor(AbstractName abstractName);
114 String getGBeanDescription(AbstractName abstractName);
115
116 // Misc
117 void testLoginModule(J2EEServer server, LoginModule module, Map options);
118 Subject testLoginModule(J2EEServer server, LoginModule module, Map options, String username, String password) throws LoginException;
119 Object[] findByInterface(Class iface);
120 AbstractName getNameFor(Object component);
121 ConfigurationData[] getConfigurations(ConfigurationModuleType type, boolean includeChildModules);
122 /**
123 * Gets a JSR-77 Module (WebModule, EJBModule, etc.) for the specified configuration.
124 * Note: this only works if the configuration is running at the time you ask.
125 *
126 * @return The Module, or null if the configuration is not running.
127 */
128 J2EEDeployedObject getModuleForConfiguration(Artifact configuration);
129
130 /**
131 * Adds a new GBean to an existing Configuration.
132 * @param configID The configuration to add the GBean to.
133 * @param gbean The data representing the GBean to add.
134 * @param start If true, the GBean should be started as part of this call.
135 */
136 public void addGBeanToConfiguration(Artifact configID, GBeanData gbean, boolean start);
137
138 /**
139 * This method returns the Naming object of the kernel.
140 */
141 public Naming getNaming();
142
143 Object[] getGBeansImplementing(Class iface);
144 }