1 17 18 package org.apache.james.imapserver; 19 20 import org.apache.avalon.framework.component.Component; 21 import org.apache.avalon.framework.activity.Initializable; 22 import org.apache.james.imapserver.AuthenticationException; 23 24 import java.net.InetAddress ; 25 import java.net.UnknownHostException ; 26 import java.util.Collections ; 27 import java.util.HashSet ; 28 import java.util.Iterator ; 29 import java.util.Set ; 30 31 37 public class SimpleSystem 38 implements IMAPSystem, Component, Initializable { 39 40 private static final String namespaceToken = "#"; 41 private static final String hierarchySeparator = "."; 42 private static final String namespace 43 = "((\"#mail.\" \".\")) ((\"#users.\" \".\")) ((\"#shared.\" \".\"))"; 44 45 private static String singleServer; 46 private Set servers = new HashSet (); 47 48 51 public void initialize() throws Exception { 52 String hostName = null; 53 try { 54 hostName = InetAddress.getLocalHost().getHostName(); 55 } catch (UnknownHostException ue) { 56 hostName = "localhost"; 57 } 58 singleServer = hostName; 59 servers.add(singleServer); 60 } 61 62 67 public String getNamespaceToken() { 68 return namespaceToken; 69 } 70 71 82 public String getHomeServer(String username) 83 throws AuthenticationException { 84 return singleServer; 85 } 86 87 97 public String getHierarchySeperator(String namespace) { 98 return hierarchySeparator; 99 } 100 101 112 public String getNamespaces(String username) { 113 return namespace; 114 } 115 116 124 public Iterator getAccessibleServers(String username) { 125 return Collections.unmodifiableSet(servers).iterator(); 126 } 127 } 128 | Popular Tags |