use of org.glassfish.resources.javamail.config.MailResource in project Payara by payara.
the class DeleteJavaMailResourceTest method tearDown.
@After
public void tearDown() throws TransactionFailure {
ConfigSupport.apply(new SingleConfigCode<Resources>() {
public Object run(Resources param) throws PropertyVetoException, TransactionFailure {
Resource target = null;
for (Resource resource : param.getResources()) {
if (resource instanceof MailResource) {
MailResource r = (MailResource) resource;
if (r.getJndiName().equals("mail/MyMailSession")) {
target = resource;
break;
}
}
}
if (target != null) {
param.getResources().remove(target);
}
return null;
}
}, resources);
parameters = new ParameterMap();
}
use of org.glassfish.resources.javamail.config.MailResource in project Payara by payara.
the class MailResourceDeployer method undeployResource.
/**
* {@inheritDoc}
*/
@Override
public void undeployResource(Object resource, String applicationName, String moduleName) throws Exception {
MailResource mailRes = (MailResource) resource;
// converts the config data to j2ee resource
ResourceInfo resourceInfo = new ResourceInfo(mailRes.getJndiName(), applicationName, moduleName);
deleteResource(mailRes, resourceInfo);
}
use of org.glassfish.resources.javamail.config.MailResource in project Payara by payara.
the class MailResourceDeployer method deployResource.
/**
* {@inheritDoc}
*/
@Override
public synchronized void deployResource(Object resource) throws Exception {
MailResource mailResource = (MailResource) resource;
ResourceInfo resourceInfo = ResourceUtil.getResourceInfo(mailResource);
deployResource(resource, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
}
use of org.glassfish.resources.javamail.config.MailResource in project Payara by payara.
the class MailSessionDeployer method deployResource.
@Override
public void deployResource(Object resource) throws Exception {
assert resource instanceof MailSessionDescriptor;
final MailSessionDescriptor desc = (MailSessionDescriptor) resource;
String resourceName = ConnectorsUtil.deriveResourceName(desc.getResourceId(), desc.getName(), desc.getResourceType());
MailResource mailResource = new MyMailResource(desc, resourceName);
getDeployer(mailResource).deployResource(mailResource);
_logger.log(Level.FINE, "Mail-Session resource is deployed having resource-name [" + desc.getName() + "]");
}
use of org.glassfish.resources.javamail.config.MailResource in project Payara by payara.
the class MailSessionDeployer method undeployResource.
@Override
public void undeployResource(Object resource) throws Exception {
assert resource instanceof MailSessionDescriptor;
final MailSessionDescriptor desc = (MailSessionDescriptor) resource;
String resourceName = ConnectorsUtil.deriveResourceName(desc.getResourceId(), desc.getName(), desc.getResourceType());
MailResource mailResource = new MyMailResource(desc, resourceName);
getDeployer(mailResource).undeployResource(mailResource);
_logger.log(Level.FINE, "Mail-Session resource is undeployed having resource-name [" + desc.getName() + "]");
}
Aggregations