Skip to content

Commit

Permalink
[JBRULES-3480] notify RF deprecation with a KnowledgeBuilder warning
Browse files Browse the repository at this point in the history
  • Loading branch information
mariofusco committed Apr 23, 2012
1 parent 314325f commit be22d5e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
@@ -0,0 +1,28 @@
package org.drools.compiler;

import org.drools.io.Resource;
import org.drools.io.internal.InternalResource;

public class DeprecatedResourceTypeWarning extends DroolsWarning {

private final String deprecatedFormat;

public DeprecatedResourceTypeWarning(Resource resource) {
this(resource, ((InternalResource) resource).getResourceType().getName());
}

public DeprecatedResourceTypeWarning(Resource resource, String deprecatedFormat) {
super(resource);
this.deprecatedFormat = deprecatedFormat;
}

@Override
public String getMessage() {
return deprecatedFormat + " format usage detected. This format is deprecated and will be removed in future";
}

@Override
public int[] getLines() {
return new int[0];
}
}
@@ -0,0 +1,16 @@
package org.drools.compiler;

import org.drools.builder.ResultSeverity;
import org.drools.io.Resource;

public abstract class DroolsWarning extends BaseKnowledgeBuilderResultImpl {

public DroolsWarning(Resource resource) {
super(resource);
}

@Override
public ResultSeverity getSeverity() {
return ResultSeverity.WARNING;
}
}
Expand Up @@ -641,7 +641,7 @@ public void addProcessFromXml( Resource resource ) {
}

if ( ResourceType.DRF.equals( ( (InternalResource) resource ).getResourceType() ) ) {
System.err.println("RF format usage detected. This format is deprecated and will be removed in future");
this.results.add( new DeprecatedResourceTypeWarning(resource, "RF") );
}

this.resource = resource;
Expand Down

0 comments on commit be22d5e

Please sign in to comment.