001/* 002 * Copyright 2016 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.plugins.contentio.synchronize.impl; 017 018import java.sql.Connection; 019import java.sql.PreparedStatement; 020import java.sql.ResultSet; 021 022import org.apache.avalon.framework.component.Component; 023import org.slf4j.Logger; 024 025import org.ametys.core.datasource.ConnectionHelper; 026import org.ametys.plugins.contentio.synchronize.SynchronizableContentsCollection; 027 028/** 029 * Implementation of {@link SynchronizableContentsCollection} to be synchronized with a LDAP data source 030 */ 031public class SQLSynchronizableContentsCollection extends AbstractDataSourceSynchronizableContentsCollection implements Component 032{ 033 private static final String __PARAM_SQL_TABLE = "tableName"; 034 035 /** 036 * Get the name of SQL table 037 * @return The SQL table name 038 */ 039 public String getTableName() 040 { 041 return (String) _modelParamValues.get(__PARAM_SQL_TABLE); 042 } 043 044 @Override 045 protected void _internalPopulate(Logger logger) 046 { 047 Connection connection = ConnectionHelper.getConnection(getDataSourceId()); 048 PreparedStatement stmt = null; 049 ResultSet rs = null; 050 051 try 052 { 053 // TODO 054 } 055 finally 056 { 057 ConnectionHelper.cleanup(rs); 058 ConnectionHelper.cleanup(stmt); 059 ConnectionHelper.cleanup(connection); 060 } 061 062 } 063}