001    /*
002     * Copyright 2006 Stephen J. McConnell.
003     *
004     * Licensed  under the  Apache License,  Version 2.0  (the "License");
005     * you may not use  this file  except in  compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *   http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed  under the  License is distributed on an "AS IS" BASIS,
012     * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
013     * implied.
014     *
015     * See the License for the specific language governing permissions and
016     * limitations under the License.
017     */
018    
019    package net.dpml.transit.management;
020    
021    import javax.management.AttributeChangeNotification;
022    import javax.management.MBeanNotificationInfo;
023    import javax.management.NotificationBroadcasterSupport;
024    import javax.management.MBeanException;
025    
026    import net.dpml.transit.model.HostModel;
027    
028    /** 
029     * Transit MBean.
030     *
031     * @author <a href="http://www.dpml.net">Digital Product Meta Library</a>
032     * @version 0.0.0
033     */
034    public class HostController implements HostControllerMXBean 
035    {
036        private HostModel m_model;
037        
038        public HostController( final HostModel model ) throws Exception
039        {
040            m_model = model;
041        }
042        
043        public String getID() throws MBeanException
044        {
045            try
046            {
047                return m_model.getID();
048            }
049            catch( Exception e )
050            {
051                throw new MBeanException( e );
052            }
053        }
054        
055        public int getPriority() throws MBeanException
056        {
057            try
058            {
059                return m_model.getPriority();
060            }
061            catch( Exception e )
062            {
063                throw new MBeanException( e );
064            }
065        }
066        
067        public String getBase() throws MBeanException
068        {
069            try
070            {
071                return m_model.getBasePath();
072            }
073            catch( Exception e )
074            {
075                throw new MBeanException( e );
076            }
077        }
078        
079        public String getLayout() throws MBeanException
080        {
081            try
082            {
083                return m_model.getLayoutModel().getID();
084            }
085            catch( Exception e )
086            {
087                throw new MBeanException( e );
088            }
089        }
090        
091        public boolean getEnabled() throws MBeanException
092        {
093            try
094            {
095                return m_model.getEnabled();
096            }
097            catch( Exception e )
098            {
099                throw new MBeanException( e );
100            }
101        }
102        
103        public boolean getTrusted() throws MBeanException
104        {
105            try
106            {
107                return m_model.getTrusted();
108            }
109            catch( Exception e )
110            {
111                throw new MBeanException( e );
112            }
113        }
114    }