1 17 18 package org.apache.james.imapserver; 19 20 import org.apache.avalon.framework.logger.AbstractLogEnabled; 21 import org.apache.avalon.framework.logger.Logger; 22 import org.apache.james.services.User; 23 import org.apache.james.services.UsersRepository; 24 import org.apache.james.imapserver.store.ImapMailbox; 25 26 31 public final class ImapSessionImpl implements ImapSession 32 { 33 private ImapSessionState state = ImapSessionState.NON_AUTHENTICATED; 34 private User user = null; 35 private ImapMailbox selectedMailbox = null; 36 private boolean selectedIsReadOnly = false; 40 41 private String clientHostName; 42 private String clientAddress; 43 44 private ImapHandler handler; 46 private ImapHost imapHost; 47 private UsersRepository users; 48 49 public ImapSessionImpl( ImapHost imapHost, 50 UsersRepository users, 51 ImapHandler handler, 52 String clientHostName, 53 String clientAddress ) 54 { 55 this.imapHost = imapHost; 56 this.users = users; 57 this.handler = handler; 58 this.clientHostName = clientHostName; 59 this.clientAddress = clientAddress; 60 } 61 62 public ImapHost getHost() 63 { 64 return imapHost; 65 } 66 67 public void unsolicitedResponses( ImapResponse request ) 68 { 69 } 70 71 public void closeConnection() 72 { 73 handler.resetHandler(); 74 } 75 76 public UsersRepository getUsers() 77 { 78 return users; 79 } 80 81 public String getClientHostname() 82 { 83 return clientHostName; 84 } 85 86 public String getClientIP() 87 { 88 return clientAddress; 89 } 90 91 public void setAuthenticated( User user ) 92 { 93 this.state = ImapSessionState.AUTHENTICATED; 94 this.user = user; 95 } 96 97 public User getUser() 98 { 99 return this.user; 100 } 101 102 public void deselect() 103 { 104 this.state = ImapSessionState.AUTHENTICATED; 105 } 106 107 public void setSelected( ImapMailbox mailbox, boolean readOnly ) 108 { 109 this.state = ImapSessionState.SELECTED; 110 this.selectedMailbox = mailbox; 111 this.selectedIsReadOnly = readOnly; 112 } 113 114 public ImapMailbox getSelected() 115 { 116 return this.selectedMailbox; 117 } 118 119 public boolean selectedIsReadOnly() 120 { 121 return this.selectedIsReadOnly; 122 } 123 124 public ImapSessionState getState() 125 { 126 return this.state; 127 } 128 } 129 | Popular Tags |