List of usage examples for org.apache.commons.configuration PropertiesConfiguration setProperty
public void setProperty(String key, Object value)
From source file:org.xwiki.contrib.confluence.filter.internal.ConfluenceXMLPackage.java
private long readObjectProperties(XMLStreamReader xmlReader, PropertiesConfiguration properties) throws XMLStreamException, FilterException { long id = -1; for (xmlReader.nextTag(); xmlReader.isStartElement(); xmlReader.nextTag()) { String elementName = xmlReader.getLocalName(); if (elementName.equals("id")) { String idName = xmlReader.getAttributeValue(null, "name"); if (idName != null && idName.equals("id")) { id = Long.valueOf(xmlReader.getElementText()); properties.setProperty("id", id); } else { StAXUtils.skipElement(xmlReader); }/*from ww w .j a v a 2 s . c o m*/ } else if (elementName.equals("property") || elementName.equals("collection")) { String propertyName = xmlReader.getAttributeValue(null, "name"); properties.setProperty(propertyName, readProperty(xmlReader)); } else { StAXUtils.skipElement(xmlReader); } } return id; }
From source file:org.xwiki.contrib.confluence.filter.internal.ConfluenceXMLPackage.java
private void readSpaceDescriptionObject(XMLStreamReader xmlReader) throws XMLStreamException, FilterException, ConfigurationException { PropertiesConfiguration properties = newProperties(); long descriptionId = readObjectProperties(xmlReader, properties); properties.setProperty(KEY_PAGE_HOMEPAGE, true); // Save page/*from w w w . j a v a 2 s . c o m*/ savePageProperties(properties, descriptionId); }
From source file:org.xwiki.contrib.confluence.filter.internal.ConfluenceXMLPackage.java
private void readMembershipObject(XMLStreamReader xmlReader) throws ConfigurationException, XMLStreamException, FilterException { PropertiesConfiguration properties = newProperties(); readObjectProperties(xmlReader, properties); Long parentGroup = properties.getLong("parentGroup", null); if (parentGroup != null) { PropertiesConfiguration groupProperties = getGroupProperties(parentGroup); Long userMember = properties.getLong("userMember", null); if (userMember != null) { List<Long> users = new ArrayList<>( getLongList(groupProperties, KEY_GROUP_MEMBERUSERS, Collections.<Long>emptyList())); users.add(userMember);//w w w .java2 s. c o m groupProperties.setProperty(KEY_GROUP_MEMBERUSERS, users); } Long groupMember = properties.getLong("groupMember", null); if (groupMember != null) { List<Long> groups = new ArrayList<>( getLongList(groupProperties, KEY_GROUP_MEMBERGROUPS, Collections.<Long>emptyList())); groups.add(groupMember); groupProperties.setProperty(KEY_GROUP_MEMBERGROUPS, groups); } saveObjectProperties("groups", groupProperties, parentGroup); } }
From source file:org.xwiki.filter.confluence.xml.internal.ConfluenceXMLPackage.java
private int readObjectProperties(XMLStreamReader xmlReader, PropertiesConfiguration properties) throws XMLStreamException, FilterException, ConfigurationException, IOException { int id = -1;//from w w w. ja v a 2 s.co m for (xmlReader.nextTag(); xmlReader.isStartElement(); xmlReader.nextTag()) { String elementName = xmlReader.getLocalName(); if (elementName.equals("id")) { id = Integer.valueOf(xmlReader.getElementText()); properties.setProperty("id", id); } else if (elementName.equals("property")) { String propertyName = xmlReader.getAttributeValue(null, "name"); properties.setProperty(propertyName, readProperty(xmlReader)); } else if (elementName.equals("collection")) { String propertyName = xmlReader.getAttributeValue(null, "name"); properties.setProperty(propertyName, readProperty(xmlReader)); } else { StAXUtils.skipElement(xmlReader); } } return id; }
From source file:org.xwiki.filter.confluence.xml.internal.ConfluenceXMLPackage.java
private void readSpaceDescriptionObject(XMLStreamReader xmlReader) throws XMLStreamException, FilterException, ConfigurationException, IOException { PropertiesConfiguration properties = newProperties(); int descriptionId = readObjectProperties(xmlReader, properties); properties.setProperty(KEY_PAGE_HOMEPAGE, true); // Save page/*w w w. j a v a2s .co m*/ savePageProperties(properties, descriptionId); }
From source file:org.xwiki.filter.confluence.xml.internal.ConfluenceXMLPackage.java
private void readMembershipObject(XMLStreamReader xmlReader) throws ConfigurationException, XMLStreamException, FilterException, IOException { PropertiesConfiguration properties = newProperties(); readObjectProperties(xmlReader, properties); Integer parentGroup = properties.getInteger("parentGroup", null); if (parentGroup != null) { PropertiesConfiguration groupProperties = getGroupProperties(parentGroup); Integer userMember = properties.getInteger("userMember", null); if (userMember != null) { List<Integer> users = new ArrayList<Integer>( getIntegertList(groupProperties, KEY_GROUP_MEMBERUSERS, Collections.<Integer>emptyList())); users.add(userMember);//from w w w. jav a 2s.c o m groupProperties.setProperty(KEY_GROUP_MEMBERUSERS, users); } Integer groupMember = properties.getInteger("groupMember", null); if (groupMember != null) { List<Integer> groups = new ArrayList<Integer>( getIntegertList(groupProperties, KEY_GROUP_MEMBERGROUPS, Collections.<Integer>emptyList())); groups.add(groupMember); groupProperties.setProperty(KEY_GROUP_MEMBERGROUPS, groups); } saveGroupProperties(groupProperties, parentGroup); } }
From source file:org.xwiki.test.cluster.AllTests.java
private void initChannel(XWikiExecutor executor, String channelName) throws Exception { PropertiesConfiguration properties = executor.loadXWikiPropertiesConfiguration(); properties.setProperty("observation.remote.enabled", "true"); properties.setProperty("observation.remote.channels", channelName); executor.saveXWikiProperties(properties); // Force bind_addr since tcp jgroups configuration expect cluster members to listen localhost by default executor.setXWikiOpts("-Djgroups.bind_addr=localhost -Xmx512m -XX:MaxPermSize=128m"); }
From source file:org.xwiki.test.escaping.framework.SingleXWikiExecutor.java
/** * {@inheritDoc}/*from w w w .ja va 2s . c om*/ * * Starts the server on the first call, subsequent calls only increase the internal counter by one. */ @Override public synchronized void start() throws Exception { if (counter == 0) { if (!VERIFY_RUNNING_XWIKI_AT_START.equals("true") || isXWikiStarted(getURL(), 15).timedOut) { // Disable extensions manager external repositories PropertiesConfiguration properties = loadXWikiPropertiesConfiguration(); if (!properties.containsKey("extension.repositories")) { properties.setProperty("extension.repositories", ""); } saveXWikiProperties(properties); } super.start(); } counter++; }
From source file:org.xwiki.test.integration.XWikiTestSetup.java
public XWikiTestSetup(Test test, int nb) throws Exception { super(test);/*ww w . j ava2s. c o m*/ for (int i = 0; i < nb; ++i) { XWikiExecutor executor = new XWikiExecutor(i); PropertiesConfiguration properties = executor.loadXWikiPropertiesConfiguration(); // Don't set any extension repository since we don't need it and we don't want to require internet // connection for the tests. properties.setProperty("extension.repositories", ""); executor.saveXWikiProperties(properties); this.executors.add(executor); } }
From source file:org.xwiki.test.selenium.AllTests.java
@XWikiExecutorSuite.PreStart public void preStart(List<XWikiExecutor> executors) throws Exception { // Put back the old WYSIWYG editor in xwiki.properties XWikiExecutor executor = executors.get(0); PropertiesConfiguration properties = executor.loadXWikiPropertiesConfiguration(); properties.setProperty("edit.defaultEditor.org.xwiki.rendering.syntax.SyntaxContent#wysiwyg", "gwt"); executor.saveXWikiProperties(properties); }