% UTPCLOSECONNECTION closes the connection.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: UTPCLOSECONNECTION closes the connection.
%
% CALL:        utpGetConnection(conn)
%
% VERSION:     $Id: utpCloseConnection.m,v 1.2 2009/09/20 15:38:53 ingo Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function utpCloseConnection(conn)
  
  if isa(conn, 'database')
    % MATLAB connection
    if isconnection(conn)
      close(conn);
    end
  elseif isa(conn, 'mpipeline.repository.RepositoryConnection')
    % java connection
    conn.closeConnection();
  else
    error('### Unknown connection [%s]. Can not close the connection', class(conn));
  end
  
end
