use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.
the class ApplicationRuntimeNode method setElementValue.
/**
* receives notification of the value for a particular tag
*
* @param element the xml element
* @param value it's associated value
*/
public void setElementValue(XMLElement element, String value) {
if (element.getQName().equals(RuntimeTagNames.PASS_BY_REFERENCE)) {
descriptor.setPassByReference("true".equalsIgnoreCase(value));
} else if (element.getQName().equals(RuntimeTagNames.UNIQUE_ID)) {
DOLUtils.getDefaultLogger().finer("Ignoring unique id");
return;
} else if (element.getQName().equals(RuntimeTagNames.ARCHIVE_NAME)) {
descriptor.setArchiveName(value);
} else if (element.getQName().equals(RuntimeTagNames.COMPATIBILITY)) {
descriptor.setCompatibility(value);
} else if (element.getQName().equals(RuntimeTagNames.PAYARA_CLASSLOADING_DELEGATE)) {
descriptor.setClassLoadingDelegate(value);
} else if (element.getQName().equals(RuntimeTagNames.PAYARA_ENABLE_IMPLICIT_CDI)) {
// ignore, handled in EarHandler.java
} else if (element.getQName().equals(RuntimeTagNames.PAYARA_SCANNING_EXCLUDE)) {
descriptor.addScanningExclusions(ImmutableList.of(value));
} else if (element.getQName().equals(RuntimeTagNames.PAYARA_SCANNING_INCLUDE)) {
descriptor.addScanningInclusions(ImmutableList.of(value));
} else if (element.getQName().equals(RuntimeTagNames.PAYARA_WHITELIST_PACKAGE)) {
descriptor.addWhitelistPackage(value);
} else if (element.getQName().equals(RuntimeTagNames.WEB_URI)) {
currentWebUri = value;
} else if (element.getQName().equals(RuntimeTagNames.CONTEXT_ROOT)) {
if (currentWebUri != null) {
ModuleDescriptor md = descriptor.getModuleDescriptorByUri(currentWebUri);
if (md == null) {
throw new RuntimeException("No bundle in application with uri " + currentWebUri);
}
currentWebUri = null;
if (md.getModuleType().equals(DOLUtils.warType())) {
md.setContextRoot(value);
} else {
throw new RuntimeException(currentWebUri + " uri does not point to a web bundle");
}
} else {
throw new RuntimeException("No uri provided for this context-root " + value);
}
} else if (element.getQName().equals(RuntimeTagNames.KEEP_STATE)) {
descriptor.setKeepState(value);
} else if (element.getQName().equals(RuntimeTagNames.VERSION_IDENTIFIER)) {
} else
super.setElementValue(element, value);
}
use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.
the class CheckMgr method getAbstractArchiveUri.
protected String getAbstractArchiveUri(Descriptor descriptor) {
String archBase = context.getAbstractArchive().getURI().toString();
if (descriptor instanceof Application)
return archBase;
ModuleDescriptor mdesc = getBundleDescriptor(descriptor).getModuleDescriptor();
if (mdesc.isStandalone()) {
return archBase;
} else {
return archBase + "/" + FileUtils.makeFriendlyFilename(mdesc.getArchiveUri());
}
}
use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.
the class PersistenceUnitCheckMgrImpl method getAbstractArchiveUri.
/**
* This method returns the path to the module.
* @param descriptor is a PersistenceUnitDescriptor
* @return the path to the module
*/
protected String getAbstractArchiveUri(Descriptor descriptor) {
String archBase = context.getAbstractArchive().getURI().toString();
RootDeploymentDescriptor rootDD = PersistenceUnitDescriptor.class.cast(descriptor).getParent().getParent();
if (rootDD.isApplication()) {
return archBase;
} else {
ModuleDescriptor mdesc = BundleDescriptor.class.cast(rootDD).getModuleDescriptor();
if (mdesc.isStandalone()) {
return archBase;
} else {
return archBase + "/" + FileUtils.makeFriendlyFilename(mdesc.getArchiveUri());
}
}
}
use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.
the class WsUtil method handleGet.
/**
* Serve up the FINAL wsdl associated with this web service.
* @return true for success, false for failure
*/
public boolean handleGet(HttpServletRequest request, HttpServletResponse response, WebServiceEndpoint endpoint) throws IOException {
MimeHeaders headers = getHeaders(request);
if (hasSomeTextXmlContent(headers)) {
String message = MessageFormat.format(logger.getResourceBundle().getString(LogUtils.GET_RECEIVED), endpoint.getEndpointName(), endpoint.getEndpointAddressUri());
writeInvalidMethodType(response, message);
logger.info(message);
return false;
}
URL wsdlUrl = null;
String requestUriRaw = request.getRequestURI();
String requestUri = (requestUriRaw.charAt(0) == '/') ? requestUriRaw.substring(1) : requestUriRaw;
String queryString = request.getQueryString();
WebService webService = endpoint.getWebService();
if (queryString == null) {
// Get portion of request uri representing location within a module
String wsdlPath = endpoint.getWsdlContentPath(requestUri);
if (wsdlPath != null) {
ModuleDescriptor module = webService.getBundleDescriptor().getModuleDescriptor();
if (wsdlPath.equals(webService.getWsdlFileUri())) {
// If the request is for the main wsdl document, return
// the final wsdl instead of the wsdl from the module.
wsdlUrl = webService.getWsdlFileUrl();
} else if (isWsdlContent(wsdlPath, webService.getBundleDescriptor())) {
// For relative document imports. These documents do not
// require modification during deployment, so serve them
// up directly from the packaged module. isWsdlContent()
// check ensures we don't serve up arbitrary content from
// the module.
URL finalWsdlUrl = webService.getWsdlFileUrl();
String finalWsdlPath = finalWsdlUrl.getPath();
// remove the final wsdl uri from the above path
String wsdlDirPath = finalWsdlPath.substring(0, finalWsdlPath.length() - webService.getWsdlFileUri().length());
File wsdlDir = new File(wsdlDirPath);
File wsdlFile = new File(wsdlDir, wsdlPath.replace('/', File.separatorChar));
try {
wsdlUrl = wsdlFile.toURL();
} catch (MalformedURLException mue) {
String msg = MessageFormat.format(logger.getResourceBundle().getString(LogUtils.FAILURE_SERVING_WSDL), webService.getName());
logger.log(Level.INFO, msg, mue);
}
}
}
} else if (queryString.equalsIgnoreCase("WSDL")) {
wsdlUrl = webService.getWsdlFileUrl();
}
boolean success = false;
if (wsdlUrl != null) {
InputStream is = null;
try {
response.setContentType("text/xml");
response.setStatus(HttpServletResponse.SC_OK);
// than the one they were deployed on (DAS).
if (wsdlUrl.toURI().equals(webService.getWsdlFileUrl().toURI())) {
// get the application module ID
try {
WebServerInfo wsi = getWebServerInfoForDAS();
URL url = webService.getWsdlFileUrl();
File originalWsdlFile = new File(url.getPath() + "__orig");
if (!originalWsdlFile.exists()) {
originalWsdlFile = new File(url.getPath());
}
generateFinalWsdl(originalWsdlFile.toURL(), webService, wsi, response.getOutputStream());
} catch (Exception e) {
// if this fail, we revert to service the untouched
// repository item.
URLConnection urlCon = wsdlUrl.openConnection();
urlCon.setUseCaches(false);
is = urlCon.getInputStream();
copyIsToOs(is, response.getOutputStream());
}
} else {
// Copy bytes into output. Disable caches to avoid jar URL
// caching problem.
URLConnection urlCon = wsdlUrl.openConnection();
urlCon.setUseCaches(false);
is = urlCon.getInputStream();
copyIsToOs(is, response.getOutputStream());
}
success = true;
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, LogUtils.SERVING_FINAL_WSDL, new Object[] { wsdlUrl, request.getRequestURL() + (queryString != null ? ("?" + queryString) : "") });
}
} catch (Exception e) {
String msg = MessageFormat.format(logger.getResourceBundle().getString(LogUtils.FAILURE_SERVING_WSDL), webService.getName());
logger.log(Level.INFO, msg, e);
} finally {
if (is != null) {
try {
is.close();
} catch (IOException ex) {
}
}
}
}
if (!success) {
String message = MessageFormat.format(logger.getResourceBundle().getString(LogUtils.INVALID_WSDL_REQUEST), request.getRequestURL() + (queryString != null ? ("?" + queryString) : ""), webService.getName());
logger.info(message);
writeInvalidMethodType(response, message);
}
return success;
}
use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.
the class Application method addBundleDescriptor.
/**
* Add a bundle descriptor to this application.
*
* @param bundleDescriptor the bundle descriptor to add
*/
@Override
public void addBundleDescriptor(BundleDescriptor bundleDescriptor) {
ModuleDescriptor newModule = bundleDescriptor.getModuleDescriptor();
addModule(newModule);
}
Aggregations