Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2004-2008 Sybase, Inc. and others. |
2 |
* Copyright (c) 2004-2009 Sybase, Inc. and others. |
3 |
* |
3 |
* |
4 |
* All rights reserved. This program and the accompanying materials are made |
4 |
* All rights reserved. This program and the accompanying materials are made |
5 |
* available under the terms of the Eclipse Public License v1.0 which |
5 |
* available under the terms of the Eclipse Public License v1.0 which |
Lines 10-15
Link Here
|
10 |
* IBM Corporation - fix for defect #223855 |
10 |
* IBM Corporation - fix for defect #223855 |
11 |
* IBM Corporation - fix for defect #241713 |
11 |
* IBM Corporation - fix for defect #241713 |
12 |
* Actuate Corporation - fix for bug #247587 |
12 |
* Actuate Corporation - fix for bug #247587 |
|
|
13 |
* brianf - added Transient profile functionality for bug 253606 |
13 |
******************************************************************************/ |
14 |
******************************************************************************/ |
14 |
package org.eclipse.datatools.connectivity.internal; |
15 |
package org.eclipse.datatools.connectivity.internal; |
15 |
|
16 |
|
Lines 76-81
Link Here
|
76 |
|
77 |
|
77 |
private IConnectionProfile[] mProfiles = null; |
78 |
private IConnectionProfile[] mProfiles = null; |
78 |
|
79 |
|
|
|
80 |
private ArrayList mTransientProfiles = null; |
81 |
|
79 |
private Set mRepositories = new HashSet(); |
82 |
private Set mRepositories = new HashSet(); |
80 |
|
83 |
|
81 |
private boolean mIsDirty = false; |
84 |
private boolean mIsDirty = false; |
Lines 455-460
Link Here
|
455 |
} |
458 |
} |
456 |
|
459 |
|
457 |
/** |
460 |
/** |
|
|
461 |
* Create transient connection profile |
462 |
* |
463 |
* @param name |
464 |
* @param description |
465 |
* @param providerID |
466 |
* @param baseProperties |
467 |
* @throws ConnectionProfileException |
468 |
*/ |
469 |
public IConnectionProfile createTransientProfile(String name, String description, |
470 |
String providerID, Properties baseProperties) throws ConnectionProfileException { |
471 |
String transientName = name; |
472 |
if (transientName == null) { |
473 |
transientName = "Transient" + providerID; |
474 |
} |
475 |
transientName = findUniqueTransientProfileName(transientName, providerID); |
476 |
ConnectionProfile profile = new ConnectionProfile(transientName, description, |
477 |
providerID, "", false, UUID.createUUID() |
478 |
.toString()); |
479 |
baseProperties.setProperty(IConnectionProfile.TRANSIENT_PROPERTY_ID, ""); |
480 |
profile.setBaseProperties(baseProperties); |
481 |
profile.setCreated(); |
482 |
if (mTransientProfiles == null) |
483 |
mTransientProfiles = new ArrayList(); |
484 |
mTransientProfiles.add(profile); |
485 |
return profile; |
486 |
} |
487 |
|
488 |
/** |
489 |
* Private method to avoid name collisions |
490 |
* @param name |
491 |
* @param providerID |
492 |
* @return |
493 |
*/ |
494 |
private String findUniqueTransientProfileName(String name, String providerID) { |
495 |
if (mTransientProfiles != null) { |
496 |
Iterator iter = mTransientProfiles.iterator(); |
497 |
int count = 0; |
498 |
while (iter.hasNext()) { |
499 |
IConnectionProfile profile = (IConnectionProfile) iter.next(); |
500 |
if (profile.getProviderId().equalsIgnoreCase(providerID)) { |
501 |
count++; |
502 |
} |
503 |
} |
504 |
return name + count; |
505 |
} |
506 |
return name; |
507 |
} |
508 |
|
509 |
/** |
458 |
* Create connection profile |
510 |
* Create connection profile |
459 |
* |
511 |
* |
460 |
* @param name |
512 |
* @param name |
Lines 856-865
Link Here
|
856 |
|
908 |
|
857 |
// Changed to fix bug 247599 |
909 |
// Changed to fix bug 247599 |
858 |
//cps[index] = profile; |
910 |
//cps[index] = profile; |
859 |
if(cps[index] != profile) { |
911 |
removeProfile(cps[index]); |
860 |
removeProfile(cps[index]); |
912 |
addProfile(profile); |
861 |
addProfile(profile); |
|
|
862 |
} |
863 |
|
913 |
|
864 |
mIsDirty = true; |
914 |
mIsDirty = true; |
865 |
|
915 |
|
Lines 1097-1102
Link Here
|
1097 |
} |
1147 |
} |
1098 |
|
1148 |
|
1099 |
/* package */void dispose() { |
1149 |
/* package */void dispose() { |
|
|
1150 |
if (mTransientProfiles != null) { |
1151 |
Iterator transientIter = mTransientProfiles.iterator(); |
1152 |
while (transientIter.hasNext()) { |
1153 |
// ((ConnectionProfile)transientIter.next()).dispose(); |
1154 |
ConnectionProfile transientProfile = |
1155 |
(ConnectionProfile) transientIter.next(); |
1156 |
System.out.println("Disposing transient profile: " + transientProfile.getInstanceID()); |
1157 |
transientProfile.dispose(); |
1158 |
} |
1159 |
} |
1100 |
if (mProfiles == null) { |
1160 |
if (mProfiles == null) { |
1101 |
return; |
1161 |
return; |
1102 |
} |
1162 |
} |