Package org.apache.ode.store

Examples of org.apache.ode.store.DeploymentUnitDAO


    public void testCreateDU() {
        ConfStoreConnection conn = cf.getConnection();
        conn.begin();
        try {
            DeploymentUnitDAO du = conn.createDeploymentUnit("foo");
            assertNotNull(du);
            assertEquals("foo", du.getName());
            assertNotNull(du.getDeployDate());
        } finally {
            conn.commit();
            conn.close();
        }

        conn = cf.getConnection();
        conn.begin();
        try {
            DeploymentUnitDAO du = conn.getDeploymentUnit("foo");
            assertNotNull(du);
            assertEquals("foo", du.getName());
        } finally {
            conn.commit();
        }

    }
View Full Code Here


    public void testRollback() {
        ConfStoreConnection conn = cf.getConnection();
        conn.begin();
        try {
            DeploymentUnitDAO du = conn.createDeploymentUnit("foo");
            assertNotNull(du);
            assertEquals("foo", du.getName());
            assertNotNull(du.getDeployDate());
        } finally {
            conn.rollback();
            conn.close();
        }

        conn = cf.getConnection();
        conn.begin();
        try {
            DeploymentUnitDAO du = conn.getDeploymentUnit("foo");
            assertNull(du);
        } finally {
            conn.commit();
        }
View Full Code Here

    public void testCreateProcess() {
        QName foobar = new QName("foo","bar");
        ConfStoreConnection conn = cf.getConnection();
        conn.begin();
        try {
            DeploymentUnitDAO du = conn.createDeploymentUnit("foo1");
            ProcessConfDAO p = du.createProcess(foobar,foobar,1);
            assertEquals(foobar,p.getPID());
            assertEquals(foobar,p.getType());
            assertNotNull(p.getDeploymentUnit());
            assertEquals("foo1", p.getDeploymentUnit().getName());
        } finally {
            conn.commit();
            conn.close();
        }
       
        conn = cf.getConnection();
        conn.begin();
        try {
            DeploymentUnitDAO du = conn.getDeploymentUnit("foo1");
            ProcessConfDAO p = du.getProcess(foobar);
            assertNotNull(p);
            assertNotNull(du.getProcesses());
           
            assertEquals(foobar,p.getPID());
            assertEquals(foobar,p.getType());

        } finally {
View Full Code Here

    public void testProcessProperties() {
        QName foobar = new QName("foo","bar");
        ConfStoreConnection conn = cf.getConnection();
        conn.begin();
        try {
            DeploymentUnitDAO du = conn.createDeploymentUnit("foo1");
            ProcessConfDAO p = du.createProcess(foobar,foobar,1);
            p.setProperty(foobar,"baz");
        } finally {
            conn.commit();
            conn.close();
        }
       
        conn = cf.getConnection();
        conn.begin();
        try {
            DeploymentUnitDAO du = conn.getDeploymentUnit("foo1");
            ProcessConfDAO p = du.getProcess(foobar);
            assertNotNull(p.getProperty(foobar));
            assertEquals("baz", p.getProperty(foobar));
            assertNotNull(p.getPropertyNames());
            assertTrue(p.getPropertyNames().contains(foobar));
        } finally {
View Full Code Here

        }

    }

    private void loadExistingBPELPackage(String bpelPackageName) {
        DeploymentUnitDAO duDAO = parentProcessStore.getDeploymentUnitDAO(bpelPackageName);
        if (duDAO == null) {
            String errMsg = "Cannot find DeploymentUnitDAO instance for package "
                    + bpelPackageName + ".";
            log.error(errMsg);
            throw new BPELDeploymentException(errMsg);
        }
        File bpelPackage = findBPELPackageInFileSystem(duDAO);
        if (bpelPackage == null || !bpelPackage.exists()) {
            throw new BPELDeploymentException("Deployed directory " +
                    (bpelPackage == null ? "(unknown)" : bpelPackage) + " no longer there!");
        }

        DeploymentUnitDir du = new DeploymentUnitDir(bpelPackage);
        du.setVersion(du.getStaticVersion());
        du.scan();

        List<ProcessConfigurationImpl> loaded = new ArrayList<ProcessConfigurationImpl>();
        List<QName> processIds = new ArrayList<QName>();

        for (ProcessConfDAO pConfDAO : duDAO.getProcesses()) {
            TDeployment.Process processDD = du.getProcessDeployInfo(pConfDAO.getType());
            if (processDD == null) {
                log.warn("Cannot load " + pConfDAO.getPID() + "; cannot find descriptor.");
                continue;
            }

            // TODO: update the props based on the values in the DB.

            ProcessConfigurationImpl pConf = new ProcessConfigurationImpl(
                    tenantId,
                    processDD,
                    du,
                    duDAO.getDeployDate(),
                    parentProcessStore.getEndpointReferenceContext(),
                    tenantConfigContext);
            pConf.setState(pConfDAO.getState());
            processIds.add(pConfDAO.getPID());
            processes.put(pConf.getProcessId(), pConf);
View Full Code Here

            processToTenantMap.put(pid, tenantId);
        }
    }

    public DeploymentUnitDAO getDeploymentUnitDAO(final String bpelPackageName) {
        DeploymentUnitDAO duDAO = exec(new Callable<DeploymentUnitDAO>() {
            @Override
            public DeploymentUnitDAO call(ConfStoreConnection conn) {
                return conn.getDeploymentUnit(bpelPackageName);
            }
        });
View Full Code Here

                                        final String duLocation,
                                        final List<ProcessConfigurationImpl> processConfs) {
        boolean status = exec(new Callable<Boolean>() {
            @Override
            public Boolean call(ConfStoreConnection conn) {
                DeploymentUnitDAO duDao = conn.getDeploymentUnit(duName);
                if (duDao != null) {
                    /*
                    This is for clustering scenario. update/deployment
                     */
                    return true;
                }

                duDao = conn.createDeploymentUnit(duName);
                duDao.setDeploymentUnitDir(duLocation);

                for (ProcessConf pConf : processConfs) {
                    try {
                        ProcessConfDAO processConfDao = duDao.createProcess(pConf.getProcessId(),
                                pConf.getType(),
                                pConf.getVersion());
                        processConfDao.setState(pConf.getState());
                        for (Map.Entry<QName, Node> prop : pConf.getProcessProperties().entrySet()) {
                            processConfDao.setProperty(prop.getKey(),
View Full Code Here

    public void deleteDeploymentUnitDataFromDB(final String duName) {
        try {
            exec(new Callable<Boolean>() {
                public Boolean call(ConfStoreConnection conn) {
                    DeploymentUnitDAO duDao = conn.getDeploymentUnit(duName);
                    if (duDao != null) {
                        duDao.delete();
                    }
                    return true;
                }
            });
View Full Code Here

            log.error(errMsg);
            throw new ContextException(errMsg);
        }
        exec(new Callable<Object>() {
            public Object call(ConfStoreConnection conn) {
                DeploymentUnitDAO duDao = conn.getDeploymentUnit(duName);
                if (duDao == null) {
                    return null;
                }

                ProcessConfDAO pConfDao = duDao.getProcess(pid);
                if (pConfDao == null) {
                    return null;
                }
                pConfDao.setProperty(propName, value);
                return null;
View Full Code Here

        final String duName = getDeploymentUnitForProcess(pid);
        validateDeploymentUnitForTheProcess(duName, pid);

        ProcessState old = exec(new Callable<ProcessState>() {
            public ProcessState call(ConfStoreConnection conn) {
                DeploymentUnitDAO duDao = conn.getDeploymentUnit(duName);
                if (duDao == null) {
                    String errMsg = "Deployment unit " + duName + " not found.";
                    log.error(errMsg);
                    throw new ContextException(errMsg);
                }

                ProcessConfDAO pConfDao = duDao.getProcess(pid);
                if (pConfDao == null) {
                    String errMsg = "Process " + pid + " not found in deployment unit " + duName +
                            ".";
                    log.error(errMsg);
                    throw new ContextException(errMsg);
View Full Code Here

TOP

Related Classes of org.apache.ode.store.DeploymentUnitDAO

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.