diff --git a/appserver/common/amx-javaee/pom.xml b/appserver/common/amx-javaee/pom.xml index e0f9e147a2e..2cb9329413c 100755 --- a/appserver/common/amx-javaee/pom.xml +++ b/appserver/common/amx-javaee/pom.xml @@ -47,10 +47,6 @@ - - jakarta.management.j2ee - jakarta.management.j2ee-api - org.glassfish.main.common amx-core diff --git a/appserver/common/amx-javaee/src/main/java/org/glassfish/admin/amx/impl/j2ee/J2EEManagedObjectImplBase.java b/appserver/common/amx-javaee/src/main/java/org/glassfish/admin/amx/impl/j2ee/J2EEManagedObjectImplBase.java index 7485131fc58..a74d94d6e8b 100644 --- a/appserver/common/amx-javaee/src/main/java/org/glassfish/admin/amx/impl/j2ee/J2EEManagedObjectImplBase.java +++ b/appserver/common/amx-javaee/src/main/java/org/glassfish/admin/amx/impl/j2ee/J2EEManagedObjectImplBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2020 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -16,15 +16,12 @@ package org.glassfish.admin.amx.impl.j2ee; -import java.lang.String; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import javax.management.MBeanServer; import javax.management.ObjectName; -import javax.management.j2ee.Management; -import javax.management.j2ee.ManagementHome; import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; @@ -256,20 +253,6 @@ protected String[] getChildrenAsStrings( final String... args ) return getChildrenAsStrings(types); } - public final Management getMEJB() { - Management mejb = null; - try { - final Context ic = new InitialContext(); - final String ejbName = System.getProperty("mejb.name", "ejb/mgmt/MEJB"); - final Object objref = ic.lookup(ejbName); - final ManagementHome home = (ManagementHome) PortableRemoteObject.narrow(objref, ManagementHome.class); - mejb = home.create(); - } catch (Exception ex) { - throw new RuntimeException("Can't find MEJB", ex); - } - return mejb; - } - } diff --git a/appserver/common/amx-javaee/src/main/java/org/glassfish/admin/amx/j2ee/EntityBean.java b/appserver/common/amx-javaee/src/main/java/org/glassfish/admin/amx/j2ee/EntityBean.java index 63ab87011e6..bedc18617ed 100644 --- a/appserver/common/amx-javaee/src/main/java/org/glassfish/admin/amx/j2ee/EntityBean.java +++ b/appserver/common/amx-javaee/src/main/java/org/glassfish/admin/amx/j2ee/EntityBean.java @@ -17,8 +17,6 @@ package org.glassfish.admin.amx.j2ee; -import javax.management.j2ee.statistics.EntityBeanStats; -import org.glassfish.admin.amx.annotation.ManagedAttribute; import org.glassfish.admin.amx.core.AMXMBeanMetadata; /** diff --git a/appserver/common/amx-javaee/src/main/java/org/glassfish/admin/amx/j2ee/StatisticsProvider.java b/appserver/common/amx-javaee/src/main/java/org/glassfish/admin/amx/j2ee/StatisticsProvider.java index bd708e3ce6a..a4fd85e0401 100644 --- a/appserver/common/amx-javaee/src/main/java/org/glassfish/admin/amx/j2ee/StatisticsProvider.java +++ b/appserver/common/amx-javaee/src/main/java/org/glassfish/admin/amx/j2ee/StatisticsProvider.java @@ -15,20 +15,10 @@ */ package org.glassfish.admin.amx.j2ee; - -import javax.management.j2ee.statistics.Stats; -import org.glassfish.admin.amx.annotation.ManagedAttribute; - /** Defines access to Stats. */ public interface StatisticsProvider { - /** - Return a Stats object - - @return the Stats object or null if not available - */ - @ManagedAttribute - public Stats getStats(); + } diff --git a/appserver/common/mejb-frag/pom.xml b/appserver/common/mejb-frag/pom.xml deleted file mode 100644 index dc5c0baa261..00000000000 --- a/appserver/common/mejb-frag/pom.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - 4.0.0 - - org.glassfish.main.common - common - 6.0.0-SNAPSHOT - - - mejb-frag - mejb distribution fragment - - distribution-fragment - - - - - - org.jvnet.maven-antrun-extended-plugin - maven-antrun-extended-plugin - - - generate-sources - - - - - - - - run - - - - - - - - - - org.glassfish.main.common - mejb - ${project.version} - ejb - true - - - diff --git a/appserver/common/mejb/osgi.bundle b/appserver/common/mejb/osgi.bundle deleted file mode 100644 index 3944001d7fa..00000000000 --- a/appserver/common/mejb/osgi.bundle +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved. -# -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v. 2.0, which is available at -# http://www.eclipse.org/legal/epl-2.0. -# -# This Source Code may also be made available under the following Secondary -# Licenses when the conditions for such availability set forth in the -# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, -# version 2 with the GNU Classpath Exception, which is available at -# https://www.gnu.org/software/classpath/license.html. -# -# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 -# - - --exportcontents: \ - org.glassfish.admin.mejb;\ - version=${project.osgi.version} - - - - diff --git a/appserver/common/mejb/pom.xml b/appserver/common/mejb/pom.xml deleted file mode 100755 index 293e6d630a5..00000000000 --- a/appserver/common/mejb/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - org.glassfish.main.common - common - 6.0.0-SNAPSHOT - - 4.0.0 - mejb - ejb - Java EE Management JSR 77 MEJB - - - - naman_mehta - Naman Mehta - Oracle, Inc. - - lead - developer - - - - - - - - jakarta.management.j2ee - jakarta.management.j2ee-api - - - jakarta.ejb - jakarta.ejb-api - - - - org.glassfish.main.common - amx-core - ${project.version} - - - org.glassfish.main.security - security-ee - ${project.version} - test - - - diff --git a/appserver/common/mejb/runtest b/appserver/common/mejb/runtest deleted file mode 100755 index a102af0a4b7..00000000000 --- a/appserver/common/mejb/runtest +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved. -# -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v. 2.0, which is available at -# http://www.eclipse.org/legal/epl-2.0. -# -# This Source Code may also be made available under the following Secondary -# Licenses when the conditions for such availability set forth in the -# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, -# version 2 with the GNU Classpath Exception, which is available at -# https://www.gnu.org/software/classpath/license.html. -# -# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 -# - -export CONFIG_FILE=$V3_RUN/glassfish/lib/appclient/appclientlogin.conf -echo Using config file of $CONFIG_FILE -export OPTIONS="-Djava.security.auth.login.config=$CONFIG_FILE" -echo $OPTIONS -echo "" - -export V3M=/v3/glassfish6/glassfish/modules -export MAIN=org.glassfish.admin.mejb.test.MEJBTest - -java $OPTIONS -cp $V3M/gf-client.jar:$V3M/javax.management.j2ee.jar:target/MEJB.jar:target/test-classes $MAIN - - diff --git a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/EventListenerProxy.java b/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/EventListenerProxy.java deleted file mode 100644 index 2f92f82afb4..00000000000 --- a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/EventListenerProxy.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.admin.mejb; - -import java.rmi.Naming; -import java.rmi.RemoteException; -import java.rmi.registry.Registry; -import java.rmi.registry.LocateRegistry; -import java.rmi.server.UnicastRemoteObject; - -import java.util.Hashtable; -import javax.management.ListenerNotFoundException; -import javax.management.Notification; -import javax.management.NotificationListener; - - -/** - * The EventListenerProxy recieves notifications from RemoteListenerConnectors - * registered on the server managed objects and forwards them to the corresponding - * local listeners - * - * @author Hans Hrasna - */ -public class EventListenerProxy extends UnicastRemoteObject implements RemoteEventListener { - private Hashtable listenerTable = new Hashtable(); - private Hashtable handbackTable = new Hashtable(); - private String proxyAddress; - private static EventListenerProxy eventProxy = null; - private static int portnum=1100; - private String rmiName; - private static boolean debug = false; - - public synchronized static EventListenerProxy getEventListenerProxy() { - if (eventProxy == null) { - EventListenerProxy newProxy = null; - try { - newProxy = new EventListenerProxy(); - Naming.rebind(newProxy.proxyAddress, newProxy); - eventProxy = newProxy; - if(debug) System.out.println(eventProxy.rmiName + " bound to existing registry at port " + portnum ); - - } catch (RemoteException re) { - if(debug) System.out.println("Naming.rebind("+ (newProxy != null ? newProxy.proxyAddress : "null") +", eventProxy): " + re); - try { - newProxy = new EventListenerProxy(); - Registry r = LocateRegistry.createRegistry(portnum); - r.bind(newProxy.rmiName, newProxy); - eventProxy = newProxy; - if(debug) System.out.println(newProxy.rmiName + " bound to newly created registry at port " + portnum ); - } catch(Exception e) { - eventProxy = null; - if(debug) e.printStackTrace(); - } - } catch (Exception e) { - if(debug) e.printStackTrace(); - } - } - return eventProxy; - } - - public EventListenerProxy() throws java.rmi.RemoteException { - String hostName; - rmiName = "RemoteEventListener" + hashCode() + System.currentTimeMillis(); - try { - hostName = java.net.InetAddress.getLocalHost().getHostAddress(); - } catch (java.net.UnknownHostException e) { - hostName = "localhost"; - System.out.println(e); - } - proxyAddress = "//"+ hostName + ":" + portnum + "/" + rmiName; - } - - public void handleNotification(Notification n, Object h) throws RemoteException { - if (debug) System.out.println("EventListenerProxy:handleNotification(" + n + ")"); - NotificationListener listener = (NotificationListener)listenerTable.get((String)h); - if (listener != null) { - Object handback = handbackTable.get((String)h); - listener.handleNotification(n,handback); - } else { - System.out.println("EventListenerProxy: listener id " + h + " not found"); - } - } - - public String getProxyAddress() { - return proxyAddress; - } - - public void addListener(String id, NotificationListener l, Object handback) { - if (debug) System.out.println("EventListenerProxy.addListener()"); - listenerTable.put(id, l); - handbackTable.put(id, handback); - } - - public void removeListener(String id) throws ListenerNotFoundException { - if(listenerTable.remove(id) == null) { - throw new ListenerNotFoundException(); - } else { - handbackTable.remove(id); - } - } -} - diff --git a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/IIOPMBeanServer.java b/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/IIOPMBeanServer.java deleted file mode 100644 index d812fddabf0..00000000000 --- a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/IIOPMBeanServer.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.admin.mejb; - -import java.util.Set; - -import javax.management.*; - -import java.rmi.RemoteException; - -public interface IIOPMBeanServer extends java.rmi.Remote { - - - Set queryNames(ObjectName name, QueryExp query) throws RemoteException; - - /** - * Checks whether an managed object, identified by its object name, is already registered - * with the MEJB. - * - * @param name The object name of the managed object to be checked. - * - * @return True if the managed object is already registered in the MEJB, false otherwise. - * - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The object name in parameter is null. - * @BM_EXPOSED - * @BUSINESSMETHOD - * - */ - boolean isRegistered(ObjectName name) throws RemoteException; - - /** - * Returns the number of managed objects registered in the MEJB. - * @BM_EXPOSED - * @BUSINESSMETHOD - */ - Integer getMBeanCount() throws RemoteException; - - /** - * This method discovers the attributes and operations that an managed object exposes - * for management. - * - * @param name The name of the managed object to analyze - * - * @return An instance of MBeanInfo allowing the retrieval of all attributes and operations - * of this managed object. - * - * @exception IntrospectionException An exception occurs during introspection. - * @exception InstanceNotFoundException The managed object specified is not found. - */ - MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException, IntrospectionException, ReflectionException, RemoteException; - - /** - * Gets the value of a specific attribute of a named managed object. The managed object - * is identified by its object name. - * - * @param name The object name of the managed object from which the attribute is to be retrieved. - * @param attribute A String specifying the name of the attribute to be - * retrieved. - * - * @return The value of the retrieved attribute. - * - * @exception AttributeNotFoundException The attribute specified is not accessible in the managed object. - * @exception MBeanException Wraps an exception thrown by the managed object's getter. - * @exception InstanceNotFoundException The managed object specified is not registered in the MEJB. - * @exception ReflectionException Wraps a java.lang.Exception thrown when trying to invoke the setter. - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The object name in parameter is null or - * the attribute in parameter is null. - * @BM_EXPOSED - * @BUSINESSMETHOD - */ - Object getAttribute(ObjectName name, String attribute) throws - AttributeNotFoundException, MBeanException, InstanceNotFoundException, ReflectionException, RemoteException; - - /** - * Enables the values of several attributes of a named managed object. The managed object - * is identified by its object name. - * - * @param name The object name of the managed object from which the attributes are - * retrieved. - * @param attributes A list of the attributes to be retrieved. - * - * @return The list of the retrieved attributes. - * - * @exception InstanceNotFoundException The managed object specified is not registered in the MEJB. - * @exception ReflectionException An exception occurred when trying to invoke the getAttributes method of a Dynamic managed object. - * @exception RuntimeOperationsException Wrap a java.lang.IllegalArgumentException: The object name in parameter is null or - * attributes in parameter is null. - * @BM_EXPOSED - * @BUSINESSMETHOD - * - */ - AttributeList getAttributes(ObjectName name, String[] attributes) - throws InstanceNotFoundException, ReflectionException, RemoteException; - - /** - * Sets the value of a specific attribute of a named managed object. The managed object - * is identified by its object name. - * - * @param name The name of the managed object within which the attribute is to be set. - * @param attribute The identification of the attribute to be set and the value it is to be set to. - * - * @return The value of the attribute that has been set. - * - * @exception InstanceNotFoundException The managed object specified is not registered in the MEJB. - * @exception AttributeNotFoundException The attribute specified is not accessible in the managed object. - * @exception InvalidAttributeValueException The value specified for the attribute is not valid. - * @exception MBeanException Wraps an exception thrown by the managed object's setter. - * @exception ReflectionException Wraps a java.lang.Exception thrown when trying to invoke the setter. - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The object name in parameter is null or - * the attribute in parameter is null. - * @BM_EXPOSED - * @BUSINESSMETHOD - */ - void setAttribute(ObjectName name, Attribute attribute) throws - InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, - MBeanException, ReflectionException, RemoteException; - - /** - * Sets the values of several attributes of a named managed object. The managed object is - * identified by its object name. - * - * @param name The object name of the managed object within which the attributes are to - * be set. - * @param attributes A list of attributes: The identification of the - * attributes to be set and the values they are to be set to. - * - * @return The list of attributes that were set, with their new values. - * - * @exception InstanceNotFoundException The managed object specified is not registered in the MEJB. - * @exception ReflectionException An exception occurred when trying to invoke the getAttributes method of a Dynamic managed object. - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The object name in parameter is null or - * attributes in parameter is null. - * @BM_EXPOSED - * @BUSINESSMETHOD - * - */ - AttributeList setAttributes(ObjectName name, AttributeList attributes) - throws InstanceNotFoundException, ReflectionException, RemoteException; - - /** - * Invokes an operation on an managed object. - * - * @param name The object name of the managed object on which the method is to be invoked. - * @param operationName The name of the operation to be invoked. - * @param params An array containing the parameters to be set when the operation is - * invoked - * @param signature An array containing the signature of the operation. The class objects will - * be loaded using the same class loader as the one used for loading the managed object on which the operation was invoked. - * - * @return The object returned by the operation, which represents the result ofinvoking the operation on the - * managed object specified. - * - * @exception InstanceNotFoundException The managed object specified is not registered in the MEJB. - * @exception MBeanException Wraps an exception thrown by the managed object's invoked method. - * @exception ReflectionException Wraps a java.lang.Exception thrown while trying to invoke the method. - * @BM_EXPOSED - * @BUSINESSMETHOD - * - */ - Object invoke(ObjectName name, String operationName, Object[] params, - String[] signature) throws InstanceNotFoundException, MBeanException, ReflectionException, RemoteException; - - /** - * Returns the domain name of this MEJB. - */ - String getDefaultDomain() throws RemoteException; - - /** - * De-registers an MBean from the MBean server. The MBean is identified by - * its object name. Once the method has been invoked, the MBean may no longer be accessed by its object name. - * @param name The object name of the MBean to be de-registered. - * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server. - * @exception MBeanRegistrationException The preDeregister ((MBeanRegistration interface) method of the MBean - * has thrown an exception. - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The object name in - * parameter is null or the MBean you are when trying to de-register is the {@link javax.management.MBeanServerDelegate - * MBeanServerDelegate} MBean. - */ - public void unregisterMBean(ObjectName name) throws InstanceNotFoundException, - MBeanRegistrationException, RemoteException; -} diff --git a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/IIOPMBeanServerImpl.java b/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/IIOPMBeanServerImpl.java deleted file mode 100644 index fd5c6ccb083..00000000000 --- a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/IIOPMBeanServerImpl.java +++ /dev/null @@ -1,584 +0,0 @@ -/* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.admin.mejb; - -import java.rmi.RemoteException; -import java.io.ObjectInputStream; -import java.util.Set; -import javax.management.*; -import javax.rmi.PortableRemoteObject; -/** - * IIOPMBeanServerImpl provides an IIOP wrapper for MBeanServers in remote VMs - * - * @author Hans Hrasna - */ -public class IIOPMBeanServerImpl extends PortableRemoteObject implements IIOPMBeanServer { - - private MBeanServer server; - - public IIOPMBeanServerImpl(MBeanServer mbs) throws java.rmi.RemoteException { - server = mbs; - } - - // javax.management.j2ee.Management implementation starts here - - /** - * Gets the names of managed objects controlled by the MEJB. This method - * enables any of the following to be obtained: The names of all managed objects, - * the names of a set of managed objects specified by pattern matching on the - * ObjectName and/or a Query expression, a specific managed object name (equivalent to - * testing whether an managed object is registered). When the object name is - * null or no domain and key properties are specified, all objects are selected (and filtered if a - * query is specified). It returns the set of ObjectNames for the managed objects selected. - * @param name The object name pattern identifying the managed objects to be retrieved. If - * null or no domain and key properties are specified, all the managed objects registered will be retrieved. - * @param query The query expression to be applied for selecting managed objects. If null - * no query expression will be applied for selecting managed objects. - * @return A set containing the ObjectNames for the managed objects selected. - * If no managed object satisfies the query, an empty list is returned. - */ - public Set queryNames(ObjectName name, QueryExp query) throws RemoteException { - return server.queryNames(name, query); - } - - /** - * Checks whether an MBean, identified by its object name, is already registered with the MBean server. - * @param name The object name of the MBean to be checked. - * @return True if the MBean is already registered in the MBean server, false otherwise. - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The object - * name in parameter is null. - */ - public boolean isRegistered(ObjectName name) throws RemoteException { - return server.isRegistered(name); - } - - /** Returns the number of MBeans registered in the MBean server. */ - public Integer getMBeanCount() throws RemoteException { - return server.getMBeanCount(); - } - - /** - * This method discovers the attributes and operations that an MBean exposes for management. - * @param name The name of the MBean to analyze - * @return An instance of MBeanInfo allowing the retrieval of all attributes and operations of this MBean. - * @exception IntrospectionException An exception occurs during introspection. - * @exception InstanceNotFoundException The MBean specified is not found. - * @exception ReflectionException An exception occurred when trying to invoke the getMBeanInfo of a Dynamic MBean. - */ - public MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException, - IntrospectionException, ReflectionException, RemoteException { - return server.getMBeanInfo(name); - } - - /** - * Gets the value of a specific attribute of a named MBean. The MBean is identified by its object name. - * @param name The object name of the MBean from which the attribute is to be retrieved. - * @param attribute A String specifying the name of the attribute to be retrieved. - * @return The value of the retrieved attribute. - * @exception AttributeNotFoundException The attribute specified is not accessible in the MBean. - * @exception MBeanException Wraps an exception thrown by the MBean's getter. - * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server. - * @exception ReflectionException Wraps a java.lang.Exception thrown when trying to invoke the setter. - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The object name in - * parameter is null or the attribute in parameter is null. - */ - public Object getAttribute(ObjectName name, String attribute) throws MBeanException, - AttributeNotFoundException, InstanceNotFoundException, - ReflectionException, RemoteException { - return server.getAttribute(name, attribute); - } - - /** - * Enables the values of several attributes of a named MBean. The MBean is identified by its object name. - * @param name The object name of the MBean from which the attributes are retrieved. - * @param attributes A list of the attributes to be retrieved. - * @return The list of the retrieved attributes. - * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server. - * @exception ReflectionException An exception occurred when trying to invoke the getAttributes method of a Dynamic MBean. - * @exception RuntimeOperationsException Wrap a java.lang.IllegalArgumentException: The object name in - * parameter is null or attributes in parameter is null. - */ - public AttributeList getAttributes(ObjectName name, String[] attributes) - throws InstanceNotFoundException, ReflectionException, RemoteException { - return server.getAttributes(name, attributes); - } - - /** - * Sets the value of a specific attribute of a named MBean. The MBean is identified by its object name. - * @param name The name of the MBean within which the attribute is to be set. - * @param attribute The identification of the attribute to be set and the value it is to be set to. - * @return The value of the attribute that has been set. - * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server. - * @exception AttributeNotFoundException The attribute specified is not accessible in the MBean. - * @exception InvalidAttributeValueException The value specified for the attribute is not valid. - * @exception MBeanException Wraps an exception thrown by the MBean's setter. - * @exception ReflectionException Wraps a java.lang.Exception thrown when trying to invoke the setter. - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The object name in - * parameter is null or the attribute in parameter is null. - */ - public void setAttribute(ObjectName name, Attribute attribute) - throws InstanceNotFoundException, AttributeNotFoundException, - InvalidAttributeValueException, MBeanException, - ReflectionException, RemoteException { - server.setAttribute(name, attribute); - } - - /** - * Sets the values of several attributes of a named MBean. The MBean is identified by its object name. - * @param name The object name of the MBean within which the attributes are to be set. - * @param attributes A list of attributes: The identification of the - * attributes to be set and the values they are to be set to. - * @return The list of attributes that were set, with their new values. - * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server. - * @exception ReflectionException An exception occurred when trying to invoke the getAttributes method of a Dynamic MBean. - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The object name in - * parameter is null or attributes in parameter is null. - */ - public AttributeList setAttributes(ObjectName name, AttributeList attributes) - throws InstanceNotFoundException, ReflectionException, RemoteException { - return server.setAttributes(name, attributes); - } - - /** - * Invokes an operation on an MBean. - * @param name The object name of the MBean on which the method is to be invoked. - * @param operationName The name of the operation to be invoked. - * @param params An array containing the parameters to be set when the operation is invoked - * @param signature An array containing the signature of the operation. The class objects will - * be loaded using the same class loader as the one used for loading the MBean on which the operation was invoked. - * @return The object returned by the operation, which represents the result ofinvoking the operation - * on the MBean specified. - * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server. - * @exception MBeanException Wraps an exception thrown by the MBean's invoked method. - * @exception ReflectionException Wraps a java.lang.Exception thrown while trying to invoke the method. - */ - public Object invoke(ObjectName name, String operationName, Object[] params, String[] signature) - throws InstanceNotFoundException, MBeanException, - ReflectionException, RemoteException { - return server.invoke(name, operationName, params, signature); - } - - /** - * Returns the default domain used for naming the managed object. - * The default domain name is used as the domain part in the ObjectName - * of managed objects if no domain is specified by the user. - */ - public String getDefaultDomain() throws RemoteException { - return server.getDefaultDomain(); - } - - /* - * returns the ListenerRegistry implementation for this MEJB - */ - - /*ListenerRegistration getListenerRegistry() throws RemoteException { - if (listenerRegistry == null) { - - listenerRegistry = new ListenerRegistry(ctx.toString()); - System.out.println("Created new ListenerRegistry..."); - } - return listenerRegistry; - }*/ - - // Additional MBeanServer interface implementation starts here - - /** - * Instantiates an object using the list of all class loaders registered - * in the MBean server ({@link javax.management.loading.DefaultLoaderRepository Default Loader Repository}). - * The object's class should have a public constructor. It returns a reference to the newly created object. - * The newly created object is not registered in the MBean server. - * @param className The class name of the object to be instantiated. - * @return The newly instantiated object. - * @exception ReflectionException Wraps a java.lang.ClassNotFoundException or the - * java.lang.Exception that occurred when trying to invoke the object's constructor. - * @exception MBeanException The constructor of the object has thrown an exception - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The className - * passed in parameter is null. - */ - public Object instantiate(String className) throws ReflectionException, MBeanException, RemoteException { - return server.instantiate(className); - } - - /** - * Instantiates an object using the class Loader specified by its ObjectName. - * If the loader name is null, the ClassLoader that loaded the MBean Server will be used. - * The object's class should have a public constructor. It returns a reference to the newly created object. - * The newly created object is not registered in the MBean server. - * @param className The class name of the MBean to be instantiated. - * @param loaderName The object name of the class loader to be used. - * @return The newly instantiated object. - * @exception ReflectionException Wraps a java.lang.ClassNotFoundException or the - * java.lang.Exception that occurred when trying to invoke the object's constructor. - * @exception MBeanException The constructor of the object has thrown an exception. - * @exception InstanceNotFoundException The specified class loader is not registered in the MBaenServer. - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The className - * passed in parameter is null. - */ - public Object instantiate(String className, ObjectName loaderName) throws ReflectionException, - MBeanException, InstanceNotFoundException, RemoteException { - return server.instantiate(className, loaderName); - } - - /** - * Instantiates an object using the list of all class loaders registered - * in the MBean server ({@link javax.management.loading.DefaultLoaderRepository Default Loader Repository}). - * The object's class should have a public constructor. The call returns a reference to the newly created object. - * The newly created object is not registered in the MBean server. - * @param className The class name of the object to be instantiated. - * @param params An array containing the parameters of the constructor to be invoked. - * @param signature An array containing the signature of the constructor to be invoked. - * @return The newly instantiated object. - * @exception ReflectionException Wraps a java.lang.ClassNotFoundException or the - * java.lang.Exception that occurred when trying to invoke the object's constructor. - * @exception MBeanException The constructor of the object has thrown an exception - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The className - * passed in parameter is null. - */ - public Object instantiate(String className, Object[] params, String[] signature) throws ReflectionException, - MBeanException, RemoteException { - return server.instantiate(className, params, signature); - } - - /** - * Instantiates an object. The class loader to be used is identified by its object - * name. If the object name of the loader is null, the ClassLoader that loaded the MBean server will be used. - * The object's class should have a public constructor. The call returns a reference to the newly created object. - * The newly created object is not registered in the MBean server. - * @param className The class name of the object to be instantiated. - * @param params An array containing the parameters of the constructor to be invoked. - * @param signature An array containing the signature of the constructor to be invoked. - * @param loaderName The object name of the class loader to be used. - * @return The newly instantiated object. - * @exception ReflectionException Wraps a java.lang.ClassNotFoundException or the - * java.lang.Exception that occurred when trying to invoke the object's constructor. - * @exception MBeanException The constructor of the object has thrown an exception - * @exception InstanceNotFoundException The specified class loader is not registered in the MBean server. - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The className - * passed in parameter is null. - */ - public Object instantiate(String className, ObjectName loaderName, Object[] params, String[] signature) - throws ReflectionException, MBeanException, - InstanceNotFoundException, RemoteException { - return server.instantiate(className, loaderName, params, signature); - } - - /** - * Instantiates and registers an MBean in the MBean server. The MBean server will use the {@link - * javax.management.loading.DefaultLoaderRepository Default Loader Repository} to load the class of the MBean. - * An object name is associated to the MBean. If the object name given is null, the MBean can automatically provide its - * own name by implementing the {@link javax.management.MBeanRegistration MBeanRegistration} interface. The call returns - * an ObjectInstance object representing the newly created MBean. - * @param className The class name of the MBean to be instantiated. - * @param name The object name of the MBean. May be null. - * @return An ObjectInstance, containing the ObjectName and the Java class name - * of the newly instantiated MBean. - * @exception ReflectionException Wraps a java.lang.ClassNotFoundException or a - * java.lang.Exception that occurred when trying to invoke the MBean's constructor. - * @exception InstanceAlreadyExistsException The MBean is already under the control of the MBean server. - * @exception MBeanRegistrationException The preRegister (MBeanRegistration interface) method of - * the MBean has thrown an exception. The MBean will not be registered. - * @exception MBeanException The constructor of the MBean has thrown an exception - * @exception NotCompliantMBeanException This class is not a JMX compliant MBean - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The className passed in - * parameter is null, the ObjectName passed in parameter contains a pattern or no ObjectName is - * specified for the MBean. - */ - public ObjectInstance createMBean(String className, ObjectName name) throws ReflectionException, - InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, - NotCompliantMBeanException, RemoteException { - return server.createMBean(className, name); - } - - /** - * Instantiates and registers an MBean in the MBean server. The class loader to be used is identified by its object name. - * An object name is associated to the MBean. If the object name of the loader is null, the ClassLoader that loaded the - * MBean server will be used. If the MBean's object name given is null, the MBean can automatically provide its - * own name by implementing the {@link javax.management.MBeanRegistration MBeanRegistration} interface. The call returns - * an ObjectInstance object representing the newly created MBean. - * @param className The class name of the MBean to be instantiated. - * @param name The object name of the MBean. May be null. - * @param loaderName The object name of the class loader to be used. - * @return An ObjectInstance, containing the ObjectName and the Java class name - * of the newly instantiated MBean. - * @exception ReflectionException Wraps a java.lang.ClassNotFoundException or a - * java.lang.Exception that occurred when trying to invoke the MBean's constructor. - * @exception InstanceAlreadyExistsException The MBean is already under the control of the MBean server. - * @exception MBeanRegistrationException The preRegister (MBeanRegistration interface) method - * of the MBean has thrown an exception. The MBean will not be registered. - * @exception MBeanException The constructor of the MBean has thrown an exception - * @exception NotCompliantMBeanException This class is not a JMX compliant MBean - * @exception InstanceNotFoundException The specified class loader is not registered in the MBean server. - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The className passed in - * parameter is null, the ObjectName passed in parameter contains a pattern or no ObjectName is - * specified for the MBean. - */ - public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName) - throws ReflectionException, InstanceAlreadyExistsException, - MBeanRegistrationException, MBeanException, NotCompliantMBeanException, - InstanceNotFoundException, RemoteException { - return server.createMBean(className, name, loaderName); - } - - /** - * Instantiates and registers an MBean in the MBean server. - * The MBean server will use the {@link javax.management.loading.DefaultLoaderRepository Default Loader Repository} - * to load the class of the MBean. An object name is associated to the MBean. If the object name given is null, the MBean - * can automatically provide its own name by implementing the {@link javax.management.MBeanRegistration MBeanRegistration} - * interface. The call returns an ObjectInstance object representing the newly created MBean. - * @param className The class name of the MBean to be instantiated. - * @param name The object name of the MBean. May be null. - * @param params An array containing the parameters of the constructor to be invoked. - * @param signature An array containing the signature of the constructor to be invoked. - * @return An ObjectInstance, containing the ObjectName and the Java class name - * of the newly instantiated MBean. - * @exception ReflectionException Wraps a java.lang.ClassNotFoundException or a - * java.lang.Exception that occurred when trying to invoke the MBean's constructor. - * @exception InstanceAlreadyExistsException The MBean is already under the control of the MBean server. - * @exception MBeanRegistrationException The preRegister (MBeanRegistration interface) method - * of the MBean has thrown an exception. The MBean will not be registered. - * @exception MBeanException The constructor of the MBean has thrown an exception - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The className passed in - * parameter is null, the ObjectName passed in parameter contains a pattern or no ObjectName is - * specified for the MBean. - */ - public ObjectInstance createMBean(String className, ObjectName name, Object[] params, String[] signature) - throws ReflectionException, InstanceAlreadyExistsException, - MBeanRegistrationException, MBeanException, NotCompliantMBeanException, RemoteException { - return server.createMBean(className, name, params, signature); - } - - /** - * Instantiates and registers an MBean in the MBean server. The class loader to be used is identified by its object - * name. An object name is associated to the MBean. If the object name - * of the loader is not specified, the ClassLoader that loaded the MBean server will be used. - * If the MBean object name given is null, the MBean can automatically provide its - * own name by implementing the {@link javax.management.MBeanRegistration MBeanRegistration} interface. The call returns - * an ObjectInstance object representing the newly created MBean. - * @param className The class name of the MBean to be instantiated. - * @param name The object name of the MBean. May be null. - * @param params An array containing the parameters of the constructor to be invoked. - * @param signature An array containing the signature of the constructor to be invoked. - * @param loaderName The object name of the class loader to be used. - * @return An ObjectInstance, containing the ObjectName and the Java class name - * of the newly instantiated MBean. - * @exception ReflectionException Wraps a java.lang.ClassNotFoundException or a - * java.lang.Exception that occurred when trying to invoke the MBean's constructor. - * @exception InstanceAlreadyExistsException The MBean is already under the control of the MBean server. - * @exception MBeanRegistrationException The preRegister (MBeanRegistration interface) method - * of the MBean has thrown an exception. The MBean will not be registered. - * @exception MBeanException The constructor of the MBean has thrown an exception - * @exception InstanceNotFoundException The specified class loader is not registered in the MBean server. - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The className passed in - * parameter is null, the ObjectName passed in parameter contains a pattern or no ObjectName is - * specified for the MBean. - */ - public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] signature) - throws ReflectionException, InstanceAlreadyExistsException, - MBeanRegistrationException, MBeanException, NotCompliantMBeanException, - InstanceNotFoundException, RemoteException { - return server.createMBean(className, name, loaderName, params, signature); - } - - /** - * Registers a pre-existing object as an MBean with the MBean server. If the object name given is - * null, the MBean may automatically provide its own name by implementing the - * {@link javax.management.MBeanRegistration MBeanRegistration} interface. - * The call returns an ObjectInstance object representing the registered MBean. - * @param object The MBean to be registered as an MBean. - * @param name The object name of the MBean. May be null. - * @return The ObjectInstance for the MBean that has been registered. - * @exception InstanceAlreadyExistsException The MBean is already under the control of the MBean server. - * @exception MBeanRegistrationException The preRegister (MBeanRegistration interface) method - * of the MBean has thrown an exception. The MBean will not be registered. - * @exception NotCompliantMBeanException This object is not a JMX compliant MBean - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The object passed in - * parameter is null or no object name is specified. - */ - public ObjectInstance registerMBean(Object object, ObjectName name) throws InstanceAlreadyExistsException, - MBeanRegistrationException, NotCompliantMBeanException, RemoteException { - return server.registerMBean(object, name); - } - - /** - * De-registers an MBean from the MBean server. The MBean is identified by - * its object name. Once the method has been invoked, the MBean may no longer be accessed by its object name. - * @param name The object name of the MBean to be de-registered. - * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server. - * @exception MBeanRegistrationException The preDeregister ((MBeanRegistration interface) method of the MBean - * has thrown an exception. - * @exception RuntimeOperationsException Wraps a java.lang.IllegalArgumentException: The object name in - * parameter is null or the MBean you are when trying to de-register is the {@link javax.management.MBeanServerDelegate - * MBeanServerDelegate} MBean. - */ - public void unregisterMBean(ObjectName name) throws InstanceNotFoundException, - MBeanRegistrationException, RemoteException { - server.unregisterMBean(name); - } - - /** - * Gets the ObjectInstance for a given MBean registered with the MBean server. - * @param name The object name of the MBean. - * @return The ObjectInstance associated to the MBean specified by name. - * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server. - */ - public ObjectInstance getObjectInstance(ObjectName name) - throws InstanceNotFoundException, RemoteException { - return server.getObjectInstance(name); - } - - /** - * Gets MBeans controlled by the MBean server. This method allows any - * of the following to be obtained: All MBeans, a set of MBeans specified - * by pattern matching on the ObjectName and/or a Query expression, a - * specific MBean. When the object name is null or no domain and key properties are specified, all objects are to be - * selected (and filtered if a query is specified). It returns the - * set of ObjectInstance objects (containing the ObjectName and the Java Class name) - * for the selected MBeans. - * @param name The object name pattern identifying the MBeans to be retrieved. If - * null or no domain and key properties are specified, all the MBeans registered will be retrieved. - * @param query The query expression to be applied for selecting MBeans. If null - * no query expression will be applied for selecting MBeans. - * @return A set containing the ObjectInstance objects for the selected MBeans. - * If no MBean satisfies the query an empty list is returned. - */ - public Set queryMBeans(ObjectName name, QueryExp query) throws RemoteException { - return server.queryMBeans(name, query); - } - - /** - * Returns the default domain used for naming the MBean. The default domain name is used as the domain part in the - * ObjectName of MBeans if no domain is specified by the user. - */ - //public String getDefaultDomain() throws RemoteException; - - /** - * Enables to add a listener to a registered MBean. - * @param name The name of the MBean on which the listener should be added. - * @param listener The listener object which will handle the notifications emitted by the registered MBean. - * @param filter The filter object. If filter is null, no filtering will be performed before handling notifications. - * @param handback The context to be sent to the listener when a notification is emitted. - * @exception InstanceNotFoundException The MBean name provided does not match any of the registered MBeans. - */ - public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) - throws InstanceNotFoundException, RemoteException { -/* ***** FIX THIS ***** - if (listener instanceof RemoteListenerConnector) { - ((RemoteListenerConnector)listener).setMBeanServer(server); - } - server.addNotificationListener(name, listener, filter, handback); -*/ - } - - /** - * Enables to add a listener to a registered MBean. - * @param name The name of the MBean on which the listener should be added. - * @param listener The object name of the listener which will handle the notifications emitted by the registered MBean. - * @param filter The filter object. If filter is null, no filtering will be performed before handling notifications. - * @param handback The context to be sent to the listener when a notification is emitted. - * @exception InstanceNotFoundException The MBean name of the notification listener or of the notification broadcaster - * does not match any of the registered MBeans. - */ - public void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object handback) - throws InstanceNotFoundException, RemoteException { - server.addNotificationListener(name, listener, filter, handback); - } - - /** - * Enables to remove a listener from a registered MBean. - * @param name The name of the MBean on which the listener should be removed. - * @param listener The listener object which will handle the notifications emitted by the registered MBean. - * This method will remove all the information related to this listener. - * @exception InstanceNotFoundException The MBean name provided does not match any of the registered MBeans. - * @exception ListenerNotFoundException The listener is not registered in the MBean. - */ - public void removeNotificationListener(ObjectName name, NotificationListener listener) - throws InstanceNotFoundException, ListenerNotFoundException, RemoteException { - server.removeNotificationListener(name, listener); - } - - /** - * Enables to remove a listener from a registered MBean. - * @param name The name of the MBean on which the listener should be removed. - * @param listener The object name of the listener which will handle the notifications emitted by the registered MBean. - * This method will remove all the information related to this listener. - * @exception InstanceNotFoundException The MBean name provided does not match any of the registered MBeans. - * @exception ListenerNotFoundException The listener is not registered in the MBean. - */ - public void removeNotificationListener(ObjectName name, ObjectName listener) throws InstanceNotFoundException, - ListenerNotFoundException, RemoteException { - server.removeNotificationListener(name, listener); - } - - /** - * Returns true if the MBean specified is an instance of the specified class, false otherwise. - * @param name The ObjectName of the MBean. - * @param className The name of the class. - * @return true if the MBean specified is an instance of the specified class, false otherwise. - * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server. - */ - public boolean isInstanceOf(ObjectName name, String className) - throws InstanceNotFoundException, RemoteException { - return server.isInstanceOf(name, className); - } - - /** - * De-serializes a byte array in the context of the class loader of an MBean. - * @param name The name of the MBean whose class loader should be used for the de-serialization. - * @param data The byte array to be de-sererialized. - * @return The de-serialized object stream. - * @exception InstanceNotFoundException The MBean specified is not found. - * @exception OperationsException Any of the usual Input/Output related exceptions. - */ - public ObjectInputStream deserialize(ObjectName name, byte[] data) throws InstanceNotFoundException, - OperationsException, RemoteException { - return server.deserialize(name, data); - } - - /** - * De-serializes a byte array in the context of a given MBean class loader. - * The class loader is the one that loaded the class with name "className". - * @param name The name of the class whose class loader should be used for the de-serialization. - * @param data The byte array to be de-sererialized. - * @return The de-serialized object stream. - * @exception OperationsException Any of the usual Input/Output related exceptions. - * @exception ReflectionException The specified class could not be loaded by the default loader repository - */ - public ObjectInputStream deserialize(String className, byte[] data) throws OperationsException, - ReflectionException, RemoteException { - return server.deserialize(className, data); - } - - /** - * De-serializes a byte array in the context of a given MBean class loader. - * The class loader is the one that loaded the class with name "className". - * The name of the class loader to be used for loading the specified class is specified. - * If null, the MBean Server's class loader will be used. - * @param name The name of the class whose class loader should be used for the de-serialization. - * @param data The byte array to be de-sererialized. - * @param loaderName The name of the class loader to be used for loading the specified class. - * If null, the MBean Server's class loader will be used. - * @return The de-serialized object stream. - * @exception InstanceNotFoundException The specified class loader MBean is not found. - * @exception OperationsException Any of the usual Input/Output related exceptions. - * @exception ReflectionException The specified class could not be loaded by the specified class loader. - */ - public ObjectInputStream deserialize(String className, ObjectName loaderName, byte[] data) - throws InstanceNotFoundException, OperationsException, - ReflectionException, RemoteException { - return server.deserialize(className, loaderName, data); - } -} diff --git a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/J2EEModuleCallBack.java b/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/J2EEModuleCallBack.java deleted file mode 100644 index e428b36efda..00000000000 --- a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/J2EEModuleCallBack.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.admin.mejb; - - -/** - * - * @author prakash - * @version - */ -public interface J2EEModuleCallBack { - public String getName(); - public String getParentName(); - public String getDeploymentDescriptor(); - public void start(Object module); - public void stop(Object module); - public String getServerName(); -} - diff --git a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/ListenerRegistry.java b/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/ListenerRegistry.java deleted file mode 100644 index fe87146dea6..00000000000 --- a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/ListenerRegistry.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.admin.mejb; - -import java.rmi.RemoteException; -import java.util.Hashtable; -import javax.management.InstanceNotFoundException; -import javax.management.ListenerNotFoundException; -import javax.management.NotificationFilter; -import javax.management.NotificationListener; -import javax.management.ObjectName; - -import javax.management.j2ee.Management; - - -/** - * ListenerRegistry provides an implementation of ListenerRegistration - * This implementation creates instances of RemoteListenerConnectors which - * are registered on the MEJB on behalf of the local listener. - * - * Note that this cannot possibly work for remote listeners due to MEJBUtility not supporting - * anything but the local MBeanServer. - * - * @author Hans Hrasna - */ -public final class ListenerRegistry implements javax.management.j2ee.ListenerRegistration { - //private static final String OMG_ORB_INIT_PORT_PROPERTY = "org.omg.CORBA.ORBInitialPort"; - - private static final boolean debug = true; - private static void debug( final String s ) { if ( debug ) { System.out.println(s); } } - - private final Hashtable listenerConnectors = - new Hashtable(); - private final String serverAddress; // the hostname or ip address of the MEJB - - public ListenerRegistry(String ip) { - serverAddress = ip; - } - - /** - * Add a listener to a registered managed object. - * - * @param name The name of the managed object on which the listener should be added. - * @param listener The listener object which will handle the notifications emitted by the registered managed object. - * @param filter The filter object. If filter is null, no filtering will be performed before handling notifications. - * @param handback The context to be sent to the listener when a notification is emitted. - * - * @exception InstanceNotFoundException The managed object name provided does not match any of the registered managed objects. - * - */ - public void addNotificationListener( - final ObjectName name, - final NotificationListener listener, - final NotificationFilter filter, - final Object handback) - throws RemoteException { - final String proxyAddress = EventListenerProxy.getEventListenerProxy().getProxyAddress(); - try { - debug("ListenerRegistry:addNotificationListener() to " + name); - final RemoteListenerConnector connector = new RemoteListenerConnector(proxyAddress); - getMEJBUtility().addNotificationListener(name, connector, filter, connector.getId()); - EventListenerProxy.getEventListenerProxy().addListener(connector.getId(), listener, handback); - listenerConnectors.put(listener, connector); - } catch (final InstanceNotFoundException inf) { - throw new RemoteException(inf.getMessage(), inf); - } - } - - /** - * Remove a listener from a registered managed object. - * - * @param name The name of the managed object on which the listener should be removed. - * @param listener The listener object which will handle the notifications emitted by the registered managed object. - * This method will remove all the information related to this listener. - * - * @exception InstanceNotFoundException The managed object name provided does not match any of the registered managed objects. - * @exception ListenerNotFoundException The listener is not registered in the managed object. - */ - public void removeNotificationListener( - final ObjectName name, - final NotificationListener listener) - throws RemoteException { - final EventListenerProxy proxy = EventListenerProxy.getEventListenerProxy(); - try { - debug("ListenerRegistry.removeNotificationListener: " + listener + " for " + name); - //debug("ListenerRegistry.listenerProxy = " + listenerConnectors.get(((RemoteListenerConnector) listener).getId())); - final RemoteListenerConnector connector = listenerConnectors.get(listener); - getMEJBUtility().removeNotificationListener(name, connector); - proxy.removeListener(connector.getId()); - listenerConnectors.remove(listener); - } catch (final InstanceNotFoundException inf) { - throw new RemoteException(inf.getMessage(), inf); - } catch (final ListenerNotFoundException lnf) { - throw new RemoteException(lnf.getMessage(), lnf); - } - } - - private MEJBUtility getMEJBUtility() { - return MEJBUtility.getInstance(); - } -} diff --git a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/MEJBBean.java b/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/MEJBBean.java deleted file mode 100644 index 8345d42c679..00000000000 --- a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/MEJBBean.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.admin.mejb; - -import java.rmi.RemoteException; -import java.util.HashSet; -import java.util.Set; -import javax.ejb.CreateException; -import javax.ejb.SessionBean; -import javax.ejb.SessionContext; -import javax.management.*; -import javax.management.j2ee.ListenerRegistration; - -import org.glassfish.external.amx.AMXGlassfish; - -/** - * @ejbHome <{org.glassfish.admin.mejb.MEJBHome}> - * @ejbRemote <{org.glassfish.admin.mejb.MEJB}> - */ -public final class MEJBBean implements SessionBean -{ - private static final boolean debug = true; - private static void debug( final String s ) { if ( debug ) { System.out.println(s); } } - - private volatile SessionContext ctx; - private final MBeanServer mbeanServer = MEJBUtility.getInstance().getMBeanServer(); - private volatile String mDomain = null; - - public MEJBBean() - { - } - - public void setSessionContext(SessionContext context) { - ctx = context; - } - - public void ejbActivate() { - } - - public void ejbPassivate() { - } - - public void ejbRemove() { - } - - public void ejbCreate() throws CreateException { - final ObjectName domainRoot = AMXGlassfish.DEFAULT.bootAMX(mbeanServer); - - if ( domainRoot == null ) - { - throw new IllegalStateException( "Impossible: DomainRoot is null" ); - } - - mDomain = domainRoot.getDomain(); - } - - /** - Restrict access to only JSR 77 MBeans - */ - private Set - restrict( final Set candidates ) - { - final Set allowed = new HashSet(); - for( final ObjectName candidate : candidates ) - { - if ( oneOfOurs(candidate) ) - { - allowed.add(candidate); - } - } - return allowed; - } - - private boolean oneOfOurs( final ObjectName candidate ) { - return candidate != null && - candidate.getDomain().equals(mDomain) && - candidate.getKeyProperty( "j2eeType" ) != null && - candidate.getKeyProperty( "name" ) != null; - } - - private ObjectName bounce(final ObjectName o) throws InstanceNotFoundException - { - if ( ! oneOfOurs(o) ) - { - throw new InstanceNotFoundException( "" + o ); - } - return o; - } - - // javax.management.j2ee.Management implementation starts here - public Set queryNames(ObjectName name, QueryExp query) throws RemoteException { - try { - return restrict( mbeanServer.queryNames(name, query) ); - } catch (Exception ex) { - throw new RemoteException(this.toString() + "::queryNames", ex); - } - } - - public boolean isRegistered(ObjectName name) throws RemoteException { - try { - return mbeanServer.isRegistered(name); - } catch (Exception ex) { - throw new RemoteException(this.toString() + "::isRegistered", ex); - } - } - - public Integer getMBeanCount() throws RemoteException { - try { - final ObjectName pattern = new ObjectName( mDomain + ":*" ); - return queryNames( pattern, null ).size(); - } catch (Exception ex) { - throw new RemoteException(this.toString() + "::getMBeanCount", ex); - } - } - - public MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException, - IntrospectionException, ReflectionException, RemoteException { - return mbeanServer.getMBeanInfo( bounce(name) ); - } - - public Object getAttribute(ObjectName name, String attribute) throws MBeanException, - AttributeNotFoundException, InstanceNotFoundException, - ReflectionException, RemoteException { - //debug( "MEJBBean.getAttribute: " + attribute + " on " + name ); - return mbeanServer.getAttribute( bounce(name) , attribute); - } - - public AttributeList getAttributes(ObjectName name, String[] attributes) - throws InstanceNotFoundException, ReflectionException, RemoteException { - //debug( "MEJBBean.getAttributes: on " + name ); - return mbeanServer.getAttributes( bounce(name), attributes); - } - - public void setAttribute(ObjectName name, Attribute attribute) - throws InstanceNotFoundException, AttributeNotFoundException, - InvalidAttributeValueException, MBeanException, - ReflectionException, RemoteException { - mbeanServer.setAttribute( bounce(name), attribute); - } - - public AttributeList setAttributes(ObjectName name, AttributeList attributes) - throws InstanceNotFoundException, ReflectionException, RemoteException { - return mbeanServer.setAttributes(name, attributes); - } - - public Object invoke(ObjectName name, String operationName, Object[] params, String[] signature) - throws InstanceNotFoundException, MBeanException, - ReflectionException, RemoteException { - return mbeanServer.invoke( bounce(name), operationName, params, signature); - } - - /** - * Returns the default domain used for naming the managed object. - * The default domain name is used as the domain part in the ObjectName - * of managed objects if no domain is specified by the user. - */ - public String getDefaultDomain() throws RemoteException { - return mDomain; - } - - public ListenerRegistration getListenerRegistry() throws RemoteException { - return MEJBUtility.getInstance().getListenerRegistry(); - } -} diff --git a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/MEJBUtility.java b/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/MEJBUtility.java deleted file mode 100644 index 90ff53063e0..00000000000 --- a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/MEJBUtility.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.admin.mejb; - -import java.lang.management.ManagementFactory; -import java.net.InetAddress; -import java.net.UnknownHostException; -import javax.rmi.PortableRemoteObject; -import java.rmi.RemoteException; -import javax.management.InstanceNotFoundException; -import javax.management.ListenerNotFoundException; -import javax.management.MBeanServer; -import javax.management.NotificationFilter; -import javax.management.NotificationListener; -import javax.management.ObjectName; -import javax.management.j2ee.ListenerRegistration; -import javax.management.j2ee.ManagementHome; -import javax.management.j2ee.Management; -import javax.naming.Context; -import javax.naming.InitialContext; - - -/** - */ -public final class MEJBUtility { - private final MBeanServer mServer; - private final ListenerRegistry listenerRegistry; - private Management mMEJB; - - private static final MEJBUtility INSTANCE = new MEJBUtility(); - - private MEJBUtility() { - mServer = ManagementFactory.getPlatformMBeanServer(); - listenerRegistry = _getListenerRegistry(); - } - - public static MEJBUtility getInstance() { - return INSTANCE; - } - - - public static final String MEJB_NAME_PROP = "mejb.name"; - public static final String MEJB_DEFAULT_NAME = "ejb/mgmt/MEJB"; - - public synchronized Management getMEJB() throws RemoteException { - if (mMEJB == null) { - try { - final Context ic = new InitialContext(); - final String ejbName = System.getProperty( MEJB_NAME_PROP, MEJB_DEFAULT_NAME); - final Object objref = ic.lookup(ejbName); - final ManagementHome home = (ManagementHome) PortableRemoteObject.narrow(objref, ManagementHome.class); - mMEJB = (Management) home.create(); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - return mMEJB; - } - - public MBeanServer getMBeanServer() - { - return mServer; - } - - public ListenerRegistration getListenerRegistry() - { - return listenerRegistry; - } - - private static ListenerRegistry _getListenerRegistry() { - ListenerRegistry reg = null; - try { - reg = new ListenerRegistry( InetAddress.getLocalHost().getHostAddress()); - } catch ( final UnknownHostException e) { - reg = new ListenerRegistry( MEJBUtility.class.getName() ); - } - return reg; - } - - - public void addNotificationListener( final ObjectName name, NotificationListener listener, NotificationFilter filter, Object handback) - throws InstanceNotFoundException, RemoteException { - - if ( ! mServer.isRegistered(name) ) - { - System.out.println( "addNotificationListener: NOT REGISTERED: " + name ); - } - else - { - System.out.println( "addNotificationListener: REGISTERED: " + name ); - } - mServer.addNotificationListener(name, listener, filter, handback); - } - - public void removeNotificationListener( final ObjectName name, NotificationListener listener) - throws InstanceNotFoundException, ListenerNotFoundException, RemoteException { - mServer.removeNotificationListener(name, listener); - } -} diff --git a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/RemoteEventListener.java b/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/RemoteEventListener.java deleted file mode 100644 index aa72a8edd48..00000000000 --- a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/RemoteEventListener.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.admin.mejb; - -import java.io.Serializable; -import java.rmi.Remote; -import java.rmi.RemoteException; -import javax.management.Notification; - -public interface RemoteEventListener extends Remote, Serializable { - public void handleNotification(Notification n, Object h) throws RemoteException; -} - - - diff --git a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/RemoteListenerConnector.java b/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/RemoteListenerConnector.java deleted file mode 100644 index 39c8188768a..00000000000 --- a/appserver/common/mejb/src/main/java/org/glassfish/admin/mejb/RemoteListenerConnector.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.admin.mejb; - -import java.rmi.Naming; -import javax.management.MBeanServer; -import javax.management.Notification; -import javax.management.NotificationListener; -import javax.management.ObjectName; - -/** - * RemoteListenerConnectors are instantiated by the ListenerRegistry - * with the address of the callback port of the RemoteEventListener - * and then registered with the MBeanServer by the MEJB. - * - * @author Hans Hrasna - */ -public final class RemoteListenerConnector implements NotificationListener, java.io.Serializable { - private static final boolean debug = true; - private static void debug( final String s ) { if ( debug ) { System.out.println(s); } } - - private final String proxyAddress; // the RMI address of the remote event listener - private RemoteEventListener listener = null; //the remote event listener - private transient MBeanServer server = null; // the MBeanServer holds the object this is listening to - // which is set when this is registered in the MEJB - private final String id = hashCode() + ":" + System.currentTimeMillis(); - - public RemoteListenerConnector(String address) { - proxyAddress = address; - } - - public synchronized void handleNotification(Notification evt, Object h) { - try { - debug("RemoteListenerConnector.handleNotification()"); - if (listener == null) { - listener = (RemoteEventListener)Naming.lookup(proxyAddress); - } - listener.handleNotification(evt, h); - } catch (java.rmi.RemoteException ce) { - if (server != null) { - debug("RemoteListenerConnector.server.removeNotificationListener("+ (ObjectName)evt.getSource() + ", " + this + ")"); - try { - server.removeNotificationListener((ObjectName)evt.getSource(), this); - } catch (javax.management.ListenerNotFoundException e) { - debug(toString() + ": " + e); //occurs normally if event was fowarded from J2EEDomain - } catch (Exception e1) { - debug(toString() + ": " + e1); - } - } - } catch (Exception e) { - debug(toString() + ": " + e); - if (debug) { - try { - debug("Naming.list(\"//localhost:1100\")"); - String [] names = Naming.list("//localhost:1100"); - for(int x=0;x - - - - MEJB JAR - - - MEJBBean - MEJBBean - javax.management.j2ee.ManagementHome - javax.management.j2ee.Management - org.glassfish.admin.mejb.MEJBBean - Stateless - Bean - - - admin-role - admin-role - - - - - - - - - - - - admin-role - - - admin-role - - MEJBBean - Remote - isIdentical - - javax.ejb.EJBObject - - - - MEJBBean - Remote - getObjectInstance - - javax.management.ObjectName - - - - MEJBBean - Remote - getDefaultDomain - - - - MEJBBean - Remote - isRegistered - - javax.management.ObjectName - - - - MEJBBean - Remote - remove - - - - MEJBBean - Remote - createMBean - - java.lang.String - javax.management.ObjectName - java.lang.Object[] - java.lang.String[] - - - - MEJBBean - Remote - createMBean - - java.lang.String - javax.management.ObjectName - javax.management.ObjectName - - - - MEJBBean - Home - remove - - javax.ejb.Handle - - - - MEJBBean - Remote - getPrimaryKey - - - - MEJBBean - Remote - removeNotificationListener - - javax.management.ObjectName - javax.management.ObjectName - - - - MEJBBean - Remote - instantiate - - java.lang.String - - - - MEJBBean - Remote - registerAppClient - - com.sun.enterprise.deployment.ApplicationClientDescriptor - - - - MEJBBean - Remote - addNotificationListener - - javax.management.ObjectName - javax.management.ObjectName - javax.management.NotificationFilter - java.lang.Object - - - - MEJBBean - Remote - removeNotificationListener - - javax.management.ObjectName - javax.management.NotificationListener - - - - MEJBBean - Remote - isInstanceOf - - javax.management.ObjectName - java.lang.String - - - - MEJBBean - Remote - deserialize - - java.lang.String - javax.management.ObjectName - byte[] - - - - MEJBBean - Remote - getMBeanCount - - - - MEJBBean - Remote - getEJBHome - - - - MEJBBean - Remote - instantiate - - java.lang.String - javax.management.ObjectName - - - - MEJBBean - Remote - queryNames - - javax.management.ObjectName - javax.management.QueryExp - - - - MEJBBean - Remote - getListenerRegistry - - - - MEJBBean - Remote - deserialize - - java.lang.String - byte[] - - - - MEJBBean - Remote - queryMBeans - - javax.management.ObjectName - javax.management.QueryExp - - - - MEJBBean - Remote - getHandle - - - - MEJBBean - Remote - deserialize - - javax.management.ObjectName - byte[] - - - - MEJBBean - Remote - addNotificationListener - - javax.management.ObjectName - javax.management.NotificationListener - javax.management.NotificationFilter - java.lang.Object - - - - MEJBBean - Remote - instantiate - - java.lang.String - javax.management.ObjectName - java.lang.Object[] - java.lang.String[] - - - - MEJBBean - Remote - unregisterMBean - - javax.management.ObjectName - - - - MEJBBean - Remote - getMBeanInfo - - javax.management.ObjectName - - - - MEJBBean - Home - remove - - java.lang.Object - - - - MEJBBean - Home - getHomeHandle - - - - MEJBBean - Remote - getAttribute - - javax.management.ObjectName - java.lang.String - - - - MEJBBean - Home - create - - - - MEJBBean - Remote - setAttributes - - javax.management.ObjectName - javax.management.AttributeList - - - - MEJBBean - Remote - registerMBean - - java.lang.Object - javax.management.ObjectName - - - - MEJBBean - Remote - createMBean - - java.lang.String - javax.management.ObjectName - - - - MEJBBean - Remote - getAttributes - - javax.management.ObjectName - java.lang.String[] - - - - MEJBBean - Remote - invoke - - javax.management.ObjectName - java.lang.String - java.lang.Object[] - java.lang.String[] - - - - MEJBBean - Remote - instantiate - - java.lang.String - java.lang.Object[] - java.lang.String[] - - - - MEJBBean - Remote - setAttribute - - javax.management.ObjectName - javax.management.Attribute - - - - MEJBBean - Remote - createMBean - - java.lang.String - javax.management.ObjectName - javax.management.ObjectName - java.lang.Object[] - java.lang.String[] - - - - MEJBBean - Home - getEJBMetaData - - - - - - - - diff --git a/appserver/common/mejb/src/main/resources/META-INF/sun-ejb-jar.xml b/appserver/common/mejb/src/main/resources/META-INF/sun-ejb-jar.xml deleted file mode 100644 index 3da1f5fe12b..00000000000 --- a/appserver/common/mejb/src/main/resources/META-INF/sun-ejb-jar.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - admin-role - asadmin - - - - 1 - - MEJBBean - ejb/mgmt/MEJB - false - - - USERNAME_PASSWORD - admin-realm - true - - - false - -1 - 0 - - - - diff --git a/appserver/common/mejb/src/main/resources/stuff/application.xml b/appserver/common/mejb/src/main/resources/stuff/application.xml deleted file mode 100644 index 124b5d9ceda..00000000000 --- a/appserver/common/mejb/src/main/resources/stuff/application.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - J2EE Management EJB Component based on jsr77 spec - MEjbApp - - mejb.jar - - diff --git a/appserver/common/mejb/src/main/resources/stuff/sun-application.xml b/appserver/common/mejb/src/main/resources/stuff/sun-application.xml deleted file mode 100644 index 2480b8c4869..00000000000 --- a/appserver/common/mejb/src/main/resources/stuff/sun-application.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - admin-role - asadmin - - diff --git a/appserver/common/mejb/src/main/resources/stuff/sun-j2ee-ri.xml b/appserver/common/mejb/src/main/resources/stuff/sun-j2ee-ri.xml deleted file mode 100644 index a2a6601711a..00000000000 --- a/appserver/common/mejb/src/main/resources/stuff/sun-j2ee-ri.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - mejb.jar - - MEJBBean - ejb/mgmt/MEJB - - - supported - supported - supported - supported - - - username_password - default - false - - - supported - - - - - - diff --git a/appserver/common/mejb/src/test/java/org/glassfish/admin/mejb/test/MEJBTest.java b/appserver/common/mejb/src/test/java/org/glassfish/admin/mejb/test/MEJBTest.java deleted file mode 100644 index f06353f8f46..00000000000 --- a/appserver/common/mejb/src/test/java/org/glassfish/admin/mejb/test/MEJBTest.java +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -/** - * - */ -package org.glassfish.admin.mejb.test; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Set; -import javax.rmi.PortableRemoteObject; -import javax.management.AttributeList; -import javax.management.MBeanAttributeInfo; -import javax.management.MBeanInfo; -import javax.management.Notification; -import javax.management.NotificationListener; -import javax.management.ObjectName; -import javax.naming.InitialContext; - -import javax.management.j2ee.ManagementHome; - -import com.sun.enterprise.security.ee.auth.login.ProgrammaticLogin; -import org.glassfish.external.amx.AMXGlassfish; - -import javax.management.j2ee.Management; - - -import org.junit.Ignore; - -/** - Standalone MEJB test -- requires running server and disabling security on MEJB. - -export V3M=/v3/glassfish/modules -export MAIN=org.glassfish.admin.mejb.test.MEJBTest -java -cp $V3M/gf-client.jar:$V3M/javax.management.j2ee.jar:target/MEJB.jar $MAIN - - */ -@Ignore -public class MEJBTest { - private final Management mMEJB; - - public MEJBTest( final Management mejb ) - { - mMEJB = mejb; - } - - private void test() { - try - { - _test(); - } - catch( final Exception e) - { - e.printStackTrace(); - } - println( "DONE with MEJB test." ); - } - - - private void testMBean( final ObjectName objectName) - throws Exception - { - println( "" ); - println( "" + objectName ); - - final Management mejb = mMEJB; - final MBeanInfo info = mejb.getMBeanInfo(objectName); - final String[] attrNames = getAttributeNames( info.getAttributes() ); - - println( "attributes: " + toString( newListFromArray(attrNames), ", " ) ); - - final AttributeList list = mejb.getAttributes( objectName, attrNames ); - - for( final String attrName : attrNames) - { - try - { - final Object value = mejb.getAttribute( objectName, attrName ); - } - catch( Exception e ) - { - println( "Attribute failed: " + attrName ); - } - } - } - - private void _test() - throws Exception - { - final Management mejb = mMEJB; - - final String defaultDomain = mejb.getDefaultDomain(); - println("MEJB default domain = " + defaultDomain + ", MBeanCount = " + mejb.getMBeanCount() ); - - final String domain = AMXGlassfish.DEFAULT.amxJMXDomain(); - final ObjectName pattern = newObjectName( domain + ":*" ); - final Set items = mejb.queryNames( pattern, null); - println("Queried " + pattern + ", got mbeans: " + items.size() ); - for( final ObjectName objectName : items ) - { - if ( mejb.isRegistered(objectName) ) - { - testMBean(objectName); - } - } - - // add listeners to all - println( "Listener are not supported, skipping." ); - /* - println( "Adding listeners to every MBean..." ); - - final ListenerRegistration reg = mejb.getListenerRegistry(); - println( "Got ListenerRegistration: " + reg ); - final NotificationListener listener = new NotifListener(); - for( final ObjectName objectName : items ) - { - if ( mejb.isRegistered(objectName) ) - { - final NotificationFilter filter = null; - final Object handback = null; - try { - reg.addNotificationListener( objectName, listener, filter, handback ); - } - catch( final Exception e ) - { - e.printStackTrace(); - } - } - } - */ - } - - - private static final class NotifListener implements NotificationListener - { - public NotifListener() - { - } - - public void handleNotification( final Notification notif, final Object handback ) - { - System.out.println( "NotifListener: " + notif); - } - } - - public static String - toString( - final Collection c, - final String delim ) - { - final StringBuffer buf = new StringBuffer(); - - for( final Object item : c ) - { - buf.append( "" + item ); - buf.append( delim ); - } - if( c.size() != 0) - { - buf.setLength( buf.length() - delim.length() ); - } - - return buf.toString(); - } - - public static List - newListFromArray( final T [] items ) - { - final List list = new ArrayList(); - - for( int i = 0; i < items.length; ++i ) - { - list.add( items[ i ] ); - } - - return( list ); - } - - - public static String [] - getAttributeNames( final MBeanAttributeInfo[] infos ) - { - final String[] names = new String[ infos.length ]; - - for( int i = 0; i < infos.length; ++i ) - { - names[ i ] = infos[ i ].getName(); - } - - return( names ); - } - - static ObjectName - newObjectName( final String name ) - { - try - { - return( new ObjectName( name ) ); - } - catch( Exception e ) - { - throw new RuntimeException( e.getMessage(), e ); - } - } - - - -public static void main(String[] args) { - try { - final String mejbName = "java:global/mejb/MEJBBean"; - final String username = "admin"; - final String password = ""; - final String realm = "admin-realm"; - System.out.println( "Authenticating with \"" + username + "\", \"" + password + "\""); - - final ProgrammaticLogin pm = new ProgrammaticLogin(); - pm.login( username, password, realm, true); - - println("Looking up: " + mejbName); - final InitialContext initial = new InitialContext(); - final Object objref = initial.lookup(mejbName); - - final ManagementHome home = (ManagementHome) PortableRemoteObject.narrow(objref, ManagementHome.class); - try - { - final ManagementHome home2 = (ManagementHome)objref; - } - catch( final Exception e ) - { - println("WARNING: (ManagementHome)PortableRemoteObject.narrow(objref, ManagementHome.class) works, but (ManagementHome)objref does not!" ); - } - - //println("ManagementHome: " + home + " for " + mejbName); - final Management mejb = (Management)home.create(); - println("Got the MEJB"); - - new MEJBTest( mejb ).test(); - - println( "Calling mejb.remove()" ); - mejb.remove(); - - } catch (Exception ex) { - System.err.println("Caught an unexpected exception!"); - ex.printStackTrace(); - } - println( "Exiting main() forcibly" ); - System.exit( -1 ); -} - - private static final void println(final Object o) { - System.out.println("" + o); - } -} diff --git a/appserver/common/pom.xml b/appserver/common/pom.xml index e7bb6a6dd46..faa47463492 100755 --- a/appserver/common/pom.xml +++ b/appserver/common/pom.xml @@ -31,9 +31,7 @@ GlassFish Common modules stats77 - amx-javaee - mejb - mejb-frag + amx-javaee glassfish-ee-api annotation-framework container-common diff --git a/appserver/extras/embedded/all/pom.xml b/appserver/extras/embedded/all/pom.xml index 54b9e1c5752..d294d821f4f 100644 --- a/appserver/extras/embedded/all/pom.xml +++ b/appserver/extras/embedded/all/pom.xml @@ -469,13 +469,6 @@ zip true - - org.glassfish.main.common - mejb-frag - ${project.version} - zip - true - org.glassfish.main.jaxr-ra jaxr-ra-rar diff --git a/appserver/extras/embedded/shell/glassfish-embedded-static-shell/pom.xml b/appserver/extras/embedded/shell/glassfish-embedded-static-shell/pom.xml index b0e4574195d..39deac6ef6a 100755 --- a/appserver/extras/embedded/shell/glassfish-embedded-static-shell/pom.xml +++ b/appserver/extras/embedded/shell/glassfish-embedded-static-shell/pom.xml @@ -311,13 +311,6 @@ zip true - - org.glassfish.main.common - mejb-frag - ${project.version} - zip - true - org.glassfish.main.batch glassfish-batch-commands diff --git a/appserver/featuresets/glassfish/pom.xml b/appserver/featuresets/glassfish/pom.xml index d7dd42328b9..14542ebe9b9 100644 --- a/appserver/featuresets/glassfish/pom.xml +++ b/appserver/featuresets/glassfish/pom.xml @@ -62,17 +62,6 @@ - - org.glassfish.main.common - mejb - ${project.version} - - - * - * - - - org.glassfish.main.batch glassfish-batch-connector diff --git a/appserver/featuresets/web/pom.xml b/appserver/featuresets/web/pom.xml index 424c0624eaf..6eaf8616c9e 100644 --- a/appserver/featuresets/web/pom.xml +++ b/appserver/featuresets/web/pom.xml @@ -579,16 +579,6 @@ - - jakarta.management.j2ee - jakarta.management.j2ee-api - - - * - * - - - jakarta.security.auth.message jakarta.security.auth.message-api diff --git a/appserver/pom.xml b/appserver/pom.xml index 4d4b4256e09..4d0561b9b89 100644 --- a/appserver/pom.xml +++ b/appserver/pom.xml @@ -104,8 +104,7 @@ 1.0.2 1.0.2 1.0.2 - 1.1.3 - 1.2.1.Final + 1.2.1.Final 3.5 2.4 @@ -410,18 +409,6 @@ 1.6 javax.enterprise.deploy - - - jakarta.management.j2ee - jakarta.management.j2ee-api - ${javax.management.j2ee-api.version} - - false - api - 1.1 - ${javax.management.j2ee-api.version} - javax.management.j2ee - jakarta.servlet.jsp @@ -805,11 +792,6 @@ yasson ${yasson.version} - - jakarta.management.j2ee - jakarta.management.j2ee-api - ${javax.management.j2ee-api.version} - org.glassfish.hk2 osgi-resource-locator