From: <fza...@us...> - 2005-11-29 23:08:40
|
Update of /cvsroot/struts/ajaxchat/WEB-INF/src/org/apache/struts/apps/ajaxchat In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21020/WEB-INF/src/org/apache/struts/apps/ajaxchat Added Files: AjaxChatConfig.java package.html Log Message: --- NEW FILE: AjaxChatConfig.java --- /* * Copyright 2005 Frank W. Zammetti * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.struts.apps.ajaxchat; import java.lang.reflect.Field; /** * This class stores static application configuration information read in from * the app-config.xml file at startup. It is then accessible to all classes * that need it. * * @author <a href="mailto:fza...@om...">Frank W. Zammetti</a>. */ public class AjaxChatConfig { /** * The maximum number of messages to keep in the messages collection in * any given room. */ private static int maxMessages; /** * Constructor. */ public AjaxChatConfig() { } // End constructor. /** * Return the maxMessages field. * * @return Maximum number of messages to keep in the messages collection in * any given room. */ public static int getMaxMessages() { return maxMessages; } // End getMaxMessages(). /** * Set the maxMessages field. * * @param inMaxMessages New value of the maxMessages field. */ public void setMaxMessages(int inMaxMessages) { maxMessages = inMaxMessages; } // End setMaxMessages(). /** * Overriden toString method. * * @return A reflexively-built string representation of this bean. */ public String toString() { String str = null; StringBuffer sb = new StringBuffer(1000); sb.append("[" + super.toString() + "]={"); boolean firstPropertyDisplayed = false; try { Field[] fields = this.getClass().getDeclaredFields(); for (int i = 0; i < fields.length; i++) { if (firstPropertyDisplayed) { sb.append(", "); } else { firstPropertyDisplayed = true; } sb.append(fields[i].getName() + "=" + fields[i].get(this)); } sb.append("}"); str = sb.toString().trim(); } catch (IllegalAccessException iae) { iae.printStackTrace(); } return str; } // End toString(). } // End class. --- NEW FILE: package.html --- <body> The org.apache.struts.apps.ajaxchat.ajaxchat package contains general-purpose classes for the AjaxChat application, including the AjaxChatConfig class which holds static application configuration information. </body> |