File Source: PlanetUIAction.java
1 /*
2 * Copyright 2005 Sun Microsystems, Inc.
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 package org.apache.roller.weblogger.planet.ui;
18
19 import org.apache.commons.logging.Log;
20 import org.apache.commons.logging.LogFactory;
21 import org.apache.roller.planet.business.PlanetFactory;
22 import org.apache.roller.planet.business.PlanetManager;
23 import org.apache.roller.planet.pojos.Planet;
24 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
25
26
27 /**
28 * An extension of the UIAction class specific to the Planet actions.
29 */
/*
P/P * Method: void org.apache.roller.weblogger.planet.ui.PlanetUIAction()
*
* Postconditions:
* this.planet == null
*/
30 public abstract class PlanetUIAction extends UIAction {
31
/*
P/P * Method: org.apache.roller.weblogger.planet.ui.PlanetUIAction__static_init
*
* Postconditions:
* init'ed(log)
*/
32 private static Log log = LogFactory.getLog(PlanetUIAction.class);
33
34 public static final String DEFAULT_PLANET_HANDLE = "default";
35
36 // the planet used by all Planet actions
37 private Planet planet = null;
38
39
40 public Planet getPlanet() {
/*
P/P * Method: Planet getPlanet()
*
* Preconditions:
* init'ed(this.planet)
* (soft) log != null
*
* Presumptions:
* org.apache.roller.planet.business.Planet:getPlanetManager(...)@43 != null
* org.apache.roller.planet.business.PlanetFactory:getPlanet(...)@43 != null
*
* Postconditions:
* init'ed(return_value)
* this.planet == return_value
*
* Test Vectors:
* this.planet: Inverse{null}, Addr_Set{null}
*/
41 if(planet == null) {
42 try {
43 PlanetManager pmgr = PlanetFactory.getPlanet().getPlanetManager();
44 planet = pmgr.getPlanet(DEFAULT_PLANET_HANDLE);
45 } catch(Exception ex) {
46 log.error("Error loading weblogger planet - "+DEFAULT_PLANET_HANDLE, ex);
47 }
48 }
49 return planet;
50 }
51
52 }
SofCheck Inspector Build Version : 2.18479
| PlanetUIAction.java |
2009-Jan-02 14:24:46 |
| PlanetUIAction.class |
2009-Sep-04 03:12:46 |