KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > outerj > daisy > publisher > serverimpl > requestmodel > RootPublisherContext


1 /*
2  * Copyright 2004 Outerthought bvba and Schaubroeck nv
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 package org.outerj.daisy.publisher.serverimpl.requestmodel;
17
18 import org.outerj.daisy.repository.*;
19 import org.outerj.daisy.publisher.serverimpl.PublisherImpl;
20 import org.outerj.daisy.publisher.serverimpl.docpreparation.PreparedDocuments;
21 import org.outerj.daisy.publisher.serverimpl.docpreparation.ContentProcessor;
22 import org.apache.avalon.framework.logger.Logger;
23
24 import java.util.Locale JavaDoc;
25 import java.text.DateFormat JavaDoc;
26
27 public class RootPublisherContext implements PublisherContext {
28     private Repository repository;
29     private PublisherImpl publisher;
30     private Locale JavaDoc locale = Locale.US;
31     private Logger logger;
32     private DateFormat JavaDoc dateFormat;
33     private static final String JavaDoc NO_DOC_AVAILABLE = "A document-related request was used in a context where no document is available.";
34
35     public RootPublisherContext(Repository repository, PublisherImpl publisher, Logger logger) {
36         if (repository == null)
37             throw new IllegalArgumentException JavaDoc("repository argument cannot be null");
38         if (logger == null)
39             throw new IllegalArgumentException JavaDoc("logger argument cannot be null");
40         this.repository = repository;
41         this.logger = logger;
42         this.publisher = publisher;
43         this.dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, locale);
44     }
45
46     public Locale JavaDoc getLocale() {
47         return locale;
48     }
49
50     public Repository getRepository() {
51         return repository;
52     }
53
54     public DateFormat JavaDoc getTimestampFormat() {
55         return dateFormat;
56     }
57
58     public long getDocumentId() {
59         throw new AssertionError JavaDoc(NO_DOC_AVAILABLE);
60     }
61
62     public long getBranchId() {
63         throw new AssertionError JavaDoc(NO_DOC_AVAILABLE);
64     }
65
66     public long getLanguageId() {
67         throw new AssertionError JavaDoc(NO_DOC_AVAILABLE);
68     }
69
70     public VariantKey getVariantKey() {
71         throw new AssertionError JavaDoc(NO_DOC_AVAILABLE);
72     }
73
74     public long getVersionId() {
75         throw new AssertionError JavaDoc(NO_DOC_AVAILABLE);
76     }
77
78     public Document getDocument() {
79         throw new AssertionError JavaDoc(NO_DOC_AVAILABLE);
80     }
81
82     public Version getVersion() throws RepositoryException {
83         throw new AssertionError JavaDoc(NO_DOC_AVAILABLE);
84     }
85
86     public boolean hasDocument() {
87         return false;
88     }
89
90     public PublisherImpl getPublisher() {
91         return publisher;
92     }
93
94     public Logger getLogger() {
95         return logger;
96     }
97
98     public PreparedDocuments getPreparedDocuments() {
99         return null;
100     }
101
102     public ContentProcessor getContentProcessor() {
103         return null;
104     }
105
106     public boolean searchRecursivePrepDocs(long documentId, long branchId, long languageId, String JavaDoc pubReqSetName) {
107         return false;
108     }
109
110     public PublisherVersionMode getVersionMode() {
111         return PublisherVersionMode.LIVE;
112     }
113 }
114
Popular Tags