Package com.intersys.gds

Examples of com.intersys.gds.Document


    Connection connection = new Connection();
    connection.connect();
   
    //2. Generate test data
    List<Document> worldJugs = new ArrayList<Document>();
    Document jug = null;
    Document location = null;
    for(int i=0; i<documentCount ; i++){
      jug = new Document();
      jug.put("jugVisit-" + i, new String("Date: " + Calendar.getInstance().getTime()));
      location = new Document();
      location.put("country", "(Axis-Of-Evil) - " + i);
      location.put("venue", "Hotel-" + i*3);
      jug.put("location", location);
      worldJugs.add(jug);
    }
    //3 TODO: Without schema you will get nulls instead of Exceptions.  Add exception/error notification.
    Document firstJUG = worldJugs.get(0);
    DocumentType jugType = DocumentType.createDocumentType("WorldJUGs", firstJUG);
    jugType.setReference("location", ElementType.TYPE_REFERENCE, "Location", "country");
    connection.saveDocumentType(jugType);
   
    Document jugLocation = (Document) firstJUG.get("location");
    DocumentType locationType = DocumentType.createDocumentType("Location", jugLocation);
    locationType.setReference("venue", ElementType.TYPE_BACK_REFERENCE, "WorldJUGs", "NONE");
    connection.saveDocumentType(locationType);
   
    //4.Create the db object handle
    DocumentMap dbDocHandle = connection.getDocumentMap("WorldJUGs");
   
    //5. Store the data in the database
    for(int j=0; j<documentCount; j++){
      Document ljug = worldJugs.get(j);
      dbDocHandle.store(Integer.toString(j), ljug);
    }
    //6. Close the connection
    connection.close();
  }
View Full Code Here


            return null;
        }
        //if ((candidates == null) || (candidates.isEmpty())) {
        //    return null;
        //}
        Document document = documentMap.load(candidateIt.next().toString());
        //candidateIt.remove();
        beforeFirst = false;
        return document;
    }
View Full Code Here

   /** Test and profile data load.
    */
    void load() {
        long start = getTime();
        for (int i=0;i<documentCount;i++) {
            Document current = benchmark.load(Integer.toString(i));
            int ind = (Integer) data[i].get("intOne");
            if (!(data[ind].get("longTwo").equals(current.get("longTwo")))) { // ||
                //(((Double[])(data[ind].get("doubleArrayOne"))[3]).equals((Double[])current.get("doubleArrayOne")))[3])) {
                throw new RuntimeException("Data does not match");
            }
            //if (i == 2) {
                //System.out.println(customer.toJSON("\r\n"));
View Full Code Here

    void generateSampleData() {
        Random rnd = new Random(5283314247687391911L);
        data = new Document[100000];
        for (int i=0;i<documentCount;i++) {
            data[i] = new Document();
            data[i].put("shortOne",rnd.nextInt());
            data[i].put("intOne",i);
            data[i].put("longOne",12345678L);
            data[i].put("longTwo",rnd.nextLong());
            data[i].put("longThree",rnd.nextLong());
View Full Code Here

   /** Test and profile data load.
    */
    void load() {
        long start = getTime();
        for (int i=0;i<documentCount;i++) {
            Document customer = customers.load(Integer.toString(i));
            if (i == 2) {
                System.out.println(customer.toJSON("\r\n"));
            }
        }
        reportLoad(documentCount*2,start);
    }
View Full Code Here

        long start = getTime();
        customers.executeQuery(query);
        int count = query.size();
        reportQuery(count,start);
        for (int i=0;i<count;i++) {
            Document document = query.next();
            //if (i < 3) {
            //    System.out.println(document.toJSON("\r\n "));
            //}
        }
    }
View Full Code Here

    *
    * We also declare a number of unique, and non-unique indices.
    */
    private void createSchema() {
        // We will use the first customer data to infer types
        Document firstCustomer = customersData.get(0);

        // Customers schema
        DocumentType customersType = DocumentType.createDocumentType("Customers",firstCustomer);
        customersType.setReference("account",ElementType.TYPE_REFERENCE,"Accounts","number");

        // Customer indices
        customersType.addIndex("name",false);
        customersType.addIndex("ssn",true);
        customersType.addIndex("age",false);
        connection.saveDocumentType(customersType);

        // Accounts schema
        Document firstAccount = (Document)firstCustomer.get("account");
        DocumentType accountsType = DocumentType.createDocumentType("Accounts",firstAccount);
        accountsType.setReference("owner",ElementType.TYPE_BACK_REFERENCE,"Customers","TODO");

        // Accounts indices
        accountsType.addIndex("owner",true);
View Full Code Here

TOP

Related Classes of com.intersys.gds.Document

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.