ruper2/src/java/core/org/krysalis/ruper2/protocols/impl HttpClientProtocolOperationsProvider.java,1.1,1.2 BasicProtocolOperationsProvider.java,1.3,1.4

[email protected]
Newsgroups gmane.comp.krysalis.metamorphosis.cvs
Message-ID <[email protected]>
Update of /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper2/protocols/impl
In directory sc8-pr-cvs1:/tmp/cvs-serv25339/src/java/core/org/krysalis/ruper2/protocols/impl

Modified Files:
	HttpClientProtocolOperationsProvider.java 
	BasicProtocolOperationsProvider.java 
Log Message:
Opps, did it for HTTP input but not File input. Added that.

Index: HttpClientProtocolOperationsProvider.java
===================================================================
RCS file: /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper2/protocols/impl/HttpClientProtocolOperationsProvider.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** HttpClientProtocolOperationsProvider.java	9 Oct 2003 20:30:27 -0000	1.1
--- HttpClientProtocolOperationsProvider.java	9 Oct 2003 21:15:01 -0000	1.2
***************
*** 10,14 ****
--- 10,17 ----
  import org.krysalis.ruper2.impl.ResourceUpdaterContext;
  import org.krysalis.ruper2.protocols.Protocol;
+ import org.krysalis.ruper2.util.io.FileUtils;
  import org.krysalis.ruper2.util.io.HtmlUtils;
+ import org.krysalis.ruper2.util.io.IOUtils;
+ import org.krysalis.ruper2.util.io.ResolvedFile;
  import org.krysalis.ruper2.util.net.VirtualResourceLocator;
  import org.krysalis.ruper2.util.net.http.HttpClientUserAgent;
***************
*** 36,47 ****
  
  	public boolean exists(VirtualResourceLocator container) throws Exception {
! 		return m_agent.exists(container.toExternalForm());
  	}
  
  	public List list(VirtualResourceLocator container, ISelector selector)
  		throws Exception {
! 		return HtmlUtils.getChildren(
! 			container,
! 			m_agent.getContents(container.toExternalForm()));
  	}
  
--- 39,74 ----
  
  	public boolean exists(VirtualResourceLocator container) throws Exception {
! 		boolean exists = false;
! 
! 		if (Protocol.isHTTP(container.getProtocol()))
! 			exists = m_agent.exists(container.toExternalForm());
! 		else
! 			exists = container.getFile().exists();
! 
! 		return exists;
  	}
  
  	public List list(VirtualResourceLocator container, ISelector selector)
  		throws Exception {
! 		List children = null;
! 
! 		if (Protocol.isHTTP(container.getProtocol())) {
! 			children =
! 				HtmlUtils.getChildren(
! 					container,
! 					m_agent.getContents(container.toExternalForm()));
! 		}
! 		else {
! 			File folder = container.getFile();
! 			File files[] = folder.listFiles();
! 			for (int i = 0; i < files.length; ++i) {
! 				File file = files[i];
! 				children.add(
! 					new VirtualResourceLocator(
! 						ResolvedFile.resolve(folder, file)));
! 			}
! 		}
! 
! 		return children;
  	}
  
***************
*** 51,81 ****
  		ISelector selector)
  		throws Exception {
! 		File toFile = new File(to.toString());
! 
  		// Build Folders to this Folder
  		toFile.getParentFile().mkdirs();
- 
- 		// Copy data...
- 		FileOutputStream stream = null;
- 
  		try {
! 			stream = new FileOutputStream(toFile);
! 
! 			m_agent.transferContents(from.toExternalForm(), stream);
! 
! 		}
! 		catch (Exception e) {
! 			// Attempt at cleanup
! 			try {
! 				toFile.delete();
  			}
! 			catch (Exception ee) {
  			}
  		}
! 		finally {
! 			// Close
  			try {
! 				if (null != stream)
! 					stream.close();
  			}
  			catch (Exception ee) {
--- 78,103 ----
  		ISelector selector)
  		throws Exception {
! 		File toFile = to.getFile();
  		// Build Folders to this Folder
  		toFile.getParentFile().mkdirs();
  		try {
! 			if (Protocol.isHTTP(from.getProtocol())) { // Copy data...
! 				FileOutputStream stream = null;
! 				try {
! 					stream = new FileOutputStream(toFile);
! 					m_agent.transferContents(from.toExternalForm(), stream);
! 				}
! 				finally {
! 					IOUtils.close(stream);
! 				}
  			}
! 			else {
! 				FileUtils.transfer(from.getFile(), toFile);
  			}
+ 
  		}
! 		catch (Exception e) { // Attempt at cleanup
  			try {
! 				toFile.delete();
  			}
  			catch (Exception ee) {

Index: BasicProtocolOperationsProvider.java
===================================================================
RCS file: /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper2/protocols/impl/BasicProtocolOperationsProvider.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** BasicProtocolOperationsProvider.java	9 Oct 2003 16:02:20 -0000	1.3
--- BasicProtocolOperationsProvider.java	9 Oct 2003 21:15:02 -0000	1.4
***************
*** 33,37 ****
  		boolean exists = false;
  		
! 		URL url = container.getResourceLocator();
  
  		// :TODO: Get URL contents and list
--- 33,37 ----
  		boolean exists = false;
  		
! 		URL url = container.getURL();
  
  		// :TODO: Get URL contents and list
***************
*** 43,47 ****
  		throws Exception {
  		List results = null;
! 		URL url = container.getResourceLocator();
  
  		// :TODO: Get URL contents and list
--- 43,47 ----
  		throws Exception {
  		List results = null;
! 		URL url = container.getURL();
  
  		// :TODO: Get URL contents and list
***************
*** 55,60 ****
  		ISelector selector)
  		throws Exception {
! 		URL url1 = from.getResourceLocator();
! 		URL url2 = to.getResourceLocator();
  
  		// :TODO: Get URL contents and write to a file...
--- 55,60 ----
  		ISelector selector)
  		throws Exception {
! 		URL url1 = from.getURL();
! 		URL url2 = to.getURL();
  
  		// :TODO: Get URL contents and write to a file...




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.