File Source: Setup.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
19 package org.apache.roller.weblogger.ui.struts2.core;
20
21 import org.apache.commons.logging.Log;
22 import org.apache.commons.logging.LogFactory;
23 import org.apache.roller.weblogger.WebloggerException;
24 import org.apache.roller.weblogger.business.WebloggerFactory;
25 import org.apache.roller.weblogger.business.UserManager;
26 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
27
28
29 /**
30 * Page used to display Roller isntall instructions.
31 */
32 public class Setup extends UIAction {
33
/*
P/P * Method: org.apache.roller.weblogger.ui.struts2.core.Setup__static_init
*
* Postconditions:
* init'ed(log)
*/
34 private static final Log log = LogFactory.getLog(Setup.class);
35
36 private long userCount = 0;
37 private long blogCount = 0;
38
39
/*
P/P * Method: void org.apache.roller.weblogger.ui.struts2.core.Setup()
*
* Postconditions:
* this.blogCount == 0
* this.userCount == 0
* this.pageTitle == &"index.heading"
*/
40 public Setup() {
41 // TODO: i18n
42 this.pageTitle = "index.heading";
43 }
44
45
46 @Override
47 public boolean isUserRequired() {
/*
P/P * Method: bool isUserRequired()
*
* Postconditions:
* return_value == 0
*/
48 return false;
49 }
50
51 @Override
52 public boolean isWeblogRequired() {
/*
P/P * Method: bool isWeblogRequired()
*
* Postconditions:
* return_value == 0
*/
53 return false;
54 }
55
56
57 public String execute() {
58
59 try {
/*
P/P * Method: String execute()
*
* Presumptions:
* org.apache.commons.logging.LogFactory:getLog(...)@34 != null
* org.apache.roller.weblogger.business.Weblogger:getUserManager(...)@60 != null
* org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger(...)@60 != null
*
* Postconditions:
* return_value == &"success"
* possibly_updated(this.blogCount)
* possibly_updated(this.userCount)
*/
60 UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();
61 setUserCount(umgr.getUserCount());
62 setBlogCount(umgr.getWeblogCount());
63 } catch (WebloggerException ex) {
64 log.error("Error getting user/weblog counts", ex);
65 }
66
67 return SUCCESS;
68 }
69
70
71 public long getUserCount() {
/*
P/P * Method: long getUserCount()
*
* Preconditions:
* init'ed(this.userCount)
*
* Postconditions:
* return_value == this.userCount
* init'ed(return_value)
*/
72 return userCount;
73 }
74
75 public void setUserCount(long userCount) {
/*
P/P * Method: void setUserCount(long)
*
* Postconditions:
* this.userCount == userCount
* init'ed(this.userCount)
*/
76 this.userCount = userCount;
77 }
78
79 public long getBlogCount() {
/*
P/P * Method: long getBlogCount()
*
* Preconditions:
* init'ed(this.blogCount)
*
* Postconditions:
* return_value == this.blogCount
* init'ed(return_value)
*/
80 return blogCount;
81 }
82
83 public void setBlogCount(long blogCount) {
/*
P/P * Method: void setBlogCount(long)
*
* Postconditions:
* this.blogCount == blogCount
* init'ed(this.blogCount)
*/
84 this.blogCount = blogCount;
85 }
86
87 }
SofCheck Inspector Build Version : 2.18479
| Setup.java |
2009-Jan-02 14:25:22 |
| Setup.class |
2009-Sep-04 03:12:45 |