merged asterix_stabilization r620:1109

git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization_temporal_functionality@1113 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-common/pom.xml b/asterix-common/pom.xml
index facca1c..048c037 100644
--- a/asterix-common/pom.xml
+++ b/asterix-common/pom.xml
@@ -26,12 +26,12 @@
 		<dependency>
 			<groupId>edu.uci.ics.hyracks</groupId>
 			<artifactId>hyracks-algebricks-compiler</artifactId>
-			<version>0.2.1-SNAPSHOT</version>
+			<version>0.2.2-SNAPSHOT</version>
 		</dependency>
 		<dependency>
 			<groupId>edu.uci.ics.hyracks</groupId>
 			<artifactId>hyracks-dataflow-std</artifactId>
-			<version>0.2.1-SNAPSHOT</version>
+			<version>0.2.2-SNAPSHOT</version>
 		</dependency>
 		<dependency>
 			<groupId>edu.uci.ics.asterix</groupId>
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/annotations/RecordDataGenAnnotation.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/annotations/RecordDataGenAnnotation.java
index 8214b39..6b7a96b 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/annotations/RecordDataGenAnnotation.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/annotations/RecordDataGenAnnotation.java
@@ -1,6 +1,8 @@
 package edu.uci.ics.asterix.common.annotations;
 
-public class RecordDataGenAnnotation implements IRecordTypeAnnotation {
+import java.io.Serializable;
+
+public class RecordDataGenAnnotation implements IRecordTypeAnnotation, Serializable {
 
     private final IRecordFieldDataGen[] declaredFieldsDatagen;
     private final UndeclaredFieldsDataGen undeclaredFieldsDataGen;
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixAppContextInfoImpl.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixAppContextInfoImpl.java
index 144a8824..00a2651 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixAppContextInfoImpl.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixAppContextInfoImpl.java
@@ -1,22 +1,50 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ *     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 edu.uci.ics.asterix.common.api;
 
-import java.util.Map;
-import java.util.Set;
-
 import edu.uci.ics.asterix.common.context.AsterixIndexRegistryProvider;
 import edu.uci.ics.asterix.common.context.AsterixStorageManagerInterface;
 import edu.uci.ics.asterix.common.dataflow.IAsterixApplicationContextInfo;
+import edu.uci.ics.hyracks.api.application.ICCApplicationContext;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.IIndex;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.IIndexRegistryProvider;
 import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
 
+/*
+ * Acts as an holder class for IndexRegistryProvider, AsterixStorageManager
+ * instances that are accessed from the NCs. In addition an instance of ICCApplicationContext 
+ * is stored for access by the CC.
+ */
 public class AsterixAppContextInfoImpl implements IAsterixApplicationContextInfo {
 
-    public static final AsterixAppContextInfoImpl INSTANCE = new AsterixAppContextInfoImpl();
+    private static AsterixAppContextInfoImpl INSTANCE;
 
-    private static Map<String, Set<String>> nodeControllerMap;
+    private final ICCApplicationContext appCtx;
 
-    private AsterixAppContextInfoImpl() {
+    public static void initialize(ICCApplicationContext ccAppCtx) {
+        if (INSTANCE == null) {
+            INSTANCE = new AsterixAppContextInfoImpl(ccAppCtx);
+        }
+    }
+
+    private AsterixAppContextInfoImpl(ICCApplicationContext ccAppCtx) {
+        this.appCtx = ccAppCtx;
+    }
+
+    public static IAsterixApplicationContextInfo getInstance() {
+        return INSTANCE;
     }
 
     @Override
@@ -29,12 +57,9 @@
         return AsterixStorageManagerInterface.INSTANCE;
     }
 
-    public static void setNodeControllerInfo(Map<String, Set<String>> nodeControllerInfo) {
-        nodeControllerMap = nodeControllerInfo;
-    }
-
-    public static Map<String, Set<String>> getNodeControllerMap() {
-        return nodeControllerMap;
+    @Override
+    public ICCApplicationContext getCCApplicationContext() {
+        return appCtx;
     }
 
 }
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/OptimizationConfUtil.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/OptimizationConfUtil.java
index 0a125b4..271f216 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/OptimizationConfUtil.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/OptimizationConfUtil.java
@@ -1,6 +1,6 @@
 package edu.uci.ics.asterix.common.config;
 
-import edu.uci.ics.hyracks.algebricks.core.rewriter.base.PhysicalOptimizationConfig; 
+import edu.uci.ics.hyracks.algebricks.core.rewriter.base.PhysicalOptimizationConfig;
 
 public class OptimizationConfUtil {
 
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/dataflow/IAsterixApplicationContextInfo.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/dataflow/IAsterixApplicationContextInfo.java
index 7bb0fd6..032e832 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/dataflow/IAsterixApplicationContextInfo.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/dataflow/IAsterixApplicationContextInfo.java
@@ -1,11 +1,48 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ *     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 edu.uci.ics.asterix.common.dataflow;
 
+import edu.uci.ics.hyracks.api.application.ICCApplicationContext;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.IIndex;
 import edu.uci.ics.hyracks.storage.am.common.dataflow.IIndexRegistryProvider;
 import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
 
+/**
+ * Provides methods for obtaining the IIndexRegistryProvider, IStorageManager and
+ * ICCApplicationContext implementation.
+ */
 public interface IAsterixApplicationContextInfo {
+
+    /**
+     * Returns an instance of the implementation for IIndexRegistryProvider.
+     * 
+     * @return IIndexRegistryProvider implementation instance
+     */
     public IIndexRegistryProvider<IIndex> getIndexRegistryProvider();
 
+    /**
+     * Returns an instance of the implementation for IStorageManagerInterface.
+     * 
+     * @return IStorageManagerInterface implementation instance
+     */
     public IStorageManagerInterface getStorageManagerInterface();
+
+    /**
+     * Returns an instance of the implementation for ICCApplicationContext.
+     * 
+     * @return ICCApplicationContext implementation instance
+     */
+    public ICCApplicationContext getCCApplicationContext();
 }
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/functions/FunctionSignature.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/functions/FunctionSignature.java
new file mode 100644
index 0000000..188593c
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/functions/FunctionSignature.java
@@ -0,0 +1,53 @@
+package edu.uci.ics.asterix.common.functions;
+
+import java.io.Serializable;
+
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+
+public class FunctionSignature implements Serializable {
+    private final String namespace;
+    private final String name;
+    private final int arity;
+    private final String rep;
+
+    public FunctionSignature(String namespace, String name, int arity) {
+        this.namespace = namespace;
+        this.name = name;
+        this.arity = arity;
+        rep = namespace + "." + name + "@" + arity;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (!(o instanceof FunctionSignature)) {
+            return false;
+        } else {
+            FunctionSignature f = ((FunctionSignature) o);
+            return ((namespace != null && namespace.equals(f.getNamespace()) || (namespace == null && f.getNamespace() == null)))
+                    && name.equals(f.getName())
+                    && (arity == f.getArity() || arity == FunctionIdentifier.VARARGS || f.getArity() == FunctionIdentifier.VARARGS);
+        }
+    }
+
+    public String toString() {
+        return rep;
+    }
+
+    @Override
+    public int hashCode() {
+        return (namespace + "." + name).hashCode();
+    }
+
+    public String getNamespace() {
+        return namespace;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public int getArity() {
+        return arity;
+    }
+
+}