@Override public void addTransientAppMetaData(String metaDataKey, Object metaData) { context.addTransientAppMetaData(metaDataKey, metaData); }
/** * Records the Artifacts object into the specified deployment context. * @param dc the DeploymentContent in which to persist the Artifacts object */ public void record(final DeploymentContext dc) { synchronized (dc) { /* * Note that "addTransientAppMetaData" actually "puts" into a map, * so it's more like a "set" operation. */ dc.addTransientAppMetaData(transientAppMetadataKey(), this); } }
/** * Retreives the client artifacts store from the provided deployment * context, creating one and storing it back into the DC if none is * there yet. * * @param dc the deployment context to hold the ClientArtifactsManager object * @return the ClientArtifactsManager object from the deployment context (created * and stored in the DC if needed) */ public static ClientArtifactsManager get(final DeploymentContext dc) { synchronized (dc) { ClientArtifactsManager result = dc.getTransientAppMetaData( CLIENT_ARTIFACTS_KEY, ClientArtifactsManager.class); if (result == null) { result = new ClientArtifactsManager(); dc.addTransientAppMetaData(CLIENT_ARTIFACTS_KEY, result); } return result; } }
@Override void visitPUD(PersistenceUnitDescriptor pud, DeploymentContext context) { if(referencedPus.contains(pud)) { boolean isDas = isDas(); // While running in embedded mode, it is not possible to guarantee that entity classes are not loaded by the app classloader before transformers are installed // If that happens, weaving will not take place and EclipseLink will throw up. Provide users an option to disable weaving by passing the flag. // Note that we enable weaving if not explicitly disabled by user boolean weavingEnabled = Boolean.valueOf(sc.getArguments().getProperty("org.glassfish.persistence.embedded.weaving.enabled", "true")); ProviderContainerContractInfo providerContainerContractInfo = weavingEnabled ? new ServerProviderContainerContractInfo(context, connectorRuntime, isDas) : new EmbeddedProviderContainerContractInfo(context, connectorRuntime, isDas); try { ((ExtendedDeploymentContext) context).prepareScratchDirs(); } catch (IOException e) { // There is no way to recover if we are not able to create the scratch dirs. Just rethrow the exception. throw new RuntimeException(e); } PersistenceUnitLoader puLoader = new PersistenceUnitLoader(pud, providerContainerContractInfo); // Store the puLoader in context. It is retrieved to execute java2db and to // store the loaded emfs in a JPAApplicationContainer object for cleanup context.addTransientAppMetaData(getUniquePuIdentifier(pud), puLoader ); } } };
public Collection<? extends Sniffer> getSniffers(final ArchiveHandler handler, Collection<? extends Sniffer> sniffers, DeploymentContext context) { if (handler == null) { return Collections.EMPTY_LIST; } if (sniffers==null) { if (handler instanceof CompositeHandler) { ((CompositeHandler)handler).initCompositeMetaData(context); context.getAppProps().setProperty(ServerTags.IS_COMPOSITE, "true"); } sniffers = snifferManager.getSniffers(context); } context.addTransientAppMetaData(DeploymentProperties.SNIFFERS, sniffers); snifferManager.validateSniffers(sniffers, context); return sniffers; }
public Collection<? extends Sniffer> getSniffers(final ArchiveHandler handler, Collection<? extends Sniffer> sniffers, DeploymentContext context) { if (handler == null) { return Collections.EMPTY_LIST; } if (sniffers==null) { if (handler instanceof CompositeHandler) { ((CompositeHandler)handler).initCompositeMetaData(context); context.getAppProps().setProperty(ServerTags.IS_COMPOSITE, "true"); } sniffers = snifferManager.getSniffers(context); } context.addTransientAppMetaData(DeploymentProperties.SNIFFERS, sniffers); snifferManager.validateSniffers(sniffers, context); return sniffers; }
/** * Returns the Artifacts object from the deployment context with the * sepcified key prefix, creating a new one and storing it in the DC if * no matching Artifacts object already exists. * @param dc the deployment context * @param keyPrefix key prefix by which to look up or store the artifacts * @return */ public static Artifacts get( final DeploymentContext dc, final String keyPrefix) { final String key = transientAppMetadataKey(keyPrefix); synchronized (dc) { Artifacts result = dc.getTransientAppMetaData( transientAppMetadataKey(keyPrefix), Artifacts.class); if (result == null) { result = new Artifacts(keyPrefix); dc.addTransientAppMetaData(key, result); } return result; } }
dc.addTransientAppMetaData(ConnectorConstants.APP_SCOPED_RESOURCES_MAP, appScopedResources); ApplicationInfo appInfo = appRegistry.get(appName); if(appInfo != null){
public boolean start(ApplicationContext startupContext) throws Exception { started = true; if (! initializeInOrder) { Boolean alreadyMarked = dc.getTransientAppMetaData(EJB_APP_MARKED_AS_STARTED_STATUS, Boolean.class); if (! alreadyMarked.booleanValue()) { List<EjbApplication> ejbAppList = dc.getTransientAppMetaData(CONTAINER_LIST_KEY, List.class); for (EjbApplication app : ejbAppList) { app.markAllContainersAsStarted(); } dc.addTransientAppMetaData(EJB_APP_MARKED_AS_STARTED_STATUS, Boolean.TRUE); } } try { DeployCommandParameters params = ((DeploymentContext)startupContext). getCommandParameters(DeployCommandParameters.class); for (Container container : containers) { container.startApplication(params.origin.isDeploy()); } singletonLCM.doStartup(this); } catch(Exception e) { abortInitializationAfterException(); throw e; } return true; }
context.addTransientAppMetaData(Types.class.getName(), parsingContext.getTypes()); context.addTransientAppMetaData(Parser.class.getName(), parser); return parsingContext.getTypes(); } catch(InterruptedException e) {
public boolean start(ApplicationContext startupContext) throws Exception { started = true; if (! initializeInOrder) { Boolean alreadyMarked = dc.getTransientAppMetaData(EJB_APP_MARKED_AS_STARTED_STATUS, Boolean.class); if (! alreadyMarked.booleanValue()) { List<EjbApplication> ejbAppList = dc.getTransientAppMetaData(CONTAINER_LIST_KEY, List.class); for (EjbApplication app : ejbAppList) { app.markAllContainersAsStarted(); } dc.addTransientAppMetaData(EJB_APP_MARKED_AS_STARTED_STATUS, Boolean.TRUE); } } try { DeployCommandParameters params = ((DeploymentContext)startupContext). getCommandParameters(DeployCommandParameters.class); for (Container container : containers) { container.startApplication(params.origin.isDeploy()); } singletonLCM.doStartup(this); } catch(Exception e) { abortInitializationAfterException(); throw e; } return true; }
context.addTransientAppMetaData(Types.class.getName(), parsingContext.getTypes()); context.addTransientAppMetaData(Parser.class.getName(), parser); return parsingContext.getTypes(); } catch(InterruptedException e) {
public Transaction prepareAppConfigChanges(final DeploymentContext context) throws TransactionFailure { final Properties appProps = context.getAppProps(); final DeployCommandParameters deployParams = context.getCommandParameters(DeployCommandParameters.class); Transaction t = new Transaction(); try { // prepare the application element ConfigBean newBean = ((ConfigBean)ConfigBean.unwrap(applications)).allocate(Application.class); Application app = newBean.createProxy(); Application app_w = t.enroll(app); setInitialAppAttributes(app_w, deployParams, appProps, context); context.addTransientAppMetaData(ServerTags.APPLICATION, app_w); } catch(TransactionFailure e) { t.rollback(); throw e; } catch (Exception e) { t.rollback(); throw new TransactionFailure(e.getMessage(), e); } return t; }
public Transaction prepareAppConfigChanges(final DeploymentContext context) throws TransactionFailure { final Properties appProps = context.getAppProps(); final DeployCommandParameters deployParams = context.getCommandParameters(DeployCommandParameters.class); Transaction t = new Transaction(); try { // prepare the application element ConfigBean newBean = ((ConfigBean)ConfigBean.unwrap(applications)).allocate(Application.class); Application app = newBean.createProxy(); Application app_w = t.enroll(app); setInitialAppAttributes(app_w, deployParams, appProps, context); context.addTransientAppMetaData(ServerTags.APPLICATION, app_w); } catch(TransactionFailure e) { t.rollback(); throw e; } catch (Exception e) { t.rollback(); throw new TransactionFailure(e.getMessage(), e); } return t; }
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); } }
private static void createModuleScopedResources(Application app, Module module, List<org.glassfish.resource.common.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 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); } }
dc.getCommandParameters(DeployCommandParameters.class); boolean generateRmicStubs = dcp.generatermistubs; dc.addTransientAppMetaData(CMPDeployer.MODULE_CLASSPATH, getModuleClassPath(dc)); if( generateRmicStubs ) { StaticRmiStubGenerator staticStubGenerator = new StaticRmiStubGenerator(habitat);
dc.getCommandParameters(DeployCommandParameters.class); boolean generateRmicStubs = dcp.generatermistubs; dc.addTransientAppMetaData(CMPDeployer.MODULE_CLASSPATH, getModuleClassPath(dc)); if( generateRmicStubs ) { StaticRmiStubGenerator staticStubGenerator = new StaticRmiStubGenerator(habitat);