Examples of DcwRecordFile


Examples of com.bbn.openmap.layer.vpf.DcwRecordFile

        String s = e.getRequest();
        System.out.println(s);
        Document d = new Document(s);
        d.addElement(new HeaderElement(1, s));
        try {
            DcwRecordFile f = new DcwRecordFile(s);
            d.addElement(new HeaderElement(3, "Table Description Schema"));
            d.addElement(new StringElement("<table border>"));
            DcwColumnInfo dci[] = f.getColumnInfo();
            TableRowElement t = new TableRowElement();
            d.addElement(t);
            t.addElement(new TableHeaderElement("Column Name"));
            t.addElement(new TableHeaderElement("Field Type"));
            t.addElement(new TableHeaderElement("Number Of Elements"));
            t.addElement(new TableHeaderElement("Key Type"));
            t.addElement(new TableHeaderElement("Column Description"));
            t.addElement(new TableHeaderElement("Value Description Table"));
            t.addElement(new TableHeaderElement("Thematic Index Name"));
            t.addElement(new TableHeaderElement("Narrative Table"));
            TableRowElement rw = new TableRowElement();
            for (int i = 0; i < dci.length; i++) {
                TableRowElement row = new TableRowElement();
                d.addElement(row);
                row.addElement(dci[i].getColumnName());
                char munge[] = dci[i].getColumnName().toCharArray();
                for (int j = 0; j < munge.length; j++)
                    if (munge[j] == '_')
                        munge[j] = ' ';
                rw.addElement(new TableHeaderElement(new String(munge)));
                row.addElement(new Character(dci[i].getFieldType()).toString());
                row.addElement(Integer.toString(dci[i].getNumberOfElements()));
                row.addElement(new Character(dci[i].getKeyType()).toString());
                row.addElement(dci[i].getColumnDescription());
                row.addElement(dci[i].getValueDescriptionTable());
                row.addElement(dci[i].getThematicIndexName());
                row.addElement(dci[i].getNarrativeTable());
            }
            d.addElement(new StringElement("</table>"));
            d.addElement(new HeaderElement(3, "Table Data"));
            d.addElement(new StringElement("<table border>"));
            d.addElement(rw);
            List colhdr;
            while ((colhdr = f.parseRow()) != null) {
                d.addElement(listAsTableRow(colhdr));
            }
            d.addElement(new StringElement("</table>"));
            f.close();
        } catch (com.bbn.openmap.io.FormatException f) {
            d.addElement(new StringElement(f.getMessage()));
        }
        d.generate(e.getWriter());
    }
View Full Code Here

Examples of com.bbn.openmap.layer.vpf.DcwRecordFile

        }
        try {
            HtmlListElement flist = new HtmlListElement("Feature Types (from "
                    + fcsURL + ")");
            boolean generateflist = false;
            DcwRecordFile fcs = new DcwRecordFile(ct.getDataPath()
                    + File.separator + "fcs" + (ct.appendDot ? "." : ""));
            int featureClassColumn = fcs.whatColumn("feature_class");
            int table1Column = fcs.whatColumn("table1");
//            int table1_keyColumn = fcs.whatColumn("table1_key");
//            int table2Column = fcs.whatColumn("table2");
//            int table2_keyColumn = fcs.whatColumn("table2_key");

            List fcsl = new ArrayList(fcs.getColumnCount());
            while (fcs.parseRow(fcsl)) {
                String featureclass = ((String) fcsl.get(featureClassColumn)).toLowerCase();
                String table1 = ((String) fcsl.get(table1Column)).toLowerCase();
                if (!ftypeinfo.containsKey(featureclass)) {
                    ftypeinfo.put(featureclass, null);
                    String type = null;
                    if (table1.endsWith(".cft")) {
                        type = "complex feature";
                    } else if (table1.endsWith(".pft")) {
                        type = "point feature";
                    } else if (table1.endsWith(".lft")) {
                        type = "line feature";
                    } else if (table1.endsWith(".aft")) {
                        type = "area feature";
                    } else if (table1.endsWith(".tft")) {
                        type = "text feature";
                    }
                    if (type != null) {
                        generateflist = true;
                        flist.addElement(type
                                + " "
                                + buildURL(request,
                                        response,
                                        pathPrefix,
                                        table1,
                                        featureclass));
                    }
                }
            }
            if (generateflist) {
                list.addElement(flist);
            }
            fcs.close();
        } catch (FormatException fe) {
            list.addElement("no fcs");
        }
        list.generate(out);
    }
View Full Code Here

Examples of com.bbn.openmap.layer.vpf.DcwRecordFile

        theColumn = table.whatColumn(joinColumnName);
        tileColumn = table.whatColumn(FeatureClassInfo.TILE_ID_COLUMN_NAME);
        if (isTiled) {
            throw new FormatException("can't complex join with tiling (yet)");
        }
        joinTable = new DcwRecordFile(new File(table.getTableFile()).getParentFile()
                + File.separator + tableName);
        keyMap = getKeyMap(tableKeyColumn);
    }
View Full Code Here

Examples of com.bbn.openmap.layer.vpf.DcwRecordFile

        try {
            boolean color1 = false;
            int i = 0;
            for (Iterator li = l.iterator(); li.hasNext(); ) {
                Object o = li.next();
                DcwRecordFile featureTable = featureTables[i++];
                if ((featureTable != null) &&
                    featureTable.getRow(featureRow, VPFUtil.objectToInt(o))) {
                    color1 = !color1;
                    for (Iterator fi = featureRow.iterator(); fi.hasNext(); ) {
                        row.addElement(new TableDataElement(color1 ? "CLASS=JoinColumn" : "CLASS=Join2Column",
                                                            fi.next().toString()));
                    }
View Full Code Here

Examples of com.bbn.openmap.layer.vpf.DcwRecordFile

        File dirPath = new File(drf.getTableFile()).getParentFile();
        File fcsfile = new File(dirPath, "fcs");
        if (!fcsfile.canRead()) {
            fcsfile = new File(dirPath, "fcs.");
        }
        DcwRecordFile fcs = new DcwRecordFile(fcsfile.toString());
        List l = new ArrayList(fcs.getColumnCount());
        String tableName = drf.getTableName();

        int table1Column = fcs.whatColumn("table1");
        int table1_keyColumn = fcs.whatColumn("table1_key");
        int table2Column = fcs.whatColumn("table2");
        int table2_keyColumn = fcs.whatColumn("table2_key");

        while (fcs.parseRow(l)) {
            String table1 = (String)l.get(table1Column);
            String table1_key = (String)l.get(table1_keyColumn);
            String table2 = (String)l.get(table2Column);
            String table2_key = (String)l.get(table2_keyColumn);
            if (table1.equalsIgnoreCase(tableName) &&
                table2_key.equalsIgnoreCase("id")) {
                int indexCol = drf.whatColumn(table1_key);
                retval[indexCol] = new DcwRecordFile(dirPath + File.separator + table2);
            }
        }

        fcs.close();
        return retval;
    }
View Full Code Here

Examples of com.bbn.openmap.layer.vpf.DcwRecordFile

        return retval;
    }

    public void close() {
        for (int i = 0; i < featureTables.length; i++) {
            DcwRecordFile drf = featureTables[i];
            if (drf != null) {
                drf.close();
            }
        }
    }
View Full Code Here

Examples of com.bbn.openmap.layer.vpf.DcwRecordFile

    }

    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        DcwRecordFile foo = (DcwRecordFile) request.getAttribute(DispatchServlet.RECORD_FILE_OBJ);
        if (foo == null) {
            response.sendError(HttpServletResponse.SC_BAD_REQUEST);
            return;
        }
        try {
View Full Code Here

Examples of com.bbn.openmap.layer.vpf.DcwRecordFile

            if ((file == null) && (table != null)) {
                table.close();
                table = null;
            }
            if (file != null) {
                table = new DcwRecordFile(file);
            }
        } catch (FormatException fe) {
        }
    }
View Full Code Here

Examples of com.bbn.openmap.layer.vpf.DcwRecordFile

    }

    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {

        DcwRecordFile foo = (DcwRecordFile) request.getAttribute(DispatchServlet.RECORD_FILE_OBJ);
        if (foo == null) {
            response.sendError(HttpServletResponse.SC_BAD_REQUEST);
            return;
        }
        String basepath = getRootDir(request);
        String url = response.encodeURL(request.getContextPath()
                + "/VPFHelp.jsp?topic=table_schema");
        PrintWriter out = response.getWriter();
        out.println("<H2>Table Schema</H2>");
        out.println("<H3>General Table Information</H3>");
        HtmlListElement list = new HtmlListElement();
        list.addElement("Table Name: " + foo.getTableName());
        list.addElement("Table Description: " + foo.getDescription());
        list.addElement("DocFile Name: "
                + fileURL(request,
                        response,
                        basepath,
                        foo.getDocumentationFilename()));
        int reclen = foo.getRecordLength();
        String reclenstr = (reclen == -1) ? ("variable")
                : (Integer.toString(reclen) + " bytes");
        list.addElement("Record Length: " + reclenstr);
        try {
            list.addElement("Record Count: " + foo.getRecordCount());
        } catch (com.bbn.openmap.io.FormatException fe) {
            list.addElement("Record Count Error: " + fe.toString());
        }
        list.generate(out);

        // out.println("<br><H3>Column Schema</H3>");
        ListElement rows = new ListElement();
        WrapElement table = new WrapElement("table", "BORDER=1", rows);
        TableRowElement thr = new TableRowElement();
        rows.addElement(new WrapElement("CAPTION", new StringElement("Column Schema")));
        rows.addElement(thr);
        thr.addElement(THE("#", url));
        thr.addElement(THE("Name", url));
        thr.addElement(THE("Type", url));
        thr.addElement(THE("Count", url));
        thr.addElement(THE("Key Type", url));
        thr.addElement(THE("Description", url));
        thr.addElement(THE("VDT", url));
        thr.addElement(THE("Thematic Index", url));
        thr.addElement(THE("DocFile", url));
        DcwColumnInfo dci[] = foo.getColumnInfo();
        for (int i = 0; i < dci.length; i++) {
            TableRowElement tr = new TableRowElement();
            rows.addElement(tr);
            tr.addElement(Integer.toString(i));
            tr.addElement(dci[i].getColumnName());
View Full Code Here

Examples of com.bbn.openmap.layer.vpf.DcwRecordFile

     * @return the feature table
     * @throws FormatException the feature table couldn't be created
     */
    public DcwRecordFile getFeatureTable(int fcId) throws FormatException {
        fcId -= 1; // array is 0-based, table ids are 1-based
        DcwRecordFile retval = featureTables[fcId];
        if (retval == null) {
            retval = new DcwRecordFile(dirPath + File.separator
                    + featureNames[fcId].toLowerCase() + featureTableExt);
            featureTables[fcId] = retval;
        }
        return retval;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.