Author: mattmann
Date: Mon Jul 12 20:23:29 2010
New Revision: 963472
URL: http://svn.apache.org/viewvc?rev=963472&view=rev
Log:
- progress towards OODT-15 One trunk for all OODT components with top level
build
Modified:
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/dictionary/Dictionary.java
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/dictionary/WorkflowManagerDictionary.java
Modified:
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/dictionary/Dictionary.java
URL:
http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/dictionary/Dictionary.java?rev=963472&r1=963471&r2=963472&view=diff
==============================================================================
---
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/dictionary/Dictionary.java
(original)
+++
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/dictionary/Dictionary.java
Mon Jul 12 20:23:29 2010
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
@@ -24,43 +24,45 @@ import org.apache.oodt.cas.catalog.term.
import org.apache.oodt.cas.metadata.Metadata;
/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
+ *
* A Dictionary for create Catalog understandable Terms from Metadata
- * <p>
+ *
*/
public interface Dictionary {
- /**
- * Given a Metadata object a lookup call to a given dictionary will
- * always return the same TermBucket. However, calls to several
- * Dictionary's lookup method may return different TermBuckets for
- * a given Metadata object.
- * @param metadata The Metadata for which a TermBucket will be created
- * @return TermBucket representing the given Metadata for this
Dictionary or
- * null if Metadata is not recognized by this Dictionary
- */
- public TermBucket lookup(Metadata metadata) throws
CatalogDictionaryException;
-
- /**
- * Generates Metadata for the given TermBucket. A call to
lookup(Metadata) and
- * then reverseLookup(TermBucket) may not give you back the original
Metadata
- * because lookup may ignore key/values in Metadata for which it does
not
- * understand.
- * @param termBucket The TermBucket for which Metadata will be created
- * @return Metadata for the given TermBucket. If the TermBucket is not
understood,
- * then an empty Metadata object should be returned.
- */
- public Metadata reverseLookup(TermBucket termBucket) throws
CatalogDictionaryException;
-
- /**
- *
- * @param queryExpression
- * @return
- * @throws CatalogDictionaryException
- */
- public boolean understands(QueryExpression queryExpression) throws
CatalogDictionaryException;
-
+ /**
+ * Given a Metadata object a lookup call to a given dictionary will always
+ * return the same TermBucket. However, calls to several Dictionary's lookup
+ * method may return different TermBuckets for a given Metadata object.
+ *
+ * @param metadata
+ * The Metadata for which a TermBucket will be created
+ * @return TermBucket representing the given Metadata for this Dictionary or
+ * null if Metadata is not recognized by this Dictionary
+ */
+ public TermBucket lookup(Metadata metadata) throws
CatalogDictionaryException;
+
+ /**
+ * Generates Metadata for the given TermBucket. A call to lookup(Metadata)
and
+ * then reverseLookup(TermBucket) may not give you back the original Metadata
+ * because lookup may ignore key/values in Metadata for which it does not
+ * understand.
+ *
+ * @param termBucket
+ * The TermBucket for which Metadata will be created
+ * @return Metadata for the given TermBucket. If the TermBucket is not
+ * understood, then an empty Metadata object should be returned.
+ */
+ public Metadata reverseLookup(TermBucket termBucket)
+ throws CatalogDictionaryException;
+
+ /**
+ *
+ * @param queryExpression
+ * @return
+ * @throws CatalogDictionaryException
+ */
+ public boolean understands(QueryExpression queryExpression)
+ throws CatalogDictionaryException;
+
}
Modified:
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/dictionary/WorkflowManagerDictionary.java
URL:
http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/dictionary/WorkflowManagerDictionary.java?rev=963472&r1=963471&r2=963472&view=diff
==============================================================================
---
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/dictionary/WorkflowManagerDictionary.java
(original)
+++
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/dictionary/WorkflowManagerDictionary.java
Mon Jul 12 20:23:29 2010
@@ -1,4 +1,4 @@
-/*
+/**
* 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.
@@ -17,8 +17,10 @@
package org.apache.oodt.cas.catalog.struct.impl.dictionary;
+//JDK imports
import java.util.Set;
+//OODT imports
import org.apache.oodt.cas.catalog.exception.CatalogDictionaryException;
import org.apache.oodt.cas.catalog.query.ComparisonQueryExpression;
import org.apache.oodt.cas.catalog.query.NotQueryExpression;
@@ -31,43 +33,49 @@ import org.apache.oodt.cas.catalog.term.
import org.apache.oodt.cas.catalog.term.TermBucket;
import org.apache.oodt.cas.metadata.Metadata;
+/**
+ *
+ * Describe your class here.
+ *
+ */
public class WorkflowManagerDictionary implements Dictionary {
- public TermBucket lookup(Metadata metadata)
- throws CatalogDictionaryException {
- if (metadata.getMetadata("ProductType") != null &&
metadata.getAllMetadata("ProductType").contains("Workflows")) {
- TermBucket workflowBucket = new TermBucket("Workflows");
- for (Object key : metadata.getHashtable().keySet())
- workflowBucket.addTerm(new Term((String) key,
metadata.getAllMetadata((String) key)));
- return workflowBucket;
- }else {
- return null;
- }
- }
-
- public Metadata reverseLookup(TermBucket termBucket)
- throws CatalogDictionaryException {
- Metadata metadata = new Metadata();
- if (termBucket.getName().equals("Workflows")) {
- for (Term term : termBucket.getTerms())
- metadata.addMetadata(term.getName(),
term.getValues());
- }
- return metadata;
- }
-
- public boolean understands(QueryExpression queryExpression)
- throws CatalogDictionaryException {
- Set<String> bucketNames = queryExpression.getBucketNames();
- if (bucketNames == null || bucketNames.contains("Workflows")) {
- if (queryExpression instanceof NotQueryExpression
- || queryExpression instanceof
ComparisonQueryExpression
- || queryExpression instanceof
StdQueryExpression
- || queryExpression instanceof
QueryLogicalGroup) {
- return true;
- } else
- return false;
- }
- return false;
- }
+ public TermBucket lookup(Metadata metadata) throws
CatalogDictionaryException {
+ if (metadata.getMetadata("ProductType") != null
+ && metadata.getAllMetadata("ProductType").contains("Workflows")) {
+ TermBucket workflowBucket = new TermBucket("Workflows");
+ for (Object key : metadata.getHashtable().keySet())
+ workflowBucket.addTerm(new Term((String) key, metadata
+ .getAllMetadata((String) key)));
+ return workflowBucket;
+ } else {
+ return null;
+ }
+ }
+
+ public Metadata reverseLookup(TermBucket termBucket)
+ throws CatalogDictionaryException {
+ Metadata metadata = new Metadata();
+ if (termBucket.getName().equals("Workflows")) {
+ for (Term term : termBucket.getTerms())
+ metadata.addMetadata(term.getName(), term.getValues());
+ }
+ return metadata;
+ }
+
+ public boolean understands(QueryExpression queryExpression)
+ throws CatalogDictionaryException {
+ Set<String> bucketNames = queryExpression.getBucketNames();
+ if (bucketNames == null || bucketNames.contains("Workflows")) {
+ if (queryExpression instanceof NotQueryExpression
+ || queryExpression instanceof ComparisonQueryExpression
+ || queryExpression instanceof StdQueryExpression
+ || queryExpression instanceof QueryLogicalGroup) {
+ return true;
+ } else
+ return false;
+ }
+ return false;
+ }
}