本文整理了Java中com.sun.enterprise.config.serverbeans.Application.setResources()
方法的一些代码示例,展示了Application.setResources()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Application.setResources()
方法的具体详情如下:
包路径:com.sun.enterprise.config.serverbeans.Application
类名称:Application
方法名:setResources
暂无
代码示例来源:origin: org.glassfish.connectors/connectors-runtime
/**
* 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);
}
}
}
}
}
代码示例来源:origin: org.glassfish.main.resources/resources-runtime
/**
* 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 void retainResourceConfig(DeploymentContext dc, Map<String, Resources> allResources) throws Exception {
String appName = getAppNameFromDeployCmdParams(dc);
Application application = dc.getTransientAppMetaData(ServerTags.APPLICATION, Application.class);
Resources appScopedResources = allResources.get(appName);
if(appScopedResources != null){
application.setResources(appScopedResources);
}
if(DeploymentUtils.isArchiveOfType(dc.getSource(), DOLUtils.earType(), locator)){
List<Module> modules = application.getModule();
if(modules != null){
for(Module module : modules){
Resources moduleScopedResources = allResources.get(module.getName());
if(moduleScopedResources != null){
module.setResources(moduleScopedResources);
}
}
}
}
}
代码示例来源: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.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);
}
}
内容来源于网络,如有侵权,请联系作者删除!