Refine search
private void preserveResources(Application app) { String appName = app.getName(); Map<String, Resources> allResources = new HashMap<String, Resources>(); Resources appScopedResources = app.getResources(); if(appScopedResources != null){ allResources.put(appName, appScopedResources); } List<Module> modules = app.getModule(); if(modules != null){ for(Module module : modules){ Resources moduleScopedResources = module.getResources(); if(moduleScopedResources != null){ allResources.put(module.getName(), moduleScopedResources); } } } //store the resource-configuration resourceConfigurations.put(appName, allResources); }
public Object run(Application application) throws PropertyVetoException, TransactionFailure { Module module = application.createChild(Module.class); module.setName(application.getName()); for (Engine engine : application.getEngine()) { module.getEngines().add(engine); } application.getModule().add(module); application.getEngine().clear(); return null; } }, app);
private void createModuleScopedResources(Application app, Module module, List<org.glassfish.resources.api.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); } }
private String webModuleList(final Application app) { /* * Build a list of web module names to include in the error message. */ final StringBuilder moduleNames = new StringBuilder(); for (Module m : app.getModule()) { if (m.getEngine("web") != null) { moduleNames.append((moduleNames.length() > 0 ? ", " : "")). append(m.getName()); } } return moduleNames.toString(); }
for (Application app : domain.getApplications().getApplications()) { System.out.println("Checking app " + app.getName()); Application app_w = null; Property oldSetting = app.getProperty(V3_0_1_JAVA_WEB_START_ENABLED_PROPERTY_NAME); if (oldSetting != null) { logger.log(Level.INFO, "For application {0} converting property {1} to {2}", new Object[] { app.getName(), V3_0_1_JAVA_WEB_START_ENABLED_PROPERTY_NAME, GF3_1_JAVA_WEB_START_ENABLED_PROPERTY_NAME}); for (Module mod : app.getModule()) { if (mod.getEngine(APPCLIENT_SNIFFER_NAME) != null) { oldSetting = mod.getProperty(V3_0_1_JAVA_WEB_START_ENABLED_PROPERTY_NAME); if (oldSetting != null) { logger.log(Level.INFO, "For application {0}/module {1} converting property {2} to {3}", new Object[] { app.getName(), mod.getName(), V3_0_1_JAVA_WEB_START_ENABLED_PROPERTY_NAME, GF3_1_JAVA_WEB_START_ENABLED_PROPERTY_NAME}); oldSetting.getValue(), mod_w); mod_w.getProperty().remove(oldSetting);
Application app = sa.createChild(Application.class); sa.getModules().add(app); app.setName(AdminConsoleAdapter.ADMIN_APP_NAME); app.setEnabled(Boolean.TRUE.toString()); app.setObjectType("system-admin"); //TODO app.setDirectoryDeployed("true"); app.setContextRoot(contextRoot); Module singleModule = app.createChild(Module.class); app.getModule().add(singleModule); singleModule.setName(app.getName()); Engine webe = singleModule.createChild(Engine.class); webe.setSniffer("web"); Engine sece = singleModule.createChild(Engine.class); sece.setSniffer("security"); singleModule.getEngines().add(webe); singleModule.getEngines().add(sece); Server s = (Server) proxies[1]; List<ApplicationRef> arefs = s.getApplicationRef();
public static ResourceInfo getGenericResourceInfo(Resource resource, String resourceName){ if(resource.getParent() != null && resource.getParent().getParent() instanceof Application){ Application application = (Application)resource.getParent().getParent(); return new ResourceInfo(resourceName, application.getName()); }else if(resource.getParent() != null && resource.getParent().getParent() instanceof Module){ Module module = (Module)resource.getParent().getParent(); Application application = (Application)module.getParent(); return new ResourceInfo(resourceName, application.getName(), module.getName()); }else{ return new ResourceInfo(resourceName); } }
Application application = applications.getApplication(applicationName); if (application.isLifecycleModule()) { if (!terse) { part.setMessage(localStrings.getLocalString("listsubcomponents.no.elements.to.list", "Nothing to List.")); Module module = application.getModule(subComponent.getKey()); if (module != null) { ActionReport subReport = report.addSubActionsReport(); CommandRunner.CommandInvocation inv = commandRunner.getCommandInvocation("_list-resources", subReport, context.getSubject()); final ParameterMap parameters = new ParameterMap(); parameters.add("appname", application.getName()); parameters.add("modulename", module.getName()); inv.parameters(parameters).execute();
public List<Sniffer> getSniffersFromApp(Application app) { List<String> snifferTypes = new ArrayList<String>(); for (com.sun.enterprise.config.serverbeans.Module module : app.getModule()) { for (Engine engine : module.getEngines()) { snifferTypes.add(engine.getSniffer()); if (app.isStandaloneModule()) { for (String snifferType : snifferTypes) { Sniffer sniffer = snifferManager.getSniffer(snifferType); logger.log(Level.SEVERE, KernelLoggerInfo.cantFindSnifferForApp, app.getName()); return null;
com.sun.enterprise.config.serverbeans.Application app = domain.getApplications().getApplication(appName); boolean isRAR = false; if (app != null && Boolean.valueOf(app.getEnabled())) { isRAR = app.containsSnifferType(ConnectorConstants.CONNECTOR_MODULE); return; boolean isEAR = app.containsSnifferType(EAR); String moduleName = appName; ResourcesUtil resourcesUtil = ResourcesUtil.createInstance(); List<Module> modules = app.getModule(); for (Module module : modules) { moduleName = module.getName(); if (module.getEngine(ConnectorConstants.CONNECTOR_MODULE) != null) { moduleName = appName + ConnectorConstants.EMBEDDEDRAR_NAME_DELIMITER + moduleName; if (moduleName.toLowerCase().endsWith(".rar")) {
/** * Do cleanup of system-resource-adapter, resources, pools */ public void preDestroy() { if (isConnectorRuntimeInitialized()) { Collection<Application> apps = applications.getApplications(); if(apps != null){ for(Application app : apps){ Resources resources = app.getResources(); if(resources != null){ undeploySystemResources(resources); } List<Module> modules = app.getModule(); if(modules != null){ for(Module module : modules){ Resources moduleScopedResources = module.getResources(); if(moduleScopedResources != null){ undeploySystemResources(moduleScopedResources); } } } } } } else { if(_logger.isLoggable(Level.FINEST)){ _logger.finest("ConnectorRuntime not initialized, hence skipping " + "resource-adapters shutdown, resources, pools cleanup"); } } }
private boolean isApplicationOfThisType(String name, String type) { if (type == null) { return true; } Application app = applications.getApplication(name); if (app != null) { if (!app.isStandaloneModule()) { if (type.equals("ear")) { return true; } else { return false; } } for (Module module : app.getModule()) { final List<Engine> engineList = module.getEngines(); for (Engine engine : engineList) { if (engine.getSniffer().equals(type)) { return true; } } } } return false; }
private List<Engine> getAppEngines(final Application app) { final List<Engine> engineList = new ArrayList<Engine>(); // first add application level engines engineList.addAll(app.getEngine()); // now add module level engines for (Module module: app.getModule()) { engineList.addAll(module.getEngines()); } return engineList; }
engineInfo.getContainer().getClass().toString()); boolean atLeastOne = false; for (Application app : applications.getApplications()) { for (com.sun.enterprise.config.serverbeans.Module module : app.getModule()) { Engine engine = module.getEngine(engineInfo.getSniffer().getModuleType()); if (engine!=null) { if (!atLeastOne) { container.addChild().setMessage(app.getName());
/** * Saves its state to the configuration. this method must be called within a transaction * to the configured Application instance. * * @param app the application being persisted */ public void save(Application app) throws TransactionFailure, PropertyVetoException { for (EngineRef ref : engines) { Engine engine = app.createChild(Engine.class); app.getEngine().add(engine); ref.save(engine); } for (ModuleInfo module : modules) { Module modConfig = app.getModule(module.getName()); if (modConfig == null) { // not a JavaEE module, create it here modConfig = app.createChild(Module.class); modConfig.setName(module.getName()); app.getModule().add(modConfig); } module.save(modConfig); } }
public static Map<String, Properties> getModulePropertiesMap( Application me) { Map<String, Properties> modulePropertiesMap = new HashMap<String, Properties>(); for (Module module: me.getModule()) { if (module.getProperty() != null) { Properties moduleProps = new Properties(); for (Property property : module.getProperty()) { moduleProps.put(property.getName(), property.getValue()); } modulePropertiesMap.put(module.getName(), moduleProps); } } return modulePropertiesMap; }
public ApplicationConfigInfo(final Application app) { moduleToEngineToAppConfig = createNewMap(); if (app != null) { for (Module m : app.getModule()) { for (Engine e : m.getEngines()) { put(m.getName(), e.getSniffer(), e.getApplicationConfig()); } } } }
/** * retain old resource configuration for the new archive being deployed. * @param dc DeploymentContext * @param allResources all resources (app scoped, module scoped) of old application * @throws Exception when unable to retain old resource configuration. */ public static void retainResourceConfig(DeploymentContext dc, Map<String, Resources> allResources) throws Exception { String appName = getAppNameFromDeployCmdParams(dc); Application application = dc.getTransientAppMetaData(Application.APPLICATION, Application.class); Resources appScopedResources = allResources.get(appName); if(appScopedResources != null){ application.setResources(appScopedResources); } if(DeploymentUtils.isEAR(dc.getSource())){ List<Module> modules = application.getModule(); if(modules != null){ for(Module module : modules){ Resources moduleScopedResources = allResources.get(module.getName()); if(moduleScopedResources != null){ module.setResources(moduleScopedResources); } } } } }
if (app.isStandaloneModule() && appNameAndOptionalModuleName.contains("/")) { fail(report, "standaloneAppNoSubMods", "Application {0} is a stand-alone application and contains no submodules but submodule {1} was specified", if ( ! app.isStandaloneModule() && ! appNameAndOptionalModuleName.contains("/")) { fail(report, "earNoModuleSelection", "Application {0} is an enterprise application; please also specify one of the web module names ({1}) as part of the command argument (for example, {0}/{2})", appName(), webModuleList(app), app.getModule().get(0).getName()); return null;