Methods Summary |
---|
public static com.sun.enterprise.config.ConfigBean | findResource(com.sun.enterprise.config.ConfigContext ctx, java.lang.String id)
Resources root = ((Domain)ctx.getRootConfigBean()).getResources();
return findResource(root, id);
|
public static com.sun.enterprise.config.ConfigBean | findResource(Resources root, java.lang.String id)
ConfigBean res = root.getJdbcResourceByJndiName(id);
if ( res != null )
return res;
res = root.getMailResourceByJndiName(id);
if( res != null )
return res;
res = root.getCustomResourceByJndiName(id);
if( res != null )
return res;
res = root.getExternalJndiResourceByJndiName(id);
if ( res != null )
return res;
res = root.getPersistenceManagerFactoryResourceByJndiName(id);
if ( res != null)
return res;
res = root.getAdminObjectResourceByJndiName(id);
if ( res != null )
return res;
res = root.getConnectorResourceByJndiName(id);
if ( res != null )
return res;
res = root.getJdbcConnectionPoolByName(id);
if ( res != null )
return res;
res = root.getConnectorConnectionPoolByName(id);
if ( res != null )
return res;
res = root.getResourceAdapterConfigByResourceAdapterName(id);
if ( res != null )
return res;
return null;
|
private static synchronized com.sun.enterprise.config.serverbeans.ResourceHelper | getInstance()
if (_theInstance == null) {
_theInstance = new ResourceHelper();
}
return _theInstance;
|
protected Cluster[] | getReferencingClusters(com.sun.enterprise.config.ConfigContext configContext, java.lang.String name)
return ClusterHelper.getClustersReferencingResource(configContext, name);
|
protected Server[] | getReferencingServers(com.sun.enterprise.config.ConfigContext configContext, java.lang.String name)
return ServerHelper.getServersReferencingResource(configContext, name);
|
public static java.lang.String | getResourceReferenceesAsString(com.sun.enterprise.config.ConfigContext configContext, java.lang.String resourceName)Find all the servers or clusters associated with the given configuration and return them
as a comma separated list.
return getInstance().getReferenceesAsString(configContext, resourceName);
|
public static java.lang.String | getResourceType(com.sun.enterprise.config.ConfigContext ctx, java.lang.String id)Returns the resource type of a given resource
Resources root = ((Domain)ctx.getRootConfigBean()).getResources();
ConfigBean res = root.getJdbcResourceByJndiName(id);
if ( res != null )
return Resources.JDBC_RESOURCE;
res = root.getMailResourceByJndiName(id);
if( res != null )
return Resources.MAIL_RESOURCE;
res = root.getCustomResourceByJndiName(id);
if( res != null )
return Resources.CUSTOM_RESOURCE;
res = root.getExternalJndiResourceByJndiName(id);
if ( res != null )
return Resources.EXTERNAL_JNDI_RESOURCE;
res = root.getPersistenceManagerFactoryResourceByJndiName(id);
if ( res != null)
return Resources.PERSISTENCE_MANAGER_FACTORY_RESOURCE;
res = root.getAdminObjectResourceByJndiName(id);
if ( res != null )
return Resources.ADMIN_OBJECT_RESOURCE;
res = root.getConnectorResourceByJndiName(id);
if ( res != null )
return Resources.CONNECTOR_RESOURCE;
res = root.getJdbcConnectionPoolByName(id);
if ( res != null )
return Resources.JDBC_CONNECTION_POOL;
res = root.getConnectorConnectionPoolByName(id);
if ( res != null )
return Resources.CONNECTOR_CONNECTION_POOL;
res = root.getResourceAdapterConfigByResourceAdapterName(id);
if ( res != null )
return Resources.RESOURCE_ADAPTER_CONFIG;
return null;
|
public static boolean | isConnectorPoolReferenced(com.sun.enterprise.config.ConfigContext ctx, java.lang.String poolName, java.lang.String serverName)Returns true if the named pool has a reference from a connector resource
that is used by the given server instance.
if (ctx == null || poolName == null || serverName == null) {
return false;
}
Resources rBean = ServerBeansFactory.getDomainBean(ctx).getResources();
ConnectorResource[] conBeans = rBean.getConnectorResource();
// no connector resource in the domain, so it is not possible
// for the connector pool to be in use by a server in this domain
if (conBeans == null) {
return false;
}
for (int i = 0; i <conBeans.length; i++) {
// connector resource is not referenced by the server instance
if ( !ServerHelper.serverReferencesResource(
ctx, serverName, conBeans[i].getJndiName()) ) {
continue;
} else {
String pool = conBeans[i].getPoolName();
if ( (pool != null) && pool.equals(poolName) ) {
return true;
}
}
}
return false;
|
public static boolean | isJdbcPoolReferenced(com.sun.enterprise.config.ConfigContext ctx, java.lang.String poolName, java.lang.String serverName)Returns true if the named pool has a reference from a jdbc resource
that is used by the given server instance.
if (ctx == null || poolName == null || serverName == null) {
return false;
}
Resources rBean = ServerBeansFactory.getDomainBean(ctx).getResources();
JdbcResource[] jdbcBeans = rBean.getJdbcResource();
// no jdbc resource in the domain, so it is not possible
// for the jdbc pool to be in use by a server in this domain
if (jdbcBeans == null) {
return false;
}
for (int i = 0; i <jdbcBeans.length; i++) {
// jdbc resource is not referenced by the server instance
if ( !ServerHelper.serverReferencesResource(
ctx, serverName, jdbcBeans[i].getJndiName()) ) {
continue;
} else {
String pool = jdbcBeans[i].getPoolName();
if ( (pool != null) && pool.equals(poolName) ) {
// jdbc pool is referenced by server (server->res->pool)
return true;
}
}
}
// no jdbc resource referred by this server is using this pool
return false;
|
public static boolean | isResourceReferenced(com.sun.enterprise.config.ConfigContext configContext, java.lang.String resourceName)Is the configuration referenced by anyone (i.e. any server instance or cluster
return getInstance().isReferenced(configContext, resourceName);
|
public static boolean | isResourceReferencedByClusterOnly(com.sun.enterprise.config.ConfigContext configContext, java.lang.String resourceName, java.lang.String clusterName)Return true if the configuration is referenced by no-one other than the given
cluster.
return getInstance().isReferencedByClusterOnly(configContext, resourceName, clusterName);
|
public static boolean | isResourceReferencedByServerOnly(com.sun.enterprise.config.ConfigContext configContext, java.lang.String resourceName, java.lang.String serverName)Return true if the configuration is referenced by no-one other than the given
server instance.
return getInstance().isReferencedByServerOnly(configContext, resourceName, serverName);
|
public static boolean | isSystemResource(com.sun.enterprise.config.ConfigContext ctx, java.lang.String resourceName)
ConfigBean bean = findResource(ctx, resourceName);
if (bean == null) {
throw new ConfigException(_strMgr.getString("noSuchResource",
resourceName));
}
String objectType = null;
try {
objectType = bean.getAttributeValue(ServerTags.OBJECT_TYPE);
} catch (Exception ex) {
//if the object-type attribute does not exist, then assume that
//the resource is not a system resource.
return false;
}
if (objectType.equals(IAdminConstants.SYSTEM_ALL) ||
objectType.equals(IAdminConstants.SYSTEM_ADMIN) ||
objectType.equals(IAdminConstants.SYSTEM_INSTANCE)) {
return true;
} else {
return false;
}
|