File | Project | Line |
---|
org/apache/james/api/vut/management/VirtualUserTableManagementMBean.java | Apache JAMES Server User API | 47 |
org/apache/james/api/vut/management/VirtualUserTableManagementService.java | Apache JAMES Server User API | 45 |
public boolean addRegexMapping(String virtualUserTable, String user, String domain, String regex) throws VirtualUserTableManagementException;
/**
* Remove regex mapping
*
* @param virtualUserTable The virtualUserTable
* @param user the username. Null if no username should be used
* @param domain the domain. Null if no domain should be used
* @param regex the regex.
* @return true if successfully
* @throws VirtualUserTableManagementException get thrown if an invalid argument was given
*/
public boolean removeRegexMapping(String virtualUserTable, String user,String domain, String regex) throws VirtualUserTableManagementException;
/***
* Add address mapping
*
* @param virtualUserTable The virtualUserTable
* @param user the username. Null if no username should be used
* @param domain the domain. Null if no domain should be used
* @param address
* @return true if successfully
* @throws VirtualUserTableManagementException get thrown if an invalid argument was given
*/
public boolean addAddressMapping(String virtualUserTable, String user, String domain, String address) throws VirtualUserTableManagementException;
/**
* Remove address mapping
*
* @param virtualUserTable The virtualUserTable
* @param user the username. Null if no username should be used
* @param domain the domain. Null if no domain should be used
* @param address
* @return true if successfully
* @throws VirtualUserTableManagementException get thrown if an invalid argument was given
*/
public boolean removeAddressMapping(String virtualUserTable, String user,String domain, String address) throws VirtualUserTableManagementException;
/**
* Add error mapping
*
* @param virtualUserTable The virtualUserTable
* @param user the username. Null if no username should be used
* @param domain the domain. Null if no domain should be used
* @param error
* @return true if successfully
* @throws VirtualUserTableManagementException get thrown if an invalid argument was given
*/
public boolean addErrorMapping(String virtualUserTable, String user, String domain, String error) throws VirtualUserTableManagementException;
/**
* Remove error mapping
*
* @param virtualUserTable The virtualUserTable
* @param user the username. Null if no username should be used
* @param domain the domain. Null if no domain should be used
* @param error
* @return true if successfully
* @throws VirtualUserTableManagementException get thrown if an invalid argument was given
*/
public boolean removeErrorMapping(String virtualUserTable, String user,String domain, String error) throws VirtualUserTableManagementException;
/**
* Return the explicit mapping stored for the given user and domain. Return null
* if no mapping was found
*
* @param virtualUserTable The virtualUserTable
* @param user the username
* @param domain the domain
* @return the collection which holds the mappings.
* @throws VirtualUserTableManagementException get thrown if an invalid use or domain was given
*/
public Collection getUserDomainMappings(String virtualUserTable, String user, String domain) throws VirtualUserTableManagementException;
/**
* Try to identify the right method based on the prefix of the mapping and add it.
*
* @param virtualUserTable The virtualUserTable
* @param user the username. Null if no username should be used
* @param domain the domain. Null if no domain should be used
* @param mapping the mapping.
* @return true if successfully
* @throws VirtualUserTableManagementException get thrown if an invalid argument was given
*/
public boolean addMapping(String virtualUserTable, String user, String domain, String mapping) throws VirtualUserTableManagementException;
/**
* Try to identify the right method based on the prefix of the mapping and remove it.
*
* @param virtualUserTable The virtualUserTable
* @param user the username. Null if no username should be used
* @param domain the domain. Null if no domain should be used
* @param mapping the mapping.
* @return true if successfully
* @throws VirtualUserTableManagementException get thrown if an invalid argument was given
*/
public boolean removeMapping(String virtualUserTable, String user, String domain, String mapping) throws VirtualUserTableManagementException; |
File | Project | Line |
---|
org/apache/james/transport/mailets/AbstractRedirect.java | Apache JAMES Server Mailets function | 400 |
org/apache/james/transport/mailets/Redirect.java | Apache JAMES Server Mailets function | 335 |
String addressList = getInitParameter("recipients",getInitParameter("to"));
// if nothing was specified, return <CODE>null</CODE> meaning no change
if (addressList == null) {
return null;
}
try {
InternetAddress[] iaarray = InternetAddress.parse(addressList, false);
for (int i = 0; i < iaarray.length; i++) {
String addressString = iaarray[i].getAddress();
MailAddress specialAddress = getSpecialAddress(addressString,
new String[] {"postmaster", "sender", "from", "replyTo", "reversePath", "unaltered", "recipients", "to", "null"});
if (specialAddress != null) {
newRecipients.add(specialAddress);
} else {
newRecipients.add(new MailAddress(iaarray[i]));
}
}
} catch (Exception e) {
throw new MessagingException("Exception thrown in getRecipients() parsing: " + addressList, e);
}
if (newRecipients.size() == 0) {
throw new MessagingException("Failed to initialize \"recipients\" list; empty <recipients> init parameter found.");
}
return newRecipients;
}
/**
* @return the <CODE>to</CODE> init parameter
* or the postmaster address
* or <CODE>SpecialAddress.SENDER</CODE>
* or <CODE>SpecialAddress.REVERSE_PATH</CODE>
* or <CODE>SpecialAddress.UNALTERED</CODE>
* or the <CODE>recipients</CODE> init parameter if missing
* or <CODE>null</CODE> if also the latter is missing
*/
protected InternetAddress[] getTo() throws MessagingException { |
File | Project | Line |
---|
org/apache/james/transport/mailets/Forward.java | Apache JAMES Server Mailets function | 120 |
org/apache/james/transport/mailets/Redirect.java | Apache JAMES Server Mailets function | 340 |
}
try {
InternetAddress[] iaarray = InternetAddress.parse(addressList, false);
for (int i = 0; i < iaarray.length; i++) {
String addressString = iaarray[i].getAddress();
MailAddress specialAddress = getSpecialAddress(addressString,
new String[] {"postmaster", "sender", "from", "replyTo", "reversePath", "unaltered", "recipients", "to", "null"});
if (specialAddress != null) {
newRecipients.add(specialAddress);
} else {
newRecipients.add(new MailAddress(iaarray[i]));
}
}
} catch (Exception e) {
throw new MessagingException("Exception thrown in getRecipients() parsing: " + addressList, e);
}
if (newRecipients.size() == 0) {
throw new MessagingException("Failed to initialize \"recipients\" list; empty <recipients> init parameter found.");
}
return newRecipients;
}
/**
* @return the <CODE>to</CODE> init parameter
* or the postmaster address
* or <CODE>SpecialAddress.SENDER</CODE>
* or <CODE>SpecialAddress.REVERSE_PATH</CODE>
* or <CODE>SpecialAddress.UNALTERED</CODE>
* or the <CODE>recipients</CODE> init parameter if missing
* or <CODE>null</CODE> if also the latter is missing
*/
protected InternetAddress[] getTo() throws MessagingException { |
File | Project | Line |
---|
org/apache/james/pop3server/ListCmdHandler.java | Apache JAMES Server POP3 function | 100 |
org/apache/james/pop3server/UidlCmdHandler.java | Apache JAMES Server POP3 function | 76 |
.append(mc.getName());
session.writeResponse(responseBuffer.toString());
} else {
StringBuffer responseBuffer =
new StringBuffer(64)
.append(POP3Handler.ERR_RESPONSE)
.append(" Message (")
.append(num)
.append(") already deleted.");
session.writeResponse(responseBuffer.toString());
}
} catch (IndexOutOfBoundsException npe) {
StringBuffer responseBuffer =
new StringBuffer(64)
.append(POP3Handler.ERR_RESPONSE)
.append(" Message (")
.append(num)
.append(") does not exist.");
session.writeResponse(responseBuffer.toString());
} catch (NumberFormatException nfe) {
StringBuffer responseBuffer =
new StringBuffer(64)
.append(POP3Handler.ERR_RESPONSE)
.append(" ")
.append(argument)
.append(" is not a valid number");
session.writeResponse(responseBuffer.toString());
} |
File | Project | Line |
---|
org/apache/james/util/bayesian/BayesianAnalyzer.java | Apache JAMES Server Common Utilities | 372 |
org/apache/james/util/bayesian/BayesianAnalyzer.java | Apache JAMES Server Common Utilities | 424 |
String token;
String header = "";
//Build a Map of tokens encountered.
while ((token = nextToken(stream)) != null) {
boolean endingLine = false;
if (token.length() > 0 && token.charAt(token.length() - 1) == '\n') {
endingLine = true;
token = token.substring(0, token.length() - 1);
}
if (token.length() > 0 && header.length() + token.length() < 90 && !allDigits(token)) {
if (token.equals("From:")
|| token.equals("Return-Path:")
|| token.equals("Subject:")
|| token.equals("To:")
) {
header = token;
if (!endingLine) {
continue;
}
}
token = header + token; |
File | Project | Line |
---|
org/apache/james/pop3server/POP3HandlerChain.java | Apache JAMES Server POP3 function | 175 |
org/apache/james/smtpserver/SMTPHandlerChain.java | Apache JAMES Server SMTP function | 314 |
}
/**
* Add it to map (key as command name, value is an array list of commandhandlers)
*
* @param commandName the command name which will be key
* @param cmdHandler The commandhandler object
*/
private void addToMap(String commandName, CommandHandler cmdHandler) {
ArrayList handlers = (ArrayList)commandHandlerMap.get(commandName);
if(handlers == null) {
handlers = new ArrayList();
commandHandlerMap.put(commandName, handlers);
}
handlers.add(cmdHandler);
}
/**
* Returns all the configured commandhandlers for the specified command
*
* @param command the command name which will be key
* @return List of commandhandlers
*/
List getCommandHandlers(String command) {
if (command == null) {
return null;
}
if (getLogger().isDebugEnabled()) {
getLogger().debug("Lookup command handler for command: " + command);
}
List handlers = (List)commandHandlerMap.get(command);
if(handlers == null) {
handlers = (List)commandHandlerMap.get(UnknownCmdHandler.UNKNOWN_COMMAND);
}
return handlers;
}
/**
* Returns all the configured message handlers
*
* @return List of message handlers
*/
List getMessageHandlers() {
return messageHandlers;
}
/**
* Returns all the configured connect handlers
*
* @return List of connect handlers
*/
List getConnectHandlers() {
return connectHandlers;
}
} |
File | Project | Line |
---|
org/apache/james/nntpserver/NNTPHandler.java | Apache JAMES Server NNTP function | 768 |
org/apache/james/nntpserver/NNTPHandler.java | Apache JAMES Server NNTP function | 899 |
.append("221 0 ")
.append(param);
helper.writeLoggedFlushedResponse(respBuffer.toString());
}
} else {
int newArticleNumber = currentArticleNumber;
if ( group == null ) {
helper.writeLoggedFlushedResponse("412 no newsgroup selected");
return;
} else {
if ( param == null ) {
if ( currentArticleNumber < 0 ) {
helper.writeLoggedFlushedResponse("420 no current article selected");
return;
} else {
article = group.getArticle(currentArticleNumber);
}
}
else {
newArticleNumber = Integer.parseInt(param);
article = group.getArticle(newArticleNumber);
}
if ( article == null ) {
helper.writeLoggedFlushedResponse("423 no such article number in this group");
return;
} else {
currentArticleNumber = newArticleNumber;
String articleID = article.getUniqueID();
if (articleID == null) {
articleID = "<0>";
}
StringBuffer respBuffer =
new StringBuffer(128)
.append("221 ") |
File | Project | Line |
---|
org/apache/james/transport/mailets/AbstractRedirect.java | Apache JAMES Server Mailets function | 405 |
org/apache/james/transport/mailets/Forward.java | Apache JAMES Server Mailets function | 120 |
}
try {
InternetAddress[] iaarray = InternetAddress.parse(addressList, false);
for (int i = 0; i < iaarray.length; i++) {
String addressString = iaarray[i].getAddress();
MailAddress specialAddress = getSpecialAddress(addressString,
new String[] {"postmaster", "sender", "from", "replyTo", "reversePath", "unaltered", "recipients", "to", "null"});
if (specialAddress != null) {
newRecipients.add(specialAddress);
} else {
newRecipients.add(new MailAddress(iaarray[i]));
}
}
} catch (Exception e) {
throw new MessagingException("Exception thrown in getRecipients() parsing: " + addressList, e);
}
if (newRecipients.size() == 0) {
throw new MessagingException("Failed to initialize \"recipients\" list; empty <recipients> init parameter found.");
}
return newRecipients;
}
/**
* @return null
*/
protected InternetAddress[] getTo() throws MessagingException { |
File | Project | Line |
---|
org/apache/james/transport/mailets/WhiteListManager.java | Apache JAMES Server Mailets function | 743 |
org/apache/james/transport/matchers/IsInWhiteList.java | Apache JAMES Server Mailets function | 226 |
theJDBCUtil.closeJDBCConnection(conn);
}
}
/** Gets the main name of a local customer, handling alias */
private String getPrimaryName(String originalUsername) {
String username;
try {
username = localusers.getRealName(originalUsername);
JamesUser user = (JamesUser) localusers.getUserByName(username);
if (user.getAliasing()) {
username = user.getAlias();
}
}
catch (Exception e) {
username = originalUsername;
}
return username;
}
/**
* Initializes the sql query environment from the SqlResources file.
* Will look for conf/sqlResources.xml.
* Will <I>not</I> create the database resources, if missing
* (this task is done, if needed, in the {@link WhiteListManager}
* initialization routine).
* @param conn The connection for accessing the database
* @param mailetContext The current mailet context,
* for finding the conf/sqlResources.xml file
* @throws Exception If any error occurs
*/
private void initSqlQueries(Connection conn, org.apache.mailet.MailetContext mailetContext) throws Exception {
try {
if (conn.getAutoCommit()) {
conn.setAutoCommit(false);
}
this.sqlFile = new File((String) mailetContext.getAttribute("confDir"), "sqlResources.xml").getCanonicalFile();
sqlQueries.init(this.sqlFile, "WhiteList" , conn, getSqlParameters()); |
File | Project | Line |
---|
org/apache/james/util/bayesian/JDBCBayesianAnalyzer.java | Apache JAMES Server Common Utilities | 393 |
org/apache/james/transport/mailets/WhiteListManager.java | Apache JAMES Server Mailets function | 793 |
dbUpdated = createTable(conn, "whiteListTableName", "createWhiteListTable");
//Commit our changes if necessary.
if (conn != null && dbUpdated && !conn.getAutoCommit()) {
conn.commit();
dbUpdated = false;
}
}
private boolean createTable(Connection conn, String tableNameSqlStringName, String createSqlStringName) throws SQLException {
String tableName = sqlQueries.getSqlString(tableNameSqlStringName, true);
DatabaseMetaData dbMetaData = conn.getMetaData();
// Try UPPER, lower, and MixedCase, to see if the table is there.
if (theJDBCUtil.tableExists(dbMetaData, tableName)) {
return false;
}
PreparedStatement createStatement = null;
try {
createStatement =
conn.prepareStatement(sqlQueries.getSqlString(createSqlStringName, true));
createStatement.execute();
StringBuffer logBuffer = null;
logBuffer =
new StringBuffer(64)
.append("Created table '")
.append(tableName)
.append("' using sqlResources string '")
.append(createSqlStringName)
.append("'."); |
File | Project | Line |
---|
org/apache/james/transport/mailets/AbstractRedirect.java | Apache JAMES Server Mailets function | 480 |
org/apache/james/transport/mailets/Redirect.java | Apache JAMES Server Mailets function | 375 |
String addressList = getInitParameter("to",getInitParameter("recipients"));
// if nothing was specified, return null meaning no change
if (addressList == null) {
return null;
}
try {
iaarray = InternetAddress.parse(addressList, false);
for(int i = 0; i < iaarray.length; ++i) {
String addressString = iaarray[i].getAddress();
MailAddress specialAddress = getSpecialAddress(addressString,
new String[] {"postmaster", "sender", "from", "replyTo", "reversePath", "unaltered", "recipients", "to", "null"});
if (specialAddress != null) {
iaarray[i] = specialAddress.toInternetAddress();
}
}
} catch (Exception e) {
throw new MessagingException("Exception thrown in getTo() parsing: " + addressList, e);
}
if (iaarray.length == 0) {
throw new MessagingException("Failed to initialize \"to\" list; empty <to> init parameter found.");
}
return iaarray;
}
/**
* @return the <CODE>reversePath</CODE> init parameter
* or the postmaster address
* or <CODE>SpecialAddress.SENDER</CODE>
* or <CODE>SpecialAddress.NULL</CODE>
* or <CODE>null</CODE> if missing
*/
protected MailAddress getReversePath() throws MessagingException { |
File | Project | Line |
---|
org/apache/james/nntpserver/NNTPHandler.java | Apache JAMES Server NNTP function | 770 |
org/apache/james/nntpserver/NNTPHandler.java | Apache JAMES Server NNTP function | 969 |
helper.writeLoggedResponse(respBuffer.toString());
}
} else {
int newArticleNumber = currentArticleNumber;
if ( group == null ) {
helper.writeLoggedFlushedResponse("412 no newsgroup selected");
return;
} else {
if ( param == null ) {
if ( currentArticleNumber < 0 ) {
helper.writeLoggedFlushedResponse("420 no current article selected");
return;
} else {
article = group.getArticle(currentArticleNumber);
}
}
else {
newArticleNumber = Integer.parseInt(param);
article = group.getArticle(newArticleNumber);
}
if ( article == null ) {
helper.writeLoggedFlushedResponse("423 no such article number in this group");
return;
} else {
currentArticleNumber = newArticleNumber;
String articleID = article.getUniqueID();
if (articleID == null) {
articleID = "<0>";
}
StringBuffer respBuffer =
new StringBuffer(128)
.append("220 ") |
File | Project | Line |
---|
org/apache/james/transport/mailets/WhiteListManager.java | Apache JAMES Server Mailets function | 528 |
org/apache/james/transport/mailets/WhiteListManager.java | Apache JAMES Server Mailets function | 651 |
log("Removal request issued by " + senderMailAddress);
}
//Commit our changes if necessary.
if (conn != null && dbUpdated && !conn.getAutoCommit()) {
conn.commit() ;
dbUpdated = false;
}
}
else {
out.println("The message must be plain - no action");
}
out.println();
out.println("Finished");
sendReplyFromPostmaster(mail, sout.toString());
} catch (SQLException sqle) {
out.println("Error accessing the database");
sendReplyFromPostmaster(mail, sout.toString());
throw new MessagingException("Error accessing the database", sqle);
} catch (IOException ioe) {
out.println("Error getting message content");
sendReplyFromPostmaster(mail, sout.toString());
throw new MessagingException("Error getting message content", ioe);
} finally {
theJDBCUtil.closeJDBCStatement(selectStmt);
theJDBCUtil.closeJDBCStatement(deleteStmt); |
File | Project | Line |
---|
org/apache/james/vut/JDBCVirtualUserTable.java | Apache JAMES Server Avalon User function | 170 |
org/apache/james/mailrepository/JDBCMailRepository.java | Apache JAMES Server Core function | 298 |
Connection conn = datasource.getConnection();
PreparedStatement createStatement = null;
try {
// Initialise the sql strings.
InputStream sqlFile = null;
try {
sqlFile = fileSystem.getResource(sqlFileName);
} catch (Exception e) {
getLogger().fatalError(e.getMessage(), e);
throw e;
}
if (getLogger().isDebugEnabled()) {
logBuffer =
new StringBuffer(128)
.append("Reading SQL resources from file: ")
.append(sqlFileName)
.append(", section ")
.append(this.getClass().getName())
.append(".");
getLogger().debug(logBuffer.toString());
}
// Build the statement parameters
Map sqlParameters = new HashMap();
if (tableName != null) {
sqlParameters.put("table", tableName);
} |
File | Project | Line |
---|
org/apache/james/transport/mailets/BayesianAnalysis.java | Apache JAMES Server Mailets function | 230 |
org/apache/james/transport/mailets/BayesianAnalysisFeeder.java | Apache JAMES Server Mailets function | 189 |
initDb();
}
private void initDb() throws MessagingException {
try {
ServiceManager serviceManager = (ServiceManager) getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
// Get the DataSourceSelector block
DataSourceSelector datasources = (DataSourceSelector) serviceManager.lookup(DataSourceSelector.ROLE);
// Get the data-source required.
int stindex = repositoryPath.indexOf("://") + 3;
String datasourceName = repositoryPath.substring(stindex);
datasource = (DataSourceComponent) datasources.select(datasourceName);
} catch (Exception e) {
throw new MessagingException("Can't get datasource", e);
}
try {
analyzer.initSqlQueries(datasource.getConnection(), getMailetContext().getAttribute("confDir") + "/sqlResources.xml");
} catch (Exception e) {
throw new MessagingException("Exception initializing queries", e);
} |
File | Project | Line |
---|
org/apache/james/transport/mailets/AbstractRedirect.java | Apache JAMES Server Mailets function | 1031 |
org/apache/james/transport/mailets/DSNBounce.java | Apache JAMES Server Mailets function | 217 |
setRecipients(newMail, getRecipients(originalMail), originalMail);
setTo(newMail, getTo(originalMail), originalMail);
setSubjectPrefix(newMail, getSubjectPrefix(originalMail), originalMail);
if(newMail.getMessage().getHeader(RFC2822Headers.DATE) == null) {
newMail.getMessage().setHeader(RFC2822Headers.DATE,rfc822DateFormat.format(new Date()));
}
setReplyTo(newMail, getReplyTo(originalMail), originalMail);
setReversePath(newMail, getReversePath(originalMail), originalMail);
setSender(newMail, getSender(originalMail), originalMail);
setIsReply(newMail, isReply(originalMail), originalMail);
newMail.getMessage().saveChanges(); |
File | Project | Line |
---|
org/apache/james/util/XMLResources.java | Apache JAMES Server Common Utilities | 142 |
org/apache/james/util/sql/SqlResources.java | Apache JAMES Server Common Utilities | 184 |
.append(sqlDefsSection)
.append("\' does not exist.");
throw new RuntimeException(exceptionBuffer.toString());
}
// Get parameters defined within the file as defaults,
// and use supplied parameters as overrides.
Map parameters = new HashMap();
// First read from the <params> element, if it exists.
Element parametersElement =
(Element)(sectionElement.getElementsByTagName("parameters").item(0));
if ( parametersElement != null ) {
NamedNodeMap params = parametersElement.getAttributes();
int paramCount = params.getLength();
for (int i = 0; i < paramCount; i++ ) {
Attr param = (Attr)params.item(i);
String paramName = param.getName();
String paramValue = param.getValue();
parameters.put(paramName, paramValue);
}
}
// Then copy in the parameters supplied with the call.
parameters.putAll(configParameters);
// 2 maps - one for storing default statements,
// the other for statements with a "db" attribute matching this
// connection.
Map defaultSqlStatements = new HashMap(); |
File | Project | Line |
---|
org/apache/james/transport/mailets/WhiteListManager.java | Apache JAMES Server Mailets function | 333 |
org/apache/james/transport/mailets/WhiteListManager.java | Apache JAMES Server Mailets function | 485 |
String recipientUser = recipientMailAddress.getUser().toLowerCase(Locale.US);
String recipientHost = recipientMailAddress.getHost().toLowerCase(Locale.US);
if (getMailetContext().isLocalServer(recipientHost)) {
// not a remote recipient, so skip
continue;
}
if (conn == null) {
conn = datasource.getConnection();
}
if (selectStmt == null) {
selectStmt = conn.prepareStatement(selectByPK);
}
selectStmt.setString(1, senderUser);
selectStmt.setString(2, senderHost);
selectStmt.setString(3, recipientUser);
selectStmt.setString(4, recipientHost);
selectRS = selectStmt.executeQuery();
if (selectRS.next()) { |
File | Project | Line |
---|
org/apache/james/pop3server/RetrCmdHandler.java | Apache JAMES Server POP3 function | 74 |
org/apache/james/pop3server/TopCmdHandler.java | Apache JAMES Server POP3 function | 102 |
writeMessageContentTo(mc.getMessage(),nouts,lines);
nouts.flush();
edouts.checkCRLFTerminator();
edouts.flush();
} finally {
session.writeResponse(".");
}
} else {
StringBuffer responseBuffer =
new StringBuffer(64)
.append(POP3Handler.ERR_RESPONSE)
.append(" Message (")
.append(num)
.append(") already deleted.");
responseString = responseBuffer.toString();
session.writeResponse(responseString);
}
} catch (IOException ioe) {
responseString = POP3Handler.ERR_RESPONSE + " Error while retrieving message.";
session.writeResponse(responseString);
} catch (MessagingException me) {
responseString = POP3Handler.ERR_RESPONSE + " Error while retrieving message.";
session.writeResponse(responseString);
} catch (IndexOutOfBoundsException iob) {
StringBuffer exceptionBuffer = |
File | Project | Line |
---|
org/apache/james/pop3server/POP3HandlerChain.java | Apache JAMES Server POP3 function | 149 |
org/apache/james/smtpserver/SMTPHandlerChain.java | Apache JAMES Server SMTP function | 127 |
}
}
// the size must be greater than 1 because we added UnknownCmdHandler to
// the map
if (commandHandlerMap.size() < 2) {
if (getLogger().isErrorEnabled()) {
getLogger().error("No commandhandlers configured");
}
throw new ConfigurationException("No commandhandlers configured");
} else {
boolean found = true;
for (int i = 0; i < mandatoryCommands.length; i++) {
if (!commandHandlerMap.containsKey(mandatoryCommands[i])) {
if (getLogger().isErrorEnabled()) {
getLogger().error(
"No commandhandlers configured for the command:"
+ mandatoryCommands[i]);
}
found = false;
break;
}
}
if (!found) {
throw new ConfigurationException(
"No commandhandlers configured for mandatory commands");
} |
File | Project | Line |
---|
org/apache/james/transport/mailets/JDBCAlias.java | Apache JAMES Server Mailets function | 89 |
org/apache/james/transport/mailets/JDBCVirtualUserTable.java | Apache JAMES Server Mailets function | 128 |
try {
ServiceManager componentManager = (ServiceManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
// Get the DataSourceSelector service
DataSourceSelector datasources = (DataSourceSelector)componentManager.lookup(DataSourceSelector.ROLE);
// Get the data-source required.
datasource = (DataSourceComponent)datasources.select(datasourceName);
conn = datasource.getConnection();
// Check if the required table exists. If not, complain.
DatabaseMetaData dbMetaData = conn.getMetaData();
// Need to ask in the case that identifiers are stored, ask the DatabaseMetaInfo.
// Try UPPER, lower, and MixedCase, to see if the table is there.
if (!(theJDBCUtil.tableExists(dbMetaData, tableName))) {
StringBuffer exceptionBuffer =
new StringBuffer(128)
.append("Could not find table '")
.append(tableName)
.append("' in datasource '")
.append(datasourceName)
.append("'");
throw new MailetException(exceptionBuffer.toString());
} |
File | Project | Line |
---|
org/apache/james/transport/mailets/WhiteListManager.java | Apache JAMES Server Mailets function | 333 |
org/apache/james/transport/mailets/WhiteListManager.java | Apache JAMES Server Mailets function | 608 |
String recipientUser = recipientMailAddress.getUser().toLowerCase(Locale.US);
String recipientHost = recipientMailAddress.getHost().toLowerCase(Locale.US);
if (getMailetContext().isLocalServer(recipientHost)) {
// not a remote recipient, so skip
continue;
}
if (conn == null) {
conn = datasource.getConnection();
}
if (selectStmt == null) {
selectStmt = conn.prepareStatement(selectByPK);
}
selectStmt.setString(1, senderUser);
selectStmt.setString(2, senderHost);
selectStmt.setString(3, recipientUser);
selectStmt.setString(4, recipientHost);
selectRS = selectStmt.executeQuery();
if (!selectRS.next()) { |
File | Project | Line |
---|
org/apache/james/mailrepository/JDBCMailRepository.java | Apache JAMES Server Core function | 523 |
org/apache/james/mailrepository/JDBCMailRepository.java | Apache JAMES Server Core function | 627 |
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
try {
if (mc instanceof MailImpl) {
oos.writeObject(((MailImpl)mc).getAttributesRaw());
} else {
HashMap temp = new HashMap();
for (Iterator i = mc.getAttributeNames(); i.hasNext(); ) {
String hashKey = (String) i.next();
temp.put(hashKey,mc.getAttribute(hashKey));
}
oos.writeObject(temp);
}
oos.flush();
ByteArrayInputStream attrInputStream =
new ByteArrayInputStream(baos.toByteArray()); |
File | Project | Line |
---|
org/apache/james/util/bayesian/JDBCBayesianAnalyzer.java | Apache JAMES Server Common Utilities | 399 |
org/apache/james/smtpserver/core/filter/fastfail/GreylistHandler.java | Apache JAMES Server SMTP function | 619 |
}
}
/**
* Create the table if not exists.
*
* @param conn
* The connection
* @param tableNameSqlStringName
* The tableSqlname
* @param createSqlStringName
* The createSqlname
* @return true or false
* @throws SQLException
*/
private boolean createTable(Connection conn, String tableNameSqlStringName,
String createSqlStringName) throws SQLException {
String tableName = sqlQueries.getSqlString(tableNameSqlStringName, true);
DatabaseMetaData dbMetaData = conn.getMetaData();
// Try UPPER, lower, and MixedCase, to see if the table is there.
if (theJDBCUtil.tableExists(dbMetaData, tableName)) {
return false;
}
PreparedStatement createStatement = null;
try {
createStatement = conn.prepareStatement(sqlQueries.getSqlString(createSqlStringName, true));
createStatement.execute();
StringBuffer logBuffer = null;
logBuffer = new StringBuffer(64).append("Created table '").append(tableName)
.append("' using sqlResources string '")
.append(createSqlStringName).append("'."); |
File | Project | Line |
---|
org/apache/james/smtpserver/core/DataCmdHandler.java | Apache JAMES Server SMTP function | 153 |
org/apache/james/smtpserver/core/SendMailHandler.java | Apache JAMES Server SMTP function | 100 |
StringBuffer errorBuffer =
new StringBuffer(256)
.append("Rejected message from ")
.append(session.getState().get(SMTPSession.SENDER).toString())
.append(" from host ")
.append(session.getRemoteHost())
.append(" (")
.append(session.getRemoteIPAddress())
.append(") exceeding system maximum message size of ")
.append(session.getConfigurationData().getMaxMessageSize());
getLogger().error(errorBuffer.toString());
} else {
responseString = "451 "+DSNStatus.getStatus(DSNStatus.TRANSIENT,DSNStatus.UNDEFINED_STATUS)+" Error processing message."; |
File | Project | Line |
---|
org/apache/james/domain/JDBCDomainList.java | Apache JAMES Server Core function | 167 |
org/apache/james/mailrepository/JDBCMailRepository.java | Apache JAMES Server Core function | 307 |
} catch (Exception e) {
getLogger().fatalError(e.getMessage(), e);
throw e;
}
if (getLogger().isDebugEnabled()) {
logBuffer =
new StringBuffer(128)
.append("Reading SQL resources from file: ")
.append(sqlFileName)
.append(", section ")
.append(this.getClass().getName())
.append(".");
getLogger().debug(logBuffer.toString());
}
// Build the statement parameters
Map sqlParameters = new HashMap();
if (tableName != null) {
sqlParameters.put("table", tableName);
} |
File | Project | Line |
---|
org/apache/james/util/XMLResources.java | Apache JAMES Server Common Utilities | 278 |
org/apache/james/util/sql/SqlResources.java | Apache JAMES Server Common Utilities | 346 |
private String substituteSubString( String input,
String find,
String replace )
{
int find_length = find.length();
int replace_length = replace.length();
StringBuffer output = new StringBuffer(input);
int index = input.indexOf(find);
int outputOffset = 0;
while ( index > -1 ) {
output.replace(index + outputOffset, index + outputOffset + find_length, replace);
outputOffset = outputOffset + (replace_length - find_length);
index = input.indexOf(find, index + find_length);
}
String result = output.toString();
return result;
}
/**
* Returns a named SQL string for the specified connection,
* replacing parameters with the values set.
*
* @param name the name of the SQL resource required.
* @return the requested resource
*/
public String getSqlString(String name) |
File | Project | Line |
---|
org/apache/james/mailrepository/AbstractMailRepository.java | Apache JAMES Server Core function | 112 |
org/apache/james/mailrepository/javamail/AbstractJavamailStoreMailRepository.java | Apache JAMES Server Core function | 253 |
if (getLock().lock(key)) {
if ((DEEP_DEBUG) && (getLogger().isDebugEnabled())) {
StringBuffer debugBuffer = new StringBuffer(256).append(
"Locked ").append(key).append(" for ").append(
Thread.currentThread().getName()).append(" @ ").append(
new java.util.Date(System.currentTimeMillis()));
getLogger().debug(debugBuffer.toString());
}
return true;
} else {
return false;
}
}
/**
* Releases a lock on a message identified by a key
*
* @param key
* the key of the message to be unlocked
*
* @return true if successfully released the lock, false otherwise
*/
public boolean unlock(String key) { |
File | Project | Line |
---|
org/apache/james/mailrepository/AbstractMailRepository.java | Apache JAMES Server Core function | 90 |
org/apache/james/mailrepository/javamail/AbstractJavamailStoreMailRepository.java | Apache JAMES Server Core function | 276 |
if (getLock().unlock(key)) {
if ((DEEP_DEBUG) && (getLogger().isDebugEnabled())) {
StringBuffer debugBuffer = new StringBuffer(256).append(
"Unlocked ").append(key).append(" for ").append(
Thread.currentThread().getName()).append(" @ ").append(
new java.util.Date(System.currentTimeMillis()));
getLogger().debug(debugBuffer.toString());
}
return true;
} else {
return false;
}
}
/**
* Removes a specified message
*
* @param mail
* the message to be removed from the repository
* @throws MessagingException
*/
public void remove(Mail mail) throws MessagingException { |
File | Project | Line |
---|
org/apache/james/transport/mailets/CommandListservManager.java | Apache JAMES Server Mailets function | 416 |
org/apache/james/transport/mailets/CommandListservProcessor.java | Apache JAMES Server Mailets function | 452 |
}
/**
* Retrieves a data field, potentially defined by a super class.
* @return null if not found, the object otherwise
*/
protected static Object getField(Object instance, String name) throws IllegalAccessException {
Class clazz = instance.getClass();
Field[] fields;
while (clazz != null) {
fields = clazz.getDeclaredFields();
for (int index = 0; index < fields.length; index++) {
Field field = fields[index];
if (field.getName().equals(name)) {
field.setAccessible(true);
return field.get(instance);
}
}
clazz = clazz.getSuperclass();
}
return null;
} |