<commit_before>/*
 * Copyright 2006 Wyona
 */

package org.wyona.yanel.impl.resources.navigation;

import org.wyona.yanel.core.Resource;
import org.wyona.yanel.core.api.attributes.ViewableV2;
import org.wyona.yanel.core.attributes.viewable.View;
import org.wyona.yanel.core.attributes.viewable.ViewDescriptor;
import org.wyona.yanel.core.navigation.Node;
import org.wyona.yanel.core.navigation.Sitetree;
import org.wyona.yanel.impl.resources.BasicXMLResource;

import org.apache.log4j.Logger;

/**
 *
 */
public class DataRepoSitetreeResource extends BasicXMLResource {

    private static Logger log = Logger.getLogger(DataRepoSitetreeResource.class);

    /**
     *
     */
    public DataRepoSitetreeResource() {
    }

    /**
     *
     */
    public long getSize() throws Exception {
        return -1;
    }

    /**
     *
     */
    public boolean exists() throws Exception {
        return true;
    }

    /**
     *
     */
    public java.io.InputStream getContentXML(String viewId) throws Exception {
        StringBuffer sb = new StringBuffer("<?xml version=\"1.0\"?>");
        sb.append(getSitetreeAsXML());
        //sb.append(getSitetreeAsXML(getPath().toString()));

        return new java.io.StringBufferInputStream(sb.toString());
    }

    /**
     * Get sitetree as XML
     */
    private String getSitetreeAsXML() {
        String name4pathParameter;
        try {
            name4pathParameter = getResourceConfigProperty("name4path-parameter");
        } catch (Exception e) {
            name4pathParameter = "path";
        }
        StringBuffer sb = new StringBuffer("<sitetree>");
        if (getEnvironment().getRequest().getParameter(name4pathParameter) != null) {
            sb.append(getNodeAsXML(request.getParameter(name4pathParameter)));
        } else {
            sb.append(getNodeAsXML("/"));
        }

        // TODO: Sitetree generated out of RDF resources and statements
        /*
        com.hp.hpl.jena.rdf.model.Resource rootResource = getRealm().getSitetreeRootResource();
        sb.append(getNodeAsXML(rootResource));
        */
        sb.append("</sitetree>");

        return sb.toString();
    }
<commit_msg>setting of path parameter fixed<commit_after>/*
 * Copyright 2006 Wyona
 */

package org.wyona.yanel.impl.resources.navigation;

import org.wyona.yanel.core.Resource;
import org.wyona.yanel.core.api.attributes.ViewableV2;
import org.wyona.yanel.core.attributes.viewable.View;
import org.wyona.yanel.core.attributes.viewable.ViewDescriptor;
import org.wyona.yanel.core.navigation.Node;
import org.wyona.yanel.core.navigation.Sitetree;
import org.wyona.yanel.impl.resources.BasicXMLResource;

import org.apache.log4j.Logger;

/**
 *
 */
public class DataRepoSitetreeResource extends BasicXMLResource {

    private static Logger log = Logger.getLogger(DataRepoSitetreeResource.class);

    /**
     *
     */
    public DataRepoSitetreeResource() {
    }

    /**
     *
     */
    public long getSize() throws Exception {
        return -1;
    }

    /**
     *
     */
    public boolean exists() throws Exception {
        return true;
    }

    /**
     *
     */
    public java.io.InputStream getContentXML(String viewId) throws Exception {
        StringBuffer sb = new StringBuffer("<?xml version=\"1.0\"?>");
        sb.append(getSitetreeAsXML());
        //sb.append(getSitetreeAsXML(getPath().toString()));

        return new java.io.StringBufferInputStream(sb.toString());
    }

    /**
     * Get sitetree as XML
     */
    private String getSitetreeAsXML() throws Exception {
        String name4pathParameter = "path";
        if (getResourceConfigProperty("name4path-parameter") != null) {
            name4pathParameter = getResourceConfigProperty("name4path-parameter");
        }
        StringBuffer sb = new StringBuffer("<sitetree>");
        if (getEnvironment().getRequest().getParameter(name4pathParameter) != null) {
            sb.append(getNodeAsXML(request.getParameter(name4pathParameter)));
        } else {
            sb.append(getNodeAsXML("/"));
        }

        // TODO: Sitetree generated out of RDF resources and statements
        /*
        com.hp.hpl.jena.rdf.model.Resource rootResource = getRealm().getSitetreeRootResource();
        sb.append(getNodeAsXML(rootResource));
        */
        sb.append("</sitetree>");

        return sb.toString();
    }

{'fraction_non_alphanumeric': 0.12514272664992007, 'fraction_numerical': 0.006850879196163508, 'mean_word_length': 2.6962025316455698, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 2, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5534010', 'n_tokens_mistral': 1306, 'n_tokens_neox': 1291, 'n_words': 218}