Coverage Report - fr.paris.lutece.plugins.adminsql.business.TableDAO
 
Classes in this File Line Coverage Branch Coverage Complexity
TableDAO
0 %
1/165
0 %
0/30
1,882
 
 1  
 /*
 2  
  * Copyright (c) 2002-2017, Mairie de Paris
 3  
  * All rights reserved.
 4  
  *
 5  
  * Redistribution and use in source and binary forms, with or without
 6  
  * modification, are permitted provided that the following conditions
 7  
  * are met:
 8  
  *
 9  
  *  1. Redistributions of source code must retain the above copyright notice
 10  
  *     and the following disclaimer.
 11  
  *
 12  
  *  2. Redistributions in binary form must reproduce the above copyright notice
 13  
  *     and the following disclaimer in the documentation and/or other materials
 14  
  *     provided with the distribution.
 15  
  *
 16  
  *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
 17  
  *     contributors may be used to endorse or promote products derived from
 18  
  *     this software without specific prior written permission.
 19  
  *
 20  
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 21  
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 22  
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 23  
  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
 24  
  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 25  
  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 26  
  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 27  
  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 28  
  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 29  
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 30  
  * POSSIBILITY OF SUCH DAMAGE.
 31  
  *
 32  
  * License 1.0
 33  
  */
 34  
 package fr.paris.lutece.plugins.adminsql.business;
 35  
 
 36  
 import fr.paris.lutece.plugins.adminsql.service.AdminSqlConnectionService;
 37  
 import fr.paris.lutece.portal.service.database.PluginConnectionService;
 38  
 import fr.paris.lutece.portal.service.plugin.Plugin;
 39  
 import fr.paris.lutece.portal.service.plugin.PluginService;
 40  
 import fr.paris.lutece.util.ReferenceItem;
 41  
 import fr.paris.lutece.util.ReferenceList;
 42  
 import fr.paris.lutece.util.sql.DAOUtil;
 43  
 
 44  
 
 45  
 import java.util.ArrayList;
 46  
 import java.util.List;
 47  
 
 48  
 
 49  
 /**
 50  
  * Creates a new instance of TableDAO
 51  
  */
 52  1
 public class TableDAO implements ITableDAO
 53  
 {
 54  
     //Constantes
 55  
     private static final String NULL_VALUE = "NULL";
 56  
     private static final String NOT = "NOT ";
 57  
     private static final String CHANGE = "CHANGE";
 58  
     private static final String ADD = " ADD ";
 59  
     private static final String PRIMARY_KEY = "PRIMARY KEY";
 60  
     private static final String FOREIGN_KEY = "FOREIGN";
 61  
     private static final String INDEX_KEY = "INDEX";
 62  
     private static final String UNIQUE_KEY = "UNIQUE";
 63  
     private static final String DROP = " DROP ";
 64  
     private static final String RENAME_TO = " RENAME TO ";
 65  
     private static final String WHERE = " WHERE ";
 66  
     private static final String SPACE = " ";
 67  
     private static final String USER = "-u";
 68  
     private static final String PASSWORD = "-p";
 69  
 
 70  
     //RequĂȘtes
 71  
     private static final String SQL_QUERY_SELECTALL_FIELD_TYPE = " SELECT id_field_type, label_field_type FROM adminsql_field_type";
 72  
     private static final String SQL_QUERY_SELECTALL_FIELD_KEY = "SELECT id_field_key, label_field_key FROM adminsql_field_key";
 73  
     private static final String SQL_QUERY_SELECTALL_FIELD_NULL = "SELECT id_field_null, label_field_null FROM adminsql_field_null";
 74  
     private static final String SQL_QUERY_FIND_FIELD_TYPE_ID = " SELECT id_field_type FROM adminsql_field_type WHERE label_field_type= ?";
 75  
     private static final String SQL_QUERY_FIND_FIELD_TYPE_LABEL_BY_ID = " SELECT label_field_type FROM adminsql_field_type WHERE id_field_type= ?";
 76  
     private static final String SQL_QUERY_FIND_FIELD_NULL_ID = " SELECT id_field_null FROM adminsql_field_null WHERE label_field_null= ?";
 77  
     private static final String SQL_QUERY_FIND_FIELD_NULL_LABEL_BY_ID = " SELECT label_field_null FROM adminsql_field_null WHERE id_field_null= ?";
 78  
     private static final String SQL_QUERY_FIND_FIELD_KEY_ID = " SELECT id_field_key FROM adminsql_field_key WHERE label_field_key= ?";
 79  
     private static final String SQL_QUERY_FIND_FIELD_KEY_LABEL_BY_ID = " SELECT label_field_key FROM adminsql_field_key WHERE id_field_key= ?";
 80  
     private static final String SQL_QUERY_SELECT = "SELECT ";
 81  
     private static final String SQL_QUERY_SHOW_DATABASE_TABLES = "SHOW TABLES ";
 82  
     private static final String SQL_QUERY_SHOW_DATABASE_TABLES_BY_POOL = "SHOW TABLES FROM ";
 83  
     private static final String SQL_QUERY_SELECT_A_TABLE_ON_DATABASE = "SELECT TABLE_NAME, COLUMN_NAME, COLUMN_KEY FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = ? "; //and column_key = 'PRI' ";
 84  
     private static final String SQL_QUERY_CREATE_TABLE = " CREATE TABLE ";
 85  
     private static final String SQL_QUERY_DELETE_TABLE = " DROP TABLE ";
 86  
     private static final String SQL_QUERY_MODIFY_TABLE_NAME = " ALTER TABLE ";
 87  
         private static final String SQL_QUERY_SELECT_A_TABLE_ON_DATABASE_1 = "DESC ";
 88  
 
 89  
     /**
 90  
      * Load a table from a database
 91  
      * @param strPoolName the name of the pool
 92  
      * @param strTableName the name of the table
 93  
      * @param plugin Plugin adminsql
 94  
      * @return the table objet
 95  
      */
 96  
     public Table load( String strPoolName, String strTableName, Plugin plugin )
 97  
     {
 98  0
         Table table = new Table(  );
 99  0
         DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECT_A_TABLE_ON_DATABASE_1 + strTableName, plugin );
 100  0
         daoUtil.executeQuery(  );
 101  
 
 102  0
         if ( daoUtil.next(  ) )
 103  
         {
 104  0
             table.setTableName( strTableName );
 105  0
             table.setFieldName( daoUtil.getString( 2 ) );
 106  0
             table.setFieldNull( daoUtil.getString( 3 ) );
 107  0
             table.setPrimaryKey( daoUtil.getString( 4 ) );
 108  
         }
 109  
 
 110  0
         daoUtil.free(  );
 111  
 
 112  0
          return table;
 113  
     }
 114  
 
 115  
     /**
 116  
      * Insert a table into a database
 117  
      * @param strPoolName the name of the pool
 118  
      * @param table the name of the table
 119  
      * @param field the name of the field
 120  
      * @param plugin Plugin adminsql
 121  
      */
 122  
     public void insert( String strPoolName, Table table, Field field, Plugin plugin )
 123  
     {
 124  
         //
 125  0
         String strFieldName = field.getFieldName(  );
 126  0
         field.setLabelTypeValue( findFieldTypeLabelbyId( field.getIdTypeValue(  ), plugin, strPoolName ) );
 127  
 
 128  0
         String strLabelType = field.getLabelTypeValue(  );
 129  0
         String strFieldLabelType = strLabelType + "(" + field.getLengthTypeValue(  ) + ")";
 130  0
         field.setLabelNullValue( findFieldNullLabelbyId( field.getIdNullValue(  ), plugin, strPoolName ) );
 131  
 
 132  0
         String strLabelNullValue = field.getLabelNullValue(  );
 133  0
         String strFieldLabelNullValue = "";
 134  
 
 135  0
         if ( strLabelNullValue.equals( "YES" ) )
 136  
         {
 137  0
             strFieldLabelNullValue = NULL_VALUE;
 138  
         }
 139  
         else
 140  
         {
 141  0
             strFieldLabelNullValue = NOT + NULL_VALUE;
 142  
         }
 143  
 
 144  0
         int nIdKeyValue = field.getIdKeyValue(  );
 145  0
         field.setLabelKeyValue( findFieldKeyLabelbyId( nIdKeyValue, plugin, strPoolName ) );
 146  
 
 147  0
         String strFieldLabelKeyValue = field.getLabelKeyValue(  );
 148  
         String strKey;
 149  
 
 150  0
         if ( nIdKeyValue == 1 )
 151  
         {
 152  0
             strKey = "";
 153  
         }
 154  
         else
 155  
         {
 156  0
             strKey = PRIMARY_KEY;
 157  
         }
 158  
 
 159  0
         String strFieldLabelDefaultValue = field.getDefaultValue(  );
 160  0
         String strDEFAULT = "";
 161  
 
 162  0
         if ( strFieldLabelDefaultValue.equals( "" ) )
 163  
         {
 164  0
             strDEFAULT = "";
 165  
         }
 166  
         else
 167  
         {
 168  0
             strDEFAULT = "DEFAULT";
 169  0
             strFieldLabelDefaultValue = " '" + strFieldLabelDefaultValue + "' ";
 170  
         }
 171  0
                  String strTableName = table.getTableName(  );
 172  0
 System.out.println(SQL_QUERY_CREATE_TABLE + strTableName + "(" + strFieldName + " " +
 173  
                 strFieldLabelType + " " + strKey + " " + strFieldLabelNullValue + " " + strDEFAULT +
 174  
                 strFieldLabelDefaultValue + ")");
 175  
        
 176  0
         DAOUtil daoUtil = new DAOUtil( SQL_QUERY_CREATE_TABLE + strTableName + "(" + strFieldName + " " +
 177  
                 strFieldLabelType + " " + strKey + " " + strFieldLabelNullValue + " " + strDEFAULT +
 178  
                 strFieldLabelDefaultValue + ")", plugin );
 179  
 
 180  0
         daoUtil.executeUpdate(  );
 181  0
         daoUtil.free(  );
 182  0
     }
 183  
 
 184  
     /**
 185  
      * Store a table into a database
 186  
      * @param strTableNameToModify the name of the table to modify
 187  
      * @param table Table object
 188  
      */
 189  
     public void store( String strTableNameToModify, Table table )
 190  
     {
 191  0
         String strTableName = table.getTableName(  );
 192  0
         DAOUtil daoUtil = new DAOUtil( SQL_QUERY_MODIFY_TABLE_NAME + strTableName + RENAME_TO + strTableNameToModify );
 193  0
         daoUtil.executeUpdate(  );
 194  0
         daoUtil.free(  );
 195  0
     }
 196  
 
 197  
     /**
 198  
      * Delete a table from a database
 199  
      * @param strTableName the name of the table
 200  
      * @param plugin Plugin adminsql
 201  
      */
 202  
     public void delete( String strTableName, Plugin plugin )
 203  
     {
 204  0
         DAOUtil daoUtil = new DAOUtil( SQL_QUERY_DELETE_TABLE + strTableName, plugin );
 205  0
         daoUtil.executeUpdate(  );
 206  0
         daoUtil.free(  );
 207  0
     }
 208  
 
 209  
     /**
 210  
      * Find the list of the tables on a database
 211  
      * @param plugin Plugin adminsql
 212  
      * @return the list of the tables on a database
 213  
      */
 214  
     public List<Table> selectTableList( Plugin plugin )
 215  
     {
 216  0
         List<Table> tableList = new ArrayList<Table>(  );
 217  0
         DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SHOW_DATABASE_TABLES, plugin );
 218  0
         daoUtil.executeQuery(  );
 219  
 
 220  0
         while ( daoUtil.next(  ) )
 221  
         {
 222  0
             Table table = new Table(  );
 223  0
             table.setTableName( daoUtil.getString( 1 ) );
 224  0
             tableList.add( table );
 225  0
         }
 226  
 
 227  0
         daoUtil.free(  );
 228  
 
 229  0
         return tableList;
 230  
     }
 231  
 
 232  
     /**
 233  
      * Find the list of the tables on a database
 234  
      * @param strPoolName the name of the pool
 235  
      * @param plugin Plugin adminsql
 236  
      * @return the list of the tables on a database
 237  
      */
 238  
     public List<Table> selectTableListByPool( String strPoolName, Plugin plugin )
 239  
     {
 240  0
         plugin.setConnectionService( AdminSqlConnectionService.getInstance(  ).getConnectionService( strPoolName ) );
 241  
 
 242  0
         List<Table> tableList = new ArrayList<Table>(  );
 243  0
         DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SHOW_DATABASE_TABLES, plugin );
 244  0
         daoUtil.executeQuery(  );
 245  
 
 246  0
         while ( daoUtil.next(  ) )
 247  
         {
 248  0
             Table table = new Table(  );
 249  0
             table.setTableName( daoUtil.getString( 1 ) );
 250  0
             tableList.add( table );
 251  0
         }
 252  
 
 253  0
         daoUtil.free(  );
 254  
 
 255  0
         return tableList;
 256  
     }
 257  
 
 258  
     /**
 259  
      * lists the field list possiblilities to create or modify fields form
 260  
      * @return Field list
 261  
      * @param plugin plugin adminsql
 262  
      */
 263  
     public ReferenceList selectFieldTypeList( Plugin plugin )
 264  
     {
 265  0
         ReferenceList fieldtypeList = new ReferenceList(  );
 266  0
         DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECTALL_FIELD_TYPE, plugin );
 267  
 
 268  0
         daoUtil.executeQuery(  );
 269  
 
 270  0
         while ( daoUtil.next(  ) )
 271  
         {
 272  0
             ReferenceItem item = new ReferenceItem(  );
 273  0
             item.setCode( daoUtil.getString( 1 ) );
 274  0
             item.setName( daoUtil.getString( 2 ) );
 275  0
             fieldtypeList.add( item );
 276  0
         }
 277  
 
 278  0
         daoUtil.free(  );
 279  
 
 280  0
         return fieldtypeList;
 281  
     }
 282  
 
 283  
     /**
 284  
      * lists the field list possiblilities to create or modify fields form
 285  
      *
 286  
      * @return the keys choice adminsql database
 287  
      * @param plugin Plugin adminsql
 288  
      */
 289  
     public ReferenceList selectFieldKeyList( Plugin plugin )
 290  
     {
 291  0
         ReferenceList fieldkeyList = new ReferenceList(  );
 292  0
         DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECTALL_FIELD_KEY, plugin );
 293  
 
 294  0
         daoUtil.executeQuery(  );
 295  
 
 296  0
         while ( daoUtil.next(  ) )
 297  
         {
 298  0
             ReferenceItem item = new ReferenceItem(  );
 299  0
             item.setCode( daoUtil.getString( 1 ) );
 300  0
             item.setName( daoUtil.getString( 2 ) );
 301  0
             fieldkeyList.add( item );
 302  0
         }
 303  
 
 304  0
         daoUtil.free(  );
 305  
 
 306  0
         return fieldkeyList;
 307  
     }
 308  
 
 309  
     /**
 310  
      * lists the field list possiblilities to create or modify fields form
 311  
      *
 312  
      * @return the null value choice adminsql database
 313  
      * @param plugin Plugin adminsql
 314  
      */
 315  
     public ReferenceList selectFieldNullList( Plugin plugin )
 316  
     {
 317  0
         ReferenceList fieldnullList = new ReferenceList(  );
 318  0
         DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECTALL_FIELD_NULL, plugin );
 319  
 
 320  0
         daoUtil.executeQuery(  );
 321  
 
 322  0
         while ( daoUtil.next(  ) )
 323  
         {
 324  0
             ReferenceItem item = new ReferenceItem(  );
 325  0
             item.setCode( daoUtil.getString( 1 ) );
 326  0
             item.setName( daoUtil.getString( 2 ) );
 327  0
             fieldnullList.add( item );
 328  0
         }
 329  
 
 330  0
         daoUtil.free(  );
 331  
 
 332  0
         return fieldnullList;
 333  
     }
 334  
 
 335  
     /**
 336  
      * Find the field id type by label type from adminsql database
 337  
      * @param strLabelType the name of the type that user choose
 338  
      * @param plugin Plugin adminsql
 339  
      * @param strPoolName the name of the pool
 340  
      * @return id type from label type
 341  
      */
 342  
     public int findFieldTypeIdbyLabel( String strLabelType, Plugin plugin, String strPoolName )
 343  
     {
 344  0
         DAOUtil daoUtil = new DAOUtil( SQL_QUERY_FIND_FIELD_TYPE_ID, getDefaultPool( plugin ) );
 345  0
         daoUtil.setString( 1, strLabelType );
 346  0
         daoUtil.executeQuery(  );
 347  
 
 348  0
         int nIdFieldType = 0;
 349  
 
 350  0
         if ( daoUtil.next(  ) )
 351  
         {
 352  0
             nIdFieldType = daoUtil.getInt( 1 );
 353  
         }
 354  
 
 355  0
         daoUtil.free(  );
 356  0
         plugin = changePool( strPoolName );
 357  
 
 358  0
         return nIdFieldType;
 359  
     }
 360  
 
 361  
     /**
 362  
      * Find the field label type by id type from adminsql database
 363  
      * @param nId the id of type label
 364  
      * @param plugin Plugin adminsql
 365  
      * @param strPoolName name of the pool
 366  
      * @return the label of the type by id
 367  
      */
 368  
     public String findFieldTypeLabelbyId( int nId, Plugin plugin, String strPoolName )
 369  
     {
 370  0
         DAOUtil daoUtil = new DAOUtil( SQL_QUERY_FIND_FIELD_TYPE_LABEL_BY_ID, getDefaultPool( plugin ) );
 371  0
         daoUtil.setInt( 1, nId );
 372  0
         daoUtil.executeQuery(  );
 373  
 
 374  0
         String strFieldTypeLabel = "";
 375  
 
 376  0
         if ( daoUtil.next(  ) )
 377  
         {
 378  0
             strFieldTypeLabel = daoUtil.getString( 1 );
 379  
         }
 380  
 
 381  0
         daoUtil.free(  );
 382  0
         plugin = changePool( strPoolName );
 383  
 
 384  0
         return strFieldTypeLabel;
 385  
     }
 386  
 
 387  
     /**
 388  
      * Find the field id null by label null from adminsql database
 389  
      * @param strLabelNull the label of the null value
 390  
      * @param plugin Plugin adminsql
 391  
      * @param strPoolName the name of the pool
 392  
      * @return id null from null type
 393  
      */
 394  
     public int findFieldNullIdbyLabel( String strLabelNull, Plugin plugin, String strPoolName )
 395  
     {
 396  0
         DAOUtil daoUtil = new DAOUtil( SQL_QUERY_FIND_FIELD_NULL_ID, getDefaultPool( plugin ) );
 397  0
         daoUtil.setString( 1, strLabelNull );
 398  0
         daoUtil.executeQuery(  );
 399  
 
 400  0
         int nIdFieldNull = 0;
 401  
 
 402  0
         if ( daoUtil.next(  ) )
 403  
         {
 404  0
             nIdFieldNull = daoUtil.getInt( 1 );
 405  
         }
 406  
 
 407  0
         daoUtil.free(  );
 408  0
         plugin = changePool( strPoolName );
 409  
 
 410  0
         return nIdFieldNull;
 411  
     }
 412  
 
 413  
     /**
 414  
      * Find the field id null by label null from adminsql database
 415  
      * @param nId the id of the null value
 416  
      * @param plugin Plugin adminsql
 417  
      * @param strPoolName the name of the pool
 418  
      * @return the label of null value by id
 419  
      */
 420  
     public String findFieldNullLabelbyId( int nId, Plugin plugin, String strPoolName )
 421  
     {
 422  0
         DAOUtil daoUtil = new DAOUtil( SQL_QUERY_FIND_FIELD_NULL_LABEL_BY_ID, getDefaultPool( plugin ) );
 423  0
         daoUtil.setInt( 1, nId );
 424  0
         daoUtil.executeQuery(  );
 425  
 
 426  0
         String strFieldNullLabel = "";
 427  
 
 428  0
         if ( daoUtil.next(  ) )
 429  
         {
 430  0
             strFieldNullLabel = daoUtil.getString( 1 );
 431  
         }
 432  
 
 433  0
         daoUtil.free(  );
 434  0
         plugin = changePool( strPoolName );
 435  
 
 436  0
         return strFieldNullLabel;
 437  
     }
 438  
 
 439  
     /**
 440  
      * Find the field id key by label key from adminsql database
 441  
      * @param strLabelKey the label key of the field
 442  
      * @param plugin Plugin adminsql
 443  
      * @param strPoolName the name of the pool
 444  
      * @return id key from label key
 445  
      */
 446  
     public int findFieldKeyIdbyLabel( String strLabelKey, Plugin plugin, String strPoolName )
 447  
     {
 448  0
         DAOUtil daoUtil = new DAOUtil( SQL_QUERY_FIND_FIELD_KEY_ID, getDefaultPool( plugin ) );
 449  0
         daoUtil.setString( 1, strLabelKey );
 450  0
         daoUtil.executeQuery(  );
 451  
 
 452  0
         int nIdFieldKey = 0;
 453  
 
 454  0
         if ( daoUtil.next(  ) )
 455  
         {
 456  0
             nIdFieldKey = daoUtil.getInt( 1 );
 457  
         }
 458  
 
 459  0
         daoUtil.free(  );
 460  0
         plugin = changePool( strPoolName );
 461  
 
 462  0
         return nIdFieldKey;
 463  
     }
 464  
 
 465  
     /**
 466  
      * Find the field id key by label key from adminsql database
 467  
      * @param nId the id of the key
 468  
      * @param plugin Plugin adminsql
 469  
      * @param strPoolName the name of the pool
 470  
      * @return the label of key by id
 471  
      */
 472  
     public String findFieldKeyLabelbyId( int nId, Plugin plugin, String strPoolName )
 473  
     {
 474  0
         DAOUtil daoUtil = new DAOUtil( SQL_QUERY_FIND_FIELD_KEY_LABEL_BY_ID, getDefaultPool( plugin ) );
 475  0
         daoUtil.setInt( 1, nId );
 476  0
         daoUtil.executeQuery(  );
 477  
 
 478  0
         String strFieldKeyLabel = "";
 479  
 
 480  0
         if ( daoUtil.next(  ) )
 481  
         {
 482  0
             strFieldKeyLabel = daoUtil.getString( 1 );
 483  
         }
 484  
 
 485  0
         daoUtil.free(  );
 486  0
         plugin = changePool( strPoolName );
 487  
 
 488  0
         return strFieldKeyLabel;
 489  
     }
 490  
 
 491  
     private Plugin changePool( String strPoolName )
 492  
     {
 493  0
         Plugin plugin = PluginService.getPlugin( "adminsql" );
 494  
 
 495  
         // plugin.setPoolName(strPoolName );
 496  0
         PluginConnectionService connectionService = new PluginConnectionService( strPoolName );
 497  0
         connectionService.setPool( strPoolName );
 498  0
         plugin.setConnectionService( connectionService );
 499  
 
 500  0
         return plugin;
 501  
     }
 502  
 
 503  
     private Plugin getDefaultPool( Plugin plugin )
 504  
     {
 505  0
         PluginConnectionService connectionService = new PluginConnectionService( plugin.getDbPoolName(  ) );
 506  0
         connectionService.setPool( "adminsql" );
 507  0
         plugin.setConnectionService( connectionService );
 508  
 
 509  0
         return plugin; //TODO in properties
 510  
     }
 511  
 }