}
@Override
public Map<String, Serializable> createConnectionParameters(Object context) {
if( context instanceof MySQLServiceImpl ){
MySQLServiceImpl mysql = (MySQLServiceImpl) context;
return mysql.getConnectionParams();
}
URL url = toCapabilitiesURL( context );
if( url == null ){
// so we are not sure it is a mysql url
// lets guess
url = CatalogPlugin.locateURL(context);
}
if( url != null && MySQLServiceExtension.isMySQL(url)) {
// well we have a url - lets try it!
List<IResolve> list = CatalogPlugin.getDefault().getLocalCatalog().find( url, null );
for( IResolve resolve : list ){
if( resolve instanceof MySQLServiceImpl) {
// got a hit!
MySQLServiceImpl mysqlService = (MySQLServiceImpl) context;
return mysqlService.getConnectionParams();
}
else if (resolve instanceof MySQLGeoResource ){
MySQLGeoResource layer = (MySQLGeoResource) resolve;
MySQLServiceImpl mysql;
try {
mysql = (MySQLServiceImpl) layer.parent( null );
return mysql.getConnectionParams();
} catch (IOException e) {
toCapabilitiesURL( layer.getIdentifier() );
}
}
}