1 23 24 package com.sun.enterprise.admin.servermgmt.pe; 25 import java.util.Map ; 26 import java.util.Vector ; 27 import java.util.Iterator ; 28 import java.io.File ; 29 30 import com.iplanet.ias.installer.core.installConfig; 31 import com.iplanet.ias.installer.core.ServerConfig; 32 import com.sun.enterprise.admin.servermgmt.DomainsManager; 33 import com.sun.enterprise.admin.servermgmt.InstancesManager; 34 import com.sun.enterprise.admin.servermgmt.DomainConfig; 35 import com.sun.enterprise.admin.servermgmt.DomainException; 36 37 public class PEWebCoreDomainsManager extends DomainsManager 38 { 39 private static final String SERVER_ID = "server"; 40 41 public PEWebCoreDomainsManager() 42 { 43 } 44 45 public void createDomain(String domainName, Map domainConfig) 46 throws DomainException 47 { 48 50 ServerConfig sc = createServerConfig(domainConfig); 52 53 File domainDir = new File (sc.domainRoot); 55 domainDir.mkdirs(); 56 57 installConfig instconf = new installConfig(); 59 60 instconf.createServerInstance(sc); 62 } 63 64 private void validate(Map domainConfig) throws DomainException 65 { 66 final String domainRoot = 67 (String )domainConfig.get(DomainConfig.K_DOMAIN_ROOT); 68 if ((domainRoot == null) || (domainRoot.length() == 0)) 69 { 70 throw new DomainException("Invalid domain root"); 71 } 72 78 } 79 80 public void deleteDomain(String domainName, Map domainConfig) 81 throws DomainException 82 { 83 String domainRoot = (String ) domainConfig.get(DomainConfig.K_DOMAIN_ROOT); 84 try { 85 installConfig instconf = new installConfig(); 86 instconf.deleteDomain(domainName, domainRoot); 87 } catch(java.io.IOException ioe) { 88 throw new DomainException("Error deleting domain: "+domainName); 89 } 90 } 91 92 public void startDomain(String domainName, Map domainConfig) 93 throws DomainException 94 { 95 } 96 97 public void stopDomain(String domainName, Map domainConfig) 98 throws DomainException 99 { 100 } 101 102 105 public String [] listDomains() 106 { 107 String [] domains = new String [0]; 108 return domains; 109 } 110 111 public InstancesManager getInstancesManager(String domainName) 112 { 113 throw new UnsupportedOperationException ("Not Supported for PE"); 114 } 115 116 public boolean isDomainExists(String domainName, String domainRoot) 117 { 118 return new File (domainRoot, domainName).exists(); 119 } 120 121 private ServerConfig createServerConfig(Map domainConfig) 122 { 123 ServerConfig sc = new ServerConfig(); 124 sc.defaultLocale = (String ) domainConfig.get(DomainConfig.K_DEFAULTLOCALE); 125 sc.icuLib = (String ) domainConfig.get(DomainConfig.K_ICULIB); 126 sc.webServicesLib = (String ) domainConfig.get(DomainConfig.K_WEBSVCSLIB); 127 sc.perlRoot = (String ) domainConfig.get(DomainConfig.K_PERLROOT); 128 sc.serverID = PEWebCoreDomainsManager.SERVER_ID; 129 sc.serverPort = ((Integer ) domainConfig.get(DomainConfig.K_INSTANCE_PORT)).intValue(); 130 sc.adminPort = ((Integer ) domainConfig.get(DomainConfig.K_ADMIN_PORT)).intValue(); 131 sc.serverRoot = (String ) domainConfig.get(DomainConfig.K_INSTALL_ROOT); 132 sc.domainRoot = (String ) domainConfig.get(DomainConfig.K_DOMAIN_ROOT); 133 sc.serverUser = (String ) domainConfig.get(DomainConfig.K_SVRUSER); 134 sc.serverUserFlag = ((Boolean ) domainConfig.get(DomainConfig.K_SVRUSERFLAG)).booleanValue(); 135 sc.serverName = (String ) domainConfig.get(DomainConfig.K_SVRNAME); 136 sc.domainName = (String ) domainConfig.get(DomainConfig.K_DOMAIN_NAME); 137 sc.mailHost = (String ) domainConfig.get(DomainConfig.K_MAIL_HOST); 138 sc.docRoot = sc.domainRoot + File.separator + "docroot"; 139 140 sc.jmsPort = ((Integer ) domainConfig.get(DomainConfig.K_JMS_PORT)).intValue(); 141 sc.jmsUser = (String ) domainConfig.get(DomainConfig.K_JMS_USER); 142 sc.jmsPasswd = (String ) domainConfig.get(DomainConfig.K_JMS_PASSWORD); 143 sc.imqBin = (String ) domainConfig.get(DomainConfig.K_IMQ_BIN); 144 sc.imqLib = (String ) domainConfig.get(DomainConfig.K_IMQ_LIB); 145 sc.javaHome = (String ) domainConfig.get(DomainConfig.K_JAVA_HOME); 146 sc.orbListenerPort = ((Integer ) domainConfig.get(DomainConfig.K_ORB_LISTENER_PORT)).intValue(); 147 sc.configRoot = (String ) domainConfig.get(DomainConfig.K_CFG_ROOT); 148 sc.adminName = (String ) domainConfig.get(DomainConfig.K_USER); 149 sc.adminPasswd = (String ) domainConfig.get(DomainConfig.K_PASSWORD); 150 sc.ldapUser = (String ) domainConfig.get(DomainConfig.K_LDAP_USER); 151 sc.ldapURL = (String ) domainConfig.get(DomainConfig.K_LDAP_URL); 152 sc.ldapPasswd = (String ) domainConfig.get(DomainConfig.K_LDAP_PASSWD); 153 sc.ldapDN = (String ) domainConfig.get(DomainConfig.K_LDAP_DN); 154 155 return sc; 156 } 157 } 158 | Popular Tags |