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.servicemix.geronimo;
018    
019    import org.apache.commons.logging.Log;
020    import org.apache.commons.logging.LogFactory;
021    import org.apache.geronimo.gbean.GBeanInfo;
022    import org.apache.geronimo.gbean.GBeanInfoBuilder;
023    import org.apache.geronimo.gbean.GBeanLifecycle;
024    
025    public class SharedLibrary implements GBeanLifecycle {
026    
027        private static final Log log = LogFactory.getLog(SharedLibrary.class);
028        
029        private String name;
030        private String description;
031        private Container container;
032        
033        public SharedLibrary(String name, String description, Container container) {
034            this.name = name;
035            this.description = description;
036            this.container = container;
037        }
038        
039        public String getName() {
040            return this.name;
041        }
042    
043        public void doStart() throws Exception {
044            log.info("doStart called for JBI service assembly: " + name);
045        }
046    
047        public void doStop() throws Exception {
048            log.info("doStop called for JBI service assembly: " + name);
049        }
050    
051        public void doFail() {
052            log.info("doFail called for JBI service assembly: " + name);
053        }
054        
055        public static final GBeanInfo GBEAN_INFO;
056    
057        static {
058            GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("JBISharedLibrary", SharedLibrary.class, "JBISharedLibrary");
059            infoFactory.addAttribute("name", String.class, true);
060            infoFactory.addAttribute("description", String.class, true);
061            infoFactory.addReference("container", Container.class);
062            infoFactory.setConstructor(new String[] {"name", "description", "container"});
063            GBEAN_INFO = infoFactory.getBeanInfo();
064        }
065    
066        public static GBeanInfo getGBeanInfo() {
067            return GBEAN_INFO;
068        }
069    
070    }