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    
018    package org.apache.geronimo.mgmt;
019    
020    import javax.annotation.security.RolesAllowed;
021    import javax.ejb.RemoteHome;
022    import javax.ejb.Stateless;
023    import javax.management.Attribute;
024    import javax.management.AttributeList;
025    import javax.management.AttributeNotFoundException;
026    import javax.management.InstanceNotFoundException;
027    import javax.management.InvalidAttributeValueException;
028    import javax.management.MBeanException;
029    import javax.management.ObjectName;
030    import javax.management.ReflectionException;
031    
032    import org.apache.openejb.mgmt.MEJBBean;
033    
034    /**
035     * MEJB represents the management EJB defined by JSR 77
036     * MEJBBean extends javax.ejb.Statetless and has @RemoteHome(ManagementHome.class)
037     * 
038     * @version $Rev: 706640 $ $Date: 2008-10-21 14:44:05 +0000 (Tue, 21 Oct 2008) $
039     */
040    
041    @Stateless(name="ejb/mgmt/MEJB")  //JNDI name will be java:comp/env/ejb/mgmt/MEJB
042    @RolesAllowed({"mejbadmin", "mejbuser"})
043    @RemoteHome(javax.management.j2ee.ManagementHome.class)
044    
045    public class MEJB extends MEJBBean {
046        
047        @Override
048        @RolesAllowed("mejbadmin")
049        public void setAttribute(ObjectName objName, Attribute attrib) throws InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
050            super.setAttribute(objName, attrib);
051        }
052        
053        @Override
054        @RolesAllowed("mejbadmin")
055        public AttributeList setAttributes(ObjectName objName, AttributeList attribList)  throws InstanceNotFoundException, ReflectionException{
056            return super.setAttributes(objName, attribList);
057        }
058    
059        @Override
060        @RolesAllowed("mejbadmin")
061        public Object invoke(ObjectName objName, String str, Object[] objects, String[] strings) throws InstanceNotFoundException, MBeanException, ReflectionException {
062            return super.invoke(objName, str, objects, strings);
063        }
064    }