org.jwall.apache.httpd.config.ExpandedMacro Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of apache-config Show documentation
Show all versions of apache-config Show documentation
A Java library for reading Apache httpd configuration files
The newest version!
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* Copyright (C) 2010-2014 Christian Bockermann
*
* This file is part of the jwall.org apache-config library. The apache-config library is
* a parsing library to handle Apache HTTPD configuration files.
*
* More information and documentation for the jwall-tools can be found at
*
* http://www.jwall.org/apache-config
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 3 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this
* program; if not, see .
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
package org.jwall.apache.httpd.config;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
public class ExpandedMacro extends ApacheConfig {
/** The unique class id */
private static final long serialVersionUID = 1607004770867810447L;
String macro;
final ArrayList params = new ArrayList();
public ExpandedMacro(File file, Collection parameters) {
super(file);
for (String param : parameters) {
params.add(param);
}
}
public ExpandedMacro(ApacheConfig c) {
super(c.file);
for (AbstractDirective d : c.nested) {
this.add(d);
}
}
public String getMacro() {
return macro;
}
public void setMacro(String macro) {
this.macro = macro;
}
public List getParameters() {
return params;
}
public String toXML() {
StringBuffer s = new StringBuffer("<" + name + " file=\"");
s.append(this.location.toString());
s.append("\"");
s.append(" macro=\"" + macro + "\"");
s.append(" params=\"");
Iterator it = params.iterator();
while (it.hasNext()) {
String p = it.next();
s.append(p);
if (it.hasNext()) {
s.append(" ");
}
}
s.append("\"");
s.append(">\n");
for (Directive child : this.nested) {
s.append(child.toXML());
}
s.append("" + name + ">\n");
return s.toString();
// return getXStream().toXML( cfg );
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy