From graffito-dev-return-1436-apmail-incubator-graffito-dev-archive=www.apache.org@incubator.apache.org Tue Oct 17 08:32:19 2006 Return-Path: Delivered-To: apmail-incubator-graffito-dev-archive@www.apache.org Received: (qmail 51735 invoked from network); 17 Oct 2006 08:32:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 17 Oct 2006 08:32:19 -0000 Received: (qmail 20887 invoked by uid 500); 17 Oct 2006 08:32:19 -0000 Mailing-List: contact graffito-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: graffito-dev@incubator.apache.org Delivered-To: mailing list graffito-dev@incubator.apache.org Received: (qmail 20876 invoked by uid 99); 17 Oct 2006 08:32:19 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Oct 2006 01:32:19 -0700 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=DNS_FROM_RFC_POST,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of evlach@aegean.gr designates 195.251.130.4 as permitted sender) Received: from [195.251.130.4] (HELO hermes2.aegean.gr) (195.251.130.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Oct 2006 01:32:16 -0700 Received: from [195.251.174.44] ([195.251.174.44]) by hermes2.aegean.gr with Microsoft SMTPSVC(6.0.3790.1830); Tue, 17 Oct 2006 11:31:14 +0300 Received: from 127.0.0.1 (AVG SMTP 7.1.408 [268.13.4/477]); Tue, 17 Oct 2006 11:31:14 +0300 Message-ID: <453494D2.6050008@aegean.gr> Date: Tue, 17 Oct 2006 11:31:14 +0300 From: Evangelos Vlachogiannis User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) To: graffito-dev@incubator.apache.org Subject: Re: cannot import!! References: <45347D09.9060706@aegean.gr> <3b728ee90610170119m2ce5e15br7a35bc023dea0fa0@mail.gmail.com> In-Reply-To: <3b728ee90610170119m2ce5e15br7a35bc023dea0fa0@mail.gmail.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-OriginalArrivalTime: 17 Oct 2006 08:31:14.0841 (UTC) FILETIME=[9BEC4890:01C6F1C6] X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N What I want to do is to get the DocumentStream so that I can add the content in index. Here is my changes: Any proposal how to replace that class please? Index: components/src/java/org/apache/portals/graffito/services/search/impl/ContentIndexServiceImpl.java =================================================================== --- components/src/java/org/apache/portals/graffito/services/search/impl/ContentIndexServiceImpl.java (revision 463916) +++ components/src/java/org/apache/portals/graffito/services/search/impl/ContentIndexServiceImpl.java (working copy) @@ -34,9 +34,11 @@ import org.apache.portals.graffito.model.core.CmsObject; import org.apache.portals.graffito.model.core.VersionnedContent; import org.apache.portals.graffito.persistence.ContentPersistenceService; +import org.apache.portals.graffito.portlets.util.ServiceAccessor; +import org.apache.portals.graffito.services.dm.DocumentModelService; import org.apache.portals.graffito.services.search.ContentIndexService; -/** +/** * * Default implementation for {@link org.apache.portals.graffito.services.core.ContentIndexService} * @@ -157,13 +159,19 @@ doc.add(Field.Keyword(CREATION_DATE_FIELD, DateField.dateToString(cmsObject.getCreationDate()))); doc.add(Field.Keyword(LAST_MODIFIED_DATE_FIELD, DateField.dateToString(cmsObject.getLastModified()))); + DocumentModelService cms = ServiceAccessor.getDocumentService(); + org.apache.portals.graffito.model.dm.Document doc1 = cms.getDocument(cmsObject.getUri()); + String s = new String(doc1.getDocumentStream().getContentByte(),"utf-8"); + doc.add(Field.Text("contents", s)); //this only for text documents + + //TODO: add more more mime type (pdfbox.org for pdf etc...) + // Add version info if (cmsObject instanceof VersionnedContent) { //TODO : add Version infos } - indexWriter.addDocument(doc); indexWriter.optimize(); result = true; @@ -171,7 +179,9 @@ catch (IOException e) { log.error("Error while adding document into the Lucene index " , e); - } + } catch (ContentManagementException e) { + log.error("Error while getting the contents of the document to add to the Lucene index " , e); + } finally { try Christophe Lombart wrote: > The components subproject has no dependencies to the graffito > portlets subproject (applications/graffito-portlets). > > Why do you want to use ServiceAccessor in ContentIndexServiceImpl ? It > is better to use injection to access to another service. > > > On 10/17/06, Evangelos Vlachogiannis wrote: >> Hi list, >> >> I have met a strange behavior: When I just add in class >> >> components/src/java/org/apache/portals/graffito/services/search/impl/ContentIndexServiceImpl.java >> >> >> the >> >> import org.apache.portals.graffito.portlets.util.ServiceAccessor; >> >> and try to compile using maven allBuild I compile get error saying that >> there is not org.apache.portals.graffito.portlets.util package!!! Any >> ideas pls before I get crazy?? >> >> Thnx, >> Vangelis >> >> > > -- Evangelos Vlachogiannis Researcher - University of the Aegean Contact&More: http://www.syros.aegean.gr/users/evlach/contactme.php -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.408 / Virus Database: 268.13.4/477 - Release Date: 16/10/2006