KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > cms > cocoon > components > modules > input > AbstractPageEnvelopeModule


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17
18 /* $Id: AbstractPageEnvelopeModule.java 42598 2004-03-01 16:18:28Z gregor $ */
19
20 package org.apache.lenya.cms.cocoon.components.modules.input;
21
22 import java.util.Map JavaDoc;
23
24 import org.apache.avalon.framework.configuration.ConfigurationException;
25 import org.apache.cocoon.components.modules.input.AbstractInputModule;
26 import org.apache.cocoon.environment.ObjectModelHelper;
27 import org.apache.cocoon.environment.Request;
28 import org.apache.lenya.cms.publication.PageEnvelope;
29 import org.apache.lenya.cms.publication.PageEnvelopeFactory;
30
31 /**
32  * Abstract superclass for classes which need access to the page envelope.
33  */

34 public abstract class AbstractPageEnvelopeModule extends AbstractInputModule {
35
36     /**
37      * Get the the page envelope for the given objectModel.
38      *
39      * @param objectModel the objectModel for which the page enevelope is requested.
40      *
41      * @return a <code>PageEnvelope</code>
42      *
43      * @throws ConfigurationException if the page envelope could not be instantiated.
44      */

45     protected PageEnvelope getEnvelope(Map JavaDoc objectModel) throws ConfigurationException {
46         
47         PageEnvelope envelope = null;
48
49         if (getLogger().isDebugEnabled()) {
50             Request request = ObjectModelHelper.getRequest(objectModel);
51             getLogger().debug("Resolving page envelope for URL [" + request.getRequestURI() + "]");
52         }
53
54         try {
55             envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
56         } catch (Exception JavaDoc e) {
57             throw new ConfigurationException("Resolving page envelope failed: ", e);
58         }
59
60         return envelope;
61     }
62
63 }
64
Popular Tags