package org.jboss.loom.migrators.jaxr;

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.migrators.Origin;
import org.jboss.loom.spi.IConfigFragment;

/**
 * $JBOSS_HOME/server/all/deploy/juddi-service.sar/META-INF/jboss-service.xml

<server>
    <!-- The juddi service configration -->
    <mbean code="org.jboss.jaxr.juddi.JUDDIService" name="jboss:service=juddi">
    
        <!-- Whether we want to run the db initialization scripts -->
        <!-- Should all tables be created on Start-->
        <attribute name="CreateOnStart">false</attribute>
        <!-- Should all tables be dropped on Stop-->
        <attribute name="DropOnStop">false</attribute>
        <!-- Should all tables be dropped on Start-->
        <attribute name="DropOnStart">false</attribute>
        <!-- Datasource to Database-->
        <attribute name="DataSourceUrl">java:/DefaultDS</attribute>
        <!-- Alias to the registry-->
        <attribute name="RegistryOperator">RegistryOperator</attribute>
        <!-- Should I bind a Context to which JaxrConnectionFactory bound-->
        <attribute name="ShouldBindJaxr">true</attribute>
        <!-- Context to which JaxrConnectionFactory to bind to.
             If you have remote clients, please bind it to the global
             namespace (default behavior). To just cater to clients running
             on the same VM as JBoss, change to java:/JAXR -->
        <attribute name="BindJaxr">JAXR</attribute>
        <attribute name="DropDB">false</attribute> 
        <depends>jboss.jca:service=DataSourceBinding,name=DefaultDS</depends>
    </mbean>
</server>
   
 * 
 * @Jira: MIGR-42
 * @author Ondrej Zizka, ozizka at redhat.com
 */
@XmlRootElement(name = "mbean")
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = "mbean")
public final class JaxrConfigBean implements IConfigFragment, Origin.Wise {
    
    @XmlAttribute(name = "name") 
    private String mbeanName;

    
    // Whether we want to run the db initialization scripts
    // Should all tables be created on Start
    @XmlPath("attribute[@name='CreateOnStart']/@value")
    private boolean CreateOnStart = false;

    // Should all tables be dropped on Stop
    @XmlPath("attribute[@name='DropOnStop']/@value")
    private boolean DropOnStop = false;

    // Should all tables be dropped on Start
    @XmlPath("attribute[@name='DropOnStart']/@value")
    private boolean DropOnStart = false;

    // Datasource to Database
    @XmlPath("attribute[@name='DataSourceUrl']/@value")
    private String DataSourceUrl; //java:/DefaultDS

    // Alias to the registry
    @XmlPath("attribute[@name='RegistryOperator']/@value")
    private String RegistryOperator; // RegistryOperator

    // Should I bind a Context to which JaxrConnectionFactory bound
    @XmlPath("attribute[@name='ShouldBindJaxr']/@value")
    private boolean ShouldBindJaxr; // true

    // Context to which JaxrConnectionFactory to bind to.
    // If you have remote clients, please bind it to the global namespace(default behavior). 
    // To just cater to clients running on the same VM as JBoss, change to java:/JAXR
    @XmlPath("attribute[@name='BindJaxr']/@value")
    private boolean BindJaxr; // JAXR
    @XmlPath("attribute[@name='DropDB']/@value")
    private boolean DropDB = false; 


    
    //<editor-fold defaultstate="collapsed" desc="get/set">
    public String getMbeanName() { return mbeanName; }
    public void setMbeanName( String mbeanName ) { this.mbeanName = mbeanName; }
    
    public boolean isCreateOnStart() { return CreateOnStart; }
    public void setCreateOnStart( boolean CreateOnStart ) { this.CreateOnStart = CreateOnStart; }
    public boolean isDropOnStop() { return DropOnStop; }
    public void setDropOnStop( boolean DropOnStop ) { this.DropOnStop = DropOnStop; }
    public boolean isDropOnStart() { return DropOnStart; }
    public void setDropOnStart( boolean DropOnStart ) { this.DropOnStart = DropOnStart; }
    public String getDataSourceUrl() { return DataSourceUrl; }
    public void setDataSourceUrl( String DataSourceUrl ) { this.DataSourceUrl = DataSourceUrl; }
    public String getRegistryOperator() { return RegistryOperator; }
    public void setRegistryOperator( String RegistryOperator ) { this.RegistryOperator = RegistryOperator; }
    public boolean isShouldBindJaxr() { return ShouldBindJaxr; }
    public void setShouldBindJaxr( boolean ShouldBindJaxr ) { this.ShouldBindJaxr = ShouldBindJaxr; }
    public boolean isBindJaxr() { return BindJaxr; }
    public void setBindJaxr( boolean BindJaxr ) { this.BindJaxr = BindJaxr; }
    public boolean isDropDB() { return DropDB; }
    public void setDropDB( boolean DropDB ) { this.DropDB = DropDB; }
    //</editor-fold>

    
    // Origin
    private Origin origin;
    @Override public Origin getOrigin() { if( origin == null ) origin = new Origin( null ); return origin; }
    public JaxrConfigBean setOrigin( Origin origin ) { this.origin = origin; return this; }
    
}// class

@@ -37,61 +37,8 @@
 r;%0A%0A
-import java.util.Collections;%0Aimport java.util.List;%0A
 impo
@@ -135,100 +135,8 @@
 pe;%0A
-import javax.xml.bind.annotation.XmlAttribute;%0Aimport javax.xml.bind.annotation.XmlElement;%0A
 impo
@@ -278,16 +278,63 @@
 mlPath;%0A
+import org.jboss.loom.migrators.MBeanJaxbBase;%0A
 import o
@@ -2063,16 +2063,54 @@
 nfigBean
+ extends MBeanJaxbBase%3CJaxrConfigBean%3E
  impleme
@@ -2151,75 +2151,8 @@
 %0A   
- %0A    @XmlAttribute(name = %22name%22) %0A    private String mbeanName;%0A%0A
     
@@ -3575,149 +3575,8 @@
 t%22%3E%0A
-    public String getMbeanName() %7B return mbeanName; %7D%0A    public void setMbeanName( String mbeanName ) %7B this.mbeanName = mbeanName; %7D%0A    %0A
     
@@ -4803,256 +4803,8 @@
 old%3E
-%0A%0A    %0A    // Origin%0A    private Origin origin;%0A    @Override public Origin getOrigin() %7B if( origin == null ) origin = new Origin( null ); return origin; %7D%0A    public JaxrConfigBean setOrigin( Origin origin ) %7B this.origin = origin; return this; %7D
 %0A   

Use MBeanJaxbBase for JaxrConfigBean.