01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18:
19: /* $Id: TestPageEnvelope.java 507914 2007-02-15 12:15:30Z andreas $ */
20:
21: package org.apache.lenya.cms.publication;
22:
23: import org.apache.avalon.framework.logger.Logger;
24: import org.apache.avalon.framework.service.ServiceManager;
25: import org.apache.lenya.cms.repository.RepositoryUtil;
26: import org.apache.lenya.cms.repository.Session;
27:
28: /**
29: * To change the template for this generated type comment go to Window>Preferences>Java>Code
30: * Generation>Code and Comments
31: */
32: public class TestPageEnvelope extends PageEnvelope {
33: /**
34: * Constructs a test page envelope.
35: * @param publication The publication.
36: * @param url The document url (starting with a slash).
37: * @throws PageEnvelopeException when something goes wrong.
38: */
39: public TestPageEnvelope(Publication publication, String url,
40: ServiceManager manager, Logger logger)
41: throws PageEnvelopeException {
42: super ();
43: setContext("");
44:
45: try {
46: Session session = RepositoryUtil.createSession(manager,
47: null, false);
48: DocumentFactory map = DocumentUtil.createDocumentFactory(
49: manager, session);
50: setDocument(map.getFromURL(url));
51: } catch (Exception e) {
52: throw new PageEnvelopeException(e);
53: }
54: }
55: }
|