use of com.sun.enterprise.config.serverbeans.ConfigBeansUtilities in project Payara by payara.
the class VirtualServer method getDefaultWebModule.
protected WebModuleConfig getDefaultWebModule(Domain domain, WebArchivist webArchivist, ApplicationRegistry appRegistry) {
WebModuleConfig webModuleConfig = null;
String defaultWebModuleId = getDefaultWebModuleID();
if (defaultWebModuleId != null) {
// Check if the default-web-module is part of an ee-application
webModuleConfig = findWebModuleInJ2eeApp(domain.getApplications(), defaultWebModuleId, appRegistry);
if (webModuleConfig == null) {
String contextRoot = null;
String location = null;
ConfigBeansUtilities configBeansUtilities = getConfigBeansUtilities();
if (configBeansUtilities != null) {
contextRoot = configBeansUtilities.getContextRoot(defaultWebModuleId);
location = configBeansUtilities.getLocation(defaultWebModuleId);
}
if (contextRoot != null && location != null) {
WebBundleDescriptorImpl webBundleDescriptorImpl = webArchivist.getDefaultWebXmlBundleDescriptor();
webBundleDescriptorImpl.setName(DEFAULT_WEB_MODULE_NAME);
webBundleDescriptorImpl.setContextRoot(contextRoot);
webModuleConfig = new WebModuleConfig();
webModuleConfig.setLocation(new File(location));
webModuleConfig.setDescriptor(webBundleDescriptorImpl);
webModuleConfig.setParentLoader(EmbeddedWebContainer.class.getClassLoader());
webModuleConfig.setAppClassLoader(privileged(() -> new WebappClassLoader(EmbeddedWebContainer.class.getClassLoader(), webBundleDescriptorImpl.getApplication())));
}
}
if (webModuleConfig == null) {
_logger.log(SEVERE, VS_DEFAULT_WEB_MODULE_NOT_FOUND, new Object[] { defaultWebModuleId, getID() });
}
}
return webModuleConfig;
}
use of com.sun.enterprise.config.serverbeans.ConfigBeansUtilities in project Payara by payara.
the class VirtualServer method getDefaultContextPath.
// ------------------------------------------------------ Protected Methods
/**
* Gets the context root of the web module that the user/configuration has designated as the default-web-module for this
* virtual server.
*
* The default-web-module for a virtual server is specified via the 'default-web-module' attribute of the
* 'virtual-server' element in server.xml. This is an optional attribute and if the configuration does not specify
* another web module (standalone or part of a j2ee-application) that is configured at a context-root="", then a default
* web module will be created and loaded. The value for this attribute is either "${standalone-web-module-name}" or
* "${j2ee-app-name}:${web-module-uri}".
*
* @param domain
* @param appRegistry
* @return null if the default-web-module has not been specified or if the web module specified either could not be
* found or is disabled or does not specify this virtual server (if it specifies a value for the virtual-servers
* attribute) or if there was an error loading its deployment descriptors.
*/
protected String getDefaultContextPath(Domain domain, ApplicationRegistry appRegistry) {
String contextRoot = null;
String defaultWebModuleId = getDefaultWebModuleID();
if (defaultWebModuleId != null) {
// Check if the default-web-module is part of a
// j2ee-application
Applications appsBean = domain.getApplications();
WebModuleConfig webModuleConfig = findWebModuleInJ2eeApp(appsBean, defaultWebModuleId, appRegistry);
if (webModuleConfig == null) {
ConfigBeansUtilities configBeansUtilities = getConfigBeansUtilities();
if (configBeansUtilities == null) {
contextRoot = null;
} else {
contextRoot = configBeansUtilities.getContextRoot(defaultWebModuleId);
}
} else {
contextRoot = webModuleConfig.getContextPath();
}
if (contextRoot == null) {
_logger.log(SEVERE, VS_DEFAULT_WEB_MODULE_NOT_FOUND, new Object[] { defaultWebModuleId, getID() });
}
}
return contextRoot;
}
use of com.sun.enterprise.config.serverbeans.ConfigBeansUtilities in project Payara by payara.
the class NotDuplicateTargetNameValidator method initialize.
@Override
public void initialize(NotDuplicateTargetName constraintAnnotation) {
ServiceLocator locator = ServiceLocatorFactory.getInstance().find("default");
if (locator == null)
return;
ConfigBeansUtilities cbu = locator.getService(ConfigBeansUtilities.class);
if (cbu == null)
return;
domain = cbu.getDomain();
}
Aggregations