public ApplicationInfo get(String appName) { return appRegistry.get(appName); }
public ApplicationInfo get(String appName) { return appRegistry.get(appName); }
protected Application getApplicationFromApplicationInfo( String appName) { ApplicationInfo appInfo = appRegistry.get(appName); if (appInfo == null) { return null; } return appInfo.getMetaData(Application.class); }
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 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); }
/** * Suspends this application. * * @param appName the registration application ID * @return true if suspending was successful, false otherwise. */ public boolean suspend(String appName) { boolean isSuccess = true; ApplicationInfo appInfo = appRegistry.get(appName); if (appInfo != null) { isSuccess = appInfo.suspend(logger); } return isSuccess; }
/** * Resumes this application. * * @param appName the registration application ID * @return true if resumption was successful, false otherwise. */ public boolean resume(String appName) { boolean isSuccess = true; ApplicationInfo appInfo = appRegistry.get(appName); if (appInfo != null) { isSuccess = appInfo.resume(logger); } return isSuccess; }
/** * Suspends this application. * * @param appName the registration application ID * @return true if suspending was successful, false otherwise. */ public boolean suspend(String appName) { boolean isSuccess = true; ApplicationInfo appInfo = appRegistry.get(appName); if (appInfo != null) { isSuccess = appInfo.suspend(logger); } return isSuccess; }
/** * Resumes this application. * * @param appName the registration application ID * @return true if resumption was successful, false otherwise. */ public boolean resume(String appName) { boolean isSuccess = true; ApplicationInfo appInfo = appRegistry.get(appName); if (appInfo != null) { isSuccess = appInfo.resume(logger); } return isSuccess; }
private ServiceLocator getAppServiceLocator() throws NamingException { String appName = getAppName(); ApplicationInfo info = applicationRegistry.get(appName); if (info == null) { throw new NamingException("Could not resolve " + JAVA_APP_SERVICE_LOCATOR); } return info.getAppServiceLocator(); }
private static void addDeployParamLibrariesForModule(StringBuilder sb, String moduleId, String deploymentLibs, Habitat habitat) { if (moduleId.indexOf("#") != -1) { moduleId = moduleId.substring(0, moduleId.indexOf("#")); } if (deploymentLibs == null) { ApplicationInfo appInfo = habitat.getComponent(ApplicationRegistry.class).get(moduleId); if (appInfo == null) { // this might be an internal container app, // like _default_web_app, ignore. return; } deploymentLibs = appInfo.getLibraries(); } final URL[] libs = getDeployParamLibrariesAsURLs(deploymentLibs, habitat); if (libs != null) { for (final URL u : libs) { sb.append(u.getPath()); sb.append(File.pathSeparator); } } }
/** * {@inheritDoc} */ public Set<String> getRARsReferredByApplication(String appName) { ApplicationInfo appInfo = appRegistry.get(appName); if (appInfo != null) { Application app = appInfo.getMetaData(Application.class); if(appInfo.isJavaEEApp()){ return app.getResourceAdapters(); } } return new HashSet<String>(); }
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; }
/** * Entry point from the framework into the command execution * @param context context for the command. */ public void execute(AdminCommandContext context) { final ActionReport report = context.getActionReport(); ActionReport.MessagePart part = report.getTopMessagePart(); ApplicationInfo appInfo = appRegistry.get(appname); if (appInfo != null) { Application app = appInfo.getMetaData(Application.class); if (app != null) { BundleDescriptor bundleDesc = app.getModuleByUri(modulename); if (bundleDesc != null && bundleDesc instanceof WebBundleDescriptor) { String contextRoot = ((WebBundleDescriptor)bundleDesc).getContextRoot(); part.addProperty(DeploymentProperties.CONTEXT_ROOT, contextRoot); part.setMessage(contextRoot); } } } } }
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; }
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); } } } } }
public static 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 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); } }
public void undeploy(String appName, ExtendedDeploymentContext context) { ActionReport report = context.getActionReport(); UndeployCommandParameters params = context.getCommandParameters(UndeployCommandParameters.class); ApplicationInfo info = appRegistry.get(appName); if (info==null) { report.failure(context.getLogger(), "Application " + appName + " not registered", null); events.send(new Event(Deployment.UNDEPLOYMENT_FAILURE, context)); return; } events.send(new Event(Deployment.UNDEPLOYMENT_START, info)); // for DAS target, the undeploy should unload the application // as well if (DeploymentUtils.isDASTarget(params.target)) { unload(info, context); } if (report.getActionExitCode().equals(ActionReport.ExitCode.SUCCESS)) { events.send(new Event(Deployment.UNDEPLOYMENT_SUCCESS, context)); deploymentLifecycleProbeProvider.applicationUndeployedEvent(appName, getApplicationType(info)); } else { events.send(new Event(Deployment.UNDEPLOYMENT_FAILURE, context)); } appRegistry.remove(appName); }
public void undeploy(String appName, ExtendedDeploymentContext context) { ActionReport report = context.getActionReport(); UndeployCommandParameters params = context.getCommandParameters(UndeployCommandParameters.class); ApplicationInfo info = appRegistry.get(appName); if (info==null) { report.failure(context.getLogger(), "Application " + appName + " not registered", null); events.send(new Event(Deployment.UNDEPLOYMENT_FAILURE, context)); return; } events.send(new Event(Deployment.UNDEPLOYMENT_START, info)); // for DAS target, the undeploy should unload the application // as well if (DeploymentUtils.isDASTarget(params.target)) { unload(info, context); } if (report.getActionExitCode().equals(ActionReport.ExitCode.SUCCESS)) { events.send(new Event(Deployment.UNDEPLOYMENT_SUCCESS, context)); deploymentLifecycleProbeProvider.applicationUndeployedEvent(appName, getApplicationType(info)); } else { events.send(new Event(Deployment.UNDEPLOYMENT_FAILURE, context)); } appRegistry.remove(appName); }