The Artima Developer Community
Sponsored Link

Java Buzz Forum
Distributed Query API

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Talip Ozturk

Posts: 103
Nickname: talip
Registered: May, 2003

Talip Ozturk is founder of Hazelcast, distributed queue, set, map and lock implementation.
Distributed Query API Posted: Sep 7, 2009 5:02 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Talip Ozturk.
Original Post: Distributed Query API
Feed Title: Shared Memory
Feed URL: http://www.jroller.com/talipozturk/feed/entries/rss
Feed Description: about java, jcache, jini, javaspaces, distributed data structures and a little bit of me and life.
Latest Java Buzz Posts
Latest Java Buzz Posts by Talip Ozturk
Latest Posts From Shared Memory

Advertisement
Hazelcast partitions your data and spreads across cluster of servers. You can, of course, get your map entries by key or iterate all entries but being able to query the distributed map would be very nice. We are working on the query feature these days and we already got most of it working. We are quite flexible in terms of query API and before the release we want to make sure that the default Query API is right. We can surely support more than one API !

Let's say we have a Employee class:

public class Employee implements Serializable {
        String name;
        int age;
        boolean active;
        double salary;

        public Employee(String name, int age, boolean live, double price) {
            this.name = name;
            this.age = age;
            this.active = live;
            this.salary = price;
        }

        public Employee() {
        }

        public String getName() {
            return name;
        }

        public int getAge() {
            return age;
        }

        public double getSalary() {
            return salary;
        }

        public boolean isActive() {
            return active;
        }
}

1. Predicates like and, equal, get, lessThan etc. can be static methods so that they can be imported.

//active employees with age of 23
Set IMap.entrySet(and(equal(get("isActive"), true), equal(get("getAge"), 23)));

2. More like JPA Criteria API:

DomainObject do= IMap.getDomainObject();
Set IMap.entrySet(do.get("isActive").equal(true).and(do.get("getAge").equal(23)));
This is SQL like 'as you speak' kinda lingo.

3. Complete Predicate API like Google Collections or Apache Common Collections have:

Predicate p = new AndPredicate (new EqualPredicate("isActive", true), new EqualPredicate ("getAge", 23));
Set IMap.entrySet(p)
I like standards so I prefer JPA Criteria like API. What do you think? What would you care the most?

Helpful links:
Linda DeMichiel on JPA Criteria API
Apache Collection Predicates
Google Collection Predicates
JaQu
JeQuel

Read: Distributed Query API

Topic: Google's Chrome Web browser gets first personal-computer partner in Sony Previous Topic   Next Topic Topic: And so it goes, around again.

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use