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: DocumentBuilder.java 507914 2007-02-15 12:15:30Z andreas $ */
20:
21: package org.apache.lenya.cms.publication;
22:
23: /**
24: * A document builder builds a document from a URL.
25: */
26: public interface DocumentBuilder {
27:
28: /**
29: * The Avalon role.
30: */
31: String ROLE = DocumentBuilder.class.getName();
32:
33: /**
34: * Returns a document for a web application URL.
35: * @param factory The factory.
36: * @param webappUrl The web application URL.
37: * @return A document identifier.
38: * @throws DocumentBuildException if an error occurs.
39: */
40: DocumentLocator getLocator(DocumentFactory factory, String webappUrl)
41: throws DocumentBuildException;
42:
43: /**
44: * Checks if an URL corresponds to a CMS document.
45: * @param factory The document factory.
46: * @param url The URL of the form /{publication-id}/...
47: * @return A boolean value.
48: * @throws DocumentBuildException when something went wrong.
49: */
50: boolean isDocument(DocumentFactory factory, String url)
51: throws DocumentBuildException;
52:
53: /**
54: * Builds an URL corresponding to a CMS document.
55: * @param factory The document factory.
56: * @param locator The locator.
57: * @return a String The corresponding URL.
58: */
59: String buildCanonicalUrl(DocumentFactory factory,
60: DocumentLocator locator);
61:
62: /**
63: * Checks if a document name is valid.
64: * @param documentName The document name.
65: * @return A boolean value.
66: */
67: boolean isValidDocumentName(String documentName);
68:
69: }
|