Update of /cvsroot/plexus/plexus-container-new/src/java/org/apache/plexus/servlet
In directory eng.werken.com:/tmp/cvs-serv25512/src/java/org/apache/plexus/servlet
Modified Files:
PlexusLoaderServlet.java PlexusServlet.java
Log Message:
o Removed all weird Plexus manglings of Avalon's interfaces. Now Plexus can
handle many container APIs and many lifecycles so we won't tamper with
Avalon. Where Avalon applies we will adhere to whatever they decide.
If users need something different then they can extend the lifecycle as
they see fit and create different or extended container APIs.
Index: PlexusLoaderServlet.java
===================================================================
RCS file: /cvsroot/plexus/plexus-container-new/src/java/org/apache/plexus/servlet/PlexusLoaderServlet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- PlexusLoaderServlet.java 22 Apr 2003 00:35:52 -0000 1.2
+++ PlexusLoaderServlet.java 23 Apr 2003 03:57:13 -0000 1.3
@@ -56,16 +56,16 @@
* ----------------------------------------------------------------------------
*/
+import org.apache.plexus.DefaultPlexusContainer;
+import org.apache.plexus.lifecycle.avalon.AvalonServiceManager;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.Reader;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-
-import org.apache.plexus.DefaultPlexusContainer;
-
/**
* <p>PlexusLoaderServlet loads a Plexus instance for a web application. The
* Plexus <code>ServiceBroker</code> instance is put into the
@@ -87,33 +87,33 @@
{
/** Plexus instance */
private DefaultPlexusContainer container;
-
+
/**
* Load Plexus into the ServletContext for PlexusServlets.
- *
+ *
* @see javax.servlet.GenericServlet#init()
*/
public void init() throws ServletException
{
super.init();
-
- log("Initializing Plexus...");
+
+ log( "Initializing Plexus..." );
String configFileName = getInitParameter( "plexus-config" );
- String applicationRoot = getServletContext().getRealPath("");
-
+ String applicationRoot = getServletContext().getRealPath( "" );
+
System.getProperties().setProperty( "plexus.home", applicationRoot + "/WEB-INF" );
-
+
File configuration = new File( applicationRoot, configFileName );
Reader config = null;
try
{
config = new FileReader( configuration.getAbsolutePath() );
}
- catch (FileNotFoundException e)
+ catch ( FileNotFoundException e )
{
throw new ServletException( "Could not find the Plexus configuration!", e );
- }
-
+ }
+
// Start plexus
container = new DefaultPlexusContainer();
try
@@ -122,20 +122,20 @@
container.initialize();
container.start();
}
- catch (Exception e)
+ catch ( Exception e )
{
throw new ServletException( "Could not start Plexus!", e );
}
-
+
// Put the ServiceBroker in the context
- this.getServletContext().setAttribute( PlexusServlet.SERVICE_BROKER_KEY,
- container.getServiceRepository() );
- log("Plexus Initializied.");
+ this.getServletContext().setAttribute( PlexusServlet.SERVICE_MANAGER_KEY,
+ new AvalonServiceManager( container.getServiceRepository() ) );
+ log( "Plexus Initializied." );
}
-
+
/**
* Shutdown plexus.
- *
+ *
* @see javax.servlet.Servlet#destroy()
*/
public void destroy()
@@ -144,11 +144,11 @@
{
container.dispose();
}
- catch (Exception e)
+ catch ( Exception e )
{
this.log( "Could not shutdown Plexus!", e );
}
-
+
super.destroy();
}
}
Index: PlexusServlet.java
===================================================================
RCS file: /cvsroot/plexus/plexus-container-new/src/java/org/apache/plexus/servlet/PlexusServlet.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- PlexusServlet.java 29 Mar 2003 03:49:44 -0000 1.1.1.1
+++ PlexusServlet.java 23 Apr 2003 03:57:13 -0000 1.2
@@ -56,16 +56,16 @@
* ----------------------------------------------------------------------------
*/
-import org.apache.plexus.service.ServiceBroker;
+import org.apache.avalon.framework.service.ServiceManager;
import javax.servlet.http.HttpServlet;
public class PlexusServlet extends HttpServlet
{
- public static final String SERVICE_BROKER_KEY = "plexus.service.broker";
+ public static final String SERVICE_MANAGER_KEY = "plexus.service.manager";
- public ServiceBroker getServiceBroker()
+ public ServiceManager getServiceManager()
{
- return (ServiceBroker) getServletContext().getAttribute( SERVICE_BROKER_KEY );
+ return (ServiceManager) getServletContext().getAttribute( SERVICE_MANAGER_KEY );
}
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.