Methods Summary |
---|
public static void | addClusterMbeanReference(com.sun.enterprise.config.ConfigContext cc, java.lang.String toThisMbean, java.lang.String clusterName)
final Cluster cluster = ClusterHelper.getClusterByName(cc, clusterName);
final ApplicationRef ar = new ApplicationRef();
ar.setRef(toThisMbean);
ar.setEnabled(true);
cluster.addApplicationRef(ar);
|
public static void | addMbeanDefinition(com.sun.enterprise.config.ConfigContext cc, Mbean m)
final Domain d = ServerBeansFactory.getDomainBean(cc);
final Applications as = d.getApplications();
as.addMbean(m);
|
public static void | addMbeanReference(com.sun.enterprise.config.ConfigContext cc, java.lang.String toThisMbean, java.lang.String server)
final Domain d = ServerBeansFactory.getDomainBean(cc);
final Servers ss = d.getServers();
final Server s = ss.getServerByName(server);
final ApplicationRef ar = new ApplicationRef();
ar.setRef(toThisMbean);
ar.setEnabled(true);
s.addApplicationRef(ar);
|
public static java.lang.String | getAdminServiceLogLevel(com.sun.enterprise.config.ConfigContext ctx)
Config cfg = ServerBeansFactory.getConfigBean(ctx);
LogService logService = cfg.getLogService();
return logService.getModuleLogLevels().getAdmin();
|
public static java.util.List | getAllMBeanDefinitions(com.sun.enterprise.config.ConfigContext cc)Method to get all the MBean definitions from the domain.xml. These are just the MBeans that are available in
the given domain. No consideration of references. This is to make sure that names of applications, modules, mbeans
are unique in the domain, even if they're referenced from different servers. For example, following structure is to be deemed
invalid
<applications>
<mbean name="foo">
<mbean name="foo">
</applications>
final Domain d = ServerBeansFactory.getDomainBean(cc);
final Applications as = d.getApplications();
final Mbean[] ma = as.getMbean();
final List<Mbean> ml = Arrays.asList(ma);
return ( Collections.unmodifiableList(ml) );
|
public static java.util.Set | getApplicationRefs(com.sun.enterprise.config.ConfigContext ctx)Get all the application ref elements from the given
configuration context wherever they are located.
final Set refs = new HashSet();
for (final Iterator it = getServers(ctx).iterator(); it.hasNext();){
refs.addAll(Arrays.asList(((Server) it.next()).getApplicationRef()));
}
for (final Iterator it = getClusters(ctx).iterator(); it.hasNext();){
refs.addAll(Arrays.asList(((Cluster) it.next()).getApplicationRef()));
}
return refs;
|
private static java.util.Set | getApplicationRefsReferencing(java.lang.String name, com.sun.enterprise.config.ConfigContext ctx)
final Set refers = new HashSet();
for (final Iterator it = getApplicationRefs(ctx).iterator(); it.hasNext(); ){
final ApplicationRef ar = (ApplicationRef) it.next();
if (name.equals(ar.getRef())){
refers.add(ar);
}
}
return refers;
|
public static Applications | getApplicationsBean(com.sun.enterprise.config.ConfigContext ctx)
return ServerBeansFactory.getDomainBean(ctx).getApplications();
|
public static java.util.Set | getClusterRefs(com.sun.enterprise.config.ConfigContext ctx)Get all the cluster refs in the given context, wherever
they are located.
final Set lbconfigs = getLbConfigs(ctx);
if (lbconfigs.isEmpty()){
return Collections.EMPTY_SET;
}
final Set result = new HashSet();
for (final Iterator it = lbconfigs.iterator(); it.hasNext();){
final ConfigBean [] cr = ((LbConfig) it.next()).getClusterRef();
if (null != cr){
result.addAll(Arrays.asList(cr));
}
}
return result;
|
public static java.util.Set | getClusters(com.sun.enterprise.config.ConfigContext ctx)Get a set containing all the clusters within the given
context.
if (null == ctx) {
return Collections.EMPTY_SET;
}
final Domain dom = (Domain) ctx.getRootConfigBean();
if (null == dom){
return Collections.EMPTY_SET;
}
final Clusters clusters = dom.getClusters();
if (null == clusters || null == clusters.getCluster()){
return Collections.EMPTY_SET;
}
final Set result = new HashSet();
result.addAll(Arrays.asList(clusters.getCluster()));
return result;
|
public static Config | getConfigBean(com.sun.enterprise.config.ConfigContext ctx)Returns the config bean for a particular instance.
return ServerBeansFactory.getConfigModel(ctx);
|
public static Config | getConfigModel(com.sun.enterprise.config.ConfigContext configContext)Get the config model for this server instance. This is the config
bean for the server that is defined by the config-ref child element.
if ( configContext == null ) {
final String msg = localStrings.getString( "serverContext.config_context_is_null");
throw new ConfigException(msg);
}
//create the config bean for this instance
final Server server = ServerBeansFactory.getServerBean(configContext);
final String configRef = server.getConfigRef();
final String configXpath = ServerXPathHelper.getConfigIdXpath(configRef);
final Config configModel = (Config)
ConfigBeansFactory.getConfigBeanByXPath(configContext, configXpath);
return configModel;
|
public static java.util.Set | getConfigs(com.sun.enterprise.config.ConfigContext ctx)Get a set containing all the configs within the given
context.
if (null == ctx) {
return Collections.EMPTY_SET;
}
final Domain dom = (Domain) ctx.getRootConfigBean();
if (null == dom){
return Collections.EMPTY_SET;
}
final Configs configs = dom.getConfigs();
if (null == configs || null == configs.getConfig()){
return Collections.EMPTY_SET;
}
final Set result = new HashSet();
result.addAll(Arrays.asList(configs.getConfig()));
return result;
|
public static java.util.Set | getConnectorResources(com.sun.enterprise.config.ConfigContext ctx)Get a set containing all the connector resources within the
given context.
final Set result = new HashSet();
final ConfigBean [] cr = getResources(ctx, ServerTags.CONNECTOR_RESOURCE);
if (null != cr){
result.addAll(Arrays.asList(cr));
}
return result;
|
public static ConnectorService | getConnectorServiceBean(com.sun.enterprise.config.ConfigContext ctx)Get the connector service object from the given config
context
return getConfigBean(ctx).getConnectorService();
|
public static java.lang.String | getCorbaLogLevel(com.sun.enterprise.config.ConfigContext ctx)
Config cfg = ServerBeansFactory.getConfigBean(ctx);
LogService logService = cfg.getLogService();
return logService.getModuleLogLevels().getCorba();
|
public static DasConfig | getDasConfigBean(com.sun.enterprise.config.ConfigContext ctx)
Config cfg = ServerBeansFactory.getConfigBean(ctx);
AdminService as = cfg.getAdminService();
DasConfig ds = null;
if(as != null) ds = as.getDasConfig();
return ds; // can be null;
|
public static Domain | getDomainBean(com.sun.enterprise.config.ConfigContext ctx)
return (Domain)ctx.getRootConfigBean();
|
public static java.lang.String | getEjbContainerLogLevel(com.sun.enterprise.config.ConfigContext ctx)
Config cfg = ServerBeansFactory.getConfigBean(ctx);
LogService logService = cfg.getLogService();
return logService.getModuleLogLevels().getEjbContainer();
|
public static java.util.List | getFullyEnabledMBeans(com.sun.enterprise.config.ConfigContext cc, java.lang.String sn)Method to get the completely enabled mbean definitions from the domain.xml, for a given server instance.
Note that an MBean is truly enabled if and only if it is enabled in its definition and a reference to its
definition from a server instance is enabled too.
//while reaching here, if cc or sn are null, we are already in trouble
final List<Mbean> em = new ArrayList<Mbean>();
final Domain d = ServerBeansFactory.getDomainBean(cc);
final Server[] ss = d.getServers().getServer();
for(Server a : ss) {
if (sn.equals(a.getName())) {
ApplicationRef[] ars = a.getApplicationRef();
for (ApplicationRef ar : ars) {
if (ar.isEnabled()) { // reference itself is enabled, this is generally not required, but to take care of some weird cases
final Mbean tmp = getMBeanDefinition(cc, ar.getRef());
if (tmp != null && tmp.isEnabled()) { // the definition is also enabled
//System.out.println(tmp.getName() + " will be loaded");
em.add(tmp);
}
}
}
}
}
return ( Collections.unmodifiableList(em) );
|
public static java.util.List | getFullyEnabledUserDefinedMBeans(com.sun.enterprise.config.ConfigContext cc, java.lang.String sn)Method to get the completely enabled "user-defined" mbean definitions from the domain.xml, for a given server instance.
Note that an MBean is truly enabled if and only if it is enabled in its definition and a reference to its
definition from a server instance is enabled too.
final List<Mbean> em = ServerBeansFactory.getFullyEnabledMBeans(cc, sn);
final List<Mbean> uem = new ArrayList<Mbean>();
for (Mbean m : em) {
assert (m.isEnabled());
if (IAdminConstants.USER.equals(m.getObjectType())) {
uem.add(m);
}
}
return ( Collections.unmodifiableList(uem) );
|
public static HttpService | getHttpServiceBean(com.sun.enterprise.config.ConfigContext ctx)
Config cfg = ServerBeansFactory.getConfigBean(ctx);
HttpService httpService = cfg.getHttpService();
return httpService;
|
public static java.util.Set | getHttpServices(com.sun.enterprise.config.ConfigContext ctx)Get a set containing all the http services within the given
context.
final Set result = new HashSet();
for (final Iterator it = getConfigs(ctx).iterator(); it.hasNext(); ){
result.add(((Config) it.next()).getHttpService());
}
return result;
|
public static IiopService | getIiopServiceBean(com.sun.enterprise.config.ConfigContext ctx)
Config cfg = ServerBeansFactory.getConfigBean(ctx);
IiopService iiopService = cfg.getIiopService();
return iiopService;
|
public static JavaConfig | getJavaConfigBean(com.sun.enterprise.config.ConfigContext ctx)
Config cfg = ServerBeansFactory.getConfigBean(ctx);
JavaConfig javaConfig = cfg.getJavaConfig();
return javaConfig;
|
public static JmsHost | getJmsHostBean(com.sun.enterprise.config.ConfigContext ctx)
JmsService jmsService = ServerBeansFactory.getJmsServiceBean(ctx);
JmsHost[] hosts = jmsService.getJmsHost();
return hosts[0];
|
public static JmsService | getJmsServiceBean(com.sun.enterprise.config.ConfigContext ctx)
Config cfg = ServerBeansFactory.getConfigBean(ctx);
JmsService jmsService = cfg.getJmsService();
return jmsService;
|
public static java.util.Set | getLbConfigs(com.sun.enterprise.config.ConfigContext ctx)Get a set containing all the lbconfigs within the given
context.
if (null == ctx) {
return Collections.EMPTY_SET;
}
final Domain dom = (Domain) ctx.getRootConfigBean();
if (null == dom){
return Collections.EMPTY_SET;
}
final LbConfigs lbconfigs = dom.getLbConfigs();
if (null == lbconfigs || null == lbconfigs.getLbConfig()){
return Collections.EMPTY_SET;
}
final Set result = new HashSet();
result.addAll(Arrays.asList(lbconfigs.getLbConfig()));
return result;
|
public static Mbean | getMBeanDefinition(com.sun.enterprise.config.ConfigContext cc, java.lang.String n)
final Domain d = ServerBeansFactory.getDomainBean(cc);
final Applications a = d.getApplications();
final Mbean[] ms = a.getMbean();
for (Mbean m : ms) {
if (n.equals(m.getName())) {
return ( m );
}
}
return ( null );
|
public static MdbContainer | getMdbContainerBean(com.sun.enterprise.config.ConfigContext ctx)
Config cfg = ServerBeansFactory.getConfigBean(ctx);
MdbContainer container = cfg.getMdbContainer();
return container;
|
public static java.lang.String | getMdbContainerLogLevel(com.sun.enterprise.config.ConfigContext ctx)
Config cfg = ServerBeansFactory.getConfigBean(ctx);
LogService logService = cfg.getLogService();
return logService.getModuleLogLevels().getMdbContainer();
|
public static java.util.List | getReferencedMBeans(com.sun.enterprise.config.ConfigContext cc, java.lang.String sn)Method to get mbean definitions from domain.xml that are referenced from a given
server name.
final List<Mbean> em = new ArrayList<Mbean>();
final Domain d = ServerBeansFactory.getDomainBean(cc);
final Server[] ss = d.getServers().getServer();
for(Server a : ss) {
if (sn.equals(a.getName())) {
ApplicationRef[] ars = a.getApplicationRef();
for (ApplicationRef ar : ars) {
final Mbean tmp = getMBeanDefinition(cc, ar.getRef());
if (tmp != null)
em.add(tmp);
}
}
}
return ( Collections.unmodifiableList(em) );
|
public static java.util.Set | getReferers(AdminObjectResource res, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link AdminObjectResource} resource within the given {@link
ConfigContext}
return getResourceRefsReferencing(res.getJndiName(), ctx);
|
public static java.util.Set | getReferers(AppclientModule cm, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link AppclientModule} within the given {@link
ConfigContext}
return getApplicationRefsReferencing(cm.getName(), ctx);
|
public static java.util.Set | getReferers(Config res, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link Config} resource within the given {@link
ConfigContext}
if (null == res || null == ctx) { return Collections.EMPTY_SET; }
final Set result = new HashSet();
for (final Iterator it = getServers(ctx).iterator(); it.hasNext();){
final Server el = (Server) it.next();
if (res.getName().equals(el.getConfigRef())){
result.add(el);
}
}
for (final Iterator it = getClusters(ctx).iterator(); it.hasNext();){
final Cluster el = (Cluster) it.next();
if (res.getName().equals(el.getConfigRef())){
result.add(el);
}
}
return result;
|
public static java.util.Set | getReferers(NodeAgent res, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link NodeAgent} resource within the given {@link
ConfigContext}
if (null == res || null == ctx) { return Collections.EMPTY_SET; }
final Set result = new HashSet();
for (final Iterator it = getServers(ctx).iterator(); it.hasNext();){
final Server el = (Server) it.next();
if (res.getName().equals(el.getNodeAgentRef())){
result.add(el);
}
}
return result;
|
public static java.util.Set | getReferers(ConnectorResource res, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link ConnectorResource} resource within the given {@link
ConfigContext}
return getResourceRefsReferencing(res.getJndiName(), ctx);
|
public static java.util.Set | getReferers(Cluster cm, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link Cluster} within the given {@link
ConfigContext}
if (null == cm || null == ctx) {return Collections.EMPTY_SET;}
final Set refs = getClusterRefs(ctx);
if (refs.isEmpty()) { return Collections.EMPTY_SET; }
final Set result = new HashSet();
for (final Iterator it = refs.iterator(); it.hasNext(); ){
final ClusterRef ref = (ClusterRef) it.next();
if (cm.getName().equals(ref.getRef())){
result.add(ref);
}
}
return result;
|
public static java.util.Set | getReferers(ConnectorConnectionPool cm, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link ConnectorConnectionPool} within the given {@link
ConfigContext}
if (null == cm || null == ctx) {return Collections.EMPTY_SET;}
final Set crs = getConnectorResources(ctx);
if (crs.isEmpty()) { return Collections.EMPTY_SET; }
final Set result = new HashSet();
for (final Iterator it = crs.iterator(); it.hasNext(); ){
final ConnectorResource cr = (ConnectorResource) it.next();
if (cm.getName().equals(cr.getPoolName())){
result.add(cr);
}
}
return result;
|
public static java.util.Set | getReferers(ConnectorModule cm, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link ConnectorModule} within the given {@link
ConfigContext}
return getApplicationRefsReferencing(cm.getName(), ctx);
|
public static java.util.Set | getReferers(CustomResource res, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link CustomResource} resource within the given {@link
ConfigContext}
return getResourceRefsReferencing(res.getJndiName(), ctx);
|
public static java.util.Set | getReferers(EjbModule cm, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link EjbModule} within the given {@link
ConfigContext}
return getApplicationRefsReferencing(cm.getName(), ctx);
|
public static java.util.Set | getReferers(ExternalJndiResource res, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link ExternalJndiResource} resource within the given {@link
ConfigContext}
return getResourceRefsReferencing(res.getJndiName(), ctx);
|
public static java.util.Set | getReferers(J2eeApplication cm, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link J2eeApplication} within the given {@link
ConfigContext}
return getApplicationRefsReferencing(cm.getName(), ctx);
|
public static java.util.Set | getReferers(JdbcResource res, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link JdbcResource} resource within the given {@link
ConfigContext}
return getResourceRefsReferencing(res.getJndiName(), ctx);
|
public static java.util.Set | getReferers(LifecycleModule cm, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link LifecycleModule} within the given {@link
ConfigContext}
return getApplicationRefsReferencing(cm.getName(), ctx);
|
public static java.util.Set | getReferers(MailResource res, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link MailResource} resource within the given {@link
ConfigContext}
return getResourceRefsReferencing(res.getJndiName(), ctx);
|
public static java.util.Set | getReferers(PersistenceManagerFactoryResource res, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link PersistenceManagerFactoryResource} resource within the given {@link
ConfigContext}
return getResourceRefsReferencing(res.getJndiName(), ctx);
|
public static java.util.Set | getReferers(ResourceAdapterConfig res, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link ResourceAdapterConfig} resource within the given {@link
ConfigContext}
return getResourceRefsReferencing(res.getResourceAdapterName(), ctx);
|
public static java.util.Set | getReferers(Server res, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link Server} resource within the given {@link
ConfigContext}
return getServerRefsReferencing(res.getName(), ctx);
|
public static java.util.Set | getReferers(WebModule cm, com.sun.enterprise.config.ConfigContext ctx)Return a set containing all the elements that reference the
given {@link WebModule} within the given {@link
ConfigContext}
return getApplicationRefsReferencing(cm.getName(), ctx);
|
public static java.util.Set | getResourceRefs(com.sun.enterprise.config.ConfigContext ctx)Get all the resource ref elements from the given
configuration context wherever they are located.
final Set refs = new HashSet();
for (final Iterator it = getServers(ctx).iterator(); it.hasNext();){
refs.addAll(Arrays.asList(((Server) it.next()).getResourceRef()));
}
for (final Iterator it = getClusters(ctx).iterator(); it.hasNext();){
refs.addAll(Arrays.asList(((Cluster) it.next()).getResourceRef()));
}
return refs;
|
private static java.util.Set | getResourceRefsReferencing(java.lang.String name, com.sun.enterprise.config.ConfigContext ctx)
final Set refers = new HashSet();
for (final Iterator it = getResourceRefs(ctx).iterator(); it.hasNext(); ){
final ResourceRef ar = (ResourceRef) it.next();
if (name.equals(ar.getRef())){
refers.add(ar);
}
}
return refers;
|
public static com.sun.enterprise.config.ConfigBean[] | getResources(com.sun.enterprise.config.ConfigContext ctx, java.lang.String type)
Resources r = getDomainBean(ctx).getResources();
//ResourceRefs refs = getServerBean(ctx).getResourceRefs();
// Implement the logic of getting only the resources referenced by the server
// TBD
//FIXME: validate the code.
return r.getChildBeansByName(type);
|
public static java.lang.String | getRootLogLevel(com.sun.enterprise.config.ConfigContext ctx)
Config cfg = ServerBeansFactory.getConfigBean(ctx);
LogService logService = cfg.getLogService();
return logService.getModuleLogLevels().getRoot();
|
public static SecurityService | getSecurityServiceBean(com.sun.enterprise.config.ConfigContext ctx)
Config cfg = ServerBeansFactory.getConfigBean(ctx);
return cfg.getSecurityService();
|
public static java.lang.String | getSecurityServiceLogLevel(com.sun.enterprise.config.ConfigContext ctx)
Config cfg = ServerBeansFactory.getConfigBean(ctx);
/*SecurityService securityService = cfg.getSecurityService();
return securityService.getLogLevel();
*/
LogService logService = cfg.getLogService();
return logService.getModuleLogLevels().getSecurity();
|
public static Server | getServerBean(com.sun.enterprise.config.ConfigContext ctx)Returns server config bean.
final String serverName = java.lang.System.getProperty("com.sun.aas.instanceName");
String xpath = ServerXPathHelper.getServerIdXpath(serverName);
final Server server =
(Server) ConfigBeansFactory.getConfigBeanByXPath(ctx, xpath);
return server;
|
public static Server | getServerBeanFromArray(Server[] serverArray, java.lang.String serverName)Returns the appropriate Server bean for an instance given an array
of Server beans from the domain.xml config.
for (int i=0;i<serverArray.length;i++) {
if (serverArray[i].getName().equals(serverName)) {
return serverArray[i];
}
}
//if no match is made, then return first server bean in array
return serverArray[0];
|
public static java.util.Set | getServerRefs(com.sun.enterprise.config.ConfigContext ctx)Get all the server ref elements from the given
configuration context wherever they are located.
final Set refs = new HashSet();
for (final Iterator it = getLbConfigs(ctx).iterator(); it.hasNext();){
refs.addAll(Arrays.asList(((LbConfig) it.next()).getServerRef()));
}
for (final Iterator it = getClusters(ctx).iterator(); it.hasNext();){
refs.addAll(Arrays.asList(((Cluster) it.next()).getServerRef()));
}
return refs;
|
private static java.util.Set | getServerRefsReferencing(java.lang.String name, com.sun.enterprise.config.ConfigContext ctx)
final Set refers = new HashSet();
for (final Iterator it = getServerRefs(ctx).iterator(); it.hasNext(); ){
final ServerRef ar = (ServerRef) it.next();
if (name.equals(ar.getRef())){
refers.add(ar);
}
}
return refers;
|
public static java.util.Set | getServers(com.sun.enterprise.config.ConfigContext ctx)Get a set containing all the servers within the given
context.
if (null == ctx) {
return Collections.EMPTY_SET;
}
final Domain dom = (Domain) ctx.getRootConfigBean();
if (null == dom){
return Collections.EMPTY_SET;
}
final Servers servers = dom.getServers();
if (null == servers || null == servers.getServer()){
return Collections.EMPTY_SET;
}
final Set result = new HashSet();
result.addAll(Arrays.asList(servers.getServer()));
return result;
|
public static Server[] | getServersReferencingMBeanDefinition(com.sun.enterprise.config.ConfigContext cc, java.lang.String name)
//check to see if two or more servers have references to this mbean
Server[] ss = null;
final List<Server> list = new ArrayList<Server> ();
ss = ServerBeansFactory.getDomainBean(cc).getServers().getServer();
int numberOfReferencingServers = 0;
for (Server s : ss) {
boolean referenced = false;
final String sName = s.getName();
referenced = ServerBeansFactory.isReferencedMBean(cc, sName, name);
if (referenced) {
list.add(s);
}
}
final Server[] rss = new Server[list.size()];
return ( list.toArray(rss) );
|
public static TransactionService | getTransactionServiceBean(com.sun.enterprise.config.ConfigContext ctx)
Config cfg = ServerBeansFactory.getConfigBean(ctx);
return cfg.getTransactionService();
|
public static java.lang.String | getTransactionServiceLogLevel(com.sun.enterprise.config.ConfigContext ctx)
Config cfg = ServerBeansFactory.getConfigBean(ctx);
LogService logService = cfg.getLogService();
return logService.getModuleLogLevels().getJts();
|
public static java.util.Set | getVirtualServers(com.sun.enterprise.config.ConfigContext ctx)Get a set containing all the virtual servers within the given
context.
final Set result = new HashSet();
for (final Iterator it = getHttpServices(ctx).iterator(); it.hasNext(); ){
final ConfigBean [] vs = ((HttpService) it.next()).getVirtualServer();
if (null != vs){
result.addAll(Arrays.asList(vs));
}
}
return result;
|
public static java.lang.String | getVirtualServersByAppName(com.sun.enterprise.config.ConfigContext ctx, java.lang.String appName)Get virtual server given an Application
Virtual servers are maintained in the reference contained
in Server element. First, we need to find the server
and then get the virtual server from the correct reference
ApplicationRef ar = getServerBean(ctx).getApplicationRefByRef(appName);
if (ar == null) return null; //fixme should I throw an exception??
return ar.getVirtualServers();
/*
VirtualServer[] vsList = getConfigBean(ctx).getHttpService().getVirtualServer();
if (vsList == null) return null;
String ret ="";
for(int i=0;i< vsList.length; i++) {
if(!ret.equals("")) {
ret+="'";
}
ret += vsList[i].getId();
}
return ret;
*/
|
public static WebContainer | getWebContainerBean(com.sun.enterprise.config.ConfigContext ctx)
Config cfg = ServerBeansFactory.getConfigBean(ctx);
WebContainer webContainer = cfg.getWebContainer();
return webContainer;
|
public static java.lang.String | getWebContainerLogLevel(com.sun.enterprise.config.ConfigContext ctx)
Config cfg = ServerBeansFactory.getConfigBean(ctx);
LogService logService = cfg.getLogService();
return logService.getModuleLogLevels().getWebContainer();
|
public static boolean | isReferenced(AdminObjectResource res, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link AdminObjectResource} resource is
referenced by one or more other elements within the given
{@link ConfigContext}.
return isReferencedByResourceRef(res.getJndiName(), ctx);
|
public static boolean | isReferenced(AppclientModule cm, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link AppclientModule} element is
referenced by one or more other elements within the given
{@link ConfigContext}.
return isReferencedByApplicationRef(cm.getName(), ctx);
|
public static boolean | isReferenced(Config res, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link Config} resource is
referenced by one or more other elements within the given
{@link ConfigContext}.
if (null == res || null == ctx) { return false; }
for (final Iterator it = getServers(ctx).iterator(); it.hasNext();){
if (res.getName().equals(((Server) it.next()).getConfigRef())){
return true;
}
}
for (final Iterator it = getClusters(ctx).iterator(); it.hasNext();){
if (res.getName().equals(((Cluster) it.next()).getConfigRef())){
return true;
}
}
return false;
|
public static boolean | isReferenced(NodeAgent res, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link NodeAgent} resource is
referenced by one or more other elements within the given
{@link ConfigContext}.
if (null == res || null == ctx) { return false; }
for (final Iterator it = getServers(ctx).iterator(); it.hasNext();){
if (res.getName().equals(((Server) it.next()).getNodeAgentRef())){
return true;
}
}
return false;
|
public static boolean | isReferenced(ConnectorResource res, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link ConnectorResource} resource is
referenced by one or more other elements within the given
{@link ConfigContext}.
return isReferencedByResourceRef(res.getJndiName(), ctx);
|
public static boolean | isReferenced(Cluster cm, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link Cluster} element is
referenced by one or more other elements within the given
{@link ConfigContext}.
if (null == cm || null == ctx) {return false;}
final Set refs = getClusterRefs(ctx);
if (refs.isEmpty()) { return false; }
for (final Iterator it = refs.iterator(); it.hasNext(); ){
if (cm.getName().equals(((ClusterRef) it.next()).getRef())){
return true;
}
}
return false;
|
public static boolean | isReferenced(ConnectorConnectionPool cm, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link ConnectorConnectionPool} element is
referenced by one or more other elements within the given
{@link ConfigContext}.
if (null == cm || null == ctx) {return false;}
final Set crs = getConnectorResources(ctx);
if (crs.isEmpty()) { return false; }
for (final Iterator it = crs.iterator(); it.hasNext(); ){
if (cm.getName().equals(((ConnectorResource) it.next()).getPoolName())){
return true;
}
}
return false;
|
public static boolean | isReferenced(ConnectorModule cm, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link ConnectorModule} element is
referenced by one or more other elements within the given
{@link ConfigContext}.
return isReferencedByApplicationRef(cm.getName(), ctx);
|
public static boolean | isReferenced(CustomResource res, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link CustomResource} resource is
referenced by one or more other elements within the given
{@link ConfigContext}.
return isReferencedByResourceRef(res.getJndiName(), ctx);
|
public static boolean | isReferenced(EjbModule cm, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link EjbModule} element is
referenced by one or more other elements within the given
{@link ConfigContext}.
return isReferencedByApplicationRef(cm.getName(), ctx);
|
public static boolean | isReferenced(ExternalJndiResource res, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link ExternalJndiResource} resource is
referenced by one or more other elements within the given
{@link ConfigContext}.
return isReferencedByResourceRef(res.getJndiName(), ctx);
|
public static boolean | isReferenced(J2eeApplication cm, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link J2eeApplication} element is
referenced by one or more other elements within the given
{@link ConfigContext}.
return isReferencedByApplicationRef(cm.getName(), ctx);
|
public static boolean | isReferenced(JdbcResource res, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link JdbcResource} resource is
referenced by one or more other elements within the given
{@link ConfigContext}.
return isReferencedByResourceRef(res.getJndiName(), ctx);
|
public static boolean | isReferenced(LifecycleModule cm, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link LifecycleModule} element is
referenced by one or more other elements within the given
{@link ConfigContext}.
return isReferencedByApplicationRef(cm.getName(), ctx);
|
public static boolean | isReferenced(MailResource res, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link MailResource} resource is
referenced by one or more other elements within the given
{@link ConfigContext}.
return isReferencedByResourceRef(res.getJndiName(), ctx);
|
public static boolean | isReferenced(PersistenceManagerFactoryResource res, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link PersistenceManagerFactoryResource} resource is
referenced by one or more other elements within the given
{@link ConfigContext}.
return isReferencedByResourceRef(res.getJndiName(), ctx);
|
public static boolean | isReferenced(ResourceAdapterConfig res, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link ResourceAdapterConfig} resource is
referenced by one or more other elements within the given
{@link ConfigContext}.
return isReferencedByResourceRef(res.getResourceAdapterName(), ctx);
|
public static boolean | isReferenced(Server res, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link Server} resource is
referenced by one or more other elements within the given
{@link ConfigContext}.
return isReferencedByServerRef(res.getName(), ctx);
|
public static boolean | isReferenced(WebModule cm, com.sun.enterprise.config.ConfigContext ctx)Indicate if the given {@link WebModule} element is
referenced by one or more other elements within the given
{@link ConfigContext}.
for (final Iterator it = getVirtualServers(ctx).iterator(); it.hasNext(); ){
if (cm.getName().equals(((VirtualServer) it.next()).getDefaultWebModule())){
return true;
}
}
return isReferencedByApplicationRef(cm.getName(), ctx);
|
private static boolean | isReferencedByApplicationRef(java.lang.String name, com.sun.enterprise.config.ConfigContext ctx)
for (final Iterator it = getApplicationRefs(ctx).iterator(); it.hasNext(); ){
if (name.equals(((ApplicationRef) it.next()).getRef())){
return true;
}
}
return false;
|
private static boolean | isReferencedByResourceRef(java.lang.String name, com.sun.enterprise.config.ConfigContext ctx)
for (final Iterator it = getResourceRefs(ctx).iterator(); it.hasNext(); ){
if (name.equals(((ResourceRef) it.next()).getRef())){
return true;
}
}
return false;
|
private static boolean | isReferencedByServerRef(java.lang.String name, com.sun.enterprise.config.ConfigContext ctx)
for (final Iterator it = getServerRefs(ctx).iterator(); it.hasNext(); ){
if (name.equals(((ServerRef) it.next()).getRef())){
return true;
}
}
return false;
|
public static boolean | isReferencedMBean(com.sun.enterprise.config.ConfigContext cc, java.lang.String sn, java.lang.String mn)
final List<Mbean> rm = getReferencedMBeans(cc, sn);
boolean refd = false;
for (Mbean m : rm) {
if (m.getName().equals(mn)) {
refd = true;
break;
}
}
return ( refd );
|
public static boolean | isReferencedMBeanInCluster(com.sun.enterprise.config.ConfigContext cc, java.lang.String cn, java.lang.String mn)
- Returns true if all of the instances in the given cluster reference the given custom mbean
- Return false if all of the instances in the given cluster do not reference the given custom mbean
or if there are no instances in the cluster
- throw a ConfigException if some instances have the ref and some do not.
// by definition a cluster has no referenced mbeans -- only instances in the cluster do.
assert cc != null && cn != null && mn != null;
// in case asserts are off, return false. Normally I'd log it but this
// file has no logger and I'm just visiting...
if(cc == null || cn == null || mn == null)
return false;
final Server[] ss = ServerHelper.getServersInCluster(cc, cn);
if(ss == null || ss.length < 1)
return false;
final boolean[] isrefs = new boolean[ss.length];
for(int i = 0; i < ss.length; i++)
{
isrefs[i] = isReferencedMBean(cc, ss[i].getName(), mn);
}
// see if they are not all exactly the same -- simply compare the first
// with all the others.
for(int i = 1; i < ss.length; i++)
{
if(isrefs[i] != isrefs[0])
{
String messy = prepareMessyStringMessage(ss, isrefs);
String msg = StringManager.getManager(ServerBeansFactory.class).getString("CorruptClusterConfig",
new Object[] { cn, mn, messy} );
throw new ConfigException(msg);
}
}
return isrefs[0]; // they are all the same!
|
private static java.lang.String | prepareMessyStringMessage(Server[] ss, boolean[] isrefs)
// the refs in this array of Servers are not the same. I.e. we have a scary inconsistent
// corrupted cluster configuration. Let's painfully create a message for the user about it...
StringBuilder sb = new StringBuilder();
for(int i = 0; i < ss.length; i++)
{
if(i != 0)
sb.append(", ");
String s = isrefs[i] ? "referenced" : "not-referenced";
sb.append(ss[i].getName()).append(":").append(s);
}
return sb.toString();
|
public static void | removeClusterMbeanReference(com.sun.enterprise.config.ConfigContext cc, java.lang.String ref, java.lang.String clusterName)
final Cluster cluster = ClusterHelper.getClusterByName(cc, clusterName);
final ApplicationRef ar = cluster.getApplicationRefByRef(ref);
cluster.removeApplicationRef(ar);
|
public static void | removeMbeanDefinition(com.sun.enterprise.config.ConfigContext cc, java.lang.String n)
final Domain d = ServerBeansFactory.getDomainBean(cc);
final Applications as = d.getApplications();
as.removeMbean(as.getMbeanByName(n));
|
public static void | removeMbeanReference(com.sun.enterprise.config.ConfigContext cc, java.lang.String ref, java.lang.String server)
final Domain d = ServerBeansFactory.getDomainBean(cc);
final Servers ss = d.getServers();
final Server s = ss.getServerByName(server);
final ApplicationRef ar = s.getApplicationRefByRef(ref);
s.removeApplicationRef(ar);
|