use of org.apache.catalina.deploy.NamingResourcesImpl in project tomcat by apache.
the class StandardServer method setGlobalNamingResources.
/**
* Set the global naming resources.
*
* @param globalNamingResources The new global naming resources
*/
@Override
public void setGlobalNamingResources(NamingResourcesImpl globalNamingResources) {
NamingResourcesImpl oldGlobalNamingResources = this.globalNamingResources;
this.globalNamingResources = globalNamingResources;
this.globalNamingResources.setContainer(this);
support.firePropertyChange("globalNamingResources", oldGlobalNamingResources, this.globalNamingResources);
}
use of org.apache.catalina.deploy.NamingResourcesImpl in project tomcat by apache.
the class NamingResourcesMBean method removeResource.
/**
* Remove any resource reference with the specified name.
*
* @param resourceName Name of the resource reference to remove
*/
public void removeResource(String resourceName) {
resourceName = ObjectName.unquote(resourceName);
NamingResourcesImpl nresources = (NamingResourcesImpl) this.resource;
if (nresources == null) {
return;
}
ContextResource resource = nresources.findResource(resourceName);
if (resource == null) {
throw new IllegalArgumentException(sm.getString("namingResourcesMBean.removeNotFound.resource", resourceName));
}
nresources.removeResource(resourceName);
}
use of org.apache.catalina.deploy.NamingResourcesImpl in project tomcat by apache.
the class NamingResourcesMBean method removeEnvironment.
/**
* Remove any environment entry with the specified name.
*
* @param envName Name of the environment entry to remove
*/
public void removeEnvironment(String envName) {
NamingResourcesImpl nresources = (NamingResourcesImpl) this.resource;
if (nresources == null) {
return;
}
ContextEnvironment env = nresources.findEnvironment(envName);
if (env == null) {
throw new IllegalArgumentException(sm.getString("namingResourcesMBean.removeNotFound.environment", envName));
}
nresources.removeEnvironment(envName);
}
use of org.apache.catalina.deploy.NamingResourcesImpl in project tomcat by apache.
the class NamingResourcesSF method storeChildren.
/**
* Store the specified NamingResources properties.
*
* @param aWriter
* PrintWriter to which we are storing
* @param indent
* Number of spaces to indent this element
* @param aElement
* Object whose properties are being stored
* @param elementDesc
* element descriptor
*
* @exception Exception
* if an exception occurs while storing
*
* @see org.apache.catalina.storeconfig.StoreFactoryBase#storeChildren(java.io.PrintWriter,
* int, java.lang.Object, StoreDescription)
*/
@Override
public void storeChildren(PrintWriter aWriter, int indent, Object aElement, StoreDescription elementDesc) throws Exception {
if (aElement instanceof NamingResourcesImpl) {
NamingResourcesImpl resources = (NamingResourcesImpl) aElement;
// Store nested <Ejb> elements
ContextEjb[] ejbs = resources.findEjbs();
storeElementArray(aWriter, indent, ejbs);
// Store nested <Environment> elements
ContextEnvironment[] envs = resources.findEnvironments();
storeElementArray(aWriter, indent, envs);
// Store nested <LocalEjb> elements
ContextLocalEjb[] lejbs = resources.findLocalEjbs();
storeElementArray(aWriter, indent, lejbs);
// Store nested <Resource> elements
ContextResource[] dresources = resources.findResources();
storeElementArray(aWriter, indent, dresources);
// Store nested <ResourceEnvRef> elements
ContextResourceEnvRef[] resEnv = resources.findResourceEnvRefs();
storeElementArray(aWriter, indent, resEnv);
// Store nested <ResourceLink> elements
ContextResourceLink[] resourceLinks = resources.findResourceLinks();
storeElementArray(aWriter, indent, resourceLinks);
}
}
use of org.apache.catalina.deploy.NamingResourcesImpl in project tomcat by apache.
the class StandardContextSF method storeChildren.
/**
* Store the specified context element children.
*
* @param aWriter Current output writer
* @param indent Indentation level
* @param aContext Context to store
* @param parentDesc The element description
* @throws Exception Configuration storing error
*/
@Override
public void storeChildren(PrintWriter aWriter, int indent, Object aContext, StoreDescription parentDesc) throws Exception {
if (aContext instanceof StandardContext) {
StandardContext context = (StandardContext) aContext;
// Store nested <Listener> elements
LifecycleListener[] listeners = context.findLifecycleListeners();
List<LifecycleListener> listenersArray = new ArrayList<>();
for (LifecycleListener listener : listeners) {
if (!(listener instanceof ThreadLocalLeakPreventionListener)) {
listenersArray.add(listener);
}
}
storeElementArray(aWriter, indent, listenersArray.toArray());
// Store nested <Valve> elements
Valve[] valves = context.getPipeline().getValves();
storeElementArray(aWriter, indent, valves);
// Store nested <Loader> elements
Loader loader = context.getLoader();
storeElement(aWriter, indent, loader);
// Store nested <Manager> elements
if (context.getCluster() == null || !context.getDistributable()) {
Manager manager = context.getManager();
storeElement(aWriter, indent, manager);
}
// Store nested <Realm> element
Realm realm = context.getRealm();
if (realm != null) {
Realm parentRealm = null;
// @TODO is this case possible?
if (context.getParent() != null) {
parentRealm = context.getParent().getRealm();
}
if (realm != parentRealm) {
storeElement(aWriter, indent, realm);
}
}
// Store nested resources
WebResourceRoot resources = context.getResources();
storeElement(aWriter, indent, resources);
// Store nested <WrapperListener> elements
String[] wLifecycles = context.findWrapperLifecycles();
getStoreAppender().printTagArray(aWriter, "WrapperListener", indent + 2, wLifecycles);
// Store nested <WrapperLifecycle> elements
String[] wListeners = context.findWrapperListeners();
getStoreAppender().printTagArray(aWriter, "WrapperLifecycle", indent + 2, wListeners);
// Store nested <Parameter> elements
ApplicationParameter[] appParams = context.findApplicationParameters();
storeElementArray(aWriter, indent, appParams);
// Store nested naming resources elements (EJB,Resource,...)
NamingResourcesImpl nresources = context.getNamingResources();
storeElement(aWriter, indent, nresources);
// Store nested watched resources <WatchedResource>
String[] wresources = context.findWatchedResources();
wresources = filterWatchedResources(context, wresources);
getStoreAppender().printTagArray(aWriter, "WatchedResource", indent + 2, wresources);
// Store nested <JarScanner> elements
JarScanner jarScanner = context.getJarScanner();
storeElement(aWriter, indent, jarScanner);
// Store nested <CookieProcessor> elements
CookieProcessor cookieProcessor = context.getCookieProcessor();
storeElement(aWriter, indent, cookieProcessor);
}
}
Aggregations