Package org.apache.abdera.model

Examples of org.apache.abdera.model.Document


        ByteArrayInputStream bais =
            new ByteArrayInputStream(value.getBytes(getXMLStreamReader().getCharacterEncodingScheme()));
        ParserOptions options = parser.getDefaultParserOptions();
        options.setCharset(getXMLStreamReader().getCharacterEncodingScheme());
        options.setFactory(fomfactory);
        Document doc = parser.parse(bais, (baseUri != null) ? baseUri.toString() : null, options);
        return doc.getRoot();
    }
View Full Code Here


    public Content setContent(InputStream in, String mediatype) {
        if (MimeTypeHelper.isText(mediatype)) {
            try {
                StringBuilder buf = new StringBuilder();
                String charset = MimeTypeHelper.getCharset(mediatype);
                Document doc = this.getDocument();
                charset = charset != null ? charset : doc != null ? doc.getCharset() : null;
                charset = charset != null ? charset : "UTF-8";
                InputStreamReader isr = new InputStreamReader(in, charset);
                char[] data = new char[500];
                int r = -1;
                while ((r = isr.read(data)) != -1) {
View Full Code Here

        }
        return dom;
    }

    protected Document domToFom(org.w3c.dom.Document dom, SecurityOptions options) {
        Document doc = null;
        if (dom != null) {
            try {
                Serializer ser = new XMLSerializer();
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                ser.setOutputByteStream(out);
View Full Code Here

                abderaClient.get(baseURI + APPConstants.ATOM +
                        encodeURL(path +
                                RegistryConstants.URL_SEPARATOR +
                                APPConstants.PARAMETER_VERSION),
                        getAuthorization());
        Document introspection = clientResponse.getDocument();
        Feed feed = (Feed) introspection.getRoot();
        List entries = feed.getEntries();
        if (entries != null) {
            String[] versions = new String[entries.size()];
            for (int i = 0; i < entries.size(); i++) {
                Entry entry = (Entry) entries.get(i);
View Full Code Here

                encodeURL(resourcePath +
                        RegistryConstants.URL_SEPARATOR +
                        APPConstants.ASSOCIATIONS),
                getAuthorization());
        if (resp.getType() == Response.ResponseType.SUCCESS) {
            Document introspection = resp.getDocument();
            Feed feed = (Feed) introspection.getRoot();
            Association[] associations = getAssociationsFromFeed(feed, resourcePath);
            abderaClient.teardown();
            return associations;
        } else {
            String msg = "uanble to get all associations for path " + resourcePath +
View Full Code Here

                abderaClient.get(baseURI + APPConstants.ATOM +
                        encodeURL(resourcePath + RegistryConstants.URL_SEPARATOR +
                                APPConstants.ASSOCIATIONS + ":" +
                                associationType),
                        getAuthorization());
        Document introspection = clientResponse.getDocument();
        Feed feed = (Feed) introspection.getRoot();
        List entries = feed.getEntries();
        Association associations[] = null;
        if (entries != null) {
            associations = new Association[entries.size()];
            for (int i = 0; i < entries.size(); i++) {
View Full Code Here

    public TaggedResourcePath[] getResourcePathsWithTag(String tag) throws RegistryException {
        AbderaClient abderaClient = new AbderaClient(abdera);
        ClientResponse clientResponse = abderaClient.get(baseURI + "/tags/" + tag,
                getAuthorization());

        Document introspection =
                clientResponse.getDocument();
        Feed feed = (Feed) introspection.getRoot();
        List entries = feed.getEntries();
        TaggedResourcePath taggedResourcePaths[] = null;
        if (entries != null) {
            taggedResourcePaths = new TaggedResourcePath[entries.size()];
            for (int i = 0; i < entries.size(); i++) {
View Full Code Here

                encodeURL(resourcePath +
                        RegistryConstants.URL_SEPARATOR +
                        APPConstants.PARAMETER_TAGS),
                getAuthorization());

        Document introspection =
                clientResponse.getDocument();
        Feed feed = (Feed) introspection.getRoot();
        List entries = feed.getEntries();
        Tag tags[] = null;
        if (entries != null) {
            tags = new Tag[entries.size()];
            for (int i = 0; i < entries.size(); i++) {
View Full Code Here

        ClientResponse clientResponse =
                abderaClient.get(baseURI + APPConstants.ATOM +
                        resourcePath + RegistryConstants.URL_SEPARATOR +
                        APPConstants.PARAMETER_COMMENTS,
                        getAuthorization());
        Document introspection = clientResponse.getDocument();
        Element element = introspection.getRoot();
        Feed feed = (Feed) element;
        org.wso2.carbon.registry.core.Comment[] comments = getCommentsFromFeed(feed);
        abderaClient.teardown();

        return comments;
View Full Code Here

            abderaClient.teardown();
            log.error(msg);
            throw new RegistryException(msg);
        }

        Document introspection = clientResponse.getDocument();
        if (introspection.getRoot() instanceof Feed) {
            Feed feed = (Feed) introspection.getRoot();
            String floatValue = feed.getSimpleExtension(APPConstants.QN_AVERAGE_RATING);
            abderaClient.teardown();
            return Float.parseFloat(floatValue);
        }
        return 0;
View Full Code Here

TOP

Related Classes of org.apache.abdera.model.Document

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.