class JmxQueryProcedure extends CallableProcedure.BasicProcedure {

    @Override
    public RawIterator<Object[], ProcedureException> apply( Context ctx, Object[] input, ResourceTracker resourceTracker ) throws ProcedureException
    {
        String query = input[0].toString();
        try
        {
            // Find all beans that match the query name pattern
            Iterator<ObjectName> names = jmxServer.queryNames( new ObjectName( query ), null ).iterator();

            // Then convert them to a Neo4j type system representation
            return RawIterator.from( () ->
            {
                if ( !names.hasNext() )
                {
                    return null;
                }

                ObjectName name = names.next();
                try
                {
                    MBeanInfo beanInfo = jmxServer.getMBeanInfo( name );
                    return new Object[]{
                            name.getCanonicalName(),
                            beanInfo.getDescription(),
                            toNeo4jValue( name, beanInfo.getAttributes() ) };
                }
                catch ( JMException e )
                {
                    throw new ProcedureException( Status.General.UnknownError,
                            e, "JMX error while accessing `%s`, please report this. Message was: %s",
                            name, e.getMessage() );
                }
            });
        }
        catch ( MalformedObjectNameException e )
        {
            throw new ProcedureException( Status.Procedure.ProcedureCallFailed,
                  "'%s' is an invalid JMX name pattern. Valid queries should use" +
                  "the syntax outlined in the javax.management.ObjectName API documentation." +
                  "For instance, try 'org.neo4j:*' to find all JMX beans of the 'org.neo4j' " +
                  "domain, or '*:*' to find every JMX bean.", query );
        }
    }

    public  JmxQueryProcedure( QualifiedName name, MBeanServer jmxServer );

}