use of com.sun.enterprise.deployment.BundleDescriptor in project Payara by payara.
the class ManagedBeanManagerImpl method createManagedBean.
public <T> T createManagedBean(Class<T> managedBeanClass) throws Exception {
ManagedBeanDescriptor managedBeanDesc = null;
try {
BundleDescriptor bundle = getBundle();
managedBeanDesc = bundle.getManagedBeanByBeanClass(managedBeanClass.getName());
} catch (Exception e) {
// OK. Can mean that it's not annotated with @ManagedBean but 299 can handle it.
}
return createManagedBean(managedBeanDesc, managedBeanClass);
}
use of com.sun.enterprise.deployment.BundleDescriptor in project Payara by payara.
the class EjbBundleValidator method checkDependsOn.
private void checkDependsOn(EjbDescriptor ejb) {
if (ejb instanceof EjbSessionDescriptor) {
EjbSessionDescriptor sessionDesc = (EjbSessionDescriptor) ejb;
if (sessionDesc.hasDependsOn()) {
if (!sessionDesc.isSingleton()) {
throw new RuntimeException("Illegal usage of DependsOn for EJB " + ejb.getName() + ". DependsOn is only supported for Singleton beans");
}
String[] dependsOn = sessionDesc.getDependsOn();
for (String next : dependsOn) {
// TODO support new EJB 3.1 syntax
boolean fullyQualified = next.contains("#");
Application app = sessionDesc.getEjbBundleDescriptor().getApplication();
if (fullyQualified) {
int indexOfHash = next.indexOf("#");
String ejbName = next.substring(indexOfHash + 1);
String relativeJarPath = next.substring(0, indexOfHash);
BundleDescriptor bundle = app.getRelativeBundle(sessionDesc.getEjbBundleDescriptor(), relativeJarPath);
if (bundle == null) {
throw new IllegalStateException("Invalid @DependOn value = " + next + " for Singleton " + sessionDesc.getName());
}
EjbBundleDescriptorImpl ejbBundle = (bundle.getModuleType() != null && bundle.getModuleType().equals(DOLUtils.warType())) ? bundle.getExtensionsDescriptors(EjbBundleDescriptorImpl.class).iterator().next() : (EjbBundleDescriptorImpl) bundle;
if (!ejbBundle.hasEjbByName(ejbName)) {
throw new RuntimeException("Invalid DependsOn dependency '" + next + "' for EJB " + ejb.getName());
}
} else {
EjbBundleDescriptorImpl bundle = ejb.getEjbBundleDescriptor();
if (!bundle.hasEjbByName(next)) {
throw new RuntimeException("Invalid DependsOn dependency '" + next + "' for EJB " + ejb.getName());
}
}
}
}
}
}
use of com.sun.enterprise.deployment.BundleDescriptor in project Payara by payara.
the class DataSourceDefinitionDeployer method registerDataSourceDefinitions.
public void registerDataSourceDefinitions(com.sun.enterprise.deployment.Application application) {
String appName = application.getAppName();
// Register data source definitions defined in application.xml
registerDataSourceDefinitions(appName, application);
// Register data source definition defined in web.xml and ejb-jar.xml
for (BundleDescriptor bundle : application.getBundleDescriptors()) {
registerDataSourceDefinitions(appName, bundle);
Collection<RootDeploymentDescriptor> descriptors = bundle.getExtensionsDescriptors();
if (descriptors != null) {
for (Descriptor descriptor : descriptors) {
registerDataSourceDefinitions(appName, descriptor);
}
}
}
}
use of com.sun.enterprise.deployment.BundleDescriptor in project Payara by payara.
the class RoleMapper method getAppDefaultRoleMapping.
private boolean getAppDefaultRoleMapping() {
if (appDefaultMapping != null) {
return appDefaultMapping;
}
appDefaultMapping = false;
if (secService != null) {
appDefaultMapping = Boolean.parseBoolean(secService.getActivateDefaultPrincipalToRoleMapping());
if (appDefaultMapping) {
// if set explicitly in the security service allow default mapping
return appDefaultMapping;
}
}
ApplicationRegistry appRegistry = Globals.getDefaultHabitat().getService(ApplicationRegistry.class);
ApplicationInfo appInfo = appRegistry.get(appName);
if (appInfo == null) {
return appDefaultMapping;
}
Application app = appInfo.getMetaData(Application.class);
BundleDescriptor bd = app.getModuleByUri(appName);
appDefaultMapping = bd == null ? app.isDefaultGroupPrincipalMapping() : app.getModuleByUri(appName).isDefaultGroupPrincipalMapping();
return appDefaultMapping;
}
use of com.sun.enterprise.deployment.BundleDescriptor 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