Weitere old initializers entfernt.
git-svn-id: https://svn.libreccm.org/ccm/trunk@710 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
d2cb0d24af
commit
3ecac2aff0
|
|
@ -3,7 +3,7 @@
|
||||||
name="ccm-core"
|
name="ccm-core"
|
||||||
prettyName="Core"
|
prettyName="Core"
|
||||||
version="6.6.1"
|
version="6.6.1"
|
||||||
release="1"
|
release="2"
|
||||||
shared="true"
|
shared="true"
|
||||||
webapp="ROOT"
|
webapp="ROOT"
|
||||||
buildHooks="build-hooks.xml">
|
buildHooks="build-hooks.xml">
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import com.arsdigita.domain.DomainObject;
|
||||||
import com.arsdigita.domain.DomainObjectInstantiator;
|
import com.arsdigita.domain.DomainObjectInstantiator;
|
||||||
import com.arsdigita.kernel.ACSObjectInstantiator;
|
import com.arsdigita.kernel.ACSObjectInstantiator;
|
||||||
import com.arsdigita.loader.CoreLoader;
|
import com.arsdigita.loader.CoreLoader;
|
||||||
|
import com.arsdigita.mimetypes.MimeType;
|
||||||
import com.arsdigita.persistence.DataObject;
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.persistence.Session;
|
import com.arsdigita.persistence.Session;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
|
|
@ -37,8 +38,10 @@ import com.arsdigita.runtime.LegacyInitializer;
|
||||||
import com.arsdigita.runtime.OptionalLegacyInitializer;
|
import com.arsdigita.runtime.OptionalLegacyInitializer;
|
||||||
import com.arsdigita.runtime.PDLInitializer;
|
import com.arsdigita.runtime.PDLInitializer;
|
||||||
import com.arsdigita.runtime.RuntimeConfig;
|
import com.arsdigita.runtime.RuntimeConfig;
|
||||||
|
import com.arsdigita.toolbox.CharsetEncodingProvider;
|
||||||
import com.arsdigita.ui.admin.Admin;
|
import com.arsdigita.ui.admin.Admin;
|
||||||
import com.arsdigita.ui.sitemap.SiteMap;
|
import com.arsdigita.ui.sitemap.SiteMap;
|
||||||
|
import com.arsdigita.util.URLRewriter;
|
||||||
import com.arsdigita.xml.FactoriesSetup;
|
import com.arsdigita.xml.FactoriesSetup;
|
||||||
import com.arsdigita.web.Host;
|
import com.arsdigita.web.Host;
|
||||||
import com.arsdigita.web.WebApp;
|
import com.arsdigita.web.WebApp;
|
||||||
|
|
@ -82,7 +85,7 @@ public class Initializer extends CompoundInitializer {
|
||||||
("ccm-core.pdl.mf",
|
("ccm-core.pdl.mf",
|
||||||
new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl"))));
|
new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl"))));
|
||||||
|
|
||||||
// add(new com.arsdigita.ui.Initializer());
|
add(new com.arsdigita.ui.Initializer());
|
||||||
add(new com.arsdigita.portal.Initializer());
|
add(new com.arsdigita.portal.Initializer());
|
||||||
add(new com.arsdigita.search.Initializer());
|
add(new com.arsdigita.search.Initializer());
|
||||||
add(new com.arsdigita.search.lucene.Initializer());
|
add(new com.arsdigita.search.lucene.Initializer());
|
||||||
|
|
@ -93,6 +96,10 @@ public class Initializer extends CompoundInitializer {
|
||||||
add(new OptionalLegacyInitializer("enterprise.init"));
|
add(new OptionalLegacyInitializer("enterprise.init"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final void init(final DomainInitEvent e) {
|
public final void init(final DomainInitEvent e) {
|
||||||
super.init(e);
|
super.init(e);
|
||||||
|
|
@ -155,6 +162,41 @@ public class Initializer extends CompoundInitializer {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* MimeType used to have its own initializer in the old initialize system
|
||||||
|
* based on enterprise.ini. This initializer performed a DomainObjectFactgory
|
||||||
|
* instantiation and some handling of INSO filter, an Oracle db related
|
||||||
|
* filter for intermedia textsearch. INSO filter handling is moved to
|
||||||
|
* intermedia search engine so no configuration was left in the domain
|
||||||
|
* instantiation could be moved to the central core initializer
|
||||||
|
From old Initializer system:
|
||||||
|
|
||||||
|
if (DomainObjectFactory.getInstantiator
|
||||||
|
(MimeType.BASE_DATA_OBJECT_TYPE) == null) {
|
||||||
|
DomainObjectInstantiator instMimeType = new DomainObjectInstantiator() {
|
||||||
|
public DomainObject doNewInstance(DataObject dataObject) {
|
||||||
|
return new MimeType(dataObject);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
DomainObjectFactory.registerInstantiator
|
||||||
|
(MimeType.BASE_DATA_OBJECT_TYPE, instMimeType);
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
e.getFactory().registerInstantiator
|
||||||
|
(MimeType.BASE_DATA_OBJECT_TYPE,
|
||||||
|
new DomainObjectInstantiator() {
|
||||||
|
public DomainObject doNewInstance(DataObject dataObject) {
|
||||||
|
return new MimeType(dataObject);
|
||||||
|
}
|
||||||
|
public DomainObjectInstantiator
|
||||||
|
resolveInstantiator(DataObject obj) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// register the document converters
|
// register the document converters
|
||||||
Converter converter = new PDFConverter();
|
Converter converter = new PDFConverter();
|
||||||
ConverterRegistry.registerConverter(converter,
|
ConverterRegistry.registerConverter(converter,
|
||||||
|
|
@ -176,9 +218,16 @@ public class Initializer extends CompoundInitializer {
|
||||||
ConverterRegistry.registerConverter(converter,
|
ConverterRegistry.registerConverter(converter,
|
||||||
converter.getMimeTypes());
|
converter.getMimeTypes());
|
||||||
|
|
||||||
|
// Initialize the the CharsetEncodingProvider internal data structure
|
||||||
|
URLRewriter.addParameterProvider(new CharsetEncodingProvider());
|
||||||
|
|
||||||
s_log.info("Core init(DomainInitEvent) done");
|
s_log.info("Core init(DomainInitEvent) done");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
public final void init(final LegacyInitEvent e) {
|
public final void init(final LegacyInitEvent e) {
|
||||||
super.init(e);
|
super.init(e);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,34 +47,34 @@ init com.arsdigita.kernel.security.Initializer {
|
||||||
|
|
||||||
|
|
||||||
// Set to true when using intermedia search
|
// Set to true when using intermedia search
|
||||||
init com.arsdigita.mimetypes.MimeTypeInitializer {
|
//-init com.arsdigita.mimetypes.LegacyMimeTypeInitializer {
|
||||||
INSOFilterEnabled = false;
|
//- INSOFilterEnabled = false;
|
||||||
}
|
//-}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Should get integrated into the same configuration file as parameter
|
||||||
|
// waf.debug, i.e. ccm-core/kernel.properties.
|
||||||
init com.arsdigita.webdevsupport.Initializer {
|
init com.arsdigita.webdevsupport.Initializer {
|
||||||
active = false;
|
active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
init com.arsdigita.toolbox.CharsetEncodingProviderInitializer { }
|
// init com.arsdigita.toolbox.CharsetEncodingProviderInitializer { }
|
||||||
|
|
||||||
init com.arsdigita.ui.LegacyInitializer {
|
// init com.arsdigita.ui.LegacyInitializer {
|
||||||
// If using the default SimplePage class, the following
|
// If using the default SimplePage class, the following
|
||||||
// two parameters specify the class names of the bebop
|
// two parameters specify the class names of the bebop
|
||||||
// components to (optionally) add to margins of pages
|
// components to (optionally) add to margins of pages
|
||||||
|
|
||||||
// The is default set of page components
|
// The is default set of page components
|
||||||
defaultLayout = {
|
// defaultLayout = {
|
||||||
{ "top", "com.arsdigita.ui.UserBanner" },
|
// { "top", "com.arsdigita.ui.UserBanner" },
|
||||||
{ "bottom", "com.arsdigita.ui.SiteBanner" },
|
// { "bottom", "com.arsdigita.ui.SiteBanner" },
|
||||||
{ "bottom", "com.arsdigita.ui.DebugPanel" }
|
// { "bottom", "com.arsdigita.ui.DebugPanel" }
|
||||||
|
// // { "left", "com.arsdigita.x.y.z" },
|
||||||
|
// // { "right", "com.arsdigita.x.y.z" }
|
||||||
|
// };
|
||||||
|
|
||||||
// { "left", "com.arsdigita.x.y.z" },
|
// }
|
||||||
// { "right", "com.arsdigita.x.y.z" }
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// init com.arsdigita.portal.Initializer { }
|
// init com.arsdigita.portal.Initializer { }
|
||||||
// init com.arsdigita.portal.LegacyInitializer { }
|
// init com.arsdigita.portal.LegacyInitializer { }
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ import com.arsdigita.util.parameter.CompoundParameterReader;
|
||||||
import com.arsdigita.util.parameter.ParameterReader;
|
import com.arsdigita.util.parameter.ParameterReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PackageLoader
|
* Base class which loaders of all modules extend.
|
||||||
*
|
*
|
||||||
* @author Rafael H. Schloming <rhs@mit.edu>
|
* @author Rafael H. Schloming <rhs@mit.edu>
|
||||||
* @version $Id: PackageLoader.java 2070 2010-01-28 08:47:41Z pboy $
|
* @version $Id: PackageLoader.java 2070 2010-01-28 08:47:41Z pboy $
|
||||||
|
|
@ -118,18 +118,11 @@ public abstract class PackageLoader extends AbstractScript {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* @param args
|
* @param args
|
||||||
* @return
|
* @return
|
||||||
* //@deprecated use reader() instead
|
|
||||||
* but seems not to be used by any module
|
|
||||||
*/
|
*/
|
||||||
//public static ParameterLoader loader(String[] args) {
|
|
||||||
// return ( this.reader(args) );
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
public static ParameterReader reader(String[] args) {
|
public static ParameterReader reader(String[] args) {
|
||||||
CompoundParameterReader result = new CompoundParameterReader();
|
CompoundParameterReader result = new CompoundParameterReader();
|
||||||
result.add(new JavaPropertyReader(props(args)));
|
result.add(new JavaPropertyReader(props(args)));
|
||||||
|
|
|
||||||
|
|
@ -42,15 +42,15 @@ import java.math.BigDecimal;
|
||||||
* @author Stanislav Freidin
|
* @author Stanislav Freidin
|
||||||
* @version $Revision: #15 $ $Date: 2004/08/16 $
|
* @version $Revision: #15 $ $Date: 2004/08/16 $
|
||||||
*/
|
*/
|
||||||
public class MimeTypeInitializer extends BaseInitializer {
|
public class LegacyMimeTypeInitializer extends BaseInitializer {
|
||||||
private static final Logger s_log = Logger.getLogger(MimeTypeInitializer.class);
|
private static final Logger s_log = Logger.getLogger(LegacyMimeTypeInitializer.class);
|
||||||
|
|
||||||
private final Configuration m_conf = new Configuration();
|
private final Configuration m_conf = new Configuration();
|
||||||
public static final String INSO_FILTER_WORKS = "INSOFilterEnabled";
|
public static final String INSO_FILTER_WORKS = "INSOFilterEnabled";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update status table with new hash code
|
* Update status table with new hash code
|
||||||
**/
|
*/
|
||||||
private void updateStatus() {
|
private void updateStatus() {
|
||||||
MimeTypeStatus ms = MimeTypeStatus.getMimeTypeStatus();
|
MimeTypeStatus ms = MimeTypeStatus.getMimeTypeStatus();
|
||||||
if ( isFilterEnabled() ) {
|
if ( isFilterEnabled() ) {
|
||||||
|
|
@ -63,7 +63,7 @@ public class MimeTypeInitializer extends BaseInitializer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a trivial instantiator for MimeType
|
* Register a trivial instantiator for MimeType
|
||||||
**/
|
*/
|
||||||
private static void registerInstantiator() {
|
private static void registerInstantiator() {
|
||||||
if (DomainObjectFactory.getInstantiator
|
if (DomainObjectFactory.getInstantiator
|
||||||
(MimeType.BASE_DATA_OBJECT_TYPE) == null) {
|
(MimeType.BASE_DATA_OBJECT_TYPE) == null) {
|
||||||
|
|
@ -77,7 +77,7 @@ public class MimeTypeInitializer extends BaseInitializer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MimeTypeInitializer() throws InitializationException {
|
public LegacyMimeTypeInitializer() throws InitializationException {
|
||||||
m_conf.initParameter
|
m_conf.initParameter
|
||||||
(INSO_FILTER_WORKS,
|
(INSO_FILTER_WORKS,
|
||||||
"Set to true if you have a working INSO filter",
|
"Set to true if you have a working INSO filter",
|
||||||
|
|
@ -105,8 +105,8 @@ public class MimeTypeInitializer extends BaseInitializer {
|
||||||
disableFilter();
|
disableFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
testINSOFilter();
|
// testINSOFilter();
|
||||||
updateStatus();
|
// updateStatus();
|
||||||
registerInstantiator();
|
registerInstantiator();
|
||||||
|
|
||||||
txn.commitTxn();
|
txn.commitTxn();
|
||||||
|
|
@ -118,6 +118,10 @@ public class MimeTypeInitializer extends BaseInitializer {
|
||||||
|
|
||||||
protected void doShutdown () { }
|
protected void doShutdown () { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a routine test whether the INSO filter works correctly. Disables
|
||||||
|
* INSO filter if testing fails.
|
||||||
|
*/
|
||||||
private void testINSOFilter() {
|
private void testINSOFilter() {
|
||||||
if ( !isFilterEnabled() ) {
|
if ( !isFilterEnabled() ) {
|
||||||
s_log.info("Not testing INSO filter.");
|
s_log.info("Not testing INSO filter.");
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* as published by the Free Software Foundation; either version 2.1 of
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
|
@ -19,12 +17,10 @@
|
||||||
package com.arsdigita.search.intermedia;
|
package com.arsdigita.search.intermedia;
|
||||||
|
|
||||||
import com.arsdigita.db.DbHelper;
|
import com.arsdigita.db.DbHelper;
|
||||||
// import com.arsdigita.initializer.Configuration;
|
import com.arsdigita.mimetypes.MimeTypeStatus;
|
||||||
// import com.arsdigita.initializer.InitializationException;
|
import com.arsdigita.mimetypes.converters.ConvertFormat;
|
||||||
import com.arsdigita.runtime.ConfigError;
|
import com.arsdigita.runtime.ConfigError;
|
||||||
import com.arsdigita.runtime.ContextCloseEvent;
|
import com.arsdigita.runtime.ContextCloseEvent;
|
||||||
import com.arsdigita.runtime.DataInitEvent;
|
|
||||||
import com.arsdigita.runtime.DomainInitEvent;
|
|
||||||
import com.arsdigita.runtime.ContextInitEvent;
|
import com.arsdigita.runtime.ContextInitEvent;
|
||||||
import com.arsdigita.search.FilterType;
|
import com.arsdigita.search.FilterType;
|
||||||
import com.arsdigita.search.IndexerType;
|
import com.arsdigita.search.IndexerType;
|
||||||
|
|
@ -33,6 +29,10 @@ import com.arsdigita.search.Search;
|
||||||
import com.arsdigita.search.filters.CategoryFilterType;
|
import com.arsdigita.search.filters.CategoryFilterType;
|
||||||
import com.arsdigita.search.filters.ObjectTypeFilterType;
|
import com.arsdigita.search.filters.ObjectTypeFilterType;
|
||||||
import com.arsdigita.search.filters.PermissionFilterType;
|
import com.arsdigita.search.filters.PermissionFilterType;
|
||||||
|
import com.arsdigita.util.Assert;
|
||||||
|
import com.arsdigita.util.StringUtils;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
@ -51,9 +51,10 @@ public class Initializer extends com.arsdigita.runtime.GenericInitializer {
|
||||||
// Creates a s_logging category with name = to the full name of class
|
// Creates a s_logging category with name = to the full name of class
|
||||||
public static final Logger s_log = Logger.getLogger(Initializer.class);
|
public static final Logger s_log = Logger.getLogger(Initializer.class);
|
||||||
|
|
||||||
|
private static final IntermediaConfig conf = IntermediaConfig.getConfig();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public Initializer() {
|
public Initializer() {
|
||||||
}
|
}
|
||||||
|
|
@ -64,9 +65,27 @@ public class Initializer extends com.arsdigita.runtime.GenericInitializer {
|
||||||
* method.
|
* method.
|
||||||
*
|
*
|
||||||
* @param evt The context init event.
|
* @param evt The context init event.
|
||||||
**/
|
*/
|
||||||
|
@Override
|
||||||
public void init(ContextInitEvent evt) {
|
public void init(ContextInitEvent evt) {
|
||||||
|
|
||||||
|
// In any case we have to check whether the INSO filter is set
|
||||||
|
// correctly.
|
||||||
|
// If it's not Oracle, INSO filters don't exist, so override whatever is
|
||||||
|
// configured in registry.
|
||||||
|
final boolean isNonOracleDB = DbHelper.getDatabase() != DbHelper.DB_ORACLE;
|
||||||
|
if (conf.isINSOFilterEnabled() && isNonOracleDB) {
|
||||||
|
s_log.debug("INSO filter is set to true using a non Oracle database. "
|
||||||
|
+ "This is not allowed. Setting to false. Database=" +
|
||||||
|
DbHelper.getDatabaseName(DbHelper.getDatabase()));
|
||||||
|
|
||||||
|
// silently disable filter
|
||||||
|
MimeTypeStatus ms = MimeTypeStatus.getMimeTypeStatus();
|
||||||
|
ms.setInsoFilterWorks(new BigDecimal(0));
|
||||||
|
ms.save();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (Search.getConfig().isIntermediaEnabled()) {
|
if (Search.getConfig().isIntermediaEnabled()) {
|
||||||
|
|
||||||
if (DbHelper.getDatabase() != DbHelper.DB_ORACLE) {
|
if (DbHelper.getDatabase() != DbHelper.DB_ORACLE) {
|
||||||
|
|
@ -75,7 +94,14 @@ public class Initializer extends com.arsdigita.runtime.GenericInitializer {
|
||||||
DbHelper.getDatabaseName(DbHelper.getDatabase()));
|
DbHelper.getDatabaseName(DbHelper.getDatabase()));
|
||||||
}
|
}
|
||||||
|
|
||||||
IntermediaConfig conf = IntermediaConfig.getConfig();
|
// update INSO filter status
|
||||||
|
MimeTypeStatus ms = MimeTypeStatus.getMimeTypeStatus();
|
||||||
|
if (conf.isINSOFilterEnabled() && testINSOFilter() ) {
|
||||||
|
ms.setInsoFilterWorks(new BigDecimal(1));
|
||||||
|
} else {
|
||||||
|
ms.setInsoFilterWorks(new BigDecimal(0));
|
||||||
|
}
|
||||||
|
ms.save();
|
||||||
|
|
||||||
// Multiply by 1000 to convert from seconds to milliseconds
|
// Multiply by 1000 to convert from seconds to milliseconds
|
||||||
BuildIndex.setParameterValues( conf.getTimerDelay() * 1000,
|
BuildIndex.setParameterValues( conf.getTimerDelay() * 1000,
|
||||||
|
|
@ -94,14 +120,17 @@ public class Initializer extends com.arsdigita.runtime.GenericInitializer {
|
||||||
new CategoryFilterType()
|
new CategoryFilterType()
|
||||||
},
|
},
|
||||||
new BaseQueryEngine());
|
new BaseQueryEngine());
|
||||||
} else {
|
} else {
|
||||||
s_log.debug("Intermedia search engine not enabled. Initialization skipped.");
|
s_log.debug("Intermedia search engine not enabled. Initialization skipped.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Implementation of the {@link Initializer#init(ContextCloseEvent)}
|
||||||
|
* method which stops the background thread started by
|
||||||
|
* {@link Initializer#init(ContextInitEvent)} initialization method
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void close(ContextCloseEvent evt) {
|
public void close(ContextCloseEvent evt) {
|
||||||
if (Search.getConfig().isIntermediaEnabled()) {
|
if (Search.getConfig().isIntermediaEnabled()) {
|
||||||
BuildIndex.stopTimer();
|
BuildIndex.stopTimer();
|
||||||
|
|
@ -109,4 +138,93 @@ public class Initializer extends com.arsdigita.runtime.GenericInitializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a routine test whether the INSO filter works correctly.
|
||||||
|
*
|
||||||
|
* @return true if INSO Filter test passed, false otherwise.
|
||||||
|
*/
|
||||||
|
private boolean testINSOFilter() {
|
||||||
|
|
||||||
|
Assert.isTrue(DbHelper.getDatabase() == DbHelper.DB_ORACLE,
|
||||||
|
"Testing INSO filter on non Oracle DB! Shouldn't happen!");
|
||||||
|
|
||||||
|
s_log.info("Starting INSO filter test. If server hangs here,\n" +
|
||||||
|
" kill the job, then change your enterprise.init setting;' in \n" +
|
||||||
|
" enterprise.init com.arsdigita.cms.installer.Initializer.");
|
||||||
|
|
||||||
|
String actual = ConvertFormat.toHTML(rtfTestFile.getBytes());
|
||||||
|
|
||||||
|
if (actual == null) {
|
||||||
|
s_log.warn("INSO Filter test failed. " +
|
||||||
|
"Unable to convert test rtf document to html.");
|
||||||
|
s_log.warn("INSO Filter test Expected: '" + rtfTestFileHTML + "'");
|
||||||
|
s_log.warn("INSO Filter test Got: '" + actual + "'");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove white space before doing matching. In case version
|
||||||
|
// of INSO filter changes.
|
||||||
|
final String expected = StringUtils.
|
||||||
|
stripWhiteSpace(rtfTestFileHTML).toLowerCase();
|
||||||
|
|
||||||
|
actual = StringUtils.stripWhiteSpace(actual).toLowerCase();
|
||||||
|
if (expected.equals(actual)) {
|
||||||
|
s_log.info("INSO Filter test passed.");
|
||||||
|
return true;
|
||||||
|
} else if (actual.startsWith("<html><body> <p") &&
|
||||||
|
actual.indexOf("but lets see if it really works.") >= 0 &&
|
||||||
|
actual.indexOf("this app uses the intermedia inso " +
|
||||||
|
"filtering to automatically convert " +
|
||||||
|
"from an rtf format to html format.") >= 0 &&
|
||||||
|
actual.endsWith("</body></html>")) {
|
||||||
|
s_log.info("INSO Filter test passed.");
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
s_log.warn("INSO Filter test failed. " +
|
||||||
|
"(Will not be able to convert documents to "+
|
||||||
|
"html format by file uploading.)");
|
||||||
|
s_log.warn("INSO Filter test Expected: '" + expected + "'");
|
||||||
|
s_log.warn("Got: '" + actual + "'");
|
||||||
|
return false ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// rtf file used to test inso filter conversion to html
|
||||||
|
private static final String rtfTestFile =
|
||||||
|
"{\\rtf1\\ansi\\deff0\n" +
|
||||||
|
"{\\fonttbl{\\f0\\froman\\fprq2\\fcharset0 Times;}}\n" +
|
||||||
|
"{\\colortbl\\red0\\green0\\blue0;\\red255\\green255\\blue" +
|
||||||
|
"255;\\red128\\green128\\blue128;}\n" +
|
||||||
|
"{\\stylesheet{\\s1\\snext1 Standard;}\n}\n" +
|
||||||
|
"{\\info{\\comment StarWriter}{\\vern5690}}\\deftab720\n" +
|
||||||
|
"{\\*\\pgdsctbl\n" +
|
||||||
|
"{\\pgdsc0\\pgdscuse195\\pgwsxn12240\\pghsxn15840\\marglsxn" +
|
||||||
|
"1800\\margrsxn1800\\margtsxn1440\\margbsxn1440\\pgdscnxt0 Standard;}}\n" +
|
||||||
|
"\\paperh15840\\paperw12240\\margl1800\\margr1800\\margt" +
|
||||||
|
"1440\\margb1440\\sectd\\sbknone\\pgwsxn12240\\pghsxn" +
|
||||||
|
"15840\\marglsxn1800\\margrsxn1800\\margtsxn1440\\margbsxn" +
|
||||||
|
"1440\\ftnbj\\ftnstart1\\ftnrstcont\\ftnnar\\aenddoc\\aftnr" +
|
||||||
|
"stcont\\aftnstart1\\aftnnrlc\n" +
|
||||||
|
"\\pard\\plain \\s1\\fs40\\qc test rtf file.\n" +
|
||||||
|
"\\par \\pard\\plain \\s1 \n" +
|
||||||
|
"\\par This app uses the interMedia INSO filtering to " +
|
||||||
|
"automatically convert from an RTF format to html format.\n" +
|
||||||
|
"\\par \n" +
|
||||||
|
"\\par But lets see if it really works.\n" +
|
||||||
|
"\\par \n\\par }\n";
|
||||||
|
|
||||||
|
|
||||||
|
// The following should be the result of converting rtfTestFile
|
||||||
|
// to html using the inso filter.
|
||||||
|
private static final String rtfTestFileHTML =
|
||||||
|
"<HTML><BODY>\n" +
|
||||||
|
"<P><A NAME=\"s1content\"></A>test rtf file. <BR></P>\n" +
|
||||||
|
"<P>This app uses the interMedia INSO filtering to \n" +
|
||||||
|
"automatically convert from an RTF format to html \n" +
|
||||||
|
"format. <BR></P>\n" +
|
||||||
|
"<P>But lets see if it really works.</P>\n" +
|
||||||
|
"</BODY></HTML>\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,11 @@ public class IntermediaConfig extends AbstractConfig {
|
||||||
private BooleanParameter m_stemming = new BooleanParameter
|
private BooleanParameter m_stemming = new BooleanParameter
|
||||||
("waf.intermedia.stemming", Parameter.REQUIRED,
|
("waf.intermedia.stemming", Parameter.REQUIRED,
|
||||||
Boolean.FALSE);
|
Boolean.FALSE);
|
||||||
|
/** Enable INSO filter for (advanced) intermedia text search. Set to true
|
||||||
|
when using intermedia search. */
|
||||||
|
private Parameter m_insoFilterEnabled = new BooleanParameter
|
||||||
|
("waf.intermedia.inso_filter_enabled", Parameter.REQUIRED,
|
||||||
|
Boolean.FALSE);
|
||||||
|
|
||||||
|
|
||||||
public IntermediaConfig() {
|
public IntermediaConfig() {
|
||||||
|
|
@ -79,6 +84,7 @@ public class IntermediaConfig extends AbstractConfig {
|
||||||
register(m_maxIndexingTime);
|
register(m_maxIndexingTime);
|
||||||
register(m_indexingRetryDelay);
|
register(m_indexingRetryDelay);
|
||||||
register(m_stemming);
|
register(m_stemming);
|
||||||
|
register(m_insoFilterEnabled);
|
||||||
|
|
||||||
loadInfo();
|
loadInfo();
|
||||||
}
|
}
|
||||||
|
|
@ -143,4 +149,9 @@ public class IntermediaConfig extends AbstractConfig {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isINSOFilterEnabled() {
|
||||||
|
return ((Boolean)get(m_insoFilterEnabled)).booleanValue();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,6 @@
|
||||||
|
|
||||||
package com.arsdigita.ui;
|
package com.arsdigita.ui;
|
||||||
|
|
||||||
// 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.ContextInitEvent;
|
||||||
import com.arsdigita.runtime.ConfigError;
|
import com.arsdigita.runtime.ConfigError;
|
||||||
|
|
||||||
|
|
@ -40,7 +35,6 @@ import org.apache.log4j.Logger;
|
||||||
* @author pb
|
* @author pb
|
||||||
* @version $Id: $
|
* @version $Id: $
|
||||||
*/
|
*/
|
||||||
// public class Initializer extends CompoundInitializer {
|
|
||||||
public class Initializer extends com.arsdigita.runtime.GenericInitializer {
|
public class Initializer extends com.arsdigita.runtime.GenericInitializer {
|
||||||
|
|
||||||
/** Creates a s_logging category with name = to the full name of class */
|
/** Creates a s_logging category with name = to the full name of class */
|
||||||
|
|
@ -51,7 +45,7 @@ public class Initializer extends com.arsdigita.runtime.GenericInitializer {
|
||||||
// s_log.debug("ui configuration loaded.");
|
// s_log.debug("ui configuration loaded.");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public Initializer() {
|
public Initializer() {
|
||||||
}
|
}
|
||||||
|
|
@ -93,7 +87,13 @@ public class Initializer extends com.arsdigita.runtime.GenericInitializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method creates the layout definitions
|
||||||
|
* @param desc
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private SimplePageLayout buildLayout(List desc) {
|
private SimplePageLayout buildLayout(List desc) {
|
||||||
|
|
||||||
SimplePageLayout layout = new SimplePageLayout();
|
SimplePageLayout layout = new SimplePageLayout();
|
||||||
|
|
||||||
Iterator comps = desc.iterator();
|
Iterator comps = desc.iterator();
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,12 @@
|
||||||
package com.arsdigita.ui;
|
package com.arsdigita.ui;
|
||||||
|
|
||||||
import com.arsdigita.runtime.AbstractConfig;
|
import com.arsdigita.runtime.AbstractConfig;
|
||||||
import com.arsdigita.util.parameter.ArrayOfStringArrayParameter;
|
import com.arsdigita.util.StringUtils;
|
||||||
import com.arsdigita.util.parameter.StringArrayParameter;
|
import com.arsdigita.util.parameter.StringArrayParameter;
|
||||||
import com.arsdigita.util.parameter.Parameter;
|
import com.arsdigita.util.parameter.Parameter;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
// import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
@ -63,33 +63,38 @@ public class UIConfig extends AbstractConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default set of page component objects defining the default layout for the
|
* Default set of page component objects defining the default layout for the
|
||||||
* SimplePage class.
|
* <strong>SimplePage</strong> class.
|
||||||
* Format: list
|
|
||||||
*
|
*
|
||||||
|
* Format expected by clients:
|
||||||
|
* list { { "margin_position", "class_name_of_bebop_component"} ,
|
||||||
|
* { "margin_position", "class_name_of_bebop_component"} ,
|
||||||
|
* ...
|
||||||
|
* { "margin_position", "class_name_of_bebop_component"}
|
||||||
|
* }
|
||||||
|
* Elements are optional and may have 0 ...n pairs of position/classname.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* 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" }
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* Currently there is no list parameter model available. We use a
|
||||||
|
* StringArrayParameter instead, where each String element contains a
|
||||||
|
* colon separated position:class entry. It is converted to a list by
|
||||||
|
* the getter method.
|
||||||
*/
|
*/
|
||||||
// From the OLD initializer:
|
// Quick 'md Dirty, we reeally need a StringListParameter class
|
||||||
// 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 =
|
private final Parameter m_defaultLayout =
|
||||||
new StringArrayParameter(
|
new StringArrayParameter(
|
||||||
"waf.ui.default_layout",
|
"waf.ui.default_layout",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
new String[]
|
new String[]
|
||||||
{ "top:com.arsdigita.ui.UserBanner"
|
{ "top:com.arsdigita.ui.UserBanner"
|
||||||
,"bottom:com.arsdigita.ui.SiteBanner"
|
,"bottom:com.arsdigita.ui.SiteBanner"
|
||||||
,"bottom:com.arsdigita.ui.DebugPanel"
|
,"bottom:com.arsdigita.ui.DebugPanel"
|
||||||
//,"left:com.arsdigita.x.y.zl",
|
//,"left:com.arsdigita.x.y.zl",
|
||||||
//,"right:com.arsdigita.x.y.zr",
|
//,"right:com.arsdigita.x.y.zr",
|
||||||
}
|
}
|
||||||
|
|
@ -97,7 +102,29 @@ public class UIConfig extends AbstractConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The customized layout for applications using the SimplePage class
|
* The customized layout for applications using the SimplePage class
|
||||||
* Format: list
|
* Format: list presumably same format as m_defaultLayout. details unknown
|
||||||
|
*
|
||||||
|
* According to a comment in old enterprise.init file:
|
||||||
|
* // Application specific page components
|
||||||
|
* // applicationLayouts = {
|
||||||
|
* // { "forums",
|
||||||
|
* // {
|
||||||
|
* // { "top", "com.arsdigita.x.y.z" },
|
||||||
|
* // { "left", "com.arsdigita.x.y.z" },
|
||||||
|
* // { "bottom", "com.arsdigita.x.y.z" },
|
||||||
|
* // { "right", "com.arsdigita.x.y.z" }
|
||||||
|
* // }
|
||||||
|
* // },
|
||||||
|
* // { "search",
|
||||||
|
* // {
|
||||||
|
* // { "top", "com.arsdigita.x.y.z" },
|
||||||
|
* // { "left", "com.arsdigita.x.y.z" },
|
||||||
|
* // { "bottom", "com.arsdigita.x.y.z" },
|
||||||
|
* // { "right", "com.arsdigita.x.y.z" }
|
||||||
|
* // }
|
||||||
|
* // }
|
||||||
|
* // };
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
private final Parameter m_applicationLayouts =
|
private final Parameter m_applicationLayouts =
|
||||||
new StringArrayParameter(
|
new StringArrayParameter(
|
||||||
|
|
@ -127,25 +154,45 @@ public class UIConfig extends AbstractConfig {
|
||||||
* the default layout for SimplePage class.
|
* the default layout for SimplePage class.
|
||||||
*/
|
*/
|
||||||
public List getDefaultLayout() {
|
public List getDefaultLayout() {
|
||||||
// String[][] defaultLayoutArray = (String[]) get(m_defaultLayout);
|
|
||||||
String[][] defaultLayoutArray =
|
/** List contain the default layout used to create a SimplePage. */
|
||||||
new String[][]
|
ArrayList defaultLayout = new ArrayList();
|
||||||
{{ "top","com.arsdigita.ui.UserBanner"}
|
/** Value of the defaultLayout parameter, a string array of
|
||||||
,{"bottom","com.arsdigita.ui.SiteBanner"}
|
pair of position:class strings */
|
||||||
,{"bottom","com.arsdigita.ui.DebugPanel"}
|
String[] layoutParameter = (String[]) get(m_defaultLayout) ;
|
||||||
//,{"left","com.arsdigita.x.y.zl"},
|
|
||||||
//,{"right","com.arsdigita.x.y.zr"},
|
for (int i = 0; i < layoutParameter.length ; ++i) {
|
||||||
};
|
String[] layoutSection = StringUtils.split(layoutParameter[i],':');
|
||||||
return Arrays.asList(defaultLayoutArray);
|
defaultLayout.add(Arrays.asList(layoutSection));
|
||||||
|
}
|
||||||
|
return defaultLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the set of default page component objects defining
|
* Retrieve the set of customized layout for applications using the
|
||||||
* the default layout for SimplePage class.
|
* SimplePage class.
|
||||||
|
* Parameter is optional, method may return null!
|
||||||
*/
|
*/
|
||||||
public List getApplicationLayouts() {
|
public List getApplicationLayouts() {
|
||||||
String[] layouts = (String[]) get(m_applicationLayouts);
|
|
||||||
return Arrays.asList(layouts);
|
/** Value of the customLayout parameter, a string array of
|
||||||
|
pair of position:class strings */
|
||||||
|
String[] customParameter = (String[]) get(m_applicationLayouts) ;
|
||||||
|
|
||||||
|
if (customParameter != null) {
|
||||||
|
// This part of method could NOT be tested yet!
|
||||||
|
/** List contain the application layout used to create a SimplePage. */
|
||||||
|
ArrayList customLayout = new ArrayList();
|
||||||
|
for (int i = 0; i < customParameter.length ; ++i) {
|
||||||
|
String[] layoutSection = StringUtils.split(customParameter[i],':');
|
||||||
|
customLayout.add(Arrays.asList(layoutSection));
|
||||||
|
}
|
||||||
|
return customLayout;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue