001package org.andromda.core.configuration;
002
003import java.io.Serializable;
004import org.apache.commons.lang.StringUtils;
005
006/**
007 * Represents the configuration for the
008 * AndroMDA server.
009 *
010 * @author Chad Brandon
011 */
012public class Server
013    implements Serializable
014{
015    private static final long serialVersionUID = 34L;
016
017    /**
018     * Stores the port the server should be run on.
019     */
020    private int port;
021
022    /**
023     * The port the server should be run on.
024     *
025     * @return Returns the port.
026     */
027    public int getPort()
028    {
029        return port;
030    }
031
032    /**
033     * The port the server should be run on.
034     *
035     * @param port The port to set.
036     */
037    public void setPort(final String port)
038    {
039        if (StringUtils.isNotBlank(port))
040        {
041            this.port = Integer.parseInt(port);
042        }
043    }
044
045    /**
046     * The host the server is running on.
047     */
048    private String host;
049
050    /**
051     * gets the host the server should be run on.
052     *
053     * @return Returns the host.
054     */
055    public String getHost()
056    {
057        return host;
058    }
059
060    /**
061     * Sets the host the server should be run on.
062     *
063     * @param host The host to set.
064     */
065    public void setHost(String host)
066    {
067        this.host = host;
068    }
069
070    /**
071     * The interval at which the server loads
072     * model(s) (if a load is required).
073     */
074    private int loadInterval = 1000;
075
076    /**
077     * Gets the interval at which model(s) are
078     * loaded (if required).
079     *
080     * @return Returns the model Load interval
081     */
082    public int getLoadInterval()
083    {
084        return loadInterval;
085    }
086
087    /**
088     * Sets the interval at which model(s) should be
089     * loaded (if an initial load or Load is required).
090     *
091     * @param loadInterval The loadInterval to set.
092     */
093    public void setLoadInterval(final String loadInterval)
094    {
095        if (StringUtils.isNotBlank(loadInterval))
096        {
097            this.loadInterval = Integer.parseInt(loadInterval);
098        }
099    }
100
101    /**
102     * The maximum number of failed model load attempts
103     * that can occur before we fail.
104     */
105    private int maximumFailedLoadAttempts = 10;
106
107    /**
108     * Gets the maximum number of failed model load attempts
109     * that can occur before we fail.
110     *
111     * @return Returns the maximumFailedLoadAttempts.
112     */
113    public int getMaximumFailedLoadAttempts()
114    {
115        return this.maximumFailedLoadAttempts;
116    }
117
118    /**
119     * Sets the maximum number of failed model load attempts
120     * that can occur before we fail.
121     *
122     * @param maximumFailedLoadAttempts The maximumFailedLoadAttempts to set.
123     */
124    public void setMaximumFailedLoadAttempts(final String maximumFailedLoadAttempts)
125    {
126        if (StringUtils.isNotBlank(maximumFailedLoadAttempts))
127        {
128            this.maximumFailedLoadAttempts = Integer.parseInt(maximumFailedLoadAttempts);
129        }
130    }
131}