ruper2/src/java/core/org/krysalis/ruper2/protocols VirtualResourceLocator.java,1.2,1.3

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

Modified Files:
	VirtualResourceLocator.java 
Log Message:
1) Made ResourceAnalysis extract the group (from grandparent dir)
2) Added some unit tests for this.

Index: VirtualResourceLocator.java
===================================================================
RCS file: /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper2/protocols/VirtualResourceLocator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** VirtualResourceLocator.java	8 Oct 2003 13:23:21 -0000	1.2
--- VirtualResourceLocator.java	8 Oct 2003 18:28:34 -0000	1.3
***************
*** 28,33 ****
  public class VirtualResourceLocator {
  
! 	public static final String VRL_CLASSNAME = VirtualResourceLocator.class.getName();
! 	
  	private String m_url = null;
  
--- 28,34 ----
  public class VirtualResourceLocator {
  
! 	public static final String VRL_CLASSNAME =
! 		VirtualResourceLocator.class.getName();
! 
  	private String m_url = null;
  
***************
*** 100,114 ****
  	}
  
!     public boolean equals(Object obj) {
!         boolean isEqual = false;
!         if( obj instanceof VirtualResourceLocator ) {
!             VirtualResourceLocator rhs = (VirtualResourceLocator) obj;
!             if( m_protocol.equals( rhs.m_protocol ) &&
!                     m_url.equals( rhs.m_url ) ) {
!                 isEqual = true;
!             }
!         }
!         return isEqual;
!     }
  
  	public static VirtualResourceLocator getTestVRL() {
--- 101,149 ----
  	}
  
! 	private String getURLNoEndingSlash() {
! 		String me = toExternalForm();
! 		int length = me.length();
! 		if (isDirectory())
! 			me = me.substring(0, length - 1);
! 		return me;
! 	}
! 
! 	public String getBasename() {
! 		String me = getURLNoEndingSlash();
! 
! 		int sepPosn = me.lastIndexOf('/');
! 		return (-1 == sepPosn) ? me : me.substring(sepPosn + 1);	}
! 
! 	public VirtualResourceLocator getParent() {
! 		String parentString = null;
! 
! 		String me = getURLNoEndingSlash();
! 		int sepPosn = me.lastIndexOf('/');
! 
! 		if (-1 != sepPosn)
! 			parentString = me.substring(0, sepPosn + 1);
! 
! 		return (null == parentString)
! 			? null
! 			: new VirtualResourceLocator(parentString);
! 	}
! 
! 	//
! 	// :TODO: A guess, at best
! 	//
! 	public boolean isDirectory() {
! 		return toExternalForm().endsWith("/");
! 	}
! 
! 	public boolean equals(Object obj) {
! 		boolean isEqual = false;
! 		if (obj instanceof VirtualResourceLocator) {
! 			VirtualResourceLocator rhs = (VirtualResourceLocator) obj;
! 			if (m_protocol.equals(rhs.m_protocol) && m_url.equals(rhs.m_url)) {
! 				isEqual = true;
! 			}
! 		}
! 		return isEqual;
! 	}
  
  	public static VirtualResourceLocator getTestVRL() {




-------------------------------------------------------
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.