class VirtualMachineHandler {

    public Object attachVirtualMachine() {
        if (options.getPid() == null && options.getProcessPattern() == null) {
            return null;
        }
        Class vmClass = lookupVirtualMachineClass();
        String pid = null;
        try {
            Method method = vmClass.getMethod("attach",String.class);
            pid = getProcessId(options);
            return method.invoke(null, pid);
        } catch (NoSuchMethodException e) {
            throw new ProcessingException("Internal: No method 'attach' found on " + vmClass,e,options);
        } catch (InvocationTargetException e) {
            throw new ProcessingException(getPidErrorMesssage(pid,"InvocationTarget",vmClass),e,options);
        } catch (IllegalAccessException e) {
            throw new ProcessingException(getPidErrorMesssage(pid, "IllegalAccessException", vmClass),e,options);
        } catch (IllegalArgumentException e) {
            throw new ProcessingException("Illegal Argument",e,options);
        }
    }

    public  VirtualMachineHandler(OptionsAndArgs pOptions);

}