1 48 49 package org.jpublish.util.uri; 50 51 import org.apache.commons.logging.Log; 52 import org.apache.commons.logging.LogFactory; 53 54 public class RepositoryURI extends InternalURI { 55 56 private Log log = LogFactory.getLog(RepositoryURI.class); 57 58 protected String repositoryName; 59 60 65 66 public String getRepositoryName() { 67 return repositoryName; 68 } 69 70 75 76 public void setRepositoryName(String repositoryName) { 77 this.repositoryName = repositoryName; 78 } 79 80 85 86 public String toURI() { 87 StringBuffer buffer = new StringBuffer (); 88 buffer.append(protocol); 89 buffer.append(":"); 90 buffer.append(repositoryName); 91 buffer.append("://"); 92 buffer.append(path); 93 return buffer.toString(); 94 } 95 96 101 102 public void setURI(String uriString) { 103 if (log.isDebugEnabled()) { 104 log.debug("setURI(" + uriString + ")"); 105 } 106 107 int protocolTerminatorIndex = uriString.indexOf(PROTOCOL_SEPARATOR); 108 int nameTerminatorIndex = uriString.indexOf(PROTOCOL_SEPARATOR, 109 protocolTerminatorIndex + 1); 110 111 protocol = uriString.substring(0, protocolTerminatorIndex); 112 repositoryName = uriString.substring(protocolTerminatorIndex + 1, 113 nameTerminatorIndex); 114 path = uriString.substring(nameTerminatorIndex + 115 URI_SEPARATOR.length()); 116 117 } 118 119 } 120 | Popular Tags |