File Source: JPAWebloggerImpl.java
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. The ASF licenses this file to You
4 * under the Apache License, Version 2.0 (the "License"); you may not
5 * 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. For additional information regarding
15 * copyright in this work, please see the NOTICE file in the top level
16 * directory of this distribution.
17 */
18 package org.apache.roller.weblogger.business.jpa;
19
20 import org.apache.commons.logging.Log;
21 import org.apache.commons.logging.LogFactory;
22 import org.apache.roller.weblogger.WebloggerException;
23 import org.apache.roller.weblogger.business.BookmarkManager;
24 import org.apache.roller.weblogger.business.FileManager;
25 import org.apache.roller.weblogger.business.PropertiesManager;
26 import org.apache.roller.weblogger.business.URLStrategy;
27 import org.apache.roller.weblogger.business.WebloggerImpl;
28 import org.apache.roller.weblogger.business.UserManager;
29 import org.apache.roller.weblogger.business.WeblogManager;
30 import org.apache.roller.weblogger.business.runnable.ThreadManager;
31 import org.apache.roller.weblogger.business.pings.AutoPingManager;
32 import org.apache.roller.weblogger.business.pings.PingQueueManager;
33 import org.apache.roller.weblogger.business.pings.PingTargetManager;
34 import org.apache.roller.weblogger.business.plugins.PluginManager;
35 import org.apache.roller.weblogger.business.referrers.RefererManager;
36 import org.apache.roller.weblogger.business.referrers.ReferrerQueueManager;
37 import org.apache.roller.weblogger.business.search.IndexManager;
38 import org.apache.roller.weblogger.business.themes.ThemeManager;
39
40 /**
41 * A JPA specific implementation of the Weblogger business layer.
42 */
43 @com.google.inject.Singleton
44 public class JPAWebloggerImpl extends WebloggerImpl {
45
46 static final long serialVersionUID = 5256135928578074652L;
47
/*
P/P * Method: org.apache.roller.weblogger.business.jpa.JPAWebloggerImpl__static_init
*
* Postconditions:
* init'ed(logger)
*/
48 private static Log logger = LogFactory.getLog(JPAWebloggerImpl.class);
49
50 // a persistence utility class
51 private final JPAPersistenceStrategy strategy;
52
53
54 /**
55 * Single constructor.
56 * @throws org.apache.roller.weblogger.WebloggerException on any error
57 */
58 @com.google.inject.Inject
59 protected JPAWebloggerImpl(
60 JPAPersistenceStrategy strategy,
61 AutoPingManager autoPingManager,
62 BookmarkManager bookmarkManager,
63 FileManager fileManager,
64 IndexManager indexManager,
65 PingQueueManager pingQueueManager,
66 PingTargetManager pingTargetManager,
67 PluginManager pluginManager,
68 PropertiesManager propertiesManager,
69 RefererManager refererManager,
70 ReferrerQueueManager refererQueueManager,
71 ThemeManager themeManager,
72 ThreadManager threadManager,
73 UserManager userManager,
74 WeblogManager weblogManager,
75 URLStrategy urlStrategy) throws WebloggerException {
76
/*
P/P * Method: void org.apache.roller.weblogger.business.jpa.JPAWebloggerImpl(JPAPersistenceStrategy, AutoPingManager, BookmarkManager, FileManager, IndexManager, PingQueueManager, PingTargetManager, PluginManager, PropertiesManager, RefererManager, ReferrerQueueManager, ThemeManager, ThreadManager, UserManager, WeblogManager, URLStrategy)
*
* Preconditions:
* (soft) org/apache/roller/weblogger/business/WebloggerImpl.log != null
*
* Postconditions:
* this.autoPingManager == autoPingManager
* init'ed(this.autoPingManager)
* this.bookmarkManager == bookmarkManager
* init'ed(this.bookmarkManager)
* init'ed(this.buildTime)
* init'ed(this.buildUser)
* this.fileManager == fileManager
* init'ed(this.fileManager)
* this.indexManager == indexManager
* init'ed(this.indexManager)
* ...
*/
77 super(
78 autoPingManager,
79 bookmarkManager,
80 fileManager,
81 indexManager,
82 pingQueueManager,
83 pingTargetManager,
84 pluginManager,
85 propertiesManager,
86 refererManager,
87 refererQueueManager,
88 themeManager,
89 threadManager,
90 userManager,
91 weblogManager,
92 urlStrategy);
93
94 this.strategy = strategy;
95 }
96
97
98 public void flush() throws WebloggerException {
/*
P/P * Method: void flush()
*
* Preconditions:
* this.strategy != null
* this.strategy.threadLocalEntityManager != null
* (soft) this.strategy.emf != null
*/
99 this.strategy.flush();
100 }
101
102
103 public void release() {
/*
P/P * Method: void release()
*
* Preconditions:
* this.strategy != null
* this.strategy.threadLocalEntityManager != null
* (soft) org/apache/roller/weblogger/business/WebloggerImpl.log != null
* (soft) this.autoPingManager != null
* (soft) this.bookmarkManager != null
* (soft) this.fileManager != null
* (soft) this.pingQueueManager != null
* (soft) this.pingTargetManager != null
* (soft) this.pluginManager != null
* (soft) this.refererManager != null
* ...
*/
104 super.release();
105 // tell JPA to close down
106 this.strategy.release();
107 }
108
109
110 public void shutdown() {
111 // do our own shutdown first
/*
P/P * Method: void shutdown()
*
* Preconditions:
* this.strategy != null
* this.strategy.threadLocalEntityManager != null
* (soft) org/apache/roller/weblogger/business/HitCountQueue.instance != null
* (soft) init'ed(org/apache/roller/weblogger/business/HitCountQueue.instance.worker)
* (soft) org/apache/roller/weblogger/business/HitCountQueue.log != null
* (soft) org/apache/roller/weblogger/business/WebloggerImpl.log != null
* (soft) org/apache/roller/weblogger/business/referrers/ReferrerQueueManagerImpl.mLogger != null
* (soft) org/apache/roller/weblogger/business/search/IndexManagerImpl.mLogger != null
* (soft) this.autoPingManager != null
* (soft) this.bookmarkManager != null
* ...
*/
112 this.release();
113
114 // then let parent do its thing
115 super.shutdown();
116 }
117
118 }
SofCheck Inspector Build Version : 2.18479
| JPAWebloggerImpl.java |
2009-Jan-02 14:25:00 |
| JPAWebloggerImpl.class |
2009-Sep-04 03:12:31 |