Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / MyDerby-10.3 / java / engine / org / apache / derby / iapi / services / diag / Diagnosticable.java
diff --git a/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/iapi/services/diag/Diagnosticable.java b/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/iapi/services/diag/Diagnosticable.java
new file mode 100644 (file)
index 0000000..48333ed
--- /dev/null
@@ -0,0 +1,92 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.iapi.services.diag.Diagnosticable\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.diag;\r
+\r
+import org.apache.derby.iapi.error.StandardException;\r
+\r
+import java.util.Properties;\r
+\r
+/**\r
+\r
+  The Diagnosticable class implements the Diagnostics protocol, and can\r
+  be used as the parent class for all other Diagnosticable objects.\r
+\r
+**/\r
+\r
+public interface Diagnosticable\r
+{\r
+       /*\r
+       ** Methods of Diagnosticable\r
+       */\r
+    public void init(Object obj);\r
+\r
+    /**\r
+     * Default implementation of diagnostic on the object.\r
+     * <p>\r
+     * This routine returns a string with whatever diagnostic information\r
+     * you would like to provide about this associated object passed in\r
+     * the init() call.\r
+     * <p>\r
+     * This routine should be overriden by a real implementation of the\r
+     * diagnostic information you would like to provide.\r
+     * <p>\r
+     *\r
+        * @return A string with diagnostic information about the object.\r
+     *\r
+     * @exception StandardException  Standard Derby exception policy\r
+     **/\r
+    public String diag() throws StandardException;\r
+\r
+    /**\r
+     * Default implementation of detail diagnostic on the object.\r
+     * <p>\r
+     * This interface provides a way for an object to pass back pieces of\r
+     * information as requested by the caller.  The information is passed\r
+     * back and forth through the properties argument.  It is expected that\r
+     * the caller knows what kind of information to ask for, and correctly\r
+     * handles the situation when the diagnostic object can't provide the\r
+     * information.\r
+     * <p>\r
+     * As an example assume an object TABLE exists, and that we have created\r
+     * an object D_TABLE that knows how to return the number of pages in the\r
+     * TABLE object.  The code to get that information out would looks something\r
+     * like the following:\r
+     * <p>\r
+     * print_num_pages(Object table)\r
+     * {\r
+     *     Properties prop = new Properties();\r
+     *     prop.put(Page.DIAG_NUM_PAGES,        "");\r
+     *\r
+     *     DiagnosticUtil.findDiagnostic(table).diag_detail(prop);\r
+     *\r
+     *     System.out.println(\r
+     *        "number of pages = " + prop.getProperty(Page.DIAG_NUM_PAGES));\r
+     * }\r
+     * <p>\r
+     * This routine should be overriden if there is detail diagnostics to\r
+     * be provided by a real implementation.\r
+     * <p>\r
+     *\r
+     * @exception StandardException  Standard Derby exception policy\r
+     **/\r
+    public void diag_detail(Properties prop) throws StandardException;\r
+}\r