use of com.sun.enterprise.deployment.Application in project Payara by payara.
the class PipeHelper method getHandlerContext.
@Override
protected HandlerContext getHandlerContext(Map map) {
String realmName = null;
WebServiceEndpoint wSE = (WebServiceEndpoint) map.get(PipeConstants.SERVICE_ENDPOINT);
if (wSE != null) {
Application app = wSE.getBundleDescriptor().getApplication();
if (app != null) {
realmName = app.getRealm();
}
if (realmName == null) {
realmName = wSE.getRealm();
}
}
final String fRealmName = realmName;
return new HandlerContext() {
@Override
public String getRealmName() {
return fRealmName;
}
};
}
use of com.sun.enterprise.deployment.Application in project Payara by payara.
the class RealmAdapter method computeRealmName.
// ### Private methods
private void computeRealmName(WebBundleDescriptor webDescriptor, String realmName) {
Application application = webDescriptor.getApplication();
LoginConfiguration loginConfig = webDescriptor.getLoginConfiguration();
this.realmName = application.getRealm();
if (this.realmName == null && loginConfig != null) {
this.realmName = loginConfig.getRealmName();
}
if (realmName != null && (this.realmName == null || this.realmName.equals(""))) {
this.realmName = realmName;
}
}
use of com.sun.enterprise.deployment.Application in project Payara by payara.
the class EjbApplication method resolveKeepStateOptions.
/**
* Returns a consolidated keepstate value. keepstate only takes effect for
* redeploy operations where the app is already registered. If the app is
* not already registered, keepstate always resolves to false even if
* keepstate is true in CLI or descriptors. For redeploy operations, CLI
* --keepstate option has precedence over descriptor keep-state element.
* @param deployContext
* @param isDeploy
* @param bundleDesc
* @return true if keepstate is true after consolidating --keepstate CLI option
* and keep-state element in descriptors; false otherwise.
*/
private boolean resolveKeepStateOptions(DeploymentContext deployContext, boolean isDeploy, EjbBundleDescriptorImpl bundleDesc) {
Boolean isredeploy = Boolean.FALSE;
Boolean keepState = null;
if (isDeploy) {
DeployCommandParameters dcp = deployContext.getCommandParameters(DeployCommandParameters.class);
if (dcp != null) {
isredeploy = dcp.isredeploy;
keepState = dcp.keepstate;
}
} else {
UndeployCommandParameters ucp = deployContext.getCommandParameters(UndeployCommandParameters.class);
if (ucp != null) {
isredeploy = ucp.isredeploy;
keepState = ucp.keepstate;
}
}
if (!isredeploy) {
return false;
}
if (keepState == null) {
Application app = bundleDesc.getApplication();
keepState = app.getKeepState();
}
return keepState;
}
use of com.sun.enterprise.deployment.Application in project Payara by payara.
the class EjbDeployer method event.
@Override
public void event(Event event) {
if (event.is(Deployment.APPLICATION_PREPARED) && isDas()) {
ExtendedDeploymentContext context = (ExtendedDeploymentContext) event.hook();
OpsParams opsparams = context.getCommandParameters(OpsParams.class);
DeployCommandParameters dcp = context.getCommandParameters(DeployCommandParameters.class);
ApplicationInfo appInfo = appRegistry.get(opsparams.name());
Application app = appInfo.getMetaData(Application.class);
if (app == null) {
// Not a Java EE application
return;
}
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "EjbDeployer in APPLICATION_PREPARED for origin: " + opsparams.origin + ", target: " + dcp.target + ", name: " + opsparams.name());
}
boolean createTimers = true;
if (!(opsparams.origin.isDeploy() || opsparams.origin.isCreateAppRef()) || env.getInstanceName().equals(dcp.target)) {
// Timers will be created by the BaseContainer if it's a single instance deploy
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "EjbDeployer ... will only set the timeout application flag if any");
}
// But is-timed-app needs to be set in AppInfo in any case
createTimers = false;
}
String target = dcp.target;
if (createTimers && dcp.isredeploy != null && dcp.isredeploy && DeploymentUtils.isDomainTarget(target)) {
List<String> targets = (List<String>) context.getTransientAppMetaData(DeploymentProperties.PREVIOUS_TARGETS, List.class);
for (String ref : targets) {
target = ref;
if (domain.getClusterNamed(target) != null || domain.getDeploymentGroupNamed(target) != null) {
// prefer cluster target
break;
}
}
}
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "EjbDeployer using target for event as " + target);
}
boolean isTimedApp = false;
for (EjbBundleDescriptorImpl ejbBundle : app.getBundleDescriptors(EjbBundleDescriptorImpl.class)) {
if (checkEjbBundleForTimers(ejbBundle, createTimers, target)) {
isTimedApp = true;
}
}
if (isTimedApp && (opsparams.origin.isDeploy() || opsparams.origin.isLoad())) {
// Mark application as a timeout application, so that the clean() call removes the timers.
appInfo.addTransientAppMetaData(IS_TIMEOUT_APP_PROP, Boolean.TRUE);
}
}
}
use of com.sun.enterprise.deployment.Application in project Payara by payara.
the class EjbDeployer method prepare.
@Override
public boolean prepare(DeploymentContext dc) {
EjbBundleDescriptorImpl ejbBundle = dc.getModuleMetaData(EjbBundleDescriptorImpl.class);
if (ejbBundle == null) {
String errMsg = localStrings.getLocalString("context.contains.no.ejb", "DeploymentContext does not contain any EJB", dc.getSourceDir());
throw new RuntimeException(errMsg);
}
// Get application-level properties (*not* module-level)
Properties appProps = dc.getAppProps();
long uniqueAppId;
if (!appProps.containsKey(APP_UNIQUE_ID_PROP)) {
// This is the first time load is being called for any ejb module in an
// application, so generate the unique id.
uniqueAppId = getNextEjbAppUniqueId();
appProps.setProperty(APP_UNIQUE_ID_PROP, uniqueAppId + "");
} else {
uniqueAppId = Long.parseLong(appProps.getProperty(APP_UNIQUE_ID_PROP));
}
OpsParams params = dc.getCommandParameters(OpsParams.class);
if (params.origin.isDeploy()) {
// KEEP_STATE is saved to AppProps in EjbApplication.stop
String keepStateVal = (String) dc.getAppProps().get(EjbApplication.KEEP_STATE);
if (keepStateVal != null) {
// save KEEP_STATE to Application so subsequent to make it available
// to subsequent deploy-related methods.
ejbBundle.getApplication().setKeepStateResolved(keepStateVal);
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "EjbDeployer.prepare set keepstate to {0} for application.", ejbBundle.getApplication().getKeepStateResolved());
}
}
}
Application app = ejbBundle.getApplication();
if (!app.isUniqueIdSet()) {
// This will set the unique id for all EJB components in the application.
// If there are multiple ejb modules in the app, we'll only call it once
// for the first ejb module load(). All the old
// .xml processing for unique-id in the sun-* descriptors is removed so
// this is the only place where Application.setUniqueId() should be called.
app.setUniqueId(uniqueAppId);
}
return super.prepare(dc);
}
Aggregations