JavaPOS KeyBoardDriver
authorgumartinm <gu.martinm@gmail.com>
Sun, 16 Oct 2011 16:53:41 +0000 (18:53 +0200)
committergumartinm <gu.martinm@gmail.com>
Sun, 16 Oct 2011 16:53:41 +0000 (18:53 +0200)
.gitignore
JavaPOS/KeyBoardDriver/pom.xml [new file with mode: 0644]
JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/BaseKeyBoardDriver.java [new file with mode: 0644]
JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/EventQueue.java [new file with mode: 0644]
JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/JposDriverInstanceFactory.java [new file with mode: 0644]
JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/JposDriverInstanceFactoryImpl.java [new file with mode: 0644]
JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/JposServiceInstanceFactoryImpl.java [new file with mode: 0644]
JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/KBDDeviceLinux.java [new file with mode: 0644]
JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/POSKeyboard.java [new file with mode: 0644]

index cc9a220..cc11a1f 100644 (file)
@@ -1,3 +1,4 @@
 bin/
 .classpath
 .project
+.settings
diff --git a/JavaPOS/KeyBoardDriver/pom.xml b/JavaPOS/KeyBoardDriver/pom.xml
new file mode 100644 (file)
index 0000000..dda8b95
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>es.dia.pos.n2a</groupId>
+    <artifactId>javapos-keyboard-driver</artifactId>
+    <version>1.0</version>
+    <name>javapos-keyboard-driver</name>
+    <url>http://maven.apache.org</url>
+    <dependencies>
+        <dependency>
+            <groupId>jpos</groupId>
+            <artifactId>jpos</artifactId>
+            <version>1.12.2</version>
+        </dependency>
+        <dependency>
+            <groupId>jpos</groupId>
+            <artifactId>jpos-controls</artifactId>
+            <version>1.12.2</version>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/BaseKeyBoardDriver.java b/JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/BaseKeyBoardDriver.java
new file mode 100644 (file)
index 0000000..ef44764
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ * 
+ */
+package es.dia.pos.n2a.gus.jpos;
+
+import jpos.JposException;
+
+/**
+ * @author
+ *
+ */
+public interface BaseKeyBoardDriver extends Runnable {
+       
+       public boolean isOpened();
+
+       public void close() throws JposException;
+    
+       public void claim() throws JposException;
+       
+       public void claim(int paramInt) throws JposException;
+
+       public void release() throws JposException;
+       
+       public boolean isClaimed();
+       
+       public void enable() throws JposException;
+       
+       public void disable() throws JposException;
+       
+       public boolean isEnabled();
+       
+       public void addEventListener(DCALEventListener paramDCALEventListener) throws JposException;
+       
+       public void removeEventListener(DCALEventListener paramDCALEventListener);
+       
+       public boolean write(byte[] paramArrayOfByte, int paramInt1, int paramInt2, 
+                       int paramInt3) throws JposException;
+       
+       public int read(byte[] paramArrayOfByte, int paramInt1, int paramInt2, 
+               int paramInt3) throws JposException;
+       
+       public int writeRead(byte[] paramArrayOfByte1, int paramInt1, 
+                       int paramInt2, byte[] paramArrayOfByte2, int paramInt3, int paramInt4, 
+                       int paramInt5) throws JposException;
+       
+       public String getDescription(int paramInt);
+               
+       public void flush(int paramInt) throws JposException;
+}
diff --git a/JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/EventQueue.java b/JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/EventQueue.java
new file mode 100644 (file)
index 0000000..dc880ea
--- /dev/null
@@ -0,0 +1,28 @@
+package es.dia.pos.n2a.gus.jpos;\r
+\r
+\r
+\r
+\r
+/**\r
+ * Instance factory to get the JPOS device services\r
+ * @author\r
+ */\r
+public class EventQueue extends Thread\r
+{\r
+       //Esto se ejectua en el constructor que hay por defecto (y que no se ve en este caso, \r
+        //si quisiera podria hacerlo tambien en ese constructor pero así queda mas ordenado)\r
+        private boolean isEnabled = false;\r
+        \r
+        \r
+        public void run() {\r
+\r
+                \r
+        }       \r
+        \r
+        /*private void enable ()\r
+        {\r
+                threadEventSpool = new Thread(this);\r
+                threadEventSpool.start();\r
+                threadEventSpool.setName("Thread-GUSPOSKeyboard");\r
+        }*/\r
+}\r
diff --git a/JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/JposDriverInstanceFactory.java b/JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/JposDriverInstanceFactory.java
new file mode 100644 (file)
index 0000000..4de9b91
--- /dev/null
@@ -0,0 +1,24 @@
+/**
+ * 
+ */
+package es.dia.pos.n2a.gus.jpos;
+
+import jpos.JposException;
+import jpos.config.JposEntry;
+
+/**
+ * @author
+ *
+ */
+public interface JposDriverInstanceFactory {
+
+       /**
+        * 
+        * @param logicalName 
+        * @param jposEntry
+        * @param entry
+        * @return
+        * @throws JposException
+        */
+       public <E> E createInstance(String logicalName, JposEntry entry, Class<E> pruebaClass) throws JposException;
+}
diff --git a/JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/JposDriverInstanceFactoryImpl.java b/JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/JposDriverInstanceFactoryImpl.java
new file mode 100644 (file)
index 0000000..48b56d4
--- /dev/null
@@ -0,0 +1,50 @@
+package es.dia.pos.n2a.gus.jpos;\r
+\r
+\r
+import java.lang.reflect.Constructor;\r
+\r
+import jpos.JposConst;\r
+import jpos.JposException;\r
+import jpos.config.JposEntry;\r
+\r
+/**\r
+ * Retrieve the device HW driver using this instance factory.\r
+ * @author \r
+ */\r
+public class JposDriverInstanceFactoryImpl implements JposDriverInstanceFactory\r
+{      \r
+       \r
+    /**\r
+     * @input_parameters: \r
+     */ \r
+       @Override\r
+       public <E> E createInstance(String logicalName, JposEntry entry, Class<E> typeClass) throws JposException \r
+       {\r
+       if (entry.getPropertyValue("driverClass") == null)\r
+        {\r
+            throw new JposException(JposConst.JPOS_E_NOSERVICE, "Missing driverClass JposEntry");\r
+        }      \r
+       E driverInstance = null;\r
+        try\r
+        {\r
+            String serviceClassName = (String)entry.getPropertyValue("driverClass");\r
+            Class<?> serviceClass = Class.forName(serviceClassName);\r
+            Class<?>[] params = new Class<?>[0];\r
+            Constructor<?> ctor = serviceClass.getConstructor(params);\r
+            if (typeClass.isInstance(ctor.newInstance((Object[])params)) )\r
+            {\r
+               //This cast is correct (IMHO) because we are checking the right type\r
+               //with the method isInstance.\r
+               //Why must I declare this local variable with SuppressWarnings? This is weird...\r
+               @SuppressWarnings("unchecked") E aux = (E)ctor.newInstance((Object[])params);\r
+               driverInstance = aux;\r
+            }\r
+        }\r
+        catch(Exception e)\r
+        {\r
+               throw new JposException(JposConst.JPOS_E_NOSERVICE, "Could not create " +\r
+                       "the driver instance for device with logicalName= " + logicalName, e);\r
+        }   \r
+        return driverInstance;\r
+       }\r
+}\r
diff --git a/JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/JposServiceInstanceFactoryImpl.java b/JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/JposServiceInstanceFactoryImpl.java
new file mode 100644 (file)
index 0000000..941a2e6
--- /dev/null
@@ -0,0 +1,45 @@
+package es.dia.pos.n2a.gus.jpos;\r
+\r
+\r
+import java.lang.reflect.Constructor;\r
+\r
+import jpos.JposConst;\r
+import jpos.JposException;\r
+import jpos.config.JposEntry;\r
+import jpos.loader.JposServiceInstance;\r
+import jpos.loader.JposServiceInstanceFactory;\r
+\r
+/**\r
+ * Instance factory to get the JPOS device services\r
+ * @author \r
+ */\r
+public class JposServiceInstanceFactoryImpl implements JposServiceInstanceFactory\r
+{    \r
+    /**\r
+     * @input_parameters: \r
+     * entry: (for jpos.xml and jpos.properties must be serviceClass)\r
+     * logicalName: device's name (in jpos.xml or jpos.properties file, jpos.xml file by default)\r
+     */\r
+    public JposServiceInstance createInstance(String logicalName, JposEntry entry) throws JposException\r
+    {\r
+        if(!entry.hasPropertyWithName(JposEntry.SERVICE_CLASS_PROP_NAME))\r
+        {\r
+            throw new JposException(JposConst.JPOS_E_NOSERVICE, "The JposEntry does not contain the 'serviceClass' property");\r
+        }\r
+        JposServiceInstance serviceInstance = null;\r
+        try\r
+        {\r
+            String serviceClassName = (String)entry.getPropertyValue(JposEntry.SERVICE_CLASS_PROP_NAME);\r
+            Class<?> serviceClass = Class.forName(serviceClassName);\r
+            Class<?>[] params = new Class<?>[0];\r
+            Constructor<?> ctor = serviceClass.getConstructor(params);\r
+            serviceInstance = (JposServiceInstance)ctor.newInstance((Object[])params);\r
+        }\r
+        catch(Exception e)\r
+        {\r
+            throw new JposException(JposConst.JPOS_E_NOSERVICE, "Could not create " +\r
+                       "the service instance with logicalName= " + logicalName, e);\r
+        }\r
+        return serviceInstance;\r
+    }\r
+}\r
diff --git a/JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/KBDDeviceLinux.java b/JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/KBDDeviceLinux.java
new file mode 100644 (file)
index 0000000..3b4b70a
--- /dev/null
@@ -0,0 +1,162 @@
+/**
+ * 
+ */
+package es.dia.pos.n2a.gus.jpos;
+
+import jpos.JposException;
+
+/**
+ * @author
+ *
+ */
+public class KBDDeviceLinux implements BaseKeyBoardDriver {
+
+       /* (non-Javadoc)
+        * @see es.dia.pos.n2a.gus.jpos.KeyBoardDriver#isOpened()
+        */
+       @Override
+       public boolean isOpened() {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       /* (non-Javadoc)
+        * @see es.dia.pos.n2a.gus.jpos.KeyBoardDriver#close()
+        */
+       @Override
+       public void close() throws JposException {
+               // TODO Auto-generated method stub
+
+       }
+
+       /* (non-Javadoc)
+        * @see es.dia.pos.n2a.gus.jpos.KeyBoardDriver#claim()
+        */
+       @Override
+       public void claim() throws JposException {
+               // TODO Auto-generated method stub
+
+       }
+
+       /* (non-Javadoc)
+        * @see es.dia.pos.n2a.gus.jpos.KeyBoardDriver#claim(int)
+        */
+       @Override
+       public void claim(int paramInt) throws JposException {
+               // TODO Auto-generated method stub
+
+       }
+
+       /* (non-Javadoc)
+        * @see es.dia.pos.n2a.gus.jpos.KeyBoardDriver#release()
+        */
+       @Override
+       public void release() throws JposException {
+               // TODO Auto-generated method stub
+
+       }
+
+       /* (non-Javadoc)
+        * @see es.dia.pos.n2a.gus.jpos.KeyBoardDriver#isClaimed()
+        */
+       @Override
+       public boolean isClaimed() {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       /* (non-Javadoc)
+        * @see es.dia.pos.n2a.gus.jpos.KeyBoardDriver#enable()
+        */
+       @Override
+       public void enable() throws JposException {
+               // TODO Auto-generated method stub
+
+       }
+
+       /* (non-Javadoc)
+        * @see es.dia.pos.n2a.gus.jpos.KeyBoardDriver#disable()
+        */
+       @Override
+       public void disable() throws JposException {
+               // TODO Auto-generated method stub
+
+       }
+
+       /* (non-Javadoc)
+        * @see es.dia.pos.n2a.gus.jpos.KeyBoardDriver#isEnabled()
+        */
+       @Override
+       public boolean isEnabled() {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       /* (non-Javadoc)
+        * @see es.dia.pos.n2a.gus.jpos.KeyBoardDriver#write(byte[], int, int, int)
+        */
+       @Override
+       public boolean write(byte[] paramArrayOfByte, int paramInt1, int paramInt2,
+                       int paramInt3) throws JposException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       /* (non-Javadoc)
+        * @see es.dia.pos.n2a.gus.jpos.KeyBoardDriver#read(byte[], int, int, int)
+        */
+       @Override
+       public int read(byte[] paramArrayOfByte, int paramInt1, int paramInt2,
+                       int paramInt3) throws JposException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       /* (non-Javadoc)
+        * @see es.dia.pos.n2a.gus.jpos.KeyBoardDriver#writeRead(byte[], int, int, byte[], int, int, int)
+        */
+       @Override
+       public int writeRead(byte[] paramArrayOfByte1, int paramInt1,
+                       int paramInt2, byte[] paramArrayOfByte2, int paramInt3,
+                       int paramInt4, int paramInt5) throws JposException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       /* (non-Javadoc)
+        * @see es.dia.pos.n2a.gus.jpos.KeyBoardDriver#getDescription(int)
+        */
+       @Override
+       public String getDescription(int paramInt) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       /* (non-Javadoc)
+        * @see es.dia.pos.n2a.gus.jpos.KeyBoardDriver#flush(int)
+        */
+       @Override
+       public void flush(int paramInt) throws JposException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void addEventListener(DCALEventListener paramDCALEventListener)
+                       throws JposException {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public void removeEventListener(DCALEventListener paramDCALEventListener) {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public void run() {
+               // TODO Auto-generated method stub
+               
+       }
+}
diff --git a/JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/POSKeyboard.java b/JavaPOS/KeyBoardDriver/src/main/java/es/dia/pos/n2a/gus/jpos/POSKeyboard.java
new file mode 100644 (file)
index 0000000..123b4e7
--- /dev/null
@@ -0,0 +1,346 @@
+package es.dia.pos.n2a.gus.jpos;
+
+import java.io.FileInputStream;
+import jpos.JposConst;
+import jpos.JposException;
+import jpos.POSKeyboardConst;
+import jpos.config.simple.SimpleEntryRegistry;
+import jpos.loader.JposServiceLoader;
+import jpos.loader.JposServiceManager;
+import jpos.services.EventCallbacks;
+import jpos.services.POSKeyboardService17;
+import jpos.config.JposEntry;
+import jpos.config.JposEntryRegistry;
+import jpos.events.DataEvent;
+import jpos.events.DataListener;
+public class POSKeyboard implements POSKeyboardService17, JposConst, POSKeyboardConst
+{
+       private String logicalname;
+       private EventCallbacks callbacks = null;
+       private JposEntryRegistry jposEntryRegistry = null;
+       private JposEntry jposEntry = null;
+       private String device;
+       private int maxEvents;
+       private BaseKeyBoardDriver deviceDriver;
+       private JposDriverInstanceFactory jposDriverFactory;
+       
+       @Override
+       public int getCapPowerReporting() throws JposException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getPowerNotify() throws JposException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getPowerState() throws JposException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public void setPowerNotify(int arg0) throws JposException {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public void clearInput() throws JposException {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public boolean getAutoDisable() throws JposException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean getCapKeyUp() throws JposException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public int getDataCount() throws JposException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public boolean getDataEventEnabled() throws JposException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public int getEventTypes() throws JposException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getPOSKeyData() throws JposException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getPOSKeyEventType() throws JposException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public void setAutoDisable(boolean arg0) throws JposException {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public void setDataEventEnabled(boolean arg0) throws JposException {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public void setEventTypes(int arg0) throws JposException {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public void checkHealth(int arg0) throws JposException {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public void claim(int arg0) throws JposException {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public void close() throws JposException {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public void directIO(int arg0, int[] arg1, Object arg2)
+                       throws JposException {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public String getCheckHealthText() throws JposException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public boolean getClaimed() throws JposException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean getDeviceEnabled() throws JposException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public String getDeviceServiceDescription() throws JposException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public int getDeviceServiceVersion() throws JposException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public boolean getFreezeEvents() throws JposException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public String getPhysicalDeviceDescription() throws JposException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getPhysicalDeviceName() throws JposException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public int getState() throws JposException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public void open(String paramString, EventCallbacks paramEventCallbacks) throws JposException {
+               this.logicalname = paramString;
+               
+               //La clase EventCallbacks se crea en la clase POSKeyboard, y contiene 
+               //los objectos listeners generados en nuestro wrapper
+               //Esos objectos lo que contienen son punteros a funciones (en Java 
+               //realmente todo son punteros) conocidas como callbacks
+               //
+               //  this.dataListener = new DataListener() {
+        //    @Override
+               //        public void dataOccurred(final DataEvent dataEvent) {
+               //               JPosScaleWrapper.this.processDataOccurredOccurred(dataEvent);  <--- Esto es el "puntero" a funcion que será lo que se almacene en la clase EventCallbacs (se almacena el objecto DataListener que implementa la callback o puntero a funcion) ya a nivel Jpos (se introduce en el nivel Jpos algo creado en un nivel superior, es decir, en nuestro Wrapper)
+               //        }
+               //  }
+               //  this.scale.addDataListener(this.dataListener); <-- addDataListener es un método definido en POSKeyboard que introduce el objeto DataListener en un Vector (al introducir ese objecto lo que está haciendo es pasar el callback, en Java lo han hecho así, en C,C++ por ejemplo podría haberse pasado directamente el puntero a función
+               this.callbacks = paramEventCallbacks; //<---- En este objeto dentro del Vector está el objecto DataListener creado en el Wrapper
+               
+               //Podemos extraer los valores de configuracion del jpos.xml o jpos.properties tal como sigue:
+               //(Wincord usa la clase OSServiceConfiguration para hacer lo mismo)
+               JposServiceManager localJposServiceManager = JposServiceLoader.getManager();
+               //Esto contiene todo el jpos.xml o el jpos.properties correctamente ordenado y parseado
+               this.jposEntryRegistry = localJposServiceManager.getEntryRegistry();
+               //Así podemos obtener toda la configuracion localizada en el jpos.xml o .properties 
+               //para un determinado dispostivo
+               //cuyo nombre pasamos aqui como parametro de entrada.
+               //NOTA: Roberto lo que hacia era en la Factoria hacer esto mismo (recuperar 
+               //el jposEntryRegistry y el jposEntry
+               //y pasarselo directamente al constructor. Mi constructor no hace nada 
+               //(no lo he implementado, al menos todavia)
+               //En mi caso el constructor no hace eso y tengo que recuperarlo aquí
+               //(keine Ahnung was ist besser)
+               this.jposEntry = this.jposEntryRegistry.getJposEntry(paramString);
+               
+               
+               //Aqui comienzo a leer toda la posible configuracion para cumplir con un Keyboard POS.
+               //Finalmente de este modo podemos ir obteniendo la configuracion de ese 
+               //dispositivo pasado los campos
+               String str = readJposConfiguration(this.jposEntry,this.jposEntryRegistry);
+               if ( str != null)
+               {
+                       //En caso de devolver un string, este string es el mensaje de error.
+                       throw new JposException(JPOS_E_ILLEGAL, str);
+               }
+               
+               //Recuperamos el codigo Java que lee eventos HW del teclado y los almacena en el 
+               //DataEvent. Si hubiera que modificar el driver podria hacerse creando un nuevo
+               //interfaz que extiende de BaseKeyBoardDriver y aqui deberiamos aniadir algo
+               //que hiciera cast al nuevo interfaz que extiende de BaseKeyBoardDriver. De esta forma
+               //si hay que aniadir algo al driver no hay que modificar casi nada del codigo. 
+               //Ademas si queremos cambiar el driver lo unico que hay que hacer es crear una nueva
+               //clase que implemente el interfaz BaseKeyBoardDriver y poner el nombre de la clase
+               //en el jpos.xml o en el jpos.properties en el campo driverClass que es donde he definido
+               //que se ponga el nombre de la clase que implementa el driver. En Wincord era en dcalClass.
+               //Por ejemplo yo ahora tendria que aniadir un campos driverClass al jpos.xml de la N2A
+               //con la clase es.dia.pos.n2a.gus.jpos.GUSKBDDeviceLinux
+               //Lo que no me gusta es que la factoria si se cambiara debe hacerse aquí en el codigo :S
+               this.jposDriverFactory = new JposDriverInstanceFactoryImpl();
+               BaseKeyBoardDriver instanceHWDriver = this.jposDriverFactory.createInstance(paramString, 
+                               this.jposEntry, BaseKeyBoardDriver.class);
+               
+       }
+       
+       private String readJposConfiguration(JposEntry jposEntry, JposEntryRegistry jposEntryRegistry)
+       {
+               String str;
+               final String device = "device";
+               final String maxEvents = "maxEvents";
+               final String keyTable = "keyTable";
+           JposEntry tableJposKey;
+               
+               //Primero: obtener el dispositivo de caracteres.
+               if ( jposEntry.hasPropertyWithName(device) ){
+                       //Chequeamos que lo que estamos leyendo es un String (deberia ser algo como /dev/wn_javapos_kbd0)
+                       if (String.class == jposEntry.getPropertyType(device))
+                       {
+                               this.device = (String)jposEntry.getPropertyValue(device);
+                       }else
+                               return "open-readJposConfiguration(): illegal device name.";
+               }else
+                       return "open-readJposConfiguration(): A property called 'device' with " +
+                                       "the path of the character device of the keyboard is needed";
+               
+               
+               //Segundo: obtener el numero maximo de eventos.
+               if ( jposEntry.hasPropertyWithName(maxEvents) ){
+                       if ((str = (String)jposEntry.getPropertyValue(maxEvents)) != null)
+                       {
+                               try
+                               {
+                                       this.maxEvents = Integer.decode(str).intValue();
+                               }
+                               catch (NumberFormatException localNumberFormatException)
+                               {
+                                       return "open-readJposConfiguration(): illegal jpos property maxEvents '" + 
+                                                       str + "is not a number";
+                               }
+                       }
+               }else
+                       return "open-readJposConfiguration(): A property called 'maxEvents' with is needed";
+               
+               
+               //Tercero: obtener la tabla de caracteres del teclado (si existe) puede ser de Dia o de Wincor
+               //PASO DE HACER ESTO AHORA, ME ABURRE LOL.
+               if ( jposEntry.hasPropertyWithName(keyTable)){
+                       if (String.class == jposEntry.getPropertyType(keyTable)){
+                               str = (String)jposEntry.getPropertyValue(keyTable);
+                               tableJposKey=jposEntryRegistry.getJposEntry(str);
+                       }else
+                               return "open-readJposConfiguration(): illegal jpos property keyTable '" + 
+                                               str + "is not a String";
+                       
+                       /*PASO DE HACER ESTO DE MOMENTO, PARSEAR ESO ME ABURRE LOL*/
+                       
+                       
+               }
+               
+               return null;
+       }
+
+       @Override
+       public void release() throws JposException {
+               // TODO Auto-generated method stub
+               
+       }
+       
+
+       @Override
+       public void setDeviceEnabled(boolean arg0) throws JposException {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public void setFreezeEvents(boolean arg0) throws JposException {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public void deleteInstance() throws JposException {
+               // TODO Auto-generated method stub
+               
+       }
+       
+       
+       
+       
+}
\ No newline at end of file