private static ResourceInfo getResourceInfo(DeploymentContext ctx, String dataSourceName) { ResourceInfo resourceInfo; if(dataSourceName.startsWith("java:app") /* || jndiName.startsWith("java:module") // Use of module scoped resources from JPA still needs to be speced out*/){ String applicationName = ctx.getCommandParameters(OpsParams.class).name(); resourceInfo = new ResourceInfo(dataSourceName, applicationName); }else{ resourceInfo = new ResourceInfo(dataSourceName); } return resourceInfo; } }
/** * {@inheritDoc} */ public void undeployResource(Object resource, String applicationName, String moduleName) throws Exception { ExternalJndiResource jndiRes = (ExternalJndiResource) resource; ResourceInfo resourceInfo = new ResourceInfo(jndiRes.getJndiName(), applicationName, moduleName); deleteResource(jndiRes, resourceInfo); }
/** * {@inheritDoc} */ public synchronized void deployResource(Object resource, String applicationName, String moduleName) throws Exception { CustomResource customResource = (CustomResource) resource; ResourceInfo resourceInfo = new ResourceInfo(customResource.getJndiName(), applicationName, moduleName); deployResource(resource, resourceInfo); }
/** * {@inheritDoc} */ public void undeployResource(Object resource, String applicationName, String moduleName) throws Exception { CustomResource customResource = (CustomResource) resource; ResourceInfo resourceInfo = new ResourceInfo(customResource.getJndiName(), applicationName, moduleName); deleteResource(customResource, resourceInfo); }
/** * {@inheritDoc} */ public synchronized void deployResource(Object resource, String applicationName, String moduleName) throws Exception { ExternalJndiResource jndiRes = (ExternalJndiResource) resource; ResourceInfo resourceInfo = new ResourceInfo(jndiRes.getJndiName(), applicationName, moduleName); createExternalJndiResource(jndiRes, resourceInfo); }
@Override public void deployResource(Object resource, String applicationName, String moduleName) throws Exception { ManagedThreadFactory ManagedThreadFactoryRes = (ManagedThreadFactory) resource; if (ManagedThreadFactoryRes == null) { _logger.log(Level.WARNING, LogFacade.DEPLOY_ERROR_NULL_CONFIG, "ManagedThreadFactory"); return; } String jndiName = ManagedThreadFactoryRes.getJndiName(); if(_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "ManagedThreadFactoryDeployer.deployResource() : jndi-name ["+jndiName+"]"); } ResourceInfo resourceInfo = new ResourceInfo(ManagedThreadFactoryRes.getJndiName(), applicationName, moduleName); ManagedThreadFactoryConfig config = new ManagedThreadFactoryConfig(ManagedThreadFactoryRes); javax.naming.Reference ref= new javax.naming.Reference( javax.enterprise.concurrent.ManagedThreadFactory.class.getName(), "org.glassfish.concurrent.runtime.deployer.ConcurrentObjectFactory", null); RefAddr addr = new SerializableObjectRefAddr(ManagedThreadFactoryConfig.class.getName(), config); ref.add(addr); RefAddr resAddr = new SerializableObjectRefAddr(ResourceInfo.class.getName(), resourceInfo); ref.add(resAddr); try { // Publish the object ref namingService.publishObject(resourceInfo, ref, true); } catch (NamingException ex) { LogHelper.log(_logger, Level.SEVERE, LogFacade.UNABLE_TO_BIND_OBJECT, ex, "ManagedThreadFactory", jndiName); } }
@Override public void deployResource(Object resource, String applicationName, String moduleName) throws Exception { ManagedExecutorService managedExecutorServiceRes = (ManagedExecutorService) resource; if (managedExecutorServiceRes == null) { _logger.log(Level.WARNING, LogFacade.DEPLOY_ERROR_NULL_CONFIG, "ManagedExecutorService"); return; } String jndiName = managedExecutorServiceRes.getJndiName(); if(_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "ManagedExecutorServiceDeployer.deployResource() : jndi-name ["+jndiName+"], "); } ResourceInfo resourceInfo = new ResourceInfo(managedExecutorServiceRes.getJndiName(), applicationName, moduleName); ManagedExecutorServiceConfig config = new ManagedExecutorServiceConfig(managedExecutorServiceRes); javax.naming.Reference ref= new javax.naming.Reference( javax.enterprise.concurrent.ManagedExecutorService.class.getName(), "org.glassfish.concurrent.runtime.deployer.ConcurrentObjectFactory", null); RefAddr addr = new SerializableObjectRefAddr(ManagedExecutorServiceConfig.class.getName(), config); ref.add(addr); RefAddr resAddr = new SerializableObjectRefAddr(ResourceInfo.class.getName(), resourceInfo); ref.add(resAddr); try { // Publish the object ref namingService.publishObject(resourceInfo, ref, true); } catch (NamingException ex) { LogHelper.log(_logger, Level.SEVERE, LogFacade.UNABLE_TO_BIND_OBJECT, ex, "ManagedExecutorService", jndiName); } }
@Override public void deployResource(Object resource, String applicationName, String moduleName) throws Exception { ManagedScheduledExecutorService ManagedScheduledExecutorServiceRes = (ManagedScheduledExecutorService) resource; if (ManagedScheduledExecutorServiceRes == null) { _logger.log(Level.WARNING, LogFacade.DEPLOY_ERROR_NULL_CONFIG, "ManagedScheduledExecutorService"); return; } String jndiName = ManagedScheduledExecutorServiceRes.getJndiName(); if(_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "ManagedScheduledExecutorServiceDeployer.deployResource() : jndi-name ["+jndiName+"]"); } ResourceInfo resourceInfo = new ResourceInfo(ManagedScheduledExecutorServiceRes.getJndiName(), applicationName, moduleName); ManagedScheduledExecutorServiceConfig config = new ManagedScheduledExecutorServiceConfig(ManagedScheduledExecutorServiceRes); javax.naming.Reference ref= new javax.naming.Reference( javax.enterprise.concurrent.ManagedScheduledExecutorService.class.getName(), "org.glassfish.concurrent.runtime.deployer.ConcurrentObjectFactory", null); RefAddr addr = new SerializableObjectRefAddr(ManagedScheduledExecutorServiceConfig.class.getName(), config); ref.add(addr); RefAddr resAddr = new SerializableObjectRefAddr(ResourceInfo.class.getName(), resourceInfo); ref.add(resAddr); try { // Publish the object ref namingService.publishObject(resourceInfo, ref, true); } catch (NamingException ex) { LogHelper.log(_logger, Level.SEVERE, LogFacade.UNABLE_TO_BIND_OBJECT, ex, "ManagedScheduledExecutorService", jndiName); } }
public static ResourceInfo getGenericResourceInfo(Resource resource, String resourceName){ if(resource.getParent() != null && resource.getParent().getParent() instanceof Application){ Application application = (Application)resource.getParent().getParent(); return new ResourceInfo(resourceName, application.getName()); }else if(resource.getParent() != null && resource.getParent().getParent() instanceof Module){ Module module = (Module)resource.getParent().getParent(); Application application = (Application)module.getParent(); return new ResourceInfo(resourceName, application.getName(), module.getName()); }else{ return new ResourceInfo(resourceName); } }
@Override public void deployResource(Object resource, String applicationName, String moduleName) throws Exception { ContextService contextServiceRes = (ContextService) resource; if (contextServiceRes == null) { _logger.log(Level.WARNING, LogFacade.DEPLOY_ERROR_NULL_CONFIG, "ContextService"); return; } String jndiName = contextServiceRes.getJndiName(); String contextInfo = contextServiceRes.getContextInfo(); if(_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "ContextServiceDeployer.deployResource() : jndi-name ["+jndiName+"], " + " context-info ["+contextInfo+"]"); } ResourceInfo resourceInfo = new ResourceInfo(contextServiceRes.getJndiName(), applicationName, moduleName); ContextServiceConfig config = new ContextServiceConfig(contextServiceRes); javax.naming.Reference ref= new javax.naming.Reference( javax.enterprise.concurrent.ContextService.class.getName(), "org.glassfish.concurrent.runtime.deployer.ConcurrentObjectFactory", null); RefAddr addr = new SerializableObjectRefAddr(ContextServiceConfig.class.getName(), config); ref.add(addr); RefAddr resAddr = new SerializableObjectRefAddr(ResourceInfo.class.getName(), resourceInfo); ref.add(resAddr); try { // Publish the object ref namingService.publishObject(resourceInfo, ref, true); } catch (NamingException ex) { LogHelper.log(_logger, Level.SEVERE, LogFacade.UNABLE_TO_BIND_OBJECT, ex, "ContextService", jndiName); } }
@Override public void undeployResource(Object resource, String applicationName, String moduleName) throws Exception { ManagedScheduledExecutorService managedscheduledexecutorserviceRes = (ManagedScheduledExecutorService) resource; ResourceInfo resourceInfo = new ResourceInfo(managedscheduledexecutorserviceRes.getJndiName(), applicationName, moduleName); namingService.unpublishObject(resourceInfo, managedscheduledexecutorserviceRes.getJndiName()); // stop the runtime object concurrentRuntime.shutdownScheduledManagedExecutorService(managedscheduledexecutorserviceRes.getJndiName()); }
@Override public void undeployResource(Object resource, String applicationName, String moduleName) throws Exception { ManagedExecutorService managedExecutorServiceRes = (ManagedExecutorService) resource; ResourceInfo resourceInfo = new ResourceInfo(managedExecutorServiceRes.getJndiName(), applicationName, moduleName); namingService.unpublishObject(resourceInfo, managedExecutorServiceRes.getJndiName()); // stop the runtime object concurrentRuntime.shutdownManagedExecutorService(managedExecutorServiceRes.getJndiName()); }
@Override public void undeployResource(Object resource, String applicationName, String moduleName) throws Exception { ContextService contextServiceRes = (ContextService) resource; ResourceInfo resourceInfo = new ResourceInfo(contextServiceRes.getJndiName(), applicationName, moduleName); namingService.unpublishObject(resourceInfo, contextServiceRes.getJndiName()); // stop the runtime object concurrentRuntime.shutdownContextService(contextServiceRes.getJndiName()); }
@Override public void undeployResource(Object resource, String applicationName, String moduleName) throws Exception { ManagedThreadFactory managedThreadFactoryRes = (ManagedThreadFactory) resource; ResourceInfo resourceInfo = new ResourceInfo(managedThreadFactoryRes.getJndiName(), applicationName, moduleName); namingService.unpublishObject(resourceInfo, managedThreadFactoryRes.getJndiName()); // stop the runtime object concurrentRuntime.shutdownManagedThreadFactory(managedThreadFactoryRes.getJndiName()); }
public static ResourceInfo getResourceInfo(BindableResource resource){ if(resource.getParent() != null && resource.getParent().getParent() instanceof Application){ Application application = (Application)resource.getParent().getParent(); return new ResourceInfo(resource.getJndiName(), application.getName()); }else if(resource.getParent() != null && resource.getParent().getParent() instanceof Module){ Module module = (Module)resource.getParent().getParent(); Application application = (Application)module.getParent(); return new ResourceInfo(resource.getJndiName(), application.getName(), module.getName()); }else{ return new ResourceInfo(resource.getJndiName()); } }
BindableResource br = (BindableResource) resource; if (Boolean.valueOf(ref.getEnabled()) && Boolean.valueOf(br.getEnabled())) { ResourceInfo resourceInfo = new ResourceInfo(br.getJndiName()); resourcesBinder.deployResource(resourceInfo, br);
BindableResource bindableResource = (BindableResource) resource; if (bindableResourcesHelper.isBindableResourceEnabled(bindableResource)) { ResourceInfo resourceInfo = new ResourceInfo(bindableResource.getJndiName()); resourcesBinder.deployResource(resourceInfo, resource);
public void deployResources(String applicationName, String moduleName, Collection<com.sun.enterprise.config.serverbeans.Resource> resources, boolean postDeployPhase) throws Exception { for(Resource resource : resources){ if(resource instanceof BindableResource) { BindableResource bindableResource = (BindableResource)resource; ResourceInfo resourceInfo = new ResourceInfo(bindableResource.getJndiName(), applicationName, moduleName); if(getResourceDeployer(bindableResource).canDeploy(postDeployPhase, resources, bindableResource)){ resourcesBinder.deployResource(resourceInfo, bindableResource); } } else{ if(getResourceDeployer(resource).canDeploy(postDeployPhase, resources, resource)){ getResourceDeployer(resource).deployResource(resource, applicationName, moduleName); } } } }