public boolean start(ApplicationContext startupContext) throws Exception { DeploymentContext dc = (DeploymentContext)startupContext; final DeployCommandParameters deployParams = dc.getCommandParameters(DeployCommandParameters.class); //during app. deployment, create resources config and load resources if(deployParams.origin == OpsParams.Origin.deploy || deployParams.origin == OpsParams.Origin.deploy_instance){ ResourcesDeployer.deployResources(applicationName, true); }else if (deployParams.origin == OpsParams.Origin.load || deployParams.origin == OpsParams.Origin.create_application_ref) { //<application> and its <resources>, <modules> are already available. //Deploy them. //during app. load (eg: server start or application/application-ref enable(), load resources asrManager.deployResources(applicationName); } return true; }
public void deployResources(String applicationName){ Application app = applications.getApplication(applicationName); if(app != null){ Resources appScopedResources = app.getResources(); if(appScopedResources != null){ deployResources(appScopedResources.getResources()); } List<Module> modules = app.getModule(); if(modules != null){ for(Module module : modules){ Resources moduleScopedResources = module.getResources(); if(moduleScopedResources != null){ deployResources(moduleScopedResources.getResources()); } } } } }
public void postConstruct() { Collection<Application> apps = applications.getApplications(); if(apps != null){ for(Application app : apps){ Resources resources = app.getResources(); if(resources != null){ deployResources(resources.getResources()); } List<Module> modules = app.getModule(); if(modules != null){ for(Module module : modules){ Resources moduleResources = module.getResources(); if(moduleResources != null){ deployResources(moduleResources.getResources()); } } } } } }