package org.jboss.loom.migrators.mail;

import java.util.Collections;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.eclipse.persistence.oxm.annotations.XmlPath;
import org.jboss.loom.spi.IConfigFragment;

/**
    <?xml version="1.0" encoding="UTF-8"?>  
    <server>  
        <mbean code="org.jboss.mail.MailService" name="jboss:service=Mail">  
            <attribute name="JNDIName">java:/Mail</attribute>  
            <attribute name="User">user</attribute>  
            <attribute name="Password">password</attribute>  
            <attribute name="Configuration">  
                <configuration>  
                    <property name="mail.store.protocol" value="pop3"/>  
                    <property name="mail.transport.protocol" value="smtps"/>  
                    <property name="mail.smtps.starttls.enable" value="true"/>  
                    <property name="mail.smtps.auth" value="true"/>    
                    <property name="mail.user" value="user"/>  
                    <property name="mail.pop3.host" value="pop3.gmail.com"/>  
                    <property name="mail.smtps.host" value="smtp.gmail.com"/>  
                    <property name="mail.smtps.port" value="465"/>  
                    <property name="mail.from" value="user@gmail.com"/>  
                    <property name="mail.debug" value="true"/>  
                </configuration>  
            </attribute>  
            <depends>jboss:service=Naming</depends>  
        </mbean>  
    </server>
 *
 * @author Ondrej Zizka, ozizka at redhat.com
 */
@XmlRootElement(name = "mbean")
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = "mbean")
public final class MailServiceBean implements IConfigFragment {
    
    @XmlAttribute(name = "name") 
    private String mbeanName;
    @XmlPath("attribute[@name='JNDIName']/text()")
    @XmlElement(name = "attribute")
    private String jndiName;
    @XmlPath("attribute[@name='User']")
    private String userAttr;
    @XmlPath("attribute[@name='Password']")
    private String pass;

    @XmlPath("attribute[@name='Configuration']/configuration/property[@name='mail.store.protocol']/@value")
    private String storeProtocol;       //pop3
    @XmlPath("attribute[@name='Configuration']/configuration/property[@name='mail.pop3.host']/@value")
    private String pop3Host;            // pop3.gmail.com
    @XmlPath("attribute[@name='Configuration']/configuration/property[@name='mail.user']/@value")
    private String user;               // user

    @XmlPath("attribute[@name='Configuration']/configuration/property[@name='mail.transport.protocol']/@value")
    private String transportProtocol;  // smtp
    @XmlPath("attribute[@name='Configuration']/configuration/property[@name='mail.smtp.host']/@value")
    private String smtpHost;           // smtp.gmail.com
    @XmlPath("attribute[@name='Configuration']/configuration/property[@name='mail.smtp.port']/@value")
    private String smtpPort;           // 465
    @XmlPath("attribute[@name='Configuration']/configuration/property[@name='mail.smtp.auth']/@value")
    private String smtpAuth;           // true | false
    @XmlPath("attribute[@name='Configuration']/configuration/property[@name='mail.smtp.password']/@value")
    private String smtpPassword;       // pass
    @XmlPath("attribute[@name='Configuration']/configuration/property[@name='mail.smtp.user']/@value")
    private String smtpUser;           // user
    @XmlPath("attribute[@name='Configuration']/configuration/property[@name='mail.smtp.starttls.enable']/@value")
    private String smtpStarttlsEnable; // true | false
    @XmlPath("attribute[@name='Configuration']/configuration/property[@name='mail.smtp.ssl.enable']/@value")
    private String smtpSslEnable;      // true | false
    @XmlPath("attribute[@name='Configuration']/configuration/property[@name='mail.from']/@value")
    private String from;                // user@gmail.com
    
    @XmlPath("attribute[@name='Configuration']/configuration/property[@name='mail.debug']/@value")
    private String debug;               // true
    
    
    /**
     * Wrapper for the List.
     */
    @XmlRootElement(name = "server")
    public static final class Wrap {
        
        @XmlElement(name = "mbean")
        List<MailServiceBean> mailBeans = Collections.EMPTY_LIST;
        
    }

    
    //<editor-fold defaultstate="collapsed" desc="get/set">
    public String getMbeanName() { return mbeanName; }
    public void setMbeanName( String mbeanName ) { this.mbeanName = mbeanName; }
    public String getJndiName() { return jndiName; }
    public void setJndiName( String jndiName ) { this.jndiName = jndiName; }
    public String getUser() { return user; }
    public void setUser( String user ) { this.user = user; }
    public String getPass() { return pass; }
    public void setPass( String pass ) { this.pass = pass; }
    public String getStoreProtocol() { return storeProtocol; }
    public void setStoreProtocol( String storeProtocol ) { this.storeProtocol = storeProtocol; }
    public String getPop3Host() { return pop3Host; }
    public void setPop3Host( String pop3Host ) { this.pop3Host = pop3Host; }
    public String getTransportProtocol() { return transportProtocol; }
    public void setTransportProtocol( String transportProtocol ) { this.transportProtocol = transportProtocol; }
    public String getSmtpHost() { return smtpHost; }
    public void setSmtpHost( String smtpsHost ) { this.smtpHost = smtpsHost; }
    public String getSmtpPort() { return smtpPort; }
    public void setSmtpPort( String smtpsPort ) { this.smtpPort = smtpsPort; }
    public String getSmtpAuth() { return smtpAuth; }
    public void setSmtpAuth( String smtpsAuth ) { this.smtpAuth = smtpsAuth; }
    public String getSmtpUser() { return smtpUser; }
    public void setSmtpUser( String smtpsUser ) { this.smtpUser = smtpsUser; }
    public String getSmtpStarttlsEnable() { return smtpStarttlsEnable; }
    public void setSmtpStarttlsEnable( String smtpsStarttlsEnable ) { this.smtpStarttlsEnable = smtpsStarttlsEnable; }
    public String getFrom() { return from; }
    public void setFrom( String from ) { this.from = from; }
    public String getDebug() { return debug; }
    public void setDebug( String debug ) { this.debug = debug; }
    //</editor-fold>
    
}// class

@@ -423,16 +423,103 @@
 mlPath;%0A
+import org.jboss.loom.migrators.MBeanJaxbBase;%0Aimport org.jboss.loom.migrators.Origin;%0A
 import o
@@ -2029,105 +2029,93 @@
 ean 
-implements IConfigFragment %7B%0A    %0A    @XmlAttribute(name = %22name%22) %0A    private String mbeanName;
+extends MBeanJaxbBase%3CMailServiceBean%3E implements IConfigFragment, Origin.Wise %7B%0A    
 %0A   
@@ -2227,16 +2227,21 @@
 diName;%0A
+    %0A
     @Xml
@@ -4729,144 +4729,8 @@
 t%22%3E%0A
-    public String getMbeanName() %7B return mbeanName; %7D%0A    public void setMbeanName( String mbeanName ) %7B this.mbeanName = mbeanName; %7D%0A
     

Use MBeanJaxbBase for MailServiceBean.