本文整理了Java中com.sun.enterprise.config.serverbeans.Application.createChild()
方法的一些代码示例,展示了Application.createChild()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Application.createChild()
方法的具体详情如下:
包路径:com.sun.enterprise.config.serverbeans.Application
类名称:Application
方法名:createChild
暂无
代码示例来源:origin: org.glassfish.main.core/kernel
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));
}
}
}
}
代码示例来源:origin: fujitsu/launcher
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));
}
}
}
}
代码示例来源:origin: org.glassfish.main.admin/admin-core
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);
代码示例来源:origin: org.glassfish.admin/config-api
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);
代码示例来源:origin: eclipse-ee4j/glassfish
/**
* 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);
}
}
代码示例来源:origin: org.glassfish.common/internal-api
/**
* 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);
}
}
代码示例来源:origin: org.glassfish.main.deployment/deployment-javaee-core
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);
}
}
代码示例来源:origin: org.glassfish.main.core/kernel
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;
}
代码示例来源:origin: fujitsu/launcher
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;
}
代码示例来源:origin: org.glassfish.main.core/kernel
Module singleModule = app.createChild(Module.class);
app.getModule().add(singleModule);
singleModule.setName(app.getName());
代码示例来源:origin: org.glassfish.connectors/connectors-runtime
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);
}
}
代码示例来源:origin: org.glassfish.main.resources/resources-runtime
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);
}
}
代码示例来源:origin: org.glassfish.admin/config-api
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);
内容来源于网络,如有侵权,请联系作者删除!