Package org.voltdb.catalog

Examples of org.voltdb.catalog.Catalog


     * Loads a serialized catalog specification from a jar file and creates a
     * new CatalogContext object from it
     * @param jar_path
     */
    public static CatalogContext loadCatalogContextFromJar(File jar_path) {
        Catalog catalog = CatalogUtil.loadCatalogFromJar(jar_path);
        return new CatalogContext(catalog, jar_path);
    }
View Full Code Here


        if (!jar_path.exists()) {
            LOG.error("The catalog jar file '" + jar_path + "' does not exist");
            return (null);
        }
       
        Catalog catalog = null;
        String serializedCatalog = null;
        try {
            serializedCatalog = JarReader.readFileFromJarfile(jar_path.getAbsolutePath(), CatalogUtil.CATALOG_FILENAME);
        } catch (Exception ex) {
            ex.printStackTrace();
            return (null);
        }
        if (serializedCatalog == null) {
            LOG.warn("The catalog file '" + CatalogUtil.CATALOG_FILENAME + "' in jar file '" + jar_path + "' is null");
        } else if (serializedCatalog.isEmpty()) {
            LOG.warn("The catalog file '" + CatalogUtil.CATALOG_FILENAME + "' in jar file '" + jar_path + "' is empty");
        } else {
            catalog = new Catalog();
            if (debug.val)
                LOG.debug("Extracted file '" + CatalogUtil.CATALOG_FILENAME + "' from jar file '" + jar_path + "'");
            catalog.execute(serializedCatalog);
        }
        return (catalog);
    }
View Full Code Here

     *
     * @param jar_path
     * @return
     */
    public static Catalog loadCatalog(String path) {
        Catalog catalog = null;
        String serializedCatalog = null;
        try {
            serializedCatalog = FileUtil.readFile(path);
        } catch (Exception ex) {
            ex.printStackTrace();
            return (null);
        }
        if (serializedCatalog == null) {
            LOG.warn("The catalog file '" + CatalogUtil.CATALOG_FILENAME + "' in file '" + path + "' is null");
        } else if (serializedCatalog.isEmpty()) {
            LOG.warn("The catalog file '" + CatalogUtil.CATALOG_FILENAME + "' in file '" + path + "' is empty");
        } else {
            catalog = new Catalog();
            LOG.debug("Executing catalog from file '" + path + "'");
            catalog.execute(serializedCatalog);
        }
        return (catalog);
    }
View Full Code Here

     */
    public static Cluster getCluster(CatalogType catalog_item) {
        assert (catalog_item != null) : "Null Catalog Item!";
        if (catalog_item instanceof Cluster)
            return ((Cluster) catalog_item);
        Catalog catalog = catalog_item.getCatalog();
        assert (catalog != null) : catalog_item + " is missing its catalog?";
        return (catalog.getClusters().get(DEFAULT_CLUSTER_NAME));
    }
View Full Code Here

        IOFileFilter filter = new IOFileFilter("Catalog File", "txt");
        Pair<Catalog, String> ret = null;
        try {
            String path = showLoadDialog("Open Catalog File", ".", filter);
            if (path != null) {
                Catalog new_catalog = CatalogUtil.loadCatalog(path);
                ret = new Pair<Catalog, String>(new_catalog, path);
            }
        } catch (Exception ex) {
            ex.printStackTrace();
            showErrorDialog("Failed to open catalog from file", ex.getMessage());
View Full Code Here

        return (buffer.toString());

    }

    public Catalog createCatalog() throws Exception {
        Catalog new_catalog = new Catalog();
        new_catalog.execute(this.catalog_db.getCatalog().serialize());
        Database new_catalog_db = new_catalog.getClusters().get(this.catalog_db.getParent().getName()).getDatabases().get(this.catalog_db.getName());

        //
        // First apply the partitioning plan to all the tables
        //
        for (Table catalog_tbl : this.plan.getTableEntries().keySet()) {
View Full Code Here

                assert(status) : "Failed to compile " + catalogJar;
            } catch (Exception ex) {
                throw new RuntimeException("Failed to create " + projectBuilder.getProjectName() + " catalog [" + catalogJar + "]", ex);
            }
   
            Catalog c = new Catalog();
            try {
                // read in the catalog
                String serializedCatalog = JarReader.readFileFromJarfile(catalogJar, CatalogUtil.CATALOG_FILENAME);
                // create the catalog (that will be passed to the ClientInterface
                c.execute(serializedCatalog);
            } catch (Exception ex) {
                throw new RuntimeException("Failed to load " + projectBuilder.getProjectName() + " catalog [" + catalogJar + "]", ex);
            }
           
            CatalogContext cc = new CatalogContext(c, catalogJar);
View Full Code Here

                    LOG.debug("MISSING JAR: " + jar_path.getAbsolutePath());
                }
            }
            if (cc == null) {
                File jarPath = projectBuilder.getJarPath(true);
                Catalog c = null;
                switch (type) {
                    case TPCE:
                        c = projectBuilder.createCatalog(fkeys, full_catalog);
                        break;
                    default:
View Full Code Here

            ClusterConfiguration cc = new ClusterConfiguration();
            for (Integer i = 0; i < num_partitions; i++) {
                cc.addPartition("localhost", 0, i);
                // System.err.println("[" + i + "] " + Arrays.toString(triplets.lastElement()));
            } // FOR
            Catalog c = FixCatalog.cloneCatalog(catalog, cc);
            this.init(this.last_type, new CatalogContext(c, catalogContext.jarPath));
           
        }
        Cluster cluster = CatalogUtil.getCluster(catalog_db);
        assertEquals(num_partitions, cluster.getNum_partitions());
View Full Code Here

            catalogContext.numberOfSites != (num_hosts * num_sites) ||
            catalogContext.numberOfPartitions != (num_hosts * num_sites * num_partitions)) {
           
            // HACK
            String hostFormat = (num_hosts == 1 ? "localhost" : "host%02d");
            Catalog c = FixCatalog.cloneCatalog(catalog, hostFormat, num_hosts, num_sites, num_partitions);
            CatalogContext cc = new CatalogContext(c, catalogContext.jarPath);
            this.init(this.last_type, cc);
        }
        Cluster cluster = catalogContext.cluster;
        assertEquals(num_hosts, catalogContext.numberOfHosts);
View Full Code Here

TOP

Related Classes of org.voltdb.catalog.Catalog

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.