use of org.glassfish.deployment.common.RootDeploymentDescriptor in project Payara by payara.
the class MessageDestinationReferencerImpl method resolveLinkName.
/**
* Try to resolve the current link name value to a MessageDestination
* object.
*
* @return MessageDestination to which link was resolved, or null if
* link name resolution failed.
*/
public MessageDestinationDescriptor resolveLinkName() {
MessageDestinationDescriptor msgDest = null;
String linkName = messageDestinationLinkName;
if ((linkName != null) && (linkName.length() > 0)) {
int hashIndex = linkName.indexOf('#');
BundleDescriptor bundleDescriptor = getBundleDescriptor();
Application app = bundleDescriptor.getApplication();
if (app == null && bundleDescriptor instanceof Application) {
app = (Application) bundleDescriptor;
}
BundleDescriptor targetBundle = null;
String msgDestName = linkName;
if (app != null) {
// explicit reference to another module
if (hashIndex != -1) {
String relativeModuleUri = linkName.substring(0, hashIndex);
msgDestName = linkName.substring(hashIndex + 1);
targetBundle = app.getRelativeBundle(bundleDescriptor, relativeModuleUri);
} else {
// required search ordering.
if (!bundleDescriptor.hasMessageDestinationByName(msgDestName)) {
Set modules = app.getBundleDescriptors();
for (Iterator iter = modules.iterator(); iter.hasNext(); ) {
BundleDescriptor next = (BundleDescriptor) iter.next();
if (next.hasMessageDestinationByName(msgDestName)) {
targetBundle = next;
break;
}
}
// for ejb in war case
if (targetBundle == null) {
Collection<RootDeploymentDescriptor> extensionBundles = bundleDescriptor.getExtensionsDescriptors();
for (Iterator<RootDeploymentDescriptor> itr = extensionBundles.iterator(); itr.hasNext(); ) {
RootDeploymentDescriptor next = itr.next();
if (next instanceof BundleDescriptor) {
if (((BundleDescriptor) next).hasMessageDestinationByName(msgDestName)) {
targetBundle = (BundleDescriptor) next;
break;
}
}
}
}
} else {
targetBundle = bundleDescriptor;
}
}
}
try {
if (targetBundle != null) {
msgDest = targetBundle.getMessageDestinationByName(msgDestName);
}
} catch (IllegalArgumentException iae) {
}
}
if (msgDest != null) {
setMessageDestination(msgDest);
}
return msgDest;
}
use of org.glassfish.deployment.common.RootDeploymentDescriptor 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.RootDeploymentDescriptor in project Payara by payara.
the class PrincipalNameNode method setElementValue.
/**
* receives notiification 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) {
PrincipalNameDescriptor principal = (PrincipalNameDescriptor) getDescriptor();
if (RuntimeTagNames.PRINCIPAL_NAME.equals(element.getQName())) {
principal.setName(value);
Object rootDesc = getParentNode().getParentNode().getDescriptor();
if (rootDesc instanceof RootDeploymentDescriptor) {
principal.setClassLoader(((RootDeploymentDescriptor) rootDesc).getClassLoader());
}
} else
super.setElementValue(element, value);
}
use of org.glassfish.deployment.common.RootDeploymentDescriptor in project Payara by payara.
the class DataSourceDefinitionDeployer method unRegisterDataSourceDefinitions.
public void unRegisterDataSourceDefinitions(com.sun.enterprise.deployment.Application application) {
Set<BundleDescriptor> bundles = application.getBundleDescriptors();
for (BundleDescriptor bundle : bundles) {
unRegisterDataSourceDefinitions(application.getName(), bundle);
Collection<RootDeploymentDescriptor> dds = bundle.getExtensionsDescriptors();
if (dds != null) {
for (RootDeploymentDescriptor dd : dds) {
unRegisterDataSourceDefinitions(application.getName(), dd);
}
}
}
}
use of org.glassfish.deployment.common.RootDeploymentDescriptor in project Payara by payara.
the class AppSpecificConnectorClassLoaderUtil method detectReferredRARs.
/**
* {@inheritDoc}
*/
public void detectReferredRARs(String appName) {
ApplicationInfo appInfo = appRegistry.get(appName);
// call to detectReferredRAs can be called only when appInfo is available
if (appInfo == null) {
throw new IllegalStateException("ApplicationInfo is not available for application [ " + appName + " ]");
}
Application app = appInfo.getMetaData(Application.class);
if (!appInfo.isJavaEEApp()) {
if (_logger.isLoggable(Level.FINEST)) {
_logger.finest("Application [" + appName + "] is not a Java EE application, skipping " + "resource-adapter references detection");
}
return;
}
// Iterate through all bundle descriptors, ejb-descriptors, managed-bean descriptors
// for references to resource-adapters
//
// References can be via :
// resource-ref
// resource-env-ref
// ra-mid
//
// Resource definition can be found in :
// domain.xml
// sun-ra.xml
// default connector resource
// handle application.xml bundle descriptor
processDescriptorForRAReferences(app, null, app);
Collection<BundleDescriptor> bundleDescriptors = app.getBundleDescriptors();
// bundle descriptors
for (BundleDescriptor bundleDesc : bundleDescriptors) {
String moduleName = getModuleName(bundleDesc, app);
processDescriptorForRAReferences(app, bundleDesc, moduleName);
Collection<RootDeploymentDescriptor> dds = bundleDesc.getExtensionsDescriptors();
if (dds != null) {
for (RootDeploymentDescriptor dd : dds) {
processDescriptorForRAReferences(app, dd, moduleName);
}
}
}
}
Aggregations