use of com.mindbright.security.x509.Attribute in project mule-migration-assistant by mulesoft.
the class AbstractFilterMigrator method handleFilter.
protected void handleFilter(Element filter) {
if (filter.getAttribute("name") != null) {
Attribute nameAttribute = filter.getAttribute("name");
if (filter.getAttribute("name", DOCS_NAMESPACE) != null) {
nameAttribute.detach();
} else {
filter.getDocument().getRootElement().addNamespaceDeclaration(DOCS_NAMESPACE);
nameAttribute.setNamespace(DOCS_NAMESPACE);
}
}
if (!(filter.getParentElement().getNamespace().equals(VALIDATION_NAMESPACE) && filter.getParentElement().getName().endsWith("filter"))) {
Element flow = getContainerElement(filter);
if (flow != null) {
if ("flow".equals(flow.getName())) {
Element errorHandler = getFlowExceptionHandlingElement(flow);
if (errorHandler == null) {
errorHandler = new Element("error-handler", CORE_NAMESPACE);
flow.addContent(errorHandler);
}
resolveValidationHandler(errorHandler);
} else {
Element wrappingTry = new Element("try", CORE_NAMESPACE);
addElementAfter(wrappingTry, filter);
wrappingTry.addContent(filter.clone());
filter.detach();
Element errorHandler = new Element("error-handler", CORE_NAMESPACE);
wrappingTry.addContent(errorHandler);
resolveValidationHandler(errorHandler);
}
}
}
}
use of com.mindbright.security.x509.Attribute in project mule-migration-assistant by mulesoft.
the class BatchHistoryExpiration method execute.
@Override
public void execute(Element object, MigrationReport report) throws RuntimeException {
Attribute maxAge = object.getAttribute("max-age");
if (maxAge != null) {
maxAge.setName("maxAge");
}
Attribute ageUnit = object.getAttribute("age-unit");
if (ageUnit != null) {
ageUnit.setName("ageUnit");
}
}
use of com.mindbright.security.x509.Attribute in project mule-migration-assistant by mulesoft.
the class AbstractCompressionMigrationStep method removeArgumentAndReport.
protected void removeArgumentAndReport(Element element, String argumentName, String reportEntryKey, MigrationReport report) {
Attribute attribute = element.getAttribute(argumentName);
if (attribute != null) {
report.report(reportEntryKey, element, element);
element.removeAttribute(attribute);
}
}
use of com.mindbright.security.x509.Attribute in project mule-migration-assistant by mulesoft.
the class RollbackExceptionStrategy method execute.
@Override
public void execute(Element element, MigrationReport report) throws RuntimeException {
changeNodeName("", "on-error-propagate").apply(element);
encapsulateException(element);
boolean hadWhen = element.getAttribute("when") != null;
migrateWhenExpression(element);
if (element.getAttribute("maxRedeliveryAttempts") != null) {
Attribute maxRedelivery = element.getAttribute("maxRedeliveryAttempts");
maxRedelivery.detach();
Element flow = getContainerElement(element);
if (flow != null && !flow.getChildren().isEmpty()) {
Element source = flow.getChildren().get(0);
if (source.getAttribute("isMessageSource", Namespace.getNamespace("migration")) != null) {
Element redelivery = source.getChild("idempotent-redelivery-policy", CORE_NAMESPACE);
if (redelivery != null) {
redelivery.setName("redelivery-policy");
Attribute exprAttr = redelivery.getAttribute("idExpression");
exprAttr.setValue(getExpressionMigrator().migrateExpression(exprAttr.getValue(), true, redelivery));
Attribute maxRedeliveryCountAtt = redelivery.getAttribute("maxRedeliveryCount");
if (maxRedeliveryCountAtt != null) {
maxRedeliveryCountAtt.setValue(maxRedelivery.getValue());
} else {
redelivery.setAttribute("maxRedeliveryCount", maxRedelivery.getValue());
}
if (getExpressionMigrator().isWrapped(exprAttr.getValue())) {
exprAttr.setValue(getExpressionMigrator().wrap(getExpressionMigrator().migrateExpression(exprAttr.getValue(), true, element)));
}
migrateRedeliveryPolicyChildren(redelivery, report);
} else {
Element redeliveryPolicy = new Element("redelivery-policy");
redeliveryPolicy.setNamespace(CORE_NAMESPACE);
redeliveryPolicy.setAttribute("maxRedeliveryCount", maxRedelivery.getValue());
source.addContent(0, redeliveryPolicy);
}
}
} else {
report.report("errorHandling.redelivery", element, element);
}
}
if (element.getChild("on-redelivery-attempts-exceeded", element.getNamespace()) != null) {
Element redeliverySection = element.getChild("on-redelivery-attempts-exceeded", element.getNamespace());
redeliverySection.detach();
Element newOnError = new Element("on-error-propagate");
newOnError.setNamespace(element.getNamespace());
newOnError.setAttribute("type", "REDELIVERY_EXHAUSTED");
List<Element> redeliveryElements = new ArrayList<>();
element.getChildren().forEach(e -> redeliveryElements.add(e.clone()));
redeliverySection.getChildren().forEach(e -> {
e.detach();
redeliveryElements.add(e);
});
newOnError.addContent(redeliveryElements);
element.getParentElement().addContent(newOnError);
if (!hadWhen) {
element.detach();
}
}
}
use of com.mindbright.security.x509.Attribute in project mule-migration-assistant by mulesoft.
the class SpringImport method execute.
@Override
public void execute(Element element, MigrationReport report) throws RuntimeException {
Attribute resource = element.getAttribute("resource");
Element parent = element.getParentElement();
if (resource != null && isMuleConfigFile(resource.getValue(), getApplicationModel().getProjectBasePath())) {
element.setNamespace(CORE_NAMESPACE);
resource.setName("file");
element.detach();
addTopLevelElement(element, parent.getDocument());
}
if (parent.getChildren().isEmpty()) {
parent.detach();
}
}
Aggregations