Package org.voltdb.catalog

Examples of org.voltdb.catalog.CatalogType


    @SuppressWarnings("unchecked")
    private static <T extends CatalogType> void createKey(T catalog_item, JSONStringer stringer) throws JSONException {
        assert (catalog_item.getParent() != null) : catalog_item + " has null parent";

        stringer.object();
        CatalogType parent = catalog_item.getParent();
        String key = null;

        // SPECIAL CASE: StmtParameter
        // Since there may be Statement's with the same name but in different
        // Procedures,
        // we also want to include the Procedure name
        if (catalog_item instanceof StmtParameter) {
            assert (parent.getParent() != null);
            key = parent.getParent().getName() + PARENT_DELIMITER + parent.getName();

            // SPECIAL CASE: MultiAttributeCatalogType
        } else if (catalog_item instanceof MultiAttributeCatalogType) {
            MultiAttributeCatalogType multicatalog = (MultiAttributeCatalogType) catalog_item;
            key = parent.getName() + MULTIATTRIBUTE_DELIMITER + multicatalog.getPrefix();
        } else {
            key = parent.getName();
        }
        assert (key.isEmpty() == false);
        stringer.key(key);

        // SPECIAL CASE: MultiAttributeCatalogType
View Full Code Here


    @SuppressWarnings("unchecked")
    private static <T extends CatalogType> T getFromKey(Database catalog_db, JSONObject jsonObject, Class<T> catalog_class) throws JSONException {
        if (debug.val)
            LOG.debug("Retrieving catalog key for " + jsonObject);
        T catalog_child = null;
        CatalogType catalog_parent = null;

        String parent_key = CollectionUtil.first(jsonObject.keys());
        String orig_parent_key = parent_key;
        String multiattribute_key = null;
        String child_key = jsonObject.getString(parent_key);
View Full Code Here

            super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
            if (value instanceof DefaultMutableTreeNode) {
                DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
                Object obj = node.getUserObject();
                if (obj instanceof WrapperNode) {
                    CatalogType catalog_obj = ((WrapperNode)node.getUserObject()).getCatalogType();
                    this.setFont(this.getFont().deriveFont(Font.BOLD));
                   
                    //
                    // Cluster
                    //
View Full Code Here

            Object user_obj = node.getUserObject();
            String new_header = null;
            String new_text = null;
            boolean text_mode = true;
            if (user_obj instanceof WrapperNode) {
                CatalogType catalog_obj  = ((WrapperNode)user_obj).getCatalogType();
                new_text = CatalogViewer.this.attributeText.getAttributesText(catalog_obj);
            }
            else if (user_obj instanceof AttributesNode) {
                AttributesNode wrapper = (AttributesNode)user_obj;
                new_text = wrapper.getAttributes();
View Full Code Here

    }

    public static CatalogPair factory(CatalogType element0, CatalogType element1, ExpressionType comparison_exp, QueryType... query_types) {
        // Sort them!
        if (element0.compareTo(element1) > 0) {
            CatalogType temp = element0;
            element0 = element1;
            element1 = temp;
        }
        return (new CatalogPair(element0, element1, comparison_exp, query_types));
    }
View Full Code Here

            return (ret);
        if (catalog_item == null)
            return (null);
        assert (catalog_item.getParent() != null) : catalog_item + " has null parent";

        CatalogType parent = catalog_item.getParent();
        ret = parent.getName() + PARENT_DELIMITER;

        // Special Case: MultiAttributeCatalogType
        if (catalog_item instanceof MultiAttributeCatalogType) {
            MultiAttributeCatalogType multicatalog = (MultiAttributeCatalogType) catalog_item;
            ret += multicatalog.getPrefix();
            for (Object sub_item : multicatalog) {
                ret += MULTIATTRIBUTE_DELIMITER + ((CatalogType) sub_item).getName();
            } // FOR
        } else {
            ret += catalog_item.getName();

            // Special Case: StmtParameter
            // Since there may be Statement's with the same name but in
            // different Procedures,
            // we also want to include the Procedure name
            if (catalog_item instanceof StmtParameter) {
                assert (parent.getParent() != null);
                ret = parent.getParent().getName() + PARENT_DELIMITER + ret;
            }
        }
        CACHE_CREATEKEY.put(catalog_item, ret);
        return (ret);
    }
View Full Code Here

            cache = new HashMap<String, CatalogType>();
            CatalogKeyOldVersion.CACHE_GETFROMKEY.put(catalog_db, cache);
        }

        T catalog_child = null;
        CatalogType catalog_parent = null;
        int idx = key.indexOf(PARENT_DELIMITER);
        assert (idx != -1) : "Invalid CatalogKeyOldVersion format '" + key + "'";
        String parent_key = key.substring(0, idx);
        String child_key = key.substring(idx + 1);
View Full Code Here

        for (CatalogPair cp : cset) {
            if (cp.getComparisonExp() != ExpressionType.COMPARE_EQUAL) {
                return (false);
            }
           
            CatalogType ctypes[] = { cp.getFirst(), cp.getSecond() };
            for (int i = 0; i < ctypes.length; i++) {
                if (ctypes[i] instanceof Column) {
                    Column target_col = (Column)ctypes[i];
                    Table target_tbl = target_col.getParent();
View Full Code Here

                        new ExpressionTreeWalker() {
                            @Override
                            protected void callback(AbstractExpression exp) {
                                if (!(exp instanceof AbstractValueExpression))
                                    return;
                                CatalogType element = null;
                                switch (exp.getExpressionType()) {
                                    case VALUE_PARAMETER: {
                                        int param_idx = ((ParameterValueExpression) exp).getParameterId();
                                        element = catalog_stmt.getParameters().get(param_idx);
                                        if (element == null) {
                                            LOG.warn("ERROR: Unable to find Parameter object in catalog [" + ((ParameterValueExpression) exp).getParameterId() + "]");
                                            this.stop();
                                        }
                                        // We want to use the ProcParameter instead of the StmtParameter
                                        // It's not an error if the StmtParameter is not mapped to a
                                        // ProcParameter
                                        if (convert_params && ((StmtParameter) element).getProcparameter() != null) {
                                            LOG.debug(element + "(" + element + ") --> ProcParameter[" + element.getField("procparameter") + "]");
                                            element = ((StmtParameter) element).getProcparameter();
                                        }
                                        break;
                                    }
                                    case VALUE_TUPLE_ADDRESS:
View Full Code Here

            /**
             * @param exp
             */
            private void processValueExpression(AbstractExpression exp) {
                CatalogType element = null;
                switch (exp.getExpressionType()) {
                    case VALUE_TUPLE: {
                        String table_name = ((TupleValueExpression) exp).getTableName();
                        String column_name = ((TupleValueExpression) exp).getColumnName();
                        if (debug.val)
View Full Code Here

TOP

Related Classes of org.voltdb.catalog.CatalogType

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.