You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2007/04/05 20:52:43 UTC
svn commit: r525928 - in /incubator/roller/trunk/src/org/apache/roller:
business/ business/hibernate/ business/utils/ ui/core/util/ util/
Author: agilliland
Date: Thu Apr 5 11:52:41 2007
New Revision: 525928
URL: http://svn.apache.org/viewvc?view=rev&rev=525928
Log:
deleting some old and unused code.
Removed:
incubator/roller/trunk/src/org/apache/roller/business/ConfigManager.java
incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateConfigManagerImpl.java
incubator/roller/trunk/src/org/apache/roller/business/utils/ConsistencyCheck.java
incubator/roller/trunk/src/org/apache/roller/ui/core/util/CacheHttpServletResponseWrapper.java
incubator/roller/trunk/src/org/apache/roller/ui/core/util/RequestUtil.java
incubator/roller/trunk/src/org/apache/roller/util/OldRollerConfig.java
Modified:
incubator/roller/trunk/src/org/apache/roller/business/Roller.java
incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernatePropertiesManagerImpl.java
incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java
incubator/roller/trunk/src/org/apache/roller/business/utils/PasswordUtility.java
Modified: incubator/roller/trunk/src/org/apache/roller/business/Roller.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/Roller.java?view=diff&rev=525928&r1=525927&r2=525928
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/Roller.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/Roller.java Thu Apr 5 11:52:41 2007
@@ -67,12 +67,6 @@
public ReferrerQueueManager getReferrerQueueManager();
- /**
- * Get RefererManager associated with this Roller instance.
- */
- public ConfigManager getConfigManager();
-
-
/**
* Get the AutoPingManager associated with this Roller instance.
*/
Modified: incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernatePropertiesManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernatePropertiesManagerImpl.java?view=diff&rev=525928&r1=525927&r2=525928
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernatePropertiesManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernatePropertiesManagerImpl.java Thu Apr 5 11:52:41 2007
@@ -1,24 +1,19 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. The ASF licenses this file to You
-* under the Apache License, Version 2.0 (the "License"); you may not
-* use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License. For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
-/*
- * HibernatePropertiesManagerImpl.java
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * Created on April 21, 2005, 10:40 AM
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
*/
package org.apache.roller.business.hibernate;
@@ -50,7 +45,7 @@
*/
public class HibernatePropertiesManagerImpl implements PropertiesManager {
- static final long serialVersionUID = -4326713177137796936L;
+ public static final long serialVersionUID = -4326713177137796936L;
private static Log log = LogFactory.getLog(HibernatePropertiesManagerImpl.class);
@@ -146,14 +141,8 @@
try {
props = this.getProperties();
- if(props.size() < 1) {
- // empty props table ... try migrating, then load defaults
- props = migrateOldRollerConfig(props);
- props = initializeMissingProps(props);
- } else {
- // found existing props ... check for new props
- props = initializeMissingProps(props);
- }
+ // check for new props
+ props = initializeMissingProps(props);
// save our changes
this.saveProperties(props);
@@ -163,80 +152,6 @@
throw new RuntimeException(e);
}
- }
-
-
- /**
- * Migrate data from the old roller config.
- * This is called only if the existing runtime properties are empty.
- */
- private Map migrateOldRollerConfig(Map props) {
- // try to get the old config
- Roller roller = RollerFactory.getRoller();
- RollerConfigData rollerConfig = null;
-
- try {
- rollerConfig = roller.getConfigManager().getRollerConfig();
- } catch (Exception e) {
- // We currently treat any exception obtaining the roller config
- // as if we had not found it.
- log.error(e);
- }
-
- if (rollerConfig != null) {
- log.info("Found old roller config ... doing migration to new runtime properties.");
- // copy over data
- props.put("site.name",
- new RollerPropertyData("site.name", rollerConfig.getSiteName()));
- props.put("site.description",
- new RollerPropertyData("site.description", rollerConfig.getSiteDescription()));
- props.put("site.adminemail",
- new RollerPropertyData("site.adminemail", rollerConfig.getEmailAddress()));
- props.put("site.absoluteurl",
- new RollerPropertyData("site.absoluteurl", rollerConfig.getAbsoluteURL()));
- props.put("site.linkbacks.enabled",
- new RollerPropertyData("site.linkbacks.enabled", rollerConfig.getEnableLinkback().toString()));
- props.put("users.registration.enabled",
- new RollerPropertyData("users.registration.enabled", rollerConfig.getNewUserAllowed().toString()));
- props.put("users.themes.path",
- new RollerPropertyData("users.themes.path", rollerConfig.getUserThemes()));
- props.put("users.editor.pages",
- new RollerPropertyData("users.editor.pages", rollerConfig.getEditorPages()));
- props.put("users.comments.enabled",
- new RollerPropertyData("users.comments.enabled", "true"));
- props.put("users.comments.autoformat",
- new RollerPropertyData("users.comments.autoformat", rollerConfig.getAutoformatComments().toString()));
- props.put("users.comments.escapehtml",
- new RollerPropertyData("users.comments.escapehtml", rollerConfig.getEscapeCommentHtml().toString()));
- props.put("users.comments.emailnotify",
- new RollerPropertyData("users.comments.emailnotify", rollerConfig.getEmailComments().toString()));
- props.put("uploads.enabled",
- new RollerPropertyData("uploads.enabled", rollerConfig.getUploadEnabled().toString()));
- props.put("uploads.types.allowed",
- new RollerPropertyData("uploads.types.allowed", rollerConfig.getUploadAllow()));
- props.put("uploads.types.forbid",
- new RollerPropertyData("uploads.types.forbid", rollerConfig.getUploadForbid()));
- props.put("uploads.file.maxsize",
- new RollerPropertyData("uploads.file.maxsize", rollerConfig.getUploadMaxFileMB().toString()));
- props.put("uploads.dir.maxsize",
- new RollerPropertyData("uploads.dir.maxsize", rollerConfig.getUploadMaxDirMB().toString()));
- /* no longer part of runtime config
- props.put("aggregator.enabled",
- new RollerPropertyData("aggregator.enabled", rollerConfig.getEnableAggregator().toString()));
- props.put("aggregator.cache.enabled",
- new RollerPropertyData("aggregator.cache.enabled", rollerConfig.getRssUseCache().toString()));
- props.put("aggregator.cache.timeout",
- new RollerPropertyData("aggregator.cache.timeout", rollerConfig.getRssCacheTime().toString()));
- props.put("debug.memory.enabled",
- new RollerPropertyData("debug.memory.enabled", rollerConfig.getMemDebug().toString()));
- */
- props.put("spam.blacklist",
- new RollerPropertyData("spam.blacklist", rollerConfig.getRefererSpamWords()));
- } else {
- log.info("Old roller config not found ... default values will be loaded");
- }
-
- return props;
}
Modified: incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java?view=diff&rev=525928&r1=525927&r2=525928
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java Thu Apr 5 11:52:41 2007
@@ -25,7 +25,6 @@
import org.apache.roller.business.RollerImpl;
import org.apache.roller.config.RollerConfig;
import org.apache.roller.business.BookmarkManager;
-import org.apache.roller.business.ConfigManager;
import org.apache.roller.business.pings.AutoPingManager;
import org.apache.roller.business.pings.PingQueueManager;
import org.apache.roller.business.pings.PingTargetManager;
@@ -54,7 +53,6 @@
// references to the managers we maintain
private BookmarkManager bookmarkManager = null;
- private ConfigManager configManager = null;
private PropertiesManager propertiesManager = null;
private RefererManager refererManager = null;
private UserManager userManager = null;
@@ -112,7 +110,6 @@
// release our own stuff first
if (bookmarkManager != null) bookmarkManager.release();
- if (configManager != null) configManager.release();
if (refererManager != null) refererManager.release();
if (userManager != null) userManager.release();
if (weblogManager != null) weblogManager.release();
@@ -180,17 +177,6 @@
refererManager = new HibernateRefererManagerImpl(strategy);
}
return refererManager;
- }
-
-
- /**
- * @see org.apache.roller.model.Roller#getConfigManager()
- */
- public ConfigManager getConfigManager() {
- if (configManager == null) {
- configManager = new HibernateConfigManagerImpl(strategy);
- }
- return configManager;
}
Modified: incubator/roller/trunk/src/org/apache/roller/business/utils/PasswordUtility.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/utils/PasswordUtility.java?view=diff&rev=525928&r1=525927&r2=525928
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/utils/PasswordUtility.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/utils/PasswordUtility.java Thu Apr 5 11:52:41 2007
@@ -60,7 +60,7 @@
String algorithm = props.getProperty("algorithm");
- Connection con = ConsistencyCheck.createConnection(props,"");
+ Connection con = createConnection(props,"");
if (args.length == 2 && args[0].equals("-save"))
{
@@ -108,6 +108,38 @@
System.out.println(" rollerpw -revoke_admin <username>");
System.out.println("");
}
+ }
+
+ /**
+ * Create connection based on properties:<br/>
+ * - driverClassName<br/>
+ * - connectionUrl<br/>
+ * - userName<br/>
+ * - password<br/>
+ */
+ public static Connection createConnection(Properties props, String prefix)
+ throws Exception
+ {
+ Connection con = null;
+ if (prefix == null)
+ {
+ prefix = "";
+ }
+ String driverClassName = props.getProperty(prefix+"driverClassName");
+ String connectionUrl = props.getProperty(prefix+"connectionUrl");
+ String userName = props.getProperty(prefix+"userName");
+ String password = props.getProperty(prefix+"password");
+
+ Class.forName(driverClassName);
+ if (userName != null && password != null)
+ {
+ con = DriverManager.getConnection(connectionUrl, userName, password);
+ }
+ else
+ {
+ con = DriverManager.getConnection(connectionUrl);
+ }
+ return con;
}
/**