Korrekturen und Formatierungen
git-svn-id: https://svn.libreccm.org/ccm/trunk@946 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
37ada8557f
commit
09eeec3a34
|
|
@ -32,6 +32,7 @@ import com.arsdigita.cms.contenttypes.GenericPerson;
|
|||
import com.arsdigita.cms.contenttypes.GenericPersonContactCollection;
|
||||
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
||||
import com.arsdigita.xml.Element;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -39,6 +40,8 @@ import com.arsdigita.xml.Element;
|
|||
*/
|
||||
public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel {
|
||||
|
||||
private final static Logger logger = Logger.getLogger(GenericOrganizationalUnit.class);
|
||||
|
||||
public static final String SHOW_CONTACTS = "contacts";
|
||||
public static final String SHOW_MEMBERS = "members";
|
||||
private boolean displayContacts = true;
|
||||
|
|
@ -72,6 +75,7 @@ public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel {
|
|||
|
||||
protected void generateContactsXML(GenericOrganizationalUnit orga,
|
||||
Element parent, PageState state) {
|
||||
long start = System.currentTimeMillis();
|
||||
GenericOrganizationalUnitContactCollection contacts;
|
||||
contacts = orga.getContacts();
|
||||
|
||||
|
|
@ -98,6 +102,7 @@ public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel {
|
|||
Integer.toString(contacts.getContactOrder()),
|
||||
true);
|
||||
}
|
||||
System.out.printf("Generated Contacts XML in %d ms.\n", System.currentTimeMillis() - start);
|
||||
}
|
||||
|
||||
protected void generateMembersXML(GenericOrganizationalUnit orga,
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import java.math.BigDecimal;
|
|||
import java.util.HashSet;
|
||||
import java.io.File;
|
||||
|
||||
|
||||
/**
|
||||
* Class for queuing tasks for publishing and unpublishing to
|
||||
* the file system and for processing the queue. When processing
|
||||
|
|
@ -66,34 +65,27 @@ public class QueueManager implements Runnable {
|
|||
|
||||
// Creates a s_logging category with name = to the full name of class
|
||||
private static Logger s_log = Logger.getLogger(QueueManager.class);
|
||||
|
||||
// Should probably use these constants. Are hardcoded for now because
|
||||
// matches DataQuery suffex.
|
||||
// final static String BLOCK_SELECT_METHOD_QUEUED_ORDER = "QueuedOrder";
|
||||
// final static String BLOCK_SELECT_METHOD_GROUP_BY_PARENT = "GroupByParent";
|
||||
|
||||
// Parameters involved in processing the queue and their default values.
|
||||
// Set to values other than default by calling methods from an initializer.
|
||||
private int m_startupDelay;
|
||||
private int m_pollDelay;
|
||||
|
||||
static Integer s_retryDelay = new Integer(120);
|
||||
static Integer s_blockSize = new Integer(20);
|
||||
static String s_blockSelectMethod = "QueuedOrder";
|
||||
static Integer s_maximumFailCount = new Integer(-1);
|
||||
|
||||
// Following true if should keep watching queue
|
||||
static private boolean s_keepWatchingQueue = true;
|
||||
|
||||
static private Thread s_queueThread = null;
|
||||
|
||||
// Class implementing methods run when publishing or unpublishing to file.
|
||||
private static PublishToFileListener s_publishListener = null;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Constructor related code.
|
||||
//
|
||||
|
||||
/**
|
||||
*
|
||||
* @param startupDelay
|
||||
|
|
@ -107,7 +99,6 @@ public class QueueManager implements Runnable {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
// Initialization related code.
|
||||
//
|
||||
|
||||
/**
|
||||
* Set how many seconds the queue manager should wait before trying to
|
||||
* process an entry which has previously failed.
|
||||
|
|
@ -146,7 +137,6 @@ public class QueueManager implements Runnable {
|
|||
s_maximumFailCount = maxFailCount;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* Set the listener that processes the publish and unpublish requests.
|
||||
*/
|
||||
|
|
@ -157,7 +147,6 @@ public class QueueManager implements Runnable {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
// Methods for queuing tasks
|
||||
//
|
||||
|
||||
public static void requeueMissingFiles() {
|
||||
DomainCollection files = PublishedFile.retrieveAll();
|
||||
|
||||
|
|
@ -167,7 +156,7 @@ public class QueueManager implements Runnable {
|
|||
HashSet done = new HashSet();
|
||||
|
||||
while (files.next()) {
|
||||
PublishedFile fileRecord = (PublishedFile)files.getDomainObject();
|
||||
PublishedFile fileRecord = (PublishedFile) files.getDomainObject();
|
||||
|
||||
if (done.contains(fileRecord.getFileName())) {
|
||||
continue;
|
||||
|
|
@ -182,26 +171,26 @@ public class QueueManager implements Runnable {
|
|||
|
||||
} else if (file.exists()) {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug( "File " + file.getAbsolutePath() +
|
||||
" already exists");
|
||||
s_log.debug("File " + file.getAbsolutePath()
|
||||
+ " already exists");
|
||||
}
|
||||
|
||||
} else {
|
||||
if (s_log.isInfoEnabled()) {
|
||||
s_log.info("Published file " + file.getAbsolutePath() +
|
||||
" for item " + fileRecord.getItemId() +
|
||||
" isn't on the filesystem. Scheduling for " +
|
||||
"republishing.");
|
||||
s_log.info("Published file " + file.getAbsolutePath()
|
||||
+ " for item " + fileRecord.getItemId()
|
||||
+ " isn't on the filesystem. Scheduling for "
|
||||
+ "republishing.");
|
||||
}
|
||||
|
||||
ContentItem item = fileRecord.getItem();
|
||||
|
||||
if (item == null) {
|
||||
s_log.warn
|
||||
("No corresponding content item found for " +
|
||||
"published file " + fileRecord.getFileName() + " " +
|
||||
"(draft id " + fileRecord.getDraftId() + ", " +
|
||||
"item id " + fileRecord.getItemId() + ")");
|
||||
s_log.warn("No corresponding content item found for "
|
||||
+ "published file " + fileRecord.getFileName()
|
||||
+ " " + "(draft id " + fileRecord.getDraftId()
|
||||
+ ", " + "item id " + fileRecord.getItemId()
|
||||
+ ")");
|
||||
} else {
|
||||
ACSObject parent = item.getParent();
|
||||
BigDecimal parentID = null;
|
||||
|
|
@ -215,7 +204,6 @@ public class QueueManager implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* Schedule an item for publishing. This should be called just after a new
|
||||
* live version of an item becomes available.
|
||||
|
|
@ -225,8 +213,8 @@ public class QueueManager implements Runnable {
|
|||
* @pre ! item instanceof ContainerItem
|
||||
***/
|
||||
public static void queuePublish(ContentItem item) {
|
||||
Assert.isTrue( !(item instanceof ContentBundle),
|
||||
"Cannot queue content bundle " + item );
|
||||
Assert.isTrue(!(item instanceof ContentBundle),
|
||||
"Cannot queue content bundle " + item);
|
||||
Assert.isTrue(item.isLiveVersion(), "Item is not live");
|
||||
if (s_log.isInfoEnabled()) {
|
||||
s_log.info("Queue publish task for " + item.getID());
|
||||
|
|
@ -236,15 +224,15 @@ public class QueueManager implements Runnable {
|
|||
QueueEntryCollection q = new QueueEntryCollection(
|
||||
item.getID());
|
||||
while (q.next()) {
|
||||
if ( q.isPublishTask() ) {
|
||||
if (q.isPublishTask()) {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Deleting existing publish task " + q.getID());
|
||||
}
|
||||
q.delete();
|
||||
} else if ( q.isUnpublishTask() || q.isRepublishTask() ) {
|
||||
} else if (q.isUnpublishTask() || q.isRepublishTask()) {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Deleting existing (un|re)publish task " +
|
||||
q.getID());
|
||||
s_log.debug("Deleting existing (un|re)publish task " + q.
|
||||
getID());
|
||||
}
|
||||
task = QueueEntry.TASK_REPUBLISH;
|
||||
q.delete();
|
||||
|
|
@ -253,7 +241,6 @@ public class QueueManager implements Runnable {
|
|||
queue(item, task);
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* Schedule an item for unpublishing. This should be called just before
|
||||
* the live version <code>item</code> is deleted.
|
||||
|
|
@ -270,9 +257,9 @@ public class QueueManager implements Runnable {
|
|||
QueueEntryCollection q = new QueueEntryCollection(
|
||||
item.getID());
|
||||
while (q.next()) {
|
||||
if ( q.isPublishTask()
|
||||
if (q.isPublishTask()
|
||||
|| q.isRepublishTask()
|
||||
|| q.isUnpublishTask() ) {
|
||||
|| q.isUnpublishTask()) {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Deleting existing (un|re|new)publish task "
|
||||
+ q.getID());
|
||||
|
|
@ -283,7 +270,6 @@ public class QueueManager implements Runnable {
|
|||
queue(item, QueueEntry.TASK_UNPUBLISH);
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* Schedule an item for republishing. This should be called whenever an
|
||||
* existing live item <code>item</code> should be refreshed in the file
|
||||
|
|
@ -302,14 +288,14 @@ public class QueueManager implements Runnable {
|
|||
QueueEntryCollection q = new QueueEntryCollection(
|
||||
item.getID());
|
||||
while (q.next()) {
|
||||
if ( q.isUnpublishTask()
|
||||
|| q.isPublishTask() ) {
|
||||
if (q.isUnpublishTask()
|
||||
|| q.isPublishTask()) {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Deleting existing (un|new)publish task "
|
||||
+ q.getID());
|
||||
}
|
||||
q.delete();
|
||||
} else if ( q.isRepublishTask() ) {
|
||||
} else if (q.isRepublishTask()) {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Aborting because there is already a republish "
|
||||
+ q.getID());
|
||||
|
|
@ -354,8 +340,8 @@ public class QueueManager implements Runnable {
|
|||
}
|
||||
|
||||
private static void queue(ContentItem item, String task) {
|
||||
Assert.isTrue( !(item instanceof ContentBundle),
|
||||
"Cannot queue content bundle " + item );
|
||||
Assert.isTrue(!(item instanceof ContentBundle),
|
||||
"Cannot queue content bundle " + item);
|
||||
Assert.isTrue(item.isLiveVersion(), "Item is not live");
|
||||
|
||||
ACSObject parent = item.getParent();
|
||||
|
|
@ -374,12 +360,12 @@ public class QueueManager implements Runnable {
|
|||
String task,
|
||||
String destination) {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Queue " + task + " for " + item.getOID() + " on all hosts");
|
||||
s_log.debug("Queue " + task + " for " + item.getOID()
|
||||
+ " on all hosts");
|
||||
}
|
||||
|
||||
DestinationStub dest = PublishToFile.getDestination(
|
||||
item.getSpecificObjectType()
|
||||
);
|
||||
item.getSpecificObjectType());
|
||||
// No destination configured for this object type, lets
|
||||
// get outta here, since they obviously don't want to
|
||||
// p2fs it....
|
||||
|
|
@ -388,7 +374,7 @@ public class QueueManager implements Runnable {
|
|||
}
|
||||
|
||||
DomainCollection hosts = Host.retrieveAll();
|
||||
while ( hosts.next() ) {
|
||||
while (hosts.next()) {
|
||||
Host host = (Host) hosts.getDomainObject();
|
||||
|
||||
if (s_log.isDebugEnabled()) {
|
||||
|
|
@ -410,8 +396,7 @@ public class QueueManager implements Runnable {
|
|||
String destination,
|
||||
Host host) {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Queue item " + item + " for " +
|
||||
task + " on " + host);
|
||||
s_log.debug("Queue item " + item + " for " + task + " on " + host);
|
||||
}
|
||||
|
||||
QueueEntry q = QueueEntry.create(item,
|
||||
|
|
@ -425,8 +410,6 @@ public class QueueManager implements Runnable {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
// Routines from here down involved with processing the queue.
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* Start watching and processing the queue. This method spawns a
|
||||
* background thread that processes the queue. Queue processing starts
|
||||
|
|
@ -439,11 +422,12 @@ public class QueueManager implements Runnable {
|
|||
* has any entries.
|
||||
*/
|
||||
public static void startWatchingQueue(int startupDelay, int pollDelay) {
|
||||
if ( startupDelay > 0 ) {
|
||||
if (startupDelay > 0) {
|
||||
if (s_log.isInfoEnabled()) {
|
||||
s_log.info("Going to start queue processing.");
|
||||
}
|
||||
s_queueThread = new Thread( new QueueManager(startupDelay, pollDelay) );
|
||||
s_queueThread =
|
||||
new Thread(new QueueManager(startupDelay, pollDelay));
|
||||
s_queueThread.setDaemon(true);
|
||||
s_queueThread.setName("cms-p2fs-queue");
|
||||
s_queueThread.start();
|
||||
|
|
@ -464,8 +448,6 @@ public class QueueManager implements Runnable {
|
|||
s_keepWatchingQueue = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* Watch queue for entries to process. The main routine that starts
|
||||
* queue processing.
|
||||
|
|
@ -477,13 +459,12 @@ public class QueueManager implements Runnable {
|
|||
|
||||
HashSet failedItems = new HashSet();
|
||||
|
||||
while ( sleep(m_pollDelay) && s_keepWatchingQueue ) {
|
||||
while (sleep(m_pollDelay) && s_keepWatchingQueue) {
|
||||
// synchronized( Scheduler.class ) {
|
||||
//while there are more entries in queue process them.HashSet
|
||||
//is used to store the failed items and for checking that
|
||||
//they do not get processed again.
|
||||
while ( processQueueItems(failedItems) )
|
||||
;
|
||||
while (processQueueItems(failedItems));
|
||||
|
||||
// clear failed items
|
||||
failedItems.clear();
|
||||
|
|
@ -499,8 +480,8 @@ public class QueueManager implements Runnable {
|
|||
try {
|
||||
Thread.sleep(n * 1000);
|
||||
return true;
|
||||
} catch ( InterruptedException e ) {
|
||||
s_log.error( "Waiting was interrupted.");
|
||||
} catch (InterruptedException e) {
|
||||
s_log.error("Waiting was interrupted.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -525,11 +506,11 @@ public class QueueManager implements Runnable {
|
|||
s_log.warn("Ignoring uncaught exception", e);
|
||||
} finally {
|
||||
try {
|
||||
if ( query != null ) {
|
||||
if (query != null) {
|
||||
query.close();
|
||||
}
|
||||
|
||||
if ( txn.inTxn() ) {
|
||||
if (txn.inTxn()) {
|
||||
txn.abortTxn();
|
||||
s_log.info("Aborting transaction");
|
||||
}
|
||||
|
|
@ -548,7 +529,8 @@ public class QueueManager implements Runnable {
|
|||
* This method exists so that we can test p2fs without the
|
||||
* transaction management code.
|
||||
*/
|
||||
private static boolean processQueueItemsInternal(DataQuery query, HashSet failedItems) {
|
||||
private static boolean processQueueItemsInternal(DataQuery query,
|
||||
HashSet failedItems) {
|
||||
Host host = Web.getConfig().getCurrentHost();
|
||||
boolean hasMore = false;
|
||||
|
||||
|
|
@ -558,7 +540,7 @@ public class QueueManager implements Runnable {
|
|||
query.setParameter("maximumFailCount", s_maximumFailCount);
|
||||
|
||||
int entryCount = 0;
|
||||
while ( query.next() && entryCount < s_blockSize.intValue() ) {
|
||||
while (query.next() && entryCount < s_blockSize.intValue()) {
|
||||
DataObject dobj = (DataObject) query.get("queueEntry");
|
||||
QueueEntry qe = new QueueEntry(dobj);
|
||||
if (s_log.isDebugEnabled()) {
|
||||
|
|
@ -566,7 +548,7 @@ public class QueueManager implements Runnable {
|
|||
}
|
||||
|
||||
BigDecimal itemId = qe.getItemId();
|
||||
if ( !failedItems.contains(itemId) ) {
|
||||
if (!failedItems.contains(itemId)) {
|
||||
try {
|
||||
if (entryCount == 0) {
|
||||
// Tell the publish listener that we are about
|
||||
|
|
@ -580,17 +562,20 @@ public class QueueManager implements Runnable {
|
|||
s_publishListener.doTask(qe);
|
||||
|
||||
qe.delete(); // successfully processed item, delete from queue
|
||||
} catch ( PublishToFileException e ) {
|
||||
flagError(itemId, "PublishToFileException.", e, qe, failedItems);
|
||||
} catch ( Exception e ) {
|
||||
flagError(itemId, "Task " + qe + " failed:", e, qe, failedItems);
|
||||
} catch (PublishToFileException e) {
|
||||
flagError(itemId, "PublishToFileException.", e, qe,
|
||||
failedItems);
|
||||
} catch (Exception e) {
|
||||
flagError(itemId, "Task " + qe + " failed:", e, qe,
|
||||
failedItems);
|
||||
}
|
||||
entryCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if ( entryCount > 0 )
|
||||
if (entryCount > 0) {
|
||||
s_publishListener.transactionEnd();
|
||||
}
|
||||
|
||||
hasMore = !query.isAfterLast();
|
||||
|
||||
|
|
@ -598,19 +583,19 @@ public class QueueManager implements Runnable {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get items to process
|
||||
* @return Query for fetching block to process.
|
||||
*/
|
||||
static DataQuery getBlockQuery() {
|
||||
DataQuery query = SessionManager.getSession()
|
||||
.retrieveQuery("com.arsdigita.cms.publishToFile.getBlock");
|
||||
DataQuery query = SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.publishToFile.getBlock");
|
||||
|
||||
if ("GroupByParent".equals(s_blockSelectMethod))
|
||||
if ("GroupByParent".equals(s_blockSelectMethod)) {
|
||||
query.addOrder("queueEntry.parentId, queueEntry.sortOrder");
|
||||
else
|
||||
} else {
|
||||
query.addOrder("queueEntry.sortOrder");
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
|
|
@ -620,16 +605,13 @@ public class QueueManager implements Runnable {
|
|||
// Flag that queue entry failed
|
||||
failedItems.add(itemId);
|
||||
Long failCount = qe.getFailCount();
|
||||
s_log.error( exName + " itemId=" + itemId +
|
||||
" task=" + qe +
|
||||
" destination=" + qe.getDestination() + " failCount=" + failCount +
|
||||
" error=" + e.getMessage(), e);
|
||||
s_log.error(exName + " itemId=" + itemId + " task=" + qe
|
||||
+ " destination=" + qe.getDestination() + " failCount="
|
||||
+ failCount + " error=" + e.getMessage(), e);
|
||||
DataOperation operation = SessionManager.getSession().
|
||||
retrieveDataOperation(
|
||||
"com.arsdigita.cms.publishToFile.flagPublishFailed"
|
||||
);
|
||||
"com.arsdigita.cms.publishToFile.flagPublishFailed");
|
||||
operation.setParameter("id", qe.getID());
|
||||
operation.execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,13 +57,12 @@ import org.w3c.dom.Document;
|
|||
* @version $Id: XSLTemplate.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
*/
|
||||
public final class XSLTemplate {
|
||||
|
||||
public static final String versionId =
|
||||
"$Id: XSLTemplate.java 287 2005-02-22 00:29:02Z sskracic $" +
|
||||
"$Author: sskracic $" +
|
||||
"$DateTime: 2004/08/16 18:10:38 $";
|
||||
|
||||
"$Id: XSLTemplate.java 287 2005-02-22 00:29:02Z sskracic $"
|
||||
+ "$Author: sskracic $"
|
||||
+ "$DateTime: 2004/08/16 18:10:38 $";
|
||||
private static final Logger s_log = Logger.getLogger(XSLTemplate.class);
|
||||
|
||||
private final URL m_source;
|
||||
private final Templates m_templates;
|
||||
private final List m_dependents;
|
||||
|
|
@ -97,8 +96,8 @@ public final class XSLTemplate {
|
|||
factory.setURIResolver(resolver);
|
||||
factory.setErrorListener(listener);
|
||||
|
||||
m_templates = factory.newTemplates
|
||||
(resolver.resolve(m_source.toString(), null));
|
||||
m_templates = factory.newTemplates(resolver.resolve(m_source.
|
||||
toString(), null));
|
||||
|
||||
s_log.debug("Done getting new templates");
|
||||
} catch (TransformerConfigurationException ex) {
|
||||
|
|
@ -175,8 +174,8 @@ public final class XSLTemplate {
|
|||
final Result result,
|
||||
final ErrorListener listener) {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Transforming " + source + " and sending it to " +
|
||||
result + " using error listener " + listener);
|
||||
s_log.debug("Transforming " + source + " and sending it to "
|
||||
+ result + " using error listener " + listener);
|
||||
}
|
||||
|
||||
if (Assert.isEnabled()) {
|
||||
|
|
@ -189,9 +188,7 @@ public final class XSLTemplate {
|
|||
final Transformer transformer = newTransformer();
|
||||
transformer.setErrorListener(listener);
|
||||
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Transforming the XML source document");
|
||||
}
|
||||
|
||||
transformer.transform(source, result);
|
||||
|
||||
|
|
@ -268,14 +265,14 @@ public final class XSLTemplate {
|
|||
*/
|
||||
public final boolean isModified() {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Checking if the XSL files for " + this + " " +
|
||||
"have been modified and need to be re-read");
|
||||
s_log.debug("Checking if the XSL files for " + this + " "
|
||||
+ "have been modified and need to be re-read");
|
||||
}
|
||||
|
||||
final Iterator iter = m_dependents.iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
final URL url = Templating.transformURL((URL)iter.next());
|
||||
final URL url = Templating.transformURL((URL) iter.next());
|
||||
Assert.exists(url, URL.class);
|
||||
|
||||
if (url.getProtocol().equals("file")) {
|
||||
|
|
@ -283,16 +280,16 @@ public final class XSLTemplate {
|
|||
|
||||
if (file.lastModified() > m_created.getTime()) {
|
||||
if (s_log.isInfoEnabled()) {
|
||||
s_log.info("File " + file + " was modified " +
|
||||
file.lastModified());
|
||||
s_log.info("File " + file + " was modified " + file.
|
||||
lastModified());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("The URL is not to a file; assuming " +
|
||||
url + " is not modified");
|
||||
s_log.debug("The URL is not to a file; assuming " + url
|
||||
+ " is not modified");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -330,7 +327,7 @@ public final class XSLTemplate {
|
|||
|
||||
final Iterator sheets = getDependents().iterator();
|
||||
while (sheets.hasNext()) {
|
||||
URL xsl = (URL)sheets.next();
|
||||
URL xsl = (URL) sheets.next();
|
||||
if (xsl.getProtocol().equals(srcProto)) {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Outputting file " + xsl);
|
||||
|
|
@ -344,14 +341,15 @@ public final class XSLTemplate {
|
|||
|
||||
IO.copy(xsl.openStream(), zos);
|
||||
} else {
|
||||
s_log.warn("Not outputting file " + xsl +
|
||||
" because its not under protocol " + srcProto);
|
||||
s_log.warn("Not outputting file " + xsl
|
||||
+ " because its not under protocol " + srcProto);
|
||||
}
|
||||
}
|
||||
zos.finish();
|
||||
}
|
||||
|
||||
private static class Log4JErrorListener implements ErrorListener {
|
||||
|
||||
public void warning(TransformerException e) throws TransformerException {
|
||||
log(Level.WARN, e);
|
||||
}
|
||||
|
|
@ -360,13 +358,14 @@ public final class XSLTemplate {
|
|||
log(Level.ERROR, e);
|
||||
}
|
||||
|
||||
public void fatalError(TransformerException e) throws TransformerException {
|
||||
public void fatalError(TransformerException e) throws
|
||||
TransformerException {
|
||||
log(Level.FATAL, e);
|
||||
}
|
||||
|
||||
private static void log(Level level, TransformerException ex) {
|
||||
s_log.log(level, "Transformer " + level + ": " +
|
||||
ex.getLocationAsString() + ": " + ex.getMessage(),
|
||||
s_log.log(level, "Transformer " + level + ": " + ex.
|
||||
getLocationAsString() + ": " + ex.getMessage(),
|
||||
ex);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,15 +37,11 @@ import org.apache.log4j.Logger;
|
|||
public final class XMLConfig extends AbstractConfig {
|
||||
|
||||
public final static String versionId =
|
||||
"$Id: XMLConfig.java 1393 2006-11-28 09:12:32Z sskracic $" +
|
||||
"$Author: sskracic $" +
|
||||
"$DateTime: 2004/08/16 18:10:38 $";
|
||||
|
||||
private static final Logger s_log = Logger.getLogger
|
||||
(XMLConfig.class);
|
||||
|
||||
"$Id: XMLConfig.java 1393 2006-11-28 09:12:32Z sskracic $"
|
||||
+ "$Author: sskracic $"
|
||||
+ "$DateTime: 2004/08/16 18:10:38 $";
|
||||
private static final Logger s_log = Logger.getLogger(XMLConfig.class);
|
||||
private static XMLConfig s_config;
|
||||
|
||||
// supported XSL transformer implementations
|
||||
private static final String RESIN =
|
||||
"com.caucho.xsl.Xsl";
|
||||
|
|
@ -55,15 +51,15 @@ public final class XMLConfig extends AbstractConfig {
|
|||
"org.apache.xalan.xsltc.trax.TransformerFactoryImpl";
|
||||
private static final String SAXON =
|
||||
"com.icl.saxon.TransformerFactoryImpl";
|
||||
private static final String SAXON_HE =
|
||||
"net.sf.saxon.TransformerFactoryImpl";
|
||||
private static final String XALAN =
|
||||
"org.apache.xalan.processor.TransformerFactoryImpl";
|
||||
|
||||
// supported documentBuilder implementations
|
||||
private static final String DOM_XERCES =
|
||||
"org.apache.xerces.jaxp.DocumentBuilderFactoryImpl";
|
||||
private static final String DOM_RESIN =
|
||||
"com.caucho.xml.parsers.XmlDocumentBuilderFactory";
|
||||
|
||||
// supported SAX parser implementations
|
||||
private static final String SAX_XERCES =
|
||||
"org.apache.xerces.jaxp.SAXParserFactoryImpl";
|
||||
|
|
@ -84,22 +80,18 @@ public final class XMLConfig extends AbstractConfig {
|
|||
|
||||
return s_config;
|
||||
}
|
||||
|
||||
private final Parameter m_xfmr = new StringParameter
|
||||
("waf.xml.xsl_transformer", Parameter.REQUIRED, "saxon");
|
||||
|
||||
private final Parameter m_builder = new StringParameter
|
||||
("waf.xml.dom_builder", Parameter.REQUIRED, "xerces");
|
||||
|
||||
private final Parameter m_parser = new StringParameter
|
||||
("waf.xml.sax_parser", Parameter.REQUIRED, "xerces");
|
||||
|
||||
private Parameter m_activateFullTimeFormatter = new BooleanParameter
|
||||
("waf.xml.activate_full_date_formatter",
|
||||
Parameter.OPTIONAL, new Boolean(false));
|
||||
|
||||
|
||||
|
||||
private final Parameter m_xfmr = new StringParameter(
|
||||
"waf.xml.xsl_transformer", Parameter.REQUIRED, "saxon");
|
||||
private final Parameter m_builder = new StringParameter(
|
||||
"waf.xml.dom_builder", Parameter.REQUIRED, "xerces");
|
||||
private final Parameter m_parser = new StringParameter("waf.xml.sax_parser",
|
||||
Parameter.REQUIRED,
|
||||
"xerces");
|
||||
private Parameter m_activateFullTimeFormatter = new BooleanParameter(
|
||||
"waf.xml.activate_full_date_formatter",
|
||||
Parameter.OPTIONAL,
|
||||
new Boolean(
|
||||
false));
|
||||
|
||||
/**
|
||||
* Constructs an empty XMLConfig object following the singelton pattern.
|
||||
|
|
@ -108,7 +100,6 @@ public final class XMLConfig extends AbstractConfig {
|
|||
* it does not work with the associated classes AbstractConfig and
|
||||
* ConfigRegistry because they can currently not deal with a private constructor
|
||||
*/
|
||||
|
||||
// private XMLConfig() {
|
||||
public XMLConfig() {
|
||||
|
||||
|
|
@ -120,10 +111,7 @@ public final class XMLConfig extends AbstractConfig {
|
|||
loadInfo();
|
||||
}
|
||||
|
||||
|
||||
/* ************ public getter / setter section ************ */
|
||||
|
||||
|
||||
/**
|
||||
* Returns the XSL Transformer factory class name to use.
|
||||
*
|
||||
|
|
@ -136,13 +124,21 @@ public final class XMLConfig extends AbstractConfig {
|
|||
String m_key = (String) get(m_xfmr);
|
||||
|
||||
// Defined values: saxon (default)|jd.xslt|resin|xalan|xsltc
|
||||
if(m_key.toLowerCase().equals("xsltc")) return XSLTC;
|
||||
if(m_key.toLowerCase().equals("xalan")) return XALAN ;
|
||||
if(m_key.toLowerCase().equals("resin")) return RESIN;
|
||||
if(m_key.toLowerCase().equals("jd.xslt")) return JD_XSLT;
|
||||
if (m_key.toLowerCase().equals("xsltc")) {
|
||||
return XSLTC;
|
||||
} else if (m_key.toLowerCase().equals("xalan")) {
|
||||
return XALAN;
|
||||
} else if (m_key.toLowerCase().equals("resin")) {
|
||||
return RESIN;
|
||||
} else if (m_key.toLowerCase().equals("jd.xslt")) {
|
||||
return JD_XSLT;
|
||||
} else if (m_key.toLowerCase().equals("saxonhe")) {
|
||||
return SAXON_HE;
|
||||
} else {
|
||||
// return defaultValue
|
||||
return SAXON;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Document Builder factory class name to use
|
||||
|
|
@ -156,8 +152,11 @@ public final class XMLConfig extends AbstractConfig {
|
|||
String m_key = (String) get(m_builder);
|
||||
|
||||
// Defined values: xerces (default)|resin
|
||||
if(m_key.toLowerCase().equals("resin")) return DOM_RESIN;
|
||||
else return DOM_XERCES;
|
||||
if (m_key.toLowerCase().equals("resin")) {
|
||||
return DOM_RESIN;
|
||||
} else {
|
||||
return DOM_XERCES;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -172,8 +171,11 @@ public final class XMLConfig extends AbstractConfig {
|
|||
String m_key = (String) get(m_parser);
|
||||
|
||||
// Defined values: xerces (default)|resin
|
||||
if(m_key.toLowerCase().equals("resin")) return SAX_RESIN;
|
||||
else return SAX_XERCES;
|
||||
if (m_key.toLowerCase().equals("resin")) {
|
||||
return SAX_RESIN;
|
||||
} else {
|
||||
return SAX_XERCES;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -187,7 +189,6 @@ public final class XMLConfig extends AbstractConfig {
|
|||
* Sets the activateFullTimeFormatter flag.
|
||||
*/
|
||||
public void setActivateFullTimeFormatter(boolean activateFullTimeFormatter) {
|
||||
set (m_activateFullTimeFormatter,new Boolean(activateFullTimeFormatter));
|
||||
set(m_activateFullTimeFormatter, new Boolean(activateFullTimeFormatter));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ public class GreetingItem extends AbstractComponent {
|
|||
|
||||
public Element generateXML(HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
long start = System.currentTimeMillis();
|
||||
ContentItem item = (ContentItem) getObject();
|
||||
if (null == item || !item.isLive()) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ public class CompareFilter implements Filter {
|
|||
private final boolean allOption;
|
||||
private final boolean allOptionIsDefault;
|
||||
private final boolean propertyIsNumeric;
|
||||
private final boolean includeNull;
|
||||
private Map<String, Option> options = new LinkedHashMap<String, Option>();
|
||||
private String value;
|
||||
|
||||
|
|
@ -29,14 +28,13 @@ public class CompareFilter implements Filter {
|
|||
final String label,
|
||||
final boolean allOption,
|
||||
final boolean allOptionIsDefault,
|
||||
final boolean propertyIsNumeric,
|
||||
final boolean includeNull) {
|
||||
final boolean propertyIsNumeric
|
||||
) {
|
||||
this.property = property;
|
||||
this.label = label;
|
||||
this.allOption = allOption;
|
||||
this.allOptionIsDefault = allOptionIsDefault;
|
||||
this.propertyIsNumeric = propertyIsNumeric;
|
||||
this.includeNull = includeNull;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -45,14 +43,15 @@ public class CompareFilter implements Filter {
|
|||
}
|
||||
|
||||
public CompareFilter addOption(final String label, final String value) {
|
||||
return addOption(label, Operators.EQ, value);
|
||||
return addOption(label, Operators.EQ, value, false);
|
||||
}
|
||||
|
||||
public CompareFilter addOption(final String label,
|
||||
final Operators operator,
|
||||
final String value) {
|
||||
final String value,
|
||||
final boolean includeNull) {
|
||||
Option option;
|
||||
option = new Option(label, operator, value);
|
||||
option = new Option(label, operator, value, includeNull);
|
||||
options.put(label, option);
|
||||
return this;
|
||||
}
|
||||
|
|
@ -113,7 +112,7 @@ public class CompareFilter implements Filter {
|
|||
filter.append('\'');
|
||||
}
|
||||
|
||||
if (includeNull) {
|
||||
if (selectedOption.getIncludeNull()) {
|
||||
filter.append(String.format(" or %s is null", property));
|
||||
}
|
||||
|
||||
|
|
@ -173,13 +172,16 @@ public class CompareFilter implements Filter {
|
|||
private final String label;
|
||||
private final Operators operator;
|
||||
private final String value;
|
||||
private final boolean includeNull;
|
||||
|
||||
public Option(final String label,
|
||||
final Operators operator,
|
||||
final String value) {
|
||||
final String value,
|
||||
final boolean includeNull) {
|
||||
this.label = label;
|
||||
this.operator = operator;
|
||||
this.value = value;
|
||||
this.includeNull = includeNull;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
|
|
@ -193,5 +195,9 @@ public class CompareFilter implements Filter {
|
|||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public boolean getIncludeNull() {
|
||||
return includeNull;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,16 +142,14 @@ public class CustomizableObjectList extends ComplexObjectList {
|
|||
final String label,
|
||||
final boolean allOption,
|
||||
final boolean allOptionIsDefault,
|
||||
final boolean propertyIsNumeric,
|
||||
final boolean includeNull) {
|
||||
final boolean propertyIsNumeric) {
|
||||
CompareFilter filter;
|
||||
|
||||
filter = new CompareFilter(property,
|
||||
label,
|
||||
allOption,
|
||||
allOptionIsDefault,
|
||||
propertyIsNumeric,
|
||||
includeNull);
|
||||
propertyIsNumeric);
|
||||
filters.put(label, filter);
|
||||
|
||||
return filter;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<xrd:attributes rule="exclude">
|
||||
<xrd:property name="/object/organizationDescription"/>
|
||||
</xrd:attributes>
|
||||
<xrd:associations rule="include">
|
||||
<!--<xrd:associations rule="include">
|
||||
<xrd:property name="/object/addendum"/>
|
||||
<xrd:property name="/object/contacts"/>
|
||||
<xrd:property name="/object/contacts/person"/>
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
<xrd:property name="/object/persons/contacts"/>
|
||||
<xrd:property name="/object/persons/contacts/address"/>
|
||||
<xrd:property name="/object/persons/contacts/contactentries"/>
|
||||
</xrd:associations>
|
||||
</xrd:associations>-->
|
||||
</xrd:adapter>
|
||||
</xrd:context>
|
||||
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@
|
|||
now.get(java.util.GregorianCalendar.DATE));
|
||||
|
||||
objList.addCompareFilter("projectend", "projectstatus", true, true, false)
|
||||
.addOption("ongoing", CompareFilter.Operators.GTEQ, today)
|
||||
.addOption("finished", CompareFilter.Operators.LT, today);
|
||||
.addOption("ongoing", CompareFilter.Operators.GTEQ, today, true)
|
||||
.addOption("finished", CompareFilter.Operators.LT, today, false);
|
||||
objList.addSortField("title", "title asc");
|
||||
objList.getDefinition().addOrder(objList.getOrder(request.getParameter("sort")));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue