summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/ArtifactDocumentProcessor.java
diff options
context:
space:
mode:
authoradrianocrestani <adrianocrestani@13f79535-47bb-0310-9956-ffa450edef68>2009-10-28 06:38:34 +0000
committeradrianocrestani <adrianocrestani@13f79535-47bb-0310-9956-ffa450edef68>2009-10-28 06:38:34 +0000
commitaaea9a7255e72725634af9f46bb59c4f61418776 (patch)
tree4ca00006ac9373cf7a85f358abe2df47dcf0510e /branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/ArtifactDocumentProcessor.java
parente14097e558d803c2b22a92ec3484330ffebf1459 (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/ArtifactDocumentProcessor.java')
-rw-r--r--branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/ArtifactDocumentProcessor.java121
1 files changed, 47 insertions, 74 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();
- }
+ }
}