@@ -0,0 +1,2200 @@
+/**%0A * Copyright 2016 Eventchain team%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A */%0Apackage org.eventchain.h2;%0A%0Aimport com.googlecode.cqengine.attribute.Attribute;%0Aimport com.googlecode.cqengine.index.Index;%0Aimport org.eventchain.h2.index.HashIndex;%0Aimport org.eventchain.h2.index.UniqueIndex;%0Aimport org.eventchain.index.CQIndexEngine;%0Aimport org.eventchain.index.IndexEngine;%0Aimport org.h2.mvstore.MVStore;%0Aimport org.osgi.service.component.ComponentContext;%0Aimport org.osgi.service.component.annotations.Activate;%0Aimport org.osgi.service.component.annotations.Component;%0A%0Aimport java.util.Arrays;%0Aimport java.util.List;%0A%0Aimport static org.eventchain.index.IndexEngine.IndexFeature.*;%0Aimport static org.eventchain.index.IndexEngine.IndexFeature.EQ;%0Aimport static org.eventchain.index.IndexEngine.IndexFeature.IN;%0A%0A@Component(properties = %22org.eventchain.hlc.MVStoreIndexEngine.filename%22)%0Apublic class MVStoreIndexEngine extends CQIndexEngine implements IndexEngine %7B%0A%0A    private MVStore store;%0A%0A    public MVStoreIndexEngine() %7B%0A%0A    %7D%0A%0A    public MVStoreIndexEngine(MVStore store) %7B%0A        this.store = store;%0A    %7D%0A%0A    @Activate%0A    public void activate(ComponentContext ctx) %7B%0A        this.store = MVStore.open((String) ctx.getProperties().get(%22org.eventchain.hlc.MVStoreIndexEngine.filename%22));%0A    %7D%0A%0A    @Override%0A    protected List%3CIndexCapabilities%3E getIndexMatrix() %7B%0A        return Arrays.asList(%0A            new IndexCapabilities%3CAttribute%3E(%22Hash%22, new IndexFeature%5B%5D%7BEQ, IN, QZ%7D, attribute -%3E HashIndex.onAttribute(store, attribute)),%0A            new IndexCapabilities%3CAttribute%3E(%22Unique%22, new IndexFeature%5B%5D%7BUNIQUE, EQ, IN%7D, attribute -%3E UniqueIndex.onAttribute(store, attribute))%0A        );%0A    %7D%0A%7D%0A

Implement MVStoreIndexEngine