cziegeler    2004/02/24 01:48:52

  Modified:    src/java/org/apache/cocoon/components/container
                        ComponentContext.java
               src/java/org/apache/cocoon/components ContextHelper.java
  Log:
  Making sitemap service manager available through the context
  
  Revision  Changes    Path
  1.5       +11 -4     
cocoon-2.2/src/java/org/apache/cocoon/components/container/ComponentContext.java
  
  Index: ComponentContext.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/container/ComponentContext.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ComponentContext.java     20 Feb 2004 20:34:37 -0000      1.4
  +++ ComponentContext.java     24 Feb 2004 09:48:52 -0000      1.5
  @@ -62,8 +62,9 @@
   /**
    * This is the [EMAIL PROTECTED] Context} implementation for Cocoon 
components.
    * It extends the [EMAIL PROTECTED] DefaultContext} by a special handling for
  - * getting objects from the object model.
  - *
  + * getting objects from the object model and other application information.
  + * 
  + * @see org.apache.cocoon.components.ContextHelper
    * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
    * @version CVS $Id$
    */
  @@ -118,12 +119,18 @@
        */
       public Object get( final Object key )
       throws ContextException {
  -        if ( key.equals(ContextHelper.CONTEXT_OBJECT_MODEL)) {
  +        if ( ContextHelper.CONTEXT_OBJECT_MODEL.equals(key)) {
               final Environment env = 
EnvironmentHelper.getCurrentEnvironment();
               if ( env == null ) {
                   throw new ContextException("Unable to locate " + key + " (No 
environment available)");
               }
               return env.getObjectModel();
  +        } else if ( 
ContextHelper.CONTEXT_SITEMAP_SERVICE_MANAGER.equals(key)) {
  +            final Object manager = 
EnvironmentHelper.getSitemapServiceManager();
  +            if ( manager == null ) {
  +                throw new ContextException("Unable to locate " + key + " (No 
environment available)");
  +            }
  +            return manager;
           }
           if ( key instanceof String ) {
               String stringKey = (String)key;
  
  
  
  1.8       +4 -1      
cocoon-2.2/src/java/org/apache/cocoon/components/ContextHelper.java
  
  Index: ContextHelper.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/ContextHelper.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ContextHelper.java        22 Oct 2003 15:37:50 -0000      1.7
  +++ ContextHelper.java        24 Feb 2004 09:48:52 -0000      1.8
  @@ -78,6 +78,9 @@
       /** Application <code>Context</code> Key for the current response object 
*/
       public static final String CONTEXT_RESPONSE_OBJECT = 
CONTEXT_OBJECT_MODEL + '.' + ObjectModelHelper.RESPONSE_OBJECT;
   
  +    /** Application <code>Context</code> Key for the current sitemap service 
manager */
  +    public static final String CONTEXT_SITEMAP_SERVICE_MANAGER = 
"sitemap-service-manager";
  +    
       private ContextHelper() {
           // Forbid instantiation
       }
  
  
  

Reply via email to