Author: remy.maucherat(a)jboss.com
Date: 2010-04-08 18:33:40 -0400 (Thu, 08 Apr 2010)
New Revision: 1433
Removed:
trunk/java/org/apache/catalina/mbeans-descriptors.xml
Modified:
trunk/java/org/apache/catalina/Globals.java
trunk/java/org/apache/catalina/Host.java
trunk/java/org/apache/catalina/Loader.java
trunk/java/org/apache/catalina/Server.java
trunk/java/org/apache/catalina/core/StandardHost.java
trunk/java/org/apache/catalina/core/StandardServer.java
trunk/java/org/apache/catalina/startup/Catalina.java
trunk/java/org/apache/catalina/startup/Embedded.java
trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
trunk/webapps/docs/changelog.xml
Log:
- More standalone code removal.
- Add back two util methods used in AS.
Modified: trunk/java/org/apache/catalina/Globals.java
===================================================================
--- trunk/java/org/apache/catalina/Globals.java 2010-04-07 23:15:04 UTC (rev 1432)
+++ trunk/java/org/apache/catalina/Globals.java 2010-04-08 22:33:40 UTC (rev 1433)
@@ -356,40 +356,4 @@
(System.getSecurityManager() != null);
- /**
- * The folder used for JAR overlays.
- */
- public static final String OVERLAY_PATH =
- System.getProperty("org.apache.catalina.OVERLAY_PATH",
"/META-INF/resources");
-
-
- /**
- * The path used for web fragments.
- */
- public static final String WEB_FRAGMENT_PATH =
- System.getProperty("org.apache.catalina.WEB_FRAGMENT_PATH",
"/META-INF/web-fragment.xml");
-
-
- /**
- * The path used for the ServletContainerInitializer service.
- */
- public static final String SERVLET_CONTAINER_INITIALIZER_SERVICE_PATH =
-
System.getProperty("org.apache.catalina.SERVLET_CONTAINER_INITIALIZER_SERVICE_PATH",
-
"/META-INF/services/javax.servlet.ServletContainerInitializer");
-
-
- /**
- * The master flag which controls XML validation.
- */
- public static final boolean XML_VALIDATION =
-
Boolean.valueOf(System.getProperty("org.apache.catalina.XML_VALIDATION",
"false")).booleanValue();
-
-
- /**
- * The master flag which controls namespace awareness when parsing XML.
- */
- public static final boolean XML_NAMESPACE_AWARE =
-
Boolean.valueOf(System.getProperty("org.apache.catalina.XML_NAMESPACE_AWARE",
"false")).booleanValue();
-
-
}
Modified: trunk/java/org/apache/catalina/Host.java
===================================================================
--- trunk/java/org/apache/catalina/Host.java 2010-04-07 23:15:04 UTC (rev 1432)
+++ trunk/java/org/apache/catalina/Host.java 2010-04-08 22:33:40 UTC (rev 1433)
@@ -136,15 +136,6 @@
/**
- * Return the Context that would be used to process the specified
- * host-relative request URI, if any; otherwise return
<code>null</code>.
- *
- * @param uri Request URI to be mapped
- */
- public Context map(String uri);
-
-
- /**
* Remove the specified alias name from the aliases for this Host.
*
* @param alias Alias name to be removed
Modified: trunk/java/org/apache/catalina/Loader.java
===================================================================
--- trunk/java/org/apache/catalina/Loader.java 2010-04-07 23:15:04 UTC (rev 1432)
+++ trunk/java/org/apache/catalina/Loader.java 2010-04-08 22:33:40 UTC (rev 1433)
@@ -88,22 +88,6 @@
/**
- * Return the "follow standard delegation model" flag used to configure
- * our ClassLoader.
- */
- public boolean getDelegate();
-
-
- /**
- * Set the "follow standard delegation model" flag used to configure
- * our ClassLoader.
- *
- * @param delegate The new flag
- */
- public void setDelegate(boolean delegate);
-
-
- /**
* Return descriptive information about this Loader implementation and
* the corresponding version number, in the format
* <code><description>/<version></code>.
@@ -111,31 +95,10 @@
public String getInfo();
- /**
- * Return the reloadable flag for this Loader.
- */
- public boolean getReloadable();
-
-
- /**
- * Set the reloadable flag for this Loader.
- *
- * @param reloadable The new reloadable flag
- */
- public void setReloadable(boolean reloadable);
-
-
// --------------------------------------------------------- Public Methods
/**
- * Return the set of loader repositories defined for this class loader.
- * If none are defined, a zero-length array is returned.
- */
- public String[] findLoaderRepositories();
-
-
- /**
* Add a property change listener to this component.
*
* @param listener The listener to add
@@ -152,20 +115,6 @@
/**
- * Return the set of repositories defined for this class loader.
- * If none are defined, a zero-length array is returned.
- */
- public String[] findRepositories();
-
-
- /**
- * Has the internal repository associated with this Loader been modified,
- * such that the loaded classes should be reloaded?
- */
- public boolean modified();
-
-
- /**
* Remove a property change listener from this component.
*
* @param listener The listener to remove
Modified: trunk/java/org/apache/catalina/Server.java
===================================================================
--- trunk/java/org/apache/catalina/Server.java 2010-04-07 23:15:04 UTC (rev 1432)
+++ trunk/java/org/apache/catalina/Server.java 2010-04-08 22:33:40 UTC (rev 1433)
@@ -58,48 +58,6 @@
public String getInfo();
- /**
- * Return the port number we listen to for shutdown commands.
- */
- public int getPort();
-
-
- /**
- * Set the port number we listen to for shutdown commands.
- *
- * @param port The new port number
- */
- public void setPort(int port);
-
-
- /**
- * Return the address on which we listen to for shutdown commands.
- */
- public String getAddress();
-
-
- /**
- * Set the address on which we listen to for shutdown commands.
- *
- * @param address The new address
- */
- public void setAddress(String address);
-
-
- /**
- * Return the shutdown command string we are waiting for.
- */
- public String getShutdown();
-
-
- /**
- * Set the shutdown command we are waiting for.
- *
- * @param shutdown The new shutdown command
- */
- public void setShutdown(String shutdown);
-
-
// --------------------------------------------------------- Public Methods
@@ -112,12 +70,6 @@
/**
- * Wait until a proper shutdown command is received, then return.
- */
- public void await();
-
-
- /**
* Return the specified Service (if it exists); otherwise return
* <code>null</code>.
*
Modified: trunk/java/org/apache/catalina/core/StandardHost.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardHost.java 2010-04-07 23:15:04 UTC (rev
1432)
+++ trunk/java/org/apache/catalina/core/StandardHost.java 2010-04-08 22:33:40 UTC (rev
1433)
@@ -358,55 +358,6 @@
/**
- * Return the Context that would be used to process the specified
- * host-relative request URI, if any; otherwise return
<code>null</code>.
- *
- * @param uri Request URI to be mapped
- */
- public Context map(String uri) {
-
- if (log.isDebugEnabled())
- log.debug("Mapping request URI '" + uri + "'");
- if (uri == null)
- return (null);
-
- // Match on the longest possible context path prefix
- if (log.isTraceEnabled())
- log.trace(" Trying the longest context path prefix");
- Context context = null;
- String mapuri = uri;
- while (true) {
- context = (Context) findChild(mapuri);
- if (context != null)
- break;
- int slash = mapuri.lastIndexOf('/');
- if (slash < 0)
- break;
- mapuri = mapuri.substring(0, slash);
- }
-
- // If no Context matches, select the default Context
- if (context == null) {
- if (log.isTraceEnabled())
- log.trace(" Trying the default context");
- context = (Context) findChild("");
- }
-
- // Complain if no Context has been selected
- if (context == null) {
- log.error(sm.getString("standardHost.mappingError", uri));
- return (null);
- }
-
- // Return the mapped Context (if any)
- if (log.isDebugEnabled())
- log.debug(" Mapped to context '" + context.getPath() +
"'");
- return (context);
-
- }
-
-
- /**
* Remove the specified alias name from the aliases for this Host.
*
* @param alias Alias name to be removed
Modified: trunk/java/org/apache/catalina/core/StandardServer.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardServer.java 2010-04-07 23:15:04 UTC (rev
1432)
+++ trunk/java/org/apache/catalina/core/StandardServer.java 2010-04-08 22:33:40 UTC (rev
1433)
@@ -21,19 +21,11 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.InetAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.security.AccessControlException;
-import java.util.Random;
import javax.management.MBeanRegistration;
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import org.apache.catalina.Context;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
@@ -88,36 +80,12 @@
/**
- * The port number on which we wait for shutdown commands.
- */
- private int port = 8005;
-
- /**
- * The address on which we wait for shutdown commands.
- */
- private String address = "localhost";
-
-
- /**
- * A random number generator that is <strong>only</strong> used if
- * the shutdown command string is longer than 1024 characters.
- */
- private Random random = null;
-
-
- /**
* The set of Services associated with this Server.
*/
private Service services[] = new Service[0];
/**
- * The shutdown command string we are looking for.
- */
- private String shutdown = "SHUTDOWN";
-
-
- /**
* The string manager for this package.
*/
private static final StringManager sm =
@@ -141,7 +109,6 @@
*/
protected PropertyChangeSupport support = new PropertyChangeSupport(this);
- private boolean stopAwait = false;
// ------------------------------------------------------------- Properties
@@ -166,71 +133,7 @@
return ServerInfo.getServerInfo();
}
- /**
- * Return the port number we listen to for shutdown commands.
- */
- public int getPort() {
- return (this.port);
-
- }
-
-
- /**
- * Set the port number we listen to for shutdown commands.
- *
- * @param port The new port number
- */
- public void setPort(int port) {
-
- this.port = port;
-
- }
-
-
- /**
- * Return the address on which we listen to for shutdown commands.
- */
- public String getAddress() {
-
- return (this.address);
-
- }
-
-
- /**
- * Set the address on which we listen to for shutdown commands.
- *
- * @param address The new address
- */
- public void setAddress(String address) {
-
- this.address = address;
-
- }
-
- /**
- * Return the shutdown command string we are waiting for.
- */
- public String getShutdown() {
-
- return (this.shutdown);
-
- }
-
-
- /**
- * Set the shutdown command we are waiting for.
- *
- * @param shutdown The new shutdown command
- */
- public void setShutdown(String shutdown) {
-
- this.shutdown = shutdown;
-
- }
-
-
// --------------------------------------------------------- Server Methods
@@ -271,113 +174,7 @@
}
- public void stopAwait() {
- stopAwait=true;
- }
-
/**
- * Wait until a proper shutdown command is received, then return.
- * This keeps the main thread alive - the thread pool listening for http
- * connections is daemon threads.
- */
- public void await() {
- // Negative values - don't wait on port - tomcat is embedded or we just
don't like ports
- if( port == -2 ) {
- // undocumented yet - for embedding apps that are around, alive.
- return;
- }
- if( port==-1 ) {
- while( true ) {
- try {
- Thread.sleep(10000);
- } catch( InterruptedException ex ) {
- }
- if( stopAwait ) return;
- }
- }
-
- // Set up a server socket to wait on
- ServerSocket serverSocket = null;
- try {
- serverSocket =
- new ServerSocket(port, 1,
- InetAddress.getByName(address));
- } catch (IOException e) {
- log.error("StandardServer.await: create[" + address
- + ":" + port
- + "]: ", e);
- System.exit(1);
- }
-
- // Loop waiting for a connection and a valid command
- while (true) {
-
- // Wait for the next connection
- Socket socket = null;
- InputStream stream = null;
- try {
- socket = serverSocket.accept();
- socket.setSoTimeout(10 * 1000); // Ten seconds
- stream = socket.getInputStream();
- } catch (AccessControlException ace) {
- log.warn("StandardServer.accept security exception: "
- + ace.getMessage(), ace);
- continue;
- } catch (IOException e) {
- log.error("StandardServer.await: accept: ", e);
- System.exit(1);
- }
-
- // Read a set of characters from the socket
- StringBuilder command = new StringBuilder();
- int expected = 1024; // Cut off to avoid DoS attack
- while (expected < shutdown.length()) {
- if (random == null)
- random = new Random();
- expected += (random.nextInt() % 1024);
- }
- while (expected > 0) {
- int ch = -1;
- try {
- ch = stream.read();
- } catch (IOException e) {
- log.warn("StandardServer.await: read: ", e);
- ch = -1;
- }
- if (ch < 32) // Control character or EOF terminates loop
- break;
- command.append((char) ch);
- expected--;
- }
-
- // Close the socket now that we are done with it
- try {
- socket.close();
- } catch (IOException e) {
- ;
- }
-
- // Match against our command string
- boolean match = command.toString().equals(shutdown);
- if (match) {
- break;
- } else
- log.warn("StandardServer.await: Invalid command '" +
- command.toString() + "' received");
-
- }
-
- // Close the server socket and return
- try {
- serverSocket.close();
- } catch (IOException e) {
- ;
- }
-
- }
-
-
- /**
* Return the specified Service (if it exists); otherwise return
* <code>null</code>.
*
@@ -492,71 +289,10 @@
* Return a String representation of this component.
*/
public String toString() {
-
- StringBuilder sb = new StringBuilder("StandardServer[");
- sb.append(getPort());
- sb.append("]");
- return (sb.toString());
-
+ return ("StandardServer[]");
}
- /**
- * Write the configuration information for this entire
<code>Server</code>
- * out to the server.xml configuration file.
- *
- * @exception javax.management.InstanceNotFoundException if the managed resource
object
- * cannot be found
- * @exception javax.management.MBeanException if the initializer of the object
throws
- * an exception, or persistence is not supported
- * @exception javax.management.RuntimeOperationsException if an exception is
reported
- * by the persistence mechanism
- */
- public synchronized void storeConfig() throws Exception {
-
- ObjectName sname = null;
- try {
- sname = new ObjectName("Catalina:type=StoreConfig");
- if(mserver.isRegistered(sname)) {
- mserver.invoke(sname, "storeConfig", null, null);
- } else
- log.error("StoreConfig mbean not registered" + sname);
- } catch (Throwable t) {
- log.error(t);
- }
-
- }
-
-
- /**
- * Write the configuration information for <code>Context</code>
- * out to the specified configuration file.
- *
- * @exception javax.management.InstanceNotFoundException if the managed resource
object
- * cannot be found
- * @exception javax.management.MBeanException if the initializer of the object
throws
- * an exception, or persistence is not supported
- * @exception javax.management.RuntimeOperationsException if an exception is
reported
- * by the persistence mechanism
- */
- public synchronized void storeContext(Context context) throws Exception {
-
- ObjectName sname = null;
- try {
- sname = new ObjectName("Catalina:type=StoreConfig");
- if(mserver.isRegistered(sname)) {
- mserver.invoke(sname, "store",
- new Object[] {context},
- new String [] { "java.lang.String"});
- } else
- log.error("StoreConfig mbean not registered" + sname);
- } catch (Throwable t) {
- log.error(t);
- }
-
- }
-
-
// ------------------------------------------------------ Lifecycle Methods
@@ -662,9 +398,6 @@
// Notify our interested LifecycleListeners
lifecycle.fireLifecycleEvent(AFTER_STOP_EVENT, null);
- if (port == -1)
- stopAwait();
-
}
public void init() throws Exception {
Deleted: trunk/java/org/apache/catalina/mbeans-descriptors.xml
===================================================================
--- trunk/java/org/apache/catalina/mbeans-descriptors.xml 2010-04-07 23:15:04 UTC (rev
1432)
+++ trunk/java/org/apache/catalina/mbeans-descriptors.xml 2010-04-08 22:33:40 UTC (rev
1433)
@@ -1,150 +0,0 @@
-<?xml version="1.0"?>
-<mbeans-descriptors>
-
- <mbean name="Group"
- className="org.apache.catalina.mbeans.GroupMBean"
- description="Group from a user database"
- domain="Users"
- group="Group"
- type="org.apache.catalina.Group">
-
- <attribute name="description"
- description="Description of this group"
- type="java.lang.String"/>
-
- <attribute name="groupname"
- description="Group name of this group"
- type="java.lang.String"/>
-
- <attribute name="roles"
- description="MBean Names of roles for this group"
- type="[Ljava.lang.String;"
- writeable="false"/>
-
- <attribute name="users"
- description="MBean Names of user members of this group"
- type="[Ljava.lang.String;"
- writeable="false"/>
-
- <operation name="addRole"
- description="Add a new authorized role for this group"
- impact="ACTION"
- returnType="void">
- <parameter name="role"
- description="Role to be added"
- type="java.lang.String"/>
- </operation>
-
- <operation name="removeRole"
- description="Remove an old authorized role for this group"
- impact="ACTION"
- returnType="void">
- <parameter name="role"
- description="Role to be removed"
- type="java.lang.String"/>
- </operation>
-
- <operation name="removeRoles"
- description="Remove all authorized roles for this group"
- impact="ACTION"
- returnType="void">
- </operation>
-
- </mbean>
-
- <mbean name="Role"
- className="org.apache.catalina.mbeans.RoleMBean"
- description="Security role from a user database"
- domain="Users"
- group="Role"
- type="org.apache.catalina.Role">
-
- <attribute name="description"
- description="Description of this role"
- type="java.lang.String"/>
-
- <attribute name="rolename"
- description="Role name of this role"
- type="java.lang.String"/>
-
- </mbean>
-
- <mbean name="User"
- className="org.apache.catalina.mbeans.UserMBean"
- description="User from a user database"
- domain="Users"
- group="User"
- type="org.apache.catalina.User">
-
- <attribute name="fullName"
- description="Full name of this user"
- type="java.lang.String"/>
-
- <attribute name="groups"
- description="MBean Names of groups this user is a member of"
- type="[Ljava.lang.String;"/>
-
- <attribute name="password"
- description="Password of this user"
- type="java.lang.String"/>
-
- <attribute name="roles"
- description="MBean Names of roles for this user"
- type="[Ljava.lang.String;"
- writeable="false"/>
-
- <attribute name="username"
- description="User name of this user"
- type="java.lang.String"/>
-
- <operation name="addGroup"
- description="Add a new group membership for this user"
- impact="ACTION"
- returnType="void">
- <parameter name="groupname"
- description="Group name of the new group"
- type="java.lang.String"/>
- </operation>
-
- <operation name="addRole"
- description="Add a new authorized role for this user"
- impact="ACTION"
- returnType="void">
- <parameter name="role"
- description="Role to be added"
- type="java.lang.String"/>
- </operation>
-
- <operation name="removeGroup"
- description="Remove an old group membership for this user"
- impact="ACTION"
- returnType="void">
- <parameter name="groupname"
- description="Group name of the old group"
- type="java.lang.String"/>
- </operation>
-
- <operation name="removeGroups"
- description="Remove all group memberships for this user"
- impact="ACTION"
- returnType="void">
- </operation>
-
- <operation name="removeRole"
- description="Remove an old authorized role for this user"
- impact="ACTION"
- returnType="void">
- <parameter name="role"
- description="Role to be removed"
- type="java.lang.String"/>
- </operation>
-
- <operation name="removeRoles"
- description="Remove all authorized roles for this user"
- impact="ACTION"
- returnType="void">
- </operation>
-
- </mbean>
-
-</mbeans-descriptors>
Modified: trunk/java/org/apache/catalina/startup/Catalina.java
===================================================================
--- trunk/java/org/apache/catalina/startup/Catalina.java 2010-04-07 23:15:04 UTC (rev
1432)
+++ trunk/java/org/apache/catalina/startup/Catalina.java 2010-04-08 22:33:40 UTC (rev
1433)
@@ -19,30 +19,14 @@
package org.apache.catalina.startup;
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.Socket;
-
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Server;
/**
- * Startup/Shutdown shell program for Catalina. The following command line
- * options are recognized:
- * <ul>
- * <li><b>-config {pathname}</b> - Set the pathname of the
configuration file
- * to be processed. If a relative path is specified, it will be
- * interpreted as relative to the directory pathname specified by the
- * "catalina.base" system property. [conf/server.xml]
- * <li><b>-help</b> - Display usage information.
- * <li><b>-stop</b> - Stop the currently running instance of Catalina.
- * </u>
+ * Wrapper impl of Embedded.
*
- * Should do the same thing as Embedded, but using a server.xml file.
- *
* @author Craig R. McClanahan
* @author Remy Maucherat
* @version $Revision$ $Date$
@@ -55,19 +39,6 @@
/**
- * Pathname to the server configuration file.
- */
- protected String configFile = "conf/server.xml";
-
- // XXX Should be moved to embedded
- /**
- * The shared extensions class loader for this server.
- */
- protected ClassLoader parentClassLoader =
- Catalina.class.getClassLoader();
-
-
- /**
* The server component we are starting or stopping
*/
protected Server server = null;
@@ -85,247 +56,27 @@
protected boolean stopping = false;
- /**
- * Use shutdown hook flag.
- */
- protected boolean useShutdownHook = true;
-
-
- /**
- * Shutdown hook.
- */
- protected Thread shutdownHook = null;
-
-
// ------------------------------------------------------------- Properties
- public void setConfig(String file) {
- configFile = file;
+ public Server getServer() {
+ return server;
}
-
- public void setConfigFile(String file) {
- configFile = file;
- }
-
-
- public String getConfigFile() {
- return configFile;
- }
-
-
- public void setUseShutdownHook(boolean useShutdownHook) {
- this.useShutdownHook = useShutdownHook;
- }
-
-
- public boolean getUseShutdownHook() {
- return useShutdownHook;
- }
-
-
- /**
- * Set the shared extensions class loader.
- *
- * @param parentClassLoader The shared extensions class loader.
- */
- public void setParentClassLoader(ClassLoader parentClassLoader) {
-
- this.parentClassLoader = parentClassLoader;
-
- }
-
-
- /**
- * Set the server instance we are configuring.
- *
- * @param server The new server
- */
public void setServer(Server server) {
-
this.server = server;
-
}
- // ----------------------------------------------------------- Main Program
-
- /**
- * The application main program.
- *
- * @param args Command line arguments
- */
- public static void main(String args[]) {
- (new Catalina()).process(args);
- }
-
-
- /**
- * The instance main program.
- *
- * @param args Command line arguments
- */
- public void process(String args[]) {
-
- setAwait(true);
- try {
- if (arguments(args)) {
- if (starting) {
- load(args);
- start();
- } else if (stopping) {
- stopServer();
- }
- }
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
- }
-
-
- // ------------------------------------------------------ Protected Methods
-
-
- /**
- * Process the specified command line arguments, and return
- * <code>true</code> if we should continue processing; otherwise
- * return <code>false</code>.
- *
- * @param args Command line arguments to process
- */
- protected boolean arguments(String args[]) {
-
- boolean isConfig = false;
-
- if (args.length < 1) {
- usage();
- return (false);
- }
-
- for (int i = 0; i < args.length; i++) {
- if (isConfig) {
- configFile = args[i];
- isConfig = false;
- } else if (args[i].equals("-config")) {
- isConfig = true;
- } else if (args[i].equals("-nonaming")) {
- setUseNaming( false );
- } else if (args[i].equals("-help")) {
- usage();
- return (false);
- } else if (args[i].equals("start")) {
- starting = true;
- stopping = false;
- } else if (args[i].equals("stop")) {
- starting = false;
- stopping = true;
- } else {
- usage();
- return (false);
- }
- }
-
- return (true);
-
- }
-
-
- /**
- * Return a File object representing our configuration file.
- */
- protected File configFile() {
-
- File file = new File(configFile);
- if (!file.isAbsolute())
- file = new File(System.getProperty("catalina.base"), configFile);
- return (file);
-
- }
-
-
- public void stopServer() {
- stopServer(null);
- }
-
- public void stopServer(String[] arguments) {
-
- if (arguments != null) {
- arguments(arguments);
- }
-
- // Stop the existing server
- if (server.getPort() < 0) {
- return;
- }
- try {
- Socket socket = new Socket(server.getAddress(), server.getPort());
- OutputStream stream = socket.getOutputStream();
- String shutdown = server.getShutdown();
- for (int i = 0; i < shutdown.length(); i++)
- stream.write(shutdown.charAt(i));
- stream.flush();
- stream.close();
- socket.close();
- } catch (IOException e) {
- log.error("Catalina.stop: ", e);
- System.exit(1);
- }
-
- }
-
-
- /**
- * Start a new server instance.
- */
- public void load() {
-
- // Stream redirection
- initStreams();
-
- // Start the new server
- if (server instanceof Lifecycle) {
- try {
- server.initialize();
- } catch (LifecycleException e) {
- log.error("Catalina.start", e);
- }
- }
-
- }
-
-
- /*
- * Load using arguments
- */
- public void load(String args[]) {
-
- try {
- if (arguments(args))
- load();
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
- }
-
public void create() {
-
}
public void destroy() {
-
}
/**
* Start a new server instance.
*/
public void start() {
-
- if (server == null) {
- load();
- }
-
- long t1 = System.nanoTime();
-
// Start the new server
if (server instanceof Lifecycle) {
try {
@@ -334,29 +85,6 @@
log.error("Catalina.start: ", e);
}
}
-
- long t2 = System.nanoTime();
- if (log.isDebugEnabled())
- log.debug("Server startup in " + ((t2 - t1) / 1000000) + "
ms");
-
- try {
- // Register shutdown hook
- if (useShutdownHook) {
- if (shutdownHook == null) {
- shutdownHook = new CatalinaShutdownHook();
- }
- Runtime.getRuntime().addShutdownHook(shutdownHook);
- }
- } catch (Throwable t) {
- // This will fail on JDK 1.2. Ignoring, as Tomcat can run
- // fine without the shutdown hook.
- }
-
- if (await) {
- await();
- stop();
- }
-
}
@@ -365,17 +93,6 @@
*/
public void stop() {
- try {
- // Remove the ShutdownHook first so that server.stop()
- // doesn't get invoked twice
- if (useShutdownHook) {
- Runtime.getRuntime().removeShutdownHook(shutdownHook);
- }
- } catch (Throwable t) {
- // This will fail on JDK 1.2. Ignoring, as Tomcat can run
- // fine without the shutdown hook.
- }
-
// Shut down the server
if (server instanceof Lifecycle) {
try {
@@ -388,48 +105,6 @@
}
- /**
- * Await and shutdown.
- */
- public void await() {
-
- server.await();
-
- }
-
-
- /**
- * Print usage information for this application.
- */
- protected void usage() {
-
- System.out.println
- ("usage: java org.apache.catalina.startup.Catalina"
- + " [ -config {pathname} ]"
- + " [ -nonaming ] { start | stop }");
-
- }
-
-
- // --------------------------------------- CatalinaShutdownHook Inner Class
-
- // XXX Should be moved to embedded !
- /**
- * Shutdown hook which will perform a clean shutdown of Catalina if needed.
- */
- protected class CatalinaShutdownHook extends Thread {
-
- public void run() {
-
- if (server != null) {
- Catalina.this.stop();
- }
-
- }
-
- }
-
-
private static org.jboss.logging.Logger log=
org.jboss.logging.Logger.getLogger( Catalina.class );
Modified: trunk/java/org/apache/catalina/startup/Embedded.java
===================================================================
--- trunk/java/org/apache/catalina/startup/Embedded.java 2010-04-07 23:15:04 UTC (rev
1432)
+++ trunk/java/org/apache/catalina/startup/Embedded.java 2010-04-08 22:33:40 UTC (rev
1433)
@@ -41,7 +41,6 @@
import org.apache.catalina.util.LifecycleSupport;
import org.apache.catalina.util.StringManager;
import org.apache.tomcat.util.IntrospectionUtils;
-import org.apache.tomcat.util.log.SystemLogHandler;
import org.jboss.logging.Logger;
@@ -131,18 +130,6 @@
/**
- * Is naming enabled ?
- */
- protected boolean useNaming = true;
-
-
- /**
- * Is standard streams redirection enabled ?
- */
- protected boolean redirectStreams = true;
-
-
- /**
* The set of Engines that have been deployed in this server. Normally
* there will only be one.
*/
@@ -187,66 +174,10 @@
*/
protected boolean started = false;
- /**
- * Use await.
- */
- protected boolean await = false;
-
-
// ------------------------------------------------------------- Properties
/**
- * Return true if naming is enabled.
- */
- public boolean isUseNaming() {
-
- return (this.useNaming);
-
- }
-
-
- /**
- * Enables or disables naming support.
- *
- * @param useNaming The new use naming value
- */
- public void setUseNaming(boolean useNaming) {
-
- boolean oldUseNaming = this.useNaming;
- this.useNaming = useNaming;
- support.firePropertyChange("useNaming", new Boolean(oldUseNaming),
- new Boolean(this.useNaming));
-
- }
-
-
- /**
- * Return true if redirction of standard streams is enabled.
- */
- public boolean isRedirectStreams() {
-
- return (this.redirectStreams);
-
- }
-
-
- /**
- * Enables or disables naming support.
- *
- * @param useNaming The new use naming value
- */
- public void setRedirectStreams(boolean redirectStreams) {
-
- boolean oldRedirectStreams = this.redirectStreams;
- this.redirectStreams = redirectStreams;
- support.firePropertyChange("redirectStreams", new
Boolean(oldRedirectStreams),
- new Boolean(this.redirectStreams));
-
- }
-
-
- /**
* Return the default Realm for our Containers.
*/
public Realm getRealm() {
@@ -269,14 +200,6 @@
}
- public void setAwait(boolean b) {
- await = b;
- }
-
- public boolean isAwait() {
- return await;
- }
-
public void setCatalinaHome( String s ) {
System.setProperty( "catalina.home", s);
}
@@ -848,19 +771,6 @@
}
- // ------------------------------------------------------ Protected Methods
-
-
- protected void initStreams() {
- if (redirectStreams) {
- // Replace System.out and System.err with a custom PrintStream
- SystemLogHandler systemlog = new SystemLogHandler(System.out);
- System.setOut(systemlog);
- System.setErr(systemlog);
- }
- }
-
-
// -------------------------------------------------------- Private Methods
/**
Modified: trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
===================================================================
--- trunk/java/org/apache/tomcat/util/IntrospectionUtils.java 2010-04-07 23:15:04 UTC (rev
1432)
+++ trunk/java/org/apache/tomcat/util/IntrospectionUtils.java 2010-04-08 22:33:40 UTC (rev
1433)
@@ -214,6 +214,56 @@
return null;
}
+ public static Object callMethod1(Object target, String methodN,
+ Object param1, String typeParam1, ClassLoader cl) throws Exception {
+ if (target == null || param1 == null) {
+ d("Assert: Illegal params " + target + " " + param1);
+ }
+ if (dbg > 0)
+ d("callMethod1 " + target.getClass().getName() + " "
+ + param1.getClass().getName() + " " + typeParam1);
+
+ Class params[] = new Class[1];
+ if (typeParam1 == null)
+ params[0] = param1.getClass();
+ else
+ params[0] = cl.loadClass(typeParam1);
+ Method m = findMethod(target.getClass(), methodN, params);
+ if (m == null)
+ throw new NoSuchMethodException(target.getClass().getName() + " "
+ + methodN);
+ return m.invoke(target, new Object[] { param1 });
+ }
+
+ public static Method findMethod(Class c, String name, Class params[]) {
+ Method methods[] = c.getMethods();
+ if (methods == null)
+ return null;
+ for (int i = 0; i < methods.length; i++) {
+ if (methods[i].getName().equals(name)) {
+ Class methodParams[] = methods[i].getParameterTypes();
+ if (methodParams == null)
+ if (params == null || params.length == 0)
+ return methods[i];
+ if (params == null)
+ if (methodParams == null || methodParams.length == 0)
+ return methods[i];
+ if (params.length != methodParams.length)
+ continue;
+ boolean found = true;
+ for (int j = 0; j < params.length; j++) {
+ if (params[j] != methodParams[j]) {
+ found = false;
+ break;
+ }
+ }
+ if (found)
+ return methods[i];
+ }
+ }
+ return null;
+ }
+
/**
* Reverse of Introspector.decapitalize
*/
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2010-04-07 23:15:04 UTC (rev 1432)
+++ trunk/webapps/docs/changelog.xml 2010-04-08 22:33:40 UTC (rev 1433)
@@ -16,6 +16,16 @@
<body>
+<section name="JBoss Web 3.0.0.Beta5 (remm)">
+ <subsection name="Catalina">
+ <changelog>
+ <update>
+ More standalone code removal. (remm)
+ </update>
+ </changelog>
+ </subsection>
+</section>
+
<section name="JBoss Web 3.0.0.Beta4 (remm)">
<subsection name="Catalina">
<changelog>