Package jpos

Examples of jpos.JposException


        super(deviceName, timeout);
        this.control = new jpos.CheckScanner();
    }

    protected void initialize() throws JposException {
        throw new JposException(JposConst.JPOS_E_NOEXIST, "Device not yet implemented");
    }
View Full Code Here


        super(deviceName, timeout);
        this.control = new jpos.POSPrinter();
    }

    protected void initialize() throws JposException {
        throw new JposException(JposConst.JPOS_E_NOEXIST, "Device not yet implemented");
    }
View Full Code Here

        super(deviceName, timeout);
        this.control = new jpos.PINPad();
    }

    public void initialize() throws JposException {
        throw new JposException(JposConst.JPOS_E_NOEXIST, "Device not yet implemented");
    }
View Full Code Here

        super(deviceName, timeout);
        this.control = new jpos.SignatureCapture();
    }

    protected void initialize() throws JposException {
        throw new JposException(JposConst.JPOS_E_NOEXIST, "Device not yet implemented");
    }
View Full Code Here

        super(deviceName, timeout);
        this.control = new jpos.LineDisplay();
    }

    protected void initialize() throws JposException {
        throw new JposException(JposConst.JPOS_E_NOEXIST, "Device not yet implemented");
    }
View Full Code Here

            this.eventTypes = i;
    }

    public int getPOSKeyData() throws JposException {
        if (!received) {
            throw new JposException(JposConst.JPOS_PS_UNKNOWN, "No data received");
        }
        return keyData;
    }
View Full Code Here

        return keyData;
    }

    public int getPOSKeyEventType() throws JposException {
        if (!received) {
            throw new JposException(JposConst.JPOS_PS_UNKNOWN, "No data received");
        }
        return this.keyEvent;
    }
View Full Code Here

            if (keyDef.startsWith("0x")) {
                try {
                    this.keyCode = Integer.parseInt(keyDef.substring(2), 16);
                } catch (Throwable t) {
                    Debug.logError(t, module);
                    throw new JposException(JposConst.JPOS_E_ILLEGAL, "Illegal hex code key definition [" + keyName + "]");
                }
            } else if (keyDef.startsWith("VK_")) {
                try {
                    Field kef = KeyEvent.class.getField(keyDef);
                    this.keyCode = kef.getInt(kef);
                } catch (Throwable t) {
                    Debug.logError(t, module);
                    throw new JposException(JposConst.JPOS_E_ILLEGAL, "Illegal virtual key definition [" + keyName + "]");
                }
            } else {
                try {
                    this.keyCode = Integer.parseInt(keyDef);
                } catch (Throwable t) {
                    Debug.logError(t, module);
                    throw new JposException(JposConst.JPOS_E_ILLEGAL, "Illegal key code definition [" + keyName + "]");
                }
            }

            // set the key modifiers
            String[] modifiers = null;
            if (keyMod != null && keyMod.length() > 0) {
                if (keyMod.indexOf("+") != -1) {
                    modifiers = keyMod.split("\\+");
                } else {
                    modifiers = new String[1];
                    modifiers[0] = keyMod;
                }
                for (int i = 0; i < modifiers.length; i++) {
                    if ("SHIFT".equalsIgnoreCase(modifiers[i])) {
                        this.shift = true;
                    } else {
                        this.shift = false;
                    }
                    if ("CTRL".equalsIgnoreCase(modifiers[i])) {
                        this.ctrl = true;
                    } else {
                        this.ctrl = false;
                    }
                    if ("ALT".equalsIgnoreCase(modifiers[i])) {
                        this.alt = true;
                        this.alt = false;
                    }
                }
            }

            // set the mapped value
            if (UtilValidate.isNotEmpty(mappedValue)) {
                try {
                    this.mappedCode = Integer.parseInt(mappedValue);
                } catch (Throwable t) {
                    Debug.logError(t, module);
                    throw new JposException(JposConst.JPOS_E_ILLEGAL, "Illegal key code mapping [" + mappedValue + "]");
                }
            } else {
                this.mappedCode = keyCode;
            }
        }
View Full Code Here

    private static Map serviceMap = new HashMap();

    public JposServiceInstance createInstance(String logicalName, JposEntry entry) throws JposException {
        // check to see if we have a service class property
        if (!entry.hasPropertyWithName(JposEntry.SERVICE_CLASS_PROP_NAME)) {
            throw new JposException(JposConst.JPOS_E_NOSERVICE, "serviceClass property not found!");
        }

        String className = (String) entry.getPropertyValue(JposEntry.SERVICE_CLASS_PROP_NAME);
        BaseService service = (BaseService) serviceMap.get(className);

        if (service != null) {
            service.setEntry(entry);
        } else {
            try {
                Object obj = ObjectType.getInstance(className);
                if (obj == null) {
                    throw new JposException(JposConst.JPOS_E_NOEXIST, "unable to locate serviceClass");
                }

                if (!(obj instanceof JposServiceInstance)) {
                    throw new JposException(JposConst.JPOS_E_NOSERVICE, "serviceClass is not an instance of JposServiceInstance");
                } else if (!(obj instanceof BaseService)) {
                    throw new JposException(JposConst.JPOS_E_NOSERVICE, "serviceClass is not an instance of BaseKybService");
                } else {
                    service = (BaseService) obj;
                    service.setEntry(entry);
                    serviceMap.put(className, service);
                }
            } catch (Exception e) {
                throw new JposException(JposConst.JPOS_E_NOSERVICE, "Error creating the service instance [" + className + "]", e);
            }
        }

        return service;
    }
View Full Code Here

            this.eventTypes = i;
    }

    public int getPOSKeyData() throws JposException {
        if (!received) {
            throw new JposException(JposConst.JPOS_PS_UNKNOWN, "No data received");
        }
        return keyData;
    }
View Full Code Here

TOP

Related Classes of jpos.JposException

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.