Package org.apache.marmotta.ldclient.api.endpoint

Examples of org.apache.marmotta.ldclient.api.endpoint.Endpoint


    public ClientResponse retrieveResource(String resource) throws DataRetrievalException {
        try {
            retrievalSemaphore.acquire();
            if(!config.isExcludedUri(resource)) {

                Endpoint endpoint = getEndpoint(resource);

                if(endpoint != null) {
                    DataProvider provider = getDataProvider(endpoint);
                    if(provider != null) {
                        return provider.retrieveResource(resource, this, endpoint);
                    } else {
                        log.error("no service provider for type {}",endpoint.getType());
                    }
                } else {
                    // TODO: the fallback should at least be a Linked Data handler, so maybe we should merge the ldclient-provider-rdf?
                    // TODO: determine service provider from connection handshaking / MIME type
                    throw new UnsupportedOperationException("not implemented: determine service provider from connection handshaking / MIME type");
View Full Code Here


        );
    }


    private Endpoint getEndpointByLabel(String label) {
        Endpoint endpoint = new Endpoint();

        endpoint.setName(configurationService.getStringConfiguration("ldcache.endpoint."+label+".name"));
        endpoint.setPriority(configurationService.getIntConfiguration("ldcache.endpoint." + label + ".prio"));
        endpoint.setType(configurationService.getStringConfiguration("ldcache.endpoint." + label + ".provider"));
        endpoint.setUriPattern(configurationService.getStringConfiguration("ldcache.endpoint." + label + ".pattern"));
        endpoint.setEndpointUrl(configurationService.getStringConfiguration("ldcache.endpoint." + label + ".service"));
        endpoint.setDefaultExpiry(configurationService.getLongConfiguration("ldcache.endpoint." + label + ".expiry"));
        endpoint.setActive(configurationService.getBooleanConfiguration("ldcache.endpoint." + label + ".active"));
        endpoint.setContentTypes(new HashSet<ContentType>(
                LMFHttpUtils.parseAcceptHeader(
                        configurationService.getStringConfiguration("ldcache.endpoint." + label + ".contenttype",""))
        ));

        return endpoint;
View Full Code Here

                endpointUrl = "";
            }
            if (mimetype == null) {
                mimetype ="";
            }
            Endpoint endpoint = new Endpoint(name, type, prefix, endpointUrl, mimetype, expiry);
            endpointService.addEndpoint(endpoint);

            cacheSailProvider.updateEndpoints();

View Full Code Here

    @GET
    @Path("/endpoint/{id}")
    @Produces("application/json")
    public Response retrieveEndpoint(@PathParam("id") String id) {

        Endpoint endpoint = endpointService.getEndpoint(id);
        if (endpoint == null) return notFound(id);


        return Response.ok().entity(buildEndpointJSON(endpoint, false)).build();
    }
View Full Code Here

    @DELETE
    @Path("/endpoint/{id}")
    public Response removeEndpoint(@PathParam("id") String id) {

        Endpoint endpoint = endpointService.getEndpoint(id);
        if (endpoint == null) return notFound(id);

        endpointService.removeEndpoint(endpoint);

        cacheSailProvider.updateEndpoints();
View Full Code Here

    }

    @POST
    @Path("/endpoint/{id}/enable")
    public Response enableEndpoint(@PathParam("id") String id, @QueryParam("enable") @DefaultValue("true") boolean enable) {
        Endpoint endpoint = endpointService.getEndpoint(id);
        if (endpoint == null) return notFound(id);

        endpoint.setActive(enable);
        endpointService.updateEndpoint(endpoint);

        cacheSailProvider.updateEndpoints();

        return Response.ok().build();
View Full Code Here

        );
    }


    private Endpoint getEndpointByLabel(String label) {
        Endpoint endpoint = new Endpoint();

        endpoint.setName(configurationService.getStringConfiguration("ldcache.endpoint."+label+".name"));
        endpoint.setPriority(configurationService.getIntConfiguration("ldcache.endpoint." + label + ".prio"));
        endpoint.setType(configurationService.getStringConfiguration("ldcache.endpoint." + label + ".provider"));
        endpoint.setUriPattern(configurationService.getStringConfiguration("ldcache.endpoint." + label + ".pattern"));
        endpoint.setEndpointUrl(configurationService.getStringConfiguration("ldcache.endpoint." + label + ".service"));
        endpoint.setDefaultExpiry(configurationService.getLongConfiguration("ldcache.endpoint." + label + ".expiry"));
        endpoint.setActive(configurationService.getBooleanConfiguration("ldcache.endpoint." + label + ".active"));
        endpoint.setContentTypes(new HashSet<ContentType>(
                MarmottaHttpUtils.parseAcceptHeader(
                        configurationService.getStringConfiguration("ldcache.endpoint." + label + ".contenttype",""))
        ));

        return endpoint;
View Full Code Here

                endpointUrl = "";
            }
            if (mimetype == null) {
                mimetype ="";
            }
            Endpoint endpoint = new Endpoint(name, type, prefix, endpointUrl, mimetype, expiry);
            endpointService.addEndpoint(endpoint);

            cacheSailProvider.updateEndpoints();

View Full Code Here

    @GET
    @Path("/endpoint/{id}")
    @Produces("application/json")
    public Response retrieveEndpoint(@PathParam("id") String id) {

        Endpoint endpoint = endpointService.getEndpoint(id);
        if (endpoint == null) return notFound(id);


        return Response.ok().entity(buildEndpointJSON(endpoint, false)).build();
    }
View Full Code Here

    @DELETE
    @Path("/endpoint/{id}")
    public Response removeEndpoint(@PathParam("id") String id) {

        Endpoint endpoint = endpointService.getEndpoint(id);
        if (endpoint == null) return notFound(id);

        endpointService.removeEndpoint(endpoint);

        cacheSailProvider.updateEndpoints();
View Full Code Here

TOP

Related Classes of org.apache.marmotta.ldclient.api.endpoint.Endpoint

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.