use of com.thoughtworks.xstream.security.TypePermission in project camel by apache.
the class XStreamUtils method addPermissions.
public static void addPermissions(XStream xstream, String permissions) {
for (String pterm : permissions.split(",")) {
boolean aod;
pterm = pterm.trim();
if (pterm.startsWith("-")) {
aod = false;
pterm = pterm.substring(1);
} else {
aod = true;
if (pterm.startsWith("+")) {
pterm = pterm.substring(1);
}
}
TypePermission typePermission = null;
if ("*".equals(pterm)) {
// accept or deny any
typePermission = AnyTypePermission.ANY;
} else if (pterm.indexOf('*') < 0) {
// exact type
typePermission = new ExplicitTypePermission(new String[] { pterm });
} else if (pterm.length() > 0) {
// wildcard type
typePermission = new WildcardTypePermission(new String[] { pterm });
}
if (typePermission != null) {
if (aod) {
xstream.addPermission(typePermission);
} else {
xstream.denyPermission(typePermission);
}
}
}
}
use of com.thoughtworks.xstream.security.TypePermission in project camel by apache.
the class AbstractXStreamWrapper method addPermissions.
private static void addPermissions(XStream xstream, String permissions) {
for (String pterm : permissions.split(",")) {
boolean aod;
pterm = pterm.trim();
if (pterm.startsWith("-")) {
aod = false;
pterm = pterm.substring(1);
} else {
aod = true;
if (pterm.startsWith("+")) {
pterm = pterm.substring(1);
}
}
TypePermission typePermission = null;
if ("*".equals(pterm)) {
// accept or deny any
typePermission = AnyTypePermission.ANY;
} else if (pterm.indexOf('*') < 0) {
// exact type
typePermission = new ExplicitTypePermission(new String[] { pterm });
} else if (pterm.length() > 0) {
// wildcard type
typePermission = new WildcardTypePermission(new String[] { pterm });
}
if (typePermission != null) {
if (aod) {
xstream.addPermission(typePermission);
} else {
xstream.denyPermission(typePermission);
}
}
}
}
Aggregations