📄 standarddefaultcontext.java
字号:
/**
* Return the environment entry with the specified name, if any;
* otherwise, return <code>null</code>.
*
* @param name Name of the desired environment entry
*/
public ContextEnvironment findEnvironment(String name) {
return namingResources.findEnvironment(name);
}
/**
* Return the set of defined environment entries for this web
* application. If none have been defined, a zero-length array
* is returned.
*/
public ContextEnvironment[] findEnvironments() {
return namingResources.findEnvironments();
}
/**
* Return the set of defined resource parameters for this web
* application. If none have been defined, a zero-length array
* is returned.
*/
public ResourceParams[] findResourceParams() {
return namingResources.findResourceParams();
}
/**
* Return the set of InstanceListener classes that will be added to
* newly created Wrappers automatically.
*/
public String[] findInstanceListeners() {
return (instanceListeners);
}
/**
* Return the value for the specified context initialization
* parameter name, if any; otherwise return <code>null</code>.
*
* @param name Name of the parameter to return
*/
public String findParameter(String name) {
synchronized (parameters) {
return ((String) parameters.get(name));
}
}
/**
* Return the names of all defined context initialization parameters
* for this Context. If no parameters are defined, a zero-length
* array is returned.
*/
public String[] findParameters() {
synchronized (parameters) {
String results[] = new String[parameters.size()];
return ((String[]) parameters.keySet().toArray(results));
}
}
/**
* Return the resource reference with the specified name, if any;
* otherwise return <code>null</code>.
*
* @param name Name of the desired resource reference
*/
public ContextResource findResource(String name) {
return namingResources.findResource(name);
}
/**
* Return the resource environment reference type for the specified
* name, if any; otherwise return <code>null</code>.
*
* @param name Name of the desired resource environment reference
*/
public String findResourceEnvRef(String name) {
return namingResources.findResourceEnvRef(name);
}
/**
* Return the set of resource environment reference names for this
* web application. If none have been specified, a zero-length
* array is returned.
*/
public String[] findResourceEnvRefs() {
return namingResources.findResourceEnvRefs();
}
/**
* Return the resource link with the specified name, if any;
* otherwise return <code>null</code>.
*
* @param name Name of the desired resource link
*/
public ContextResourceLink findResourceLink(String name) {
return namingResources.findResourceLink(name);
}
/**
* Return the defined resource links for this application. If
* none have been defined, a zero-length array is returned.
*/
public ContextResourceLink[] findResourceLinks() {
return namingResources.findResourceLinks();
}
/**
* Return the defined resource references for this application. If
* none have been defined, a zero-length array is returned.
*/
public ContextResource[] findResources() {
return namingResources.findResources();
}
/**
* Return the set of LifecycleListener classes that will be added to
* newly created Wrappers automatically.
*/
public String[] findWrapperLifecycles() {
return (wrapperLifecycles);
}
/**
* Return the set of ContainerListener classes that will be added to
* newly created Wrappers automatically.
*/
public String[] findWrapperListeners() {
return (wrapperListeners);
}
/**
* Return the naming resources associated with this web application.
*/
public NamingResources getNamingResources() {
return (this.namingResources);
}
/**
* Remove the specified application listener class from the set of
* listeners for this application.
*
* @param listener Java class name of the listener to be removed
*/
public void removeApplicationListener(String listener) {
synchronized (applicationListeners) {
// Make sure this application listener is currently present
int n = -1;
for (int i = 0; i < applicationListeners.length; i++) {
if (applicationListeners[i].equals(listener)) {
n = i;
break;
}
}
if (n < 0)
return;
// Remove the specified application listener
int j = 0;
String results[] = new String[applicationListeners.length - 1];
for (int i = 0; i < applicationListeners.length; i++) {
if (i != n)
results[j++] = applicationListeners[i];
}
applicationListeners = results;
}
}
/**
* Remove the application parameter with the specified name from
* the set for this application.
*
* @param name Name of the application parameter to remove
*/
public void removeApplicationParameter(String name) {
synchronized (applicationParameters) {
// Make sure this parameter is currently present
int n = -1;
for (int i = 0; i < applicationParameters.length; i++) {
if (name.equals(applicationParameters[i].getName())) {
n = i;
break;
}
}
if (n < 0)
return;
// Remove the specified parameter
int j = 0;
ApplicationParameter results[] =
new ApplicationParameter[applicationParameters.length - 1];
for (int i = 0; i < applicationParameters.length; i++) {
if (i != n)
results[j++] = applicationParameters[i];
}
applicationParameters = results;
}
}
/**
* Remove any EJB resource reference with the specified name.
*
* @param name Name of the EJB resource reference to remove
*/
public void removeEjb(String name) {
namingResources.removeEjb(name);
}
/**
* Remove a class name from the set of InstanceListener classes that
* will be added to newly created Wrappers.
*
* @param listener Class name of an InstanceListener class to be removed
*/
public void removeInstanceListener(String listener) {
synchronized (instanceListeners) {
// Make sure this InstanceListener is currently present
int n = -1;
for (int i = 0; i < instanceListeners.length; i++) {
if (instanceListeners[i].equals(listener)) {
n = i;
break;
}
}
if (n < 0)
return;
// Remove the specified InstanceListener
int j = 0;
String results[] = new String[instanceListeners.length - 1];
for (int i = 0; i < instanceListeners.length; i++) {
if (i != n)
results[j++] = instanceListeners[i];
}
instanceListeners = results;
}
}
/**
* Remove the context initialization parameter with the specified
* name, if it exists; otherwise, no action is taken.
*
* @param name Name of the parameter to remove
*/
public void removeParameter(String name) {
synchronized (parameters) {
parameters.remove(name);
}
}
/**
* Remove a property change listener from this component.
*
* @param listener The listener to remove
*/
public void removePropertyChangeListener(PropertyChangeListener listener) {
support.removePropertyChangeListener(listener);
}
/**
* Remove any environment entry with the specified name.
*
* @param name Name of the environment entry to remove
*/
public void removeEnvironment(String envName) {
NamingResources nresources = getNamingResources();
if (nresources == null) {
return;
}
ContextEnvironment env = nresources.findEnvironment(envName);
if (env == null) {
throw new IllegalArgumentException
("Invalid environment name '" + envName + "'");
}
nresources.removeEnvironment(envName);
}
/**
* Remove any resource reference with the specified name.
*
* @param resourceName Name of the resource reference to remove
*/
public void removeResource(String resourceName) {
// That should be done in the UI
// resourceName = URLDecoder.decode(resourceName);
NamingResources nresources = getNamingResources();
if (nresources == null) {
return;
}
ContextResource resource = nresources.findResource(resourceName);
if (resource == null) {
throw new IllegalArgumentException
("Invalid resource name '" + resourceName + "'");
}
nresources.removeResource(resourceName);
}
/**
* Remove any resource link with the specified name.
*
* @param resourceName Name of the resource reference to remove
*/
public void removeResourceLink(String resourceLinkName) {
//resourceLinkName = URLDecoder.decode(resourceLinkName);
NamingResources nresources = getNamingResources();
if (nresources == null) {
return;
}
ContextResourceLink resource = nresources.findResourceLink(resourceLinkName);
if (resource == null) {
throw new IllegalArgumentException
("Invalid resource name '" + resourceLinkName + "'");
}
nresources.removeResourceLink(resourceLinkName);
}
/**
* Remove any resource environment reference with the specified name.
*
* @param name Name of the resource environment reference to remove
*/
public void removeResourceEnvRef(String name) {
namingResources.removeResourceEnvRef(name);
}
/**
* Remove a class name from the set of LifecycleListener classes that
* will be added to newly created Wrappers.
*
* @param listener Class name of a LifecycleListener class to be removed
*/
public void removeWrapperLifecycle(String listener) {
synchronized (wrapperLifecycles) {
// Make sure this LifecycleListener is currently present
int n = -1;
for (int i = 0; i < wrapperLifecycles.length; i++) {
if (wrapperLifecycles[i].equals(listener)) {
n = i;
break;
}
}
if (n < 0)
return;
// Remove the specified LifecycleListener
int j = 0;
String results[] = new String[wrapperLifecycles.length - 1];
for (int i = 0; i < wrapperLifecycles.length; i++) {
if (i != n)
results[j++] = wrapperLifecycles[i];
}
wrapperLifecycles = results;
}
}
/**
* Remove a class name from the set of ContainerListener classes that
* will be added to newly created Wrappers.
*
* @param listener Class name of a ContainerListener class to be removed
*/
public void removeWrapperListener(String listener) {
synchronized (wrapperListeners) {
// Make sure this ContainerListener is currently present
int n = -1;
for (int i = 0; i < wrapperListeners.length; i++) {
if (wrapperListeners[i].equals(listener)) {
n = i;
break;
}
}
if (n < 0)
return;
// Remove the specified ContainerListener
int j = 0;
String results[] = new String[wrapperListeners.length - 1];
for (int i = 0; i < wrapperListeners.length; i++) {
if (i != n)
results[j++] = wrapperListeners[i];
}
wrapperListeners = results;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -