Examples of LTable


Examples of org.lilyproject.repository.api.LTable

            // We're already on a master record, stop here
            return;
        }

        LRepository repository = indexUpdateBuilder.getRepository();
        LTable table = repository.getTable(indexUpdateBuilder.getTable());

        Dep masterDep = new Dep(ctx.dep.id.getMaster(), Collections.<String>emptySet());
        Record master = null;
        try {
            master = VersionTag.getIdRecord(masterDep.id, indexUpdateBuilder.getVTag(), table, repository);
View Full Code Here

Examples of org.lilyproject.repository.api.LTable

            repository.getTableManager().createTable("table1");
            repository.getTableManager().createTable("table2");

            for (String tableName : new String[] {"record", "table1", "table2"}) {
                LTable table = repository.getTable(tableName);
                Record record = table.newRecord();
                record.setRecordType(typeName);
                record.setField(field1, "foobar");
                record = table.create(record);
                assertEquals("foo", record.getField(field2));
                assertEquals("foo", table.read(record.getId()).getField(field2));

                // Test we can get access to our test decorator: this is something that is occasionally useful
                // in test cases to check certain conditions, e.g. if the decorator would have async side effects.
                RepositoryDecoratorChain chain = repositoryMgr.getRepositoryDecoratorChain(repositoryName, tableName);
                assertNotNull(chain);
View Full Code Here

Examples of org.lilyproject.repository.api.LTable

                .create();

        assertNull(AuthzRegionObserver.lastSeenAuthzCtx);

        // Create a record
        LTable table = repository.getDefaultTable();
        Record record = table.recordBuilder()
                .defaultNamespace("authztest")
                .recordType("Type1")
                .field("field1", "value 1")
                .field("field2", "value 2")
                .create();

        assertNotNull(AuthzRegionObserver.lastSeenAuthzCtx);
        assertEquals("jules", AuthzRegionObserver.lastSeenAuthzCtx.getName());

        // Read the record with a different user
        setUser("jef", Sets.newHashSet("marketing"));
        table.read(record.getId());
        assertEquals("jef", AuthzRegionObserver.lastSeenAuthzCtx.getName());
    }
View Full Code Here

Examples of org.lilyproject.repository.api.LTable

    public ByteBuffer create(AvroAuthzContext authzContext, ByteBuffer record, String repositoryName, String tableName)
            throws AvroRepositoryException, AvroInterruptedException {
        try {
            AuthorizationContextHolder.setCurrentContext(converter.convert(authzContext));
            LRepository repository = repositoryManager.getRepository(repositoryName);
            LTable table = repository.getTable(tableName);
            return converter.convert(table.create(converter.convertRecord(record, repository)), repository);
        } catch (RepositoryException e) {
            throw converter.convert(e);
        } catch (InterruptedException e) {
            throw converter.convert(e);
        } finally {
View Full Code Here

Examples of org.lilyproject.repository.api.LTable

            String tableName, boolean useLatestRecordType)
            throws AvroRepositoryException, AvroInterruptedException {
        try {
            AuthorizationContextHolder.setCurrentContext(converter.convert(authzContext));
            LRepository repository = repositoryManager.getRepository(repositoryName);
            LTable table = repository.getTable(tableName);
            return converter.convert(
                    table.createOrUpdate(converter.convertRecord(record, repository), useLatestRecordType), repository);
        } catch (RepositoryException e) {
            throw converter.convert(e);
        } catch (InterruptedException e) {
            throw converter.convert(e);
        } finally {
View Full Code Here

Examples of org.lilyproject.repository.api.LTable

            String tableName, List<AvroMutationCondition> conditions, Map<String,String> attributes)
            throws AvroRepositoryException, AvroInterruptedException {
        try {
            AuthorizationContextHolder.setCurrentContext(converter.convert(authzContext));
            LRepository repository = repositoryManager.getRepository(repositoryName);
            LTable table = repository.getTable(tableName);
            RecordId decodedRecordId = converter.convertAvroRecordId(recordId, repository);
            Record record = null;
            if (attributes == null) {
                record = table.delete(decodedRecordId, converter.convertFromAvro(conditions, repository));
            } else if (conditions == null) {
                Record toDelete = table.newRecord(decodedRecordId);
                toDelete.setAttributes(attributes);
                table.delete(toDelete);
            } else {
                // There is no API call where a full record and MutationConditions can be supplied, so
                // something has gone wrong if we get here
                throw new IllegalStateException("Cannot delete a full record with MutationConditions");
            }
View Full Code Here

Examples of org.lilyproject.repository.api.LTable

            boolean updateVersion, boolean useLatestRecordType, List<AvroMutationCondition> conditions)
            throws AvroRemoteException {
        try {
            AuthorizationContextHolder.setCurrentContext(converter.convert(authzContext));
            LRepository repository = repositoryManager.getRepository(repositoryName);
            LTable table = repository.getTable(tableName);
            return converter.convert(table.update(converter.convertRecord(record, repository), updateVersion,
                    useLatestRecordType, converter.convertFromAvro(conditions, repository)), repository);
        } catch (RepositoryException e) {
            throw converter.convert(e);
        } catch (InterruptedException e) {
            throw converter.convert(e);
View Full Code Here

Examples of org.lilyproject.repository.api.LTable

    public List<String> getVariants(AvroAuthzContext authzContext, ByteBuffer recordId, String repositoryName,
            String tableName) throws AvroRepositoryException, AvroInterruptedException {
        try {
            AuthorizationContextHolder.setCurrentContext(converter.convert(authzContext));
            LRepository repository = repositoryManager.getRepository(repositoryName);
            LTable table = repository.getTable(tableName);
            return converter.convert(table.getVariants(converter.convertAvroRecordId(recordId, repository)));
        } catch (RepositoryException e) {
            throw converter.convert(e);
        } catch (InterruptedException e) {
            throw converter.convert(e);
        } finally {
View Full Code Here

Examples of org.lilyproject.repository.api.LTable

        List<String> repositories = Lists.newArrayList("company1", "company2", "default");

        for (String repoName : repositories) {
            LRepository repo = repositoryManager.getRepository(repoName);
            repo.getTableManager().createTable("mytable");
            LTable table = repo.getTable("mytable");
            table.recordBuilder()
                    .id("id1")
                    .recordType(recordType1.getName())
                    .field(fieldType1.getName(), repoName + "-value1")
                    .create();
        }

        for (String repoName : repositories) {
            LRepository repo = repositoryManager.getRepository(repoName);
            IdGenerator idGenerator = repo.getIdGenerator();
            LTable table = repo.getTable("mytable");
            assertEquals(repoName + "-value1", table.read(idGenerator.newRecordId("id1")).getField(fieldType1.getName()));
        }
    }
View Full Code Here

Examples of org.lilyproject.repository.api.LTable

                        repositoryManager.getDefaultRepository().getTypeManager());

                VTaggedRecord vtRecord;
                try {
                    LRepository repository = repositoryManager.getDefaultRepository();
                    LTable table = repository.getTable(recordEvent.getTableName());
                    vtRecord = new VTaggedRecord(absRecordId.getRecordId(), eventHelper, table, repository);
                } catch (RecordNotFoundException e) {
                    // record not found: delete all links for all vtags
                    linkIndex.deleteLinks(absRecordId);
                    if (log.isDebugEnabled()) {
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.