Methods Summary |
---|
private static void | addClientHostNameProperty2SystemJmxConnector(com.sun.enterprise.config.serverbeans.Config someConfig)
final com.sun.enterprise.config.serverbeans.AdminService as = someConfig.getAdminService();
final JmxConnector jc = as.getJmxConnectorByName(IAdminConstants.SYSTEM_CONNECTOR_NAME);
final String hostValue = System.getProperty(SystemPropertyConstants.HOST_NAME_PROPERTY);
final String hostName = IAdminConstants.HOST_PROPERTY_NAME;
ElementProperty ep = jc.getElementPropertyByName(hostName);
if (ep == null) {
ep = new ElementProperty();
ep.setName(hostName);
ep.setValue(hostValue);
jc.addElementProperty(ep);
} else {
ep.setValue(hostValue);
}
|
private static void | addClusterSupportElements(com.sun.enterprise.config.ConfigContext acc)
final Domain domain = ConfigAPIHelper.getDomainConfigBean(acc);
domain.setClusters(domain.newClusters());
domain.setNodeAgents(domain.newNodeAgents());
domain.setLoadBalancers(domain.newLoadBalancers());
domain.setLbConfigs(domain.newLbConfigs());
|
public void | addClusteringSupportUsingProfile(java.lang.String profile)
final ConfigContext acc = MBeanRegistryFactory.getAdminContext().getAdminConfigContext();
if (ServerHelper.isClusterAdminSupported(acc)) {
final String msg = localStrings.getString("domain.supports.cluster");
throw new ConfigException(msg);
}
try {
final Config defaultConfig = getTemplateConfig(profile);
addConfig(acc, defaultConfig);
addClusterSupportElements(acc);
configurAdminServer(acc);
} catch(final Exception e) {
throw new ConfigException(e);
}
|
private static void | addConfig(com.sun.enterprise.config.ConfigContext acc, com.sun.enterprise.config.serverbeans.Config dc)
final Configs configs = ConfigAPIHelper.getDomainConfigBean(acc).getConfigs();
dc.setName(SystemPropertyConstants.TEMPLATE_CONFIG_NAME);
configs.addConfig(dc);
configureDefaultJmsHost(dc);
addClientHostNameProperty2SystemJmxConnector(dc);
|
private void | checkAutoStartSupported()
if (!isAutoStartSupported()) {
String msg = localStrings.getString(
"admin.mbeans.domain.autostart_not_supported");
throw new MBeanConfigException(msg);
}
|
private static void | configurAdminServer(com.sun.enterprise.config.ConfigContext acc)
final Config dasc = ServerHelper.getConfigForServer(acc, SystemPropertyConstants.DEFAULT_SERVER_INSTANCE_NAME);
final JavaConfig jc = dasc.getJavaConfig();
jc.addJvmOptions("-Djavax.management.builder.initial=com.sun.enterprise.ee.admin.AppServerMBeanServerBuilder");
jc.addJvmOptions("-Dcom.sun.appserv.pluggable.features=com.sun.enterprise.ee.server.pluggable.EEPluggableFeatureImpl");
addClientHostNameProperty2SystemJmxConnector(dasc);
|
private static void | configureDefaultJmsHost(com.sun.enterprise.config.serverbeans.Config tc)
//this configures the default_JMS_Host's attributes
//default JMS Host is pointed to by the default-jms-host attribute of jms-service.
final JmsService js = tc.getJmsService();
final String jmshn = js.getDefaultJmsHost();
final JmsHost jmsh = js.getJmsHostByName(jmshn);
jmsh.setAdminUserName(IASJmsUtil.DEFAULT_USER);
jmsh.setAdminPassword(IASJmsUtil.DEFAULT_PASSWORD);
jmsh.setHost(System.getProperty(SystemPropertyConstants.HOST_NAME_PROPERTY));
//don't set the port as it is "tokenized" appropriately
|
private boolean | disableAutoStart()
File autoStartFile = getAutoStartFile();
boolean success = true;
if (autoStartFile.exists()) {
success = autoStartFile.delete();
}
return success;
|
private boolean | enableAutoStart()
File autoStartFile = getAutoStartFile();
boolean success = false;
try {
if (!autoStartFile.exists()) {
success = autoStartFile.createNewFile();
} else {
success = true;
}
} catch (IOException ioe) {
_sLogger.log(Level.FINE, "mbean.autostart_ioexception", ioe);
_sLogger.log(Level.WARNING, "mbean.autostart_enable_error",
new Object[] {autoStartFile, ioe.getMessage()});
}
return success;
|
private static boolean | exists(com.sun.enterprise.config.serverbeans.Config[] configs, java.lang.String configNamed)
boolean exists = false;
for (final Config c : configs) {
if (c.getName().equals(configNamed)) {
exists = true;
break;
}
}
return ( exists );
|
private java.io.File | getAutoStartFile()
return new File(getConfigDir(), AUTOSTART_FILENAME);
|
public java.lang.String | getConfigDir()Returns the absolute path of the config directory.
InstanceEnvironment env =
ApplicationServer.getServerContext().getInstanceEnvironment();
return env.getConfigDirPath();
|
public javax.management.AttributeList | getDefaultAttributeValues(java.lang.String mbeanTypeName, java.lang.String[] attrNames)
if(mbeanTypeName==null)
return null;
try {
MBeanRegistryEntry entry = m_registry.findMBeanRegistryEntryByType(mbeanTypeName);
if(attrNames==null)
{
attrNames = entry.getAttributeNames();
if(attrNames==null || attrNames.length<1)
return null;
}
MBeanNamingDescriptor descr = entry.getNamingDescriptor();
String className = descr.getMBeanClassName();
Class cl = Class.forName(className);
Method method = null;
try {
method = cl.getDeclaredMethod("getDefaultAttributeValues", new Class[]{(new String[0]).getClass()});
return (AttributeList)method.invoke(null, new Object[]{attrNames});
} catch (Exception e)
{
//no custom implementation - just ignore
}
// standard
return ConfigMBeanHelper.getDefaultAttributeValues(descr, attrNames);
} catch (Exception e)
{
_sLogger.fine("getDefaultAttributeValues(): Exception for mbeanTypeName:"+mbeanTypeName);
return null;
}
|
public javax.management.AttributeList | getDefaultCustomProperties(java.lang.String mbeanTypeName, javax.management.AttributeList attributeList)
if(mbeanTypeName==null)
return null;
try {
MBeanRegistryEntry entry = m_registry.findMBeanRegistryEntryByType(mbeanTypeName);
MBeanNamingDescriptor descr = entry.getNamingDescriptor();
String className = descr.getMBeanClassName();
Class cl = Class.forName(className);
Method method = cl.getDeclaredMethod("getDefaultCustomProperties", new Class[]{Class.forName("javax.management.AttributeList")});
return (AttributeList)method.invoke(null, new Object[]{attributeList});
} catch (Exception e)
{
_sLogger.fine("getDefaultCustomProperties(): Exception for mbeanTypeName:"+mbeanTypeName);
return null;
}
|
public java.lang.String | getName()Returns the name of this domain.
String name = null;
try {
name = System.getProperty(SystemPropertyConstants.DOMAIN_NAME);
} catch (Exception e) {
String msg = localStrings.getString(
"admin.mbeans.domain.get_name_failed")
+ " " + e.getLocalizedMessage();
throw new MBeanConfigException(msg);
}
if (name == null) {
String msg = localStrings.getString(
"admin.mbeans.domain.get_name_failed");
throw new MBeanConfigException(msg);
}
return name;
|
private com.sun.enterprise.config.serverbeans.Config | getTemplateConfig(java.lang.String profile)
final RepositoryConfig myRepos = new RepositoryConfig(); //all system properties are taken care of.
final PEFileLayout layout = new PEFileLayout(myRepos);
final File profileDomainXmlTemplate = layout.getPreExistingDomainXmlTemplateForProfile(profile);
if (! profileDomainXmlTemplate.exists()) {
final String msg = localStrings.getString("template.domain.xml.not.found",
profileDomainXmlTemplate.getAbsolutePath(), profile);
throw new IllegalArgumentException(msg);
}
final ConfigContext tcc = ConfigFactory.createConfigContext(profileDomainXmlTemplate.getAbsolutePath(), true);
//this created a config context from which we can just borrow the config element.
final String tcn = SystemPropertyConstants.TEMPLATE_CONFIG_NAME;
if (! exists(ConfigAPIHelper.getConfigsInDomain(tcc), tcn)) {
final String msg = localStrings.getString("template.config.not.found", tcn, profileDomainXmlTemplate.getAbsolutePath());
throw new IllegalArgumentException(msg);
}
final Config tc = ConfigAPIHelper.getConfigByName(tcc, tcn); // this has to exist
return ( (Config)tc.clone() ); //cloning is required
|
public boolean | isAutoStartEnabled()Is auto start enabled for this domain.
checkAutoStartSupported();
File autoStartFile = getAutoStartFile();
return autoStartFile.exists();
|
public boolean | isAutoStartSupported()Is autostart feature supported for this domain. Enabling autostart will
result in a domain being started up at the time of machine startup
(boot). The autostart feature is supported only on domains in default
domain directory of Solaris bundled release.
if (OS.isUnix()) {
if (getConfigDir().startsWith(BUNDLED_DOMAINS_ROOT)) {
return true;
}
}
return false;
|
public java.lang.String | resolveTokens(java.lang.String value, java.lang.String instanceName)Resolve tokens of the form ${..} in value.
return resolveTokens(value, instanceName, false);
|
public java.lang.String | resolveTokens(java.lang.String value, java.lang.String instanceName, boolean bResolvePathesAsWell)Resolve tokens of the form ${..} in value.
//FIXME: bResolvePathesAsWell=true is working correct only for DAS
if(instanceName==null)
{
instanceName=MBeanRegistryFactory.getAdminContext().getServerName();
}
PropertyResolver resolver = new PropertyResolver(getConfigContext(), instanceName);
return resolver.resolve(value, bResolvePathesAsWell);
|
public void | setAutoStartEnabled(boolean state)Set autostart enabled state.
checkAutoStartSupported();
boolean success = (state ? enableAutoStart() : disableAutoStart());
if (!success) {
String msg = localStrings.getString(
"admin.mbeans.domain.set_autostart_failed");
throw new MBeanConfigException(msg);
}
|