001    /*
002     * XML Type:  moduleType
003     * Namespace: http://geronimo.apache.org/xml/ns/deployment-1.2
004     * Java type: org.apache.geronimo.deployment.xbeans.ModuleType
005     *
006     * Automatically generated - do not modify.
007     */
008    package org.apache.geronimo.deployment.xbeans.impl;
009    /**
010     * An XML moduleType(@http://geronimo.apache.org/xml/ns/deployment-1.2).
011     *
012     * This is a complex type.
013     */
014    public class ModuleTypeImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.apache.geronimo.deployment.xbeans.ModuleType
015    {
016        
017        public ModuleTypeImpl(org.apache.xmlbeans.SchemaType sType)
018        {
019            super(sType);
020        }
021        
022        private static final javax.xml.namespace.QName ENVIRONMENT$0 = 
023            new javax.xml.namespace.QName("http://geronimo.apache.org/xml/ns/deployment-1.2", "environment");
024        private static final javax.xml.namespace.QName SERVICE$2 = 
025            new javax.xml.namespace.QName("http://geronimo.apache.org/xml/ns/deployment-1.2", "service");
026        private static final org.apache.xmlbeans.QNameSet SERVICE$3 = org.apache.xmlbeans.QNameSet.forArray( new javax.xml.namespace.QName[] { 
027            new javax.xml.namespace.QName("http://geronimo.apache.org/xml/ns/deployment-1.2", "service"),
028            new javax.xml.namespace.QName("http://geronimo.apache.org/xml/ns/deployment-1.2", "gbean"),
029        });
030        
031        
032        /**
033         * Gets the "environment" element
034         */
035        public org.apache.geronimo.deployment.xbeans.EnvironmentType getEnvironment()
036        {
037            synchronized (monitor())
038            {
039                check_orphaned();
040                org.apache.geronimo.deployment.xbeans.EnvironmentType target = null;
041                target = (org.apache.geronimo.deployment.xbeans.EnvironmentType)get_store().find_element_user(ENVIRONMENT$0, 0);
042                if (target == null)
043                {
044                    return null;
045                }
046                return target;
047            }
048        }
049        
050        /**
051         * Sets the "environment" element
052         */
053        public void setEnvironment(org.apache.geronimo.deployment.xbeans.EnvironmentType environment)
054        {
055            synchronized (monitor())
056            {
057                check_orphaned();
058                org.apache.geronimo.deployment.xbeans.EnvironmentType target = null;
059                target = (org.apache.geronimo.deployment.xbeans.EnvironmentType)get_store().find_element_user(ENVIRONMENT$0, 0);
060                if (target == null)
061                {
062                    target = (org.apache.geronimo.deployment.xbeans.EnvironmentType)get_store().add_element_user(ENVIRONMENT$0);
063                }
064                target.set(environment);
065            }
066        }
067        
068        /**
069         * Appends and returns a new empty "environment" element
070         */
071        public org.apache.geronimo.deployment.xbeans.EnvironmentType addNewEnvironment()
072        {
073            synchronized (monitor())
074            {
075                check_orphaned();
076                org.apache.geronimo.deployment.xbeans.EnvironmentType target = null;
077                target = (org.apache.geronimo.deployment.xbeans.EnvironmentType)get_store().add_element_user(ENVIRONMENT$0);
078                return target;
079            }
080        }
081        
082        /**
083         * Gets array of all "service" elements
084         */
085        public org.apache.geronimo.deployment.xbeans.AbstractServiceType[] getServiceArray()
086        {
087            synchronized (monitor())
088            {
089                check_orphaned();
090                java.util.List targetList = new java.util.ArrayList();
091                get_store().find_all_element_users(SERVICE$3, targetList);
092                org.apache.geronimo.deployment.xbeans.AbstractServiceType[] result = new org.apache.geronimo.deployment.xbeans.AbstractServiceType[targetList.size()];
093                targetList.toArray(result);
094                return result;
095            }
096        }
097        
098        /**
099         * Gets ith "service" element
100         */
101        public org.apache.geronimo.deployment.xbeans.AbstractServiceType getServiceArray(int i)
102        {
103            synchronized (monitor())
104            {
105                check_orphaned();
106                org.apache.geronimo.deployment.xbeans.AbstractServiceType target = null;
107                target = (org.apache.geronimo.deployment.xbeans.AbstractServiceType)get_store().find_element_user(SERVICE$3, i);
108                if (target == null)
109                {
110                    throw new IndexOutOfBoundsException();
111                }
112                return target;
113            }
114        }
115        
116        /**
117         * Returns number of "service" element
118         */
119        public int sizeOfServiceArray()
120        {
121            synchronized (monitor())
122            {
123                check_orphaned();
124                return get_store().count_elements(SERVICE$3);
125            }
126        }
127        
128        /**
129         * Sets array of all "service" element
130         */
131        public void setServiceArray(org.apache.geronimo.deployment.xbeans.AbstractServiceType[] serviceArray)
132        {
133            synchronized (monitor())
134            {
135                check_orphaned();
136                arraySetterHelper(serviceArray, SERVICE$2, SERVICE$3);
137            }
138        }
139        
140        /**
141         * Sets ith "service" element
142         */
143        public void setServiceArray(int i, org.apache.geronimo.deployment.xbeans.AbstractServiceType service)
144        {
145            synchronized (monitor())
146            {
147                check_orphaned();
148                org.apache.geronimo.deployment.xbeans.AbstractServiceType target = null;
149                target = (org.apache.geronimo.deployment.xbeans.AbstractServiceType)get_store().find_element_user(SERVICE$3, i);
150                if (target == null)
151                {
152                    throw new IndexOutOfBoundsException();
153                }
154                target.set(service);
155            }
156        }
157        
158        /**
159         * Inserts and returns a new empty value (as xml) as the ith "service" element
160         */
161        public org.apache.geronimo.deployment.xbeans.AbstractServiceType insertNewService(int i)
162        {
163            synchronized (monitor())
164            {
165                check_orphaned();
166                org.apache.geronimo.deployment.xbeans.AbstractServiceType target = null;
167                target = (org.apache.geronimo.deployment.xbeans.AbstractServiceType)get_store().insert_element_user(SERVICE$3, SERVICE$2, i);
168                return target;
169            }
170        }
171        
172        /**
173         * Appends and returns a new empty value (as xml) as the last "service" element
174         */
175        public org.apache.geronimo.deployment.xbeans.AbstractServiceType addNewService()
176        {
177            synchronized (monitor())
178            {
179                check_orphaned();
180                org.apache.geronimo.deployment.xbeans.AbstractServiceType target = null;
181                target = (org.apache.geronimo.deployment.xbeans.AbstractServiceType)get_store().add_element_user(SERVICE$2);
182                return target;
183            }
184        }
185        
186        /**
187         * Removes the ith "service" element
188         */
189        public void removeService(int i)
190        {
191            synchronized (monitor())
192            {
193                check_orphaned();
194                get_store().remove_element(SERVICE$3, i);
195            }
196        }
197    }