You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2007/04/08 00:09:52 UTC
svn commit: r526492 [2/4] - in
/incubator/roller/branches/roller_4.0_newbackend: ./ apps/planet/
apps/planet/src/java/org/apache/roller/planet/business/
apps/planet/src/java/org/apache/roller/planet/business/datamapper/
apps/planet/src/java/org/apache/...
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/FileManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/FileManagerImpl.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/FileManagerImpl.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/FileManagerImpl.java Sat Apr 7 15:09:45 2007
@@ -31,11 +31,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.roller.config.RollerConfig;
import org.apache.roller.config.RollerRuntimeConfig;
-import org.apache.roller.business.FileIOException;
-import org.apache.roller.business.FilePathException;
-import org.apache.roller.business.FileManager;
-import org.apache.roller.business.FileNotFoundException;
-import org.apache.roller.pojos.WeblogResource;
+import org.apache.roller.pojos.ThemeResource;
import org.apache.roller.pojos.WebsiteData;
import org.apache.roller.util.RollerMessages;
import org.apache.roller.util.URLUtilities;
@@ -74,7 +70,7 @@
/**
* @see org.apache.roller.model.FileManager#getFile(weblog, java.lang.String)
*/
- public WeblogResource getFile(WebsiteData weblog, String path)
+ public ThemeResource getFile(WebsiteData weblog, String path)
throws FileNotFoundException, FilePathException {
// get a reference to the file, checks that file exists & is readable
@@ -94,7 +90,7 @@
/**
* @see org.apache.roller.model.FileManager#getFiles(weblog, java.lang.String)
*/
- public WeblogResource[] getFiles(WebsiteData weblog, String path)
+ public ThemeResource[] getFiles(WebsiteData weblog, String path)
throws FileNotFoundException, FilePathException {
// get a reference to the dir, checks that dir exists & is readable
@@ -107,7 +103,7 @@
}
// everything looks good, list contents
- WeblogResource dir = new WeblogResourceFile(weblog, path, dirFile);
+ ThemeResource dir = new WeblogResourceFile(weblog, path, dirFile);
return dir.getChildren();
}
@@ -116,7 +112,7 @@
/**
* @see org.apache.roller.model.FileManager#getDirectories(weblog)
*/
- public WeblogResource[] getDirectories(WebsiteData weblog)
+ public ThemeResource[] getDirectories(WebsiteData weblog)
throws FileNotFoundException, FilePathException {
// get a reference to the root dir, checks that dir exists & is readable
@@ -129,8 +125,8 @@
}
});
- // convert 'em to WeblogResource objects
- WeblogResource[] resources = new WeblogResource[dirFiles.length];
+ // convert 'em to ThemeResource objects
+ ThemeResource[] resources = new ThemeResource[dirFiles.length];
for(int i=0; i < dirFiles.length; i++) {
String filePath = dirFiles[i].getName();
resources[i] = new WeblogResourceFile(weblog, filePath, dirFiles[i]);
@@ -141,7 +137,7 @@
/**
- * @see org.apache.roller.model.FileManager#saveFile(weblog, java.lang.String, java.lang.String, long, java.io.InputStream)
+ * @see org.apache.roller.model.FileManager#saveFile(weblog, java.lang.String, java.lang.String, long, java.io.InputStream)
*/
public void saveFile(WebsiteData weblog,
String path,
@@ -163,6 +159,19 @@
// make sure uploads area exists for this weblog
File dirPath = this.getRealFile(weblog, null);
+
+ // if we are saving into a subfolder, make sure it exists
+ if(path.indexOf("/") != -1) {
+ String subDir = path.substring(0, path.indexOf("/"));
+ File subDirFile = new File(dirPath.getAbsolutePath() + File.separator + subDir);
+ if(!subDirFile.exists()) {
+ // directory doesn't exist yet, create it
+ log.debug("Creating directory ["+subDir+"] automatically");
+ subDirFile.mkdir();
+ }
+ }
+
+ // create File that we are about to save
File saveFile = new File(dirPath.getAbsolutePath() + File.separator + savePath);
byte[] buffer = new byte[8192];
@@ -336,20 +345,12 @@
// fifth check, is save path viable?
if(path.indexOf("/") != -1) {
- // see if directory path exists already
- String dirPath = path.substring(0, path.lastIndexOf("/"));
-
- try {
- File parent = this.getRealFile(weblog, dirPath);
- if(parent == null || !parent.exists()) {
- messages.addError("error.upload.badPath");
- }
- } catch (Exception ex) {
- // this is okay, just means that parent dir doesn't exist
+ // just make sure there is only 1 directory, we don't allow multi
+ // level directory hierarchies right now
+ if(path.lastIndexOf("/") != path.indexOf("/")) {
messages.addError("error.upload.badPath");
return false;
}
-
}
return true;
@@ -546,16 +547,16 @@
/**
- * A FileManagerImpl specific implementation of a WeblogResource.
+ * A FileManagerImpl specific implementation of a ThemeResource.
*
- * WeblogResources from the FileManagerImpl are backed by a java.io.File
+ * ThemeResources from the FileManagerImpl are backed by a java.io.File
* object which represents the resource on a filesystem.
*
* This class is internal to the FileManagerImpl class because there should
* not be any external classes which need to construct their own instances
* of this class.
*/
- class WeblogResourceFile implements WeblogResource {
+ class WeblogResourceFile implements ThemeResource {
// the physical java.io.File backing this resource
private File resourceFile = null;
@@ -577,11 +578,7 @@
return weblog;
}
- public String getURL(boolean absolute) {
- return URLUtilities.getWeblogResourceURL(weblog, relativePath, absolute);
- }
-
- public WeblogResource[] getChildren() {
+ public ThemeResource[] getChildren() {
if(!resourceFile.isDirectory()) {
return null;
@@ -594,8 +591,8 @@
}
});
- // convert Files into WeblogResources
- WeblogResource[] resources = new WeblogResource[dirFiles.length];
+ // convert Files into ThemeResources
+ ThemeResource[] resources = new ThemeResource[dirFiles.length];
for(int i=0; i < dirFiles.length; i++) {
String filePath = dirFiles[i].getName();
if(relativePath != null && !relativePath.trim().equals("")) {
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/Roller.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/Roller.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/Roller.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/Roller.java Sat Apr 7 15:09:45 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/branches/roller_4.0_newbackend/src/org/apache/roller/business/datamapper/DatamapperPropertiesManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/datamapper/DatamapperPropertiesManagerImpl.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/datamapper/DatamapperPropertiesManagerImpl.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/datamapper/DatamapperPropertiesManagerImpl.java Sat Apr 7 15:09:45 2007
@@ -132,8 +132,7 @@
props = this.getProperties();
if(props.size() < 1) {
- // empty props table ... try migrating, then load defaults
- props = migrateOldRollerConfig(props);
+ // empty props table ... load defaults
props = initializeMissingProps(props);
} else {
// found existing props ... check for new props
@@ -149,104 +148,6 @@
}
}
-
-
- /**
- * 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;
- }
-
/**
* This method compares the property definitions in the RuntimeConfigDefs
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/datamapper/DatamapperRollerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/datamapper/DatamapperRollerImpl.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/datamapper/DatamapperRollerImpl.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/datamapper/DatamapperRollerImpl.java Sat Apr 7 15:09:45 2007
@@ -22,7 +22,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.roller.RollerException;
import org.apache.roller.business.BookmarkManager;
-import org.apache.roller.business.ConfigManager;
import org.apache.roller.business.PropertiesManager;
import org.apache.roller.business.RollerImpl;
import org.apache.roller.business.UserManager;
@@ -224,14 +223,4 @@
protected abstract ThreadManager createDatamapperThreadManager(
DatamapperPersistenceStrategy strategy);
- /**
- * This method is deprecated.
- * @return null
- * @see org.apache.roller.business.Roller#getConfigManager()
- * @deprecated see JIRA issue ROL-1151
- */
- public ConfigManager getConfigManager() {
- throw new RuntimeException("Deprecated method getConfigManager.");
- }
-
}
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/hibernate/HibernatePropertiesManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/hibernate/HibernatePropertiesManagerImpl.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/hibernate/HibernatePropertiesManagerImpl.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/hibernate/HibernatePropertiesManagerImpl.java Sat Apr 7 15:09:45 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/branches/roller_4.0_newbackend/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java Sat Apr 7 15:09:45 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/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPAPropertiesManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPAPropertiesManagerImpl.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPAPropertiesManagerImpl.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPAPropertiesManagerImpl.java Sat Apr 7 15:09:45 2007
@@ -133,8 +133,7 @@
props = this.getProperties();
if(props.size() < 1) {
- // empty props table ... try migrating, then load defaults
- props = migrateOldRollerConfig(props);
+ // empty props table ... load defaults
props = initializeMissingProps(props);
} else {
// found existing props ... check for new props
@@ -150,104 +149,6 @@
}
}
-
-
- /**
- * 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;
- }
-
/**
* This method compares the property definitions in the RuntimeConfigDefs
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPARollerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPARollerImpl.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPARollerImpl.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/jpa/JPARollerImpl.java Sat Apr 7 15:09:45 2007
@@ -29,7 +29,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.roller.RollerException;
import org.apache.roller.business.BookmarkManager;
-import org.apache.roller.business.ConfigManager;
import org.apache.roller.business.PropertiesManager;
import org.apache.roller.business.Roller;
import org.apache.roller.business.RollerImpl;
@@ -298,17 +297,6 @@
}
return threadManager;
}
-
- /**
- * This method is deprecated.
- * @return null
- * @see org.apache.roller.business.Roller#getConfigManager()
- * @deprecated see JIRA issue ROL-1151
- */
- public ConfigManager getConfigManager() {
- throw new RuntimeException("Deprecated method getConfigManager.");
- }
-
/**
* Loads properties from given resourceName using given class loader
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/pings/WeblogUpdatePinger.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/pings/WeblogUpdatePinger.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/pings/WeblogUpdatePinger.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/pings/WeblogUpdatePinger.java Sat Apr 7 15:09:45 2007
@@ -18,18 +18,23 @@
package org.apache.roller.business.pings;
-import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.roller.config.PingConfig;
import org.apache.roller.pojos.PingTargetData;
import org.apache.roller.pojos.WebsiteData;
-import org.apache.xmlrpc.XmlRpcClient;
import org.apache.xmlrpc.XmlRpcException;
+import org.apache.xmlrpc.client.XmlRpcClient;
+import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import java.io.IOException;
import java.net.MalformedURLException;
+import java.net.URL;
import java.net.UnknownHostException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Set;
+import org.apache.commons.logging.Log;
/**
* Utility for sending a weblog update ping.
@@ -98,19 +103,22 @@
Set variantOptions = PingConfig.getVariantOptions(pingTargetUrl);
// Set up the ping parameters.
- Vector params = new Vector();
+ List params = new ArrayList();
if (!variantOptions.contains("noname")) {
// ping variant for icerocket and anyone with similar bug, where we must omit the blog name.
- params.addElement(website.getName());
+ params.add(website.getName());
}
- params.addElement(websiteUrl);
+ params.add(websiteUrl);
if (logger.isDebugEnabled()) {
logger.debug("Executing ping to '" + pingTargetUrl + "' for website '" + websiteUrl + "' (" + website.getName() + ")" + (variantOptions.isEmpty() ? "" : " with variant options " + variantOptions));
}
- // Send the ping.
- XmlRpcClient client = new XmlRpcClient(pingTargetUrl);
- PingResult pingResult = parseResult(client.execute("weblogUpdates.ping", params));
+ // Send the ping.
+ XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
+ config.setServerURL(new URL(pingTargetUrl));
+ XmlRpcClient client = new XmlRpcClient();
+ client.setConfig(config);
+ PingResult pingResult = parseResult(client.execute("weblogUpdates.ping", params.toArray()));
if (logger.isDebugEnabled()) logger.debug("Ping result is: " + pingResult);
return pingResult;
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/themes/ThemeManager.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/themes/ThemeManager.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/themes/ThemeManager.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/themes/ThemeManager.java Sat Apr 7 15:09:45 2007
@@ -21,6 +21,7 @@
import java.util.List;
import org.apache.roller.RollerException;
import org.apache.roller.pojos.Theme;
+import org.apache.roller.pojos.WeblogTheme;
import org.apache.roller.pojos.WebsiteData;
@@ -36,11 +37,22 @@
* @throws ThemeNotFoundException If the named theme cannot be found.
* @throws RollerException If there is some kind of fatal backend error.
**/
- public Theme getTheme(String id)
+ public SharedTheme getTheme(String id)
throws ThemeNotFoundException, RollerException;
/**
+ * Get the WeblogTheme for a given weblog.
+ *
+ * @param weblog The weblog to get the theme for.
+ * @return WeblogTheme The theme to be used for the given weblog.
+ * @throws RollerException If there is some kind of fatal backend error.
+ */
+ public WeblogTheme getTheme(WebsiteData weblog)
+ throws RollerException;
+
+
+ /**
* Get a list of all theme names that are currently enabled.
* This list is ordered alphabetically by default.
*
@@ -57,7 +69,7 @@
*
* @throws RollerException If there is some kind of error in saving.
*/
- public void importTheme(WebsiteData website, Theme theme)
+ public void importTheme(WebsiteData website, SharedTheme theme)
throws RollerException;
}
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/themes/ThemeManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/themes/ThemeManagerImpl.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/themes/ThemeManagerImpl.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/themes/ThemeManagerImpl.java Sat Apr 7 15:09:45 2007
@@ -21,8 +21,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FilenameFilter;
-import java.io.InputStream;
-import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
@@ -40,8 +38,10 @@
import org.apache.roller.business.UserManager;
import org.apache.roller.config.RollerConfig;
import org.apache.roller.pojos.Theme;
+import org.apache.roller.pojos.ThemeResource;
import org.apache.roller.pojos.ThemeTemplate;
import org.apache.roller.pojos.WeblogTemplate;
+import org.apache.roller.pojos.WeblogTheme;
import org.apache.roller.pojos.WebsiteData;
@@ -96,11 +96,11 @@
/**
* @see org.apache.roller.model.ThemeManager#getTheme(java.lang.String)
*/
- public Theme getTheme(String id)
+ public SharedTheme getTheme(String id)
throws ThemeNotFoundException, RollerException {
// try to lookup theme from library
- Theme theme = (Theme) this.themes.get(id);
+ SharedTheme theme = (SharedTheme) this.themes.get(id);
// no theme? throw exception.
if(theme == null) {
@@ -112,6 +112,38 @@
/**
+ * @see org.apache.roller.model.ThemeManager#getTheme(weblog)
+ */
+ public WeblogTheme getTheme(WebsiteData weblog) throws RollerException {
+
+ if(weblog == null)
+ return null;
+
+ WeblogTheme weblogTheme = null;
+
+ // if theme is custom or null then return a WeblogCustomTheme
+ if(weblog.getEditorTheme() == null ||
+ WeblogTheme.CUSTOM.equals(weblog.getEditorTheme())) {
+ weblogTheme = new WeblogCustomTheme(weblog);
+
+ // otherwise we are returning a WeblogSharedTheme
+ } else {
+ ThemeManager themeMgr = RollerFactory.getRoller().getThemeManager();
+ SharedTheme staticTheme =
+ (SharedTheme) this.themes.get(weblog.getEditorTheme());
+ if(staticTheme != null) {
+ weblogTheme = new WeblogSharedTheme(weblog, staticTheme);
+ }
+ }
+
+ // TODO: if somehow the theme is still null should we provide some
+ // kind of fallback option like a default theme?
+
+ return weblogTheme;
+ }
+
+
+ /**
* @see org.apache.roller.model.ThemeManager#getEnabledThemesList()
*
* TODO: reimplement enabled vs. disabled logic once we support it
@@ -130,10 +162,10 @@
/**
* @see org.apache.roller.model.ThemeManager#importTheme(website, theme)
*/
- public void importTheme(WebsiteData website, Theme theme)
+ public void importTheme(WebsiteData website, SharedTheme theme)
throws RollerException {
- log.debug("Importing theme "+theme.getName()+" to weblog "+website.getName());
+ log.debug("Importing theme ["+theme.getName()+"] to weblog ["+website.getName()+"]");
try {
UserManager userMgr = RollerFactory.getRoller().getUserManager();
@@ -202,7 +234,7 @@
// always update this weblog's theme and customStylesheet, then save
- website.setEditorTheme(Theme.CUSTOM);
+ website.setEditorTheme(WeblogTheme.CUSTOM);
website.setCustomStylesheetPath(theme.getCustomStylesheet());
userMgr.saveWebsite(website);
@@ -212,26 +244,18 @@
List resources = theme.getResources();
Iterator iterat = resources.iterator();
- File resourceFile = null;
+ ThemeResource resource = null;
while ( iterat.hasNext() ) {
- resourceFile = (File) iterat.next();
-
- String path = resourceFile.getAbsolutePath().substring(
- this.themeDir.length()+theme.getId().length()+1);
-
- // make sure path isn't prefixed with a /
- if(path.startsWith("/")) {
- path = path.substring(1);
- }
+ resource = (ThemeResource) iterat.next();
- log.debug("Importing resource "+resourceFile.getAbsolutePath()+" to "+path);
+ log.debug("Importing resource to "+resource.getPath());
try {
- if(resourceFile.isDirectory()) {
- fileMgr.createDirectory(website, path);
+ if(resource.isDirectory()) {
+ fileMgr.createDirectory(website, resource.getPath());
} else {
- fileMgr.saveFile(website, path, "text/plain",
- resourceFile.length(), new FileInputStream(resourceFile));
+ fileMgr.saveFile(website, resource.getPath(), "text/plain",
+ resource.getLength(), resource.getInputStream());
}
} catch (Exception ex) {
log.info(ex);
@@ -272,7 +296,7 @@
// now go through each theme and load it into a Theme object
for(int i=0; i < themenames.length; i++) {
try {
- Theme theme = loadThemeFromDisk(this.themeDir + File.separator + themenames[i]);
+ Theme theme = new SharedThemeFromDir(this.themeDir + File.separator + themenames[i]);
if(theme != null) {
themes.put(theme.getId(), theme);
}
@@ -283,117 +307,6 @@
}
return themes;
- }
-
-
- /**
- * Another convenience method which knows how to load a single theme
- * off the filesystem and return a Theme object
- */
- private Theme loadThemeFromDisk(String themepath) {
-
- log.debug("Parsing theme descriptor for "+themepath);
-
- ThemeMetadata themeMetadata = null;
- try {
- // lookup theme descriptor and parse it
- ThemeMetadataParser parser = new ThemeMetadataParser();
- InputStream is = new FileInputStream(themepath + File.separator + "theme.xml");
- themeMetadata = parser.unmarshall(is);
- } catch (Exception ex) {
- log.warn("Unable to parse theme descriptor for theme "+themepath, ex);
- return null;
- }
-
- log.debug("Loading Theme "+themeMetadata.getName());
-
- // use parsed theme descriptor to load Theme object
- Theme theme = new Theme();
- theme.setId(themeMetadata.getId());
- theme.setName(themeMetadata.getName());
- theme.setDescription(themeMetadata.getName());
- theme.setAuthor(themeMetadata.getAuthor());
- theme.setCustomStylesheet(themeMetadata.getCustomStylesheet());
- theme.setLastModified(new Date());
- theme.setEnabled(true);
-
- // go through static resources and add them to the theme
- String resourcePath = null;
- Iterator resourcesIter = themeMetadata.getResources().iterator();
- while (resourcesIter.hasNext()) {
- resourcePath = (String) resourcesIter.next();
-
- // construct File object from resource
- File resourceFile = new File(themepath + File.separator + resourcePath);
-
- // Continue reading theme even if problem encountered with one file
- if(!resourceFile.exists() || !resourceFile.canRead()) {
- log.warn("Couldn't read theme resource file ["+resourcePath+"]");
- continue;
- }
-
- // add it to the theme
- theme.setResource(resourcePath, resourceFile);
- }
-
- // go through templates and read in contents to a ThemeTemplate
- ThemeTemplate theme_template = null;
- ThemeMetadataTemplate templateMetadata = null;
- Iterator templatesIter = themeMetadata.getTemplates().iterator();
- while (templatesIter.hasNext()) {
- templateMetadata = (ThemeMetadataTemplate) templatesIter.next();
-
- // construct File object from path
- File templateFile = new File(themepath + File.separator +
- templateMetadata.getContentsFile());
-
- // Continue reading theme even if problem encountered with one file
- if(!templateFile.exists() && !templateFile.canRead()) {
- log.error("Couldn't read theme template file ["+templateFile+"]");
- continue;
- }
-
- char[] chars = null;
- int length;
- try {
- chars = new char[(int) templateFile.length()];
- FileInputStream stream = new FileInputStream(templateFile);
- InputStreamReader reader = new InputStreamReader(stream, "UTF-8");
- length = reader.read(chars);
- } catch (Exception noprob) {
- log.error("Exception reading template file ["+templateFile+"]");
- if (log.isDebugEnabled())
- log.debug(noprob);
- continue;
- }
-
- String decorator = "_decorator";
- if("_decorator".equals(templateMetadata.getName())) {
- decorator = null;
- }
-
- // construct ThemeTemplate representing this file
- // a few restrictions for now:
- // - decorator is always "_decorator" or null
- theme_template = new ThemeTemplate(
- theme,
- themeMetadata.getId()+":"+templateMetadata.getName(),
- templateMetadata.getAction(),
- templateMetadata.getName(),
- templateMetadata.getDescription(),
- new String(chars, 0, length),
- templateMetadata.getLink(),
- new Date(templateFile.lastModified()),
- templateMetadata.getTemplateLanguage(),
- templateMetadata.isHidden(),
- templateMetadata.isNavbar(),
- decorator);
-
- // add it to the theme
- theme.addTemplate(theme_template);
- }
-
- return theme;
}
}
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/utils/PasswordUtility.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/utils/PasswordUtility.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/utils/PasswordUtility.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/utils/PasswordUtility.java Sat Apr 7 15:09:45 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;
}
/**
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/utils/UpgradeDatabase.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/utils/UpgradeDatabase.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/utils/UpgradeDatabase.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/utils/UpgradeDatabase.java Sat Apr 7 15:09:45 2007
@@ -166,7 +166,7 @@
PreparedStatement setCustomThemeStmt = con.prepareStatement(
"update website set editortheme = ?");
- setCustomThemeStmt.setString(1, org.apache.roller.pojos.Theme.CUSTOM);
+ setCustomThemeStmt.setString(1, org.apache.roller.pojos.WeblogTheme.CUSTOM);
setCustomThemeStmt.executeUpdate();
if (!con.getAutoCommit()) con.commit();
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/planet/business/hibernate/HibernateRollerPlanetManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/planet/business/hibernate/HibernateRollerPlanetManagerImpl.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/planet/business/hibernate/HibernateRollerPlanetManagerImpl.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/planet/business/hibernate/HibernateRollerPlanetManagerImpl.java Sat Apr 7 15:09:45 2007
@@ -58,15 +58,15 @@
private static Log log = LogFactory.getLog(HibernateRollerPlanetManagerImpl.class);
- public HibernateRollerPlanetManagerImpl(HibernatePersistenceStrategy strat) {
-
- super(strat);
-
+ public HibernateRollerPlanetManagerImpl(HibernatePersistenceStrategy strat) {
+ super(strat);
log.info("Instantiating Hibernate Roller Planet Manager");
}
- protected Set getNewEntries(PlanetSubscriptionData sub,
+ /* TODO: update local feed fetching code to use 4.0 planet interfaces
+
+ protected Set getNewEntries(PlanetSubscriptionData sub,
FeedFetcher feedFetcher,
FeedFetcherCache feedInfoCache)
throws RollerException {
@@ -78,7 +78,7 @@
log.debug("Feed is remote, letting parent handle it "+sub.getFeedURL());
- return super.getNewEntries(sub, feedFetcher, feedInfoCache);
+ return super.getEntries(sub);
}
try {
@@ -182,6 +182,6 @@
// if there was an error then try normal planet method
return super.getNewEntries(sub, feedFetcher, feedInfoCache);
- }
+ }*/
}
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/planet/tasks/SyncWebsitesTask.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/planet/tasks/SyncWebsitesTask.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/planet/tasks/SyncWebsitesTask.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/planet/tasks/SyncWebsitesTask.java Sat Apr 7 15:09:45 2007
@@ -28,12 +28,11 @@
import org.apache.roller.RollerException;
import org.apache.roller.business.runnable.RollerTaskWithLeasing;
import org.apache.roller.config.RollerRuntimeConfig;
-import org.apache.roller.planet.business.Planet;
import org.apache.roller.planet.business.PlanetFactory;
import org.apache.roller.planet.business.PlanetManager;
-import org.apache.roller.planet.pojos.PlanetEntryData;
import org.apache.roller.business.RollerFactory;
import org.apache.roller.business.UserManager;
+import org.apache.roller.planet.pojos.PlanetData;
import org.apache.roller.planet.pojos.PlanetGroupData;
import org.apache.roller.planet.pojos.PlanetSubscriptionData;
import org.apache.roller.pojos.WebsiteData;
@@ -41,7 +40,9 @@
/**
- * Ensure that every weblog has a subscription in Planet Roller database.
+ * This tasks is responsible for ensuring that the planet group 'all' contains
+ * a subscription for every weblogs in the Roller system. It also takes care
+ * of deleting subsctiptions for weblogs that no longer exist.
*/
public class SyncWebsitesTask extends RollerTaskWithLeasing {
@@ -139,7 +140,8 @@
UserManager userManager = RollerFactory.getRoller().getUserManager();
// first, make sure there is an "all" planet group
- PlanetGroupData group = planet.getGroup("all");
+ PlanetData planetObject = planet.getPlanet("all");
+ PlanetGroupData group = planet.getGroup(planetObject, "all");
if(group == null) {
group = new PlanetGroupData();
group.setHandle("all");
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/planet/ui/admin/struts/actions/PlanetGroupsAction.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/planet/ui/admin/struts/actions/PlanetGroupsAction.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/planet/ui/admin/struts/actions/PlanetGroupsAction.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/planet/ui/admin/struts/actions/PlanetGroupsAction.java Sat Apr 7 15:09:45 2007
@@ -279,8 +279,8 @@
RollerRequest rreq = RollerRequest.getRollerRequest(request);
PlanetManager pmgr = PlanetFactory.getPlanet().getPlanetManager();
PlanetData defaultPlanet = pmgr.getPlanet("default_planet");
- PlanetGroupData externalGroup = pmgr.getGroup("external");
- Iterator allgroups = pmgr.getGroups(defaultPlanet).iterator();
+ PlanetGroupData externalGroup = pmgr.getGroup(defaultPlanet, "external");
+ Iterator allgroups = defaultPlanet.getGroups().iterator();
while (allgroups.hasNext())
{
PlanetGroupData agroup = (PlanetGroupData)allgroups.next();
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/planet/ui/admin/struts/forms/PlanetSubscriptionForm.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/planet/ui/admin/struts/forms/PlanetSubscriptionForm.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/planet/ui/admin/struts/forms/PlanetSubscriptionForm.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/planet/ui/admin/struts/forms/PlanetSubscriptionForm.java Sat Apr 7 15:09:45 2007
@@ -201,10 +201,7 @@
dataHolder.setInboundblogs(this.inboundblogs);
- dataHolder.setName(this.name);
-
- dataHolder.setURL(this.URL);
-
+ dataHolder.setTitle(this.name);
}
/**
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/StaticTemplate.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/StaticTemplate.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/StaticTemplate.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/StaticTemplate.java Sat Apr 7 15:09:45 2007
@@ -32,41 +32,26 @@
public class StaticTemplate implements Template, Serializable {
private String id = null;
- private String action = null;
private String name = null;
private String description = null;
- private String contents = null;
- private String link = null;
private Date lastModified = new Date();
private String templateLanguage = null;
- private boolean hidden = false;
- private boolean navbar = false;
private String outputContentType = null;
- public StaticTemplate() {}
-
- public StaticTemplate(String id, String contents, String lang) {
+ public StaticTemplate(String id, String lang) {
this.id = id;
this.name = id;
this.description = id;
- this.contents = contents;
- this.link = id;
this.templateLanguage = lang;
}
-
- public Template getDecorator() {
- return null;
- }
public String getId() {
return id;
}
public void setId(String id) {
- // Form bean workaround: empty string is never a valid id
- if (id != null && id.trim().length() == 0) return;
this.id = id;
}
@@ -86,22 +71,6 @@
this.description = description;
}
- public String getContents() {
- return contents;
- }
-
- public void setContents(String contents) {
- this.contents = contents;
- }
-
- public String getLink() {
- return link;
- }
-
- public void setLink(String link) {
- this.link = link;
- }
-
public Date getLastModified() {
return lastModified;
}
@@ -117,22 +86,6 @@
public void setTemplateLanguage(String templateLanguage) {
this.templateLanguage = templateLanguage;
}
-
- public boolean isHidden() {
- return hidden;
- }
-
- public void setHidden(boolean hidden) {
- this.hidden = hidden;
- }
-
- public void setNavbar(boolean navbar) {
- this.navbar = navbar;
- }
-
- public boolean isNavbar() {
- return navbar;
- }
public String getOutputContentType() {
return outputContentType;
@@ -140,13 +93,6 @@
public void setOutputContentType(String outputContentType) {
this.outputContentType = outputContentType;
- }
-
- public String getAction() {
- return action;
- }
-
- public void setAction(String action) {
- this.action = action;
}
+
}
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/Template.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/Template.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/Template.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/Template.java Sat Apr 7 15:09:45 2007
@@ -29,95 +29,35 @@
*/
public interface Template {
- public static final String ACTION_WEBLOG = "weblog";
- public static final String ACTION_PERMALINK = "permalink";
- public static final String ACTION_SEARCH = "search";
- public static final String ACTION_TAGSINDEX = "tagsIndex";
- public static final String ACTION_CUSTOM = "custom";
-
- // the full list of supported special actions, which purposely does not
- // contain an entry for the 'custom' action
- public static final String[] ACTIONS = {
- ACTION_WEBLOG,
- ACTION_PERMALINK,
- ACTION_SEARCH,
- ACTION_TAGSINDEX
- };
-
-
/**
* The unique identifier for this Template.
- *
- * @roller.wrapPojoMethod type="simple"
*/
public String getId();
- /**
- * The action this template is defined for.
- */
- public String getAction();
/**
* A simple name for this Template.
- *
- * @roller.wrapPojoMethod type="simple"
*/
public String getName();
+
/**
* A description of the contents of this Template.
- *
- * @roller.wrapPojoMethod type="simple"
*/
public String getDescription();
- /**
- * The contents or body of the Template.
- *
- * @roller.wrapPojoMethod type="simple"
- */
- public String getContents();
-
- /**
- * The url link value for this Template. If this template is not
- * private this is the url that it can be accessed at.
- *
- * @roller.wrapPojoMethod type="simple"
- */
- public String getLink();
/**
* The last time the template was modified.
- *
- * @roller.wrapPojoMethod type="simple"
*/
public Date getLastModified();
- /**
- * Is the Template hidden? A hidden template cannot be accessed directly.
- *
- * @roller.wrapPojoMethod type="simple"
- */
-
- public boolean isHidden();
-
- /**
- * Is the Template to be included in the navbar?
- *
- * @roller.wrapPojoMethod type="simple"
- */
- public boolean isNavbar();
/**
* The templating language used by this template.
*/
public String getTemplateLanguage();
- /**
- * The decorator Template to apply. This returns null if no decorator
- * should be applied.
- */
- public Template getDecorator();
/**
* Content-type of output or null if none defined.
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/Theme.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/Theme.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/Theme.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/Theme.java Sat Apr 7 15:09:45 2007
@@ -18,216 +18,91 @@
package org.apache.roller.pojos;
-import java.io.File;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
+import org.apache.roller.RollerException;
/**
- * The Theme object encapsulates all elements of a single weblog theme. It
- * is used mostly to contain all the templates for a theme, but does contain
- * other theme related attributes such as name, last modifed date, etc.
+ * A Theme represents the set of components which are used to generate the
+ * web design for a weblog along with some metadata like a name, etc.
*/
-public class Theme implements Serializable, Comparable {
-
- // this is the name that will be used to identify a user customized theme
- public static final String CUSTOM = "custom";
-
- private String id = null;
- private String name = null;
- private String description = null;
- private String author = null;
- private String customStylesheet = null;
- private Date lastModified = null;
- private boolean enabled = false;
-
- // we keep templates in a Map for faster lookups by name
- // the Map contains ... (template name, ThemeTemplate)
- private Map templatesByName = new HashMap();
-
- // we keep templates in a Map for faster lookups by link
- // the Map contains ... (template link, ThemeTemplate)
- private Map templatesByLink = new HashMap();
-
- // we keep templates in a Map for faster lookups by action
- // the Map contains ... (template action, ThemeTemplate)
- private Map templatesByAction = new HashMap();
-
- // we keep resources in a Map for faster lookups by path
- // the Map contains ... (resource path, File)
- private Map resources = new HashMap();
+public interface Theme {
+ /**
+ * A unique identifier for this Theme.
+ */
+ public String getId();
- public Theme() {}
-
/**
- * Get the collection of all templates associated with this Theme.
+ * A common or display name for this Theme.
*/
- public List getTemplates() {
- return new ArrayList(this.templatesByName.values());
- }
+ public String getName();
- public Template getDefaultTemplate() {
- return (ThemeTemplate) this.templatesByAction.get(Template.ACTION_WEBLOG);
- }
+ /**
+ * A description of the Theme.
+ */
+ public String getDescription();
/**
- * Lookup the specified template by name.
- * Returns null if the template cannot be found.
+ * The last modification date of the Theme.
*/
- public ThemeTemplate getTemplate(String name) {
- return (ThemeTemplate) this.templatesByName.get(name);
- }
+ public Date getLastModified();
/**
- * Lookup the specified template by link.
- * Returns null if the template cannot be found.
+ * The path within the Theme to a custom stylesheet override, or null if
+ * no stylesheet override is set.
*/
- public Template getTemplateByLink(String link) {
- return (ThemeTemplate) this.templatesByLink.get(link);
- }
+ public String getCustomStylesheet();
/**
- * Lookup the specified template by action.
- * Returns null if the template cannot be found.
+ * Is the Theme enable for use?
*/
- public Template getTemplateByAction(String action) {
- return (ThemeTemplate) this.templatesByAction.get(action);
- }
+ public boolean isEnabled();
/**
- * Set the value for a given template name.
+ * Get the list of all templates associated with this Theme.
*/
- public void addTemplate(ThemeTemplate template) {
- this.templatesByName.put(template.getName(), template);
- this.templatesByLink.put(template.getLink(), template);
- this.templatesByAction.put(template.getAction(), template);
- }
+ public List getTemplates() throws RollerException;
/**
- * Get the collection of all resources associated with this Theme.
- *
- * It is assured that the resources are returned sorted by pathname.
+ * Lookup the default template for the Theme.
*/
- public List getResources() {
-
- // make sure resources are sorted.
- List myResources = new ArrayList(this.resources.values());
- Collections.sort(myResources);
-
- return myResources;
- }
+ public ThemeTemplate getDefaultTemplate() throws RollerException;
/**
- * Lookup the specified resource by path.
- * Returns null if the resource cannot be found.
+ * Lookup a template by action.
+ * Returns null if the template cannot be found.
*/
- public File getResource(String path) {
- return (File) this.resources.get(path);
- }
+ public ThemeTemplate getTemplateByAction(String action) throws RollerException;
/**
- * Set the value for a given resource path.
+ * Lookup a template by name.
+ * Returns null if the template cannot be found.
*/
- public void setResource(String path, File resource) {
- this.resources.put(path, resource);
- }
+ public ThemeTemplate getTemplateByName(String name) throws RollerException;
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getAuthor() {
- return author;
- }
-
- public void setAuthor(String author) {
- this.author = author;
- }
-
- public String getCustomStylesheet() {
- return customStylesheet;
- }
-
- public void setCustomStylesheet(String customStylesheet) {
- this.customStylesheet = customStylesheet;
- }
-
- public Date getLastModified() {
- return lastModified;
- }
-
- public void setLastModified(Date lastModified) {
- this.lastModified = lastModified;
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append(name);
- sb.append("\n");
-
- Iterator it = this.templatesByName.values().iterator();
- while(it.hasNext()) {
- sb.append(it.next());
- sb.append("\n");
- }
-
- return sb.toString();
-
- }
+ /**
+ * Lookup a template by link.
+ * Returns null if the template cannot be found.
+ */
+ public ThemeTemplate getTemplateByLink(String link) throws RollerException;
/**
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo(Object o) {
- Theme other = (Theme) o;
- return getName().compareTo(other.getName());
- }
-
+ * Lookup a resource by path.
+ * Returns null if the resource cannot be found.
+ */
+ public ThemeResource getResource(String path);
+
}
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/ThemeTemplate.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/ThemeTemplate.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/ThemeTemplate.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/ThemeTemplate.java Sat Apr 7 15:09:45 2007
@@ -18,162 +18,71 @@
package org.apache.roller.pojos;
-import java.io.Serializable;
-import java.util.Date;
-import org.apache.roller.pojos.Template;
-
/**
- * A Theme based implementation of a Template. A ThemeTemplate represents a
- * template which is part of a shared Theme.
+ * A Theme specific implementation of a Template.
+ *
+ * A ThemeTemplate represents a template which is part of a Theme.
*/
-public class ThemeTemplate implements Template, Serializable {
+public interface ThemeTemplate extends Template {
- private String id = null;
- private String action = null;
- private String name = null;
- private String description = null;
- private String contents = null;
- private String link = null;
- private Date lastModified = null;
- private String templateLanguage = null;
- private boolean hidden = false;
- private boolean navbar = false;
- private String decoratorName = null;
- private String outputContentType = null;
-
- private Theme myTheme = null;
-
-
- public ThemeTemplate() {}
-
- public ThemeTemplate(Theme theme, String id, String action, String name,
- String desc, String contents, String link, Date date,
- String tempLang, boolean hid, boolean navbar, String decor) {
-
- this.myTheme = theme;
- this.id = id;
- this.action = action;
- this.name = name;
- this.description = desc;
- this.contents = contents;
- this.link = link;
- this.lastModified = date;
- this.templateLanguage = tempLang;
- this.hidden = hid;
- this.navbar = navbar;
- this.decoratorName = decor;
- }
-
-
- public Template getDecorator() {
- if(decoratorName != null && !id.equals(decoratorName)) {
- return myTheme.getTemplate(decoratorName);
- }
- return null;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- // Form bean workaround: empty string is never a valid id
- if (id != null && id.trim().length() == 0) return;
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getContents() {
- return contents;
- }
-
- public void setContents(String contents) {
- this.contents = contents;
- }
-
- public Date getLastModified() {
- return lastModified;
- }
-
- public void setLastModified(Date lastModified) {
- this.lastModified = lastModified;
- }
-
- public String getLink() {
- return link;
- }
-
- public void setLink(String link) {
- this.link = link;
- }
-
- public String getTemplateLanguage() {
- return templateLanguage;
- }
-
- public void setTemplateLanguage(String templateLanguage) {
- this.templateLanguage = templateLanguage;
- }
-
- public boolean isHidden() {
- return hidden;
- }
-
- public void setHidden(boolean isHidden) {
- this.hidden = isHidden;
- }
-
- public boolean isNavbar() {
- return navbar;
- }
-
- public void setNavbar(boolean navbar) {
- this.navbar = navbar;
- }
-
- public String getDecoratorName() {
- return decoratorName;
- }
-
- public void setDecoratorName(String decorator) {
- this.decoratorName = decorator;
- }
-
- public String getOutputContentType() {
- return outputContentType;
- }
-
- public void setOutputContentType(String outputContentType) {
- this.outputContentType = outputContentType;
- }
-
- public String toString() {
- return (id + "," + name + "," + description + "," + link + "," +
- lastModified + "\n\n" + contents + "\n");
- }
-
- public String getAction() {
- return action;
- }
-
- public void setAction(String action) {
- this.action = action;
- }
+ public static final String ACTION_WEBLOG = "weblog";
+ public static final String ACTION_PERMALINK = "permalink";
+ public static final String ACTION_SEARCH = "search";
+ public static final String ACTION_TAGSINDEX = "tagsIndex";
+ public static final String ACTION_CUSTOM = "custom";
+
+ // the full list of supported special actions, which purposely does not
+ // contain an entry for the 'custom' action
+ public static final String[] ACTIONS = {
+ ACTION_WEBLOG,
+ ACTION_PERMALINK,
+ ACTION_SEARCH,
+ ACTION_TAGSINDEX
+ };
+
+
+ /**
+ * The action this template is defined for.
+ */
+ public String getAction();
+
+
+ /**
+ * The contents or body of the Template.
+ */
+ public String getContents();
+
+
+ /**
+ * The url link value for this Template. If this template is not
+ * private this is the url that it can be accessed at.
+ */
+ public String getLink();
+
+
+ /**
+ * Is the Template hidden? A hidden template cannot be accessed directly.
+ */
+ public boolean isHidden();
+
+
+ /**
+ * Is the Template to be included in the navbar?
+ */
+ public boolean isNavbar();
+
+
+ /**
+ * The name of the decorator template to apply.
+ */
+ public String getDecoratorName();
+
+
+ /**
+ * The decorator Template to apply. This returns null if no decorator
+ * should be applied.
+ */
+ public ThemeTemplate getDecorator();
}
Modified: incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/WeblogTemplate.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/WeblogTemplate.java?view=diff&rev=526492&r1=526491&r2=526492
==============================================================================
--- incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/WeblogTemplate.java (original)
+++ incubator/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/WeblogTemplate.java Sat Apr 7 15:09:45 2007
@@ -41,7 +41,7 @@
* @hibernate.class lazy="true" table="webpage"
* @hibernate.cache usage="read-write"
*/
-public class WeblogTemplate implements Serializable, Template {
+public class WeblogTemplate implements ThemeTemplate, Serializable {
public static final long serialVersionUID = -613737191638263428L;
public static final String DEFAULT_PAGE = "Weblog";
@@ -82,7 +82,7 @@
}
- public Template getDecorator() {
+ public ThemeTemplate getDecorator() {
if(decoratorName != null && !id.equals(decoratorName)) {
try {
return weblog.getPageByName(decoratorName);