cziegeler 2004/05/06 01:24:13
Modified: src/blocks/slide/java/org/apache/cocoon/components/source/impl
SlideSourceFactory.java
Log:
Lazy lookup to avoid duplicate lookup
Revision Changes Path
1.16 +9 -2
cocoon-2.1/src/blocks/slide/java/org/apache/cocoon/components/source/impl/SlideSourceFactory.java
Index: SlideSourceFactory.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/slide/java/org/apache/cocoon/components/source/impl/SlideSourceFactory.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- SlideSourceFactory.java 27 Mar 2004 22:25:10 -0000 1.15
+++ SlideSourceFactory.java 6 May 2004 08:24:13 -0000 1.16
@@ -66,7 +66,6 @@
* @param manager ServiceManager.
*/
public void service(ServiceManager manager) throws ServiceException {
- m_repository = (SlideRepository)
manager.lookup(SlideRepository.ROLE);
m_manager = manager;
}
@@ -82,6 +81,14 @@
public Source getSource(String location, Map parameters)
throws MalformedURLException, IOException, SourceException {
+ if ( m_repository == null ) {
+ try {
+ m_repository = (SlideRepository)
m_manager.lookup(SlideRepository.ROLE);
+ } catch (ServiceException se) {
+ throw new SourceException("Unable to lookup repository.",
se);
+ }
+ }
+
if (getLogger().isDebugEnabled()) {
getLogger().debug("Creating source object for " + location);
}