1 23 24 package com.sun.enterprise.admin.servermgmt; 25 26 import java.util.HashMap ; 27 import java.util.Properties ; 28 import java.util.Iterator ; 29 30 import java.util.HashSet ; 31 import java.util.Set ; 32 import java.util.Map ; 33 34 import com.sun.enterprise.util.SystemPropertyConstants; 35 36 41 public class DomainConfig extends RepositoryConfig 42 { 43 49 public static final String K_USER = "domain.user"; 50 public static final String K_PASSWORD = "domain.password"; 51 public static final String K_NEW_MASTER_PASSWORD = "domain.newMasterPassword"; 52 public static final String K_MASTER_PASSWORD = "domain.masterPassword"; 53 public static final String K_SAVE_MASTER_PASSWORD = "domain.saveMasterPassword"; 54 public static final String K_ADMIN_PORT = "domain.adminPort"; 55 public static final String K_INSTANCE_PORT = "domain.instancePort"; 56 public static final String K_DOMAINS_ROOT = "domains.root"; 57 public static final String K_HOST_NAME = "domain.hostName"; 58 public static final String K_JMS_PASSWORD = "jms.password"; 59 public static final String K_JMS_PORT = "jms.port"; 60 public static final String K_JMS_USER = "jms.user"; 61 public static final String K_ORB_LISTENER_PORT = "orb.listener.port"; 62 public static final String K_SERVERID = "server.id"; 63 public static final String K_TEMPLATE_NAME = "template.name"; 64 public static final String K_HTTP_SSL_PORT = "http.ssl.port"; 65 public static final String K_IIOP_SSL_PORT = "orb.ssl.port"; 66 public static final String K_IIOP_MUTUALAUTH_PORT = "orb.mutualauth.port"; 67 public static final String K_DEBUG = "domain.debug"; 68 public static final String K_VERBOSE = "domain.verbose"; 69 public static final String K_VALIDATE_PORTS = "domain.validatePorts"; 70 public static final String K_JMX_PORT = "domain.jmxPort"; 74 public static final String K_EXTRA_PASSWORDS = "domain.extraPasswords"; 75 76 public static final int K_FLAG_START_DOMAIN_NEEDS_ADMIN_USER = 0x1; 77 78 82 public DomainConfig(String domainName, String domainRoot) throws DomainException 83 { 84 super(domainName, domainRoot); 85 try { 86 put(K_DOMAINS_ROOT, domainRoot); 87 put(K_HOST_NAME, System.getProperty(SystemPropertyConstants.HOST_NAME_PROPERTY)); 89 } catch (Exception ex) { 90 throw new DomainException(ex); 91 } 92 } 93 94 97 public DomainConfig(String domainName, Integer adminPort, String domainRoot, 98 String adminUser, String adminPassword, String masterPassword, 99 Boolean saveMasterPassword, Integer instancePort, 100 String jmsUser, String jmsPassword, Integer jmsPort, 101 Integer orbPort, Integer httpSSLPort, 102 Integer iiopSSLPort, Integer iiopMutualAuthPort, 103 Integer jmxAdminPort, 104 Properties domainProperties) throws DomainException 105 { 106 this(domainName, domainRoot); 107 try { 108 put(K_ADMIN_PORT, adminPort); 109 put(K_JMS_USER, jmsUser); 110 put(K_JMS_PASSWORD, jmsPassword); 111 put(K_PASSWORD, adminPassword); 112 put(K_MASTER_PASSWORD, masterPassword); 113 put(K_SAVE_MASTER_PASSWORD, saveMasterPassword); 114 put(K_USER, adminUser); 115 put(K_INSTANCE_PORT, instancePort); 116 put(K_JMS_PORT, jmsPort); 117 put(K_ORB_LISTENER_PORT, orbPort); 118 put(K_HTTP_SSL_PORT, httpSSLPort); 119 put(K_IIOP_SSL_PORT, iiopSSLPort); 120 put(K_IIOP_MUTUALAUTH_PORT, iiopMutualAuthPort); 121 put(K_JMX_PORT, jmxAdminPort); 122 123 if(domainProperties!=null) { 124 Iterator iterator = domainProperties.keySet().iterator(); 125 while (iterator.hasNext()) { 126 String key = (String )iterator.next(); 127 String value = (String )domainProperties.get(key); 128 put(key,value); 129 } 130 } 131 } catch (Exception ex) { 132 throw new DomainException(ex); 133 } 134 } 135 136 public String getDomainName() { 137 return super.getRepositoryName(); 138 } 139 140 public String getDomainRoot() 141 { 142 return super.getRepositoryRoot(); 143 } 144 145 public Map getPorts(){ 146 final Iterator it = ((Map ) this).keySet().iterator(); 147 final Map result = new HashMap (); 148 while (it.hasNext()){ 149 String key = (String ) it.next(); 150 if (key.toLowerCase().endsWith("port")){ 151 result.put(key, this.get(key)); 152 } 153 } 154 return result; 155 } 156 157 158 159 } 160 | Popular Tags |