Examples of LRepository


Examples of org.lilyproject.repository.api.LRepository

    @PUT
    @Produces("application/json")
    @Consumes("application/json")
    public Response put(@PathParam("id") String id, Record record, @Context UriInfo uriInfo) {
        LRepository repository = getRepository(uriInfo);
        LTable table = getTable(uriInfo);
        return put(id, record, uriInfo, repository, table);
    }
View Full Code Here

Examples of org.lilyproject.repository.api.LRepository

    @POST
    @Produces("application/json")
    @Consumes("application/json")
    public Response post(@PathParam("id") String id, PostAction<Record> postAction, @Context UriInfo uriInfo) {
        LRepository repository = getRepository(uriInfo);
        LTable table = getTable(uriInfo);
        return post(id, postAction, uriInfo, repository, table);
    }
View Full Code Here

Examples of org.lilyproject.repository.api.LRepository

        }
    }

    @DELETE
    public Response delete(@PathParam("id") String id, @Context UriInfo uriInfo) {
        LRepository repository = getRepository(uriInfo);
        LTable table = getTable(uriInfo);
        return delete(id, repository, table);
    }
View Full Code Here

Examples of org.lilyproject.repository.api.LRepository

        final ArrayList<Record> result = new ArrayList<Record>();

        final RecordScan scan = new RecordScan();
        scan.setStartRecordId(newDep.id.getMaster());
        scan.setRecordFilter(new RecordVariantFilter(newDep.id.getMaster(), varProps));
        LRepository repository = indexUpdateBuilder.getRepository();
        LTable table = repository.getTable(indexUpdateBuilder.getTable());
        final IdRecordScanner scanner = table.getScannerWithIds(scan);
        IdRecord next;
        while ((next = scanner.next()) != null) {
            try {
                final Record record = VersionTag.getIdRecord(next, indexUpdateBuilder.getVTag(), table, repository);
View Full Code Here

Examples of org.lilyproject.repository.api.LRepository

        if (result != 0) {
            return result;
        }

        lilyClient = new LilyClient(zkConnectionString, 60000);
        LRepository repository = lilyClient.getDefaultRepository();
        typeManager = repository.getTypeManager();

        Configuration hbaseConf = HBaseConfiguration.create();
        hbaseConf.set("hbase.zookeeper.quorum", zkConnectionString);

        IndexManager indexManager = new IndexManager(hbaseConf, new HBaseTableFactoryImpl(hbaseConf));

        LinkIndex linkIndex = new LinkIndex(indexManager, lilyClient);

        //
        // Determine the index to query
        //
        boolean incoming = true; // false = outgoing
        if (cmd.hasOption(indexOption.getOpt())) {
            String index = cmd.getOptionValue(indexOption.getOpt());
            if (index.equals("incoming") || index.equals("backward")) {
                incoming = true;
            } else if (index.equals("outgoing") || index.equals("forward")) {
                incoming = false;
            } else {
                System.err.println("Invalid index name: " + index);
                return -1;
            }
        }

        //
        // Determine the record id
        //
        String recordIdParam = cmd.getOptionValue(recordIdOption.getOpt());
        if (recordIdParam == null) {
            System.out.println("Specify record id with -" + recordIdOption.getOpt());
            return 1;
        }
        RecordId recordId = repository.getIdGenerator().fromString(recordIdParam);

        //
        // Determine the vtag
        //
        SchemaId vtagId = null;
View Full Code Here

Examples of org.lilyproject.repository.api.LRepository

            throws IndexerConfException, RepositoryException, InterruptedException {
        this.indexDefinition = indexDefinition;
        this.indexerConf = indexerConf;

        String repoParam = indexDefinition.getConnectionParams().get(LResultToSolrMapper.REPO_KEY);
        LRepository repository = repositoryName == null ? repositoryManager.getDefaultRepository() : repositoryManager.getRepository(repositoryName);
        repositoryName = repoParam == null ? RepoAndTableUtil.DEFAULT_REPOSITORY : repoParam;

        this.lilyIndexerConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(indexDefinition.getConfiguration()), repository);
    }
View Full Code Here

Examples of org.lilyproject.repository.api.LRepository

                new ReadContext(repository, namespaces, linkTransformer));
    }

    protected Record readRootRecord(ValueHandle handle, ReadContext context)
            throws InterruptedException, RepositoryException, JsonFormatException {
        LRepository repository = context.repository;
        Namespaces namespaces = context.namespaces;
        JsonNode node = handle.node;

        Record record = readCommonRecordAspects(handle, context, true);

        String id = getString(node, "id", null);
        if (id != null) {
            record.setId(repository.getIdGenerator().fromString(id));
        }

        ArrayNode fieldsToDelete = getArray(node, "fieldsToDelete", null);
        if (fieldsToDelete != null) {
            for (int i = 0; i < fieldsToDelete.size(); i++) {
View Full Code Here

Examples of org.lilyproject.repository.api.LRepository

    /**
     * Reads those aspects of a record that are shared between top-level and nested records.
     */
    protected Record readCommonRecordAspects(ValueHandle handle, ReadContext context, boolean topLevelRecord)
            throws JsonFormatException, InterruptedException, RepositoryException {
        LRepository repository = context.repository;
        Namespaces namespaces = context.namespaces;

        Record record = repository.getRecordFactory().newRecord();

        JsonNode typeNode = handle.node.get("type");
        if (typeNode != null) {
            if (typeNode.isObject()) {
                QName qname = QNameConverter.fromJson(JsonUtil.getString(typeNode, "name"), namespaces);
                Long version = JsonUtil.getLong(typeNode, "version", null);
                record.setRecordType(qname, version);
            } else if (typeNode.isTextual()) {
                record.setRecordType(QNameConverter.fromJson(typeNode.getTextValue(), namespaces));
            }
        }

        ObjectNode fields = getObject(handle.node, "fields", null);
        if (fields != null) {
            Iterator<Map.Entry<String, JsonNode>> it = fields.getFields();
            while (it.hasNext()) {
                Map.Entry<String, JsonNode> entry = it.next();

                QName qname = QNameConverter.fromJson(entry.getKey(), namespaces);
                FieldType fieldType = repository.getTypeManager().getFieldTypeByName(qname);
                ValueHandle subHandle = new ValueHandle(fields.get(entry.getKey()), "fields." + entry.getKey(),
                        fieldType.getValueType());
                Object value = readValue(subHandle, context);
                if (value != null) {
                    record.setField(qname, value);
View Full Code Here

Examples of org.lilyproject.repository.api.LRepository

    public EntityList<Record> get(@PathParam("id") String id,
            @DefaultValue("1") @QueryParam("start-index") Long startIndex,
            @DefaultValue("10") @QueryParam("max-results") Long maxResults,
            @Context UriInfo uriInfo) {

        LRepository repository = getRepository(uriInfo);
        LTable table = getTable(uriInfo);
        List<QName> fieldQNames = ResourceClassUtil.parseFieldList(uriInfo);

        RecordId recordId = repository.getIdGenerator().fromString(id);
        List<Record> records;
        try {
            records = table.readVersions(recordId, startIndex, startIndex + maxResults - 1, fieldQNames);
            return EntityList.create(records, uriInfo);
        } catch (RecordNotFoundException e) {
View Full Code Here

Examples of org.lilyproject.repository.api.LRepository

    @GET
    @Produces("application/json")
    public Entity<Record> get(@PathParam("id") String id, @PathParam("version") Long version,
            @Context UriInfo uriInfo) {

        LRepository repository = getRepository(uriInfo);
        LTable table = getTable(uriInfo);
        RecordId recordId = repository.getIdGenerator().fromString(id);

        try {
            return Entity.create(table.read(recordId, version), uriInfo);
        } catch (RecordNotFoundException e) {
            throw new ResourceException(e, NOT_FOUND.getStatusCode());
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.