Run Application View Source Code

Orbeon Forms Apps

Orbeon Forms Source Code Viewer

Loading...
An error has occurred

You may want to try one of the following:

  • Close this dialog and continue to use this page.
  • Reload this page. Note that you will lose any unsaved changes.
  • If the above does not work, try reloading the page yourself. Note that you will lose any unsaved changes:

    • With Firefox: hold down the shift key and click the Reload button in your browser toolbar.
    • With Safari and Chrome: click the Reload button in your browser toolbar.
    • With Internet Explorer: hold down the control key and click the Reload button in your browser toolbar.
  • Return home.
Help
View as text View as text View as formatted XML View as formatted XML Download Download
SystemProperties.java 2,878
model.xpl 1,036
page-flow.xml 894
view.xsl 2,331
/**
 *  Copyright (C) 2004 Orbeon, Inc.
 *
 *  This program is free software; you can redistribute it and/or modify it under the terms of the
 *  GNU Lesser General Public License as published by the Free Software Foundation; either version
 *  2.1 of the License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *  See the GNU Lesser General Public License for more details.
 *
 *  The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
 */
import org.orbeon.oxf.processor.SimpleProcessor;
import org.orbeon.oxf.processor.ProcessorInputOutputInfo;
import org.orbeon.oxf.pipeline.api.PipelineContext;
import org.xml.sax.SAXException;
import org.xml.sax.ContentHandler;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.AttributesImpl;

import java.util.Enumeration;
import java.util.Properties;

public class SystemProperties extends SimpleProcessor {

    private static final Attributes NO_ATTRIBUTES = new AttributesImpl();

    public SystemProperties() {
        addOutputInfo(new ProcessorInputOutputInfo(OUTPUT_DATA));
    }

    public void generateData(PipelineContext context, ContentHandler contentHandler) throws SAXException {
        
        contentHandler.startDocument();
        contentHandler.startElement("", "properties", "properties", NO_ATTRIBUTES);
        Properties systemProperties = System.getProperties();
        for (Enumeration i = systemProperties.propertyNames(); i.hasMoreElements();) {
            String name = (String) i.nextElement();
            String value = systemProperties.getProperty(name);
            if(value != null)
                outputProperty(contentHandler, name, value);
        }

// final org.orbeon.oxf.pipeline.api.ExternalContext externalContext = org.orbeon.oxf.xforms.XFormsUtils.getExternalContext(context);
//       outputProperty(contentHandler, "xxx", externalContext.getRequest().getRemoteUser());

        contentHandler.endElement("", "properties", "properties");
        contentHandler.endDocument();
    }

    private static void outputProperty(ContentHandler contentHandler, String name, String value) throws SAXException {
        contentHandler.startElement("", "property", "property", NO_ATTRIBUTES);
        contentHandler.startElement("", "name", "name", NO_ATTRIBUTES);
        contentHandler.characters(name.toCharArray(), 0, name.length());
        contentHandler.endElement("", "name", "name");
        contentHandler.startElement("", "value", "value", NO_ATTRIBUTES);
        contentHandler.characters(value.toCharArray(), 0, value.length());
        contentHandler.endElement("", "value", "value");
        contentHandler.endElement("", "property", "property");
    }
}

Orbeon Forms Orbeon Forms 3.8.0.201005142210 PE