Author: thomas.heute(a)jboss.com
Date: 2007-02-08 11:51:26 -0500 (Thu, 08 Feb 2007)
New Revision: 6187
Added:
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/SearchCommand.java
trunk/cms/src/main/org/jboss/portal/cms/search/
trunk/cms/src/main/org/jboss/portal/cms/search/CMSFederatedSearch.java
trunk/cms/src/main/org/jboss/portal/cms/search/CMSResult.java
trunk/cms/src/main/org/jboss/portal/cms/search/CMSResultURL.java
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/searchResults.jsp
trunk/core-samples/.classpath
trunk/core-samples/.project
trunk/search/src/main/org/jboss/portal/search/QueryConverter.java
trunk/search/src/main/org/jboss/portal/search/SearchFederated.java
trunk/search/src/main/org/jboss/portal/search/federated/
trunk/search/src/main/org/jboss/portal/search/federated/jcr/
trunk/search/src/main/org/jboss/portal/search/federated/jcr/JCRQueryConverter.java
trunk/search/src/main/org/jboss/portal/search/federated/lucene/
trunk/search/src/main/org/jboss/portal/search/federated/lucene/GenericDocument.java
trunk/search/src/main/org/jboss/portal/search/federated/lucene/LuceneQueryConverter.java
trunk/search/src/main/org/jboss/portal/search/federated/lucene/LuceneSearchFederated.java
trunk/search/src/main/org/jboss/portal/search/impl/
trunk/search/src/main/org/jboss/portal/search/impl/GenericSearchFederated.java
trunk/search/src/main/org/jboss/portal/search/result/ResultSet.java
trunk/search/src/resources/
trunk/search/src/resources/portal-search-sar/
trunk/search/src/resources/portal-search-sar/META-INF/
trunk/search/src/resources/portal-search-sar/META-INF/jboss-service.xml
Removed:
trunk/search/src/main/org/jboss/portal/search/federated/lucene/GenericDocument.java
trunk/search/src/main/org/jboss/portal/search/federated/lucene/LuceneQueryConverter.java
trunk/search/src/main/org/jboss/portal/search/federated/lucene/LuceneSearchFederated.java
trunk/search/src/main/org/jboss/portal/search/federation/SearchFederated.java
trunk/search/src/main/org/jboss/portal/search/result/Results.java
Modified:
trunk/build/build.xml
trunk/cms/.classpath
trunk/cms/build.xml
trunk/cms/src/main/org/jboss/portal/cms/CommandFactory.java
trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java
trunk/core-cms/.classpath
trunk/core-cms/build.xml
trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSConstants.java
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_es.properties
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_fr.properties
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_pt_BR.properties
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jboss-portlet.xml
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/main.jsp
trunk/core-management/.classpath
trunk/core/.classpath
trunk/core/build.xml
trunk/registration/
trunk/search/
trunk/search/build.xml
trunk/search/src/main/org/jboss/portal/search/federation/SearchFederation.java
trunk/search/src/main/org/jboss/portal/search/federation/impl/SearchFederationService.java
trunk/search/src/main/org/jboss/portal/search/lucene/LuceneSearchFederated.java
trunk/search/src/main/org/jboss/portal/search/result/Result.java
trunk/search/src/main/org/jboss/portal/search/result/ResultURL.java
trunk/search/src/main/org/jboss/portal/search/result/impl/SimpleResult.java
trunk/search/src/main/org/jboss/portal/search/test/DummySearchFederated.java
trunk/search/src/main/org/jboss/portal/search/test/FederationTest.java
trunk/search/src/main/org/jboss/portal/search/test/LuceneQueryTest.java
trunk/search/src/main/org/jboss/portal/search/test/TestLuceneSearchFederated.java
trunk/tools/etc/buildfragments/modules.ent
trunk/workflow/
trunk/workflow/.classpath
trunk/wsrp/.classpath
Log:
- Search Federation prototype JBPORTAL-1155
- CMS Search prototype
- Eclipse project files update
Modified: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml 2007-02-07 20:53:41 UTC (rev 6186)
+++ trunk/build/build.xml 2007-02-08 16:51:26 UTC (rev 6187)
@@ -129,6 +129,7 @@
<module name="core"/>
<module name="core-cms"/>
<module name="core-management"/>
+ <module name="search"/>
<module name="core-samples"/>
<module name="wsrp"/>
<module name="registration"/>
@@ -138,7 +139,7 @@
<group name="portal">
<include
- modules="common, test, api, faces, jems, server, security, identity,
format, portlet, portlet-federation, theme, workflow, cms, bridge, samples, registration,
wsrp, core, core-cms, core-management, core-samples"/>
+ modules="common, test, api, faces, jems, server, security, identity,
search, format, portlet, portlet-federation, theme, workflow, cms, bridge, samples,
registration, wsrp, core, core-cms, core-management, core-samples"/>
</group>
<group name="cms">
Modified: trunk/cms/.classpath
===================================================================
--- trunk/cms/.classpath 2007-02-07 20:53:41 UTC (rev 6186)
+++ trunk/cms/.classpath 2007-02-08 16:51:26 UTC (rev 6187)
@@ -41,6 +41,7 @@
<classpathentry combineaccessrules="false" kind="src"
path="/search"/>
<classpathentry combineaccessrules="false" kind="src"
path="/workflow"/>
<classpathentry kind="lib"
path="/thirdparty/jbpm/lib/jbpm-3.1.2.jar"/>
- <classpathentry kind="lib"
path="/thirdparty/jackrabbit/lib/jackrabbit-core-1.1.jar"/>
+ <classpathentry kind="lib"
path="/thirdparty/jackrabbit/lib/jackrabbit-core.jar"/>
+ <classpathentry combineaccessrules="false" kind="src"
path="/security"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/cms/build.xml
===================================================================
--- trunk/cms/build.xml 2007-02-07 20:53:41 UTC (rev 6186)
+++ trunk/cms/build.xml 2007-02-08 16:51:26 UTC (rev 6187)
@@ -129,7 +129,8 @@
<path refid="jboss.portal-common.classpath"/>
<path refid="jboss.portal-jems.classpath"/>
<path refid="jboss.portal-test.classpath"/>
- <!-- fine grained security integration -->
+ <path refid="jboss.portal-search.classpath"/>
+ <!-- fine grained security integration -->
<path refid="jboss.portal-identity.classpath"/>
<path refid="jboss.portal-security.classpath"/>
<!-- clustered testcases related -->
@@ -198,11 +199,15 @@
<fileset dir="${apache.collections.root}/lib"
includes="commons-collections.jar"/>
<fileset dir="${apache.lucene.root}/lib"
includes="lucene.jar"/>
+ <!-- cms indexing integration -->
+ <fileset dir="${jackrabbit.jackrabbit.lib}"
includes="jackrabbit-index-filters.jar"/>
+ <fileset dir="${nekohtml.nekohtml.lib}"
includes="nekohtml.jar"/>
+
+
<!-- cms optimization integration -->
<fileset dir="${jackrabbit.jackrabbit.lib}"
includes="jackrabbit-core.jar"/>
- <fileset dir="${jboss.cache.lib}"
includes="jboss-cache.jar"/>
- <fileset dir="${jgroups.jgroups.lib}"
includes="jgroups.jar"/>
-
+ <fileset dir="${jboss.cache.lib}"
includes="jboss-cache.jar"/>
+ <fileset dir="${jgroups.jgroups.lib}"
includes="jgroups.jar"/>
<fileset dir="${slf4j.slf4j.lib}"
includes="slf4j-log4j12.jar"/>
</jar>
Modified: trunk/cms/src/main/org/jboss/portal/cms/CommandFactory.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/CommandFactory.java 2007-02-07 20:53:41 UTC
(rev 6186)
+++ trunk/cms/src/main/org/jboss/portal/cms/CommandFactory.java 2007-02-08 16:51:26 UTC
(rev 6187)
@@ -22,14 +22,15 @@
******************************************************************************/
package org.jboss.portal.cms;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Locale;
+
import org.jboss.portal.cms.model.Content;
import org.jboss.portal.cms.model.File;
import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.search.query.Query;
-import java.io.InputStream;
-import java.util.List;
-import java.util.Locale;
-
/**
* Factory to create commands for the cms service.
*
@@ -82,5 +83,7 @@
Command createFileGetListCommand(String sFilePath);
- Command createGetArchiveCommand(String sRootPath, String sLanguage);
+ Command createGetArchiveCommand(String sRootPath, String sLanguage);
+
+ Command createSearchCommand(Query query);
}
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java
===================================================================
---
trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java 2007-02-07
20:53:41 UTC (rev 6186)
+++
trunk/cms/src/main/org/jboss/portal/cms/impl/interceptors/ACLInterceptor.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -257,7 +257,24 @@
folder.setFolders(filteredFolders);
folder.setFiles(filteredFiles);
}
+ else if (filteredResponse instanceof List)
+ {
+ List list = (List)filteredResponse;
+ List filteredFiles = new ArrayList();
+ for(Iterator itr=list.iterator();itr.hasNext();)
+ {
+ File cour = (File)itr.next();
+ securityContext.setAttribute("path",cour.getBasePath());
+ PortalPermission cmsPermission = new CMSPermission(securityContext);
+ boolean allow = this.authorizationManager.checkPermission(cmsPermission);
+ if(allow)
+ {
+ filteredFiles.add(cour);
+ }
+ }
+ filteredResponse = filteredFiles;
}
+ }
catch(Exception e)
{
tx.rollback();
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java 2007-02-07
20:53:41 UTC (rev 6186)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCommandFactory.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -22,6 +22,10 @@
******************************************************************************/
package org.jboss.portal.cms.impl.jcr;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Locale;
+
import org.jboss.portal.cms.Command;
import org.jboss.portal.cms.CommandFactory;
import org.jboss.portal.cms.impl.jcr.command.ContentCreateCommand;
@@ -42,17 +46,15 @@
import org.jboss.portal.cms.impl.jcr.command.ItemExistsCommand;
import org.jboss.portal.cms.impl.jcr.command.MoveCommand;
import org.jboss.portal.cms.impl.jcr.command.RenameCommand;
+import org.jboss.portal.cms.impl.jcr.command.SearchCommand;
import org.jboss.portal.cms.impl.jcr.command.StoreArchiveCommand;
import org.jboss.portal.cms.impl.jcr.composite.NewFileCommand;
import org.jboss.portal.cms.impl.jcr.composite.UpdateFileCommand;
import org.jboss.portal.cms.model.Content;
import org.jboss.portal.cms.model.File;
import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.search.query.Query;
-import java.io.InputStream;
-import java.util.List;
-import java.util.Locale;
-
/**
* @author <a href="mailto:roy@jboss.org">Roy Russo</a>
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
@@ -177,4 +179,9 @@
{
return new GetArchiveCommand(sRootPath, sLanguage);
}
+
+ public Command createSearchCommand(Query query)
+ {
+ return new SearchCommand(query);
+ }
}
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java 2007-02-07
20:53:41 UTC (rev 6186)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ACLEnforcer.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -136,8 +136,13 @@
if(cmsSecurityContext.getAttribute("applyFilter")!=null)
{
String path =
(String)cmsSecurityContext.getAttribute("applyFilter");
- hasAccess = this.computeToolAccess(loggedInUser,path);
+ hasAccess = this.computeToolAccess(loggedInUser, path);
}
+ else if(cmsSecurityContext.getAttribute("path")!=null)
+ {
+ String path =
(String)cmsSecurityContext.getAttribute("applyFilter");
+ hasAccess = this.computeAccess(loggedInUser, path, "read");
+ }
//check if workflow management protection needs to be enforced
else
if(cmsSecurityContext.getAttribute("manageWorkflow")!=null)
{
@@ -503,7 +508,7 @@
return toolAccess;
}
-
+
/**
*
* @param user
Added: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/SearchCommand.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/SearchCommand.java
(rev 0)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/SearchCommand.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -0,0 +1,91 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.cms.impl.jcr.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.Session;
+import javax.jcr.Workspace;
+import javax.jcr.query.QueryManager;
+import javax.jcr.query.QueryResult;
+
+import org.jboss.portal.cms.CMSException;
+import org.jboss.portal.cms.impl.FileImpl;
+import org.jboss.portal.cms.impl.jcr.JCRCommand;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.search.federated.jcr.JCRQueryConverter;
+import org.jboss.portal.search.query.Query;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class SearchCommand extends JCRCommand
+{
+
+ private static final long serialVersionUID = 2614067614144410297L;
+
+ private Query query;
+
+ public SearchCommand(Query query)
+ {
+ this.query = query;
+ }
+
+
+ public Object execute() throws CMSException
+ {
+ Session session = context.getSession();
+ Workspace workspace = session.getWorkspace();
+ QueryManager queryManager;
+ List files = new ArrayList();
+ try
+ {
+ queryManager = workspace.getQueryManager();
+ javax.jcr.query.Query jcrQuery =
queryManager.createQuery(JCRQueryConverter.convert(query), javax.jcr.query.Query.XPATH);
+ QueryResult queryResult=jcrQuery.execute();
+ NodeIterator nodeIterator = queryResult.getNodes();
+
+ while (nodeIterator.hasNext())
+ {
+ Node node;
+ node = nodeIterator.nextNode().getParent();
+ File file = new FileImpl();
+ file.setBasePath(node.getPath());
+
file.setCreationDate(node.getProperty("jcr:created").getDate().getTime());
+
file.setLastModified(node.getProperty("jcr:lastModified").getDate().getTime());
+ file.setName(node.getName());
+ files.add(file);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new CMSException("Cannot query the CMS", e);
+ }
+ return files;
+ }
+
+}
Added: trunk/cms/src/main/org/jboss/portal/cms/search/CMSFederatedSearch.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/search/CMSFederatedSearch.java
(rev 0)
+++ trunk/cms/src/main/org/jboss/portal/cms/search/CMSFederatedSearch.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -0,0 +1,104 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.cms.search;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+import javax.portlet.Portlet;
+
+import org.jboss.portal.cms.CMS;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.search.IndexingException;
+import org.jboss.portal.search.federation.Info;
+import org.jboss.portal.search.impl.GenericSearchFederated;
+import org.jboss.portal.search.query.Query;
+import org.jboss.portal.search.result.ResultSet;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class CMSFederatedSearch extends GenericSearchFederated
+{
+ private CMS cms;
+ private Info info;
+ private String id;
+
+ public CMSFederatedSearch(Portlet portlet, String id)
+ {
+ this.id = id;
+ info = new Info();
+ info.setStatus(Info.Status.AVAILABLE);
+ }
+
+ public void setCMS(CMS cms)
+ {
+ this.cms = cms;
+ }
+
+ public void create() throws IndexingException
+ {
+ info.setStatus(Info.Status.AVAILABLE);
+ }
+
+ public void destroy() throws IndexingException
+ {
+ // Indexing should be managed by the JCR implementation
+
+ }
+
+ public Info getInfo()
+ {
+ return info;
+ }
+
+ public String getMarkup(ResultSet results, int markupLevel)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ResultSet search(Query query)
+ {
+ Command searchCommand = cms.getCommandFactory().createSearchCommand(query);
+ List files = (List)cms.execute(searchCommand);
+ ResultSet results = new ResultSet(this);
+
+ Iterator it = files.iterator();
+ while (it.hasNext())
+ {
+ File file = (File)it.next();
+ results.add(new CMSResult(file));
+ }
+ return results;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+}
Added: trunk/cms/src/main/org/jboss/portal/cms/search/CMSResult.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/search/CMSResult.java
(rev 0)
+++ trunk/cms/src/main/org/jboss/portal/cms/search/CMSResult.java 2007-02-08 16:51:26 UTC
(rev 6187)
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.cms.search;
+
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.search.result.Result;
+import org.jboss.portal.search.result.ResultURL;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class CMSResult implements Result
+{
+
+ private File file;
+ private ResultURL url;
+
+ public CMSResult(File file)
+ {
+ this.file = file;
+ this.url = new CMSResultURL("portal/content", file);
+ }
+
+ public float getScore()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public ResultURL getURL()
+ {
+ return url;
+ }
+
+ public String getTitle()
+ {
+ if (file.getTitle() != null)
+ {
+ return file.getTitle();
+ }
+ else
+ {
+ return file.getName();
+ }
+ }
+
+}
Added: trunk/cms/src/main/org/jboss/portal/cms/search/CMSResultURL.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/search/CMSResultURL.java
(rev 0)
+++ trunk/cms/src/main/org/jboss/portal/cms/search/CMSResultURL.java 2007-02-08 16:51:26
UTC (rev 6187)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.cms.search;
+
+import org.jboss.portal.cms.model.File;
+import org.jboss.portal.search.result.ResultURL;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class CMSResultURL implements ResultURL
+{
+ private File file;
+ private String prefix;
+
+ public CMSResultURL(String prefix, File file)
+ {
+ this.file = file;
+ this.prefix = prefix;
+ }
+
+ public String toString()
+ {
+ return "/" + prefix + file.getBasePath();
+ }
+}
Modified: trunk/core/.classpath
===================================================================
--- trunk/core/.classpath 2007-02-07 20:53:41 UTC (rev 6186)
+++ trunk/core/.classpath 2007-02-08 16:51:26 UTC (rev 6187)
@@ -44,9 +44,9 @@
<classpathentry combineaccessrules="false" kind="src"
path="/theme"/>
<classpathentry combineaccessrules="false" kind="src"
path="/identity"/>
<classpathentry combineaccessrules="false" kind="src"
path="/format"/>
- <classpathentry combineaccessrules="false" kind="src"
path="/federation"/>
<classpathentry combineaccessrules="false" kind="src"
path="/registration"/>
<classpathentry kind="lib"
path="/thirdparty/jbpm/lib/jbpm-3.1.2.jar"/>
<classpathentry combineaccessrules="false" kind="src"
path="/workflow"/>
+ <classpathentry combineaccessrules="false" kind="src"
path="/portlet-federation"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-02-07 20:53:41 UTC (rev 6186)
+++ trunk/core/build.xml 2007-02-08 16:51:26 UTC (rev 6187)
@@ -328,6 +328,7 @@
<fileset dir="${jboss.portlet-api.root}/lib"
includes="portal-api-lib.jar"/>
<fileset dir="${jboss.portal-theme.root}/lib"
includes="portal-theme-lib.jar"/>
<fileset dir="${jboss.portal-security.root}/lib"
includes="portal-security-lib.jar"/>
+ <fileset dir="${jboss.portal-search.root}/lib"
includes="portal-search-lib.jar"/>
<fileset dir="${jboss.portal-identity.root}/lib"
includes="portal-identity-lib.jar"/>
<fileset dir="${jboss.portal-registration.root}/lib"
includes="portal-registration-lib.jar"/>
<fileset dir="${jboss.portal-samples.root}/lib"
includes="portal-samples-lib.jar"/>
Modified: trunk/core-cms/.classpath
===================================================================
--- trunk/core-cms/.classpath 2007-02-07 20:53:41 UTC (rev 6186)
+++ trunk/core-cms/.classpath 2007-02-08 16:51:26 UTC (rev 6187)
@@ -19,5 +19,7 @@
<classpathentry combineaccessrules="false" kind="src"
path="/workflow"/>
<classpathentry kind="lib"
path="/thirdparty/apache-fileupload/lib/commons-fileupload.jar"/>
<classpathentry kind="lib"
path="/thirdparty/jbpm/lib/jbpm-3.1.2.jar"/>
+ <classpathentry combineaccessrules="false" kind="src"
path="/search"/>
+ <classpathentry combineaccessrules="false" kind="src"
path="/security"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/core-cms/build.xml
===================================================================
--- trunk/core-cms/build.xml 2007-02-07 20:53:41 UTC (rev 6186)
+++ trunk/core-cms/build.xml 2007-02-08 16:51:26 UTC (rev 6187)
@@ -123,6 +123,7 @@
<path refid="jboss.portal-common.classpath"/>
<path refid="jboss.portal-cms.classpath"/>
<path refid="jboss.portal-server.classpath"/>
+ <path refid="jboss.portal-search.classpath"/>
<path refid="jboss.portal-portlet.classpath"/>
<path refid="jboss.portal-jems.classpath"/>
<path refid="jboss.portal-identity.classpath"/>
@@ -243,6 +244,12 @@
<fileset dir="${jcr.jcr.lib}"
includes="jcr-1.0.jar"/>
<fileset dir="${apache.collections.lib}"
includes="commons-collections.jar"/>
<fileset dir="${apache.lucene.lib}"
includes="lucene.jar"/>
+
+ <!-- cms indexing integration -->
+ <fileset dir="${jackrabbit.jackrabbit.lib}"
includes="jackrabbit-index-filters.jar"/>
+ <fileset dir="${nekohtml.nekohtml.lib}"
includes="nekohtml.jar"/>
+
+
<!-- cms optimization integration - this contains a clustered cache enabled
version -->
<fileset dir="${jackrabbit.jackrabbit.lib}"
includes="jackrabbit-core.jar"/>
<fileset dir="${jboss.cache.lib}"
includes="jboss-cache.jar"/>
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSConstants.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSConstants.java 2007-02-07
20:53:41 UTC (rev 6186)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSConstants.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -33,4 +33,6 @@
* CMS integration by the command mapper.
*/
public static final String DEFAULT_CMS_WINDOW_REF_CONFIG_PROPERTY_NAME =
"cms.default_window_ref";
+
+ public static final String SEARCH_ID = "CMS";
}
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2007-02-07
20:53:41 UTC (rev 6186)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/CMSPortlet.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -22,32 +22,37 @@
******************************************************************************/
package org.jboss.portal.core.cms.ui;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletPreferences;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
import org.apache.log4j.Logger;
import org.jboss.portal.cms.CMS;
import org.jboss.portal.cms.CMSException;
import org.jboss.portal.cms.Command;
import org.jboss.portal.cms.model.File;
+import org.jboss.portal.cms.search.CMSFederatedSearch;
import org.jboss.portal.cms.util.FileUtil;
+import org.jboss.portal.core.cms.CMSConstants;
import org.jboss.portal.core.cms.command.StreamContentCommand;
import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.search.federation.SearchFederation;
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
import org.jboss.portlet.JBossRenderRequest;
-import javax.portlet.GenericPortlet;
-import javax.portlet.PortletException;
-import javax.portlet.PortletPreferences;
-import javax.portlet.PortletRequestDispatcher;
-import javax.portlet.PortletSecurityException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.PortletURL;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Locale;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
/**
* Displays content from the CMS.
*
@@ -125,17 +130,33 @@
/** . */
private CMS CMSService;
-
+
/** . */
private String indexpage;
public void init() throws PortletException
{
CMSService = (CMS)getPortletContext().getAttribute("CMS");
+
if (CMSService == null)
{
throw new PortletException("Cannot start CMS portlet due to service
unavailability");
}
+
+ try
+ {
+ SearchFederation searchFederationService =
(SearchFederation)getPortletContext().getAttribute("SearchFederationService");
+ if (searchFederationService.getSearchFederated(CMSConstants.SEARCH_ID) == null)
+ {
+ CMSFederatedSearch federatedSearch = new CMSFederatedSearch(this,
CMSConstants.SEARCH_ID);
+ federatedSearch.setCMS(CMSService);
+ searchFederationService.register(federatedSearch);
+ }
+ }
+ catch (UndeclaredThrowableException e)
+ {
+ log.error("Cannot start CMS portlet search service due to service
unavailability");
+ }
}
public void doView(RenderRequest req, RenderResponse resp) throws PortletException,
PortletSecurityException, IOException
Modified:
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java
===================================================================
---
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java 2007-02-07
20:53:41 UTC (rev 6186)
+++
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminConstants.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -40,6 +40,8 @@
public static final String OP_LIST = "list";
+ public static final String OP_DOSEARCH = "dosearch";
+
public static final String OP_EDIT = "edit";
public static final String OP_EDIT_BINARY = "editbinary";
@@ -101,4 +103,6 @@
public static final String OP_DENY = "deny";
public static final String OP_VIEWPENDING = "view_pending_items";
+
+ public static final String OP_VIEWSEARCHRESULTS = "view_search_results";
}
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
---
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2007-02-07
20:53:41 UTC (rev 6186)
+++
trunk/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -22,6 +22,25 @@
******************************************************************************/
package org.jboss.portal.core.cms.ui.admin;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.naming.InitialContext;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletSession;
+import javax.portlet.UnavailableException;
+
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.portlet.PortletFileUpload;
@@ -51,6 +70,8 @@
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.search.QueryConverter;
+import org.jboss.portal.search.query.Query;
import org.jboss.portal.security.PortalPermission;
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
@@ -62,24 +83,6 @@
import org.jboss.portlet.JBossRenderRequest;
import org.jboss.portlet.JBossRenderResponse;
-import javax.naming.InitialContext;
-import javax.portlet.PortletException;
-import javax.portlet.PortletRequest;
-import javax.portlet.PortletRequestDispatcher;
-import javax.portlet.PortletSession;
-import javax.portlet.UnavailableException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
-import java.util.Vector;
-
/**
* @author <a href="mailto:roy@jboss.org">Roy Russo</a>
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
@@ -123,7 +126,7 @@
throw new PortletException("Authorization Service not found");
}
- this.initializeApprovePublishWorkflow();
+ this.initializeApprovePublishWorkflow();
}
protected void doView(final JBossRenderRequest rReq, final JBossRenderResponse rRes)
@@ -299,6 +302,21 @@
javax.portlet.PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH +
"/viewfile.jsp");
prd.include(rReq, rRes);
}
+ else if (CMSAdminConstants.OP_VIEWSEARCHRESULTS.equals(op))
+ {
+ rRes.setContentType("text/html");
+
+ String textQuery = rReq.getParameter("search");
+
+ Query query = QueryConverter.convert(textQuery);
+ Command searchCommand =
CMSService.getCommandFactory().createSearchCommand(query);
+
+ List files = (List)CMSService.execute(searchCommand);
+ rReq.setAttribute("files", files);
+
+ javax.portlet.PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH +
"/searchResults.jsp");
+ prd.include(rReq, rRes);
+ }
else if (CMSAdminConstants.OP_UPLOADARCHIVECONFIRM.equals(op))
{
String sPath = rReq.getParameter("path");
@@ -733,6 +751,13 @@
}
aRes.setRenderParameter("op", CMSAdminConstants.OP_VIEWFILE);
}
+ else if (CMSAdminConstants.OP_DOSEARCH.equals(op))
+ {
+ String search = (String) aReq.getParameter("search");
+
+ aRes.setRenderParameter("search", search);
+ aRes.setRenderParameter("op",
CMSAdminConstants.OP_VIEWSEARCHRESULTS);
+ }
else if (CMSAdminConstants.OP_UPLOADARCHIVE.equals(op))
{
try
Modified: trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-02-07
20:53:41 UTC (rev 6186)
+++ trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-02-08
16:51:26 UTC (rev 6187)
@@ -125,6 +125,15 @@
<SearchIndex
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path"
value="${wsp.home}/index"/>
+ <param name="textFilterClasses" value="
+ org.apache.jackrabbit.core.query.MsExcelTextFilter,
+ org.apache.jackrabbit.core.query.MsPowerPointTextFilter,
+ org.apache.jackrabbit.core.query.MsWordTextFilter,
+ org.apache.jackrabbit.core.query.PdfTextFilter,
+ org.apache.jackrabbit.core.query.HTMLTextFilter,
+ org.apache.jackrabbit.core.query.XMLTextFilter,
+ org.apache.jackrabbit.core.query.RTFTextFilter,
+ org.apache.jackrabbit.core.query.OpenOfficeTextFilter" />
<param name="useCompoundFile" value="true"/>
<param name="minMergeDocs" value="100"/>
<param name="volatileIdleTime" value="3"/>
Modified: trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
===================================================================
---
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2007-02-07
20:53:41 UTC (rev 6186)
+++
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2007-02-08
16:51:26 UTC (rev 6187)
@@ -35,6 +35,7 @@
TITLE_UPLOAD=Upload File
TITLE_SECURECONFIRM=Secure Node
+CMS_SEARCH=Search
CMS_MENU=Action Menu
CMS_ACTION=Action
CMS_NAME=Name
Modified:
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_es.properties
===================================================================
---
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_es.properties 2007-02-07
20:53:41 UTC (rev 6186)
+++
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_es.properties 2007-02-08
16:51:26 UTC (rev 6187)
@@ -32,3 +32,5 @@
TITLE_EDIT=Editar fichero
TITLE_CREATE=Crear fichero
TITLE_UPLOAD=Subir fichero
+
+CMS_SEARCH=B�squeda
Modified:
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_fr.properties
===================================================================
---
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_fr.properties 2007-02-07
20:53:41 UTC (rev 6186)
+++
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_fr.properties 2007-02-08
16:51:26 UTC (rev 6187)
@@ -33,3 +33,4 @@
TITLE_CREATE=Creer le fichier
TITLE_UPLOAD=Charger le fichier
TITLE_SECURECONFIRM=S\u00E9curiser le noeud
+CMS_SEARCH=Chercher
Modified:
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_pt_BR.properties
===================================================================
---
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_pt_BR.properties 2007-02-07
20:53:41 UTC (rev 6186)
+++
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_pt_BR.properties 2007-02-08
16:51:26 UTC (rev 6187)
@@ -34,6 +34,7 @@
TITLE_CREATE=Criar Arquivo
TITLE_UPLOAD=Enviar Arquivo
+CMS_SEARCH=Pesquisar
CMS_MENU=Menu de A��es
CMS_ACTION=A��o
CMS_NAME=Nome
Modified: trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jboss-portlet.xml 2007-02-07
20:53:41 UTC (rev 6186)
+++ trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jboss-portlet.xml 2007-02-08
16:51:26 UTC (rev 6187)
@@ -101,4 +101,9 @@
<service-class>org.jboss.portal.portlet.federation.FederatingPortletInvoker</service-class>
<service-ref>:service=PortletInvoker,type=Federating</service-ref>
</service>
+ <service>
+ <service-name>SearchFederationService</service-name>
+
<service-class>org.jboss.portal.search.federation.SearchFederation</service-class>
+ <service-ref>:service=SearchFederationService</service-ref>
+ </service>
</portlet-app>
Modified: trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/main.jsp
===================================================================
--- trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/main.jsp 2007-02-07
20:53:41 UTC (rev 6186)
+++ trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/main.jsp 2007-02-08
16:51:26 UTC (rev 6187)
@@ -28,6 +28,20 @@
<hr/>
+<div align="right">
+
+<form method="post" action="<portlet:actionURL>
+ <portlet:param name="op" value="<%=
CMSAdminConstants.OP_DOSEARCH %>"/>
+ </portlet:actionURL>">
+ <input type="text"
+ size="15"
+ maxlength="80"
+ name="search"
+ class="portlet-form-input-field"/>
+ <input type="submit" name="search"
value="${n:i18n("CMS_SEARCH")}"
class="portlet-form-button"/>
+</form>
+</div>
+
<!-- Currently browsing -->
Browsing: <a href="<portlet:renderURL>
<portlet:param name="op" value="<%= CMSAdminConstants.OP_MAIN
%>"/>
Added:
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/searchResults.jsp
===================================================================
--- trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/searchResults.jsp
(rev 0)
+++
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/searchResults.jsp 2007-02-08
16:51:26 UTC (rev 6187)
@@ -0,0 +1,80 @@
+<%@ page import="org.jboss.portal.core.cms.ui.admin.CMSAdminConstants"
%>
+<%@ page import="java.util.Locale" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.text.Format" %>
+<%@ page import="java.text.SimpleDateFormat" %>
+<%@ page import="org.jboss.portal.cms.model.File" %>
+<%@ page language="java"
extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
+<%@ taglib
uri="http://java.sun.com/portlet" prefix="portlet"
%>
+<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
+<%@ page isELIgnored="false" %>
+
+<portlet:defineObjects/>
+
+<table>
+<%
+ List files = (List)request.getAttribute("files");
+ String createDate = "";
+ String modifiedDate = "";
+
+ if (files.size() > 0)
+ {
+ for (int i = 0; i < files.size(); i++)
+ {
+ File file = (File)files.get(i);
+%>
+<tr onmouseover="this.className='portlet-section-alternate';"
onmouseout="this.className='portlet-section-body';">
+ <td><img src="<%= renderRequest.getContextPath() +
CMSAdminConstants.DEFAULT_IMAGES_PATH%>/file.gif"
+ alt="${n:i18n("CMS_FILE")}"
+ border="0"> <a href="<portlet:renderURL>
+ <portlet:param name="op" value="<%=
CMSAdminConstants.OP_VIEWFILE %>"/>
+ <portlet:param name="path"
+ value="<%= file.getBasePath() %>"/>
+ </portlet:renderURL>"><%=
+ file.getBasePath().substring(file.getBasePath().lastIndexOf("/") + 1,
file.getBasePath().length()) %>
+ </a>
+ </td>
+ <td>
+ <form method="POST" style="padding:0;margin:0;"
action="<portlet:actionURL>
+ <portlet:param name="path" value="<%= file.getBasePath()
%>"/>
+ <portlet:param name="type" value="fi"/>
+ <portlet:param name="dispatch" value="1"/>
+ </portlet:actionURL>">
+ <select name="op">
+ <option value="<%= CMSAdminConstants.OP_VIEWFILE
%>">${n:i18n("CMS_VIEW")}</option>
+ <option value="<%= CMSAdminConstants.OP_CONFIRMCOPY
%>">${n:i18n("CMS_COPY")}</option>
+ <option value="<%= CMSAdminConstants.OP_CONFIRMMOVE
%>">${n:i18n("CMS_MOVE")}</option>
+ <option value="<%= CMSAdminConstants.OP_CONFIRMDELETE
%>">${n:i18n("CMS_DELETE")}</option>
+ </select>
+ <input type="submit" value="Go" name="Go"
class="portlet-form-button"/>
+ </form>
+ </td>
+ <td>
+ <%
+ if (file.getCreationDate() != null)
+ {
+ Format formatter;
+ formatter = new SimpleDateFormat("MM/dd/yy HH:mm");
+ createDate = formatter.format(file.getCreationDate());
+ }
+ %>
+ <%= createDate %>
+ </td>
+ <td>
+ <%
+ if (file.getLastModified() != null)
+ {
+ Format formatter;
+ formatter = new SimpleDateFormat("MM/dd/yy HH:mm");
+ modifiedDate = formatter.format(file.getLastModified());
+ }
+ %>
+ <%= modifiedDate %>
+ </td>
+</tr>
+<%
+ }
+ }
+%>
+</table>
+</form>
Property changes on:
trunk/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/searchResults.jsp
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/core-management/.classpath
===================================================================
--- trunk/core-management/.classpath 2007-02-07 20:53:41 UTC (rev 6186)
+++ trunk/core-management/.classpath 2007-02-08 16:51:26 UTC (rev 6187)
@@ -6,8 +6,8 @@
<classpathentry combineaccessrules="false" kind="src"
path="/jems"/>
<classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss-system.jar"/>
<classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss-jmx.jar"/>
- <classpathentry combineaccessrules="false" kind="src"
path="/federation"/>
<classpathentry combineaccessrules="false" kind="src"
path="/portlet"/>
<classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss-common.jar"/>
+ <classpathentry combineaccessrules="false" kind="src"
path="/portlet-federation"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Added: trunk/core-samples/.classpath
===================================================================
--- trunk/core-samples/.classpath (rev 0)
+++ trunk/core-samples/.classpath 2007-02-08 16:51:26 UTC (rev 6187)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
Added: trunk/core-samples/.project
===================================================================
--- trunk/core-samples/.project (rev 0)
+++ trunk/core-samples/.project 2007-02-08 16:51:26 UTC (rev 6187)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>core-samples</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/registration
___________________________________________________________________
Name: svn:ignore
- output
+ bin
output
Property changes on: trunk/search
___________________________________________________________________
Name: svn:ignore
- Test
output
test
+ Test
output
test
bin
Modified: trunk/search/build.xml
===================================================================
--- trunk/search/build.xml 2007-02-07 20:53:41 UTC (rev 6186)
+++ trunk/search/build.xml 2007-02-08 16:51:26 UTC (rev 6187)
@@ -68,6 +68,7 @@
<path refid="jbossas/core.libs.classpath"/>
<path refid="apache.lucene.classpath"/>
<path refid="junit.junit.classpath"/>
+ <path refid="jcr.jcr.classpath"/>
</path>
<!-- Configure modules -->
@@ -132,6 +133,13 @@
<exclude name="org/jboss/portal/search/test/**/*"/>
</fileset>
</jar>
+ <copy todir="${build.resources}/portal-search-sar">
+ <fileset dir="${build.lib}"
includes="portal-search-lib.jar"/>
+ </copy>
+ <jar jarfile="${build.lib}/portal-search.sar">
+ <fileset dir="${build.resources}/portal-search-sar"
includes="**/*"/>
+ </jar>
+
</target>
Added: trunk/search/src/main/org/jboss/portal/search/QueryConverter.java
===================================================================
--- trunk/search/src/main/org/jboss/portal/search/QueryConverter.java
(rev 0)
+++ trunk/search/src/main/org/jboss/portal/search/QueryConverter.java 2007-02-08 16:51:26
UTC (rev 6187)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.search;
+
+import org.jboss.portal.search.query.Query;
+import org.jboss.portal.search.query.impl.KeywordQueryTerm;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class QueryConverter
+{
+
+ // TODO: implemement this
+ public static Query convert(String textQuery)
+ {
+ Query query = new Query();
+ query.addOptionalTerm(new KeywordQueryTerm(textQuery));
+
+ return query;
+ }
+}
Copied: trunk/search/src/main/org/jboss/portal/search/SearchFederated.java (from rev 6150,
trunk/search/src/main/org/jboss/portal/search/federation/SearchFederated.java)
===================================================================
--- trunk/search/src/main/org/jboss/portal/search/SearchFederated.java
(rev 0)
+++ trunk/search/src/main/org/jboss/portal/search/SearchFederated.java 2007-02-08 16:51:26
UTC (rev 6187)
@@ -0,0 +1,93 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.search;
+
+import java.util.Locale;
+
+import org.jboss.portal.search.federation.Info;
+import org.jboss.portal.search.query.Query;
+import org.jboss.portal.search.result.ResultSet;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface SearchFederated
+{
+
+ /**
+ * Get the ID for this federated search
+ * @return String representing this particular federated search
+ */
+ public String getId();
+
+ /**
+ * Get a localized name for this federated search
+ * @return String
+ */
+ public String getName(Locale locale);
+
+ /**
+ * Method called when this federated search is not used anymore.
+ * This could be the place to destry any index
+ * @throws IndexingException
+ */
+ public void destroy() throws IndexingException;
+
+ /**
+ * The create method should index the required components
+ * @throws IndexingException
+ */
+ public void create() throws IndexingException;
+
+ /**
+ * Info should return information on the current status
+ * if the federated search
+ * @return
+ */
+ public Info getInfo();
+
+ /**
+ * From the query object this method is responsible to return the
+ * results of the query
+ * @param query
+ * @return
+ */
+ public ResultSet search(Query query);
+
+ /**
+ * TODO: Subject to change...
+ * get the markup fragment for this federated search. A markup level is used
+ * to define different amount of information to provide.
+ * @param results
+ * @param markupLevel
+ * @return
+ */
+ public String getMarkup(ResultSet results, int markupLevel);
+
+ public interface MarkupLevel
+ {
+ public static final int FULL = 0;
+ public static final int REDUCED = 1;
+ }
+}
Added: trunk/search/src/main/org/jboss/portal/search/federated/jcr/JCRQueryConverter.java
===================================================================
--- trunk/search/src/main/org/jboss/portal/search/federated/jcr/JCRQueryConverter.java
(rev 0)
+++
trunk/search/src/main/org/jboss/portal/search/federated/jcr/JCRQueryConverter.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.search.federated.jcr;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.portal.search.query.Query;
+import org.jboss.portal.search.query.impl.KeywordQueryTerm;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class JCRQueryConverter
+{
+
+ //TODO, just for testing, would only work with at least one KeywordQueryTerm and
nothing else
+ public static String convert(Query query)
+ {
+ StringBuffer result = new StringBuffer();
+
+ List optional = query.getOptionalTerms();
+ Iterator it = optional.iterator();
+ result.append("//*[");
+
+ result.append("jcr:contains(., '" +
((KeywordQueryTerm)it.next()).getKeyWord() + "')");
+
+ while(it.hasNext())
+ {
+ result.append("or jcr:contains(., '" +
((KeywordQueryTerm)it.next()).getKeyWord() + "')");
+ }
+ result.append("]");
+ return result.toString();
+ }
+
+}
Copied: trunk/search/src/main/org/jboss/portal/search/federated/lucene (from rev 5960,
trunk/search/src/main/org/jboss/portal/search/lucene)
Deleted:
trunk/search/src/main/org/jboss/portal/search/federated/lucene/GenericDocument.java
===================================================================
--- trunk/search/src/main/org/jboss/portal/search/lucene/GenericDocument.java 2007-01-08
10:34:19 UTC (rev 5960)
+++
trunk/search/src/main/org/jboss/portal/search/federated/lucene/GenericDocument.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -1,73 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This 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 software 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 software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.search.lucene;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class GenericDocument
-{
- private String title;
-
- private long date;
-
- private Map fields;
-
- public Map getFields()
- {
- return fields;
- }
-
- public long getDate()
- {
- return date;
- }
-
- public void setDate(long date)
- {
- this.date = date;
- }
-
- public String getTitle()
- {
- return title;
- }
-
- public void setTitle(String title)
- {
- this.title = title;
- }
-
- public void addField(String name, String value)
- {
- if (fields == null)
- {
- fields = new HashMap();
- }
- fields.put(name, value);
- }
-}
Copied:
trunk/search/src/main/org/jboss/portal/search/federated/lucene/GenericDocument.java (from
rev 6186, trunk/search/src/main/org/jboss/portal/search/lucene/GenericDocument.java)
===================================================================
--- trunk/search/src/main/org/jboss/portal/search/federated/lucene/GenericDocument.java
(rev 0)
+++
trunk/search/src/main/org/jboss/portal/search/federated/lucene/GenericDocument.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.search.federated.lucene;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class GenericDocument
+{
+ private String title;
+
+ private long date;
+
+ private Map fields;
+
+ public Map getFields()
+ {
+ return fields;
+ }
+
+ public long getDate()
+ {
+ return date;
+ }
+
+ public void setDate(long date)
+ {
+ this.date = date;
+ }
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+ public void addField(String name, String value)
+ {
+ if (fields == null)
+ {
+ fields = new HashMap();
+ }
+ fields.put(name, value);
+ }
+}
Deleted:
trunk/search/src/main/org/jboss/portal/search/federated/lucene/LuceneQueryConverter.java
===================================================================
---
trunk/search/src/main/org/jboss/portal/search/lucene/LuceneQueryConverter.java 2007-01-08
10:34:19 UTC (rev 5960)
+++
trunk/search/src/main/org/jboss/portal/search/federated/lucene/LuceneQueryConverter.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -1,106 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This 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 software 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 software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.search.lucene;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.jboss.portal.search.query.Query;
-import org.jboss.portal.search.query.QueryTerm;
-import org.jboss.portal.search.query.impl.BetweenDatesTerm;
-import org.jboss.portal.search.query.impl.DateTerm;
-import org.jboss.portal.search.query.impl.FieldQueryTerm;
-import org.jboss.portal.search.query.impl.KeywordQueryTerm;
-
-/**
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class LuceneQueryConverter
-{
-
- public static String convert(Query query)
- {
- StringBuffer result = new StringBuffer();
- Iterator it;
-
- List terms = query.getMandatoryTerms();
- if (terms != null)
- {
- it = terms.iterator();
- while (it.hasNext())
- {
- QueryTerm term = (QueryTerm) it.next();
- convert(result, term, "+");
- }
- }
-
- terms = query.getNotTerms();
- if (terms != null)
- {
- it = terms.iterator();
- while (it.hasNext())
- {
- QueryTerm term = (QueryTerm) it.next();
- convert(result, term, "-");
- }
- }
-
- terms = query.getOptionalTerms();
- if (terms != null)
- {
- it = terms.iterator();
- while (it.hasNext())
- {
- QueryTerm term = (QueryTerm) it.next();
- convert(result, term, "");
- }
- }
- return result.toString();
- }
-
- private static void convert(StringBuffer result, QueryTerm term, String prefix)
- {
- if (term instanceof FieldQueryTerm)
- {
- FieldQueryTerm convertedTerm = (FieldQueryTerm) term;
- result.append(" " + prefix + convertedTerm.getName() +
":\"" + convertedTerm.getValue()+"\"");
- }
- else if (term instanceof KeywordQueryTerm)
- {
- KeywordQueryTerm convertedTerm = (KeywordQueryTerm) term;
- result.append(" " + prefix + convertedTerm.getKeyWord());
- }
- else if (term instanceof BetweenDatesTerm)
- {
- BetweenDatesTerm convertedTerm = (BetweenDatesTerm) term;
- result.append(" " + prefix + convertedTerm.getField() + ":["
+ convertedTerm.getFromTime() + "," + convertedTerm.getToTime() +
"]");
- }
- else if (term instanceof DateTerm)
- {
- DateTerm convertedTerm = (DateTerm) term;
- result.append(" " + prefix + convertedTerm.getField() + ":["
+ convertedTerm.getTime() + "," + (convertedTerm.getTime() + 24*60*60*1000) +
"}");
- }
- }
-
-}
Copied:
trunk/search/src/main/org/jboss/portal/search/federated/lucene/LuceneQueryConverter.java
(from rev 6186,
trunk/search/src/main/org/jboss/portal/search/lucene/LuceneQueryConverter.java)
===================================================================
---
trunk/search/src/main/org/jboss/portal/search/federated/lucene/LuceneQueryConverter.java
(rev 0)
+++
trunk/search/src/main/org/jboss/portal/search/federated/lucene/LuceneQueryConverter.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -0,0 +1,106 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.search.federated.lucene;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.portal.search.query.Query;
+import org.jboss.portal.search.query.QueryTerm;
+import org.jboss.portal.search.query.impl.BetweenDatesTerm;
+import org.jboss.portal.search.query.impl.DateTerm;
+import org.jboss.portal.search.query.impl.FieldQueryTerm;
+import org.jboss.portal.search.query.impl.KeywordQueryTerm;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class LuceneQueryConverter
+{
+
+ public static String convert(Query query)
+ {
+ StringBuffer result = new StringBuffer();
+ Iterator it;
+
+ List terms = query.getMandatoryTerms();
+ if (terms != null)
+ {
+ it = terms.iterator();
+ while (it.hasNext())
+ {
+ QueryTerm term = (QueryTerm) it.next();
+ convert(result, term, "+");
+ }
+ }
+
+ terms = query.getNotTerms();
+ if (terms != null)
+ {
+ it = terms.iterator();
+ while (it.hasNext())
+ {
+ QueryTerm term = (QueryTerm) it.next();
+ convert(result, term, "-");
+ }
+ }
+
+ terms = query.getOptionalTerms();
+ if (terms != null)
+ {
+ it = terms.iterator();
+ while (it.hasNext())
+ {
+ QueryTerm term = (QueryTerm) it.next();
+ convert(result, term, "");
+ }
+ }
+ return result.toString();
+ }
+
+ private static void convert(StringBuffer result, QueryTerm term, String prefix)
+ {
+ if (term instanceof FieldQueryTerm)
+ {
+ FieldQueryTerm convertedTerm = (FieldQueryTerm) term;
+ result.append(" " + prefix + convertedTerm.getName() +
":\"" + convertedTerm.getValue()+"\"");
+ }
+ else if (term instanceof KeywordQueryTerm)
+ {
+ KeywordQueryTerm convertedTerm = (KeywordQueryTerm) term;
+ result.append(" " + prefix + convertedTerm.getKeyWord());
+ }
+ else if (term instanceof BetweenDatesTerm)
+ {
+ BetweenDatesTerm convertedTerm = (BetweenDatesTerm) term;
+ result.append(" " + prefix + convertedTerm.getField() + ":["
+ convertedTerm.getFromTime() + "," + convertedTerm.getToTime() +
"]");
+ }
+ else if (term instanceof DateTerm)
+ {
+ DateTerm convertedTerm = (DateTerm) term;
+ result.append(" " + prefix + convertedTerm.getField() + ":["
+ convertedTerm.getTime() + "," + (convertedTerm.getTime() + 24*60*60*1000) +
"}");
+ }
+ }
+
+}
Deleted:
trunk/search/src/main/org/jboss/portal/search/federated/lucene/LuceneSearchFederated.java
===================================================================
---
trunk/search/src/main/org/jboss/portal/search/lucene/LuceneSearchFederated.java 2007-01-08
10:34:19 UTC (rev 5960)
+++
trunk/search/src/main/org/jboss/portal/search/federated/lucene/LuceneSearchFederated.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -1,183 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This 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 software 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 software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.search.lucene;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Hits;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.Searcher;
-import org.jboss.portal.search.IndexingException;
-import org.jboss.portal.search.federation.Info;
-import org.jboss.portal.search.federation.SearchFederated;
-import org.jboss.portal.search.query.Query;
-import org.jboss.portal.search.result.Results;
-import org.jboss.portal.search.result.impl.AbstractResult;
-import org.jboss.portal.search.result.impl.SimpleResult;
-
-/**
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public abstract class LuceneSearchFederated implements SearchFederated
-{
-
- private IndexWriter index;
-
- private String id;
-
- private Info info;
-
- private String indexPath;
-
- private String defaultField;
-
- public LuceneSearchFederated(String id, String indexPath, String defaultField)
- {
- this.id = id;
- this.indexPath = indexPath;
- this.defaultField = defaultField;
- info = new Info();
- }
-
- public void create() throws IndexingException
- {
-
- try
- {
- index = new IndexWriter(indexPath, new StandardAnalyzer(), true);
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- info.setStatus(Info.Status.INDEXING);
- try
- {
- List documents = getLuceneDocuments();
- Iterator it = documents.iterator();
- while (it.hasNext())
- {
- Document document = (Document)it.next();
- index.addDocument(document);
- }
- index.optimize();
- index.close();
- }
- catch (IOException e)
- {
- throw new IndexingException("Cannot index document", e);
- }
- info.setStatus(Info.Status.STARTED);
- }
-
- public List getLuceneDocuments()
- {
- List documents = getDocuments();
- Iterator it = documents.iterator();
- while (it.hasNext())
- {
- GenericDocument genericDoc = (GenericDocument) it.next();
- Document doc = new Document();
- if (genericDoc.getTitle() != null)
- doc.add(Field.Text("title", genericDoc.getTitle()));
- if (genericDoc.getDate() != 0)
- doc.add(Field.Text("date", genericDoc.getDate()+""));
- if (genericDoc.getFields() != null)
- {
- Map map = genericDoc.getFields();
- Iterator itKeys = map.keySet().iterator();
- while (itKeys.hasNext())
- {
- String key = (String)itKeys.next();
- doc.add(Field.Text(key, (String)map.get(key)));
- }
- }
- documents.add(doc);
- }
- return documents;
- }
-
- public abstract List getDocuments();
-
- public void destroy()
- {
- info.setStatus(Info.Status.STOPPED);
- }
-
- public String getId()
- {
- return id;
- }
-
- public Info getInfo()
- {
- return info;
- }
-
- public Results search(Query query)
- {
- Results result = new Results();
- String luceneQueryString = LuceneQueryConverter.convert(query);
- QueryParser parser = new QueryParser(defaultField, new StandardAnalyzer());
- try
- {
- org.apache.lucene.search.Query luceneQuery = parser.parse(luceneQueryString);
- Searcher searcher = new IndexSearcher(indexPath);
- Hits hits = searcher.search(luceneQuery);
- for (int i=0; i<hits.length(); i++)
- {
- result.add(new SimpleResult(id, hits.doc(i)));
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- return result;
- }
-
- public String getMarkup(Results results, int markupLevel)
- {
- StringBuffer buffer = new StringBuffer();
- Iterator it = results.iterator();
- while (it.hasNext())
- {
- AbstractResult result = (AbstractResult) it.next();
- Document document = (Document)((SimpleResult)result).getValue();
- buffer.append("Id:" +
document.getField("id").stringValue());
- buffer.append(" ");
- }
- return buffer.toString();
- }
-
-}
Copied:
trunk/search/src/main/org/jboss/portal/search/federated/lucene/LuceneSearchFederated.java
(from rev 6186,
trunk/search/src/main/org/jboss/portal/search/lucene/LuceneSearchFederated.java)
===================================================================
---
trunk/search/src/main/org/jboss/portal/search/federated/lucene/LuceneSearchFederated.java
(rev 0)
+++
trunk/search/src/main/org/jboss/portal/search/federated/lucene/LuceneSearchFederated.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -0,0 +1,187 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.search.federated.lucene;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.Hits;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.Searcher;
+import org.jboss.portal.search.IndexingException;
+import org.jboss.portal.search.SearchFederated;
+import org.jboss.portal.search.federation.Info;
+import org.jboss.portal.search.query.Query;
+import org.jboss.portal.search.result.ResultSet;
+import org.jboss.portal.search.result.impl.AbstractResult;
+import org.jboss.portal.search.result.impl.SimpleResult;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public abstract class LuceneSearchFederated implements SearchFederated
+{
+
+ private IndexWriter index;
+
+ private String id;
+
+ private Info info;
+
+ private String indexPath;
+
+ private String defaultField;
+
+ public LuceneSearchFederated(String id, String indexPath, String defaultField)
+ {
+ this.id = id;
+ this.indexPath = indexPath;
+ this.defaultField = defaultField;
+ info = new Info();
+ }
+
+ public void create() throws IndexingException
+ {
+
+ try
+ {
+ index = new IndexWriter(indexPath, new StandardAnalyzer(), true);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ info.setStatus(Info.Status.INDEXING);
+ try
+ {
+ List documents = getLuceneDocuments();
+ Iterator it = documents.iterator();
+ while (it.hasNext())
+ {
+ Document document = (Document)it.next();
+ index.addDocument(document);
+ }
+ index.optimize();
+ index.close();
+ }
+ catch (IOException e)
+ {
+ throw new IndexingException("Cannot index document", e);
+ }
+ info.setStatus(Info.Status.STARTED);
+ }
+
+ public List getLuceneDocuments()
+ {
+ List documents = getDocuments();
+ Iterator it = documents.iterator();
+ while (it.hasNext())
+ {
+ GenericDocument genericDoc = (GenericDocument) it.next();
+ Document doc = new Document();
+ if (genericDoc.getTitle() != null)
+ doc.add(Field.Text("title", genericDoc.getTitle()));
+ if (genericDoc.getDate() != 0)
+ doc.add(Field.Text("date", genericDoc.getDate()+""));
+ if (genericDoc.getFields() != null)
+ {
+ Map map = genericDoc.getFields();
+ Iterator itKeys = map.keySet().iterator();
+ while (itKeys.hasNext())
+ {
+ String key = (String)itKeys.next();
+ doc.add(Field.Text(key, (String)map.get(key)));
+ }
+ }
+ documents.add(doc);
+ }
+ return documents;
+ }
+
+ /**
+ * List of GenericDocument
+ * @return
+ */
+ public abstract List getDocuments();
+
+ public void destroy()
+ {
+ info.setStatus(Info.Status.STOPPED);
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public Info getInfo()
+ {
+ return info;
+ }
+
+ public ResultSet search(Query query)
+ {
+ ResultSet result = new ResultSet(this);
+ String luceneQueryString = LuceneQueryConverter.convert(query);
+ QueryParser parser = new QueryParser(defaultField, new StandardAnalyzer());
+ try
+ {
+ org.apache.lucene.search.Query luceneQuery = parser.parse(luceneQueryString);
+ Searcher searcher = new IndexSearcher(indexPath);
+ Hits hits = searcher.search(luceneQuery);
+ for (int i=0; i<hits.length(); i++)
+ {
+ result.add(new SimpleResult(id, hits.doc(i)));
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ return result;
+ }
+
+ public String getMarkup(ResultSet results, int markupLevel)
+ {
+ StringBuffer buffer = new StringBuffer();
+ Iterator it = results.iterator();
+ while (it.hasNext())
+ {
+ AbstractResult result = (AbstractResult) it.next();
+ Document document = (Document)((SimpleResult)result).getValue();
+ buffer.append("Id:" +
document.getField("id").stringValue());
+ buffer.append(" ");
+ }
+ return buffer.toString();
+ }
+
+}
Deleted: trunk/search/src/main/org/jboss/portal/search/federation/SearchFederated.java
===================================================================
---
trunk/search/src/main/org/jboss/portal/search/federation/SearchFederated.java 2007-02-07
20:53:41 UTC (rev 6186)
+++
trunk/search/src/main/org/jboss/portal/search/federation/SearchFederated.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -1,77 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This 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 software 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 software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.search.federation;
-
-import org.jboss.portal.search.IndexingException;
-import org.jboss.portal.search.query.Query;
-import org.jboss.portal.search.result.Results;
-
-/**
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public interface SearchFederated
-{
-
- /**
- * Get the ID for this federated search
- * @return String representing this particular federated search
- */
- public String getId();
-
- /**
- * Method called when this federated search is not used anymore.
- * This could be the place to destry any index
- * @throws IndexingException
- */
- public void destroy() throws IndexingException;
-
- /**
- * The create method should index the required components
- * @throws IndexingException
- */
- public void create() throws IndexingException;
-
- /**
- * Info should return information on the current status
- * if the federated search
- * @return
- */
- public Info getInfo();
-
- /**
- * From the query object this method is responsible to return the
- * results of the query
- * @param query
- * @return
- */
- public Results search(Query query);
-
- public String getMarkup(Results results, int markupLevel);
-
- public interface MarkupLevel
- {
- public static final int FULL = 0;
- public static final int REDUCED = 1;
- }
-}
Modified: trunk/search/src/main/org/jboss/portal/search/federation/SearchFederation.java
===================================================================
---
trunk/search/src/main/org/jboss/portal/search/federation/SearchFederation.java 2007-02-07
20:53:41 UTC (rev 6186)
+++
trunk/search/src/main/org/jboss/portal/search/federation/SearchFederation.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -24,8 +24,8 @@
import java.util.List;
+import org.jboss.portal.search.SearchFederated;
import org.jboss.portal.search.query.Query;
-import org.jboss.portal.search.result.Results;
/**
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
@@ -43,6 +43,6 @@
public SearchFederated getSearchFederated(String id);
- public Results search(Query query);
+ public List search(Query query);
}
Modified:
trunk/search/src/main/org/jboss/portal/search/federation/impl/SearchFederationService.java
===================================================================
---
trunk/search/src/main/org/jboss/portal/search/federation/impl/SearchFederationService.java 2007-02-07
20:53:41 UTC (rev 6186)
+++
trunk/search/src/main/org/jboss/portal/search/federation/impl/SearchFederationService.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -31,11 +31,11 @@
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.search.IndexingException;
+import org.jboss.portal.search.SearchFederated;
import org.jboss.portal.search.federation.Info;
-import org.jboss.portal.search.federation.SearchFederated;
import org.jboss.portal.search.federation.SearchFederation;
import org.jboss.portal.search.query.Query;
-import org.jboss.portal.search.result.Results;
+import org.jboss.portal.search.result.ResultSet;
/**
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
@@ -136,16 +136,16 @@
return (SearchFederated)registry.get(id);
}
- public Results search(Query query)
+ public List search(Query query)
{
- Results results = new Results();
+ List results = new ArrayList();
Iterator it = registry.values().iterator();
while (it.hasNext())
{
SearchFederated federated = (SearchFederated)it.next();
if (federated.getInfo().getStatus() == Info.Status.AVAILABLE)
{
- results.addAll(federated.search(query));
+ results.add(federated.search(query));
}
}
return results;
Added: trunk/search/src/main/org/jboss/portal/search/impl/GenericSearchFederated.java
===================================================================
--- trunk/search/src/main/org/jboss/portal/search/impl/GenericSearchFederated.java
(rev 0)
+++
trunk/search/src/main/org/jboss/portal/search/impl/GenericSearchFederated.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.search.impl;
+
+import java.util.Locale;
+
+import org.jboss.portal.search.SearchFederated;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public abstract class GenericSearchFederated implements SearchFederated
+{
+ public String getName(Locale locale)
+ {
+ return getId();
+ }
+}
Modified: trunk/search/src/main/org/jboss/portal/search/lucene/LuceneSearchFederated.java
===================================================================
---
trunk/search/src/main/org/jboss/portal/search/lucene/LuceneSearchFederated.java 2007-02-07
20:53:41 UTC (rev 6186)
+++
trunk/search/src/main/org/jboss/portal/search/lucene/LuceneSearchFederated.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -36,10 +36,10 @@
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Searcher;
import org.jboss.portal.search.IndexingException;
+import org.jboss.portal.search.SearchFederated;
import org.jboss.portal.search.federation.Info;
-import org.jboss.portal.search.federation.SearchFederated;
import org.jboss.portal.search.query.Query;
-import org.jboss.portal.search.result.Results;
+import org.jboss.portal.search.result.ResultSet;
import org.jboss.portal.search.result.impl.AbstractResult;
import org.jboss.portal.search.result.impl.SimpleResult;
@@ -143,9 +143,9 @@
return info;
}
- public Results search(Query query)
+ public ResultSet search(Query query)
{
- Results result = new Results();
+ ResultSet result = new ResultSet(this);
String luceneQueryString = LuceneQueryConverter.convert(query);
QueryParser parser = new QueryParser(defaultField, new StandardAnalyzer());
try
@@ -166,7 +166,7 @@
return result;
}
- public String getMarkup(Results results, int markupLevel)
+ public String getMarkup(ResultSet results, int markupLevel)
{
StringBuffer buffer = new StringBuffer();
Iterator it = results.iterator();
Modified: trunk/search/src/main/org/jboss/portal/search/result/Result.java
===================================================================
--- trunk/search/src/main/org/jboss/portal/search/result/Result.java 2007-02-07 20:53:41
UTC (rev 6186)
+++ trunk/search/src/main/org/jboss/portal/search/result/Result.java 2007-02-08 16:51:26
UTC (rev 6187)
@@ -30,7 +30,7 @@
{
public float getScore();
- public String getFederatedId();
-
public ResultURL getURL();
+
+ public String getTitle();
}
Copied: trunk/search/src/main/org/jboss/portal/search/result/ResultSet.java (from rev
6150, trunk/search/src/main/org/jboss/portal/search/result/Results.java)
===================================================================
--- trunk/search/src/main/org/jboss/portal/search/result/ResultSet.java
(rev 0)
+++ trunk/search/src/main/org/jboss/portal/search/result/ResultSet.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.search.result;
+
+import java.util.ArrayList;
+
+import org.jboss.portal.search.SearchFederated;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class ResultSet extends ArrayList
+{
+ private static final long serialVersionUID = -334471675564695554L;
+
+ private SearchFederated searchFederated;
+
+ public ResultSet(SearchFederated searchFederated)
+ {
+ this.searchFederated = searchFederated;
+ }
+
+ public SearchFederated getSearchFederated()
+ {
+ return searchFederated;
+ }
+
+ public Result getResult(int i)
+ {
+ return (Result)get(i);
+ }
+
+
+ public void add(Result result)
+ {
+ super.add(result);
+ }
+
+}
Modified: trunk/search/src/main/org/jboss/portal/search/result/ResultURL.java
===================================================================
--- trunk/search/src/main/org/jboss/portal/search/result/ResultURL.java 2007-02-07
20:53:41 UTC (rev 6186)
+++ trunk/search/src/main/org/jboss/portal/search/result/ResultURL.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -28,5 +28,5 @@
*/
public interface ResultURL
{
-
+
}
Deleted: trunk/search/src/main/org/jboss/portal/search/result/Results.java
===================================================================
--- trunk/search/src/main/org/jboss/portal/search/result/Results.java 2007-02-07 20:53:41
UTC (rev 6186)
+++ trunk/search/src/main/org/jboss/portal/search/result/Results.java 2007-02-08 16:51:26
UTC (rev 6187)
@@ -1,41 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This 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 software 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 software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.search.result;
-
-import java.util.ArrayList;
-
-/**
- * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class Results extends ArrayList
-{
-
- private static final long serialVersionUID = -334471675564695554L;
-
- public Result getResult(int i)
- {
- return (Result)get(i);
- }
-
-}
Modified: trunk/search/src/main/org/jboss/portal/search/result/impl/SimpleResult.java
===================================================================
--- trunk/search/src/main/org/jboss/portal/search/result/impl/SimpleResult.java 2007-02-07
20:53:41 UTC (rev 6186)
+++ trunk/search/src/main/org/jboss/portal/search/result/impl/SimpleResult.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -46,5 +46,5 @@
{
this.value = value;
}
-
+
}
Modified: trunk/search/src/main/org/jboss/portal/search/test/DummySearchFederated.java
===================================================================
---
trunk/search/src/main/org/jboss/portal/search/test/DummySearchFederated.java 2007-02-07
20:53:41 UTC (rev 6186)
+++
trunk/search/src/main/org/jboss/portal/search/test/DummySearchFederated.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -22,11 +22,13 @@
******************************************************************************/
package org.jboss.portal.search.test;
+import java.util.Locale;
+
import org.jboss.portal.search.IndexingException;
+import org.jboss.portal.search.SearchFederated;
import org.jboss.portal.search.federation.Info;
-import org.jboss.portal.search.federation.SearchFederated;
import org.jboss.portal.search.query.Query;
-import org.jboss.portal.search.result.Results;
+import org.jboss.portal.search.result.ResultSet;
import org.jboss.portal.search.result.impl.SimpleResult;
/**
@@ -64,18 +66,24 @@
return info;
}
- public String getMarkup(Results results, int markupLevel)
+ public String getMarkup(ResultSet results, int markupLevel)
{
return null;
}
- public Results search(Query query)
+ public ResultSet search(Query query)
{
- Results results = new Results();
+ ResultSet results = new ResultSet(this);
results.add(new SimpleResult(getId(), "Result 1"));
results.add(new SimpleResult(getId(), "Result 2"));
results.add(new SimpleResult(getId(), "Result 3"));
return results;
}
+
+ public String getName(Locale locale)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
Modified: trunk/search/src/main/org/jboss/portal/search/test/FederationTest.java
===================================================================
--- trunk/search/src/main/org/jboss/portal/search/test/FederationTest.java 2007-02-07
20:53:41 UTC (rev 6186)
+++ trunk/search/src/main/org/jboss/portal/search/test/FederationTest.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -22,11 +22,13 @@
******************************************************************************/
package org.jboss.portal.search.test;
+import java.util.List;
+
import org.jboss.portal.search.federation.SearchFederation;
import org.jboss.portal.search.federation.impl.SearchFederationService;
import org.jboss.portal.search.query.Query;
import org.jboss.portal.search.query.impl.FieldQueryTerm;
-import org.jboss.portal.search.result.Results;
+import org.jboss.portal.search.result.ResultSet;
import org.jboss.portal.search.result.impl.SimpleResult;
import junit.framework.TestCase;
@@ -47,8 +49,8 @@
Query query = new Query();
query.addMandatoryTerm(new FieldQueryTerm("id", "1"));
- Results results = federation.search(query);
-
+ List list = federation.search(query);
+ ResultSet results = (ResultSet)list.get(0);
assertEquals("Result 1",
(((SimpleResult)results.getResult(0)).getValue()));
assertEquals("Result 2",
(((SimpleResult)results.getResult(1)).getValue()));
assertEquals("Result 3",
(((SimpleResult)results.getResult(2)).getValue()));
Modified: trunk/search/src/main/org/jboss/portal/search/test/LuceneQueryTest.java
===================================================================
--- trunk/search/src/main/org/jboss/portal/search/test/LuceneQueryTest.java 2007-02-07
20:53:41 UTC (rev 6186)
+++ trunk/search/src/main/org/jboss/portal/search/test/LuceneQueryTest.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -23,12 +23,12 @@
package org.jboss.portal.search.test;
import org.jboss.portal.search.IndexingException;
-import org.jboss.portal.search.lucene.LuceneQueryConverter;
-import org.jboss.portal.search.lucene.LuceneSearchFederated;
+import org.jboss.portal.search.federated.lucene.LuceneQueryConverter;
+import org.jboss.portal.search.federated.lucene.LuceneSearchFederated;
import org.jboss.portal.search.query.Query;
import org.jboss.portal.search.query.impl.BetweenDatesTerm;
import org.jboss.portal.search.query.impl.FieldQueryTerm;
-import org.jboss.portal.search.result.Results;
+import org.jboss.portal.search.result.ResultSet;
import junit.framework.TestCase;
@@ -63,7 +63,7 @@
Query query = new Query();
query.addMandatoryTerm(new FieldQueryTerm("id", "1"));
- Results results = fed.search(query);
+ ResultSet results = fed.search(query);
System.out.println(fed.getMarkup(results, 0));
assertEquals("Id:1 Id:1 cat ", fed.getMarkup(results, 0));
}
Modified:
trunk/search/src/main/org/jboss/portal/search/test/TestLuceneSearchFederated.java
===================================================================
---
trunk/search/src/main/org/jboss/portal/search/test/TestLuceneSearchFederated.java 2007-02-07
20:53:41 UTC (rev 6186)
+++
trunk/search/src/main/org/jboss/portal/search/test/TestLuceneSearchFederated.java 2007-02-08
16:51:26 UTC (rev 6187)
@@ -24,10 +24,11 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.jboss.portal.search.lucene.LuceneSearchFederated;
+import org.jboss.portal.search.federated.lucene.LuceneSearchFederated;
/**
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
@@ -61,4 +62,10 @@
return null;
}
+ public String getName(Locale locale)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Added: trunk/search/src/resources/portal-search-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/search/src/resources/portal-search-sar/META-INF/jboss-service.xml
(rev 0)
+++ trunk/search/src/resources/portal-search-sar/META-INF/jboss-service.xml 2007-02-08
16:51:26 UTC (rev 6187)
@@ -0,0 +1,36 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This 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 software 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 software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<server>
+
+ <!-- Management MBean -->
+ <mbean
+ code="org.jboss.portal.search.federation.impl.SearchFederationService"
+ name="portal:service=SearchFederationService"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+
+
+</server>
Property changes on:
trunk/search/src/resources/portal-search-sar/META-INF/jboss-service.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/tools/etc/buildfragments/modules.ent
===================================================================
--- trunk/tools/etc/buildfragments/modules.ent 2007-02-07 20:53:41 UTC (rev 6186)
+++ trunk/tools/etc/buildfragments/modules.ent 2007-02-08 16:51:26 UTC (rev 6187)
@@ -24,6 +24,13 @@
<pathelement path="${jboss.portal-cms.lib}/portal-cms-lib.jar"/>
</path>
+ <!-- search -->
+ <property name="jboss.portal-search.root"
value="${project.root}/search/output"/>
+ <property name="jboss.portal-search.lib"
value="${jboss.portal-search.root}/lib"/>
+ <path id="jboss.portal-search.classpath">
+ <pathelement
path="${jboss.portal-search.lib}/portal-search-lib.jar"/>
+ </path>
+
<!-- server -->
<property name="jboss.portal-server.root"
value="${project.root}/server/output"/>
<property name="jboss.portal-server.lib"
value="${jboss.portal-server.root}/lib"/>
Property changes on: trunk/workflow
___________________________________________________________________
Name: svn:ignore
- output
+ output
bin
Modified: trunk/workflow/.classpath
===================================================================
--- trunk/workflow/.classpath 2007-02-07 20:53:41 UTC (rev 6186)
+++ trunk/workflow/.classpath 2007-02-08 16:51:26 UTC (rev 6187)
@@ -12,5 +12,6 @@
<classpathentry kind="lib"
path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
<classpathentry kind="lib"
path="/thirdparty/junit/lib/junit.jar"/>
<classpathentry combineaccessrules="false" kind="src"
path="/common"/>
+ <classpathentry combineaccessrules="false" kind="src"
path="/identity"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/wsrp/.classpath
===================================================================
--- trunk/wsrp/.classpath 2007-02-07 20:53:41 UTC (rev 6186)
+++ trunk/wsrp/.classpath 2007-02-08 16:51:26 UTC (rev 6187)
@@ -23,10 +23,10 @@
<classpathentry kind="lib"
path="/thirdparty/sun-jaf/lib/activation.jar"/>
<classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/namespace.jar"/>
<classpathentry kind="lib"
path="/thirdparty/ibm-wsdl4j/lib/wsdl4j.jar"/>
- <classpathentry combineaccessrules="false" kind="src"
path="/federation"/>
<classpathentry kind="lib"
path="/thirdparty/jbossas/core-libs/lib/jboss-xml-binding.jar"/>
<classpathentry combineaccessrules="false" kind="src"
path="/jems"/>
<classpathentry combineaccessrules="false" kind="src"
path="/core"/>
<classpathentry combineaccessrules="false" kind="src"
path="/registration"/>
+ <classpathentry combineaccessrules="false" kind="src"
path="/portlet-federation"/>
<classpathentry kind="output" path="output/classes"/>
</classpath>