Added less files to the synchronization process, updated some documentation.

git-svn-id: https://svn.libreccm.org/ccm/trunk@5777 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2018-12-11 14:50:29 +00:00
parent e73f02dbca
commit 2d50d99002
3 changed files with 49 additions and 45 deletions

View File

@ -98,7 +98,7 @@ public class ThemeDirectorConfig extends AbstractConfig {
private final Parameter m_fileExtParam = new StringParameter(
"themedirector.file_extensions",
Parameter.REQUIRED,
"bmp css eot gif jpeg jpg js png svg ttf woff xml xsl");
"bmp css eot gif jpeg jpg js less otf png svg ttf woff woff2 xml xsl");
/**
* Specifies the less file(s) used as entry point(s) for compiling a managed

View File

@ -21,19 +21,18 @@ package com.arsdigita.themedirector.util;
import com.arsdigita.themedirector.Theme;
import com.arsdigita.themedirector.ThemeFile;
import com.arsdigita.themedirector.ThemeFileCollection;
import com.arsdigita.templating.Templating;
import java.io.File;
import org.apache.log4j.Logger;
/**
* Class for polling the database to look for new/updated development files
* in the ThemeFile table.
* Class for synchronizing the database and file system of the theme development
* files.
*
* For "development" files, it looks at every file in the db and, if the
* timestamp is after the timestamp of the file on the file system (or
* there is no file on the file system) then it writes out the new file.
* If the timestamp on the file system is newer, it ignores the file.
* For "development" files, he first step is to ensure that all files in the
* file system are contained in the database and are up to date. A second step
* ensures that the file system has everything from the database.
*
* @author <a href="mailto:randyg@redhat.com">Randy Graebner</a>
*/
@ -79,22 +78,20 @@ public class ThemeDevelopmentFileManager extends ThemeFileManager {
}
// is there a way to move this code up in to the parent class?
/**
* Start watching the files. This method spawns a background thread that
* looks for changes in files in the database if there is not already a
* thread that has been spawned. If there is already a running thread then
* this is a no-op that returns a reference to the running thread.
* looks for changes in files if startupDelay > 0.
*
* Specifically it is used by Themedirector's Initializer() to start a
* continuous background process to synchronize database and filesystem.
*
* If there is already a thread that has been spawned and there is already
* a running thread then this is a no-op that returns that running thread.
* It will not start up multiple threads!
*
* The thread starts processing after <code>startupDelay</code> seconds. The
* db is checked for new/updated files every <code>pollDelay</code> seconds.
*
* This will not start up multiple threads...if there is already a thread
* running, it will return that thread to you.
*
* @param startupDelay number of seconds to wait before starting to process
* the file. A startupDelay of 0 means this is a no-op
* @param pollDelay number of seconds to wait between checks if the file
@ -103,6 +100,7 @@ public class ThemeDevelopmentFileManager extends ThemeFileManager {
* for the application context ThemeDirector is running.
* (the directory containing WEB-INF subdir)
* May be null! (Specificall if invokel by Initializer!)
*
* @return
*/
public static ThemeFileManager startWatchingFiles(int startupDelay,
@ -175,9 +173,12 @@ public class ThemeDevelopmentFileManager extends ThemeFileManager {
ThemeFile.DRAFT);
}
// the call to super makes sure that the file system has everything
// from the database.
// second step: the call to super makes sure that the file system
// has everything from the database.
super.updateTheme(theme);
// purge the templating cache -- we want newly published themes
// to be visible immediately, and not after a server restart.
Templating.purgeTemplates();
}

View File

@ -12,11 +12,13 @@
* rights and limitations under the License.
*
*/
package com.arsdigita.themedirector.util;
import com.arsdigita.themedirector.Theme;
import com.arsdigita.themedirector.ThemeFileCollection;
import com.arsdigita.templating.Templating;
import java.io.File;
import org.apache.log4j.Logger;
@ -30,7 +32,6 @@ import org.apache.log4j.Logger;
* examines all themes.
*
* @author <a href="mailto:randyg@redhat.com">Randy Graebner</a>
* @version $Revision: #2 $ $DateTime: 2004/03/17 09:56:37 $
*/
public class ThemePublishedFileManager extends ThemeFileManager {
@ -45,6 +46,7 @@ public class ThemePublishedFileManager extends ThemeFileManager {
// The code in this class borrows heavily from
// com.arsdigita.cms.publishToFile.FileManager
static private ThemeFileManager s_manager = null;
/**
@ -69,29 +71,28 @@ public class ThemePublishedFileManager extends ThemeFileManager {
super(s_log, startupDelay, pollDelay, baseDirectory);
}
// is there a way to move this code up in to the parent class?
/**
* Start watching the files. This method spawns a background thread that
* looks for changes in files in the database if there is not already a
* thread that has been spawned. If there is already a running thread then
* this is a no-op that returns a reference to the running thread.
* looks for changes in files if startupDelay > 0.
*
* Specifically it is used by Themedirector's Initializer() to start a
* continuous background process to synchronize database and filesystem.
*
* If there is already a thread that has been spawned and there is already
* a running thread then this is a no-op that returns that running thread.
* It will not start up multiple threads!
*
* The thread starts processing after <code>startupDelay</code> seconds. The
* db is checked for new/updated files every <code>pollDelay</code> seconds.
*
* This will not start up multiple threads...if there is already a thread
* running, it will return that thread to you.
*
* @param startupDelay number of seconds to wait before starting to process
* the file. A startupDelay of 0 means this is a no-op
* @param pollDelay number of seconds to wait between checks if the file
* has any entries.
* @param baseDirectory String with the path to theme files base directory
* (the directory containing devel and pub subdirs) May
* be null! (Specificall if invokel by Initializer!)
* @param baseDirectory String with the file system path to document root
* for the application context ThemeDirector is running.
* (the directory containing WEB-INF subdir)
* May be null! (Specificall if invokel by Initializer!)
*
* @return
*/
@ -134,13 +135,15 @@ public class ThemePublishedFileManager extends ThemeFileManager {
*/
@Override
protected String getManagerSpecificDirectory() {
return getBaseDirectory() + PROD_THEMES_BASE_DIR;
String pubDir = getBaseDirectory() + PROD_THEMES_BASE_DIR;
s_log.info(pubDir + " is the published themes directory used.");
return pubDir ;
}
/**
* This looks at all of the files in the db for the passed in theme and
* makes sure that this servers file system has all of the updated files. If
* the thread has run since the theme was last published then this is a
* This looks at all of the files in the db for the passed in published theme
* and makes sure that this servers file system has all of the updated files.
* It the thread has run since the theme was last published then this is a
* no-op
*/
@Override