Package org.rioproject.opstring

Examples of org.rioproject.opstring.OperationalStringManager


     * @see org.rioproject.monitor.DeployAdmin#getOperationalStringManager
     */
    public OperationalStringManager getOperationalStringManager(String name) throws OperationalStringException {
        if(name==null)
            throw new IllegalArgumentException("name is null");
        OperationalStringManager opStringManager = null;
        OpStringManager opMgr = opStringMangerController.getOpStringManager(name);
        if(opMgr!=null && opMgr.isActive()) {
            opStringManager = opMgr.getProxy();
        } else  {
            try {
                DeployAdmin dAdmin = opStringMangerController.getPrimaryDeployAdmin(name);
                if(dAdmin!=null) {
                    OperationalStringManager mgr = dAdmin.getOperationalStringManager(name);
                    if(mgr.isManaging()) {
                        opStringManager = mgr;
                    }
                }
            } catch(RemoteException e) {
                    logger.debug("Communicating to peer during getOperationalStringManager for {}", name, e);
View Full Code Here


                OpStringManager manager = opStringMangerController.addOperationalString(opString, map, null, null, listener);
                deploymentResult = new DeploymentResult(manager.getOperationalStringManager(), map);
            } else {
                if(logger.isInfoEnabled())
                    logger.info("Operational String [{}] already deployed", opString.getName());
                OperationalStringManager manager = opStringMangerController.getOpStringManager(opString.getName()).getOperationalStringManager();
                deploymentResult = new DeploymentResult(manager, null);
            }
        } catch(Exception e) {
            logger.warn("Deploying OperationalString [{}]", opString.getName(), e);
            if(!(e instanceof OperationalStringException))
View Full Code Here

        logger.trace("OpStringManager: {}", opMgr);
        if(opMgr == null || (!opMgr.isActive())) {
            try {
                DeployAdmin dAdmin = opStringMangerController.getPrimaryDeployAdmin(opStringName);
                if(dAdmin!=null) {
                    OperationalStringManager mgr = dAdmin.getOperationalStringManager(opStringName);
                    if(mgr.isManaging()) {
                        dAdmin.undeploy(name);
                        undeployed = true;
                    }
                }
            } catch(RemoteException e) {
View Full Code Here

     * @param name The name of an OperationalString
     *
     * @return The primary OperationalStringManager if found, or null if not
     */
    public OperationalStringManager getPrimary(final String name) {
        OperationalStringManager mgr = null;
        ProvisionMonitor[] monitors = provisionMonitorPeer.getProvisionMonitorPeers();
        for (ProvisionMonitor monitor : monitors) {
            try {
                DeployAdmin dAdmin = (DeployAdmin) monitor.getAdmin();
                OperationalStringManager[] mgrs =
View Full Code Here

        for (ProvisionMonitor.PeerInfo peer : peers) {
            ProvisionMonitor peerMon = peer.getService();
            try {
                DeployAdmin dAdmin = (DeployAdmin) peerMon.getAdmin();
                if(dAdmin.hasDeployed(opStringName)) {
                    OperationalStringManager mgr = dAdmin.getOperationalStringManager(opStringName);
                    if (mgr.isManaging()) {
                        primary = dAdmin;
                        break;
                    }
                }
            } catch (RemoteException e) {
View Full Code Here

                    return null;
                }
                Map<String, Throwable> errorMap = ((DefaultOpStringManager)opMgr).init(active, serviceProvisioner, uuid, listener);

                if(dAdmin!=null) {
                    OperationalStringManager activeMgr;
                    Map<ServiceElement, ServiceBeanInstance[]> elemInstanceMap = new HashMap<ServiceElement, ServiceBeanInstance[]>();
                    try {
                        activeMgr = dAdmin.getOperationalStringManager(opString.getName());
                        ServiceElement[] elems = opString.getServices();
                        for (ServiceElement elem : elems) {
                            try {
                                ServiceBeanInstance[] instances = activeMgr.getServiceBeanInstances(elem);
                                elemInstanceMap.put(elem, instances);
                            } catch (Exception e) {
                                logger.warn("Getting ServiceBeanInstances from active testManager", e);
                            }
                        }
View Full Code Here

    void updateOpString(final ProvisionMonitor monitor, final OperationalString opString) {
        synchronized(vis) {
            vis.cancel("filter");
            GraphNode opStringNode = getOpStringNode(opString.getName());
            if(opStringNode!=null) {
                OperationalStringManager mgr;
                try {
                    mgr = Util.getOperationalStringManager(monitor,
                                                           opString.getName());
                } catch (Exception e) {
                    Util.showError(e, frame,
                                   "Could not get an OperationalStringManager");
                    GraphUtil.removeOpString(g, vis, opString.getName());
                    vis.run("filter");
                    return;
                }
                opStringNode.setOpString(opString);
                opStringNode.setProvisionMonitor(monitor);
                ServiceElement[] services = opString.getServices();

                // TODO: If there are existing ServiceEements that are no longer
                // in the opstring they need to be removed

                for(ServiceElement service : services) {
                    GraphNode sElemNode = getServiceElementNode(opStringNode,
                                                                service);
                    if(sElemNode!=null) {
                        sElemNode.setServiceElement(service);
                        sElemNode.setProvisionMonitor(monitor);
                        Node serviceNode = sElemNode.getTableNode();

                        /* Fetch the known ServiceBeanInstances */
                        ServiceBeanInstance[] instances =
                            new ServiceBeanInstance[0];
                        try {
                            instances = mgr.getServiceBeanInstances(service);
                        } catch (Exception e) {
                            Util.showError(e, frame,
                                           "Fetching ServiceBean Instances");
                        }

View Full Code Here

    public void testFork() {
        Assert.assertNotNull(testManager);
        Assert.assertNotNull(cybernode);
        Throwable thrown = null;
        try {
            OperationalStringManager mgr = testManager.getOperationalStringManager();
            Assert.assertNotNull("Expected non-null OperationalStringManager", mgr);
            OperationalString opstring = mgr.getOperationalString();
            Assert.assertNotNull(opstring);
            Assert.assertEquals(1, opstring.getServices().length);
            ServiceElement elem = opstring.getServices()[0];
            Assert.assertNotNull("Expected a non-null ExecDescriptor", elem.getExecDescriptor());
            testManager.waitForDeployment(mgr);
View Full Code Here

                                 "test"+File.separator+
                                 "resources"+File.separator+
                                 "opstring"+File.separator+
                                 "logging_simple_forked_opstring.groovy");
        Assert.assertNotNull(opstring);
        OperationalStringManager mgr = testManager.deploy(opstring);
        testManager.waitForDeployment(mgr);
        Simple simple = (Simple)testManager.waitForService(Simple.class, "Simple Logging Forked Simon");
        Assert.assertNotNull(simple);

        Entry[] attrs = new Entry[]{ServiceLogEvent.getEventDescriptor()};
View Full Code Here

    @Test
    public void testDeployMap1() throws RemoteException {
        Assert.assertNotNull(testManager);
        Cybernode cybernode = (Cybernode)testManager.waitForService(Cybernode.class);
        Assert.assertNotNull(cybernode);
        OperationalStringManager mgr = testManager.getOperationalStringManager();
        testManager.waitForDeployment(mgr);

        DeploymentMap dMap = mgr.getDeploymentMap();
        Assert.assertEquals(1, dMap.getServiceElements().length);
        ServiceElement elem = dMap.getServiceElements()[0];
        List<DeployedService> list = dMap.getDeployedServices(elem);
        Assert.assertEquals(1, list.size());
        DeployedService deployed =  list.get(0);
        Assert.assertNotNull(deployed);

        testManager.undeploy(mgr.getOperationalString().getName());

    }
View Full Code Here

TOP

Related Classes of org.rioproject.opstring.OperationalStringManager

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.