Package com.sun.mfwk

Examples of com.sun.mfwk.MfObjectFactory


     */
    CMM_MBean getMBean(String oid) throws Exception {

        CMM_MBean mbean = null;

        MfObjectFactory factory =
            MfObjectFactory.getObjectFactory(_context.getModuleName());

        // replaces tokens from object name
        String tokenizedOID=ObjectNameHelper.tokenize(oid,_context.getTokens());

        if (factory.isObjectCreated(tokenizedOID)) {
            mbean = factory.getObject(tokenizedOID);
        }
       
        return mbean;
    }
View Full Code Here


            throw new IllegalArgumentException();
        }

        CMM_MBean sourceMbean = null;

        MfObjectFactory objectFactory =
            MfObjectFactory.getObjectFactory(_context.getModuleName());

        // delegate factory
        if (map == null) {
            map = new Hashtable();
        }
        String mbeanName = CMM_MbeanDescriptor.getAttribute("name").trim();
        map.put(mbeanName, DefaultDelegate.class);
        MfDelegateFactory delegateFactory=objectFactory.getDelegateFactory(map);

        // mbean server connection
        MBeanServerConnection mbs = getConnection();

        // cmm object name
        String objectName = mapping.getCMM_ObjectName(CMM_MbeanDescriptor);
        String tokenizedON =
            ObjectNameHelper.tokenizeON(asON, objectName, _context.getTokens());

        DefaultDelegate delegate = null;
        if (!objectFactory.isObjectCreated(tokenizedON)) {
            sourceMbean = objectFactory.createObject(tokenizedON);

            // create delegate
            delegate = (DefaultDelegate)
                delegateFactory.createDelegate(mbs, sourceMbean, asON);

            _delegateReg.put(tokenizedON, delegate);

        } else {
            sourceMbean = objectFactory.getObject(tokenizedON);
            //delegate = (MfDelegate) delegateFactory.getDelegate(tokenizedON);
            delegate = (DefaultDelegate) _delegateReg.get(tokenizedON);
        }

        if ( (sourceMbean == null) || (delegate == null) ) {
View Full Code Here

        if (mbean == null) {
            throw new IllegalArgumentException();
        }

        MfObjectFactory objectFactory =
            MfObjectFactory.getObjectFactory(_context.getModuleName());

        Hashtable map = new Hashtable();
        String mbeanName = mbean.getAttribute("name").trim();

        try {
            String delegateClassName = mbean.getAttribute("type").trim();
            Class c = (Class) Class.forName(delegateClassName).newInstance();
            map.put(mbeanName, c);

        } catch (ClassNotFoundException cnfe) {

            LogDomains.getLogger().fine("Error: " + cnfe.getMessage()
                + ". Using default delegate class.");

            // use default delegate class
            map.put(mbeanName, DefaultDelegate.class);
        }

        // delegate factory
        MfDelegateFactory delegateFactory=objectFactory.getDelegateFactory(map);

        // jxm connection to the application server
        MBeanServerConnection mbs = getConnection();

        CMM_MBean sourceMbean = null;
        String objectName = ConfigReader.getMBeanObjectName(mbean, false);
        String tokenizedON =
            ObjectNameHelper.tokenize(objectName, _context.getTokens());

        // if cmm mbean is not created
        if (!objectFactory.isObjectCreated(tokenizedON)) {
            sourceMbean = objectFactory.createObject(tokenizedON);

            // sets up the delegate
            String proxyObjectName=ConfigReader.getMBeanObjectName(mbean, true);
            String tokenizedPON =
                ObjectNameHelper.tokenize(proxyObjectName,_context.getTokens());
View Full Code Here

        }
       
        Iterator iterator = mbeans.iterator();
        ObjectName objectName = null;
       
        MfObjectFactory mfObjectFactory =
                MfObjectFactory.getObjectFactory(_context.getModuleName());
       
        // relation mapping service
        RelationServiceImpl relationService =
                RelationServiceImpl.getRelationService();
       
        while (iterator.hasNext()) {
           
            objectName = (ObjectName) iterator.next();
           
            // remove relation for this cmm mbean
            try {
                RelationModeler rm = new RelationModeler(_context);
                rm.removeRelations(objectName.getCanonicalName());
            } catch (Exception e) {
                Utils.log(Level.INFO, "Error while deleting relation for: " + objectName, e);
            }
           
            try {
                // remove cmm mbean
                mfObjectFactory.deleteObject(objectName.toString());
            } catch (Exception exception) {
                Utils.log(Level.INFO, "Error while deleting mbean: " + objectName, exception);
            }
        }
    }
View Full Code Here

    public void start() throws Exception {
        try {
            // create domain cmm mbean
            String str = Constants.DEF_MODULE_NAME + ":type=CMM_J2eeDomain,name=" + _domainName;
            String mn = _context.getModuleName();
            MfObjectFactory fac = MfObjectFactory.getObjectFactory(mn);
            fac.createObject(str);
        } catch(Exception e) {
            Utils.log(Level.WARNING, "Error creating domain cmm mbean", e);
        }
       
        // instrument all app server mbeans and setup relations
        load();
       
        // register dynamic config listener
        ListenerManager listenerManager = ListenerManagerFactory.getListenerManager();
        try {
            ListenerImpl listener = new ListenerImpl(_serverName, _domainName);
            listenerManager.addNotificationListener(_serverName, _domainName,
                    listener, null, null);
        } catch(Exception ex) {
             Utils.log(Level.SEVERE, "Error while registering dynamic config listener", ex);
        }
       
        try {
            // create relation to the node agent objects (CMM_RunningOS)
            String mn = _context.getModuleName();
            MfObjectFactory fac = MfObjectFactory.getObjectFactory(mn);
            String tokenizedON =
                    ObjectNameHelper.tokenize(mn+JVM_PATTERN, _context.getTokens());
            CMM_MBean jvmMbean = fac.getObject(tokenizedON);
            if (jvmMbean != null) {
                MfAgentNode.createRelationsWithAgent(mn, jvmMbean);
            }
           
        } catch(Exception e) {
View Full Code Here

        }
       
        Iterator iterator = mbeans.iterator();
        ObjectName objectName = null;
       
        MfObjectFactory mfObjectFactory =
                MfObjectFactory.getObjectFactory(_context.getModuleName());
       
        // relation mapping service
        RelationServiceImpl relationService =
                RelationServiceImpl.getRelationService();
       
        while (iterator.hasNext()) {
           
            objectName = (ObjectName) iterator.next();
           
            // remove relation for this cmm mbean
            try {
                RelationModeler rm = new RelationModeler(_context);
                rm.removeRelations(objectName.getCanonicalName());
            } catch (Exception e) {
                Utils.log(Level.INFO, "Error while deleting relation for: " + objectName, e);
            }
           
            try {
                // remove cmm mbean
                mfObjectFactory.deleteObject(objectName.toString());
            } catch (Exception exception) {
                Utils.log(Level.INFO, "Error while deleting mbean: " + objectName, exception);
            }
        }
    }
View Full Code Here

    public void start() throws Exception {
        try {
            // create domain cmm mbean
            String str = Constants.DEF_MODULE_NAME + ":type=CMM_J2eeDomain,name=" + _domainName;
            String mn = _context.getModuleName();
            MfObjectFactory fac = MfObjectFactory.getObjectFactory(mn);
            fac.createObject(str);
        } catch(Exception e) {
            Utils.log(Level.WARNING, "Error creating domain cmm mbean", e);
        }
       
        // instrument all app server mbeans and setup relations
        load();
       
        // register dynamic config listener
        ListenerManager listenerManager = ListenerManagerFactory.getListenerManager();
        try {
            ListenerImpl listener = new ListenerImpl(_serverName, _domainName);
            listenerManager.addNotificationListener(_serverName, _domainName,
                    listener, null, null);
        } catch(Exception ex) {
             Utils.log(Level.SEVERE, "Error while registering dynamic config listener", ex);
        }
       
        try {
            // create relation to the node agent objects (CMM_RunningOS)
            String mn = _context.getModuleName();
            MfObjectFactory fac = MfObjectFactory.getObjectFactory(mn);
            String tokenizedON =
                    ObjectNameHelper.tokenize(mn+JVM_PATTERN, _context.getTokens());
            CMM_MBean jvmMbean = fac.getObject(tokenizedON);
            if (jvmMbean != null) {
                MfAgentNode.createRelationsWithAgent(mn, jvmMbean);
            }
           
        } catch(Exception e) {
View Full Code Here

TOP

Related Classes of com.sun.mfwk.MfObjectFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.