[jbosstools-issues] [JBoss JIRA] (JBIDE-17469) Find proper way to check for allowed/supported runtime (no mo' strings please)

Rob Stryker (JIRA) issues at jboss.org
Thu May 29 02:37:16 EDT 2014


    [ https://issues.jboss.org/browse/JBIDE-17469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12971478#comment-12971478 ] 

Rob Stryker commented on JBIDE-17469:
-------------------------------------

I did a grep on your repo, and it seems your plugins don't currently depend on the servertools code (jbosstools-server) except in your test plugins. 

If you were willing to have a dependency on org.jboss.ide.eclipse.as.wtp.core, basically our API plugin without implementation, you could check if the runtime type is in the IJBossToolingConstants.ALL_JBOSS_RUNTIMES  array. 

If you're not willing to have such a dependency, then I see that your UI code has the following string constants declared:

plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/project/facet/JBossWSRuntimeConfigBlock.java:	private final static String JBOSS_IDE_AS_RUNTIME_ID = "org.jboss.ide.eclipse.as.runtime"; //$NON-NLS-1$

plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/project/facet/JBossWSRuntimeConfigBlock.java:	private final static String JBOSS_IDE_EAP_RUNTIME_ID = "org.jboss.ide.eclipse.as.runtime.eap"; //$NON-NLS-1$




You would need to move these constants to core, and add one for wildfly "org.jboss.ide.eclipse.as.runtime.wildfly" and use these as prefixes to compare against. 

Comparing for the string type "jboss" is too vague, as it could conceivably get the upstream jboss generic server adapter and runtime types which used to be contributed by WTP. Admittedly, they're no longer included in stock wtp, but, its still possible people have them. To avoid false positives, you'll want to compare the entire string constant, or at least a healthy enough prefix. "JBOSS" is not a large enough string to compare against. 

If you wanted to compare exact ID's and NOT depend on servertools, then your only option is to copy all the constants into your plugin, but that would mean you'd need to maintain a duplicate list on your own and update it whenever we update ours. 

> Find proper way to check for allowed/supported runtime (no mo' strings please)
> ------------------------------------------------------------------------------
>
>                 Key: JBIDE-17469
>                 URL: https://issues.jboss.org/browse/JBIDE-17469
>             Project: Tools (JBoss Tools)
>          Issue Type: Task
>          Components: webservices
>    Affects Versions: 4.1.1.Final
>            Reporter: Radoslav Rábara
>            Assignee: Brian Fitzpatrick
>              Labels: respin-a
>             Fix For: 4.2.0.Beta3
>
>
> JBIDE-17247 was fixed by using String comparison. There must be a more robust way to check for the appropriate runtime. 
> [~rob.stryker], please advise.



--
This message was sent by Atlassian JIRA
(v6.2.3#6260)



More information about the jbosstools-issues mailing list