true if this SiteNode can have children; false otherwise.
+ * @return true if this SiteNode can have children;
+ * false otherwise.
*/
public boolean isDirectory() {
return ((Boolean) (get("isDirectory"))).booleanValue();
}
/**
- * @return true if the SiteNode supports patterns; false otherwise.
+ * @return true if the SiteNode supports patterns;
+ * false otherwise.
* @deprecated
*/
public boolean isPattern() {
@@ -450,11 +457,31 @@ public class SiteNode extends ACSObject {
}
+ /**
+ *
+ * @param locale
+ * @param outputType
+ * @return
+ * @deprecated without direct replacement. It is designed to work with
+ * {@link com.arsdigita.templating.LegacyStylesheetResolver} which is
+ * replaced by {@link com.arsdigita.templating.PatternStylesheetResolver}.
+ * So thes method is just not used anymore. (pboy)
+ */
public Stylesheet[] getStylesheets(Locale locale, String outputType) {
return StyleAssociation
.getStylesheets(get("defaultStyle"), locale, outputType);
}
+ /**
+ *
+ * @param locale
+ * @param outputType
+ * @return
+ * @deprecated without direct replacement. It is design wo work with
+ * {@link com.arsdigita.templating.LegacyStylesheetResolver} which is
+ * replaced by {@link com.arsdigita.templating.PatternStylesheetResolver}.
+ * So this method is just not used anymore. (pboy)
+ */
public Stylesheet getStylesheet(Locale locale, String outputType) {
return StyleAssociation
.getStylesheet(get("defaultStyle"), locale, outputType);
diff --git a/ccm-core/src/com/arsdigita/kernel/StyleAssociation.java b/ccm-core/src/com/arsdigita/kernel/StyleAssociation.java
index e5d336a54..c0c07b1cb 100755
--- a/ccm-core/src/com/arsdigita/kernel/StyleAssociation.java
+++ b/ccm-core/src/com/arsdigita/kernel/StyleAssociation.java
@@ -30,8 +30,16 @@ import java.util.ArrayList;
import org.apache.log4j.Logger; // for logging
+/**
+ *
+ * @version $Id: StyleAssociation.java 287 2005-02-22 00:29:02Z sskracic $
+ *
+ * @deprecated without direct replacement. It is designed to work with
+ * {@link com.arsdigita.templating.LegacyStylesheetResolver} which is
+ * replaced by {@link com.arsdigita.templating.PatternStylesheetResolver}.
+ * So thes method is just not used anymore. (pboy)
+ */
public class StyleAssociation {
- public static final String versionId = "$Id: StyleAssociation.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
/** this class is static-only */
private StyleAssociation() {};
@@ -39,14 +47,16 @@ public class StyleAssociation {
private static final Logger s_cat =
Logger.getLogger(StyleAssociation.class.getName());
- /** Gets an array with all applicable stylesheets.
- * @param style a DataAssociation that is the result from get("defaultStylesheet")
- * @param locale the locale of the request
- * @param outputType the desired type of output (HTML, WML, XML, and so on)
+ /**
+ * Gets an array with all applicable stylesheets.
+ * @param style a DataAssociation that is the result from get("defaultStylesheet")
+ * @param locale the locale of the request
+ * @param outputType the desired type of output (HTML, WML, XML, and so on)
*
- * @return an array with all applicable stylesheets.
+ * @return an array with all applicable stylesheets.
*
- * @pre style != null && style instanceof DataAssociation
+ * @pre style != null && style instanceof DataAssociation
+ * @deprecated see above
*/
public static Stylesheet[] getStylesheets(Object style,
Locale locale,
@@ -131,6 +141,7 @@ public class StyleAssociation {
* @return the first stylesheet associated with this object.
*
* @pre style != null && style instanceof DataAssociation
+ * @deprecated see above
*/
public static Stylesheet getStylesheet(Object style,
Locale locale,
diff --git a/ccm-core/src/com/arsdigita/kernel/Stylesheet.java b/ccm-core/src/com/arsdigita/kernel/Stylesheet.java
index bacb50b34..40332d685 100755
--- a/ccm-core/src/com/arsdigita/kernel/Stylesheet.java
+++ b/ccm-core/src/com/arsdigita/kernel/Stylesheet.java
@@ -60,10 +60,12 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
+/**
+ *
+ * @version $Id: Stylesheet.java 287 2005-02-22 00:29:02Z sskracic $
+ */
public class Stylesheet extends ACSObject implements Templates {
- public static final String versionId = "$Id: Stylesheet.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
-
/** Composite of a String and a boolean. The boolean defaults to false.
* We use it to keep track of all XSL Files and which of them are valid.
*/
@@ -501,7 +503,8 @@ public class Stylesheet extends ACSObject implements Templates {
// Saxon requires full path info
if(usingSaxon())
{
- String pathname = rm.getResourceAsFile(getPath()).getAbsolutePath();
+ String pathname = rm.getResourceAsFile(getPath())
+ .getAbsolutePath();
ssSource.setSystemId(pathname);
}
m_lastModified = System.currentTimeMillis();
@@ -524,10 +527,11 @@ public class Stylesheet extends ACSObject implements Templates {
if (tfact == null) {
tfact = TransformerFactory.newInstance();
if (usingXSLTC()) {
- //disable template inlining, otherwise xsltc might generate methods
- //that are too long, or contain jump offsets that are too large for
- //the JVM to handle for more details see "Known problems for XSLTC
- //Translets - http://xml.apache.org/xalan-j/xsltc_constraints.html#xsltcknownproblems
+ //disable template inlining, otherwise xsltc might generate
+ //methods that are too long, or contain jump offsets that
+ //are too large for the JVM to handle.
+ //For more details see "Known problems for XSLTC Translets -
+ //http://xml.apache.org/xalan-j/xsltc_constraints.html#xsltcknownproblems
tfact.setAttribute("disable-inlining", new Boolean(true));
s_cat.info("set disable-inlining to true for XSLSTC");
tfact.setErrorListener(new ErrorListener() {
diff --git a/ccm-core/src/com/arsdigita/portal/Initializer.java b/ccm-core/src/com/arsdigita/portal/Initializer.java
index 42dd5960e..1aab2ac4a 100755
--- a/ccm-core/src/com/arsdigita/portal/Initializer.java
+++ b/ccm-core/src/com/arsdigita/portal/Initializer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
+ * Copyright (C) 2010 pboy (pboy@barkhof.uni-bremen.de) All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -16,49 +16,77 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
+
+
package com.arsdigita.portal;
-import com.arsdigita.kernel.ACSObjectInstantiator;
-import com.arsdigita.initializer.Configuration;
-import com.arsdigita.initializer.InitializationException;
-import com.arsdigita.persistence.DataObject;
import com.arsdigita.domain.DomainObject;
-import com.arsdigita.domain.DomainObjectFactory;
+// import com.arsdigita.domain.DomainObjectInstantiator;
+import com.arsdigita.kernel.ACSObjectInstantiator;
+import com.arsdigita.persistence.DataObject;
+import com.arsdigita.runtime.CompoundInitializer;
+import com.arsdigita.runtime.DomainInitEvent;
+
import org.apache.log4j.Logger;
-/**
- *
- *
- * Initializes the portal package.
- *
- * @author Justin Ross
- * @version $Id: Initializer.java 738 2005-09-01 12:36:52Z sskracic $
- */
-public class Initializer implements com.arsdigita.initializer.Initializer {
+/**
+ * Initializes the core portal package.
+ *
+ * Initializer is invoked by the add-method in the core initializer.
+ *
+ * @author pb
+ * @version $Id: $
+ */
+// Not shure if this initializeris realy needed. In a short test - commenting
+// the initializer out - made no difference. (pboy-2011-01-09)
+public class Initializer extends CompoundInitializer {
+
+ /** Creates a s_logging category with name = to the full name of class */
private static Logger s_log = Logger.getLogger(Initializer.class);
- private Configuration m_conf = new Configuration();
+ // Currently no configuration options for portlets available
+ //private static PortalConfig s_conf= PortalConfig.getConfig();
- public Initializer() throws InitializationException {
- /* Empty */
+ /**
+ *
+ */
+ public Initializer() {
}
- public Configuration getConfiguration() {
- return m_conf;
- }
+ /**
+ * Initializes domain-coupling machinery, usually consisting of
+ * registering object instantiators and observers.
+ *
+ */
+ public void init(DomainInitEvent e) {
+ s_log.debug("publishToFile.Initializer.init(DomainInitEvent) invoked");
- public void startup() {
+ // Recursive invokation of init, is it really necessary??
+ // On the other hand:
+ // An empty implementations prevents this initializer from being executed.
+ // A missing implementations causes the super class method to be executed,
+ // which invokes the above added LegacyInitializer.
+ // If super is not invoked, various other cms sub-initializer may not run.
+ super.init(e);
+
+ /* From old Initializer system
DomainObjectFactory.registerInstantiator
(Portal.BASE_DATA_OBJECT_TYPE, new ACSObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) {
return new Portal(dataObject);
}
});
- }
+ */
+ e.getFactory().registerInstantiator
+ (Portal.BASE_DATA_OBJECT_TYPE,
+ new ACSObjectInstantiator() {
+ @Override
+ public DomainObject doNewInstance(DataObject dataObject) {
+ return new Portal(dataObject);
+ }
+ });
- public void shutdown() {
- /* Empty */
+ s_log.debug("publishToFile.Initializer.init(DomainInitEvent) completed");
}
-
}
diff --git a/ccm-core/src/com/arsdigita/portal/LegacyInitializer.java.nolongerInUse b/ccm-core/src/com/arsdigita/portal/LegacyInitializer.java.nolongerInUse
new file mode 100755
index 000000000..b147d6d29
--- /dev/null
+++ b/ccm-core/src/com/arsdigita/portal/LegacyInitializer.java.nolongerInUse
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.portal;
+
+import com.arsdigita.kernel.ACSObjectInstantiator;
+import com.arsdigita.initializer.Configuration;
+import com.arsdigita.initializer.InitializationException;
+import com.arsdigita.persistence.DataObject;
+import com.arsdigita.domain.DomainObject;
+import com.arsdigita.domain.DomainObjectFactory;
+import org.apache.log4j.Logger;
+
+
+// //////////////////////////////////////////////////
+// Replaced by NEW Initializer.
+// Kept for the time of migration for easy reference.
+// Will be removed later.
+// //////////////////////////////////////////////////
+
+/**
+ *
+ *
+ * Initializes the portal package.
+ *
+ * @author Justin Ross
+ * @version $Id: LegacyInitializer.java 738 2005-09-01 12:36:52Z sskracic $
+ */
+public class LegacyInitializer implements com.arsdigita.initializer.Initializer {
+
+ private static Logger s_log = Logger.getLogger(LegacyInitializer.class);
+
+ private Configuration m_conf = new Configuration();
+
+ public LegacyInitializer() throws InitializationException {
+ /* Empty */
+ }
+
+ public Configuration getConfiguration() {
+ return m_conf;
+ }
+
+ public void startup() {
+ DomainObjectFactory.registerInstantiator
+ (Portal.BASE_DATA_OBJECT_TYPE, new ACSObjectInstantiator() {
+ public DomainObject doNewInstance(DataObject dataObject) {
+ return new Portal(dataObject);
+ }
+ });
+ }
+
+ public void shutdown() {
+ /* Empty */
+ }
+
+}
diff --git a/ccm-core/src/com/arsdigita/runtime/AbstractConfig.java b/ccm-core/src/com/arsdigita/runtime/AbstractConfig.java
index c2784631f..4333f3113 100755
--- a/ccm-core/src/com/arsdigita/runtime/AbstractConfig.java
+++ b/ccm-core/src/com/arsdigita/runtime/AbstractConfig.java
@@ -81,8 +81,7 @@ public abstract class AbstractConfig extends AbstractParameterContext {
/**
* Default constructor for subclasses.
- **/
-
+ */
protected AbstractConfig() {}
/**
@@ -98,8 +97,7 @@ public abstract class AbstractConfig extends AbstractParameterContext {
* unmarshaling and loading.
*
* @see ConfigRegistry
- **/
-
+ */
public final void load(ErrorList errors) {
ConfigRegistry reg = new ConfigRegistry();
reg.load(this, errors);
@@ -122,8 +120,7 @@ public abstract class AbstractConfig extends AbstractParameterContext {
* configuration loading.
*
* @see #load(ErrorList)
- **/
-
+ */
public final ErrorList load() {
ErrorList errs = new ErrorList();
load(errs);
@@ -132,16 +129,14 @@ public abstract class AbstractConfig extends AbstractParameterContext {
/**
* @deprecated Use @{link #load()} instead.
- **/
-
+ */
public final ErrorList load(final String resource) {
return load();
}
/**
* @deprecated Use @{link #load()} instead.
- **/
-
+ */
public final ErrorList require(final String resource) {
return load();
}
diff --git a/ccm-core/src/com/arsdigita/runtime/RuntimeConfig.java b/ccm-core/src/com/arsdigita/runtime/RuntimeConfig.java
index bc4f687b1..cdb2723e5 100755
--- a/ccm-core/src/com/arsdigita/runtime/RuntimeConfig.java
+++ b/ccm-core/src/com/arsdigita/runtime/RuntimeConfig.java
@@ -68,7 +68,6 @@ public final class RuntimeConfig extends AbstractConfig {
* Constructs an empty RuntimeConfig object.
*
*/
-
public RuntimeConfig() {
// pboy: According to the comment for the getConfig() method a singleton
// pattern is to be used. Therefore the constructor must be changed to
@@ -91,10 +90,10 @@ public final class RuntimeConfig extends AbstractConfig {
m_resultSetWindowSize = new IntegerParameter
("waf.runtime.jdbc_resultset_windowsize", Parameter.REQUIRED,
new Integer(1));
- m_runBackgroundTasks = new BooleanParameter
- ("waf.runtime.run_background_tasks",
- Parameter.REQUIRED,
- Boolean.TRUE);
+ m_runBackgroundTasks = new BooleanParameter
+ ("waf.runtime.run_background_tasks",
+ Parameter.REQUIRED,
+ Boolean.TRUE);
register(m_url);
register(m_poolSize);
diff --git a/ccm-core/src/com/arsdigita/sitenode/BasePresentationManager.java b/ccm-core/src/com/arsdigita/sitenode/BasePresentationManager.java.nolongerInUse
similarity index 94%
rename from ccm-core/src/com/arsdigita/sitenode/BasePresentationManager.java
rename to ccm-core/src/com/arsdigita/sitenode/BasePresentationManager.java.nolongerInUse
index c1438bd6c..74105029b 100755
--- a/ccm-core/src/com/arsdigita/sitenode/BasePresentationManager.java
+++ b/ccm-core/src/com/arsdigita/sitenode/BasePresentationManager.java.nolongerInUse
@@ -72,10 +72,12 @@ import org.apache.log4j.Logger;
* do the same tree walk except we'll look for the stylesheet
* associated with the package mounted on each site node.
*
- * @deprecated Use {@link com.arsdigita.templating.SimplePresentationManager} instead.
- *
* @author Bill Schneider
* @version $Id: BasePresentationManager.java 562 2005-06-12 23:53:19Z apevec $
+ *
+ * @deprecated Use {@link com.arsdigita.templating.SimplePresentationManager} instead.
+ * SimplePresentationManager is deprecated as well, use
+ * {@link com.arsdigita.bebop.page.PageTransformer} instead!
*/
public class BasePresentationManager implements PresentationManager {
@@ -172,6 +174,11 @@ public class BasePresentationManager implements PresentationManager {
* the default stylesheet for the mounted package on this site node,
* or the default stylesheets for the packages mounted on ancestors
* of this site node. (lowest precedence)
+ *
+ * @deprecated without direct replacement. It is design wo work with
+ * {@link com.arsdigita.templating.LegacyStylesheetResolver} which is
+ * replaced by {@link com.arsdigita.templating.PatternStylesheetResolver}.
+ * So this method is just not used anymore. (pboy)
*/
protected Stylesheet findStylesheet(SiteNodeRequestContext rctx) {
return findStylesheet(rctx.getSiteNode(),
@@ -192,6 +199,11 @@ public class BasePresentationManager implements PresentationManager {
* the default stylesheet for the mounted package on this site node,
* or the default stylesheets for the packages mounted on ancestors
* of this site node. (lowest precedence)
+ *
+ * @deprecated without direct replacement. It is design wo work with
+ * {@link com.arsdigita.templating.LegacyStylesheetResolver} which is
+ * replaced by {@link com.arsdigita.templating.PatternStylesheetResolver}.
+ * So this method is just not used anymore. (pboy)
*/
protected synchronized Stylesheet findStylesheet
(SiteNode sn, Locale l, String outputType) {
@@ -214,6 +226,18 @@ public class BasePresentationManager implements PresentationManager {
return stylesheet;
}
+ /**
+ *
+ * @param sn
+ * @param l
+ * @param outputType
+ * @return
+ *
+ * @deprecated without direct replacement. It is design wo work with
+ * {@link com.arsdigita.templating.LegacyStylesheetResolver} which is
+ * replaced by {@link com.arsdigita.templating.PatternStylesheetResolver}.
+ * So this method is just not used anymore. (pboy)
+ */
private Stylesheet findStylesheetHelper(SiteNode sn,
Locale l,
String outputType) {
diff --git a/ccm-core/src/com/arsdigita/sitenode/package.html b/ccm-core/src/com/arsdigita/sitenode/package.html
index 5d6832198..589e8d11a 100755
--- a/ccm-core/src/com/arsdigita/sitenode/package.html
+++ b/ccm-core/src/com/arsdigita/sitenode/package.html
@@ -3,7 +3,7 @@
Provides a Dispatcher implementation that is backed by the "Site Map" of SiteNode domain objects. The reason this package is not part of the diff --git a/ccm-core/src/com/arsdigita/templating/ApplicationOIDPatternGenerator.java b/ccm-core/src/com/arsdigita/templating/ApplicationOIDPatternGenerator.java index d226e55d5..e0b84edac 100755 --- a/ccm-core/src/com/arsdigita/templating/ApplicationOIDPatternGenerator.java +++ b/ccm-core/src/com/arsdigita/templating/ApplicationOIDPatternGenerator.java @@ -18,7 +18,6 @@ */ package com.arsdigita.templating; -import com.arsdigita.templating.PatternGenerator; import com.arsdigita.web.Web; import com.arsdigita.web.Application; diff --git a/ccm-core/src/com/arsdigita/templating/LegacyStylesheetResolver.java b/ccm-core/src/com/arsdigita/templating/LegacyStylesheetResolver.java index 3edcfddfd..b061a0178 100755 --- a/ccm-core/src/com/arsdigita/templating/LegacyStylesheetResolver.java +++ b/ccm-core/src/com/arsdigita/templating/LegacyStylesheetResolver.java @@ -37,14 +37,11 @@ import org.apache.log4j.Logger; * using the old packagetype <-> stylesheet and sitenode <-> stylesheet * mappings in the database. *
+ * @version $Id: LegacyStylesheetResolver.java 287 2005-02-22 00:29:02Z sskracic $ * * @deprecated use {@link PatternStylesheetResolver} in new code. */ public class LegacyStylesheetResolver implements StylesheetResolver { - public static final String versionId = - "$Id: LegacyStylesheetResolver.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 (LegacyStylesheetResolver.class); diff --git a/ccm-core/src/com/arsdigita/templating/SimplePresentationManager.java b/ccm-core/src/com/arsdigita/templating/SimplePresentationManager.java index 5da0861e3..2e05204cb 100755 --- a/ccm-core/src/com/arsdigita/templating/SimplePresentationManager.java +++ b/ccm-core/src/com/arsdigita/templating/SimplePresentationManager.java @@ -19,10 +19,24 @@ package com.arsdigita.templating; /** - * @deprecated Use {@link com.arsdigita.bebop.page.PageTransformer} + * An Implementation of a Presentation Manager as specified by the + * {@link PresentationManager} interface which may be used as a default. + * + * As bebop is currently the only one providing a presenation layer it simply + * links to the bebop implementation. At the same time it makes shure an + * implementation exists which can be used as default in the templating + * configuration registry. + */ +/* NON Javadoc comment: + * Used to be depracated in version 6.6.0. Reverted to non-deprecated in version + * 6.6.0 release 3. Package templating provides the basic mechanism for CCM + * templating system an should provide an implementation of the Presentation + * Manager interface to be complete. + * @ deprecated Use {@link com.arsdigita.bebop.page.PageTransformer} * instead */ public class SimplePresentationManager - extends com.arsdigita.bebop.page.PageTransformer { + extends com.arsdigita.bebop.page.PageTransformer + implements PresentationManager{ // Empty } diff --git a/ccm-core/src/com/arsdigita/templating/SimpleURIResolver.java b/ccm-core/src/com/arsdigita/templating/SimpleURIResolver.java index 747f0bc12..f8884be86 100755 --- a/ccm-core/src/com/arsdigita/templating/SimpleURIResolver.java +++ b/ccm-core/src/com/arsdigita/templating/SimpleURIResolver.java @@ -39,12 +39,10 @@ import org.apache.log4j.Logger; * all the URLs that have been loaded. If you set this as the URI * resolver for a Transformer then this will track all the *xsl:import and xsl:include statements.
+ *
+ * @version $Id: SimpleURIResolver.java 287 2005-02-22 00:29:02Z sskracic $
*/
final class SimpleURIResolver implements URIResolver {
- public static final String versionId =
- "$Id: SimpleURIResolver.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
(SimpleURIResolver.class);
diff --git a/ccm-core/src/com/arsdigita/templating/Templating.java b/ccm-core/src/com/arsdigita/templating/Templating.java
index 396cb86ec..3883455c0 100755
--- a/ccm-core/src/com/arsdigita/templating/Templating.java
+++ b/ccm-core/src/com/arsdigita/templating/Templating.java
@@ -14,13 +14,12 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
*/
package com.arsdigita.templating;
-import com.arsdigita.bebop.Bebop; // XXX Blech
-import com.arsdigita.kernel.Kernel;
+import com.arsdigita.bebop.Bebop;
import com.arsdigita.caching.CacheTable;
+import com.arsdigita.kernel.Kernel;
import com.arsdigita.util.Assert;
import com.arsdigita.util.ExceptionUnwrapper;
import com.arsdigita.util.Exceptions;
@@ -49,9 +48,8 @@ import org.apache.log4j.Logger;
/**
* An entry-point class for the functions of the templating package.
*
- * This class maintains a cache of XSLTemplate objects,
- * managed via the getTemplate and
- * purgeTemplate methods.
+ * This class maintains a cache of XSLTemplate objects, managed
+ * via the getTemplate and purgeTemplate methods.
*
* @author Dan Berrange
* @author Justin Ross <jross@redhat.com>
@@ -61,9 +59,9 @@ public class Templating {
private static final Logger s_log = Logger.getLogger(Templating.class);
- // XXX eliminate these?
- public static final Class DEFAULT_PRESENTATION_MANAGER
- = SimplePresentationManager.class;
+ // just a tag to assure an implementation exists
+// public static final Class DEFAULT_PRESENTATION_MANAGER
+// = SimplePresentationManager.class;
/**
* This is the name of the attribute that is set in the request whose
@@ -115,54 +113,59 @@ public class Templating {
}
/**
- * Returns a new instance of the current presentation manager
- * class. This is an object which has the {@link
- * PresentationManager} interface which can be used to transform
- * an XML document into an output stream.
+ * Returns a new instance of the current presentation manager class. This is
+ * an object which has the {@link com.arsdigita.templating.PresentationManager
+ * PresentationManager} interface which can be used to transform an XML
+ * document into an output stream.
+ *
+ * As of v ersion 6.6.0 the bebop framework is the only instance to provide
+ * an implementation. To avoid class hierachie kludge we directly return the
+ * bebop config here.
*
- * @deprecated Use {@link
- * com.arsdigita.bebop.BebopConfig#getPresentationManager()}
- * instead.
* @return an instance of the PresentationManager
* interface
*/
+ /* NON Javadoc
+ * Used to be deprecated up to version 6.6.0. Reverted to non-deprecated.
+ * Package templating provides the basic mechanism for CCM templating
+ * machinerie and provides the Presentation Manager interface. It should be
+ * able to be queried for an implementation as well.
+ * @ deprecated Use {@link
+ * com.arsdigita.bebop.BebopConfig#getPresentationManager()}
+ * instead.
+ */
public static PresentationManager getPresentationManager() {
- // XXX Very broken dependency.
return Bebop.getConfig().getPresentationManager();
}
/**
- * Retrieves an XSL template. If the template is already loaded in
- * the cache, it will be returned. If the template has been
- * modified since it was first generated, it will be regenerated
- * first.
+ * Retrieves an XSL template. If the template is already loaded in the
+ * cache, it will be returned. If the template has been modified since
+ * it was first generated, it will be regenerated first.
*
- * @param source the URL to the top-level template
- * resource
+ * @param source the URL to the top-level template resource
* @return an XSLTemplate instance representing
- * source
+ * source
*/
public static synchronized XSLTemplate getTemplate(final URL source) {
return getTemplate(source, false, true);
}
/**
- * Retrieves an XSL template. If the template is already loaded in
- * the cache, it will be returned. If the template has been
- * modified since it was first generated, it will be regenerated
- * first.
+ * Retrieves an XSL template. If the template is already loaded in the
+ * cache, it will be returned. If the template has been modified since
+ * it was first generated, it will be regenerated first.
*
- * @param source the URL to the top-level template
- * resource
- * @param fancyErrors Should this place any xsl errors in the request
+ * @param source the URL to the top-level template resource
+ * @param fancyErrors Should this place any xsl errors in the request
* for use by another class. If this is true, the
* the errors are stored for later use.
- * @param useCache Should the templates be pulled from cache, if available?
+ * @param useCache Should the templates be pulled from cache, if available?
* True means they are pulled from cache. False means
* they are pulled from the disk. If this is false
* the pages are also not placed in the cache.
* @return an XSLTemplate instance representing
- * source
+ * source
*/
public static synchronized XSLTemplate getTemplate(final URL source,
boolean fancyErrors,
@@ -226,7 +229,7 @@ public class Templating {
/**
* Resolves and retrieves the template for the given request.
*
- * @param sreq The current request object
+ * @param sreq The current request object
* @return The resolved XSLTemplate instance
*/
public static XSLTemplate getTemplate(final HttpServletRequest sreq) {
diff --git a/ccm-core/src/com/arsdigita/templating/TemplatingConfig.java b/ccm-core/src/com/arsdigita/templating/TemplatingConfig.java
index 80cf3b34d..926931d7d 100755
--- a/ccm-core/src/com/arsdigita/templating/TemplatingConfig.java
+++ b/ccm-core/src/com/arsdigita/templating/TemplatingConfig.java
@@ -34,28 +34,31 @@ public final class TemplatingConfig extends AbstractConfig {
private static final Logger s_log = Logger.getLogger
(TemplatingConfig.class);
- private final Parameter m_paths;
- private final Parameter m_resolver;
- private final Parameter m_cacheSize;
- private final Parameter m_cacheAge;
-
- public TemplatingConfig() {
- m_paths = new StringParameter
+ /** Fully qualified path string to file contain the pattern file for
+ {@link com.arsdigita.templating.PatternStylesheetResolver
+ PatternStylesheetResolver} */
+ private final Parameter m_paths = new StringParameter
("waf.templating.stylesheet_paths", Parameter.REQUIRED,
"/WEB-INF/resources/stylesheet-paths.txt");
- m_resolver = new SingletonParameter
+ /** Specifies class for the implementation of StylesheetResolver Interface
+ to resolve a modules stylesheet. */
+ private final Parameter m_resolver = new SingletonParameter
("waf.templating.stylesheet_resolver", Parameter.REQUIRED,
new PatternStylesheetResolver());
- m_cacheSize = new IntegerParameter
+ /** Specifies number of stylesheets cached. */
+ private final Parameter m_cacheSize = new IntegerParameter
("waf.templating.stylesheet_cache_size", Parameter.OPTIONAL,
null);
- m_cacheAge = new IntegerParameter
+ /** Duration of stylesheet cache in seconds */
+ private final Parameter m_cacheAge = new IntegerParameter
("waf.templating.stylesheet_cache_age", Parameter.OPTIONAL,
null);
+ public TemplatingConfig() {
+
register(m_paths);
register(m_resolver);
register(m_cacheSize);
@@ -64,6 +67,11 @@ public final class TemplatingConfig extends AbstractConfig {
loadInfo();
}
+ /**
+ * Get name and location of stylesheet pattern file.
+ *
+ * @return String with fully qualified file name
+ */
final String getStylesheetPaths() {
return (String) get(m_paths);
}
diff --git a/ccm-core/src/com/arsdigita/ui/Initializer.java b/ccm-core/src/com/arsdigita/ui/Initializer.java
index cd8f6237c..786033ece 100755
--- a/ccm-core/src/com/arsdigita/ui/Initializer.java
+++ b/ccm-core/src/com/arsdigita/ui/Initializer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
+ * Copyright (C) 2010 pboy (pboy@barkhof.uni-bremen.de) All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -16,47 +16,63 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
+
package com.arsdigita.ui;
-import com.arsdigita.initializer.Configuration;
-import org.apache.log4j.Logger;
+// import com.arsdigita.domain.DomainObject;
+// import com.arsdigita.domain.DomainObjectInstantiator;
+// import com.arsdigita.kernel.ACSObjectInstantiator;
+// import com.arsdigita.persistence.DataObject;
+// import com.arsdigita.runtime.CompoundInitializer;
+import com.arsdigita.runtime.ContextInitEvent;
+import com.arsdigita.runtime.ConfigError;
+
import java.util.Iterator;
import java.util.List;
-import com.arsdigita.initializer.InitializationException;
+import org.apache.log4j.Logger;
+/**
+ * Initializes the core ui package.
+ *
+ * Initializer is invoked by the add-method in the core initializer.
+ *
+ * @author pb
+ * @version $Id: $
+ */
+// public class Initializer extends CompoundInitializer {
+public class Initializer extends com.arsdigita.runtime.GenericInitializer {
-public class Initializer implements com.arsdigita.initializer.Initializer {
+ /** Creates a s_logging category with name = to the full name of class */
+ private static Logger s_log = Logger.getLogger(Initializer.class);
- private Configuration m_conf = new Configuration();
- private static final Logger s_log =
- Logger.getLogger(Initializer.class);
-
- public static final String DEFAULT_LAYOUT = "defaultLayout";
- public static final String APPLICATION_LAYOUTS = "applicationLayouts";
+ /** Config object for the UI package */
+ private static UIConfig s_conf = UIConfig.getConfig();
+ // s_log.debug("ui configuration loaded.");
+ /**
+ *
+ */
public Initializer() {
- m_conf.initParameter
- (DEFAULT_LAYOUT,
- "The default layout for the SimplePage class",
- List.class);
- m_conf.initParameter
- (APPLICATION_LAYOUTS,
- "The customized layout for applications using the SimplePage class",
- List.class);
-
}
- public void startup() throws InitializationException {
- s_log.info("Starting UI initializer");
- List defaultLayout = (List)m_conf.getParameter(DEFAULT_LAYOUT);
+ /**
+ * Implementation of the {@link Initializer#init(ContextInitEvent)}
+ * method.
+ *
+ * @param evt The context init event.
+ */
+ public void init(ContextInitEvent evt) {
+ s_log.debug("UI context initialization started.");
+
+ List defaultLayout = (List) s_conf.getDefaultLayout();
if (defaultLayout != null) {
s_log.info("Processing default layout");
SimplePage.setDefaultLayout(buildLayout(defaultLayout));
}
- List apps = (List)m_conf.getParameter(APPLICATION_LAYOUTS);
+ List apps = (List) s_conf.getApplicationLayouts();
if (apps != null) {
Iterator i = apps.iterator();
while (i.hasNext()) {
@@ -72,16 +88,9 @@ public class Initializer implements com.arsdigita.initializer.Initializer {
}
}
- s_log.info("UI initializer completed");
+ s_log.debug("UI context initialization completed");
}
- public Configuration getConfiguration() {
- return m_conf;
- }
-
- public void shutdown() {
- // nada
- }
private SimplePageLayout buildLayout(List desc) {
SimplePageLayout layout = new SimplePageLayout();
@@ -92,16 +101,14 @@ public class Initializer implements com.arsdigita.initializer.Initializer {
String position = (String)comp.get(0);
String className = (String)comp.get(1);
-
+
Class classObject;
try {
classObject = Class.forName(className);
} catch (ClassNotFoundException ex) {
- throw new InitializationException(
- "cannot find component " + className, ex
- );
+ throw new ConfigError("cannot find component " + className);
}
-
+
s_log.info("Adding " + className + " to " + position);
layout.addComponent(classObject,
@@ -110,4 +117,5 @@ public class Initializer implements com.arsdigita.initializer.Initializer {
return layout;
}
+
}
diff --git a/ccm-core/src/com/arsdigita/ui/LegacyInitializer.java b/ccm-core/src/com/arsdigita/ui/LegacyInitializer.java
new file mode 100755
index 000000000..e746d98b5
--- /dev/null
+++ b/ccm-core/src/com/arsdigita/ui/LegacyInitializer.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.ui;
+
+import com.arsdigita.initializer.Configuration;
+import org.apache.log4j.Logger;
+import java.util.Iterator;
+import java.util.List;
+
+import com.arsdigita.initializer.InitializationException;
+
+
+public class LegacyInitializer implements com.arsdigita.initializer.Initializer {
+
+ private Configuration m_conf = new Configuration();
+ private static final Logger s_log =
+ Logger.getLogger(LegacyInitializer.class);
+
+ public static final String DEFAULT_LAYOUT = "defaultLayout";
+ public static final String APPLICATION_LAYOUTS = "applicationLayouts";
+
+ public LegacyInitializer() {
+ m_conf.initParameter
+ (DEFAULT_LAYOUT,
+ "The default layout for the SimplePage class",
+ List.class);
+ m_conf.initParameter
+ (APPLICATION_LAYOUTS,
+ "The customized layout for applications using the SimplePage class",
+ List.class);
+
+ }
+
+ public void startup() throws InitializationException {
+ s_log.info("Starting UI initializer");
+
+ List defaultLayout = (List)m_conf.getParameter(DEFAULT_LAYOUT);
+ if (defaultLayout != null) {
+ s_log.info("Processing default layout");
+ SimplePage.setDefaultLayout(buildLayout(defaultLayout));
+ }
+
+ List apps = (List)m_conf.getParameter(APPLICATION_LAYOUTS);
+ if (apps != null) {
+ Iterator i = apps.iterator();
+ while (i.hasNext()) {
+ List app = (List)i.next();
+
+ String name = (String)app.get(0);
+ List layout = (List)app.get(1);
+
+ s_log.info("Processing layout for " + name);
+
+ SimplePage.setLayout(name,
+ buildLayout(layout));
+ }
+ }
+
+ s_log.info("UI initializer completed");
+ }
+
+ public Configuration getConfiguration() {
+ return m_conf;
+ }
+
+ public void shutdown() {
+ // nada
+ }
+
+ private SimplePageLayout buildLayout(List desc) {
+ SimplePageLayout layout = new SimplePageLayout();
+
+ Iterator comps = desc.iterator();
+ while (comps.hasNext()) {
+ List comp = (List)comps.next();
+
+ String position = (String)comp.get(0);
+ String className = (String)comp.get(1);
+
+ Class classObject;
+ try {
+ classObject = Class.forName(className);
+ } catch (ClassNotFoundException ex) {
+ throw new InitializationException(
+ "cannot find component " + className, ex
+ );
+ }
+
+ s_log.info("Adding " + className + " to " + position);
+
+ layout.addComponent(classObject,
+ position);
+ }
+
+ return layout;
+ }
+}
diff --git a/ccm-core/src/com/arsdigita/ui/UIConfig.java b/ccm-core/src/com/arsdigita/ui/UIConfig.java
new file mode 100644
index 000000000..4f2b5cbd2
--- /dev/null
+++ b/ccm-core/src/com/arsdigita/ui/UIConfig.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2010 pboy (pboy@barkhof.uni-bremen.de) All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+package com.arsdigita.ui;
+
+import com.arsdigita.runtime.AbstractConfig;
+import com.arsdigita.util.parameter.StringArrayParameter;
+import com.arsdigita.util.parameter.Parameter;
+
+import java.util.Arrays;
+// import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+/**
+ * A configuration record for configuration of the core UI package
+ * (layoput of main UI components).
+ *
+ * @author Peter Boy <pboy@barkhof.uni-bremen.de>
+ * @version $Id: $
+ */
+public class UIConfig extends AbstractConfig {
+
+ /** A logger instance. */
+ private static final Logger s_log = Logger.getLogger(UIConfig.class);
+
+ /** Singelton config object. */
+ private static UIConfig s_conf;
+
+ /**
+ * Gain a UIConfig object.
+ *
+ * Singelton pattern, don't instantiate a lifecacle object using the
+ * constructor directly!
+ * @return
+ */
+ public static final synchronized UIConfig getConfig() {
+ if (s_conf == null) {
+ s_conf = new UIConfig();
+ s_conf.load();
+ }
+
+ return s_conf;
+ }
+
+ /**
+ * Default set of page component objects defining the default layout for the
+ * SimplePage class.
+ * Format: list
+ *
+ */
+// From the OLD initializer:
+// If using the default SimplePage class, the following
+// two parameters specify the class names of the bebop
+// components to (optionally) add to margins of pages
+
+// The is default set of page components
+// defaultLayout = {
+// { "top", "com.arsdigita.ui.UserBanner" },
+// { "bottom", "com.arsdigita.ui.SiteBanner" },
+// { "bottom", "com.arsdigita.ui.DebugPanel" }
+//
+// // { "left", "com.arsdigita.x.y.z" },
+// // { "right", "com.arsdigita.x.y.z" }
+// };
+
+ private final Parameter m_defaultLayout =
+ new StringArrayParameter(
+ "waf.ui.default_layout",
+ Parameter.REQUIRED,
+ new String[]
+ { "top:com.arsdigita.ui.UserBanner",
+ "bottom:com.arsdigita.ui.SiteBanner",
+ "bottom:com.arsdigita.ui.DebugPanel"
+ // "left,com.arsdigita.x.y.zl",
+ // "right,com.arsdigita.x.y.zr",
+ }
+ );
+
+ /**
+ * The customized layout for applications using the SimplePage class
+ * Format: list
+ */
+ private final Parameter m_applicationLayouts =
+ new StringArrayParameter(
+ "waf.ui.application_layouts",
+ Parameter.OPTIONAL,
+ null
+ );
+
+ /**
+ * Constructs an empty RuntimeConfig object.
+ *
+ */
+ public UIConfig() {
+ // pboy: According to the comment for the getConfig() method a singleton
+ // pattern is to be used. Therefore the constructor must be changed to
+ // private!
+ // private UIConfig() {
+ register(m_defaultLayout);
+ register(m_applicationLayouts);
+
+ loadInfo();
+
+ }
+
+ /**
+ * Retrieve the set of default page component objects defining
+ * the default layout for SimplePage class.
+ */
+ public List getDefaultLayout() {
+ String[] defaultLayoutArray = (String[]) get(m_defaultLayout);
+ return Arrays.asList(defaultLayoutArray);
+ }
+
+ /**
+ * Retrieve the set of default page component objects defining
+ * the default layout for SimplePage class.
+ */
+ public List getApplicationLayouts() {
+ String[] layouts = (String[]) get(m_applicationLayouts);
+ return Arrays.asList(layouts);
+ }
+
+}
diff --git a/ccm-core/src/com/arsdigita/ui/UIConfig_parameter.properties b/ccm-core/src/com/arsdigita/ui/UIConfig_parameter.properties
new file mode 100644
index 000000000..200d262eb
--- /dev/null
+++ b/ccm-core/src/com/arsdigita/ui/UIConfig_parameter.properties
@@ -0,0 +1,9 @@
+waf.ui.default_layout.title=Default Layout
+waf.ui.default_layout.purpose=Default layout components for SimplePage class
+waf.ui.default_layout.example="top,com.arsdigita.ui.UserBanner","bottom,com.arsdigita.ui.SiteBanner","left,com.arsdigita.x.y.zl",
+waf.ui.default_layout.format=[StringArray]
+
+waf.ui.application_layouts.title=Application Layouts
+waf.ui.application_layouts.purpose=The customized layout for applications using the SimplePage class
+waf.ui.application_layouts.example=unkown
+waf.ui.application_layouts.format=[StringArray]
diff --git a/ccm-core/src/com/arsdigita/util/StringUtils.java b/ccm-core/src/com/arsdigita/util/StringUtils.java
index 3d36f6b26..9612e6c50 100755
--- a/ccm-core/src/com/arsdigita/util/StringUtils.java
+++ b/ccm-core/src/com/arsdigita/util/StringUtils.java
@@ -51,11 +51,14 @@ public class StringUtils {
private static Perl5Util s_re = new Perl5Util();
+ public static final String NEW_LINE = System.getProperty("line.separator");
+
+
private StringUtils() {
// can't instantiate me!
}
- public static final String NEW_LINE = System.getProperty("line.separator");
+
/**
* Tests if a string is empty.
* @param s A string to test
@@ -463,7 +466,7 @@ public class StringUtils {
/**
* Convert a string of items separated by a separator
- * character to an array of the items. sep is the separator
+ * character to an (string)array of the items. sep is the separator
* character. Example: Input - s == "cat,house,dog" sep==','
* Output - {"cat", "house", "dog"}
* @param s string contains items separated by a separator character.
@@ -710,7 +713,6 @@ public class StringUtils {
* Get a String representation for an Object. If it has an
* asString method, use that; otherwise fall back on toString
*/
-
public static String toString(Object o) {
try {
return (String) o.getClass().getMethod("asString", null)
@@ -727,7 +729,6 @@ public class StringUtils {
* create a String representation of a map. This method is not
* too necessary, because Map.toString() does almost the same.
*/
-
public static String toString(Map m) {
StringBuffer to = new StringBuffer();
if (m == null) {
@@ -881,7 +882,6 @@ public class StringUtils {
* string consists of nothing but whitespace characters, an empty
* string is returned.
*/
-
public final static String trimleft(String s) {
for (int i = 0; i < s.length(); i++) {
if (!Character.isWhitespace(s.charAt(i))) {
@@ -898,7 +898,6 @@ public class StringUtils {
* @param pattern the pattern String
* @param repeatCount the number of time to repeat it
*/
-
public final static String repeat(String pattern, int repeatCount) {
StringBuffer sb = new StringBuffer(repeatCount * pattern.length());
for (int i = 0; i < repeatCount; i++) {
@@ -914,7 +913,6 @@ public class StringUtils {
* @param pattern the pattern character
* @param repeatCount the number of time to repeat it
*/
-
public final static String repeat(char pattern, int repeatCount) {
return repeat(String.valueOf(pattern), repeatCount);
}
@@ -928,7 +926,6 @@ public class StringUtils {
*
* @since 5.1.2
*/
-
public final static String wrap(String input) {
return wrap(input,80);
}
@@ -1252,7 +1249,7 @@ public class StringUtils {
/**
* @throws NullPointerException if throwable is null
- **/
+ */
public static String getStackTrace(Throwable throwable) {
if (throwable==null) { throw new NullPointerException("throwable"); }
@@ -1289,7 +1286,7 @@ public class StringUtils {
*
* @see #getStackTrace(Throwable)
* @throws NullPointerException if throwable is null
- **/
+ */
public static List getStackList(Throwable throwable) {
StringTokenizer tkn = new StringTokenizer
(getStackTrace(throwable), System.getProperty("line.separator"));
diff --git a/ccm-core/src/com/arsdigita/util/parameter/StringArrayParameter.java b/ccm-core/src/com/arsdigita/util/parameter/StringArrayParameter.java
index 3ed96f449..af04032c4 100755
--- a/ccm-core/src/com/arsdigita/util/parameter/StringArrayParameter.java
+++ b/ccm-core/src/com/arsdigita/util/parameter/StringArrayParameter.java
@@ -25,7 +25,7 @@ import com.arsdigita.util.StringUtils;
/**
* StringArrayParameter
*
- * Usage Esample:
+ * Usage Example:
*
* private static parameter exampleName ;
* exampleName = new StringArrayParameter(
@@ -52,6 +52,7 @@ public class StringArrayParameter extends StringParameter {
}
+ @Override
protected String marshal(final Object value) {
if (value == null) {
return null;
@@ -60,6 +61,7 @@ public class StringArrayParameter extends StringParameter {
}
}
+ @Override
protected Object unmarshal(final String literal,
final ErrorList errors) {
final String[] literals = StringUtils.split(literal, ',');
@@ -77,6 +79,7 @@ public class StringArrayParameter extends StringParameter {
return strings;
}
+ @Override
protected void doValidate(final Object value,
final ErrorList errors) {
if (value != null) {