Author: scabanovich
Date: 2010-09-30 10:11:44 -0400 (Thu, 30 Sep 2010)
New Revision: 25330
Modified:
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBCoreValidator.java
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferences.java
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidatorMessages.java
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/messages.properties
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBConfigurationBlock.java
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.java
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.properties
Log:
JBIDE-6085
https://jira.jboss.org/browse/JBIDE-6085
Modified:
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBCoreValidator.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBCoreValidator.java 2010-09-30
14:10:38 UTC (rev 25329)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBCoreValidator.java 2010-09-30
14:11:44 UTC (rev 25330)
@@ -109,6 +109,7 @@
private void validateESBConfigFile(XModelObject object, IFile file) {
// System.out.println("Validate ESB Config " + file);
validateChannelIDRefs(object, file);
+ validateActions(object, file);
}
public IStatus validateAll(IProject project,
@@ -181,12 +182,7 @@
if(busEntityPrefix != null && !entity.startsWith(busEntityPrefix)) {
IMarker marker =
addError(ESBValidatorMessages.LISTENER_REFERENCES_INCOMPATIBLE_CHANNEL,
ESBPreferences.LISTENER_REFERENCES_INCOMPATIBLE_CHANNEL,
getSourceReference(listener, ESBConstants.ATTR_BUS_ID_REF), file);
- if(marker != null) try {
- marker.setAttribute(ATTR_PATH, listener.getPath());
- marker.setAttribute(ATTR_ATTRIBUTE, ESBConstants.ATTR_BUS_ID_REF);
- } catch (CoreException e) {
- e.printStackTrace();
- }
+ bindMarkerToPathAndAttribute(marker, listener, ESBConstants.ATTR_BUS_ID_REF);
}
}
}
@@ -230,4 +226,65 @@
public boolean isEnabled(IProject project) {
return true;
}
+
+ void validateActions(XModelObject object, IFile file) {
+ XModelObject servicesFolder = object.getChildByPath("Services");
//$NON-NLS-1$
+ if(servicesFolder == null) return;
+
+ XModelObject[] services = servicesFolder.getChildren();
+ for (XModelObject service: services) {
+ XModelObject actionsFolder = service.getChildByPath("Actions");
//$NON-NLS-1$
+ XModelObject[] actions = actionsFolder.getChildren();
+ for (XModelObject action: actions) {
+ String entity = action.getModelEntity().getName();
+ if(entity.startsWith("ESBPreActionBusinessRulesProcessor")) {
//$NON-NLS-1$
+ validateBusinessRulesProcessor(action, file);
+ } else {
+ //TODO
+ }
+ }
+
+ }
+ }
+
+ static String ATTR_RULE_LANGUAGE = "rule language"; //$NON-NLS-1$
+ static String ATTR_RULE_SET = "rule set"; //$NON-NLS-1$
+ static String ATTR_RULE_AUDIT_INTERVAL = "rule audit interval"; //$NON-NLS-1$
+ static String ATTR_RULE_AUDIT_TYPE = "rule audit type"; //$NON-NLS-1$
+
+ void validateBusinessRulesProcessor(XModelObject object, IFile file) {
+ String lang = object.getAttributeValue(ATTR_RULE_LANGUAGE);
+ if(lang != null && lang.length() > 0) {
+ String ruleSet = object.getAttributeValue(ATTR_RULE_SET);
+ if(ruleSet == null || ruleSet.length() == 0) {
+ IMarker marker = addError(ESBValidatorMessages.INVALID_RULE_SET_FOR_RULE_LANGUAGE,
+ ESBPreferences.BUSINESS_RULES_PROCESSOR_PROBLEMS, getSourceReference(object,
ATTR_RULE_LANGUAGE), file);
+ bindMarkerToPathAndAttribute(marker, object, ATTR_RULE_LANGUAGE);
+ } else if(!ruleSet.endsWith(".dslr")) { //$NON-NLS-1$
+ IMarker marker = addError(ESBValidatorMessages.INVALID_RULE_SET_FOR_RULE_LANGUAGE,
+ ESBPreferences.BUSINESS_RULES_PROCESSOR_PROBLEMS, getSourceReference(object,
ATTR_RULE_SET), file);
+ bindMarkerToPathAndAttribute(marker, object, ATTR_RULE_SET);
+ }
+ }
+
+ String auditInterval = object.getAttributeValue(ATTR_RULE_AUDIT_INTERVAL);
+ if(auditInterval != null && auditInterval.length() > 0) {
+ String auditAuditType = object.getAttributeValue(ATTR_RULE_AUDIT_TYPE);
+ if(!"THREADED_FILE".equals(auditAuditType)) { //$NON-NLS-1$
+ IMarker marker = addError(ESBValidatorMessages.INVALID_RULE_AUDIT_TYPE_AND_INTERVAL,
+ ESBPreferences.BUSINESS_RULES_PROCESSOR_PROBLEMS, getSourceReference(object,
ATTR_RULE_AUDIT_INTERVAL), file);
+ bindMarkerToPathAndAttribute(marker, object, ATTR_RULE_AUDIT_INTERVAL);
+ }
+ }
+ }
+
+ void bindMarkerToPathAndAttribute(IMarker marker, XModelObject object, String attr) {
+ if(marker != null) try {
+ marker.setAttribute(ATTR_PATH, object.getPath());
+ marker.setAttribute(ATTR_ATTRIBUTE, attr);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
}
Modified:
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferences.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferences.java 2010-09-30
14:10:38 UTC (rev 25329)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferences.java 2010-09-30
14:11:44 UTC (rev 25330)
@@ -27,8 +27,9 @@
//Channel ID ref group
- public static final String LISTENER_REFERENCES_NON_EXISTENT_CHANNEL =
INSTANCE.createSeverityOption("listenerReferencesNonExistentChannel");
//$NON-NLS-1
- public static final String LISTENER_REFERENCES_INCOMPATIBLE_CHANNEL =
INSTANCE.createSeverityOption("listenerReferencesIncompatibleChannel");
//$NON-NLS-1
+ public static final String LISTENER_REFERENCES_NON_EXISTENT_CHANNEL =
INSTANCE.createSeverityOption("listenerReferencesNonExistentChannel");
//$NON-NLS-1$
+ public static final String LISTENER_REFERENCES_INCOMPATIBLE_CHANNEL =
INSTANCE.createSeverityOption("listenerReferencesIncompatibleChannel");
//$NON-NLS-1$
+ public static final String BUSINESS_RULES_PROCESSOR_PROBLEMS =
INSTANCE.createSeverityOption("businessRulesProcessorProblems"); //$NON-NLS-1$
/**
* @return the only instance of CDIPreferences
Modified:
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidatorMessages.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidatorMessages.java 2010-09-30
14:10:38 UTC (rev 25329)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidatorMessages.java 2010-09-30
14:11:44 UTC (rev 25330)
@@ -23,6 +23,9 @@
public static String LISTENER_REFERENCES_NON_EXISTENT_CHANNEL;
public static String LISTENER_REFERENCES_INCOMPATIBLE_CHANNEL;
+ public static String INVALID_RULE_SET_FOR_RULE_LANGUAGE;
+ public static String INVALID_RULE_AUDIT_TYPE_AND_INTERVAL;
+
static {
NLS.initializeMessages(BUNDLE_NAME, ESBValidatorMessages.class);
}
Modified:
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/messages.properties
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/messages.properties 2010-09-30
14:10:38 UTC (rev 25329)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/messages.properties 2010-09-30
14:11:44 UTC (rev 25330)
@@ -3,4 +3,7 @@
VALIDATING_PROJECT=project "{0}"
LISTENER_REFERENCES_NON_EXISTENT_CHANNEL=Listener references non-existent channel
-LISTENER_REFERENCES_INCOMPATIBLE_CHANNEL=Listener references incompatible channel
\ No newline at end of file
+LISTENER_REFERENCES_INCOMPATIBLE_CHANNEL=Listener references incompatible channel
+
+INVALID_RULE_SET_FOR_RULE_LANGUAGE=If "ruleLanguage" is specified, the file in
"ruleSet" should be a ".dslr" file
+INVALID_RULE_AUDIT_TYPE_AND_INTERVAL=If "ruleAuditInterval" is specified, it
only applies for a "ruleAuditType" of "THREADED_FILE"
\ No newline at end of file
Modified:
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBConfigurationBlock.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBConfigurationBlock.java 2010-09-30
14:10:38 UTC (rev 25329)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBConfigurationBlock.java 2010-09-30
14:11:44 UTC (rev 25330)
@@ -36,8 +36,17 @@
ESBValidatorPlugin.PLUGIN_ID
);
+ private static SectionDescription SECTION_ACTION_DEFINITIONS = new SectionDescription(
+ ESBPreferencesMessages.ESBValidatorConfigurationBlock_section_actions,
+ new String[][]{
+ {ESBPreferences.BUSINESS_RULES_PROCESSOR_PROBLEMS,
ESBPreferencesMessages.ESBValidatorConfigurationBlock_pb_businessRulesProcessorProblems_label},
+ },
+ ESBValidatorPlugin.PLUGIN_ID
+ );
+
private static SectionDescription[] ALL_SECTIONS = new SectionDescription[]{
SECTION_CHANNEL_ID_REF,
+ SECTION_ACTION_DEFINITIONS,
};
private static Key[] getKeys() {
Modified:
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.java 2010-09-30
14:10:38 UTC (rev 25329)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.java 2010-09-30
14:11:44 UTC (rev 25330)
@@ -27,6 +27,9 @@
public static String
ESBValidatorConfigurationBlock_pb_listenerReferencesNonExistentChannel_label;
public static String
ESBValidatorConfigurationBlock_pb_listenerReferencesIncompatibleChannel_label;
+ public static String ESBValidatorConfigurationBlock_section_actions;
+ public static String
ESBValidatorConfigurationBlock_pb_businessRulesProcessorProblems_label;
+
public static String ESB_VALIDATOR_PREFERENCE_PAGE_ESB_VALIDATOR;
static {
Modified:
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.properties
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.properties 2010-09-30
14:10:38 UTC (rev 25329)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.properties 2010-09-30
14:11:44 UTC (rev 25330)
@@ -16,4 +16,7 @@
ESBValidatorConfigurationBlock_pb_listenerReferencesNonExistentChannel_label=Listener
References Non-existent Channel:
ESBValidatorConfigurationBlock_pb_listenerReferencesIncompatibleChannel_label=Listener
References Incompatible Channel:
+ESBValidatorConfigurationBlock_section_actions=Action Definitions
+ESBValidatorConfigurationBlock_pb_businessRulesProcessorProblems_label=Business Rules
Processor Problems:
+
ESB_VALIDATOR_PREFERENCE_PAGE_ESB_VALIDATOR=ESB Validator