use of com.sun.enterprise.deployment.ApplicationClientDescriptor in project Payara by payara.
the class NestedAppClientInfo method getAppClient.
/**
*Reports which app client embedded in the application archive is the
*one the user has selected using either the main class or display name
*arguments from the command line.
*@return the app client descriptor for the user-selected app client
*/
@Override
protected ApplicationClientDescriptor getAppClient(Archivist archivist) {
if (selectedAppClientDescriptor != null) {
return selectedAppClientDescriptor;
}
Application app = Application.class.cast(archivist.getDescriptor());
/*
*There could be one or more app clients embedded in the enterprise app
*in the archive. Choose which one to run based on the user's
*command-line input.
*/
Set<ApplicationClientDescriptor> embeddedAppClients = (Set<ApplicationClientDescriptor>) app.getBundleDescriptors(ApplicationClientDescriptor.class);
/*
*Make sure the application module contains at least one app client.
*/
if (embeddedAppClients.size() == 0) {
throw new IllegalArgumentException(getLocalString("appclient.noEmbeddedAppClients", "The specified application module does not contain any app clients"));
}
/*
*If there is exactly one app client in the ear, then that's the app
*client to use.
*/
if (embeddedAppClients.size() == 1) {
selectedAppClientDescriptor = useFirstEmbeddedAppClient(embeddedAppClients, mainClassFromCommandLine);
} else {
selectedAppClientDescriptor = chooseFromEmbeddedAppClients(embeddedAppClients, mainClassFromCommandLine, displayNameFromCommandLine);
/*
*Make sure that we've selected an app client.
*/
if (selectedAppClientDescriptor == null) {
if (mainClassFromCommandLine != null) {
throw new IllegalArgumentException(getLocalString("appclient.noMatchingClientUsingMainClass", "Could not locate an embedded app client matching the main class name {0}", mainClassFromCommandLine));
} else {
throw new IllegalArgumentException(getLocalString("appclient.noMatchingClientUsingDisplayName", "Could not locate an embedded app client matching the display name {0}", displayNameFromCommandLine));
}
}
}
return selectedAppClientDescriptor;
}
use of com.sun.enterprise.deployment.ApplicationClientDescriptor in project Payara by payara.
the class StandAloneAppClientInfo method fixupWSDLEntries.
/**
*Adjusts the web services WSDL entries corresponding to where they
*actually reside.
*/
protected void fixupWSDLEntries() throws URISyntaxException, MalformedURLException, IOException, AnnotationProcessorException {
ApplicationClientDescriptor ac = getAppClient();
URI uri = (new File(getAppClientRoot(appClientArchive, ac))).toURI();
File moduleFile = new File(uri);
for (Iterator itr = ac.getServiceReferenceDescriptors().iterator(); itr.hasNext(); ) {
ServiceReferenceDescriptor serviceRef = (ServiceReferenceDescriptor) itr.next();
if (serviceRef.getWsdlFileUri() != null) {
// In case WebServiceRef does not specify wsdlLocation, we get
// wsdlLocation from @WebClient in wsimport generated source;
// If wsimport was given a local WSDL file, then WsdlURI will
// be an absolute path - in that case it should not be prefixed
// with modileFileDir
String wsdlURI = serviceRef.getWsdlFileUri();
File wsdlFile = new File(wsdlURI);
if (wsdlFile.isAbsolute()) {
serviceRef.setWsdlFileUrl(wsdlFile.toURI().toURL());
} else {
// This is the case where WsdlFileUri is a relative path
// (hence relative to the root of this module or wsimport
// was executed with WSDL in HTTP URL form
serviceRef.setWsdlFileUrl(getEntryAsUrl(moduleFile, serviceRef.getWsdlFileUri()));
}
}
}
}
use of com.sun.enterprise.deployment.ApplicationClientDescriptor in project Payara by payara.
the class DOLUtils method getComponentEnvId.
/**
* Generate a unique id name for each J2EE component.
* @param env
* @return
*/
public static String getComponentEnvId(JndiNameEnvironment env) {
String id = null;
if (env instanceof EjbDescriptor) {
// EJB component
EjbDescriptor ejbEnv = (EjbDescriptor) env;
// Make jndi name flat so it won't result in the creation of
// a bunch of sub-contexts.
String flattedJndiName = ejbEnv.getJndiName().replace('/', '.');
EjbBundleDescriptor ejbBundle = ejbEnv.getEjbBundleDescriptor();
Descriptor d = ejbBundle.getModuleDescriptor().getDescriptor();
// as the web bundle, because they share the same JNDI namespace
if (d instanceof WebBundleDescriptor) {
// copy of code below
WebBundleDescriptor webEnv = (WebBundleDescriptor) d;
id = webEnv.getApplication().getName() + ID_SEPARATOR + webEnv.getContextRoot();
if (deplLogger.isLoggable(Level.FINER)) {
deplLogger.log(Level.FINER, CONVERT_EJB_TO_WEB_ID, id);
}
} else {
id = ejbEnv.getApplication().getName() + ID_SEPARATOR + ejbBundle.getModuleDescriptor().getArchiveUri() + ID_SEPARATOR + ejbEnv.getName() + ID_SEPARATOR + flattedJndiName + ejbEnv.getUniqueId();
}
} else if (env instanceof WebBundleDescriptor) {
WebBundleDescriptor webEnv = (WebBundleDescriptor) env;
id = webEnv.getApplication().getName() + ID_SEPARATOR + webEnv.getContextRoot();
} else if (env instanceof ApplicationClientDescriptor) {
ApplicationClientDescriptor appEnv = (ApplicationClientDescriptor) env;
id = "client" + ID_SEPARATOR + appEnv.getName() + ID_SEPARATOR + appEnv.getMainClassName();
} else if (env instanceof ManagedBeanDescriptor) {
id = ((ManagedBeanDescriptor) env).getGlobalJndiName();
} else if (env instanceof EjbBundleDescriptor) {
EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor) env;
id = "__ejbBundle__" + ID_SEPARATOR + ejbBundle.getApplication().getName() + ID_SEPARATOR + ejbBundle.getModuleName();
}
return id;
}
use of com.sun.enterprise.deployment.ApplicationClientDescriptor in project Payara by payara.
the class DOLUtils method getModuleName.
public static String getModuleName(JndiNameEnvironment env) {
String moduleName = null;
if (env instanceof EjbDescriptor) {
// EJB component
EjbDescriptor ejbEnv = (EjbDescriptor) env;
EjbBundleDescriptor ejbBundle = ejbEnv.getEjbBundleDescriptor();
moduleName = ejbBundle.getModuleDescriptor().getModuleName();
} else if (env instanceof EjbBundleDescriptor) {
EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor) env;
moduleName = ejbBundle.getModuleDescriptor().getModuleName();
} else if (env instanceof WebBundleDescriptor) {
WebBundleDescriptor webEnv = (WebBundleDescriptor) env;
moduleName = webEnv.getModuleName();
} else if (env instanceof ApplicationClientDescriptor) {
ApplicationClientDescriptor appEnv = (ApplicationClientDescriptor) env;
moduleName = appEnv.getModuleName();
} else if (env instanceof ManagedBeanDescriptor) {
ManagedBeanDescriptor mb = (ManagedBeanDescriptor) env;
moduleName = mb.getBundle().getModuleName();
} else {
throw new IllegalArgumentException("IllegalJndiNameEnvironment : env");
}
return moduleName;
}
use of com.sun.enterprise.deployment.ApplicationClientDescriptor in project Payara by payara.
the class DOLUtils method getApplicationFromEnv.
/**
* @param env
* @return
*/
public static Application getApplicationFromEnv(JndiNameEnvironment env) {
Application app = null;
if (env instanceof EjbDescriptor) {
// EJB component
EjbDescriptor ejbEnv = (EjbDescriptor) env;
app = ejbEnv.getApplication();
} else if (env instanceof EjbBundleDescriptor) {
EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor) env;
app = ejbBundle.getApplication();
} else if (env instanceof WebBundleDescriptor) {
WebBundleDescriptor webEnv = (WebBundleDescriptor) env;
app = webEnv.getApplication();
} else if (env instanceof ApplicationClientDescriptor) {
ApplicationClientDescriptor appEnv = (ApplicationClientDescriptor) env;
app = appEnv.getApplication();
} else if (env instanceof ManagedBeanDescriptor) {
ManagedBeanDescriptor mb = (ManagedBeanDescriptor) env;
app = mb.getBundle().getApplication();
} else if (env instanceof Application) {
app = ((Application) env);
} else {
throw new IllegalArgumentException("IllegalJndiNameEnvironment : env");
}
return app;
}
Aggregations