View Javadoc

1   /**
2    * Copyright (C) 2005-2009 Alfresco Software Limited.
3    *
4    * This file is part of the Spring Surf Extension project.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *  http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package org.springframework.extensions.config;
20  
21  import java.util.List;
22  
23  import org.springframework.extensions.config.ConfigElement;
24  import org.springframework.extensions.config.ConfigException;
25  import org.springframework.extensions.config.element.ConfigElementAdapter;
26  
27  /**
28   * @author David Caruana
29   */
30  public class ServerConfigElement extends ConfigElementAdapter implements ServerProperties
31  {
32     public static final String CONFIG_ELEMENT_ID = "server";
33     
34     private String scheme = null;
35     private String hostname = null;
36     private Integer port = null;
37        
38     /**
39      * Default constructor
40      */
41     public ServerConfigElement()
42     {
43        super(CONFIG_ELEMENT_ID);
44     }
45  
46     /**
47      * Constructor
48      * 
49      * @param name Name of the element this config element represents
50      */
51     public ServerConfigElement(String name)
52     {
53        super(name);
54     }
55     
56     /**
57      * @see org.springframework.extensions.config.element.ConfigElementAdapter#getChildren()
58      */
59     public List<ConfigElement> getChildren()
60     {
61        throw new ConfigException("Reading the Server config via the generic interfaces is not supported");
62     }
63     
64     /**
65      * @see org.springframework.extensions.config.element.ConfigElementAdapter#combine(org.springframework.extensions.config.ConfigElement)
66      */
67     public ConfigElement combine(ConfigElement configElement)
68     {
69        ServerConfigElement newElement = (ServerConfigElement)configElement;
70        ServerConfigElement combinedElement = new ServerConfigElement();
71        
72        combinedElement.setScheme(newElement.getScheme());
73        combinedElement.setHostName(newElement.getHostName());
74        combinedElement.setPort(newElement.getPort());
75        
76        return combinedElement;
77     }
78     
79     /**
80      * @return  server scheme
81      */
82     public String getScheme()
83     {
84        return scheme;
85     }
86  
87     /**
88      * @param scheme
89      */
90     public void setScheme(String scheme)
91     {
92        this.scheme = scheme;
93     }
94        
95     /**
96      * @return  server hostname
97      */
98     public String getHostName()
99     {
100       return hostname;
101    }
102 
103    /**
104     * @param hostname
105     */
106    public void setHostName(String hostname)
107    {
108       this.hostname = hostname;
109    }
110 
111    /**
112     * @return  server port
113     */
114    public Integer getPort()
115    {
116       return port;
117    }
118 
119    /**
120     * @param port
121     */
122    public void setPort(Integer port)
123    {
124       this.port = port;
125    }
126 
127 }