Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / derby-10.3.2.1 / java / engine / org / apache / derby / iapi / services / context / ContextImpl.java
diff --git a/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/iapi/services/context/ContextImpl.java b/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/iapi/services/context/ContextImpl.java
new file mode 100644 (file)
index 0000000..29b84fa
--- /dev/null
@@ -0,0 +1,95 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.iapi.services.context.ContextImpl\r
+\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to you under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+      http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.iapi.services.context;\r
+\r
+/**\r
+ * Contexts are created and used to manage the execution\r
+ * environment. They provide a convenient location for\r
+ * storing globals organized by the module using the\r
+ * globals. \r
+ * <p>\r
+ * We provide this abstract class for other implementations\r
+ * to use so that they can simply add fields and operations on\r
+ * them. To be usable by the context manager, the subclasses\r
+ * must define CleanupOnError and call super() in any constructor.\r
+ * <p>\r
+ * Contexts assist in cleanup\r
+ * when errors are caught in the outer block.\r
+ * <p>\r
+ * Contexts implement the sanity interface to check and provide\r
+ * information about their contents.\r
+ */\r
+public abstract class ContextImpl \r
+       implements Context\r
+{\r
+       private final String myIdName;\r
+       private final ContextManager myContextManager;\r
+\r
+       /*\r
+        * class interface\r
+        */\r
+       protected ContextImpl(ContextManager cm, String id) {\r
+               myIdName = id;\r
+               myContextManager = cm;\r
+               cm.pushContext(this);\r
+       }\r
+\r
+       /*\r
+        * Context interface\r
+        */\r
+       /**\r
+        * @see org.apache.derby.iapi.services.context.Context#getContextManager\r
+        */\r
+       final public ContextManager getContextManager()\r
+       {\r
+               return myContextManager;\r
+       }\r
+\r
+       /**\r
+        * @see org.apache.derby.iapi.services.context.Context#getIdName\r
+        */\r
+       final public String getIdName()\r
+       {\r
+               return myIdName;\r
+       }\r
+\r
+       final public void pushMe() {\r
+               getContextManager().pushContext(this);\r
+       }\r
+\r
+       /** @see Context#popMe */\r
+       final public void popMe() {\r
+               getContextManager().popContext(this);\r
+       }\r
+\r
+       /**\r
+        * @see Context#isLastHandler\r
+        */\r
+       public boolean isLastHandler(int severity)\r
+       {\r
+               return false;\r
+       }\r
+\r
+       public StringBuffer appendErrorInfo() {\r
+               return null;\r
+       }\r
+}\r