Package org.lilyproject.repository.api

Examples of org.lilyproject.repository.api.LTable


        // Create some content in the default table of the default repository
        //
        LRepository repository = repoMgr.getDefaultRepository();
        TypeManager typeManager = repository.getTypeManager();
        IdGenerator idGenerator = repository.getIdGenerator();
        LTable table = repository.getDefaultTable();

        FieldType ft1 = typeManager.createFieldType("STRING", new QName("test", "field1"), Scope.NON_VERSIONED);

        RecordType rt1 = typeManager.recordTypeBuilder()
                .defaultNamespace("test")
                .name("rt1")
                .fieldEntry().use(ft1).add()
                .create();

        for (int i = 0; i < 100; i++) {
            table.recordBuilder()
                    .id(String.format("%1$03d", i))
                    .recordType(rt1.getName())
                    .field(ft1.getName(), "foo bar bar")
                    .create();
        }

        //
        // Also create some content in another repository with two tables
        //
        RepositoryModelImpl repositoryModel = new RepositoryModelImpl(lilyProxy.getLilyServerProxy().getZooKeeper());
        String repositoryName = "otherrepo";
        repositoryModel.create(repositoryName);
        assertTrue(repositoryModel.waitUntilRepositoryInState(repositoryName, RepositoryLifecycleState.ACTIVE, 60000L));
        repositoryModel.close();

        LRepository repository2 = repoMgr.getRepository(repositoryName);
        repository2.getTableManager().createTable("foobar");
        LTable table2 = repository2.getTable("foobar");
        LTable table3 = repository2.getDefaultTable();

        for (int i = 0; i < 50; i++) {
            table2.recordBuilder()
                    .id(String.valueOf(i))
                    .recordType(rt1.getName())
                    .field(ft1.getName(), "foo bar bar")
                    .create();
        }

        for (int i = 0; i < 20; i++) {
            table3.recordBuilder()
                    .id(String.valueOf(i))
                    .recordType(rt1.getName())
                    .field(ft1.getName(), "foo bar bar")
                    .create();
        }
View Full Code Here


            AuthorizationContextHolder.setCurrentContext(new AuthorizationContext("lily-scan-records", repositoryName, roles));
        }

        lilyClient = new LilyClient(zkConnectionString, zkSessionTimeout);
        LRepository repository = lilyClient.getRepository(repositoryName);
        LTable table = repository.getTable(tableName);
        if (cmd.hasOption(countOption.getOpt())) {
            RecordScanTool.count(repository, table, startId, stopId,recordTypeFilter, configFile);
        } else if (cmd.hasOption(printOption.getOpt())) {
            RecordScanTool.print(repository, table, startId, stopId, limit, recordTypeFilter, configFile);
        }
View Full Code Here

    @GET
    @Produces("application/json")
    public EntityList<Record> get(@PathParam("id") String id, @Context UriInfo uriInfo) {
        LRepository repository = getRepository(uriInfo);
        LTable table = getTable(uriInfo);
        RecordId recordId = repository.getIdGenerator().fromString(id);
        try {
            Set<RecordId> recordIds = table.getVariants(recordId);

            List<Record> records = new ArrayList<Record>();
            for (RecordId variant : recordIds) {
                records.add(repository.getRecordFactory().newRecord(variant));
            }
View Full Code Here

            Record record = recordDecoder.decodeRecord(result);
            RecordEvent event = new RecordEvent(result.getFamilyMap(LilyHBaseSchema.RecordCf.DATA.bytes)
                    .get(LilyHBaseSchema.RecordColumn.PAYLOAD.bytes), idGenerator);

            String tableName = event.getTableName();
            LTable table = repository.getTable(tableName != null ? tableName : LilyHBaseSchema.Table.RECORD.name);

            if (event.getType().equals(INDEX)) {
                if (log.isDebugEnabled()) {
                    log.debug(String.format("Record %1$s: reindex requested for these vtags: %2$s", record.getId(),
                            vtagSetToNameString(event.getVtagsToIndex())));
                }
                RecordEventHelper eventHelper = new RecordEventHelper(event, null, repository.getTypeManager());
                VTaggedRecord vtRecord = new VTaggedRecord(record.getId(), eventHelper, table, repository);

                IndexCase indexCase = lilyIndexerConf.getIndexCase(table.getTableName(), vtRecord.getRecord());
                Set<SchemaId> vtagsToIndex = event.getVtagsToIndex();
                if (indexCase == null) {
                    return;
                }
View Full Code Here

    @Test
    public void testMap() throws Exception {
        IdGenerator idGenerator = new IdGeneratorImpl();
        System.out.println(Bytes.toString(idGenerator.fromString("USER.batch-index-custom").toBytes()));
        LTable table = repository.getDefaultTable();
        Record record = table.recordBuilder()
                .assignNewUuid()
                .recordType(new QName(NS1, "rt1"))
                .field(new QName(NS1, "a_string"), "myvalue")
                .create();
       
View Full Code Here

TOP

Related Classes of org.lilyproject.repository.api.LTable

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.