*/
@Override
public void execute()
throws IOException
{
Session session = getSession();
if ( url == null )
{
Connection con = session.getConnection();
if ( con == null )
{
session.output.printMessage( "not connected" );
session.output.println( SyntaxUtils.NULL );
}
else
{
session.output.println( String.format( "%s,%s", con.getConnectorId(), con.getUrl() ) );
}
return;
}
Map<String, Object> env;
if ( user != null )
{
if ( password == null )
{
password = session.getInput().readMaskedString( "Credential password: " );
}
env = new HashMap<String, Object>( 1 );
String[] credentials = { user, password };
env.put( JMXConnector.CREDENTIALS, credentials );
}
else
{
env = null;
}
try
{
session.connect( SyntaxUtils.getUrl( url, session.getProcessManager() ), env );
session.output.printMessage( "Connection to " + url + " is opened" );
}
catch ( IOException e )
{
if ( NumberUtils.isDigits( url ) )