001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.geronimo.webservices.saaj;
018    
019    import org.apache.geronimo.gbean.GBeanInfo;
020    import org.apache.geronimo.gbean.GBeanInfoBuilder;
021    import org.apache.geronimo.gbean.GBeanLifecycle;
022    import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
023    
024    public class SAAJGBean implements GBeanLifecycle {
025    
026        public SAAJGBean() {
027        }
028    
029        public void doStart() throws Exception {
030            setProperty("javax.xml.soap.MessageFactory", 
031                        "org.apache.geronimo.webservices.saaj.GeronimoMessageFactory");
032            setProperty("javax.xml.soap.SOAPFactory", 
033                        "org.apache.geronimo.webservices.saaj.GeronimoSOAPFactory");
034            setProperty("javax.xml.soap.SOAPConnectionFactory", 
035                        "org.apache.geronimo.webservices.saaj.GeronimoSOAPConnectionFactory");
036            setProperty("javax.xml.soap.MetaFactory", 
037                        "org.apache.geronimo.webservices.saaj.GeronimoMetaFactory");                
038        }
039    
040        private void setProperty(String propertyName, String value) {
041            String propValue = System.getProperty(propertyName);
042            // set only if the property is not set
043            if (propValue == null) {
044                System.setProperty(propertyName, value);
045            }        
046        }
047        
048        public void doStop() throws Exception {             
049        }
050    
051        public void doFail() {
052        }
053    
054        public static final GBeanInfo GBEAN_INFO;
055    
056        static {
057            GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(SAAJGBean.class, SAAJGBean.class, NameFactory.GERONIMO_SERVICE);
058                    
059            GBEAN_INFO = infoFactory.getBeanInfo();
060        }
061    
062        public static GBeanInfo getGBeanInfo() {
063            return GBEAN_INFO;
064        }
065    
066    }