ccm-ldn-search jetzt legacy-free. Servlet SearchWorkerServlet in Initializer verschoben, muss aus web.xml entfernt werden. Remote background threads auf 0 gesetzt, da praktisch nicht verwendet.

git-svn-id: https://svn.libreccm.org/ccm/trunk@1531 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2012-03-03 12:23:21 +00:00
parent 5e60eed0aa
commit 4b80e714bb
47 changed files with 704 additions and 133 deletions

View File

@ -108,6 +108,8 @@ com.arsdigita.navigation.templates_file=bundle/navigation/gen-templates.txt
# ccm-search application # ccm-search application
com.arsdigita.london.search.show_sponsored_links=true com.arsdigita.london.search.show_sponsored_links=true
; Comment this out or increase the num_of_threads iv you really use remote search
com.arsdigita.london.search.num_threads=0
# ccm-subsite application # ccm-subsite application

View File

@ -267,12 +267,6 @@
<!-- module ccm-rssfeed - servlet declaration END --> <!-- module ccm-rssfeed - servlet declaration END -->
<!-- module ccm-ldn-search - servlet declarations BEGIN --> <!-- module ccm-ldn-search - servlet declarations BEGIN -->
<servlet>
<servlet-name>worker</servlet-name>
<servlet-class>com.arsdigita.london.search.SearchWorkerServlet</servlet-class>
<load-on-startup>4</load-on-startup>
</servlet>
<servlet> <servlet>
<servlet-name>search-files</servlet-name> <servlet-name>search-files</servlet-name>
<servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class> <servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>

View File

@ -108,6 +108,8 @@ com.arsdigita.navigation.templates_file=bundle/navigation/gen-templates.txt
# ccm-search application # ccm-search application
com.arsdigita.london.search.show_sponsored_links=true com.arsdigita.london.search.show_sponsored_links=true
; Comment this out or increase the num_of_threads iv you really use remote search
com.arsdigita.london.search.num_threads=0
# ccm-subsite application # ccm-subsite application

View File

@ -267,12 +267,6 @@
<!-- module ccm-rssfeed - servlet declaration END --> <!-- module ccm-rssfeed - servlet declaration END -->
<!-- module ccm-ldn-search - servlet declarations BEGIN --> <!-- module ccm-ldn-search - servlet declarations BEGIN -->
<servlet>
<servlet-name>worker</servlet-name>
<servlet-class>com.arsdigita.london.search.SearchWorkerServlet</servlet-class>
<load-on-startup>4</load-on-startup>
</servlet>
<servlet> <servlet>
<servlet-name>search-files</servlet-name> <servlet-name>search-files</servlet-name>
<servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class> <servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>

View File

@ -57,7 +57,6 @@ import com.arsdigita.persistence.OID;
import com.arsdigita.persistence.pdl.ManifestSource; import com.arsdigita.persistence.pdl.ManifestSource;
import com.arsdigita.persistence.pdl.NameFilter; import com.arsdigita.persistence.pdl.NameFilter;
import com.arsdigita.runtime.CompoundInitializer; import com.arsdigita.runtime.CompoundInitializer;
// import com.arsdigita.runtime.ConfigError;
import com.arsdigita.runtime.DomainInitEvent; import com.arsdigita.runtime.DomainInitEvent;
import com.arsdigita.runtime.PDLInitializer; import com.arsdigita.runtime.PDLInitializer;
import com.arsdigita.runtime.RuntimeConfig; import com.arsdigita.runtime.RuntimeConfig;
@ -80,11 +79,9 @@ import com.arsdigita.templating.PatternStylesheetResolver;
import com.arsdigita.cms.util.LanguageUtil; import com.arsdigita.cms.util.LanguageUtil;
import com.arsdigita.kernel.Kernel; import com.arsdigita.kernel.Kernel;
// For Id.
// import java.math.BigDecimal;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* The main CMS initializer, executed recurringly at each system startup. * The main CMS initializer, executed recurringly at each system startup.
* *

View File

@ -34,6 +34,7 @@ import org.apache.log4j.Logger;
*/ */
public class Admin extends Application { public class Admin extends Application {
/** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger(Admin.class); private static final Logger s_log = Logger.getLogger(Admin.class);
public static final String BASE_DATA_OBJECT_TYPE public static final String BASE_DATA_OBJECT_TYPE

View File

@ -62,6 +62,7 @@ import org.apache.log4j.Logger;
public class AdminServlet extends BaseApplicationServlet public class AdminServlet extends BaseApplicationServlet
implements AdminConstants{ implements AdminConstants{
/** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger( private static final Logger s_log = Logger.getLogger(
AdminServlet.class.getName()); AdminServlet.class.getName());

View File

@ -124,6 +124,8 @@ com.arsdigita.london.search.show_sponsored_links=true
# ccm-ldn-subsite application # ccm-ldn-subsite application
com.arsdigita.london.subsite.root_category_picker=com.arsdigita.london.terms.ui.RootCategoryPicker com.arsdigita.london.subsite.root_category_picker=com.arsdigita.london.terms.ui.RootCategoryPicker
; Comment this out if you really use the remote facility
com.arsdigita.london.search.num_threads=0
# ccm-themedirector application # ccm-themedirector application

View File

@ -277,12 +277,6 @@
<!-- module ccm-rssfeed - servlet declaration END --> <!-- module ccm-rssfeed - servlet declaration END -->
<!-- module ccm-ldn-search - servlet declarations BEGIN --> <!-- module ccm-ldn-search - servlet declarations BEGIN -->
<servlet>
<servlet-name>worker</servlet-name>
<servlet-class>com.arsdigita.london.search.SearchWorkerServlet</servlet-class>
<load-on-startup>4</load-on-startup>
</servlet>
<servlet> <servlet>
<servlet-name>search-files</servlet-name> <servlet-name>search-files</servlet-name>
<servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class> <servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>

View File

@ -123,6 +123,8 @@ com.arsdigita.navigation.default_template=/templates/ccm-navigation/navigation/s
# ccm-search application # ccm-search application
com.arsdigita.london.search.show_sponsored_links=true com.arsdigita.london.search.show_sponsored_links=true
; Comment this out or increase the num_of_threads iv you really use remote search
com.arsdigita.london.search.num_threads=0
# ccm-subsite application # ccm-subsite application

View File

@ -249,12 +249,6 @@
<!-- module ccm-rssfeed - servlet declaration END --> <!-- module ccm-rssfeed - servlet declaration END -->
<!-- module ccm-ldn-search - servlet declarations BEGIN --> <!-- module ccm-ldn-search - servlet declarations BEGIN -->
<servlet>
<servlet-name>worker</servlet-name>
<servlet-class>com.arsdigita.london.search.SearchWorkerServlet</servlet-class>
<load-on-startup>4</load-on-startup>
</servlet>
<servlet> <servlet>
<servlet-name>search-files</servlet-name> <servlet-name>search-files</servlet-name>
<servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class> <servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>

View File

@ -132,6 +132,8 @@ com.arsdigita.navigation.default_template=/packages/navigation/templates/default
# ccm-ldn-search application # ccm-ldn-search application
com.arsdigita.london.search.show_sponsored_links=true com.arsdigita.london.search.show_sponsored_links=true
; Comment this out or increase the num_of_threads iv you really use remote search
com.arsdigita.london.search.num_threads=0
# ccm-ldn-subsite application # ccm-ldn-subsite application

View File

@ -277,12 +277,6 @@
<!-- module ccm-rssfeed - servlet declaration END --> <!-- module ccm-rssfeed - servlet declaration END -->
<!-- module ccm-ldn-search - servlet declarations BEGIN --> <!-- module ccm-ldn-search - servlet declarations BEGIN -->
<servlet>
<servlet-name>worker</servlet-name>
<servlet-class>com.arsdigita.london.search.SearchWorkerServlet</servlet-class>
<load-on-startup>4</load-on-startup>
</servlet>
<servlet> <servlet>
<servlet-name>search-files</servlet-name> <servlet-name>search-files</servlet-name>
<servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class> <servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>

View File

@ -121,6 +121,8 @@ com.arsdigita.navigation.default_template=/packages/navigation/templates/default
# ccm-ldn-search application # ccm-ldn-search application
com.arsdigita.london.search.show_sponsored_links=true com.arsdigita.london.search.show_sponsored_links=true
; Comment this out or increase the num_of_threads iv you really use remote search
com.arsdigita.london.search.num_threads=0
# ccm-ldn-subsite application # ccm-ldn-subsite application

View File

@ -277,12 +277,6 @@
<!-- module ccm-rssfeed - servlet declaration END --> <!-- module ccm-rssfeed - servlet declaration END -->
<!-- module ccm-ldn-search - servlet declarations BEGIN --> <!-- module ccm-ldn-search - servlet declarations BEGIN -->
<servlet>
<servlet-name>worker</servlet-name>
<servlet-class>com.arsdigita.london.search.SearchWorkerServlet</servlet-class>
<load-on-startup>4</load-on-startup>
</servlet>
<servlet> <servlet>
<servlet-name>search-files</servlet-name> <servlet-name>search-files</servlet-name>
<servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class> <servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>

View File

@ -121,6 +121,8 @@ com.arsdigita.navigation.default_template=/packages/navigation/templates/default
# ccm-ldn-search application # ccm-ldn-search application
com.arsdigita.london.search.show_sponsored_links=true com.arsdigita.london.search.show_sponsored_links=true
; Comment this out or increase the num_of_threads iv you really use remote search
com.arsdigita.london.search.num_threads=0
# ccm-ldn-subsite application # ccm-ldn-subsite application

View File

@ -277,12 +277,6 @@
<!-- module ccm-rssfeed - servlet declaration END --> <!-- module ccm-rssfeed - servlet declaration END -->
<!-- module ccm-ldn-search - servlet declarations BEGIN --> <!-- module ccm-ldn-search - servlet declarations BEGIN -->
<servlet>
<servlet-name>worker</servlet-name>
<servlet-class>com.arsdigita.london.search.SearchWorkerServlet</servlet-class>
<load-on-startup>4</load-on-startup>
</servlet>
<servlet> <servlet>
<servlet-name>search-files</servlet-name> <servlet-name>search-files</servlet-name>
<servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class> <servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>

View File

@ -2,7 +2,7 @@
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
name="ccm-ldn-search" name="ccm-ldn-search"
prettyName="Search" prettyName="Search"
version="6.6.0" version="6.6.1"
release="1" release="1"
webapp="ROOT"> webapp="ROOT">
<ccm:dependencies> <ccm:dependencies>
@ -15,7 +15,7 @@
<ccm:contact uri="mailto:rhea@redhat.com" type="support"/> <ccm:contact uri="mailto:rhea@redhat.com" type="support"/>
</ccm:contacts> </ccm:contacts>
<ccm:description> <ccm:description>
The Red Hat Web Application Framework is a platform for writing Adds capability to include remote CCM instances into search and combine the
database-backed web applications in Java. results into one integrated list.
</ccm:description> </ccm:description>
</ccm:application> </ccm:application>

View File

@ -20,5 +20,6 @@ model com.arsdigita.london.search;
import com.arsdigita.web.Application; import com.arsdigita.web.Application;
object type Search extends Application { object type Search extends Application {
reference key (search_app.application_id); // reference key (search_app.application_id);
// nothing really to store here
} }

View File

@ -0,0 +1,23 @@
--
-- Copyright (C) 2011 Peter Boy 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
--
-- $Id: drop_app_table.sql pboy $
-- drops table subsite_app which just contained application type id and is
-- never used for any action.
drop table search_app ;

View File

@ -0,0 +1,131 @@
--
-- Copyright (C) 2012 Peter Boy. 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
--
-- $Id: remove_legacy_entries.sql $
-- Search is now initialized as a legacy free type of application so
-- entries in tables apm_package_types are no longer needed.
-- in case there may be several application instances!
-- delete from object_context all entries referring to node_id in site_nodes
delete from object_context
where object_id in
(select node_id from site_nodes object_id where object_id in
( select package_id from applications where application_type_id =
(select application_type_id from application_types
where object_type
like '%search.Search%')
)
);
-- delete from acs_objects all entries referring to node_id in site_nodes
alter table site_nodes drop constraint site_nodes_node_id_f_n1m2y ;
delete from acs_objects
where object_id in
(select node_id from site_nodes where object_id in
( select package_id from applications where application_type_id =
(select application_type_id from application_types
where object_type
like '%search.Search%')
)
);
-- delete all entries in site_nodes referring to a subsite instance
delete from site_nodes
where object_id in
(select package_id from applications where application_type_id =
(select application_type_id from application_types
where object_type
like '%search.Search%')
);
alter table site_nodes add constraint site_nodes_node_id_f_n1m2y
FOREIGN KEY (node_id)
REFERENCES acs_objects (object_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION ;
-- delete from object_context all entries referring to package_id in apm_packages
delete from object_context
where object_id in
(select package_id from apm_packages where package_type_id =
(select package_type_id from application_types
where object_type
like '%search.Search%')
);
-- delete from acs_objects all entries referring to package_id in apm_packages
alter table apm_packages drop constraint apm_package_package_id_f_46may ;
alter table applications drop constraint application_package_id_f_cdaho ;
delete from acs_objects
where object_id in
(select package_id from apm_packages where package_type_id =
(select package_type_id from application_types
where object_type
like '%search.Search%')
);
-- delete all entries for subsite instances in apm_packages
-- identified by package_type_id in application_types
delete from apm_packages
where package_type_id =
(select package_type_id from application_types
where object_type
like '%search.Search%') ;
-- there seem to be no intries for a apm_packages_types entry (row) in
-- acs_objects or object_context!
-- delete all entries for subsite in apm_package_types identified by
-- package_type_id in application_types
alter table application_types drop constraint applica_typ_pac_typ_id_f_v80ma ;
delete from apm_package_types
where package_type_id =
(select package_type_id from application_types
where object_type
like '%search.Search%') ;
-- set package_id to null for all entries referring to a subsite instance
-- (indicating a new legacy free application)
update applications
set package_id = null
where application_type_id =
(select application_type_id from application_types
where object_type
like '%search.Search%') ;
-- set package_id to null for all entries referring to a subsite instance
-- (indicating a new legacy free application)
update application_types
set package_type_id = null
where object_type like '%search.Search%' ;
alter table application_types add constraint applica_typ_pac_typ_id_f_v80ma
FOREIGN KEY (package_type_id)
REFERENCES apm_package_types (package_type_id)
MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION ;
alter table applications add constraint application_package_id_f_cdaho
FOREIGN KEY (package_id)
REFERENCES apm_packages (package_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION ;
alter table apm_packages add constraint apm_package_package_id_f_46may
FOREIGN KEY (package_id)
REFERENCES acs_objects (object_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION ;

View File

@ -0,0 +1,26 @@
--
-- Copyright (C) 2011 Peter Boy 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
--
-- $Id: upd_cms_tables.sql pboy $
-- adjust cms tables to the new name of application subsite
update content_sections
set template_resolver_class = replace(template_resolver_class,
'london.subsite', 'subsite');

View File

@ -0,0 +1,66 @@
--
-- Copyright (C) 2011 Peter Boy 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
--
-- $Id: upd_system_tables.sql pboy $
-- adjust various system tables to the new name of application subsite
alter table init_requirements drop constraint init_requirements_init_f_cmmdn ;
alter table init_requirements drop constraint init_require_requ_init_f_i6rgg ;
update inits
set class_name=replace(class_name,'london.subsite', 'subsite')
where class_name like '%london.subsite%' ;
update init_requirements
set init=replace(init,'london.subsite', 'subsite')
where init like '%london.subsite%' ;
update init_requirements
set required_init=replace(required_init,'london.subsite', 'subsite')
where required_init like '%london.subsite%' ;
ALTER TABLE ONLY init_requirements
ADD CONSTRAINT init_requirements_init_f_cmmdn FOREIGN KEY (init)
REFERENCES inits (class_name) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION;
ALTER TABLE init_requirements
ADD CONSTRAINT init_require_requ_init_f_i6rgg FOREIGN KEY (required_init)
REFERENCES inits (class_name) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION;
update application_types
set object_type=replace(object_type,'london.subsite', 'subsite')
where object_type like '%london.subsite%' ;
-- table applications doesn't require an update
-- table apm_package_types doesn't require an update
-- table apm_packages doesn't require an update either
-- table site_nodes doesn't require an update either
-- update application type in acs_objects
update acs_objects
set (object_type,default_domain_class) =
(replace(object_type,'london.subsite', 'subsite') ,
replace(default_domain_class,'london.subsite', 'subsite') )
where object_type like '%london.subsite%' ;

View File

@ -0,0 +1,31 @@
--
-- Copyright (C) 2012 Peter Boy 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
--
-- $DateTime: 2011/03/27 23:15:09 $
-- $Id: oracle-se-6.6.0-6.6.1 pboy $
-- drop table search_app - not needed anyway
@@ default/6.6.0-6.6.1/drop_app_table.sql
-- remove legacy compatible bits
@@ default/6.6.0-6.6.1/remove_legacy_entries.sql
-- rename application from london.subsite to subsite
-- @@ default/6.6.0-6.6.1/upd_system_tables.sql
-- adjust class name in content_sections table
-- @@ default/6.6.0-6.6.1/upd_cms_tables.sql

View File

@ -0,0 +1,36 @@
--
-- Copyright (C) 2012 Peter Boy 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
--
-- $DateTime: 2010/11/10 23:15:09 $
\echo Red Hat Enterprise ccm-ldn-search 6.6.0 -> 6.6.1 Upgrade Script (PostgreSQL)
begin;
-- drop table search_app - not needed anyway
\i default/6.6.0-6.6.1/drop_app_table.sql
-- remove legacy compatible bits
\i default/6.6.0-6.6.1/remove_legacy_entries.sql
-- rename application from london.subsite to subsite
-- \i default/6.6.0-6.6.1/upd_system_tables.sql
-- adjust class name in content_sections table
-- \i default/6.6.0-6.6.1/upd_cms_tables.sql
commit;

View File

@ -0,0 +1,5 @@
<upgrade>
<version from="6.6.0" to="6.6.1">
<script sql="ccm-ldn-search/upgrade/::database::-6.6.0-6.6.1.sql"/>
</version>
</upgrade>

View File

@ -21,9 +21,14 @@ package com.arsdigita.london.search;
import com.arsdigita.cms.search.VersionFilterType; import com.arsdigita.cms.search.VersionFilterType;
import com.arsdigita.cms.search.LuceneQueryEngine; import com.arsdigita.cms.search.LuceneQueryEngine;
import com.arsdigita.db.DbHelper; import com.arsdigita.db.DbHelper;
import com.arsdigita.domain.DomainObject;
import com.arsdigita.kernel.ACSObjectInstantiator;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.pdl.ManifestSource; import com.arsdigita.persistence.pdl.ManifestSource;
import com.arsdigita.persistence.pdl.NameFilter; import com.arsdigita.persistence.pdl.NameFilter;
import com.arsdigita.runtime.CompoundInitializer; import com.arsdigita.runtime.CompoundInitializer;
import com.arsdigita.runtime.ContextCloseEvent;
import com.arsdigita.runtime.ContextInitEvent;
import com.arsdigita.runtime.DomainInitEvent; import com.arsdigita.runtime.DomainInitEvent;
import com.arsdigita.runtime.PDLInitializer; import com.arsdigita.runtime.PDLInitializer;
import com.arsdigita.runtime.RuntimeConfig; import com.arsdigita.runtime.RuntimeConfig;
@ -32,6 +37,8 @@ import com.arsdigita.search.FilterType;
import com.arsdigita.search.QueryEngineRegistry; import com.arsdigita.search.QueryEngineRegistry;
import com.arsdigita.search.filters.ObjectTypeFilterType; import com.arsdigita.search.filters.ObjectTypeFilterType;
import org.apache.log4j.Logger;
/** /**
* The Search initializer. * The Search initializer.
* *
@ -40,6 +47,10 @@ import com.arsdigita.search.filters.ObjectTypeFilterType;
*/ */
public class Initializer extends CompoundInitializer { public class Initializer extends CompoundInitializer {
private static final Logger s_log = Logger.getLogger(Initializer.class);
private Thread[] m_workers;
public Initializer() { public Initializer() {
final String url = RuntimeConfig.getConfig().getJDBCURL(); final String url = RuntimeConfig.getConfig().getJDBCURL();
final int database = DbHelper.getDatabaseFromURL(url); final int database = DbHelper.getDatabaseFromURL(url);
@ -62,6 +73,16 @@ public class Initializer extends CompoundInitializer {
public void init(DomainInitEvent e) { public void init(DomainInitEvent e) {
super.init(e); super.init(e);
/* Register object instantiator for Search */
e.getFactory().registerInstantiator(
Search.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) {
return new Search(dataObject);
}
});
SearchGroup.setSearchTimeout SearchGroup.setSearchTimeout
(Search.getConfig().getSearchTimeout().intValue()); (Search.getConfig().getSearchTimeout().intValue());
@ -69,6 +90,46 @@ public class Initializer extends CompoundInitializer {
registerRemoteSearch(); registerRemoteSearch();
} }
/**
*
* @param evt
*/
@Override
public void init(ContextInitEvent evt) {
int nWorkers = Search.getConfig().getNumberOfThreads().intValue();
if (s_log.isDebugEnabled()) {
s_log.debug("Starting " + nWorkers + " worker threads");
}
m_workers = new Thread[nWorkers];
for (int i = 0 ; i < nWorkers ; i++) {
if (s_log.isDebugEnabled()) {
s_log.debug("Starting thread " + i);
}
m_workers[i] = new RemoteSearcher(SearchJobQueue.getInstance());
m_workers[i].start();
}
}
/**
*
*/
@Override
public void close(ContextCloseEvent evt) {
int nWorkers = m_workers.length;
for (int i = 0 ; i < nWorkers ; i++) {
if (s_log.isDebugEnabled()) {
s_log.debug("Starting thread " + i);
}
m_workers[i].stop();
}
}
private void registerRemoteSearch() { private void registerRemoteSearch() {
QueryEngineRegistry.registerEngine QueryEngineRegistry.registerEngine
("remote", new FilterType[] { ("remote", new FilterType[] {
@ -76,6 +137,7 @@ public class Initializer extends CompoundInitializer {
}, new RemoteQueryEngine()); }, new RemoteQueryEngine());
} }
private void registerLimitedSimpleSearch() { private void registerLimitedSimpleSearch() {
QueryEngineRegistry.registerEngine QueryEngineRegistry.registerEngine
(IndexerType.LUCENE, (IndexerType.LUCENE,

View File

@ -31,15 +31,21 @@ import com.arsdigita.web.ApplicationType;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* Loader (initial setup executed once at installation time). * <p>Executes nonrecurring at install time and loads (installs and initializes)
* the Remote Search module persistently into database.</p>
* *
* @author Justin Ross &lt;jross@redhat.com&gt; * @author Justin Ross &lt;jross@redhat.com&gt;
* @version $Id: Loader.java 758 2005-09-02 14:26:56Z sskracic $ * @version $Id: Loader.java 758 2005-09-02 14:26:56Z sskracic $
*/ */
public class Loader extends PackageLoader { public class Loader extends PackageLoader {
/** Creates a s_logging category with name = full name of class */
private static final Logger s_log = Logger.getLogger(Loader.class); private static final Logger s_log = Logger.getLogger(Loader.class);
/**
*
* @param ctx
*/
public void run(final ScriptContext ctx) { public void run(final ScriptContext ctx) {
new KernelExcursion() { new KernelExcursion() {
public void excurse() { public void excurse() {
@ -50,7 +56,12 @@ public class Loader extends PackageLoader {
} }
/**
* Create the Search application type and setup the default application
* instance.
*/
private void setupSearch() { private void setupSearch() {
/*
ApplicationSetup setup = new ApplicationSetup(s_log); ApplicationSetup setup = new ApplicationSetup(s_log);
setup.setApplicationObjectType(Search.BASE_DATA_OBJECT_TYPE); setup.setApplicationObjectType(Search.BASE_DATA_OBJECT_TYPE);
@ -65,14 +76,22 @@ public class Loader extends PackageLoader {
}); });
ApplicationType type = setup.run(); ApplicationType type = setup.run();
type.save(); type.save();
*/
/* Try: legacy free */
ApplicationType type = new ApplicationType("Search",
Search.BASE_DATA_OBJECT_TYPE );
type.setDescription("Public search");
type.save();
if (!Application.isInstalled(Search.BASE_DATA_OBJECT_TYPE, if (!Application.isInstalled(Search.BASE_DATA_OBJECT_TYPE,
"/search/")) { "/search/")) {
Application app = Application app = Application.createApplication(type,
Application.createApplication(type, "search",
"search", "Search",
"Search", null);
null);
app.save(); app.save();
} }
} }

View File

@ -18,6 +18,8 @@
package com.arsdigita.london.search; package com.arsdigita.london.search;
import com.arsdigita.util.UncheckedWrapperException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.rmi.RemoteException; import java.rmi.RemoteException;
@ -33,13 +35,16 @@ import org.apache.axis.client.Service;
import org.apache.axis.encoding.ser.BeanSerializerFactory; import org.apache.axis.encoding.ser.BeanSerializerFactory;
import org.apache.axis.encoding.ser.BeanDeserializerFactory; import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import com.arsdigita.util.UncheckedWrapperException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/**
*
*
*/
public class RemoteSearcher extends Thread { public class RemoteSearcher extends Thread {
private static final Logger s_log =
Logger.getLogger( RemoteSearcher.class ); /** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger( RemoteSearcher.class );
private SearchJobQueue m_queue; private SearchJobQueue m_queue;
private boolean m_stop = false; private boolean m_stop = false;
@ -53,6 +58,10 @@ public class RemoteSearcher extends Thread {
m_queue = queue; m_queue = queue;
} }
/**
*
*/
@Override
public void run() { public void run() {
// Initialize the SOAP call // Initialize the SOAP call
Service service; Service service;

View File

@ -25,31 +25,40 @@ import com.arsdigita.web.Application;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* Base class for the search application (module) * Base Domain Class for the search application (module).
* *
* Currently there is nothing specific to persist in permanent storage, so the
* corresponding pdl is empty an no class specific table created.
*/ */
public class Search extends Application { public class Search extends Application {
/** Logger instance for debugging */
private static final Logger logger = Logger.getLogger(Search.class); private static final Logger logger = Logger.getLogger(Search.class);
public static final String BASE_DATA_OBJECT_TYPE
= "com.arsdigita.london.search.Search";
private static SearchConfig s_config = new SearchConfig(); /** PDL refernce */
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.london.search.Search";
static { /** Config object containing various parameter */
logger.debug("Static initalizer starting..."); private static SearchConfig s_config = SearchConfig.getConfig();
s_config.load();
logger.debug("Static initalizer finished.");
}
/** Provide client classes with access to configuration data */
public static SearchConfig getConfig() { public static SearchConfig getConfig() {
return s_config; return s_config;
} }
/**
* Constructor based on DataObject information
* @param obj
*/
public Search(DataObject obj) { public Search(DataObject obj) {
super(obj); super(obj);
} }
/**
* Constructor retrieves Search application object based on OID
* @param oid
*/
public Search(OID oid) { public Search(OID oid) {
super(oid); super(oid);
} }
@ -89,6 +98,7 @@ public class Search extends Application {
* *
* @return path name to the applications servlet/JSP * @return path name to the applications servlet/JSP
*/ */
@Override
public String getServletPath() { public String getServletPath() {
//return "/files"; //return "/files";
return "/ccm-ldn-search/files"; return "/ccm-ldn-search/files";

View File

@ -37,36 +37,78 @@ import org.apache.log4j.Logger;
*/ */
public final class SearchConfig extends AbstractConfig { public final class SearchConfig extends AbstractConfig {
/** A logger instance to assist debugging. */
private static final Logger s_log = Logger.getLogger(SearchConfig.class); private static final Logger s_log = Logger.getLogger(SearchConfig.class);
private final Parameter m_numThreads; /** Singelton config object. */
private final Parameter m_searchTimeout; private static SearchConfig s_conf;
private final Parameter m_showSponsoredLinks;
private final Parameter m_maxRemoteResults; /**
private final Parameter m_remoteSearchContentSections; * Gain a SearchConfig object.
*
* Singelton pattern, don't instantiate a config object using the
* constructor directly!
* @return
*/
public static synchronized SearchConfig getConfig() {
if (s_conf == null) {
s_conf = new SearchConfig();
s_conf.load();
}
return s_conf;
}
// ////////////////////////////////////////////////////////////////////////
// Set of configuration parameters
/**
* Sets the number of threads that can respond to remote search queries
*/
private final Parameter m_numThreads = new
IntegerParameter("com.arsdigita.london.search.num_threads",
Parameter.REQUIRED, new Integer(10));
/**
* Sets the number of milleseconds to wait for the search to return results
* before timing out
*/
private final Parameter m_searchTimeout = new
IntegerParameter("com.arsdigita.london.search.timeout",
Parameter.REQUIRED, new Integer(4000));
/**
* Whether or not to display Sponsored Links in addition to search results
*/
private final Parameter m_showSponsoredLinks = new
BooleanParameter("com.arsdigita.london.search.show_sponsored_links",
Parameter.REQUIRED, Boolean.FALSE);
/**
* What is the maximum number of remote search results this server should return
*/
private final Parameter m_maxRemoteResults = new
IntegerParameter("com.arsdigita.london.search.max_remote_results",
Parameter.REQUIRED, new Integer(50));
/**
* When this host is a target for remote search, filter results to
* specified content sections
*/
private final Parameter m_remoteSearchContentSections = new
StringArrayParameter("com.arsdigita.london.search.remote_search_content_sections",
Parameter.OPTIONAL, null);
/**
*
*/
private final Parameter m_simpleRestrictTo = new
StringParameter("com.arsdigita.london.search.simple_restrict_to",
Parameter.OPTIONAL, "");
private final Parameter m_simpleRestrictTo;
private String[] simpleRestrictToArray; private String[] simpleRestrictToArray;
/**
* Constructor registers the configuration parameters and reads values from
* registry file.
*/
public SearchConfig() { public SearchConfig() {
m_numThreads = new IntegerParameter
("com.arsdigita.london.search.num_threads",
Parameter.REQUIRED, new Integer(10));
m_searchTimeout = new IntegerParameter
("com.arsdigita.london.search.timeout",
Parameter.REQUIRED, new Integer(4000));
m_showSponsoredLinks = new BooleanParameter
("com.arsdigita.london.search.show_sponsored_links",
Parameter.REQUIRED, Boolean.FALSE);
m_maxRemoteResults = new IntegerParameter
("com.arsdigita.london.search.max_remote_results",
Parameter.REQUIRED, new Integer(50));
m_remoteSearchContentSections = new StringArrayParameter
("com.arsdigita.london.search.remote_search_content_sections",
Parameter.OPTIONAL, null);
m_simpleRestrictTo = new StringParameter
("com.arsdigita.london.search.simple_restrict_to",
Parameter.OPTIONAL, "");
register(m_numThreads); register(m_numThreads);
register(m_searchTimeout); register(m_searchTimeout);
@ -74,31 +116,46 @@ public final class SearchConfig extends AbstractConfig {
register(m_maxRemoteResults); register(m_maxRemoteResults);
register(m_remoteSearchContentSections); register(m_remoteSearchContentSections);
register(m_simpleRestrictTo); register(m_simpleRestrictTo);
loadInfo(); loadInfo();
} }
/**
* Get the number of threads that can respond to remote search queries
* @return Number of threads to start
*/
public final Integer getNumberOfThreads() { public final Integer getNumberOfThreads() {
return (Integer) get(m_numThreads); return (Integer) get(m_numThreads);
} }
/**
* Get the number of milleseconds to wait for the search to return results
* before timing out
* @return Milliseconds to wait
*/
public final Integer getSearchTimeout() { public final Integer getSearchTimeout() {
return (Integer) get(m_searchTimeout); return (Integer) get(m_searchTimeout);
} }
/**
* Whether or not to display Sponsored Links in addition to search results
* @return
*/
public final Boolean getShowSponsoredLinks() { public final Boolean getShowSponsoredLinks() {
return (Boolean) get(m_showSponsoredLinks); return (Boolean) get(m_showSponsoredLinks);
} }
/**
* Get the maximum number of remote search results this server should return
* @return No of search results to show
*/
public final Integer getMaxRemoteResults() { public final Integer getMaxRemoteResults() {
return (Integer) get(m_maxRemoteResults); return (Integer) get(m_maxRemoteResults);
} }
public final String getSimpleRestrictTo() {
return (String) get(m_simpleRestrictTo);
}
/** /**
* When this server is the target of a remote search, this * When this server is the target of a remote search, this
* parameter enables us to filter by content section - so for * parameter enables us to filter by content section - so for
@ -112,6 +169,10 @@ public final class SearchConfig extends AbstractConfig {
return (String[])get(m_remoteSearchContentSections); return (String[])get(m_remoteSearchContentSections);
} }
public final String getSimpleRestrictTo() {
return (String) get(m_simpleRestrictTo);
}
public final String[] getSimpleRestrictToArray() { public final String[] getSimpleRestrictToArray() {
if (simpleRestrictToArray == null) { if (simpleRestrictToArray == null) {
loadSimpleRestrictToArray(); loadSimpleRestrictToArray();

View File

@ -18,17 +18,33 @@ package com.arsdigita.london.search;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
/**
*
*
*/
public class SearchJobQueue extends LinkedList { public class SearchJobQueue extends LinkedList {
private static SearchJobQueue s_jobQueue = new SearchJobQueue(); private static SearchJobQueue s_jobQueue = new SearchJobQueue();
/**
*
* @return
*/
public static SearchJobQueue getInstance() { public static SearchJobQueue getInstance() {
return s_jobQueue; return s_jobQueue;
} }
/**
*
*/
private SearchJobQueue() {} private SearchJobQueue() {}
/**
*
* @return
*/
public synchronized SearchJob getSearchJob() { public synchronized SearchJob getSearchJob() {
SearchJob job = null; SearchJob job = null;
while (job == null) { while (job == null) {
try { try {
@ -45,6 +61,10 @@ public class SearchJobQueue extends LinkedList {
return job; return job;
} }
/**
*
* @param job
*/
public synchronized void addSearchJob( SearchJob job ) { public synchronized void addSearchJob( SearchJob job ) {
addLast( job ); addLast( job );

View File

@ -24,11 +24,26 @@ import javax.servlet.ServletException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
// Deactivated!
// Moved into Initializer.
/** /**
* This isn't really used as a servlet - its just there * This isn't really used as a servlet - its just there
* isn't any other way to ensure that the threads are * isn't any other way to ensure that the threads are
* only started with a servlet container - ie not when * only started with a servlet container - ie not when
* using ccm-run. * using ccm-run.
*
* Must be activated by including following lines into web.xml
* <servlet>
* <servlet-name>worker</servlet-name>
* <servlet-class>com.arsdigita.london.search.SearchWorkerServlet</servlet-class>
* <load-on-startup>4</load-on-startup>
* </servlet>
*
*
*/ */
public class SearchWorkerServlet extends HttpServlet { public class SearchWorkerServlet extends HttpServlet {
@ -36,9 +51,15 @@ public class SearchWorkerServlet extends HttpServlet {
private Thread[] m_workers; private Thread[] m_workers;
/**
*
* @param config
* @throws ServletException
*/
@Override
public void init(ServletConfig config) public void init(ServletConfig config)
throws ServletException { throws ServletException {
/*
int nWorkers = Search.getConfig().getNumberOfThreads().intValue(); int nWorkers = Search.getConfig().getNumberOfThreads().intValue();
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Starting " + nWorkers + " worker threads"); s_log.debug("Starting " + nWorkers + " worker threads");
@ -51,6 +72,8 @@ public class SearchWorkerServlet extends HttpServlet {
m_workers[i] = new RemoteSearcher(SearchJobQueue.getInstance()); m_workers[i] = new RemoteSearcher(SearchJobQueue.getInstance());
m_workers[i].start(); m_workers[i].start();
} }
*/
} }
} }

View File

@ -1,3 +1,21 @@
/*
* Copyright (C) 2001-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.london.search.spider; package com.arsdigita.london.search.spider;
import com.arsdigita.persistence.PersistenceException; import com.arsdigita.persistence.PersistenceException;
@ -16,19 +34,26 @@ import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Vector; import java.util.Vector;
import org.apache.log4j.Logger;
/** /**
* Implementation of JoBo's HttpDocManager interface, the interface * Implementation of JoBo's HttpDocManager interface, the interface
* that is responsible for processing the content retrieved from * that is responsible for processing the content retrieved from
* the spider. * the spider.
* This implementation stores the content as {@link SpideredContent} * This implementation stores the content as {@link SpideredContent}
* domain objects. * domain objects.
* @see SpideredContent
*
* *
*@author <a href="mailto:mhanisch@redhat.com">Michael Hanisch</a> *@author <a href="mailto:mhanisch@redhat.com">Michael Hanisch</a>
*@version $Id: DocumentManager.java 287 2005-02-22 00:29:02Z sskracic $ *@version $Id: DocumentManager.java 287 2005-02-22 00:29:02Z sskracic $
*@see SpideredContent
*/ */
public class DocumentManager implements HttpDocManager { public class DocumentManager implements HttpDocManager {
/** A logger instance to assist debugging. */
private static final Logger s_log = Logger.getLogger(DocumentManager.class);
// HTTP headers // HTTP headers
private static final String LAST_MODIFIED_HEADER = "Last-Modified"; private static final String LAST_MODIFIED_HEADER = "Last-Modified";
private static final String CONTENT_TYPE_HEADER = "Content-Type"; private static final String CONTENT_TYPE_HEADER = "Content-Type";
@ -47,9 +72,10 @@ public class DocumentManager implements HttpDocManager {
public static final SimpleDateFormat rfc1123_formatter = public static final SimpleDateFormat rfc1123_formatter =
new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss z"); new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss z");
private static final org.apache.log4j.Logger s_log = /**
org.apache.log4j.Logger.getLogger(DocumentManager.class); *
* @param doc
*/
public void processDocument(HttpDoc doc) { public void processDocument(HttpDoc doc) {
/* TO DO: Create SpideredContent domain object, /* TO DO: Create SpideredContent domain object,
* set the properties and save() it * set the properties and save() it

View File

@ -1,3 +1,21 @@
/*
* Copyright (C) 2001-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.london.search.spider; package com.arsdigita.london.search.spider;
import net.matuschek.http.cookie.MemoryCookieManager; import net.matuschek.http.cookie.MemoryCookieManager;
@ -52,11 +70,15 @@ public class Scheduler {
return s_URLList; return s_URLList;
} }
/**
*
*/
public static synchronized void startTimer() { public static synchronized void startTimer() {
if (s_timer != null) { if (s_timer != null) {
return; // Timer already exists return; // Timer already exists
} }
else if (getURLs() == null || getURLs().size() == 0) { else if ( getURLs() == null || getURLs().isEmpty() ) {
// No URLs, no spider. // No URLs, no spider.
s_log.info("no URLs specified, spider disabled"); s_log.info("no URLs specified, spider disabled");
return; return;
@ -73,6 +95,9 @@ public class Scheduler {
s_timerFrequency); s_timerFrequency);
} }
/**
*
*/
public static synchronized void stopTimer() { public static synchronized void stopTimer() {
if (s_timer == null) { if (s_timer == null) {
return; // no Timer (?) return; // no Timer (?)

View File

@ -34,23 +34,34 @@ import com.arsdigita.search.ui.filters.ObjectTypeFilterComponent;
import com.arsdigita.search.FilterSpecification; import com.arsdigita.search.FilterSpecification;
import com.arsdigita.search.filters.ContentSectionFilterSpecification; import com.arsdigita.search.filters.ContentSectionFilterSpecification;
import org.apache.log4j.Logger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import org.apache.log4j.Logger;
/**
*
*
*/
public class SimpleQueryComponent extends BaseQueryComponent { public class SimpleQueryComponent extends BaseQueryComponent {
/** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger(SimpleQueryComponent.class); private static final Logger s_log = Logger.getLogger(SimpleQueryComponent.class);
private StringParameter m_hiddenAllowedContentSectionsList = new StringParameter("restrictToContentSections");
private StringParameter m_hiddenAllowedContentSectionsList = new
StringParameter("restrictToContentSections");
private String m_paramValue; private String m_paramValue;
private String[] contentSectionTitles; private String[] contentSectionTitles;
private boolean is_restricted; private boolean is_restricted;
private Form m_form; private Form m_form;
/**
*
* @param context
*/
public SimpleQueryComponent(String context) { public SimpleQueryComponent(String context) {
if (Search.getConfig().isIntermediaEnabled() || if (Search.getConfig().isIntermediaEnabled() ||
@ -69,8 +80,15 @@ public class SimpleQueryComponent extends BaseQueryComponent {
} }
/**
*
* @param form
* @param model
*/
@Override
public void register(Form form, FormModel model) { public void register(Form form, FormModel model) {
s_log.debug("Adding " + m_hiddenAllowedContentSectionsList.getName() + " to form model"); s_log.debug("Adding " + m_hiddenAllowedContentSectionsList.getName()
+ " to form model");
m_hiddenAllowedContentSectionsList.setPassIn(true); m_hiddenAllowedContentSectionsList.setPassIn(true);
model.addFormParam(m_hiddenAllowedContentSectionsList); model.addFormParam(m_hiddenAllowedContentSectionsList);
super.register(form, model); super.register(form, model);
@ -79,13 +97,15 @@ public class SimpleQueryComponent extends BaseQueryComponent {
/** /**
* Gets the hidden restrictToContentSections param. * Gets the hidden restrictToContentSections param.
* The param is in the form of a comma seperated list of content section names. * The param is in the form of a comma seperated list of content section
* If present the search will only return content items from these content sections. * names. If present the search will only return content items from these
**/ * content sections.
*/
protected String getContentSections(PageState state) { protected String getContentSections(PageState state) {
FormData formData = m_form.getFormData(state); FormData formData = m_form.getFormData(state);
if (formData != null) { if (formData != null) {
ParameterData contentSectionListParam = formData.getParameter(m_hiddenAllowedContentSectionsList.getName()); ParameterData contentSectionListParam =
formData.getParameter(m_hiddenAllowedContentSectionsList.getName());
String paramValue = (String)contentSectionListParam.getValue(); String paramValue = (String)contentSectionListParam.getValue();
m_paramValue = paramValue; m_paramValue = paramValue;
s_log.debug("content sections list is " + paramValue); s_log.debug("content sections list is " + paramValue);
@ -115,18 +135,21 @@ public class SimpleQueryComponent extends BaseQueryComponent {
/** /**
* Adds the content section filter to any existing filters. * Adds the content section filter to any existing filters.
**/ **/
@Override
protected FilterSpecification[] getFilters(PageState state) { protected FilterSpecification[] getFilters(PageState state) {
FilterSpecification[] existingfilters = super.getFilters(state); FilterSpecification[] existingfilters = super.getFilters(state);
List n = new ArrayList(); List n = new ArrayList();
try { try {
List filters = Arrays.asList(existingfilters); // this will throw a NullPointerException if there are no existing filters // this will throw a NullPointerException if there are no existing filters!
List filters = Arrays.asList(existingfilters);
n.addAll(filters); n.addAll(filters);
} catch (NullPointerException e) { } catch (NullPointerException e) {
// do we need to catch it if we're doing nothing with it? // do we need to catch it if we're doing nothing with it?
} }
String[] contentSections = getContentSectionsArray(state); String[] contentSections = getContentSectionsArray(state);
if (contentSections == null) { return existingfilters; } if (contentSections == null) { return existingfilters; }
ContentSectionFilterSpecification csfs = new ContentSectionFilterSpecification(contentSections); ContentSectionFilterSpecification csfs = new
ContentSectionFilterSpecification(contentSections);
n.add(csfs); n.add(csfs);
FilterSpecification[] newFilters = new FilterSpecification[n.size()]; FilterSpecification[] newFilters = new FilterSpecification[n.size()];
Iterator i = n.iterator(); Iterator i = n.iterator();

View File

@ -20,9 +20,17 @@ package com.arsdigita.london.search.ui;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
/**
* Used by the UI JSP to create a main (simple) search pane (index.jsp).
*
*/
public class SimpleSearchPane extends SearchComponent { public class SimpleSearchPane extends SearchComponent {
/**
*
*/
public SimpleSearchPane() { public SimpleSearchPane() {
super(new SimpleQueryComponent(ContentItem.LIVE)); super(new SimpleQueryComponent(ContentItem.LIVE));
} }
} }

View File

@ -5,12 +5,6 @@
version="2.4"> version="2.4">
<!-- module ccm-ldn-search - servlet declarations BEGIN --> <!-- module ccm-ldn-search - servlet declarations BEGIN -->
<servlet>
<servlet-name>worker</servlet-name>
<servlet-class>com.arsdigita.london.search.SearchWorkerServlet</servlet-class>
<load-on-startup>4</load-on-startup>
</servlet>
<servlet> <servlet>
<servlet-name>search-files</servlet-name> <servlet-name>search-files</servlet-name>
<servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class> <servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>

View File

@ -48,6 +48,7 @@ import org.apache.log4j.Logger;
*/ */
public class PortalSiteServlet extends BaseApplicationServlet { public class PortalSiteServlet extends BaseApplicationServlet {
/** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger(PortalSiteServlet.class); private static final Logger s_log = Logger.getLogger(PortalSiteServlet.class);
private static final PresentationManager s_presManager = private static final PresentationManager s_presManager =

View File

@ -20,7 +20,6 @@
package com.arsdigita.portalserver.personal; package com.arsdigita.portalserver.personal;
import com.arsdigita.bebop.Page; import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageFactory;
import com.arsdigita.bebop.SimpleContainer; import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.dispatcher.DispatcherHelper; import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.dispatcher.RequestContext; import com.arsdigita.dispatcher.RequestContext;
@ -31,7 +30,6 @@ import com.arsdigita.kernel.ResourceTypeConfig;
import com.arsdigita.kernel.User; import com.arsdigita.kernel.User;
import com.arsdigita.templating.PresentationManager; import com.arsdigita.templating.PresentationManager;
import com.arsdigita.templating.Templating; import com.arsdigita.templating.Templating;
import com.arsdigita.ui.login.UserAuthenticationListener;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import com.arsdigita.web.Application; import com.arsdigita.web.Application;
import com.arsdigita.web.BaseApplicationServlet; import com.arsdigita.web.BaseApplicationServlet;

View File

@ -50,6 +50,7 @@ import org.apache.log4j.Logger;
*/ */
public class PersonalPortalServlet extends BaseApplicationServlet { public class PersonalPortalServlet extends BaseApplicationServlet {
/** Logger instance for debugging */
private static final Logger s_log = Logger.getLogger(PersonalPortalServlet.class); private static final Logger s_log = Logger.getLogger(PersonalPortalServlet.class);
private static final PresentationManager s_presManager = private static final PresentationManager s_presManager =

View File

@ -4,7 +4,7 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4"> version="2.4">
<!-- Servlets for the portalserver applications --> <!-- module ccm-portalserver - servlet declarations BEGIN -->
<servlet> <servlet>
<servlet-name>portalsite</servlet-name> <servlet-name>portalsite</servlet-name>
<servlet-class>com.arsdigita.portalserver.PortalSiteServlet</servlet-class> <servlet-class>com.arsdigita.portalserver.PortalSiteServlet</servlet-class>
@ -34,8 +34,10 @@
<servlet-name>portal-personalportal</servlet-name> <servlet-name>portal-personalportal</servlet-name>
<servlet-class>com.arsdigita.portalserver.personal.PersonalPortalCreatorServlet</servlet-class> <servlet-class>com.arsdigita.portalserver.personal.PersonalPortalCreatorServlet</servlet-class>
</servlet> </servlet>
<!-- module ccm-portalserver - servlet declarations END -->
<!-- module ccm-portalserver - servlet mappings BEGIN -->
<servlet-mapping> <servlet-mapping>
<servlet-name>portalsite</servlet-name> <servlet-name>portalsite</servlet-name>
<url-pattern>/templates/servlet/portalsite/*</url-pattern> <url-pattern>/templates/servlet/portalsite/*</url-pattern>
@ -65,5 +67,6 @@
<servlet-name>portal-personalportal</servlet-name> <servlet-name>portal-personalportal</servlet-name>
<url-pattern>/templates/servlet/personal-portal-creator/*</url-pattern> <url-pattern>/templates/servlet/personal-portal-creator/*</url-pattern>
</servlet-mapping> </servlet-mapping>
<!-- module ccm-portalserver - servlet mappings END -->
</web-app> </web-app>

View File

@ -112,6 +112,7 @@ com.arsdigita.london.search.show_sponsored_links=true
# ccm-subsite application # ccm-subsite application
com.arsdigita.subsite.root_category_picker=com.arsdigita.london.terms.ui.RootCategoryPicker com.arsdigita.subsite.root_category_picker=com.arsdigita.london.terms.ui.RootCategoryPicker
com.arsdigita.london.search.num_threads=0
# ccm-themedirector application # ccm-themedirector application

View File

@ -267,12 +267,6 @@
<!-- module ccm-rssfeed - servlet declaration END --> <!-- module ccm-rssfeed - servlet declaration END -->
<!-- module ccm-ldn-search - servlet declarations BEGIN --> <!-- module ccm-ldn-search - servlet declarations BEGIN -->
<servlet>
<servlet-name>worker</servlet-name>
<servlet-class>com.arsdigita.london.search.SearchWorkerServlet</servlet-class>
<load-on-startup>4</load-on-startup>
</servlet>
<servlet> <servlet>
<servlet-name>search-files</servlet-name> <servlet-name>search-files</servlet-name>
<servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class> <servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>

View File

@ -109,6 +109,8 @@ com.arsdigita.navigation.templates_file=bundle/navigation/sci-templates.txt
# ccm-search application # ccm-search application
com.arsdigita.london.search.show_sponsored_links=true com.arsdigita.london.search.show_sponsored_links=true
; Comment this out or increase the num_of_threads iv you really use remote search
com.arsdigita.london.search.num_threads=0
# ccm-subsite application # ccm-subsite application

View File

@ -267,12 +267,13 @@
<!-- module ccm-rssfeed - servlet declaration END --> <!-- module ccm-rssfeed - servlet declaration END -->
<!-- module ccm-ldn-search - servlet declarations BEGIN --> <!-- module ccm-ldn-search - servlet declarations BEGIN -->
<!--
<servlet> <servlet>
<servlet-name>worker</servlet-name> <servlet-name>worker</servlet-name>
<servlet-class>com.arsdigita.london.search.SearchWorkerServlet</servlet-class> <servlet-class>com.arsdigita.london.search.SearchWorkerServlet</servlet-class>
<load-on-startup>4</load-on-startup> <load-on-startup>4</load-on-startup>
</servlet> </servlet>
-->
<servlet> <servlet>
<servlet-name>search-files</servlet-name> <servlet-name>search-files</servlet-name>
<servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class> <servlet-class>com.arsdigita.web.ApplicationFileServlet</servlet-class>

View File

@ -66,6 +66,7 @@ public class Initializer extends CompoundInitializer {
@Override @Override
public void init(DomainInitEvent evt) { public void init(DomainInitEvent evt) {
PatternStylesheetResolver.registerPatternGenerator( PatternStylesheetResolver.registerPatternGenerator(
"theme", "theme",
new ThemePatternGenerator() new ThemePatternGenerator()
@ -101,7 +102,6 @@ public class Initializer extends CompoundInitializer {
} }
@Override @Override
// public void init(LegacyInitEvent evt) {
public void init(ContextInitEvent evt) { public void init(ContextInitEvent evt) {
// This sets up the subsite for so that the form will include // This sets up the subsite for so that the form will include
// all of the themes already in the database // all of the themes already in the database