CVS: plexus-container-new/src/java/org/apache/plexus/service/repository ServiceRepositoryFactory.java,NONE,1.1 ServiceRepository.java,1.1.1.1,1.2
[email protected] Sun, 27 Apr 2003 23:35:39 -0500
| Newsgroups | gmane.comp.java.plexus.devel |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/plexus/plexus-container-new/src/java/org/apache/plexus/service/repository
In directory eng.werken.com:/tmp/cvs-serv12233/src/java/org/apache/plexus/service/repository
Modified Files:
ServiceRepository.java
Added Files:
ServiceRepositoryFactory.java
Log Message:
o The factories are now completely responsible for setting up a base entity.
So for each of the factories I've tried to follow the pattern of sending
in the defaultConfiguration, configuration, loggerManager, classLoader and
then any other parameters that the factory requires to setup the base
entity.
--- NEW FILE: ServiceRepositoryFactory.java ---
package org.apache.plexus.service.repository;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.plexus.PlexusContainer;
import org.apache.plexus.logging.LoggerManager;
import org.apache.plexus.factory.AbstractPlexusFactory;
public class ServiceRepositoryFactory
extends AbstractPlexusFactory
{
public static ServiceRepository create( Configuration defaultConfiguration,
Configuration configuration,
LoggerManager loggerManager,
PlexusContainer container,
ClassLoader classLoader )
throws Exception
{
String implementation;
if ( configuration.getChild( "service-repository", false ) != null )
{
implementation =
configuration.getChild( "service-repository" ).getChild( "implementation" ).getValue();
}
else
{
implementation =
defaultConfiguration.getChild( "service-repository" ).getChild( "implementation" ).getValue();
}
ServiceRepository sr =
(ServiceRepository) getInstance( implementation, classLoader );
sr.enableLogging( loggerManager.getLogger( "service-repository" ) );
sr.setPlexusContainer( container );
sr.configure( configuration );
sr.initialize();
return sr;
}
}
Index: ServiceRepository.java
===================================================================
RCS file: /cvsroot/plexus/plexus-container-new/src/java/org/apache/plexus/service/repository/ServiceRepository.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- ServiceRepository.java 29 Mar 2003 03:49:44 -0000 1.1.1.1
+++ ServiceRepository.java 28 Apr 2003 04:35:37 -0000 1.2
@@ -2,6 +2,7 @@
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.logger.Logger;
import org.apache.plexus.PlexusContainer;
public interface ServiceRepository
@@ -37,4 +38,6 @@
int instantiatedServices();
ClassLoader getClassLoader();
+
+ void enableLogging( Logger logger );
}