summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/ComponentTypeDocumentProcessor.java
diff options
context:
space:
mode:
authoradrianocrestani <adrianocrestani@13f79535-47bb-0310-9956-ffa450edef68>2009-08-17 06:24:15 +0000
committeradrianocrestani <adrianocrestani@13f79535-47bb-0310-9956-ffa450edef68>2009-08-17 06:24:15 +0000
commit53c043ac18ca8dd9d7f823bf7a399058c305003d (patch)
tree5b8184792065accca1e5a68092d0960db455cda6 /branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/ComponentTypeDocumentProcessor.java
parenta4f020f2df42181bf54587acddb3b748ff5f698f (diff)
committing domain-search changes from patch tuscany_2552_phillipe_ramalho_08_16_2009.patch
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@804871 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/ComponentTypeDocumentProcessor.java199
1 files changed, 89 insertions, 110 deletions
diff --git a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/ComponentTypeDocumentProcessor.java b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/ComponentTypeDocumentProcessor.java
index af1dee2ac5..6c6f7e2194 100644
--- a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/ComponentTypeDocumentProcessor.java
+++ b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/ComponentTypeDocumentProcessor.java
@@ -35,173 +35,152 @@ import org.apache.tuscany.sca.interfacedef.Operation;
*/
public class ComponentTypeDocumentProcessor implements DocumentProcessor {
- public Document process(DocumentProcessor parentProcessor,
- DocumentMap documents, Object object, Document doc, String parent) {
+ public Document process(DocumentProcessor parentProcessor,
+ DocumentMap documents,
+ Object object,
+ Document doc,
+ String parent) {
- if (object instanceof ComponentType) {
- ComponentType componentType = (ComponentType) object;
- String uri = componentType.getURI();
+ if (object instanceof ComponentType) {
+ ComponentType componentType = (ComponentType)object;
+ String uri = componentType.getURI();
- if (uri != null && uri.length() == 0) {
- uri = null;
- }
+ if (uri != null && uri.length() == 0) {
+ uri = null;
+ }
- if (doc == null) {
+ if (doc == null) {
- if (uri != null) {
- doc = documents.get(uri);
+ if (uri != null) {
+ doc = documents.get(uri);
- } else {
- doc = FAKE_DOCUMENT;
- }
+ } else {
+ doc = FAKE_DOCUMENT;
+ }
- }
+ }
- if (uri != null) {
+ if (uri != null) {
- parent += DomainPathAnalyzer.PATH_SEPARATOR
- + SearchFields.COMPONENT_TYPE_FIELD
- + DomainPathAnalyzer.TYPE_SEPARATOR + uri;
+ parent +=
+ DomainPathAnalyzer.PATH_SEPARATOR + SearchFields.COMPONENT_TYPE_FIELD
+ + DomainPathAnalyzer.TYPE_SEPARATOR
+ + uri;
- doc.add(new Field(SearchFields.COMPONENT_TYPE_FIELD, uri,
- Field.Store.YES, Field.Index.ANALYZED));
+ doc.add(new Field(SearchFields.COMPONENT_TYPE_FIELD, uri, Field.Store.YES, Field.Index.ANALYZED));
- for (Service service : componentType.getServices()) {
- Document serviceDoc = documents.get(uri + ':'
- + service.getName());
+ for (Service service : componentType.getServices()) {
+ Document serviceDoc = documents.get(uri + ':' + service.getName());
- serviceDoc.add(new Field(SearchFields.SERVICE_NAME_FIELD,
- service.getName(), Field.Store.YES,
- Field.Index.ANALYZED));
+ serviceDoc.add(new Field(SearchFields.SERVICE_NAME_FIELD, service.getName(), Field.Store.YES,
+ Field.Index.ANALYZED));
- InterfaceContract interfaceContract = service
- .getInterfaceContract();
+ InterfaceContract interfaceContract = service.getInterfaceContract();
- if (interfaceContract != null) {
+ if (interfaceContract != null) {
- Interface interfac = interfaceContract.getInterface();
+ Interface interfac = interfaceContract.getInterface();
- if (interfac != null) {
+ if (interfac != null) {
- for (Operation operation : interfac.getOperations()) {
+ for (Operation operation : interfac.getOperations()) {
- serviceDoc.add(new Field(
- SearchFields.SERVICE_INTERFACE_FIELD,
- operation.getName(), Field.Store.YES,
- Field.Index.ANALYZED));
+ serviceDoc.add(new Field(SearchFields.SERVICE_INTERFACE_FIELD, operation.getName(),
+ Field.Store.YES, Field.Index.ANALYZED));
- }
+ }
- }
+ }
- interfac = interfaceContract.getCallbackInterface();
+ interfac = interfaceContract.getCallbackInterface();
- if (interfac != null) {
+ if (interfac != null) {
- for (Operation operation : interfac.getOperations()) {
+ for (Operation operation : interfac.getOperations()) {
- serviceDoc
- .add(new Field(
- SearchFields.SERVICE_INTERFACE_CALLBACK_FIELD,
- operation.getName(),
- Field.Store.YES,
- Field.Index.ANALYZED));
+ serviceDoc.add(new Field(SearchFields.SERVICE_INTERFACE_CALLBACK_FIELD, operation
+ .getName(), Field.Store.YES, Field.Index.ANALYZED));
- }
+ }
- }
+ }
- }
+ }
- serviceDoc.add(new Field(SearchFields.PARENT_FIELD, parent,
- Field.Store.YES, Field.Index.ANALYZED));
+ serviceDoc.add(new Field(SearchFields.PARENT_FIELD, parent, Field.Store.YES, Field.Index.ANALYZED));
- }
+ }
- for (Reference reference : componentType.getReferences()) {
- Document referenceDoc = documents.get(componentType
- .getURI()
- + ':' + reference.getName());
+ for (Reference reference : componentType.getReferences()) {
+ Document referenceDoc = documents.get(componentType.getURI() + ':' + reference.getName());
- referenceDoc.add(new Field(
- SearchFields.REFERENCE_NAME_FIELD, reference
- .getName(), Field.Store.YES,
- Field.Index.ANALYZED));
+ referenceDoc.add(new Field(SearchFields.REFERENCE_NAME_FIELD, reference.getName(), Field.Store.YES,
+ Field.Index.ANALYZED));
- InterfaceContract interfaceContract = reference
- .getInterfaceContract();
+ InterfaceContract interfaceContract = reference.getInterfaceContract();
- if (interfaceContract != null) {
+ if (interfaceContract != null) {
- for (Operation operation : interfaceContract
- .getInterface().getOperations()) {
+ for (Operation operation : interfaceContract.getInterface().getOperations()) {
- referenceDoc.add(new Field(
- SearchFields.REFERENCE_INTERFACE_FIELD,
- operation.getName(), Field.Store.YES,
- Field.Index.ANALYZED));
+ referenceDoc.add(new Field(SearchFields.REFERENCE_INTERFACE_FIELD, operation.getName(),
+ Field.Store.YES, Field.Index.ANALYZED));
- }
+ }
- for (Operation operation : interfaceContract
- .getCallbackInterface().getOperations()) {
+ for (Operation operation : interfaceContract.getCallbackInterface().getOperations()) {
- referenceDoc
- .add(new Field(
- SearchFields.REFERENCE_INTERFACE_CALLBACK_FIELD,
- operation.getName(),
- Field.Store.YES,
- Field.Index.ANALYZED));
+ referenceDoc.add(new Field(SearchFields.REFERENCE_INTERFACE_CALLBACK_FIELD, operation
+ .getName(), Field.Store.YES, Field.Index.ANALYZED));
- }
+ }
- }
+ }
- referenceDoc.add(new Field(SearchFields.PARENT_FIELD,
- parent, Field.Store.YES, Field.Index.ANALYZED));
+ referenceDoc
+ .add(new Field(SearchFields.PARENT_FIELD, parent, Field.Store.YES, Field.Index.ANALYZED));
- }
+ }
- }
+ }
- for (Property property : componentType.getProperties()) {
- Document propertyDoc = parentProcessor.process(parentProcessor,
- documents, property, null, parent);
+ for (Property property : componentType.getProperties()) {
+ Document propertyDoc = parentProcessor.process(parentProcessor, documents, property, null, parent);
- if (uri != null) {
+ if (uri != null) {
- propertyDoc.add(new Field(SearchFields.PARENT_FIELD,
- parent, Field.Store.YES, Field.Index.ANALYZED));
+ propertyDoc
+ .add(new Field(SearchFields.PARENT_FIELD, parent, Field.Store.YES, Field.Index.ANALYZED));
- }
+ }
- }
+ }
- return doc;
+ return doc;
- }
+ }
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException();
- }
+ }
- public Object getDocumentKey(Object object) {
+ public Object getDocumentKey(Object object) {
- if (object instanceof ComponentType) {
- ComponentType componentType = (ComponentType) object;
- String uri = componentType.getURI();
+ if (object instanceof ComponentType) {
+ ComponentType componentType = (ComponentType)object;
+ String uri = componentType.getURI();
- if (uri == null || uri.length() == 0) {
- return null;
+ if (uri == null || uri.length() == 0) {
+ return null;
- } else {
- return uri;
- }
+ } else {
+ return uri;
+ }
- }
+ }
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException();
- }
+ }
}