private void setRestAppAttributes(Application app, Properties appProps) throws PropertyVetoException, TransactionFailure { // context-root element if (appProps.getProperty(ServerTags.CONTEXT_ROOT) != null) { app.setContextRoot(appProps.getProperty( ServerTags.CONTEXT_ROOT)); } // property element // trim the properties that have been written as attributes // the rest properties will be written as property element for (Iterator itr = appProps.keySet().iterator(); itr.hasNext();) { String propName = (String) itr.next(); if (!propName.equals(ServerTags.LOCATION) && !propName.equals(ServerTags.CONTEXT_ROOT) && !propName.equals(ServerTags.OBJECT_TYPE) && !propName.equals(ServerTags.DIRECTORY_DEPLOYED) && !propName.startsWith( DeploymentProperties.APP_CONFIG)) { if (appProps.getProperty(propName) != null) { Property prop = app.createChild(Property.class); app.getProperty().add(prop); prop.setName(propName); prop.setValue(appProps.getProperty(propName)); } } } }
private void setRestAppAttributes(Application app, Properties appProps) throws PropertyVetoException, TransactionFailure { // context-root element if (appProps.getProperty(ServerTags.CONTEXT_ROOT) != null) { app.setContextRoot(appProps.getProperty( ServerTags.CONTEXT_ROOT)); } // property element // trim the properties that have been written as attributes // the rest properties will be written as property element for (Iterator itr = appProps.keySet().iterator(); itr.hasNext();) { String propName = (String) itr.next(); if (!propName.equals(ServerTags.LOCATION) && !propName.equals(ServerTags.CONTEXT_ROOT) && !propName.equals(ServerTags.OBJECT_TYPE) && !propName.equals(ServerTags.DIRECTORY_DEPLOYED) && !propName.startsWith( DeploymentProperties.APP_CONFIG)) { if (appProps.getProperty(propName) != null) { Property prop = app.createChild(Property.class); app.getProperty().add(prop); prop.setName(propName); prop.setValue(appProps.getProperty(propName)); } } } }
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);
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);
/** * 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); } }
/** * 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); } }
private void addModuleConfig(DeploymentContext dc, Application application) { DeployCommandParameters params = dc.getCommandParameters(DeployCommandParameters.class); if (!params.origin.isDeploy()) { return; } try { com.sun.enterprise.config.serverbeans.Application app_w = dc.getTransientAppMetaData(com.sun.enterprise.config.serverbeans.ServerTags.APPLICATION, com.sun.enterprise.config.serverbeans.Application.class); if (app_w != null) { if (application.isVirtual()) { Module modConfig = app_w.createChild(Module.class); app_w.getModule().add(modConfig); modConfig.setName(application.getRegistrationName()); } else { for (ModuleDescriptor moduleDesc : application.getModules()) { Module modConfig = app_w.createChild(Module.class); app_w.getModule().add(modConfig); modConfig.setName(moduleDesc.getArchiveUri()); } } } } catch (Exception e) { Logger.getAnonymousLogger().log(Level.WARNING, "failed to add the module config", e); } }
private AppTenant writeableTenantForApp( final String appName, final Transaction t) throws TransactionFailure, PropertyVetoException { final com.sun.enterprise.config.serverbeans.Application app = applications.getApplication(appName); if (app == null) { throw new IllegalArgumentException("Application " + appName + " not found"); } /* * The app-tenants subelement might or might not already be there. */ AppTenants appTenants = app.getAppTenants(); AppTenants appTenants_w; if (appTenants == null) { com.sun.enterprise.config.serverbeans.Application app_w = t.enroll(app); appTenants_w = app_w.createChild(AppTenants.class); app_w.setAppTenants(appTenants_w); } else { appTenants_w = t.enroll(appTenants); } final List<AppTenant> appTenantList = appTenants_w.getAppTenant(); AppTenant appTenant_w = appTenants_w.createChild(AppTenant.class); appTenantList.add(appTenant_w); return appTenant_w; }
private AppTenant writeableTenantForApp( final String appName, final Transaction t) throws TransactionFailure, PropertyVetoException { final com.sun.enterprise.config.serverbeans.Application app = applications.getApplication(appName); if (app == null) { throw new IllegalArgumentException("Application " + appName + " not found"); } /* * The app-tenants subelement might or might not already be there. */ AppTenants appTenants = app.getAppTenants(); AppTenants appTenants_w; if (appTenants == null) { com.sun.enterprise.config.serverbeans.Application app_w = t.enroll(app); appTenants_w = app_w.createChild(AppTenants.class); app_w.setAppTenants(appTenants_w); } else { appTenants_w = t.enroll(appTenants); } final List<AppTenant> appTenantList = appTenants_w.getAppTenant(); AppTenant appTenant_w = appTenants_w.createChild(AppTenant.class); appTenantList.add(appTenant_w); return appTenant_w; }
Module singleModule = app.createChild(Module.class); app.getModule().add(singleModule); singleModule.setName(app.getName());
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); } }
private void createAppScopedResources(Application app, List<org.glassfish.resources.api.Resource> resources, DeploymentContext dc, boolean embedded) throws ResourceException { try { if (resources != null) { Application application = dc.getTransientAppMetaData(ServerTags.APPLICATION, Application.class); Resources asc = dc.getTransientAppMetaData(APP_META_DATA_RESOURCES, Resources.class); if (asc == null) { asc = application.createChild(Resources.class); application.setResources(asc); dc.addTransientAppMetaData(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); } }
connectorModule.getProperty()) { Property prop = app.createChild(Property.class); prop.setName(property.getName()); prop.setValue(property.getValue()); app.createChild(Property.class); prop.setName(MODULE_TYPE); prop.setValue(ServerTags.CONNECTOR_MODULE); ejbModule.getProperty()) { Property prop = app.createChild(Property.class); prop.setName(property.getName()); prop.setValue(property.getValue()); app.createChild(Property.class); prop.setName(MODULE_TYPE); prop.setValue(ServerTags.EJB_MODULE); webModule.getProperty()) { Property prop = app.createChild(Property.class); prop.setName(property.getName()); prop.setValue(property.getValue()); app.createChild(Property.class); prop.setName(MODULE_TYPE); prop.setValue(ServerTags.WEB_MODULE);