diff options
author | adrianocrestani <adrianocrestani@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-28 06:38:34 +0000 |
---|---|---|
committer | adrianocrestani <adrianocrestani@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-28 06:38:34 +0000 |
commit | aaea9a7255e72725634af9f46bb59c4f61418776 (patch) | |
tree | 4ca00006ac9373cf7a85f358abe2df47dcf0510e /branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl | |
parent | e14097e558d803c2b22a92ec3484330ffebf1459 (diff) |
applying patch tuscany_2552_phillipe_ramalho_09_30_2009.patch from TUSCANY-2552
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@830448 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl')
7 files changed, 141 insertions, 328 deletions
diff --git a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/ArtifactDocumentProcessor.java b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/ArtifactDocumentProcessor.java index 92aae110b4..fcfce34d88 100644 --- a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/ArtifactDocumentProcessor.java +++ b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/ArtifactDocumentProcessor.java @@ -28,107 +28,80 @@ import org.apache.tuscany.sca.domain.search.DocumentMap; import org.apache.tuscany.sca.domain.search.DocumentProcessor; /** - * * @version $Rev$ $Date$ */ public class ArtifactDocumentProcessor implements DocumentProcessor { - public Document process(DocumentProcessor parentProcessor, - DocumentMap documents, Object object, Document document, - String parent) { - - if (object instanceof Artifact) { - Artifact artifact = (Artifact) object; - // String uri = artifact.getURI(); + public Document process(DocumentProcessor parentProcessor, + DocumentMap documents, + Object object, + Document document, + String parent) { - // if (uri != null && uri.length() == 0) { - // uri = null; - // } - // - // if (uri != null) { - // - // if (uri.endsWith(".composite") - // || uri.endsWith(".component")) { - // - // parent += DomainPathAnalyzer.PATH_SEPARATOR - // + SearchFields.ARTIFACT_FIELD - // + DomainPathAnalyzer.TYPE_SEPARATOR + uri; - // - // if (document == null) { - // document = documents.get(uri); - // } - // - // document.add(new Field(SearchFields.ARTIFACT_FIELD, uri, - // Field.Store.YES, Field.Index.ANALYZED)); - // - // } - // - // } + if (object instanceof Artifact) { + Artifact artifact = (Artifact)object; - if (!(object instanceof Contribution)) { + if (!(object instanceof Contribution)) { - String location = artifact.getLocation(); + String location = artifact.getLocation(); - try { + try { - if (document == null) { - document = documents.get(SearchFields.ARTIFACT_FIELD + location); - } + if (document == null) { + document = documents.get(SearchFields.ARTIFACT_FIELD + location); + } - FileContent fileContent = new WrappedFileContent(new URL( - location)); + FileContent fileContent = new WrappedFileContent(new URL(location)); - document.add(new Field(SearchFields.ARTIFACT_FIELD, - fileContent.getName(), Field.Store.YES, - Field.Index.ANALYZED)); + document.add(new Field(SearchFields.ARTIFACT_FIELD, fileContent.getName(), Field.Store.YES, + Field.Index.ANALYZED)); - parent += DomainPathAnalyzer.PATH_SEPARATOR - + SearchFields.ARTIFACT_FIELD - + DomainPathAnalyzer.TYPE_SEPARATOR - + location + DomainPathAnalyzer.URI_SEPARATOR - + fileContent.getName(); + parent += + DomainPathAnalyzer.PATH_SEPARATOR + SearchFields.ARTIFACT_FIELD + + DomainPathAnalyzer.TYPE_SEPARATOR + + location + + DomainPathAnalyzer.URI_SEPARATOR + + fileContent.getName(); - // parent += DomainPathAnalyzer.PATH_SEPARATOR - // + SearchFields.FILE_FIELD - // + DomainPathAnalyzer.TYPE_SEPARATOR + location + - // DomainPathAnalyzer.URI_SEPARATOR + fileContent.getName(); + // parent += DomainPathAnalyzer.PATH_SEPARATOR + // + SearchFields.FILE_FIELD + // + DomainPathAnalyzer.TYPE_SEPARATOR + location + + // DomainPathAnalyzer.URI_SEPARATOR + fileContent.getName(); - Document fileDoc = parentProcessor.process(parentProcessor, - documents, fileContent, null, parent); + Document fileDoc = parentProcessor.process(parentProcessor, documents, fileContent, null, parent); - fileDoc.add(new Field(SearchFields.PARENT_FIELD, parent, - Field.Store.YES, Field.Index.ANALYZED)); + fileDoc.add(new Field(SearchFields.PARENT_FIELD, parent, Field.Store.YES, Field.Index.ANALYZED)); - } catch (IOException e) { - // ignore location - } + } catch (IOException e) { + // ignore location + } - } + } - return document == null ? FAKE_DOCUMENT : document; + return document == null ? FAKE_DOCUMENT : document; - } + } - throw new IllegalArgumentException(); + throw new IllegalArgumentException(); - } + } - public Object getDocumentKey(Object obj) { + public Object getDocumentKey(Object obj) { - if (obj instanceof Artifact) { - Artifact artifact = (Artifact) obj; - String uri = artifact.getLocation(); + if (obj instanceof Artifact) { + Artifact artifact = (Artifact)obj; + String uri = artifact.getLocation(); - if (uri != null && uri.length() == 0) { - return null; - } + if (uri != null && uri.length() == 0) { + return null; + } - return SearchFields.ARTIFACT_FIELD + uri; + return SearchFields.ARTIFACT_FIELD + uri; - } + } - throw new IllegalArgumentException(); + throw new IllegalArgumentException(); - } + } } diff --git a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DefaultSearchContributionListenerExtensionPoint.java b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DefaultSearchContributionListenerExtensionPoint.java deleted file mode 100644 index 8ed859c2e6..0000000000 --- a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DefaultSearchContributionListenerExtensionPoint.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.domain.search.impl; - -import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.service.ContributionRepository; -import org.apache.tuscany.sca.domain.search.SearchContributionListenerExtensionPoint; - -/** - * - * @version $Rev$ $Date$ - */ -public class DefaultSearchContributionListenerExtensionPoint implements SearchContributionListenerExtensionPoint { - - public void contributionAdded(ContributionRepository repository, Contribution contribution) { - System.out.println("contributionAdded:"); - System.out.println(repository); - System.out.println(contribution); - - } - - public void contributionRemoved(ContributionRepository repository, Contribution contribution) { - System.out.println("contributionRemoved:"); - System.out.println(repository); - System.out.println(contribution); - - } - - public void contributionUpdated(ContributionRepository repository, - Contribution oldContribution, - Contribution contribution) { - - System.out.println("contributionUpdated:"); - System.out.println(repository); - System.out.println(oldContribution); - System.out.println(contribution); - - } - -} diff --git a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DomainSearchDocumentProcessorsMap.java b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DomainSearchDocumentProcessorsMap.java index 544da46dad..554da34ea1 100644 --- a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DomainSearchDocumentProcessorsMap.java +++ b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DomainSearchDocumentProcessorsMap.java @@ -28,7 +28,6 @@ import org.apache.tuscany.sca.contribution.Contribution; import org.apache.tuscany.sca.domain.search.DocumentProcessorsMap; /** - * * @version $Rev$ $Date$ */ public class DomainSearchDocumentProcessorsMap extends DocumentProcessorsMap { @@ -36,15 +35,15 @@ public class DomainSearchDocumentProcessorsMap extends DocumentProcessorsMap { private static final long serialVersionUID = -4651637686945322606L; public DomainSearchDocumentProcessorsMap() { - addDocumentProcessor(Contribution.class, new ContributionDocumentProcessor()); - addDocumentProcessor(Artifact.class, new ArtifactDocumentProcessor()); - addDocumentProcessor(Property.class, new PropertyDocumentProcessor()); - addDocumentProcessor(ComponentType.class, new ComponentTypeDocumentProcessor()); - addDocumentProcessor(Binding.class, new BindingDocumentProcessor()); - addDocumentProcessor(Component.class, new ComponentDocumentProcessor()); - addDocumentProcessor(Composite.class, new CompositeDocumentProcessor()); - addDocumentProcessor(FileContent.class, new DomainSearchFileDocumentProcessor()); - addDocumentProcessor(Property.class, new PropertyDocumentProcessor()); + put(Contribution.class, new ContributionDocumentProcessor()); + put(Artifact.class, new ArtifactDocumentProcessor()); + put(Property.class, new PropertyDocumentProcessor()); + put(ComponentType.class, new ComponentTypeDocumentProcessor()); + put(Binding.class, new BindingDocumentProcessor()); + put(Component.class, new ComponentDocumentProcessor()); + put(Composite.class, new CompositeDocumentProcessor()); + put(FileContent.class, new DomainSearchFileDocumentProcessor()); + put(Property.class, new PropertyDocumentProcessor()); } diff --git a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DomainSearchImpl.java b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DomainSearchImpl.java index 182f1d09ba..59b80ac026 100644 --- a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DomainSearchImpl.java +++ b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DomainSearchImpl.java @@ -19,7 +19,6 @@ package org.apache.tuscany.sca.domain.search.impl; import java.io.File; -import java.io.FileWriter; import java.io.IOException; import java.util.HashSet; @@ -40,13 +39,13 @@ import org.apache.lucene.store.SimpleFSLockFactory; import org.apache.tuscany.sca.contribution.Contribution; import org.apache.tuscany.sca.domain.search.DocumentMap; import org.apache.tuscany.sca.domain.search.DomainSearch; +import org.apache.tuscany.sca.domain.search.IndexException; import org.apache.tuscany.sca.domain.search.Result; import org.osoa.sca.annotations.AllowsPassByReference; import org.osoa.sca.annotations.Property; import org.osoa.sca.annotations.Scope; /** - * * @version $Rev$ $Date$ */ @Scope("COMPOSITE") @@ -75,7 +74,6 @@ public class DomainSearchImpl implements DomainSearch { public DomainSearchImpl() { this.qp.setAllowLeadingWildcard(true); - } private Directory getIndexDirectory() throws IOException { @@ -108,7 +106,7 @@ public class DomainSearchImpl implements DomainSearch { } @AllowsPassByReference - public void contributionAdded(Contribution contribution) { + public void addContribution(Contribution contribution) throws IndexException { IndexWriter indexWriter = null; @@ -132,7 +130,7 @@ public class DomainSearchImpl implements DomainSearch { } - throw new RuntimeException("Problem while indexing!", e); + throw new IndexException(e.getMessage(), e); } finally { @@ -152,7 +150,7 @@ public class DomainSearchImpl implements DomainSearch { } @AllowsPassByReference - public void contributionRemoved(Contribution contribution) { + public void removeContribution(Contribution contribution) throws IndexException { IndexWriter indexWriter = null; @@ -178,7 +176,7 @@ public class DomainSearchImpl implements DomainSearch { } - throw new RuntimeException("Problem while indexing!", e); + throw new IndexException(e.getMessage(), e); } finally { @@ -199,8 +197,7 @@ public class DomainSearchImpl implements DomainSearch { } - private void contributionRemoved(Contribution contribution, IndexWriter indexWriter) throws CorruptIndexException, - IOException { + private void contributionRemoved(Contribution contribution, IndexWriter indexWriter) throws IndexException { String contributionURI = contribution.getURI(); StringBuilder sb = new StringBuilder(SearchFields.PARENT_FIELD); @@ -218,14 +215,18 @@ public class DomainSearchImpl implements DomainSearch { indexWriter.deleteDocuments(query); } catch (ParseException e) { - throw new RuntimeException("Could not parse query: " + sb.toString(), e); + // ignore exception + + } catch (CorruptIndexException ex) { + throw new IndexException(ex.getMessage(), ex); + + } catch (IOException ex) { + throw new IndexException(ex.getMessage(), ex); } } - private void contributionAdded(Contribution contribution, IndexWriter indexWriter) throws CorruptIndexException, - IOException { - + private void contributionAdded(Contribution contribution, IndexWriter indexWriter) throws IndexException { DomainSearchDocumentProcessorsMap docProcessors = new DomainSearchDocumentProcessorsMap(); DocumentMap docs = new DocumentMap(); @@ -236,37 +237,30 @@ public class DomainSearchImpl implements DomainSearch { e.printStackTrace(); } - FileWriter writer = new FileWriter("indexed.txt"); + // FileWriter writer = new FileWriter("indexed.txt"); for (Document doc : docs.values()) { org.apache.lucene.document.Document luceneDoc = doc.createLuceneDocument(); - writer.write(luceneDoc.toString()); - writer.write('\n'); - writer.write('\n'); - indexWriter.addDocument(luceneDoc); - + // writer.write(luceneDoc.toString()); + // writer.write('\n'); + // writer.write('\n'); + + try { + indexWriter.addDocument(luceneDoc); + + } catch (CorruptIndexException e) { + throw new IndexException(e.getMessage(), e); + + } catch (IOException e) { + throw new IndexException(e.getMessage(), e); + } + } - - writer.close(); - - // BufferedReader consoleReader = new BufferedReader( - // new InputStreamReader(System.in)); - // - // while (true) { - // System.out.print("query: "); - // String queryString = consoleReader.readLine(); - // - // if (queryString.equals("exit")) { - // break; - // } - // - // parseAndSearch(queryString, false); - // - // } + // writer.close(); } @AllowsPassByReference - public void contributionUpdated(Contribution oldContribution, Contribution contribution) { + public void updateContribution(Contribution oldContribution, Contribution contribution) throws IndexException { IndexWriter indexWriter = null; @@ -291,7 +285,7 @@ public class DomainSearchImpl implements DomainSearch { } - throw new RuntimeException("Problem while indexing!", e); + throw new IndexException(e.getMessage(), e); } finally { @@ -310,65 +304,53 @@ public class DomainSearchImpl implements DomainSearch { } - public Result[] parseAndSearch(String searchQuery, final boolean highlight) throws Exception { - - final IndexSearcher searcher = new IndexSearcher(getIndexDirectory()); - - DomainSearchResultProcessor resultProcessor = new DomainSearchResultProcessor(new DomainSearchResultFactory()); - - final Query query = qp.parse(searchQuery); - System.out.println("query: " + searchQuery); - - TopDocs topDocs = searcher.search(query, 1000); + public Result[] parseAndSearch(String searchQuery, final boolean highlight) throws IndexException, ParseException { + return search(this.qp.parse(searchQuery), highlight); + } - int indexed = 0; - HashSet<String> set = new HashSet<String>(); - for (ScoreDoc scoreDoc : topDocs.scoreDocs) { - org.apache.lucene.document.Document luceneDocument = searcher.doc(scoreDoc.doc); + public Result[] search(Query searchQuery, boolean highlight) throws IndexException { - resultProcessor.process(luceneDocument, null); + try { + final IndexSearcher searcher = new IndexSearcher(getIndexDirectory()); + DomainSearchResultProcessor resultProcessor = + new DomainSearchResultProcessor(new DomainSearchResultFactory()); + TopDocs topDocs = searcher.search(searchQuery, 1000); - indexed++; - set.add(luceneDocument.toString()); + int indexed = 0; + HashSet<String> set = new HashSet<String>(); + for (ScoreDoc scoreDoc : topDocs.scoreDocs) { + org.apache.lucene.document.Document luceneDocument = searcher.doc(scoreDoc.doc); - System.out.println(luceneDocument); + resultProcessor.process(luceneDocument, null); - } + indexed++; + set.add(luceneDocument.toString()); - /* - * searcher.search(query, new HitCollector() { - * @Override public void collect(int doc, float score) { try { - * org.apache.lucene.document.Document document = searcher .doc(doc); - * luceneDocuments.put(doc, document); System.out.println(doc); } catch - * (CorruptIndexException e) { // TODO Auto-generated catch block - * e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated - * catch block e.printStackTrace(); } } }); - */ + } - System.out.println("indexed = " + indexed); - System.out.println("set.size() = " + set.size()); + Result[] results = resultProcessor.createResultRoots(); - Result[] results = resultProcessor.createResultRoots(); + if (highlight) { - if (highlight) { + for (Result result : results) { + HighlightingUtil.highlightResult(result, searchQuery); + } - for (Result result : results) { - HighlightingUtil.highlightResult(result, query); } - } + return results; - return results; + } catch (CorruptIndexException ex) { + throw new IndexException(ex.getMessage(), ex); - } + } catch (IOException ex) { + throw new IndexException(ex.getMessage(), ex); + } - public Result[] search(Query searchQuery, boolean hightlight) { - // TODO Auto-generated method stub - return null; } - public String highlight(String field, String text, String searchQuery) throws Exception { - final Query query = qp.parse(searchQuery); + public String highlight(String field, String text, String searchQuery) throws ParseException { + final Query query = this.qp.parse(searchQuery); return HighlightingUtil.highlight(field, query, text); diff --git a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DomainSearchModuleActivator.java b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DomainSearchModuleActivator.java deleted file mode 100644 index 5db27931b6..0000000000 --- a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DomainSearchModuleActivator.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.domain.search.impl; - -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.ModuleActivator; - -/** - * - * @version $Rev$ $Date$ - */ -public class DomainSearchModuleActivator implements ModuleActivator { - - public DomainSearchModuleActivator() { - // empty constructor - } - - public void start(ExtensionPointRegistry registry) { - registry.addExtensionPoint(new DefaultSearchContributionListenerExtensionPoint()); - } - - public void stop(ExtensionPointRegistry registry) { - // does nothing - } - -} diff --git a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/HighlightingUtil.java b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/HighlightingUtil.java index cd253c4859..356eb88070 100644 --- a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/HighlightingUtil.java +++ b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/HighlightingUtil.java @@ -33,7 +33,6 @@ import org.apache.lucene.search.highlight.SpanScorer; import org.apache.tuscany.sca.domain.search.Result; /** - * * @version $Rev$ $Date$ */ final public class HighlightingUtil { @@ -53,22 +52,17 @@ final public class HighlightingUtil { } - try { - String highlightedText = - HighlightingUtil.bestFragmentHighlighted(result.getField(), query, result.getValue(), fragmenter); - - // checks if something was highlighted before resetting the value - if (highlightedText != null && highlightedText.length() > 0) { - result.setValue(highlightedText); - } + String highlightedText = + HighlightingUtil.bestFragmentHighlighted(result.getField(), query, result.getValue(), fragmenter); - } catch (IOException e) { - // ignore highlighting + // checks if something was highlighted before resetting the value + if (highlightedText != null && highlightedText.length() > 0) { + result.setValue(highlightedText); } } - public static String highlight(String field, Query query, String text) throws IOException { + public static String highlight(String field, Query query, String text) { String highlightedText = bestFragmentHighlighted(field, query, text, new NullFragmenter()); if (highlightedText == null || text.length() >= highlightedText.length()) { @@ -83,26 +77,30 @@ final public class HighlightingUtil { return bestFragmentHighlighted(field, query, text, new SimpleFragmenter(100)); } - public static String bestFragmentHighlighted(String field, Query query, String text, Fragmenter fragmenter) - throws IOException { - CachingTokenFilter tokenStream = - new CachingTokenFilter(new DomainSearchAnalyzer().tokenStream(field, new StringReader(text))); - - Highlighter highlighter = - new Highlighter(new DomainSearchFormatter(), new SpanScorer(query, field, tokenStream, "")); - highlighter.setTextFragmenter(fragmenter); - tokenStream.reset(); + public static String bestFragmentHighlighted(String field, Query query, String text, Fragmenter fragmenter) { try { - return highlighter.getBestFragments(tokenStream, text, 2, " ... "); + CachingTokenFilter tokenStream = + new CachingTokenFilter(new DomainSearchAnalyzer().tokenStream(field, new StringReader(text))); + + Highlighter highlighter = + new Highlighter(new DomainSearchFormatter(), new SpanScorer(query, field, tokenStream, "")); + highlighter.setTextFragmenter(fragmenter); + tokenStream.reset(); - } catch (InvalidTokenOffsetsException e) { + try { + return highlighter.getBestFragments(tokenStream, text, 2, " ... "); - // could not create fragments, return empty string - return ""; + } catch (InvalidTokenOffsetsException e) { + // could not create fragments, return empty string + } + } catch (IOException ex) { + // should never happen } + return ""; + } public static String replaceHighlightMarkupBy(CharSequence text, String startHighlight, String endHighlight) { diff --git a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/WrappedFileContent.java b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/WrappedFileContent.java index 0a1dfa75e9..78434d4c0d 100644 --- a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/WrappedFileContent.java +++ b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/WrappedFileContent.java @@ -25,7 +25,6 @@ import java.net.JarURLConnection; import java.net.URL; /** - * * @version $Rev$ $Date$ */ public class WrappedFileContent implements FileContent { @@ -37,49 +36,9 @@ public class WrappedFileContent implements FileContent { if (protocol.equals("jar")) { JarURLConnection jarConn = (JarURLConnection)url.openConnection(); - // Enumeration<JarEntry> entries = jarConn.getJarFile().entries(); String file = url.getFile(); file = file.substring(file.lastIndexOf('!') + 1); - // if (file.charAt(file.length() - 1) != '/') { - // - // int beginIndex; - // - // if (file.charAt(0) == '/') { - // beginIndex = 1; - // - // } else { - // beginIndex = 0; - // } - // - // file = file.substring(beginIndex); - // - // while (entries.hasMoreElements()) { - // String actualFile = entries.nextElement().getName(); - // - // if (actualFile.charAt(0) == '/') { - // beginIndex = 1; - // - // } else { - // beginIndex = 0; - // } - // - // if (actualFile.length() - beginIndex == file.length() + 1 && - // actualFile.charAt(actualFile.length() - 1) == '/') { - // - // if (actualFile.startsWith(file, beginIndex)) { - // file = actualFile; - // - // break; - // - // } - // - // } - // - // } - // - // } - this.fileContent = ZipFileContent.createZipFileContent(jarConn.getJarFile(), file); } else if (protocol.equals("file")) { |