use of com.sun.enterprise.deployment.BundleDescriptor in project Payara by payara.
the class WebServiceRuntimeNode 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) {
if (WebServicesTagNames.WEB_SERVICE_DESCRIPTION_NAME.equals(element.getQName())) {
BundleDescriptor parent = (BundleDescriptor) getParentNode().getDescriptor();
WebServicesDescriptor webServices = parent.getWebServices();
descriptor = webServices.getWebServiceByName(value);
} else if (WebServicesTagNames.CLIENT_WSDL_PUBLISH_URL.equals(element.getQName())) {
if (descriptor == null) {
DOLUtils.getDefaultLogger().info("Warning : WebService descriptor is null for " + "final wsdl url=" + value);
return;
}
try {
URL url = new URL(value);
descriptor.setClientPublishUrl(url);
} catch (MalformedURLException mue) {
DOLUtils.getDefaultLogger().log(Level.INFO, "Warning : Invalid final wsdl url=" + value, mue);
}
} else {
super.setElementValue(element, value);
}
}
use of com.sun.enterprise.deployment.BundleDescriptor in project Payara by payara.
the class ModuleScanner method calculateResults.
protected void calculateResults(T bundleDesc) {
try {
classParser.awaitTermination();
} catch (InterruptedException e) {
deplLogger.log(Level.SEVERE, ANNOTATION_SCANNING_EXCEPTION, e);
return;
}
Level logLevel = (System.getProperty("glassfish.deployment.dump.scanning") != null ? Level.INFO : Level.FINE);
boolean shouldLog = deplLogger.isLoggable(logLevel);
ParsingContext context = classParser.getContext();
boolean isFullAttribute = false;
if (bundleDesc instanceof BundleDescriptor) {
isFullAttribute = ((BundleDescriptor) bundleDesc).isFullAttribute();
}
Set<String> annotationsToProcess = defaultScanner.getAnnotations(isFullAttribute);
for (String annotation : annotationsToProcess) {
Type type = context.getTypes().getBy(annotation);
// we never found anyone using that type
if (type == null)
continue;
// is it an annotation
if (type instanceof AnnotationType) {
AnnotationType at = (AnnotationType) type;
for (AnnotatedElement ae : at.allAnnotatedTypes()) {
// if it is a member (field, method), let's retrieve the declaring type
// otherwise, use the annotated type directly.
Type t = (ae instanceof Member ? ((Member) ae).getDeclaringType() : (Type) ae);
if (t.wasDefinedIn(scannedURI)) {
if (shouldLog) {
if (Level.INFO.equals(logLevel)) {
deplLogger.log(Level.INFO, ANNOTATION_ADDED, new Object[] { t.getName(), ae.getName(), at.getName() });
} else {
deplLogger.log(Level.FINE, "Adding " + t.getName() + " since " + ae.getName() + " is annotated with " + at.getName());
}
}
entries.add(t.getName());
}
}
} else // or is it an interface ?
if (type instanceof InterfaceModel) {
InterfaceModel im = (InterfaceModel) type;
for (ClassModel cm : im.allImplementations()) {
if (shouldLog) {
if (Level.INFO.equals(logLevel)) {
deplLogger.log(Level.INFO, INTERFACE_ADDED, new Object[] { cm.getName(), im.getName() });
} else {
deplLogger.log(Level.FINE, "Adding " + cm.getName() + " since it is implementing " + im.getName());
}
}
entries.add(cm.getName());
}
} else {
deplLogger.log(Level.SEVERE, INCORRECT_ANNOTATION, annotation);
}
}
if (deplLogger.isLoggable(Level.FINE)) {
deplLogger.log(Level.FINE, "Done with results");
}
}
use of com.sun.enterprise.deployment.BundleDescriptor in project Payara by payara.
the class SingletonLifeCycleManager method normalizeSingletonName.
private String normalizeSingletonName(String origName, EjbSessionDescriptor sessionDesc) {
String normalizedName;
boolean fullyQualified = origName.contains("#");
Application app = sessionDesc.getEjbBundleDescriptor().getApplication();
if (fullyQualified) {
int indexOfHash = origName.indexOf("#");
String ejbName = origName.substring(indexOfHash + 1);
String relativeJarPath = origName.substring(0, indexOfHash);
BundleDescriptor bundle = app.getRelativeBundle(sessionDesc.getEjbBundleDescriptor(), relativeJarPath);
if (bundle == null) {
throw new IllegalStateException("Invalid @DependOn value = " + origName + " for Singleton " + sessionDesc.getName());
}
normalizedName = bundle.getModuleDescriptor().getArchiveUri() + "#" + ejbName;
} else {
normalizedName = sessionDesc.getEjbBundleDescriptor().getModuleDescriptor().getArchiveUri() + "#" + origName;
}
return normalizedName;
}
use of com.sun.enterprise.deployment.BundleDescriptor 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 com.sun.enterprise.deployment.BundleDescriptor in project Payara by payara.
the class BeanManagerNamingProxy method handle.
@Override
public Object handle(String name) throws NamingException {
Object beanManager = null;
if (BEAN_MANAGER_CONTEXT.equals(name)) {
try {
// Use invocation context to find applicable BeanDeploymentArchive.
ComponentInvocation inv = invocationManager.getCurrentInvocation();
if (inv != null) {
JndiNameEnvironment componentEnv = compEnvManager.getJndiNameEnvironment(inv.getComponentId());
if (componentEnv != null) {
BundleDescriptor bundle = null;
if (componentEnv instanceof EjbDescriptor) {
bundle = (BundleDescriptor) ((EjbDescriptor) componentEnv).getEjbBundleDescriptor().getModuleDescriptor().getDescriptor();
} else if (componentEnv instanceof WebBundleDescriptor) {
bundle = (BundleDescriptor) componentEnv;
}
if (bundle != null) {
BeanDeploymentArchive bda = weldDeployer.getBeanDeploymentArchiveForBundle(bundle);
if (bda != null) {
WeldBootstrap bootstrap = weldDeployer.getBootstrapForApp(bundle.getApplication());
// System.out.println("BeanManagerNamingProxy:: getting BeanManagerImpl for" + bda);
beanManager = bootstrap.getManager(bda);
}
}
if (beanManager == null) {
throw new IllegalStateException("Cannot resolve bean manager");
}
} else {
throw new IllegalStateException("No invocation context found");
}
}
} catch (Throwable t) {
NamingException ne = new NamingException("Error retrieving java:comp/BeanManager");
ne.initCause(t);
throw ne;
}
}
return beanManager;
}
Aggregations