ManagedServer.java
001 /*
002  *
003  * Licensed to the Apache Software Foundation (ASF) under one
004  * or more contributor license agreements.  See the NOTICE file
005  * distributed with this work for additional information
006  * regarding copyright ownership.  The ASF licenses this file
007  * to you under the Apache License, Version 2.0 (the
008  * "License"); you may not use this file except in compliance
009  * with the License.  You may obtain a copy of the License at
010  
011  *   http://www.apache.org/licenses/LICENSE-2.0
012  
013  * Unless required by applicable law or agreed to in writing,
014  * software distributed under the License is distributed on an
015  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016  * KIND, either express or implied.  See the License for the
017  * specific language governing permissions and limitations
018  * under the License.
019  *
020  */
021 package org.apache.qpid.management.ui;
022 
023 import static org.apache.qpid.management.ui.Constants.DEFAULT_PROTOCOL;
024 /**
025  * Class representing a server being managed eg. MBeanServer
026  @author Bhupendra Bhardwaj
027  */
028 public class ManagedServer extends ManagedObject
029 {
030     private String _host;
031     private int _port;
032     private String _url;
033     private String _domain;
034     private String _user;
035     private String _password;
036     private String _protocol = DEFAULT_PROTOCOL;
037 
038     public ManagedServer(String host, int port, String domain)
039     {
040         this(host, port, domain, null, null);
041     }
042     
043     public ManagedServer(String host, int port, String domain, String user, String password)
044     {
045         setName(host + ":" + port);
046         _host = host;
047         _port = port;
048         _domain = domain;
049         _url = getRMIURL(host, port);
050         _user = user;
051         _password = password;
052     }
053     
054     public String getDomain()
055     {
056         return _domain;
057     }
058 
059     public String getHost()
060     {
061         return _host;
062     }
063 
064     public int getPort()
065     {
066         return _port;
067     }
068 
069     public String getUrl()
070     {
071         return _url;
072     }
073     
074     public String getProtocol()
075     {
076         return _protocol;
077     }
078 
079     public String getPassword()
080     {
081         return _password;
082     }
083     
084     public void setPassword(String password)
085     {
086         _password = password;
087     }
088 
089     public String getUser()
090     {
091         return _user;
092     }
093     
094     public void setUser(String user)
095     {
096         _user = user;
097     }
098     
099     private String getRMIURL(String host, int port)
100     {
101         return "service:jmx:rmi:///jndi/rmi://" + host + ":" + port + "/jmxrmi";
102     }
103 }