Author: scabanovich
Date: 2011-12-29 20:02:44 -0500 (Thu, 29 Dec 2011)
New Revision: 37586
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-10573
https://issues.jboss.org/browse/JBIDE-10573
Attribute 'scheduleidref' validation.
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 2011-12-30
01:00:56 UTC (rev 37585)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBCoreValidator.java 2011-12-30
01:02:44 UTC (rev 37586)
@@ -148,6 +148,7 @@
private void validateESBConfigFile(XModelObject object, IFile file) {
validateChannelIDRefs(object, file);
+ validateScheduleIDRefs(object, file);
validateActions(object, file);
}
@@ -267,6 +268,53 @@
return result;
}
+ void validateScheduleIDRefs(XModelObject object, IFile file) {
+ XModelObject servicesFolder = object.getChildByPath("Services");
//$NON-NLS-1$
+ if(servicesFolder == null) return;
+ Set<String> ids = getAllScheduleRefIDs(object);
+ XModelObject[] services = servicesFolder.getChildren();
+ for (XModelObject service: services) {
+ XModelObject listenersFolder = service.getChildByPath("Listeners");
//$NON-NLS-1$
+ XModelObject[] listeners = listenersFolder.getChildren();
+ for (XModelObject listener: listeners) {
+ String scheduleIDRef =
listener.getAttributeValue(ESBConstants.ATTR_SCHEDULE_ID_REF);
+ if(scheduleIDRef == null) continue;
+ if(scheduleIDRef.length() == 0) {
+ //no id set, it is not an error
+ } else if(!ids.contains(scheduleIDRef)) {
+ //addError - no id found
+ IMarker marker =
addError(ESBValidatorMessages.LISTENER_REFERENCES_NON_EXISTENT_SCHEDULE,
+ ESBPreferences.LISTENER_REFERENCES_NON_EXISTENT_SCHEDULE,
getSourceReference(listener, ESBConstants.ATTR_SCHEDULE_ID_REF), file);
+ if(marker != null) try {
+ marker.setAttribute(ATTR_PATH, listener.getPath());
+ marker.setAttribute(ATTR_ATTRIBUTE, ESBConstants.ATTR_SCHEDULE_ID_REF);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+
+ private Set<String> getAllScheduleRefIDs(XModelObject object) {
+ Set<String> result = new HashSet<String>();
+ XModelObject[] ps = object.getChildByPath("Providers").getChildren();
//$NON-NLS-1$
+ for (int i = 0; i < ps.length; i++) {
+ XModelObject[] cs = ps[i].getChildren();
+ for (int j = 0; j < cs.length; j++) {
+ if(cs[j].getModelEntity().getAttribute(ESBConstants.ATTR_SCHEDULE_ID) != null) {
+ String v = cs[j].getAttributeValue(ESBConstants.ATTR_SCHEDULE_ID);
+ if(v != null && v.length() > 0) {
+ result.add(v);
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+
ITextSourceReference getSourceReference(XModelObject o, String attr) {
return new XMLValueInfo(o, attr);
}
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 2011-12-30
01:00:56 UTC (rev 37585)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBPreferences.java 2011-12-30
01:02:44 UTC (rev 37586)
@@ -29,6 +29,12 @@
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$
+
+ //Schedule ID ref group
+
+ public static final String LISTENER_REFERENCES_NON_EXISTENT_SCHEDULE =
INSTANCE.createSeverityOption("listenerReferencesNonExistentSchedule");
//$NON-NLS-1$
+
+ //Actions
public static final String BUSINESS_RULES_PROCESSOR_PROBLEMS =
INSTANCE.createSeverityOption("businessRulesProcessorProblems"); //$NON-NLS-1$
/**
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 2011-12-30
01:00:56 UTC (rev 37585)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ESBValidatorMessages.java 2011-12-30
01:02:44 UTC (rev 37586)
@@ -23,6 +23,8 @@
public static String LISTENER_REFERENCES_NON_EXISTENT_CHANNEL;
public static String LISTENER_REFERENCES_INCOMPATIBLE_CHANNEL;
+ public static String LISTENER_REFERENCES_NON_EXISTENT_SCHEDULE;
+
public static String INVALID_RULE_SET_FOR_RULE_LANGUAGE;
public static String INVALID_RULE_AUDIT_TYPE_AND_INTERVAL;
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 2011-12-30
01:00:56 UTC (rev 37585)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/messages.properties 2011-12-30
01:02:44 UTC (rev 37586)
@@ -5,6 +5,8 @@
LISTENER_REFERENCES_NON_EXISTENT_CHANNEL=Listener references non-existent channel
LISTENER_REFERENCES_INCOMPATIBLE_CHANNEL=Listener references incompatible channel
+LISTENER_REFERENCES_NON_EXISTENT_SCHEDULE=Listener references non-existent schedule
+
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"
INVALID_OBJECT_PATH_WRONG_LOCATION=Invalid object-path: location should be one of body,
header, properties, attachment
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 2011-12-30
01:00:56 UTC (rev 37585)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBConfigurationBlock.java 2011-12-30
01:02:44 UTC (rev 37586)
@@ -26,7 +26,7 @@
*/
public class ESBConfigurationBlock extends SeverityConfigurationBlock {
- private static final String SETTINGS_SECTION_NAME =
"CDIValidatorConfigurationBlock";
+ private static final String SETTINGS_SECTION_NAME =
"CDIValidatorConfigurationBlock"; //$NON-NLS-1$
private static SectionDescription SECTION_CHANNEL_ID_REF = new SectionDescription(
ESBPreferencesMessages.ESBValidatorConfigurationBlock_section_channelidref,
@@ -37,16 +37,25 @@
ESBValidatorPlugin.PLUGIN_ID
);
+ private static SectionDescription SECTION_SCHEDULE_ID_REF = new SectionDescription(
+ ESBPreferencesMessages.ESBValidatorConfigurationBlock_section_scheduleidref,
+ new String[][]{
+ {ESBPreferences.LISTENER_REFERENCES_NON_EXISTENT_SCHEDULE,
ESBPreferencesMessages.ESBValidatorConfigurationBlock_pb_listenerReferencesNonExistentSchedule_label},
+ },
+ 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
- );
+ ESBPreferencesMessages.ESBValidatorConfigurationBlock_section_actions,
+ new String[][]{
+ {ESBPreferences.BUSINESS_RULES_PROCESSOR_PROBLEMS,
ESBPreferencesMessages.ESBValidatorConfigurationBlock_pb_businessRulesProcessorProblems_label},
+ },
+ ESBValidatorPlugin.PLUGIN_ID
+ );
public static SectionDescription[] ALL_SECTIONS = new SectionDescription[]{
SECTION_CHANNEL_ID_REF,
+ SECTION_SCHEDULE_ID_REF,
SECTION_ACTION_DEFINITIONS,
};
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 2011-12-30
01:00:56 UTC (rev 37585)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.java 2011-12-30
01:02:44 UTC (rev 37586)
@@ -22,11 +22,15 @@
// Validator Preference page
public static String ESBValidatorConfigurationBlock_common_description;
- // Section Name
+ // Section Channel ID Ref
public static String ESBValidatorConfigurationBlock_section_channelidref;
public static String
ESBValidatorConfigurationBlock_pb_listenerReferencesNonExistentChannel_label;
public static String
ESBValidatorConfigurationBlock_pb_listenerReferencesIncompatibleChannel_label;
+ // Section Schedule ID Ref
+ public static String ESBValidatorConfigurationBlock_section_scheduleidref;
+ public static String
ESBValidatorConfigurationBlock_pb_listenerReferencesNonExistentSchedule_label;
+
public static String ESBValidatorConfigurationBlock_section_actions;
public static String
ESBValidatorConfigurationBlock_pb_businessRulesProcessorProblems_label;
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 2011-12-30
01:00:56 UTC (rev 37585)
+++
trunk/esb/plugins/org.jboss.tools.esb.validator/src/org/jboss/tools/esb/validator/ui/ESBPreferencesMessages.properties 2011-12-30
01:02:44 UTC (rev 37586)
@@ -16,6 +16,10 @@
ESBValidatorConfigurationBlock_pb_listenerReferencesNonExistentChannel_label=Listener
References Non-existent Channel:
ESBValidatorConfigurationBlock_pb_listenerReferencesIncompatibleChannel_label=Listener
References Incompatible Channel:
+##Section Schedule ID Ref
+ESBValidatorConfigurationBlock_section_scheduleidref=Schedule ID Ref
+ESBValidatorConfigurationBlock_pb_listenerReferencesNonExistentSchedule_label=Listener
References Non-existent Schedule:
+
ESBValidatorConfigurationBlock_section_actions=Action Definitions
ESBValidatorConfigurationBlock_pb_businessRulesProcessorProblems_label=Business Rules
Processor Problems: