use of com.sun.enterprise.config.serverbeans.Server in project Payara by payara.
the class DomainXml method decorate.
protected void decorate() {
Server server = habitat.getService(Server.class, env.getInstanceName());
if (server == null) {
LogRecord lr = new LogRecord(Level.SEVERE, badEnv);
lr.setLoggerName(getClass().getName());
EarlyLogHandler.earlyMessages.add(lr);
return;
}
ServiceLocatorUtilities.addOneConstant(habitat, server, ServerEnvironment.DEFAULT_INSTANCE_NAME, Server.class);
server.getConfig().addIndex(habitat, ServerEnvironment.DEFAULT_INSTANCE_NAME);
Cluster c = server.getCluster();
if (c != null) {
ServiceLocatorUtilities.addOneConstant(habitat, c, ServerEnvironment.DEFAULT_INSTANCE_NAME, Cluster.class);
}
}
use of com.sun.enterprise.config.serverbeans.Server in project Payara by payara.
the class AttributeRemovalTest method deprecatedWrite.
@Test
public void deprecatedWrite() throws TransactionFailure {
final Server server = getHabitat().getService(Server.class);
final String value = server.getNodeRef();
logger.fine("node-ref is " + server.getNodeRef());
ConfigSupport.apply(new SingleConfigCode<Server>() {
@Override
public Object run(Server s) throws PropertyVetoException, TransactionFailure {
s.setNodeAgentRef(value);
return null;
}
}, server);
logger.fine("node-agent-ref is " + server.getNodeAgentRef());
// restore
ConfigSupport.apply(new SingleConfigCode<Server>() {
@Override
public Object run(Server s) throws PropertyVetoException, TransactionFailure {
s.setNodeAgentRef(null);
return null;
}
}, server);
logger.fine("after, node-agent-ref is " + server.getNodeAgentRef());
}
use of com.sun.enterprise.config.serverbeans.Server in project Payara by payara.
the class AttributeRemovalTest method readOnlyRemovalTest.
@Test(expected = PropertyVetoException.class)
public void readOnlyRemovalTest() throws TransactionFailure, PropertyVetoException {
Server server = getHabitat().getService(Server.class);
logger.fine("config-ref is " + server.getConfigRef());
try {
server.setConfigRef(null);
} catch (PropertyVetoException e) {
if (logger.isLoggable(Level.FINE))
e.printStackTrace();
throw e;
}
}
use of com.sun.enterprise.config.serverbeans.Server in project Payara by payara.
the class ConfigApiTest method decorate.
@Override
public void decorate(ServiceLocator habitat) {
Server server = habitat.getService(Server.class, "server");
if (server != null) {
ActiveDescriptor<Server> serverDescriptor = BuilderHelper.createConstantDescriptor(server, ServerEnvironment.DEFAULT_INSTANCE_NAME, Server.class);
ServiceLocatorUtilities.addOneDescriptor(habitat, serverDescriptor);
server.getConfig().addIndex(habitat, ServerEnvironment.DEFAULT_INSTANCE_NAME);
Cluster c = server.getCluster();
if (c != null) {
ActiveDescriptor<Cluster> clusterDescriptor = BuilderHelper.createConstantDescriptor(c, ServerEnvironment.DEFAULT_INSTANCE_NAME, Cluster.class);
ServiceLocatorUtilities.addOneDescriptor(habitat, clusterDescriptor);
}
}
}
use of com.sun.enterprise.config.serverbeans.Server in project Payara by payara.
the class GetGroupNamesCommand method execute.
@Override
public void execute(AdminCommandContext context) {
Config tmp = null;
try {
tmp = configs.getConfigByName(target);
} catch (Exception ex) {
}
if (tmp != null) {
config = tmp;
}
if (tmp == null) {
Server targetServer = domain.getServerNamed(target);
if (targetServer != null) {
config = domain.getConfigNamed(targetServer.getConfigRef());
}
com.sun.enterprise.config.serverbeans.Cluster cluster = domain.getClusterNamed(target);
if (cluster != null) {
config = domain.getConfigNamed(cluster.getConfigRef());
}
}
ActionReporter report = (ActionReporter) context.getActionReport();
try {
String[] list = getGroupNames(realmName, userName);
List<String> ret = Arrays.asList(list);
report.setActionExitCode(ExitCode.SUCCESS);
Properties props = new Properties();
props.put("groups", ret);
report.setExtraProperties(props);
report.setMessage("" + ret);
} catch (NoSuchRealmException ex) {
report.setFailureCause(ex);
report.setActionExitCode(ExitCode.FAILURE);
} catch (BadRealmException ex) {
report.setFailureCause(ex);
report.setActionExitCode(ExitCode.FAILURE);
} catch (InvalidOperationException ex) {
report.setFailureCause(ex);
report.setActionExitCode(ExitCode.FAILURE);
} catch (NoSuchUserException ex) {
report.setFailureCause(ex);
report.setActionExitCode(ExitCode.FAILURE);
}
}
Aggregations