use of org.jboss.metadata.javaee.spec.MailSessionMetaData in project wildfly by wildfly.
the class MailSessionDefinitionAnnotationProcessor method processAnnotation.
@Override
protected ResourceDefinitionInjectionSource processAnnotation(AnnotationInstance annotationInstance, PropertyReplacer propertyReplacer) throws DeploymentUnitProcessingException {
final MailSessionMetaData metaData = new MailSessionMetaData();
metaData.setName(AnnotationElement.asRequiredString(annotationInstance, AnnotationElement.NAME));
metaData.setTransportProtocol(AnnotationElement.asOptionalString(annotationInstance, "transportProtocol"));
metaData.setStoreProtocol(AnnotationElement.asOptionalString(annotationInstance, "storeProtocol"));
metaData.setHost(AnnotationElement.asOptionalString(annotationInstance, "host"));
metaData.setUser(AnnotationElement.asOptionalString(annotationInstance, "user"));
metaData.setPassword(AnnotationElement.asOptionalString(annotationInstance, "password"));
metaData.setFrom(AnnotationElement.asOptionalString(annotationInstance, "from"));
final PropertiesMetaData properties = new PropertiesMetaData();
for (String fullProp : AnnotationElement.asOptionalStringArray(annotationInstance, AnnotationElement.PROPERTIES)) {
PropertyMetaData p = new PropertyMetaData();
String[] prop = fullProp.split("=", 2);
p.setName(prop[0]);
p.setValue(prop[1]);
properties.add(p);
}
metaData.setProperties(properties);
final SessionProvider provider = SessionProviderFactory.create(metaData);
return new MailSessionDefinitionInjectionSource(metaData.getName(), provider);
}
Aggregations