Package org.cyclopsgroup.jmxterm

Examples of org.cyclopsgroup.jmxterm.Session


     */
    @Override
    public void execute()
        throws MalformedObjectNameException, IOException, JMException
    {
        Session session = getSession();
        String beanName = BeanCommand.getBeanName( bean, domain, session );
        if ( beanName == null )
        {
            throw new IllegalArgumentException( "Please specify MBean to invoke either using -b option or bean command" );
        }

        Validate.isTrue( parameters.size() > 0, "At least one parameter is needed" );
        String operationName = parameters.get( 0 );
        ObjectName name = new ObjectName( beanName );
        MBeanServerConnection con = session.getConnection().getServerConnection();
        MBeanInfo beanInfo = con.getMBeanInfo( name );
        MBeanOperationInfo operationInfo = null;
        for ( MBeanOperationInfo info : beanInfo.getOperations() )
        {
            if ( operationName.equals( info.getName() ) && info.getSignature().length == parameters.size() - 1 )
View Full Code Here


     */
    @Override
    protected List<String> doSuggestArgument()
        throws IOException, JMException
    {
        Session session = getSession();
        if ( session.getBean() != null )
        {
            MBeanServerConnection conn = getSession().getConnection().getServerConnection();
            MBeanInfo info = conn.getMBeanInfo( new ObjectName( session.getBean() ) );
            MBeanAttributeInfo[] attrs = info.getAttributes();
            List<String> attributeNames = new ArrayList<String>( attrs.length );
            for ( MBeanAttributeInfo attr : attrs )
            {
                attributeNames.add( attr.getName() );
View Full Code Here

    @Override
    public void execute()
        throws JMException, IOException
    {
        Validate.isTrue( arguments.size() >= 2, "At least two arguments are required" );
        Session session = getSession();
        String attributeName = arguments.get( 0 );

        String beanName = BeanCommand.getBeanName( bean, domain, session );
        ObjectName name = new ObjectName( beanName );

        MBeanServerConnection con = session.getConnection().getServerConnection();
        MBeanInfo beanInfo = con.getMBeanInfo( new ObjectName( beanName ) );
        MBeanAttributeInfo attributeInfo = null;
        for ( MBeanAttributeInfo i : beanInfo.getAttributes() )
        {
            if ( i.getName().equals( attributeName ) )
View Full Code Here

     */
    @Override
    public void execute()
        throws IOException
    {
        Session session = getSession();
        if ( domain == null )
        {
            if ( session.getDomain() == null )
            {
                session.output.printMessage( "domain is not set" );
                session.output.println( SyntaxUtils.NULL );
            }
            else
            {
                session.output.printMessage( "domain = " + session.getDomain() );
                session.output.println( session.getDomain() );
            }
            return;
        }
        String domainName = getDomainName( domain, session );
        if ( domainName == null )
        {
            session.unsetDomain();
            session.output.printMessage( "domain is unset" );
        }
        else
        {
            session.setDomain( domainName );
            session.output.printMessage( "domain is set to " + session.getDomain() );
        }
    }
View Full Code Here

     */
    @Override
    public void execute()
        throws MalformedObjectNameException, IOException
    {
        Session session = getSession();
        String domainName = DomainCommand.getDomainName( domain, session );
        List<String> domains = new ArrayList<String>();
        if ( domainName == null )
        {
            domains.addAll( DomainsCommand.getCandidateDomains( session ) );
View Full Code Here

     */
    @Override
    public void execute()
        throws IOException
    {
        Session session = getSession();
        session.disconnect();
        session.close();
        session.output.printMessage( "bye" );
    }
View Full Code Here

     */
    @Override
    public void execute()
        throws IOException, JMException
    {
        Session session = getSession();
        List<JavaProcess> processList;

        // classworlds has some hard coded stdout printing. Therefore stdout needs to be redirected temporarily to avoid
        // meaningless console output
        PrintStream stdOut = System.out;
        System.setOut( SyntaxUtils.NULL_PRINT_STREAM );
        try
        {
            processList = session.getProcessManager().list();
        }
        finally
        {
            System.setOut( stdOut );
        }
View Full Code Here

     */
    @Override
    public void execute()
        throws MalformedObjectNameException, IOException, JMException
    {
        Session session = getSession();
        String beanName = BeanCommand.getBeanName( bean, domain, session );
        if ( beanName == null )
        {
            throw new IllegalArgumentException( "Please specify MBean to invoke either using -b option or bean command" );
        }

        ObjectName name = new ObjectName( beanName );
        NotificationListener listener = SubscribeCommand.getListeners().remove( name );
        if ( listener != null )
        {
            MBeanServerConnection con = session.getConnection().getServerConnection();
            con.removeNotificationListener( name, listener );

            session.output.printMessage("Unsubscribed from " + name);
        }

View Full Code Here

     */
    @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 ) )
View Full Code Here

     * @inheritDoc
     */
    @Override
    public void execute()
    {
        Session session = getSession();
        if ( verboseLevel == null )
        {
            session.output.printMessage( "no change for verbose, verbose = " + session.getVerboseLevel() );
        }
        else
        {
            VerboseLevel v = VerboseLevel.valueOf( verboseLevel.toUpperCase() );
            session.setVerboseLevel( v );
            session.output.printMessage( "verbose option is turned to " + v );
        }
    }
View Full Code Here

TOP

Related Classes of org.cyclopsgroup.jmxterm.Session

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.