/***********************************************************************/ /* File "Load.tld" */ /* It contains description of jsp tags for sending files to the computer managing the barcode printer */ /***********************************************************************/ 1.0 1.1 load loadFileFromHereToBarcodePrinter IARC.tag.loadFileFromHereToBarcodePrinter EMPTY This tag loads files to the barcode printer. folder yes true file yes true /***********************************************************************/ /* File loadFileFromHereToBarcodePrinter.java *****/ /* File that contains instructions for sending files to a specific folder on the computer managing the barcode printer */ /***********************************************************************/ package IARC.tag; import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; import javax.naming.*; import java.util.*; public class loadFileFromHereToBarcodePrinter extends TagSupport { private BufferedReader br; private String folder=""; private String file=""; public void setBufferedReader() throws Exception { Runtime rJSP=Runtime.getRuntime(); String cmdJSP="/bin/sh /home/web/gcsbarcodes_script/gcsBarcodePrinter.sh "+folder + " " +file ; Process pJSP=rJSP.exec(cmdJSP); InputStreamReader isrJSP=new InputStreamReader(pJSP.getInputStream()); br=new BufferedReader(isrJSP); } public int doStartTag() throws JspException { try { this.setBufferedReader(); String lineJSP=null; JspWriter jw = pageContext.getOut(); while((lineJSP = br.readLine()) != null) jw.println(lineJSP); } catch (Exception ex) { } return SKIP_BODY; } public void setFolder(String psFolder){ folder = psFolder; } public void setFile(String psFile){ file = psFile; } } /***********************************************************************/ /* File "gcsBarcodePrinter.sh" */ /***********************************************************************/ #!/bin/sh unix2dos $2 remotedirectory="//var_ip_adress/$1" localdirectory=`dirname $2` filename=`basename $2` file="lcd $localdirectory; put $filename" #echo "/usr/bin/smbclient $remotedirectory -c "$file" password -U login" /usr/bin/smbclient $remotedirectory gcs10 -c "$file" password -U login > /dev/null /***** Addition to /etc/rc.d/rc.local *****/ The following line: /usr/sbin/smbmount //10.10.xxx.xxx/gcsbarcodes /home/web/public/resources/limsGCS/barcodes -o username=login, password=pwd & /***********************************************************************/ /* File "BarcodeDNA_a_101.ext" */ /* File that generated the data file sent to the barcode printer (=.ext) */ /***********************************************************************/ <%@ taglib uri="tags/load.tld" prefix="load"%> <% String filename="/home/web/public/resources/limsGCS/barcodes/barcodes_DNA"+id+".ext"; File barcodes = new File(filename); FileWriter fw = new FileWriter(barcodes); int b_position=0; int t_position=10; fw.write("."); fw.write("\n"); fw.write("\n"); fw.write("N"); fw.write("\n"); fw.write("q812"); fw.write("\n"); fw.write("S2"); fw.write("\n"); fw.write("B215,0,0,1,2,1,25,N,\""+barcode+"\""); fw.write("\n"); fw.write("A500,10,0,1,1,1,N,\""+barcode+"\""); fw.write("\n"); fw.write("P1"); fw.write("\n"); fw.write("."); fw.write("\n"); fw.write("\n"); fw.close(); %> /***********************************************************************/ /* File "Barcode_DNA_a_101.ext" */ /* File that prints the barcode */ /***********************************************************************/ . N q812 S2 B215,0,0,1,2,1,25,N,"dna_a_101" A500,10,0,1,1,1,N,"dna_a_101" P1 .