version 1.1.1.1, 2003/06/17 10:38:55
|
version 1.3, 2003/06/25 11:50:09
|
Line 30 public class Upload extends JApplet impl
|
Line 30 public class Upload extends JApplet impl
|
static Bundle bundle; |
static Bundle bundle; |
static Bundle bundleRef; |
static Bundle bundleRef; |
JButton upload = new JButton("Upload"); |
JButton upload = new JButton("Upload"); |
|
JButton download = new JButton("Download"); |
JRadioButton proxy = new JRadioButton("Proxy"); |
JRadioButton proxy = new JRadioButton("Proxy"); |
static int fileCount = 0; |
static int fileCount = 0; |
// static UploadInfo dialog = new UploadInfo(); |
// static UploadInfo dialog = new UploadInfo(); |
Line 40 public class Upload extends JApplet impl
|
Line 41 public class Upload extends JApplet impl
|
static boolean runningAsApplet=true; |
static boolean runningAsApplet=true; |
static boolean debug=false; |
static boolean debug=false; |
static String rootNode = "edoc"; |
static String rootNode = "edoc"; |
static MessageDigest md ; |
|
static |
|
{ |
|
try { |
|
md = MessageDigest.getInstance("MD5"); |
|
} catch(Exception e) { e.printStackTrace();} |
|
} |
|
public Upload() |
public Upload() |
{ |
{ |
if(!runningAsApplet) |
if(!runningAsApplet) |
Line 58 public class Upload extends JApplet impl
|
Line 52 public class Upload extends JApplet impl
|
{ |
{ |
this.getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); |
this.getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); |
this.getContentPane().add(upload); |
this.getContentPane().add(upload); |
|
this.getContentPane().add(download); |
this.getContentPane().add(proxy); |
this.getContentPane().add(proxy); |
upload.addActionListener(this); |
upload.addActionListener(this); |
|
download.addActionListener(this); |
proxy.addActionListener(this); |
proxy.addActionListener(this); |
id = System.currentTimeMillis(); |
id = System.currentTimeMillis(); |
Properties prop = System.getProperties(); |
Properties prop = System.getProperties(); |
Line 135 public class Upload extends JApplet impl
|
Line 131 public class Upload extends JApplet impl
|
// proxy.setSelected(false); |
// proxy.setSelected(false); |
} |
} |
|
|
|
if (e.getActionCommand().equals("Download")) |
|
{ |
|
|
|
Thread thread = new Thread() |
|
{ |
|
public void run() |
|
{ |
|
UploadInfo dialog = new UploadInfo(); |
|
|
|
File startFile=new File("."); |
|
dialog.thread=Thread.currentThread(); |
|
//System.out.println("Called run with " + fileChooser.getSelectedFile()); |
|
dialog.setTitle("Download Status Window"); |
|
dialog.setSize(400, 175); |
|
dialog.setLocation(new java.awt.Point(150, 100)); |
|
|
|
long time = System.currentTimeMillis(); |
|
try |
|
{ |
|
Connection conGet = null; |
|
if(!runningAsApplet) |
|
conGet=new Connection( new URL("http://core.rz-berlin.mpg.de/edoctest/oi.epl")); |
|
else |
|
conGet=new Connection( new URL(url+"/oi.epl")); |
|
|
|
conGet.ses=ses; |
|
conGet.dialog=dialog; |
|
Bundle bundle = bundleRef; |
|
int fileCount = bundle.documents.size(); |
|
for(int i=0;i< fileCount;++i) |
|
{ |
|
Bundle.Document doc=(Bundle.Document)bundle.documents.get(i); |
|
if(doc.fileLink=="") continue; |
|
System.out.println(doc.title); |
|
conGet.url=new URL(doc.fileLink); |
|
conGet.get(); |
|
writeChunked(conGet,new File("./download/"+doc.fileName),i+1, fileCount,doc.size, dialog); |
|
//if(getMD5(conGet.md).equals(doc.md5cs)) System.out.println("download sucess"); |
|
//else |
|
// break; |
|
} |
|
} catch(Exception e5) { e5.printStackTrace();} |
|
long time2 =System.currentTimeMillis(); |
|
System.out.println("Time for download needed "+(time2-time)); |
|
} |
|
}; |
|
thread.start(); |
|
} |
if (e.getActionCommand().equals("Upload")) |
if (e.getActionCommand().equals("Upload")) |
{ |
{ |
|
|
Line 379 public class Upload extends JApplet impl
|
Line 423 public class Upload extends JApplet impl
|
System.out.println(doc.title); |
System.out.println(doc.title); |
conPost.post(file,"new",doc.docID+"",doc.title,doc.locator,doc.comment); |
conPost.post(file,"new",doc.docID+"",doc.title,doc.locator,doc.comment); |
|
|
// conPost.post(new File("./test2.jpg"),picture.elementAt(i).toString(),artist.elementAt(i).toString(),source.elementAt(i). |
// conPost.post(new File("./test2.jpg"),picture.elementAt(i).toString(),artist.elementAt(i).toString(),source.elementAt(i).toString()); |
System.out.println(getMD5(md)); |
System.out.println(getMD5(conPost.md)); |
dialog.progress.setValue(100); |
dialog.progress.setValue(100); |
count++; |
count++; |
return count; |
return count; |
Line 392 public class Upload extends JApplet impl
|
Line 436 public class Upload extends JApplet impl
|
|
|
|
|
String path =startFile.getAbsolutePath().substring(0,index+1); |
String path =startFile.getAbsolutePath().substring(0,index+1); |
System.out.println(path);mode = "new"; |
System.out.println(path); |
boolean newVersionforAll = false; |
mode = "new"; |
Vector list=new Vector(); |
boolean newVersionforAll = false, keepAllFiles = false; |
|
Vector list=new Vector();Vector docs=new Vector();Bundle.Document refDoc=null; |
for(int k=0;k<fileCount;++k) |
for(int k=0;k<fileCount;++k) |
{ |
{ |
Bundle.Document doc = (Bundle.Document)bundle.documents.elementAt(k); |
Bundle.Document doc = (Bundle.Document)bundle.documents.elementAt(k); |
if(bundleRef.docsLocator.get(doc.locator)!=null) |
if((refDoc=(Bundle.Document)bundleRef.docsLocator.get(doc.locator))!=null) |
|
{ |
|
if(checkForNewFile(path,doc,refDoc)) |
|
{ |
list.addElement(doc.fileName); |
list.addElement(doc.fileName); |
|
docs.addElement(doc); |
|
} |
|
} else docs.addElement(doc); |
} |
} |
|
|
for(int k=0;k<fileCount;++k) |
for(int k=0;k<docs.size();++k) |
{ |
{ |
Bundle.Document doc = (Bundle.Document)bundle.documents.elementAt(k); |
Bundle.Document doc = (Bundle.Document)docs.elementAt(k); |
|
|
String response = ""; |
String response = ""; |
dialog.title.setText("Uploading " + path+doc.fileName); |
dialog.title.setText("Uploading " + path+doc.fileName); |
Line 418 public class Upload extends JApplet impl
|
Line 469 public class Upload extends JApplet impl
|
dialog.repaint(); |
dialog.repaint(); |
else |
else |
dialog.show(); |
dialog.show(); |
|
|
if(bundleRef.docsLocator.get(doc.locator)!=null) |
if(bundleRef.docsLocator.get(doc.locator)!=null) |
{ |
{ |
if(!newVersionforAll) |
if(!newVersionforAll&&!keepAllFiles) |
{ |
{ |
Object[] options = new Object[] { "New Version for this file","New Version for all files", "Skip file" }; |
Object[] options = new Object[] { "Cancel","Replace existing files", "Keep existing files" }; |
|
Object[] options2 = new Object[] { "Cancel","Replace existing file", "Keep existing file" }; |
|
|
int option = showDialog("Warning "+doc.locator+" exists! \n What do you want to do?", "Destination exists!", options,list); |
int option = (list.size()>1) ? showDialog("Warning : several files exist on the server \n Press show list to see the list! \n What do you want to do?", "several Files exist!", options,list):showDialog("Warning : file "+doc.fileName+" exists on the server \n What do you want to do?", " File "+doc.fileName+" exists!", options2); |
if(option == 0) mode ="old"; |
; |
|
if(option == 0) break;// mode = "old"; |
if(option == 1) |
if(option == 1) |
{ |
{ |
mode ="old"; |
mode ="old"; |
newVersionforAll=true; |
newVersionforAll=true; |
|
keepAllFiles = false; |
} |
} |
if(option == 2) |
if(option == 2) |
{ |
{ |
count++; |
count++; |
System.out.println("Heh Document exists!"+ doc); |
System.out.println("Heh Document exists!"+ doc); |
System.out.println("Skipping"); |
System.out.println("Skipping"); |
|
newVersionforAll = false; |
|
keepAllFiles = true; |
continue; |
continue; |
} |
} |
} |
} |
Bundle.Document refDoc= (Bundle.Document) bundleRef.docsLocator.get(doc.locator); |
refDoc= (Bundle.Document) bundleRef.docsLocator.get(doc.locator); |
doc.docID=refDoc.docID; |
doc.docID=refDoc.docID; |
|
if(keepAllFiles) |
|
{ |
|
count++; |
|
continue; |
|
} |
//count++; |
//count++; |
// System.out.println("Heh Document exists!"+ doc); |
// System.out.println("Heh Document exists!"+ doc); |
// System.out.println("Skipping"); |
// System.out.println("Skipping"); |
Line 457 public class Upload extends JApplet impl
|
Line 517 public class Upload extends JApplet impl
|
conPost.ses=ses; |
conPost.ses=ses; |
conPost.dialog=dialog; |
conPost.dialog=dialog; |
conPost.post(path,doc,mode); |
conPost.post(path,doc,mode); |
String md5=getMD5(md); |
String md5=getMD5(conPost.md); |
System.out.println("MD5 is equal ?"+doc.md5cs.equals(md5)); |
System.out.println("MD5 is equal ?"+doc.md5cs.equals(md5)+" doc_md5 "+doc.md5cs+" md5 "+md5); |
if(!doc.md5cs.equals(md5)) |
if(!doc.md5cs.equals(md5)) |
{ |
{ |
Object[] options = { "Retry", "Cancel" }; |
Object[] options = { "Retry", "Cancel" }; |
Line 472 public class Upload extends JApplet impl
|
Line 532 public class Upload extends JApplet impl
|
conPost.ses=ses; |
conPost.ses=ses; |
conPost.dialog=dialog; |
conPost.dialog=dialog; |
conPost.post(path,doc,mode); |
conPost.post(path,doc,mode); |
md5=getMD5(md); |
md5=getMD5(conPost.md); |
|
if(!doc.md5cs.equals(md5)) showDialog("Transfer failed","Transfer failed again! "); |
} |
} |
} // System.out.println(getMD5(md)); |
} // System.out.println(getMD5(md)); |
dialog.progress.setValue(100); |
dialog.progress.setValue(100); |
count++; |
count++; |
} |
} |
|
bundle.exportToXML(new File(path+"/temp.xml")); |
return count; |
return count; |
} |
} |
|
|
Line 514 public class Upload extends JApplet impl
|
Line 576 public class Upload extends JApplet impl
|
|
|
return sb.toString(); |
return sb.toString(); |
} |
} |
|
public static boolean checkForNewFile(String path,Bundle.Document doc,Bundle.Document refDoc) throws Exception |
|
{ |
|
String name = doc.fileLink.trim().startsWith("file://") ?doc.fileLink.trim().substring(7):doc.fileLink.trim(); |
|
System.out.println(name); |
|
boolean isNewFile=false; |
|
String filePath = name.startsWith("/") ? name:path+name; |
|
FileInputStream f=new FileInputStream( filePath); |
|
int length=f.available(); |
|
if(length!=refDoc.size) isNewFile=true; |
|
else |
|
{ |
|
|
|
//new File(filePath).setLastModified(System.currentTimeMillis()-690000000L); |
|
Date actualTime = new Date(new File(filePath).lastModified()); |
|
Date modified = new Date(doc.modified);//new File(filePath).lastModified()); |
|
// System.out.println("actual Date "+actualTime); |
|
// System.out.println("Date file modified "+modified); |
|
// System.out.println("Time difference in minutes "+((actualTime.getTime()-modified.getTime())/60000L)); |
|
// if file has been modified longer than 10 hours do not compare md5 --> file is not newer |
|
if(actualTime.getTime()==modified.getTime()) return false; |
|
MessageDigest md = MessageDigest.getInstance("MD5"); |
|
byte[] b=new byte[512000]; |
|
int readCount =0; |
|
while (readCount < length) |
|
{ |
|
if (readCount + b.length > length) |
|
f.read(b, 0, length - readCount); // mout.flush(); |
|
else |
|
f.read(b); |
|
if (readCount + b.length > length) |
|
{ |
|
md.update(b, 0, length - readCount); |
|
} |
|
else |
|
{ |
|
md.update(b, 0, b.length); |
|
} |
|
readCount += b.length; |
|
} |
|
isNewFile = !getMD5(md).equals(refDoc.md5cs); |
|
|
|
} |
|
System.out.println("is new file ? "+isNewFile+" length is equal ?"+(length==refDoc.size)); |
|
return isNewFile; |
|
} |
public static String convertUml(String newName) |
public static String convertUml(String newName) |
{ |
{ |
StringBuffer alterMe = new StringBuffer(newName.trim()); |
StringBuffer alterMe = new StringBuffer(newName.trim()); |
Line 604 public class Upload extends JApplet impl
|
Line 710 public class Upload extends JApplet impl
|
{ |
{ |
JOptionPane pane = new JOptionPane( message, JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); |
JOptionPane pane = new JOptionPane( message, JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); |
pane.setMessageType(JOptionPane.WARNING_MESSAGE); // Configure |
pane.setMessageType(JOptionPane.WARNING_MESSAGE); // Configure |
JDialog dialog = pane.createDialog(null, title); |
final JDialog dialog = pane.createDialog(null, title); |
JList list=null; |
JList list=null; |
if(fileList==null) |
if(fileList==null) |
list= new JList(new String[]{"click","here","test","bla","world","hello"}); |
list= new JList(new String[]{"click","here","test","bla","world","hello"}); |
else list = new JList(fileList); |
else list = new JList(fileList); |
|
|
JScrollPane scpane = new JScrollPane(list); |
JScrollPane scpane = new JScrollPane(list); |
scpane.setPreferredSize(new Dimension(100,80)); |
scpane.setPreferredSize(new Dimension(150,150)); |
JLabel label= new JLabel("Files : "); |
|
label.setPreferredSize(new Dimension(50,80)); |
JLabel label = new JLabel("Files to be updated : "); |
JPanel panel = new JPanel(); |
label.setPreferredSize(new Dimension(150,30)); |
panel.add(label); |
final JPanel panel = new JPanel(); |
panel.add(scpane); |
panel.setLayout(new BorderLayout()); |
dialog.getContentPane().add(panel,"East"); |
panel.add(label,"North"); |
|
panel.add(scpane,"Center"); |
|
JButton showList= new JButton("show List"); |
|
showList.addActionListener(new ActionListener() |
|
{ |
|
public void actionPerformed(ActionEvent e) |
|
{ |
|
JDialog window = new JDialog(dialog); |
|
window.getContentPane().add(panel); |
|
window.pack(); |
|
window.show(); |
|
} |
|
}); |
|
JPanel buttonPanel = new JPanel(); |
|
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS)); |
|
buttonPanel.add(Box.createRigidArea(new Dimension(0,30))); |
|
buttonPanel.add(showList); |
|
dialog.getContentPane().add(buttonPanel,"East"); |
dialog.pack(); |
dialog.pack(); |
dialog.show(); |
dialog.show(); |
Object selectedValue = pane.getValue(); |
Object selectedValue = pane.getValue(); |
Line 629 public class Upload extends JApplet impl
|
Line 753 public class Upload extends JApplet impl
|
return 2; |
return 2; |
} |
} |
//If there is an array of option buttons: |
//If there is an array of option buttons: |
for(int counter = 0, maxCounter = options.length; |
for(int counter = 0, maxCounter = options.length;counter < maxCounter; counter++) |
counter < maxCounter; counter++) { |
{ |
if(options[counter].equals(selectedValue)) |
if(options[counter].equals(selectedValue)) |
return counter; |
return counter; |
} |
} |
Line 801 public class Upload extends JApplet impl
|
Line 925 public class Upload extends JApplet impl
|
// System.out.println(sb); |
// System.out.println(sb); |
return sb; |
return sb; |
} |
} |
|
public static void writeChunked(Connection conTest,File f,int count,int fileCount,int fileSize,UploadInfo dialog) throws Exception |
|
{ |
|
InputStream r= conTest.in; |
|
FileOutputStream file_out = new FileOutputStream(f); |
|
BufferedOutputStream fout = new BufferedOutputStream(file_out); |
|
int c,countC=0,limit=conTest.in.available(); |
|
// r.skip(211); |
|
String response = conTest.getResponseMessage(); |
|
String lowerCase= response.toLowerCase(); |
|
int index =lowerCase.indexOf("charset"); |
|
int index2 =lowerCase.indexOf("=",index); |
|
int index3 =lowerCase.indexOf("\r",index2); |
|
String charset=(index>0) ? response.substring(index2+1,index3):""; |
|
charset="";//charset.toUpperCase(); |
|
System.err.println(response); |
|
dialog.title.setText("Downloading to " + f.toString()); |
|
dialog.progress.setValue(0); |
|
MessageDigest md =conTest.md; |
|
md.reset(); |
|
String fileName = f.getName()+ " " + ((fileSize > 1000000) ? (fileSize / 1048576) + " MByte" : fileSize+ " Bytes"); |
|
dialog.file.setText(fileName); |
|
dialog.status.setText(count + " of " + fileCount + ((fileCount > 1) ? " files" : " file")); |
|
//dialog.pack(); |
|
//dialog.validate(); |
|
if (dialog.isVisible()) |
|
dialog.repaint(); |
|
else |
|
dialog.show(); |
|
|
|
if(lowerCase.indexOf("chunked")<0) |
|
{ |
|
while(r.available()==0); |
|
System.err.println(r.available()); |
|
while ((c = r.read()) != -1) |
|
{ |
|
byte b=(byte)c; |
|
fout.write(b); |
|
//md.update(b, 0, b.length); |
|
if(debug) |
|
System.out.print((char)c); |
|
} |
|
/* |
|
if(charset!="") |
|
fout.write(local.toString(charset)); |
|
else |
|
fout.write(local.toString()); |
|
*/ |
|
//if(debug) |
|
// System.out.print(sb); |
|
//return sb; |
|
} |
|
StringBuffer sb = new StringBuffer(); |
|
// read chunk size |
|
while ((c = r.read()) != -1) |
|
{ |
|
++countC; |
|
char ch=(char)c; |
|
|
|
if(Character.digit(ch, 16) != -1) |
|
sb.append((char)c); |
|
if(ch=='\r') |
|
{ |
|
ch=(char)r.read(); |
|
if( ch=='\n') |
|
break; |
|
} |
|
// System.out.print((char)c); |
|
} |
|
int bufSize=Integer.parseInt(sb.toString().trim(), 16); |
|
|
|
System.err.println("chunk size "+Integer.parseInt(sb.toString().trim(), 16)+" bytes"+" limit "+limit); |
|
//sb.append((char)r.read()); |
|
// sb.append((char)r.read()); |
|
sb=new StringBuffer();//.delete(0,sb.length()); |
|
byte[] b=new byte[bufSize]; |
|
countC=0; |
|
StringBuffer localBuff=new StringBuffer(); |
|
while (true) |
|
{ |
|
// sb.append(" new Chunk "+r.available()+" \r\n "); |
|
int readCount = 0; |
|
int available = 0; |
|
int readSize = b.length; int loop=0; |
|
while (readCount < bufSize) |
|
{ |
|
available=r.available(); |
|
|
|
if(available>=bufSize) |
|
readSize=bufSize; |
|
else |
|
readSize=available; |
|
|
|
if(readCount + readSize > bufSize) |
|
{ |
|
readSize = r.read(b, readCount, bufSize - readCount); // mout.flush(); |
|
|
|
} |
|
else |
|
{ |
|
readSize = r.read(b,readCount,readSize); |
|
} |
|
if(loop>=200) throw new Error("Connection timed out"); |
|
if(readSize==0) |
|
{ |
|
long time = System.currentTimeMillis(); |
|
while(System.currentTimeMillis()-time<100); |
|
} else loop=0; |
|
|
|
if(debug) |
|
System.out.println(++loop+" read "+readCount+" bytes"+" readSize "+readSize); |
|
readCount+=readSize; |
|
|
|
} |
|
|
|
|
|
//while(r.available()<bufSize); // critical if connection closed |
|
// r.read(b,0,bufSize); |
|
//System.err.println(r.available()); |
|
r.read();r.read(); |
|
if(charset!="") |
|
fout.write(b,0,bufSize); |
|
// sb.append(new String(b,0,bufSize,charset)); |
|
else |
|
fout.write(b,0,bufSize); |
|
md.update(b, 0, bufSize); |
|
countC+=bufSize; |
|
dialog.progress.setValue((int) (((double) countC / (double) fileSize) * 100.0)); |
|
// if(debug) |
|
// System.out.println(new String(b,0,bufSize)); |
|
while ( (c = r.read()) != -1) |
|
{ |
|
// ++countC; |
|
char ch=(char)c; |
|
//System.err.println("read lf "+(ch=='\r')+" or cr "+( ch=='\n')+" "+(Character.digit(ch, 16) == -1)); |
|
//if((ch!='\r')&&( ch!='\n')) System.err.println("read ch "+" "+ch+" "+Character.isSpace(ch)); |
|
if(Character.digit(ch, 16) != -1) |
|
localBuff.append(ch); |
|
if(ch=='\r') |
|
{ |
|
ch=(char)r.read(); |
|
if( ch=='\n') |
|
break; |
|
} |
|
} |
|
if(debug) |
|
System.out.println("chunk size "+localBuff); |
|
if(localBuff.length()>0) |
|
{ |
|
// System.err.println("new chunk size "+Integer.parseInt(localBuff.toString().trim(), 16)+" bytes"); |
|
// System.err.println((char)r.read()); |
|
bufSize=Integer.parseInt(localBuff.toString().trim(), 16); |
|
//localBuff.delete(0,localBuff.length()); |
|
localBuff=new StringBuffer(); |
|
} // else bufSize=0; |
|
++countC; |
|
// sb.append("new Chunk"+r.available()+"\r\n "); |
|
if(bufSize==0)//(bufSize)) |
|
break; |
|
// System.err.println(" in Chunk "+bufSize+" buffers used "+(countC)+" \r\n "); |
|
// // System.out.print((char)c); |
|
} |
|
// System.out.println(sb); |
|
fout.flush(); |
|
fout.close(); |
|
|
|
file_out.close(); |
|
//return sb; |
|
} |
|
|
public static Hashtable getMetaData(String url) |
public static Hashtable getMetaData(String url) |
{ |
{ |
Hashtable data=new Hashtable(); |
Hashtable data=new Hashtable(); |
Line 1213 public class Upload extends JApplet impl
|
Line 1506 public class Upload extends JApplet impl
|
// getBundle("http://core.rz-berlin.mpg.de/edoctest/oi.epl?mm=list&grp=136"); |
// getBundle("http://core.rz-berlin.mpg.de/edoctest/oi.epl?mm=list&grp=136"); |
// getBundle("http://core.rz-berlin.mpg.de/edoctest/oi.epl?mm=list&grp=136"); |
// getBundle("http://core.rz-berlin.mpg.de/edoctest/oi.epl?mm=list&grp=136"); |
runningAsApplet=false; |
runningAsApplet=false; |
// Object[] options = new Object[] { "New Version for this file","New Version for all files", "Skip file" }; |
//Object[] options = new Object[] { "Cancel","Replace existing files", "Keep existing files" }; |
|
|
// int option = showDialog("Warning exists! \n What do you want to do?", "Destination exists!", options,null); |
|
|
|
|
// int option = showDialog("Warning : several files exist on the server \n Press show list to see the list! \n What do you want to do?", "Files exist!", options,null); |
|
//System.out.println("User selected "+options[option]); |
|
// System.exit(0); // due to now internet |
long time = System.currentTimeMillis(); |
long time = System.currentTimeMillis(); |
new Upload(); |
new Upload(); |
// bundle=getBundle("http://core.rz-berlin.mpg.de/edoctest/oi.epl?mm=list&grp=136&col=11"); |
// bundle=getBundle("http://core.rz-berlin.mpg.de/edoctest/oi.epl?mm=list&grp=136&col=11"); |
Line 1280 public class Upload extends JApplet impl
|
Line 1574 public class Upload extends JApplet impl
|
String ses=""; |
String ses=""; |
HttpURLConnection con; |
HttpURLConnection con; |
UploadInfo dialog = new UploadInfo(); |
UploadInfo dialog = new UploadInfo(); |
|
MessageDigest md ; |
|
|
public Connection(URL url) throws Exception |
public Connection(URL url) throws Exception |
{ |
{ |
Properties prop = System.getProperties(); |
Properties prop = System.getProperties(); |
Line 1315 public class Upload extends JApplet impl
|
Line 1611 public class Upload extends JApplet impl
|
in = new BufferedInputStream(socket.getInputStream(),2); |
in = new BufferedInputStream(socket.getInputStream(),2); |
out = new PrintStream(new BufferedOutputStream(socket.getOutputStream()),true); |
out = new PrintStream(new BufferedOutputStream(socket.getOutputStream()),true); |
this.url = url; |
this.url = url; |
|
try |
|
{ |
|
md = MessageDigest.getInstance("MD5"); |
|
|
|
} catch(Exception e) { e.printStackTrace();} |
|
|
} |
} |
public String getSessionID(String data) |
public String getSessionID(String data) |
{ |
{ |
Line 1489 public class Upload extends JApplet impl
|
Line 1791 public class Upload extends JApplet impl
|
System.out.println(sb); |
System.out.println(sb); |
if(sb.length()>0) |
if(sb.length()>0) |
addToBundle(bundleRef,sb); |
addToBundle(bundleRef,sb); |
try |
// updating document with edoc Data |
{ |
|
|
|
Bundle.Document newDoc =(Bundle.Document) bundleRef.docsLocator.get(doc.locator); |
Bundle.Document newDoc =(Bundle.Document) bundleRef.docsLocator.get(doc.locator); |
doc.md5cs=newDoc.md5cs; |
doc.md5cs=newDoc.md5cs; |
doc.size=newDoc.size; |
doc.size=newDoc.size; |
Line 1499 public class Upload extends JApplet impl
|
Line 1799 public class Upload extends JApplet impl
|
doc.docID=newDoc.docID; |
doc.docID=newDoc.docID; |
doc.ver=newDoc.ver; |
doc.ver=newDoc.ver; |
doc.fileVer=newDoc.fileVer; |
doc.fileVer=newDoc.fileVer; |
bundle.exportToXML(new File("./metaout.xml")); |
doc.modified = new File(filePath).lastModified(); |
} catch(Exception e7) { e7.printStackTrace();} |
|
} |
} |
|
|
public void sendFile(FileInputStream f,PrintStream out) throws Exception |
public void sendFile(FileInputStream f,PrintStream out) throws Exception |
Line 1508 public class Upload extends JApplet impl
|
Line 1808 public class Upload extends JApplet impl
|
int length=f.available(); |
int length=f.available(); |
md.reset(); |
md.reset(); |
dialog.progress.setValue(0); |
dialog.progress.setValue(0); |
byte[] b=new byte[512]; |
byte[] b=new byte[16204]; |
int readCount =0; |
int readCount =0; |
while (readCount < length) |
while (readCount < length) |
{ |
{ |