Old Initializer für core portal und einige deprecated Klassen ausgebaut, verschiedene Dokumentation und Kommentierungen ergänzt.
git-svn-id: https://svn.libreccm.org/ccm/trunk@677 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
41c173670d
commit
1559f37f53
|
|
@ -28,6 +28,8 @@
|
|||
storage="ccm-core/intermedia.properties"/>
|
||||
<config class="com.arsdigita.templating.TemplatingConfig"
|
||||
storage="ccm-core/templating.properties"/>
|
||||
<config class="com.arsdigita.ui.UIConfig"
|
||||
storage="ccm-core/ui.properties"/>
|
||||
<config class="com.arsdigita.versioning.VersioningConfig"
|
||||
storage="ccm-core/versioning.properties"/>
|
||||
<config class="com.arsdigita.web.WebConfig"
|
||||
|
|
|
|||
|
|
@ -82,6 +82,8 @@ public class Initializer extends CompoundInitializer {
|
|||
("ccm-core.pdl.mf",
|
||||
new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl"))));
|
||||
|
||||
// add(new com.arsdigita.ui.Initializer());
|
||||
add(new com.arsdigita.portal.Initializer());
|
||||
add(new com.arsdigita.search.Initializer());
|
||||
add(new com.arsdigita.search.lucene.Initializer());
|
||||
add(new com.arsdigita.search.intermedia.Initializer());
|
||||
|
|
@ -91,6 +93,7 @@ public class Initializer extends CompoundInitializer {
|
|||
add(new OptionalLegacyInitializer("enterprise.init"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void init(final DomainInitEvent e) {
|
||||
super.init(e);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
//
|
||||
|
||||
|
||||
init com.arsdigita.globalization.Initializer {
|
||||
// init com.arsdigita.globalization.Initializer {
|
||||
init com.arsdigita.globalization.LegacyInitializer {
|
||||
// See http://java.sun.com/j2se/1.3/docs/api/java/lang/package-summary.html#charenc
|
||||
charsets = {
|
||||
"ISO-8859-1",
|
||||
|
|
@ -58,7 +59,7 @@ init com.arsdigita.webdevsupport.Initializer {
|
|||
|
||||
init com.arsdigita.toolbox.CharsetEncodingProviderInitializer { }
|
||||
|
||||
init com.arsdigita.ui.Initializer {
|
||||
init com.arsdigita.ui.LegacyInitializer {
|
||||
// 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
|
||||
|
|
@ -75,7 +76,8 @@ init com.arsdigita.ui.Initializer {
|
|||
|
||||
}
|
||||
|
||||
init com.arsdigita.portal.Initializer { }
|
||||
// init com.arsdigita.portal.Initializer { }
|
||||
// init com.arsdigita.portal.LegacyInitializer { }
|
||||
|
||||
|
||||
// The formbuilder application is now deprecated and will
|
||||
|
|
|
|||
|
|
@ -41,17 +41,17 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* @version $Revision: #15 $ $Date: 2004/08/16 $
|
||||
*/
|
||||
public class Initializer implements com.arsdigita.initializer.Initializer {
|
||||
public class LegacyInitializer implements com.arsdigita.initializer.Initializer {
|
||||
|
||||
private static final String DEFAULT_CHARSET = "defaultCharset";
|
||||
private static final String CHARSETS = "charsets";
|
||||
private static final String LOCALES = "locales";
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(Initializer.class);
|
||||
private static final Logger s_log = Logger.getLogger(LegacyInitializer.class);
|
||||
|
||||
private Configuration m_conf = new Configuration();
|
||||
|
||||
public Initializer() throws InitializationException {
|
||||
public LegacyInitializer() throws InitializationException {
|
||||
m_conf.initParameter
|
||||
(CHARSETS,
|
||||
"Recognized character sets",
|
||||
|
|
@ -44,9 +44,11 @@ import org.apache.log4j.Logger;
|
|||
* Represents a package type.
|
||||
*
|
||||
* @since ACS 5.0
|
||||
* @deprecated Use {@link com.arsdigita.web.ApplicationType} instead.
|
||||
* @version $Revision: #15 $, $Date: 2004/08/16 $
|
||||
* @version $Id: PackageType.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
|
||||
* @deprecated without direct replacement. Refactor to use
|
||||
* {@link com.arsdigita.web.ApplicationType} instead.
|
||||
*/
|
||||
|
||||
public class PackageType extends com.arsdigita.domain.DomainObject {
|
||||
|
|
@ -396,6 +398,11 @@ public class PackageType extends com.arsdigita.domain.DomainObject {
|
|||
* @return an array of stylesheets for the specificed locale and
|
||||
* output type.
|
||||
* @see #addStylesheet(Stylesheet)
|
||||
*
|
||||
* @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
|
||||
|
|
@ -409,6 +416,11 @@ public class PackageType extends com.arsdigita.domain.DomainObject {
|
|||
* "text/html"
|
||||
* @return the best match stylesheet for this package.
|
||||
* @see #addStylesheet(Stylesheet)
|
||||
*
|
||||
* @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 getStylesheet(Locale locale, String outputType) {
|
||||
return StyleAssociation
|
||||
|
|
|
|||
|
|
@ -58,12 +58,13 @@ import org.apache.log4j.Logger;
|
|||
* child of the root <code>SiteNode</code> with a name of "news."</li>
|
||||
* </ul>
|
||||
*
|
||||
* @deprecated Use {@link com.arsdigita.web.Application} instead.
|
||||
* @version 1.0
|
||||
* @since ACS 5.0 */
|
||||
* @version $Id: SiteNode.java 287 2005-02-22 00:29:02Z sskracic $
|
||||
* @since ACS 5.0
|
||||
* @deprecated Refactor to use {@link com.arsdigita.web.Application} instead.
|
||||
*/
|
||||
public class SiteNode extends ACSObject {
|
||||
public static final String versionId =
|
||||
"$Id: SiteNode.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
|
||||
|
||||
private static final String s_typeName = "com.arsdigita.kernel.SiteNode";
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(SiteNode.class.getName());
|
||||
|
|
@ -86,6 +87,7 @@ public class SiteNode extends ACSObject {
|
|||
*
|
||||
* @see com.arsdigita.persistence.DataObject
|
||||
* @see com.arsdigita.persistence.metadata.ObjectType
|
||||
* @deprecated see above
|
||||
*/
|
||||
public SiteNode() {
|
||||
super(s_typeName);
|
||||
|
|
@ -98,6 +100,7 @@ public class SiteNode extends ACSObject {
|
|||
* @param dataObject the data object to encapsulate in the new domain
|
||||
* object
|
||||
* @see com.arsdigita.persistence.Session#retrieve(String)
|
||||
* @deprecated see above
|
||||
*/
|
||||
public SiteNode(DataObject dataObject) {
|
||||
super(dataObject);
|
||||
|
|
@ -119,6 +122,7 @@ public class SiteNode extends ACSObject {
|
|||
* @param id a SiteNode ID
|
||||
* @exception DataObjectNotFoundException if the ID does not match
|
||||
* a SiteNode in the system.
|
||||
* @deprecated see above
|
||||
*/
|
||||
public SiteNode(BigDecimal id) throws DataObjectNotFoundException {
|
||||
super(new OID(s_typeName, id));
|
||||
|
|
@ -130,7 +134,8 @@ public class SiteNode extends ACSObject {
|
|||
* @param oid the OID for the retrieved instance
|
||||
* @see com.arsdigita.domain.DomainObject#DomainObject(OID)
|
||||
* @see com.arsdigita.persistence.OID
|
||||
**/
|
||||
* @deprecated see above
|
||||
*/
|
||||
public SiteNode(OID oid) throws DataObjectNotFoundException {
|
||||
super(oid);
|
||||
}
|
||||
|
|
@ -243,14 +248,16 @@ public class SiteNode extends ACSObject {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if this SiteNode can have children; <code>false</code> otherwise.
|
||||
* @return <code>true</code> if this SiteNode can have children;
|
||||
* <code>false</code> otherwise.
|
||||
*/
|
||||
public boolean isDirectory() {
|
||||
return ((Boolean) (get("isDirectory"))).booleanValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if the SiteNode supports patterns; <code>false</code> otherwise.
|
||||
* @return <code>true</code> if the SiteNode supports patterns;
|
||||
* <code>false</code> 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);
|
||||
|
|
|
|||
|
|
@ -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,7 +47,8 @@ public class StyleAssociation {
|
|||
private static final Logger s_cat =
|
||||
Logger.getLogger(StyleAssociation.class.getName());
|
||||
|
||||
/** Gets an array with all applicable stylesheets.
|
||||
/**
|
||||
* 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)
|
||||
|
|
@ -47,6 +56,7 @@ public class StyleAssociation {
|
|||
* @return an array with all applicable stylesheets.
|
||||
*
|
||||
* @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,
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -72,10 +72,12 @@ import org.apache.log4j.Logger;
|
|||
* do the same tree walk except we'll look for the stylesheet
|
||||
* associated with the <em>package</em> 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) {
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<title>com.arsdigita.sitenode</title>
|
||||
</head>
|
||||
<body bgcolor="white">
|
||||
<body>
|
||||
<p>
|
||||
Provides a Dispatcher implementation that is backed by the "Site Map" of
|
||||
SiteNode domain objects. The reason this package is not part of the
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package com.arsdigita.templating;
|
||||
|
||||
import com.arsdigita.templating.PatternGenerator;
|
||||
import com.arsdigita.web.Web;
|
||||
import com.arsdigita.web.Application;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,14 +37,11 @@ import org.apache.log4j.Logger;
|
|||
* using the old packagetype <-> stylesheet and sitenode <-> stylesheet
|
||||
* mappings in the database.
|
||||
* </p>
|
||||
* @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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* <code>xsl:import</code> and <code>xsl:include</code> 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);
|
||||
|
|
|
|||
|
|
@ -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 <code>XSLTemplate</code> objects,
|
||||
* managed via the <code>getTemplate</code> and
|
||||
* <code>purgeTemplate</code> methods.
|
||||
* This class maintains a cache of <code>XSLTemplate</code> objects, managed
|
||||
* via the <code>getTemplate</code> and <code>purgeTemplate</code> 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,30 +113,37 @@ 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 <code>PresentationManager</code>
|
||||
* 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 <code>URL</code> to the top-level template
|
||||
* resource
|
||||
* @param source the <code>URL</code> to the top-level template resource
|
||||
* @return an <code>XSLTemplate</code> instance representing
|
||||
* <code>source</code>
|
||||
*/
|
||||
|
|
@ -147,13 +152,11 @@ public class Templating {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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 <code>URL</code> to the top-level template
|
||||
* resource
|
||||
* @param source the <code>URL</code> 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.
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
@ -97,9 +106,7 @@ public class Initializer implements com.arsdigita.initializer.Initializer {
|
|||
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);
|
||||
|
|
@ -110,4 +117,5 @@ public class Initializer implements com.arsdigita.initializer.Initializer {
|
|||
|
||||
return layout;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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]
|
||||
|
|
@ -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 <code>throwable</code> 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 <code>throwable</code> is null
|
||||
**/
|
||||
*/
|
||||
public static List getStackList(Throwable throwable) {
|
||||
StringTokenizer tkn = new StringTokenizer
|
||||
(getStackTrace(throwable), System.getProperty("line.separator"));
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import com.arsdigita.util.StringUtils;
|
|||
/**
|
||||
* StringArrayParameter
|
||||
*
|
||||
* Usage Esample:
|
||||
* Usage Example:
|
||||
* <pre>
|
||||
* 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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue