[jbosstools-commits] JBoss Tools SVN: r44044 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Wed Sep 26 10:48:48 EDT 2012
Author: rob.stryker at jboss.com
Date: 2012-09-26 10:48:48 -0400 (Wed, 26 Sep 2012)
New Revision: 44044
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/DriverUtility.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/JBossASHandler.java
Log:
JBIDE-12733 to trunk
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/DriverUtility.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/DriverUtility.java 2012-09-26 14:08:06 UTC (rev 44043)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/DriverUtility.java 2012-09-26 14:48:48 UTC (rev 44044)
@@ -18,6 +18,7 @@
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.datatools.connectivity.ConnectionProfileConstants;
import org.eclipse.datatools.connectivity.ConnectionProfileException;
@@ -34,6 +35,7 @@
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.Messages;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.osgi.framework.Bundle;
public class DriverUtility implements IJBossRuntimePluginConstants {
public static final HashMap<String,String> SERVER_DRIVER_LOCATION = new HashMap<String, String>();
@@ -55,7 +57,14 @@
* @throws ConnectionProfileException
* @return driver instance
*/
- public void createDriver(String jbossASLocation, IServerType serverType) throws ConnectionProfileException {
+ public void createDriver(String jbossASLocation, IServerType serverType) throws DriverUtilityException {
+ try {
+ createDriver2(jbossASLocation, serverType);
+ } catch( ConnectionProfileException cfe ) {
+ throw new DriverUtilityException(cfe);
+ }
+ }
+ private void createDriver2(String jbossASLocation, IServerType serverType) throws ConnectionProfileException {
if(ProfileManager.getInstance().getProfileByName(DEFAULT_DS) != null) {
// Don't create the driver a few times
return;
@@ -205,4 +214,10 @@
return false;
}
+ public class DriverUtilityException extends Exception {
+ public DriverUtilityException(Exception e) {
+ super(e);
+ }
+ }
+
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/JBossASHandler.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/JBossASHandler.java 2012-09-26 14:08:06 UTC (rev 44043)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/JBossASHandler.java 2012-09-26 14:48:48 UTC (rev 44044)
@@ -23,7 +23,6 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.datatools.connectivity.ConnectionProfileException;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IRuntimeType;
import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
@@ -34,6 +33,7 @@
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.Messages;
import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
+import org.jboss.ide.eclipse.as.core.runtime.DriverUtility.DriverUtilityException;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.bean.JBossServerType;
import org.jboss.ide.eclipse.as.core.server.bean.ServerBean;
@@ -176,15 +176,24 @@
if (runtime != null) {
createServer(progressMonitor, runtime, serverType, name);
}
-
- new DriverUtility().createDriver(asLocation.getAbsolutePath(), serverType);
+
+ if( isDtpPresent())
+ new DriverUtility().createDriver(asLocation.getAbsolutePath(), serverType);
} catch (CoreException e) {
JBossServerCorePlugin.log(IStatus.ERROR, Messages.JBossRuntimeStartup_Cannot_create_new_JBoss_Server,e);
- } catch (ConnectionProfileException e) {
+ } catch (DriverUtilityException e) {
JBossServerCorePlugin.log(IStatus.ERROR, Messages.JBossRuntimeStartup_Cannott_create_new_DTP_Connection_Profile,e);
}
}
+ private static boolean isDtpPresent() {
+ String bundle1 = "org.eclipse.datatools.connectivity"; //$NON-NLS-1$
+ String bundle2 = "org.eclipse.datatools.connectivity.db.generic"; //$NON-NLS-1$
+ Bundle b1 = Platform.getBundle(bundle1);
+ Bundle b2 = Platform.getBundle(bundle2);
+ return b1 != null && b2 != null;
+ }
+
/**
* Creates new JBoss AS Runtime
* @param jbossASLocation location of JBoss AS
More information about the jbosstools-commits
mailing list