DBVIEW
|
00001 /* 00002 DbView - Graph Visualization 00003 Copyright (C) 2012 Denis BEURIVE 00004 00005 This program is free software: you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation, either version 3 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 /** 00020 * @author Denis Beurive 00021 */ 00022 00023 package org.dbview.output_addons; 00024 00025 import java.util.ArrayList; 00026 import java.util.regex.Pattern; 00027 00028 /** 00029 * This class loads all the resources that contain output adapters' implementations and creates a catalog of available add-ons. 00030 * @remark Right now, there is only one <i>resource</i> that contains input adaptors. This is a JAR file, create by the ANT script. 00031 * @author Denis BEURIVE 00032 */ 00033 public class OutputCatalog extends org.dbview.addons.AddOnCatalog 00034 { 00035 /** 00036 * Name of the <i>property</i> that references the JAR file that contains all the adaptors to list. 00037 * @remark This property is defined in the configuration file of the software. 00038 * The software's configuration file is a "property file" (see file "resources.properties"). 00039 */ 00040 private static final String ADAPTOR_RESOURCE_NAME = "outputTableAddons"; // __CONFPROP__ 00041 00042 /** 00043 * Regular expression that is used to recognize an adaptor, for an add-on specialized in the rendering of tables. 00044 * @remark There is a relation between the following line and the ANT script (build.xml) 00045 * <code><property name="dir.pkg.output.table.addons" value="org/dbview/addons/output/table"/></code> 00046 * <p>example: <code>toto.titi.tata.addons.output_type.addon_name.adaptor_name.class</code></p> 00047 * The important point is: "addons.output.<type of the output>.<name of the add-on>.<name of the adaptor>.class". 00048 * @warning Make sure that the regular expression has 3 pairs of brackets. 00049 * <ul> 00050 * <li>First pair of bracket: the full name of the package that represents the add-on.</li> 00051 * <li>Second pair: the name of the add-on.</li> 00052 * <li>Third pair: The name of the adaptor.</li> 00053 * </ul> 00054 */ 00055 private static final Pattern ADD_ON_PATTERN = Pattern.compile("^(.+\\.addons\\.output\\.[^\\.]+\\.([^\\.]+))\\.([^\\.]+)\\.class$"); // __BUILD_CONF__ 00056 00057 /** 00058 * This array contains the expected list of adaptors' names. 00059 * @remark If you plan to add a new adapter, then you must declare the new adaptor in the list below. 00060 */ 00061 private static final ArrayList<String> ADAPTORS = new ArrayList<String>() {{ add("Cli"); add("Description"); add("Exporter"); }}; 00062 00063 /** 00064 * Constructor. 00065 * @throws Exception 00066 */ 00067 public OutputCatalog() throws Exception 00068 { 00069 super(OutputCatalog.ADAPTOR_RESOURCE_NAME, OutputCatalog.ADAPTORS, OutputCatalog.ADD_ON_PATTERN); 00070 } 00071 }