use of com.sun.enterprise.deployment.ApplicationClientDescriptor in project Payara by payara.
the class ActiveJmsResourceAdapter method getJMSDestination.
/*
* Get JMS destination resource from application
*/
private JMSDestinationDefinitionDescriptor getJMSDestination(String logicalDestination, Application application) {
if (application == null) {
return null;
}
JMSDestinationDefinitionDescriptor destination = getJMSDestination(logicalDestination, application.getResourceDescriptors(JavaEEResourceType.JMSDD));
if (isValidDestination(destination)) {
return destination;
}
Set<WebBundleDescriptor> webBundleDescriptors = application.getBundleDescriptors(WebBundleDescriptor.class);
for (WebBundleDescriptor webBundleDescriptor : webBundleDescriptors) {
destination = getJMSDestination(logicalDestination, webBundleDescriptor.getResourceDescriptors(JavaEEResourceType.JMSDD));
if (isValidDestination(destination)) {
return destination;
}
}
Set<EjbBundleDescriptor> ejbBundleDescriptors = application.getBundleDescriptors(EjbBundleDescriptor.class);
for (EjbBundleDescriptor ejbBundleDescriptor : ejbBundleDescriptors) {
destination = getJMSDestination(logicalDestination, ejbBundleDescriptor);
if (isValidDestination(destination)) {
return destination;
}
}
Set<ApplicationClientDescriptor> appClientDescriptors = application.getBundleDescriptors(ApplicationClientDescriptor.class);
for (ApplicationClientDescriptor appClientDescriptor : appClientDescriptors) {
destination = getJMSDestination(logicalDestination, appClientDescriptor.getResourceDescriptors(JavaEEResourceType.JMSDD));
if (isValidDestination(destination)) {
return destination;
}
}
return null;
}
use of com.sun.enterprise.deployment.ApplicationClientDescriptor in project Payara by payara.
the class ClassFileAppClientInfo method massageDescriptor.
@Override
protected void massageDescriptor() throws IOException, AnnotationProcessorException {
ApplicationClientDescriptor appClient = getDescriptor();
appClient.setMainClassName(classFileFromCommandLine);
appClient.getModuleDescriptor().setStandalone(true);
FileArchive fa = new FileArchive();
fa.open(new File(classFileFromCommandLine).toURI());
new AppClientArchivist().processAnnotations(appClient, fa);
}
use of com.sun.enterprise.deployment.ApplicationClientDescriptor in project Payara by payara.
the class AppClientDeployer method load.
@Override
public AppClientServerApplication load(AppClientContainerStarter containerStarter, DeploymentContext dc) {
// if the populated DOL object does not container appclient
// descriptor, this is an indication that appclient deployer
// should not handle this module
ApplicationClientDescriptor appclientDesc = dc.getModuleMetaData(ApplicationClientDescriptor.class);
if (appclientDesc == null) {
return null;
}
appclientDesc.setClassLoader(dc.getClassLoader());
AppClientDeployerHelper helper = null;
try {
helper = getSavedHelperOrCreateHelper(dc);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
// helper.addGroupFacadeToEARDownloads();
final AppClientServerApplication newACServerApp = newACServerApp(dc, helper);
appClientApps.add(newACServerApp);
return newACServerApp;
}
use of com.sun.enterprise.deployment.ApplicationClientDescriptor in project Payara by payara.
the class AppClientContainer method completePreparation.
/**
* Gets the ACC ready so the main class can run.
* This can be followed, immediately or after some time, by either an
* invocation of {@link #launch(java.lang.String[]) or
* by the JVM invoking the client's main method (as would happen during
* a <code>java -jar theClient.jar</code> launch.
*
* @throws java.lang.Exception
*/
private void completePreparation(final Instrumentation inst) throws NamingException, IOException, InstantiationException, IllegalAccessException, InjectionException, ClassNotFoundException, SAXParseException, NoSuchMethodException, UserError {
if (state != State.INSTANTIATED) {
throw new IllegalStateException();
}
/*
* Attach any names defined in the app client. Validate the descriptor
* first, then use it to bind names in the app client. This order is
* important - for example, to set up message destination refs correctly.
*/
client.validateDescriptor();
final ApplicationClientDescriptor desc = client.getDescriptor(classLoader);
componentId = componentEnvManager.bindToComponentNamespace(desc);
/*
* Arrange for cleanup now instead of during launch() because in some use cases
* the JVM will invoke the client's main method itself and launch will
* be skipped.
*/
cleanup = Cleanup.arrangeForShutdownCleanup(logger, habitat, desc);
/*
* Allow pre-destroy handling to work on the main class during clean-up.
*/
cleanup.setInjectionManager(injectionManager, clientMainClassSetting.clientMainClass);
/*
* If this app client contains persistence unit refs, then initialize
* the PU handling.
*/
Collection<? extends PersistenceUnitDescriptor> referencedPUs = desc.findReferencedPUs();
if (referencedPUs != null && !referencedPUs.isEmpty()) {
ProviderContainerContractInfoImpl pcci = new ProviderContainerContractInfoImpl((ACCClassLoader) getClassLoader(), inst, client.getAnchorDir(), connectorRuntime);
for (PersistenceUnitDescriptor puDesc : referencedPUs) {
PersistenceUnitLoader pul = new PersistenceUnitLoader(puDesc, pcci);
desc.addEntityManagerFactory(puDesc.getName(), pul.getEMF());
}
cleanup.setEMFs(pcci.emfs());
}
cleanup.setConnectorRuntime(connectorRuntime);
prepareURLStreamHandling();
// This is required for us to enable interrupt jaxws service
// creation calls
System.setProperty("javax.xml.ws.spi.Provider", "com.sun.enterprise.webservice.spi.ProviderImpl");
// InjectionManager's injectClass will be called from getMainMethod
// Load any managed beans
ManagedBeanManager managedBeanManager = habitat.getService(ManagedBeanManager.class);
managedBeanManager.loadManagedBeans(desc.getApplication());
cleanup.setManagedBeanManager(managedBeanManager);
/**
* We don't really need the main method here but we do need the side-effects.
*/
getMainMethod();
state = State.PREPARED;
}
use of com.sun.enterprise.deployment.ApplicationClientDescriptor in project Payara by payara.
the class NestedAppClientInfo method useFirstEmbeddedAppClient.
private ApplicationClientDescriptor useFirstEmbeddedAppClient(Set<ApplicationClientDescriptor> embeddedAppClients, String mainClassNameFromCommandLine) {
ApplicationClientDescriptor result = null;
/*
*If the size is 1 then there is sure to be a non-null .next.
*Still, may as well be sure.
*/
Iterator<ApplicationClientDescriptor> it = embeddedAppClients.iterator();
if (!it.hasNext()) {
throw new IllegalStateException(getLocalString("appclient.unexpectedEndOfEmbeddedClients", "The application module seems to contain one app client but the iterator reported no more elements prematurely"));
}
result = embeddedAppClients.iterator().next();
/*
*If, in addition, the user specified a main class on the command
*line, then use the user's class name as the main class name, rather
*than the class specified by the Main-Class attribute in the
*app client archive. This allows the user to override the Main-Class
*setting in the app client's manifest.
*/
if (mainClassNameFromCommandLine != null) {
result.setMainClassName(mainClassNameFromCommandLine);
}
return result;
}
Aggregations