use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.
the class Application method getBundleDescriptors.
/**
* Obtain a full set of bundle descriptors for a particular type
*
* @param type the bundle descriptor type requested
* @return the set of bundle descriptors
*/
public <T extends BundleDescriptor> Set<T> getBundleDescriptors(Class<T> type) {
if (type == null) {
return null;
}
Set<T> bundleSet = new OrderedSet<T>();
for (ModuleDescriptor aModule : getModules()) {
try {
T descriptor = type.cast(aModule.getDescriptor());
bundleSet.add(descriptor);
} catch (ClassCastException e) {
// ignore
}
// type has nothing to do with the children extensions.
if (aModule.getDescriptor() != null) {
bundleSet.addAll(aModule.getDescriptor().getExtensionsDescriptors(type));
}
}
return bundleSet;
}
use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.
the class WSTest method getAbstractArchiveUri.
protected String getAbstractArchiveUri(WebServiceEndpoint desc) {
String archBase = getVerifierContext().getAbstractArchive().getURI().toString();
final ModuleDescriptor moduleDescriptor = desc.getBundleDescriptor().getModuleDescriptor();
if (moduleDescriptor.isStandalone()) {
// it must be a stand-alone module; no such physical dir exists
return archBase;
} else {
return archBase + "/" + FileUtils.makeFriendlyFilename(moduleDescriptor.getArchiveUri());
}
}
use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.
the class JarNotFound method getAbsolutePuRoot.
/**
* This method calculates the absolute path of the root of a PU.
* Absolute path is not the path with regards to root of file system.
* It is the path from the root of the Java EE application this
* persistence unit belongs to.
* Returned path always uses '/' as path separator.
* @param applicationLocation absolute path of application root
* @param persistenceUnitDescriptor
* @return the absolute path of the root of this persistence unit
*/
private String getAbsolutePuRoot(String applicationLocation, PersistenceUnitDescriptor persistenceUnitDescriptor) {
RootDeploymentDescriptor rootDD = persistenceUnitDescriptor.getParent().getParent();
String puRoot = persistenceUnitDescriptor.getPuRoot();
if (rootDD.isApplication()) {
return puRoot;
} else {
ModuleDescriptor module = BundleDescriptor.class.cast(rootDD).getModuleDescriptor();
if (module.isStandalone()) {
return puRoot;
} else {
final String moduleLocation = DeploymentUtils.getRelativeEmbeddedModulePath(applicationLocation, module.getArchiveUri());
// see we always '/'
return moduleLocation + '/' + puRoot;
}
}
}
use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.
the class EJBContainerProviderImpl method getRequestedEJBModuleOrLibrary.
/**
* @returns DeploymentElement if this file represents an EJB module or a library.
* Returns null if it's an EJB module which name is not present in the list of requested
* module names.
*/
private DeploymentElement getRequestedEJBModuleOrLibrary(File file, Map<String, Boolean> moduleNames) throws Exception {
DeploymentElement result = null;
String fileName = file.getName();
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("... Testing ... " + fileName);
}
ReadableArchive archive = null;
InputStream is = null;
try {
boolean isEJBModule = false;
String moduleName = DeploymentUtils.getDefaultEEName(fileName);
archive = archiveFactory.openArchive(file);
is = getDeploymentDescriptor(archive);
if (is != null) {
isEJBModule = true;
EjbDeploymentDescriptorFile eddf = new EjbDeploymentDescriptorFile();
eddf.setXMLValidation(false);
EjbBundleDescriptor bundleDesc = (EjbBundleDescriptor) eddf.read(is);
ModuleDescriptor moduleDesc = bundleDesc.getModuleDescriptor();
moduleDesc.setArchiveUri(fileName);
moduleName = moduleDesc.getModuleName();
} else {
GenericAnnotationDetector detector = new GenericAnnotationDetector(ejbAnnotations);
isEJBModule = detector.hasAnnotationInArchive(archive);
}
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("... is EJB module: " + isEJBModule);
if (isEJBModule) {
_logger.fine("... is Requested EJB module [" + moduleName + "]: " + (moduleNames.isEmpty() || moduleNames.containsKey(moduleName)));
}
}
if (!isEJBModule || moduleNames.isEmpty()) {
result = new DeploymentElement(file, isEJBModule, moduleName);
} else if (moduleNames.containsKey(moduleName) && !moduleNames.get(moduleName)) {
// Is a requested EJB module and was not found already
result = new DeploymentElement(file, isEJBModule, moduleName);
moduleNames.put(moduleName, true);
}
return result;
} finally {
if (archive != null)
archive.close();
if (is != null)
is.close();
}
}
use of org.glassfish.deployment.common.ModuleDescriptor in project Payara by payara.
the class PipeHelper method getClientModuleID.
private static String getClientModuleID(ServiceReferenceDescriptor srd) {
String rvalue = "#default-client-context#";
if (srd != null) {
ModuleDescriptor md = null;
BundleDescriptor bd = (BundleDescriptor) srd.getBundleDescriptor();
if (bd != null) {
md = bd.getModuleDescriptor();
}
Application a = (bd == null) ? null : bd.getApplication();
if (a != null) {
if (a.isVirtual()) {
rvalue = a.getRegistrationName();
} else if (md != null) {
rvalue = FileUtils.makeFriendlyFilename(md.getArchiveUri());
}
} else if (md != null) {
rvalue = FileUtils.makeFriendlyFilename(md.getArchiveUri());
}
}
return rvalue;
}
Aggregations