Package net.fortytwo.sesametools.ldserver

Examples of net.fortytwo.sesametools.ldserver.LinkedDataServer


            String externalBaseURI = TwitLogic.BASE_URI;
            final String datasetURI = TwitLogic.TWITLOGIC_DATASET;
            int port = TwitLogic.getConfiguration().getInt(TwitLogic.SERVER_PORT, DEFAULT_PORT);
            File staticContentDir = TwitLogic.getConfiguration().getFile(TwitLogic.SERVER_STATICCONTENTDIRECTORY);

            LinkedDataServer server = new LinkedDataServer(this.getSail(),
                    internalBaseURI,
                    externalBaseURI,
                    datasetURI);

            Component component = new Component();
            server.setInboundRoot(component);
            component.getServers().add(Protocol.HTTP, port);
            component.getServers().add(Protocol.FILE, port);

            component.getDefaultHost().attach("/", new Directory(server.getContext(), "file://" + staticContentDir + "/"));

            for (TwitLogic.ResourceType t : TwitLogic.ResourceType.values()) {
                String p = t.getUriPath();
                if (!p.equals("graph") && !p.equals("person")) {
                    component.getDefaultHost().attach("/" + p + "/", WebResource.class);
                }
            }
            component.getDefaultHost().attach("/person/twitter/", PersonResource.class);
            component.getDefaultHost().attach("/graph/", GraphResource.class);

            component.getDefaultHost().attach("/sparql", new SparqlResource());
            component.getDefaultHost().attach("/stream/relatedTweets", new RelatedTweetsResource());
            component.getDefaultHost().attach("/stream/relatedTags", new RelatedHashtagsResource());

            server.start();
        } catch (Throwable e) {
            throw new ServerException(e);
        }
    }
View Full Code Here

TOP

Related Classes of net.fortytwo.sesametools.ldserver.LinkedDataServer

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.