Added less files to the synchronization process, updated some documentation.
git-svn-id: https://svn.libreccm.org/ccm/trunk@5777 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
e73f02dbca
commit
2d50d99002
|
|
@ -98,7 +98,7 @@ public class ThemeDirectorConfig extends AbstractConfig {
|
||||||
private final Parameter m_fileExtParam = new StringParameter(
|
private final Parameter m_fileExtParam = new StringParameter(
|
||||||
"themedirector.file_extensions",
|
"themedirector.file_extensions",
|
||||||
Parameter.REQUIRED,
|
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
|
* Specifies the less file(s) used as entry point(s) for compiling a managed
|
||||||
|
|
|
||||||
|
|
@ -21,19 +21,18 @@ package com.arsdigita.themedirector.util;
|
||||||
import com.arsdigita.themedirector.Theme;
|
import com.arsdigita.themedirector.Theme;
|
||||||
import com.arsdigita.themedirector.ThemeFile;
|
import com.arsdigita.themedirector.ThemeFile;
|
||||||
import com.arsdigita.themedirector.ThemeFileCollection;
|
import com.arsdigita.themedirector.ThemeFileCollection;
|
||||||
|
import com.arsdigita.templating.Templating;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for polling the database to look for new/updated development files
|
* Class for synchronizing the database and file system of the theme development
|
||||||
* in the ThemeFile table.
|
* files.
|
||||||
*
|
*
|
||||||
* For "development" files, it looks at every file in the db and, if the
|
* For "development" files, he first step is to ensure that all files in the
|
||||||
* timestamp is after the timestamp of the file on the file system (or
|
* file system are contained in the database and are up to date. A second step
|
||||||
* there is no file on the file system) then it writes out the new file.
|
* ensures that the file system has everything from the database.
|
||||||
* If the timestamp on the file system is newer, it ignores the file.
|
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:randyg@redhat.com">Randy Graebner</a>
|
* @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
|
* 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
|
* looks for changes in files if startupDelay > 0.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
* Specifically it is used by Themedirector's Initializer() to start a
|
* Specifically it is used by Themedirector's Initializer() to start a
|
||||||
* continuous background process to synchronize database and filesystem.
|
* 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
|
* The thread starts processing after <code>startupDelay</code> seconds. The
|
||||||
* db is checked for new/updated files every <code>pollDelay</code> seconds.
|
* 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
|
* @param startupDelay number of seconds to wait before starting to process
|
||||||
* the file. A startupDelay of 0 means this is a no-op
|
* the file. A startupDelay of 0 means this is a no-op
|
||||||
* @param pollDelay number of seconds to wait between checks if the file
|
* @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.
|
* for the application context ThemeDirector is running.
|
||||||
* (the directory containing WEB-INF subdir)
|
* (the directory containing WEB-INF subdir)
|
||||||
* May be null! (Specificall if invokel by Initializer!)
|
* May be null! (Specificall if invokel by Initializer!)
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static ThemeFileManager startWatchingFiles(int startupDelay,
|
public static ThemeFileManager startWatchingFiles(int startupDelay,
|
||||||
|
|
@ -175,9 +173,12 @@ public class ThemeDevelopmentFileManager extends ThemeFileManager {
|
||||||
ThemeFile.DRAFT);
|
ThemeFile.DRAFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// the call to super makes sure that the file system has everything
|
// second step: the call to super makes sure that the file system
|
||||||
// from the database.
|
// has everything from the database.
|
||||||
super.updateTheme(theme);
|
super.updateTheme(theme);
|
||||||
|
// purge the templating cache -- we want newly published themes
|
||||||
|
// to be visible immediately, and not after a server restart.
|
||||||
|
Templating.purgeTemplates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,24 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2001, 2003 ArsDigita Corporation. All Rights Reserved.
|
* Copyright (C) 2001, 2003 ArsDigita Corporation. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the ArsDigita Public
|
* The contents of this file are subject to the ArsDigita Public
|
||||||
* License (the "License"); you may not use this file except in
|
* License (the "License"); you may not use this file except in
|
||||||
* compliance with the License. You may obtain a copy of
|
* compliance with the License. You may obtain a copy of
|
||||||
* the License at http://www.arsdigita.com/ADPL.txt
|
* the License at http://www.arsdigita.com/ADPL.txt
|
||||||
*
|
*
|
||||||
* Software distributed under the License is distributed on an "AS
|
* Software distributed under the License is distributed on an "AS
|
||||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||||
* implied. See the License for the specific language governing
|
* implied. See the License for the specific language governing
|
||||||
* rights and limitations under the License.
|
* rights and limitations under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.arsdigita.themedirector.util;
|
package com.arsdigita.themedirector.util;
|
||||||
|
|
||||||
import com.arsdigita.themedirector.Theme;
|
import com.arsdigita.themedirector.Theme;
|
||||||
import com.arsdigita.themedirector.ThemeFileCollection;
|
import com.arsdigita.themedirector.ThemeFileCollection;
|
||||||
import com.arsdigita.templating.Templating;
|
import com.arsdigita.templating.Templating;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
@ -30,7 +32,6 @@ import org.apache.log4j.Logger;
|
||||||
* examines all themes.
|
* examines all themes.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:randyg@redhat.com">Randy Graebner</a>
|
* @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 {
|
public class ThemePublishedFileManager extends ThemeFileManager {
|
||||||
|
|
||||||
|
|
@ -45,6 +46,7 @@ public class ThemePublishedFileManager extends ThemeFileManager {
|
||||||
|
|
||||||
// The code in this class borrows heavily from
|
// The code in this class borrows heavily from
|
||||||
// com.arsdigita.cms.publishToFile.FileManager
|
// com.arsdigita.cms.publishToFile.FileManager
|
||||||
|
|
||||||
static private ThemeFileManager s_manager = null;
|
static private ThemeFileManager s_manager = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -69,29 +71,28 @@ public class ThemePublishedFileManager extends ThemeFileManager {
|
||||||
super(s_log, startupDelay, pollDelay, baseDirectory);
|
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
|
* 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
|
* looks for changes in files if startupDelay > 0.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
* Specifically it is used by Themedirector's Initializer() to start a
|
* Specifically it is used by Themedirector's Initializer() to start a
|
||||||
* continuous background process to synchronize database and filesystem.
|
* 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
|
* The thread starts processing after <code>startupDelay</code> seconds. The
|
||||||
* db is checked for new/updated files every <code>pollDelay</code> seconds.
|
* 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
|
* @param startupDelay number of seconds to wait before starting to process
|
||||||
* the file. A startupDelay of 0 means this is a no-op
|
* the file. A startupDelay of 0 means this is a no-op
|
||||||
* @param pollDelay number of seconds to wait between checks if the file
|
* @param pollDelay number of seconds to wait between checks if the file
|
||||||
* has any entries.
|
* has any entries.
|
||||||
* @param baseDirectory String with the path to theme files base directory
|
* @param baseDirectory String with the file system path to document root
|
||||||
* (the directory containing devel and pub subdirs) May
|
* for the application context ThemeDirector is running.
|
||||||
* be null! (Specificall if invokel by Initializer!)
|
* (the directory containing WEB-INF subdir)
|
||||||
|
* May be null! (Specificall if invokel by Initializer!)
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -134,13 +135,15 @@ public class ThemePublishedFileManager extends ThemeFileManager {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected String getManagerSpecificDirectory() {
|
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
|
* This looks at all of the files in the db for the passed in published theme
|
||||||
* makes sure that this servers file system has all of the updated files. If
|
* and makes sure that this servers file system has all of the updated files.
|
||||||
* the thread has run since the theme was last published then this is a
|
* It the thread has run since the theme was last published then this is a
|
||||||
* no-op
|
* no-op
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue