Author: scabanovich
Date: 2010-01-15 10:56:12 -0500 (Fri, 15 Jan 2010)
New Revision: 19776
Added:
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/ESBDefaultVersionResolver.java
Modified:
trunk/esb/plugins/org.jboss.tools.esb.core/META-INF/MANIFEST.MF
trunk/esb/plugins/org.jboss.tools.esb.core/plugin.xml
trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddProviderSupport.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5484
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/META-INF/MANIFEST.MF 2010-01-15 15:48:35
UTC (rev 19775)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/META-INF/MANIFEST.MF 2010-01-15 15:56:12
UTC (rev 19776)
@@ -12,6 +12,7 @@
org.jboss.tools.esb.core.model.handlers,
org.jboss.tools.esb.core.model.impl
Require-Bundle: org.jboss.tools.jst.web;visibility:=reexport,
- org.eclipse.ui
+ org.eclipse.ui,
+ org.jboss.tools.esb.project.core
Bundle-Version: 2.0.0
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/plugin.xml
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/plugin.xml 2010-01-15 15:48:35 UTC (rev
19775)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/plugin.xml 2010-01-15 15:56:12 UTC (rev
19776)
@@ -51,6 +51,9 @@
class="org.jboss.tools.esb.core.model.handlers.OpenESBResourceHandler"/>
<xclass
id="org.jboss.tools.esb.core.model.handlers.AddJBRListerer12Handler"
class="org.jboss.tools.esb.core.model.handlers.AddJBRListerer12Handler"/>
+
+ <xclass
id="org.jboss.tools.esb.core.model.handlers.ESBDefaultVersionResolver"
+ class="org.jboss.tools.esb.core.model.handlers.ESBDefaultVersionResolver"/>
<xclass id="org.jboss.tools.esb.core.model.ESBResourceTree"
class="org.jboss.tools.esb.core.model.ESBResourceTree"/>
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta 2010-01-15 15:48:35
UTC (rev 19775)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta 2010-01-15 15:56:12
UTC (rev 19776)
@@ -680,7 +680,8 @@
</XActionItem>
<XDependencies/>
</XModelEntity>
- <XModelEntity
ImplementingClass="org.jboss.tools.esb.core.model.impl.FTPMessageFilterImpl"
+ <XModelEntity
+ ImplementingClass="org.jboss.tools.esb.core.model.impl.FTPMessageFilterImpl"
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;saveDefault=false"
XMLSUBPATH="ftp-message-filter" name="ESBFTPMessageFilter101">
<XChildrenEntities/>
@@ -2932,7 +2933,7 @@
<XActionItem displayName="JBoss ESB" kind="list"
name="ESB">
<XActionItem HIDE="always"
HandlerClassName="%SpecialWizard%"
ICON="action.new.seam.faces-config"
-
PROPERTIES="entity=FileESB101;extensions=.xml.;validator.addfile=true;support=org.jboss.tools.common.model.files.handlers.CreateFileSupport;extension=xml;entityVersion=ESB"
+
PROPERTIES="entity=FileESB101;extensions=.xml.;validator.addfile=true;support=org.jboss.tools.common.model.files.handlers.CreateFileSupport;extension=xml;entityVersion=ESB;defaultVersionResolver=org.jboss.tools.esb.core.model.handlers.ESBDefaultVersionResolver"
displayName="JBoss ESB File..." kind="action"
name="CreateFileESB">
<EntityData EntityName="NewFileWizard">
<AttributeData AttributeName="folder"/>
@@ -2963,7 +2964,7 @@
<XActionItem displayName="JBoss ESB" kind="list"
name="ESB">
<XActionItem HIDE="always"
HandlerClassName="%SpecialWizard%"
ICON="action.new.seam.faces-config"
-
PROPERTIES="entity=FileESB101;extensions=.xml.;validator.addfile=true;support=org.jboss.tools.common.model.files.handlers.CreateFileSupport;extension=xml;entityVersion=ESB"
+
PROPERTIES="entity=FileESB101;extensions=.xml.;validator.addfile=true;support=org.jboss.tools.common.model.files.handlers.CreateFileSupport;extension=xml;entityVersion=ESB;defaultVersionResolver=org.jboss.tools.esb.core.model.handlers.ESBDefaultVersionResolver"
displayName="JBoss ESB File..." kind="action"
name="CreateFileESB">
<EntityData EntityName="NewFileWizard">
<AttributeData AttributeName="folder"/>
Modified:
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddProviderSupport.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddProviderSupport.java 2010-01-15
15:48:35 UTC (rev 19775)
+++
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddProviderSupport.java 2010-01-15
15:56:12 UTC (rev 19776)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.esb.core.model.handlers;
import java.util.Properties;
@@ -8,6 +18,11 @@
import org.jboss.tools.common.model.util.FindObjectHelper;
import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
public class AddProviderSupport extends SpecialWizardSupport {
String providerEntity;
String busEntity;
Added:
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/ESBDefaultVersionResolver.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/ESBDefaultVersionResolver.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/ESBDefaultVersionResolver.java 2010-01-15
15:56:12 UTC (rev 19776)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.esb.core.model.handlers;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.common.model.XModelObject;
+import
org.jboss.tools.common.model.files.handlers.CreateFileSupport.DefaultVersionResolver;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.esb.core.facet.IJBossESBFacetDataModelProperties;
+import org.jboss.tools.esb.core.runtime.JBossESBRuntime;
+import org.jboss.tools.esb.core.runtime.JBossRuntimeManager;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class ESBDefaultVersionResolver implements DefaultVersionResolver {
+ final static String ROSETTA_JAR = "jbossesb-rosetta.jar"; //$NON-NLS-1$
+ final static String LIB_ROSETTA_JAR = "lib-" + ROSETTA_JAR; //$NON-NLS-1$
+ final static String VERSION_FILE_NAME = "VERSION";
+
+ public String resolve(String[] versionList, XModelObject context) {
+ IProject project = EclipseResourceUtil.getProject(context);
+ if(project == null) return null;
+ String qRuntimeName = null;
+
+ try {
+ qRuntimeName =
project.getPersistentProperty(IJBossESBFacetDataModelProperties.PERSISTENCE_PROPERTY_QNAME_RUNTIME_NAME);
+ } catch (CoreException e) {
+ //ignore
+ }
+ if(qRuntimeName == null) return null;
+
+ JBossESBRuntime runtime =
JBossRuntimeManager.getInstance().findRuntimeByName(qRuntimeName);
+ if(runtime == null) return null;
+
+ String v = runtime.getVersion();
+ if(v == null) return null;
+ String[] ts = v.split("\\.");
+ int major = 0;
+ int minor = 0;
+ if(ts.length >= 1) {
+ try {
+ major = Integer.parseInt(ts[0]);
+ } catch (NumberFormatException e) {
+ //ignore
+ }
+ }
+ if(ts.length >= 2) {
+ try {
+ minor = Integer.parseInt(ts[0]);
+ } catch (NumberFormatException e) {
+ //ignore
+ }
+ }
+
+ if(major < 4) {
+ return "1.0.1";
+ }
+ if(major > 4) {
+ return null;
+ }
+ if(minor >= 7) {
+ return "1.2.0";
+ } else {
+ return "1.1.0";
+ }
+
+ }
+
+}
Property changes on:
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/ESBDefaultVersionResolver.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain