Refine search
private boolean getBooleanStateFromApplicationInfo(String flag, String appName) { ApplicationInfo appInfo = appRegistry.get(appName); if (appInfo == null) { // appInfo can be null when running EjbDeployer.clean after a failed deploy return false; } Boolean rc = appInfo.getTransientAppMetaData(flag, Boolean.class); return (rc == null ? false : rc); }
private ApplicationInfo getApplicationInfo(EjbContainerUtil ejbUtil) throws NamingException { ApplicationRegistry appRegistry = ejbUtil.getServices().getService(ApplicationRegistry.class); Applications applications = ejbUtil.getServices().getService(Applications.class); String appNamePrefix = (String) initialContext.lookup("java:app/AppName"); Set<String> appNames = appRegistry.getAllApplicationNames(); Set<String> disabledApps = new TreeSet<>(); for (String appName : appNames) { if (appName.startsWith(appNamePrefix)) { Application appDesc = applications.getApplication(appName); if (appDesc != null && !ejbUtil.getDeployment().isAppEnabled(appDesc)) { // skip disabled version of the app disabledApps.add(appName); } else { return ejbUtil.getDeployment().get(appName); } } } // grab the latest one, there is no way to make // sure which one the user is actually enabling, // so use the best case, i.e. upgrade Iterator<String> it = disabledApps.iterator(); String lastDisabledApp = null; while (it.hasNext()) { lastDisabledApp = it.next(); } if (lastDisabledApp != null) { return ejbUtil.getDeployment().get(lastDisabledApp); } throw new NamingException("Application Information Not Found"); }
/** * During "load()" event (eg: app/app-ref enable, server start), * populate resource-config in app-info so that it can be used for * constructing connector-classloader for the application. * @param dc DeploymentContext */ public static void populateResourceConfigInAppInfo(DeploymentContext dc){ String appName = getAppNameFromDeployCmdParams(dc); Application application = applications.getApplication(appName); ApplicationInfo appInfo = appRegistry.get(appName); if(application != null && appInfo != null){ Resources appScopedResources = application.getResources(); if(appScopedResources != null){ appInfo.addTransientAppMetaData(Application.APPLICATION, application); appInfo.addTransientAppMetaData(application.getName()+"-resources", appScopedResources); } List<Module> modules = application.getModule(); if(modules != null){ for(Module module : modules){ Resources moduleScopedResources = module.getResources(); if(moduleScopedResources != null){ appInfo.addTransientAppMetaData(module.getName()+"-resources", moduleScopedResources); } } } } }
Application application = applications.getApplication(applicationName); if (application.isLifecycleModule()) { if (!terse) { part.setMessage(localStrings.getLocalString("listsubcomponents.no.elements.to.list", "Nothing to List.")); ApplicationInfo appInfo = appRegistry.get(applicationName); if (appInfo == null) { report.setMessage(localStrings.getLocalString("application.not.enabled","Application {0} is not in an enabled state", applicationName)); com.sun.enterprise.deployment.Application app = appInfo.getMetaData(com.sun.enterprise.deployment.Application.class); subComponents = getAppLevelComponents(app, type, subComponentsMap); } else { BundleDescriptor bundleDesc = app.getModuleByUri(modulename); if (bundleDesc == null) { report.setMessage(localStrings.getLocalString("listsubcomponents.invalidmodulename", "Invalid module name", appname, modulename)); if (!app.isVirtual()) { subModuleInfos = getSubModulesForEar(app, type); String.format(formattedLine, new Object[]{subComponent.getKey(), subComponent.getValue()} )); if (appname == null && !app.isVirtual()) {
public void deployResourcesFromConfiguration(String appName, boolean embedded) throws Exception { Application application = applications.getApplication(appName); ApplicationInfo appInfo = appRegistry.get(appName); if(application != null && appInfo != null){ Resources appScopedResources = application.getResources(); if(appScopedResources != null){ deployResources(appName, null, appScopedResources.getResources(), embedded); } List<Module> modules = application.getModule(); if(modules != null){ for(Module module : modules){ Resources moduleScopedResources = module.getResources(); String moduleName = module.getName(); if(moduleScopedResources != null){ deployResources(appName, moduleName, moduleScopedResources.getResources(), embedded); } } } } }
private static void createAppScopedResources(Application app, List<org.glassfish.resource.common.Resource> resources, DeploymentContext dc, boolean embedded) throws ResourceException { try { if (resources != null) { Application application = dc.getTransientAppMetaData(Application.APPLICATION, Application.class); Resources asc = dc.getTransientAppMetaData(ConnectorConstants.APP_META_DATA_RESOURCES, Resources.class); if (asc == null) { asc = application.createChild(Resources.class); application.setResources(asc); dc.addTransientAppMetaData(ConnectorConstants.APP_META_DATA_RESOURCES, asc); ApplicationInfo appInfo = appRegistry.get(app.getName()); if(appInfo != null){ appInfo.addTransientAppMetaData(app.getName()+"-resources", asc); } } createConfig(asc, resources, embedded); String appName = app.getName(); preserveResources(asc, appName, appName); } } catch (Exception e) { Object params[] = new Object[]{app.getName(), e}; _logger.log(Level.SEVERE, "gf.resources.app.scope.deployment.failure", params); throw new ResourceException(e); } }
applications.getApplicationsWithSnifferType(ServerTags.CONNECTOR, true); allApplications.addAll(applications.getApplications()); allApplications.addAll(systemApplications.getApplications()); if (app.isStandaloneModule() && app.containsSnifferType(ServerTags.CONNECTOR)) { continue; ApplicationInfo appInfo = deployment.get(app.getName()); stopApplication(app, appInfo); allAppNames.addAll(appRegistry.getAllApplicationNames()); for (String appName : allAppNames) { ApplicationInfo appInfo = appRegistry.get(appName); stopApplication(null, appInfo);
appRegistry.get(appName) != null) { report.setMessage(localStrings.getLocalString("appnamenotunique","Application name {0} is already in use. Please pick a different name.", appName)); report.setActionExitCode(ActionReport.ExitCode.FAILURE); ApplicationInfo tempAppInfo = new ApplicationInfo(events, context.getSource(), appName); for (Object m : context.getModuleMetadata()) { tempAppInfo.addMetaData(m); tempAppInfo.setIsJavaEEApp(sortedEngineInfos); context.getSource().setExtraData(Boolean.class, tempAppInfo.isJavaEEApp()); appRegistry.add(appName, tempAppInfo); appRegistry.remove(appName); appInfo.setIsJavaEEApp(sortedEngineInfos); appRegistry.add(appName, appInfo);
private Vector getEjbDescriptors(Application application, ApplicationRegistry appsRegistry) { Vector ejbDescriptors = new Vector(); if(ResourcesUtil.createInstance().isEnabled(application)){ ApplicationInfo appInfo = appsRegistry.get(application.getName()); if(appInfo != null){ com.sun.enterprise.deployment.Application app = appInfo.getMetaData(com.sun.enterprise.deployment.Application.class); Set<BundleDescriptor> descriptors = app.getBundleDescriptors(); for (BundleDescriptor descriptor : descriptors) { if (descriptor instanceof EjbBundleDescriptor) { EjbBundleDescriptor ejbBundleDescriptor = (EjbBundleDescriptor) descriptor; Set<? extends EjbDescriptor> ejbDescriptorsSet = ejbBundleDescriptor.getEjbs(); for (EjbDescriptor ejbDescriptor : ejbDescriptorsSet) { ejbDescriptors.add(ejbDescriptor); } } } }else{ //application is enabled, but still not found in app-registry _logger.log(Level.WARNING, "application.not.started.skipping.recovery", application.getName()); } } return ejbDescriptors; }
ReadableArchive archive = null; try { DeployCommandParameters commandParams = app.getDeployParameters(appRef); ApplicationInfo appInfo = appRegistry.get(commandParams.name); if (appInfo != null && appInfo.isLoaded()) { return null; commandParams.target = target; commandParams.enabled = Boolean.TRUE; Properties contextProps = app.getDeployProperties(); Map<String, Properties> modulePropsMap = app.getModulePropertiesMap(); ApplicationConfigInfo savedAppConfig = new ApplicationConfigInfo(app); URI uri = new URI(app.getLocation());
ApplicationInfo appInfo = appRegistry.get(app.getName()); res = getApplicationScopedResource(jndiName, BindableResource.class, appInfo); }else if(jndiName.startsWith(ConnectorConstants.JAVA_MODULE_SCOPE_PREFIX)){ ApplicationInfo appInfo = appRegistry.get(app.getName()); res = getModuleScopedResource(jndiName, moduleName, BindableResource.class, appInfo); }else{ String poolName = connResource.getPoolName(); Resource pool ; ApplicationInfo appInfo = appRegistry.get(app.getName()); if(jndiName.startsWith(ConnectorConstants.JAVA_APP_SCOPE_PREFIX) /*|| jndiName.startsWith("java:global/")*/){ pool = getApplicationScopedResource(poolName, ResourcePool.class, appInfo); getApplications().getApplicationsWithSnifferType(com.sun.enterprise.config.serverbeans.Application.CONNECTOR_SNIFFER_TYPE, true); Iterator itr = applications.iterator(); while (itr.hasNext()) { com.sun.enterprise.config.serverbeans.Application application = (com.sun.enterprise.config.serverbeans.Application) itr.next(); String appName = application.getName(); ApplicationInfo appInfo = appRegistry.get(appName); Application dolApp = appInfo.getMetaData(Application.class); Collection<ConnectorDescriptor> rarDescriptors = dolApp.getRarDescriptors(); for (ConnectorDescriptor desc : rarDescriptors) {
private static void createModuleScopedResources(Application app, Module module, List<org.glassfish.resource.common.Resource> resources, DeploymentContext dc, boolean embedded) throws ResourceException { try { if (resources != null) { Resources msc = dc.getTransientAppMetaData(module.getName()+"-resources", Resources.class); if (msc == null) { msc = module.createChild(Resources.class); module.setResources(msc); dc.addTransientAppMetaData(module.getName()+"-resources", msc); ApplicationInfo appInfo = appRegistry.get(app.getName()); if(appInfo != null){ appInfo.addTransientAppMetaData(module.getName()+"-resources", msc); } } createConfig(msc, resources, embedded); preserveResources(msc, app.getName(), module.getName()); } } catch (Exception e) { Object params[] = new Object[]{module.getName(),app.getName(), e}; _logger.log(Level.SEVERE, "gf.resources.module.scope.deployment.failure", params); throw new ResourceException(e); } }
Properties actionReportProps = null; if (ejbBundle.getApplication().isVirtual()) { actionReportProps = depc.getActionReport().getExtraProperties(); } else { // the application is EAR ApplicationInfo appInfo = appRegistry.get(params.name()); appInfo.addTransientAppMetaData(KEEP_STATE, keepState); ejbBundle.getApplication().setKeepStateResolved(String.valueOf(keepState));
appsBean.getModule( com.sun.enterprise.config.serverbeans.Application.class, appID); if ((appBean != null) && Boolean.valueOf(appBean.getEnabled())) { String location = appBean.getLocation(); String moduleDir = DeploymentUtils.getRelativeEmbeddedModulePath( location, moduleID); ApplicationInfo appInfo = appRegistry.get(appID); Application app = null; if (appInfo != null) { app = appInfo.getMetaData(Application.class); } else { WebBundleDescriptor wbd = app.getWebBundleDescriptorByUri(moduleID); String webUri = wbd.getModuleDescriptor().getArchiveUri(); String contextRoot = wbd.getModuleDescriptor().getContextRoot();
private void enableApplication(String appName) { Application app = applications.getApplication(appName); ApplicationRef appRef = domain.getApplicationRefInServer(server.getName(), appName); ApplicationInfo appInfo = appRegistry.get(appName); if (appInfo == null || appInfo.isLoaded()) { return;
public static boolean isRAConnectionFactory(ServiceLocator habitat, String type, Application thisApp) { // first check if this is a connection factory defined in a resource // adapter in this application if (isRAConnectionFactory(type, thisApp)) { return true; } // then check if this is a connection factory defined in a standalone // resource adapter Applications applications = habitat.getService(Applications.class); if (applications != null) { List<com.sun.enterprise.config.serverbeans.Application> raApps = applications.getApplicationsWithSnifferType(com.sun.enterprise.config.serverbeans.ServerTags.CONNECTOR, true); ApplicationRegistry appRegistry = habitat.getService(ApplicationRegistry.class); for (com.sun.enterprise.config.serverbeans.Application raApp : raApps) { ApplicationInfo appInfo = appRegistry.get(raApp.getName()); if (appInfo == null) continue; if (isRAConnectionFactory(type, appInfo.getMetaData(Application.class))) { return true; } } } return false; }
final ApplicationInfo appInfo = appRegistry.get(appName); if (appInfo == null) return null; final Application app = appInfo.getMetaData(Application.class); if ( app == null ) if ( appInfo.isJavaEEApp() ) final com.sun.enterprise.config.serverbeans.Application appConfig = getDomain().getApplications().getApplication(appName); if ( appConfig == null )
DeployCommandParameters dcp = context.getCommandParameters(DeployCommandParameters.class); ApplicationInfo appInfo = appRegistry.get(opsparams.name()); Application app = appInfo.getMetaData(Application.class); if (app == null) { for (EjbBundleDescriptorImpl ejbBundle : app.getBundleDescriptors(EjbBundleDescriptorImpl.class)) { if (checkEjbBundleForTimers(ejbBundle, createTimers, target)) { isTimedApp = true; appInfo.addTransientAppMetaData(IS_TIMEOUT_APP_PROP, Boolean.TRUE);
ApplicationInfo appInfo = appRegistry.get(endpoint.getBundleDescriptor().getApplication().getRegistrationName()); URI deployedDir =appInfo.getSource().getURI(); if(endpoint.getBundleDescriptor().getApplication().isVirtual()) { pkgedWsdl = deployedDir.resolve(endpoint.getWebService().getWsdlFileUri()).toURL(); } else {
ApplicationInfo appInfo = appRegistry.get(appName); throw new IllegalStateException("ApplicationInfo is not available for application [ " + appName + " ]"); Application app = appInfo.getMetaData(Application.class); if(!appInfo.isJavaEEApp()){ if(_logger.isLoggable(Level.FINEST)){ _logger.finest("Application ["+appName+"] is not a Java EE application, skipping " + Collection<BundleDescriptor> bundleDescriptors = app.getBundleDescriptors();