Author: adietish
Date: 2010-12-10 09:10:08 -0500 (Fri, 10 Dec 2010)
New Revision: 27352
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IDeltaCloudManagerListener.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IImageListListener.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IInstanceListListener.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/META-INF/MANIFEST.MF
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractDeltaCloudObjectRepository.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/SecurePasswordStore.java
Log:
[JBIDE-7856]
* removed notifyCloudRename since DeltaCloud now notifies about changes in its properties
(images, instances, name)
* switched the observer pattern in DeltaCloud to PropertyChangeSupport, moved
ObservablePojo to core to get PropertyChangeSupport in DeltaCloud.
* switched the observer pattern in DeltaCloud to PropertyChangeSupport, removed
IInstanceListListener and IImageListlistener.
* fireing changes when name is changed. Loading instances and images only if url,
username, pw change.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-10 13:40:26
UTC (rev 27351)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-10 14:10:08
UTC (rev 27352)
@@ -1,3 +1,28 @@
+2010-12-10 André Dietisheim <adietish(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (notifyCloudRename):
+ [JBIDE-7856] removed notifyCloudRename since DeltaCloud now notifies about changes in
its properties (images, instances, name)
+ * src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java:
+ [JBIDE-7856] switched the observer pattern in DeltaCloud to PropertyChangeSupport, moved
ObservablePojo
+ to core to get PropertyChangeSupport in DeltaCloud.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java:
+ [JBIDE-7856] switched the observer pattern in DeltaCloud to PropertyChangeSupport,
removed
+ IInstanceListListener and IImageListlistener.
+ (update):
+ (setName):
+ (updateConnectionProperties):
+ (updateInstanceFilter):
+ (updateImageFilter):
+ (loadInstances):
+ (clearImages):
+ (clearInstances):
+ (replaceInstance):
+ (performInstanceAction):
+ (loadImages):
+ (createInstance):
+ [JBIDE-7856] switched the observer pattern in DeltaCloud to PropertyChangeSupport,
fireing changes when name is changed.
+ Loading instances and images only if url, username, pw change.
+
2010-12-09 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/DeltaCloud.java
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/META-INF/MANIFEST.MF
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/META-INF/MANIFEST.MF 2010-12-10
13:40:26 UTC (rev 27351)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/META-INF/MANIFEST.MF 2010-12-10
14:10:08 UTC (rev 27352)
@@ -13,7 +13,8 @@
Export-Package:
org.jboss.tools.deltacloud.core;x-friends:="org.jboss.tools.deltacloud.ui,org.jboss.tools.deltacloud.test",
org.jboss.tools.deltacloud.core.client;x-friends:="org.jboss.tools.deltacloud.test,org.jboss.tools.deltacloud.ui",
org.jboss.tools.deltacloud.core.client.request;x-friends:="org.jboss.tools.deltacloud.test",
- org.jboss.tools.deltacloud.core.job
+ org.jboss.tools.deltacloud.core.job,
+
org.jboss.tools.internal.deltacloud.core.observable;x-friends:="org.jboss.tools.deltacloud.ui"
Bundle-ClassPath: .,
lib/apache-mime4j-0.6.jar,
lib/commons-codec-1.3.jar,
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractDeltaCloudObjectRepository.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractDeltaCloudObjectRepository.java 2010-12-10
13:40:26 UTC (rev 27351)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractDeltaCloudObjectRepository.java 2010-12-10
14:10:08 UTC (rev 27352)
@@ -23,7 +23,7 @@
* @param <E> Element to store
* @param <C> Criteria to match element against
*/
-public abstract class AbstractDeltaCloudObjectRepository<E, C> {
+public abstract class AbstractDeltaCloudObjectRepository<E extends IDeltaCloudElement,
C> {
private List<E> objects = new ArrayList<E>();
// TODO switch to readwrite lock to gain performance
@@ -34,30 +34,33 @@
this.typeClass = typeClass;
}
- public void add(E object) {
+ public E[] add(E object) {
try {
lock();
objects.add(object);
+ return get();
} finally {
unlock();
}
}
- public void add(Collection<E> objects) {
+ public E[] add(Collection<E> objects) {
try {
lock();
for (E object : objects) {
objects.add(object);
}
+ return get();
} finally {
unlock();
}
}
- public void clear() {
+ public E[] clear() {
try {
lock();
objects.clear();
+ return get();
} finally {
unlock();
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-12-10
13:40:26 UTC (rev 27351)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-12-10
14:10:08 UTC (rev 27352)
@@ -20,7 +20,6 @@
import java.util.regex.PatternSyntaxException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.jobs.Job;
import org.jboss.tools.deltacloud.core.client.DeltaCloudAuthException;
import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
@@ -31,16 +30,21 @@
import org.jboss.tools.deltacloud.core.client.Instance;
import org.jboss.tools.deltacloud.core.client.InternalDeltaCloudClient;
import org.jboss.tools.deltacloud.core.client.Realm;
+import org.jboss.tools.internal.deltacloud.core.observable.ObservablePojo;
/**
* @author Jeff Jonston
* @author André Dietisheim
*/
-public class DeltaCloud {
+public class DeltaCloud extends ObservablePojo {
public final static String MOCK_TYPE = "MOCK"; //$NON-NLS-1$
public final static String EC2_TYPE = "EC2"; //$NON-NLS-1$
+ public static final String PROP_INSTANCES = "instanceRepo";
+ public static final String PROP_IMAGES = "images";
+ public static final String PROP_NAME = "name";
+
private String name;
private String username;
private String url;
@@ -51,7 +55,7 @@
private InternalDeltaCloudClient client;
private DeltaCloudImagesRepository images;
- private DeltaCloudInstancesRepository instances;
+ private DeltaCloudInstancesRepository instanceRepo;
private IImageFilter imageFilter;
private IInstanceFilter instanceFilter;
@@ -60,8 +64,6 @@
private Object actionLock = new Object();
- ListenerList instanceListeners = new ListenerList();
- ListenerList imageListeners = new ListenerList();
private SecurePasswordStore passwordStore;
public static interface IInstanceStateMatcher {
@@ -94,17 +96,42 @@
instanceFilter = createInstanceFilter(instanceFilterRules);
}
- public void editCloud(String name, String url, String username, String password, String
type)
+ public void update(String name, String url, String username, String password, String
type)
throws DeltaCloudException {
- this.url = url;
- this.name = name;
- this.username = username;
this.type = type;
- this.passwordStore.update(new DeltaCloudPasswordStorageKey(name, username), password);
- client = createClient(name, url, username, passwordStore.getPassword());
- loadChildren();
+ setName(name);
+
+ boolean changed = updateConnectionProperties(url, username, password);
+ if (changed) {
+ client = createClient(name, url, username, passwordStore.getPassword());
+ loadChildren();
+ }
}
+ private boolean updateConnectionProperties(String url, String username, String
password)
+ throws DeltaCloudException {
+ boolean changed = false;
+ if (!equals(this.url, url)) {
+ this.url = url;
+ changed = true;
+ }
+ if (!equals(this.username, username)) {
+ this.username = username;
+ changed = true;
+ }
+ if (!equals(this.passwordStore.getPassword(), password)) {
+ this.passwordStore.setPassword(password);
+ changed = true;
+ }
+ return changed;
+ }
+
+ private boolean equals(Object thisObject, Object thatObject) {
+ return (thisObject != null && thisObject.equals(thatObject))
+ || (thatObject != null && thatObject.equals(thisObject))
+ || (thisObject == null && thatObject == null);
+ }
+
private InternalDeltaCloudClient createClient(String name, String url, String username,
String password)
throws DeltaCloudException {
try {
@@ -146,6 +173,10 @@
this.lastImageId = lastImageId;
}
+ protected void setName(String name) {
+ firePropertyChange(PROP_NAME, this.name, this.name = name);
+ }
+
public String getLastKeyname() {
return lastKeyname;
}
@@ -162,9 +193,11 @@
String rules = getInstanceFilter().toString();
instanceFilter = createInstanceFilter(ruleString);
if (!rules.equals(ruleString)) {
- // TODO: remove notification with all instances, replace by
+ // TODO: remove notification with all instanceRepo, replace by
// notifying the changed instance
- notifyInstanceListListeners(getInstancesRepository().get());
+ firePropertyChange(PROP_INSTANCES,
+ getInstancesRepository().get(),
+ getInstancesRepository().get());
}
}
@@ -191,7 +224,11 @@
String rules = getImageFilter().toString();
this.imageFilter = createImageFilter(ruleString);
if (!rules.equals(ruleString)) {
- notifyImageListListeners(getImagesRepository().get());
+ // TODO: remove notification with all instanceRepo, replace by
+ // notifying the changed instance
+ firePropertyChange(PROP_IMAGES,
+ getImagesRepository().get(),
+ getImagesRepository().get());
}
}
@@ -238,38 +275,6 @@
}
}
- public void addInstanceListListener(IInstanceListListener listener) {
- instanceListeners.add(listener);
- }
-
- public void removeInstanceListListener(IInstanceListListener listener) {
- instanceListeners.remove(listener);
- }
-
- private DeltaCloudInstance[] notifyInstanceListListeners(DeltaCloudInstance[] array) {
- Object[] listeners = instanceListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((IInstanceListListener) listeners[i]).listChanged(this, array);
- }
- return array;
- }
-
- public void addImageListListener(IImageListListener listener) {
- imageListeners.add(listener);
- }
-
- public void removeImageListListener(IImageListListener listener) {
- imageListeners.remove(listener);
- }
-
- private DeltaCloudImage[] notifyImageListListeners(DeltaCloudImage[] array) {
- Object[] listeners = imageListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((IImageListListener) listeners[i]).listChanged(this, array);
- }
- return array;
- }
-
public Job getInstanceJob(String id) {
synchronized (actionLock) {
Job j = null;
@@ -314,7 +319,7 @@
public DeltaCloudInstance waitForState(String instanceId, IInstanceStateMatcher
stateMatcher, IProgressMonitor pm)
throws InterruptedException, DeltaCloudException {
- DeltaCloudInstance instance = instances.getById(instanceId);
+ DeltaCloudInstance instance = instanceRepo.getById(instanceId);
if (instance != null) {
while (!pm.isCanceled()) {
if (stateMatcher.matchesState(instance, instance.getState())
@@ -336,56 +341,62 @@
}
/**
- * Loads the instances from the server and stores them in this instance.
+ * Loads the instanceRepo from the server and stores them in this instance.
* Furthermore listeners get informed.
*
- * @return the instances
+ * @return the instanceRepo
* @throws DeltaCloudException
*
* @see #notifyInstanceListListeners(DeltaCloudInstance[])
*/
private void loadInstances() throws DeltaCloudException {
try {
- getInstancesRepository().add(client.listInstances(), this);
- notifyImageListListeners(images.get());
+ DeltaCloudInstancesRepository repo = getInstancesRepository();
+ DeltaCloudInstance[] oldInstances = repo.get();
+ repo.add(client.listInstances(), this);
+ // TODO: remove notification with all instanceRepo, replace by
+ // notifying the changed instance
+ firePropertyChange(PROP_INSTANCES, oldInstances, repo.get());
} catch (DeltaCloudClientException e) {
- throw new DeltaCloudException(MessageFormat.format("Could not load instances of
cloud {0}: {1}",
+ throw new DeltaCloudException(MessageFormat.format("Could not load instanceRepo
of cloud {0}: {1}",
getName(), e.getMessage()), e);
}
}
private void clearImages() {
if (images != null) {
- images.clear();
- notifyImageListListeners(images.get());
+ // TODO: remove notification with all instanceRepo, replace by
+ // notifying the changed instance
+ firePropertyChange(PROP_IMAGES, images.get(), images.clear());
}
}
private void clearInstances() {
- if (instances != null) {
- instances.clear();
- notifyInstanceListListeners(instances.get());
- }
+ // TODO: remove notification with all instanceRepo, replace by
+ // notifying the changed instance
+ firePropertyChange(PROP_INSTANCES,
+ getInstancesRepository().get(),
+ getInstancesRepository().clear());
}
private DeltaCloudInstancesRepository getInstancesRepository() {
- if (instances == null) {
- instances = new DeltaCloudInstancesRepository();
+ if (instanceRepo == null) {
+ instanceRepo = new DeltaCloudInstancesRepository();
}
- return instances;
+ return instanceRepo;
}
/**
- * Gets the instances in async manner. The method does not return the
- * instances but notifies observers of the instances.
+ * Gets the instanceRepo in async manner. The method does not return the
+ * instanceRepo but notifies observers of the instanceRepo.
*
* @throws DeltaCloudException
*/
public DeltaCloudInstance[] getInstances() throws DeltaCloudException {
- if (instances == null) {
+ if (instanceRepo == null) {
loadInstances();
}
- return instances.get();
+ return instanceRepo.get();
}
private DeltaCloudImagesRepository getImagesRepository() {
@@ -442,7 +453,7 @@
}
/**
- * Replaces the current instance with the given one. The instances are
+ * Replaces the current instance with the given one. The instanceRepo are
* matched against identical id
*
* @param instance
@@ -451,27 +462,21 @@
public void replaceInstance(DeltaCloudInstance instance) {
String instanceId = instance.getId();
if (instance != null) {
- DeltaCloudInstance instanceToReplace = instances.getById(instanceId);
- replaceInstance(instance, instanceToReplace);
- // TODO: remove notification with all instances, replace by
- // notifying the changed instance
- notifyInstanceListListeners(getInstancesRepository().get());
+ replaceInstance(instance, instanceRepo.getById(instanceId));
}
}
- // TODO: remove duplicate code with #replaceInstance
public DeltaCloudInstance refreshInstance(String instanceId) throws DeltaCloudException
{
DeltaCloudInstance deltaCloudInstance = null;
try {
Instance instance = client.listInstances(instanceId);
deltaCloudInstance = new DeltaCloudInstance(this, instance);
- DeltaCloudInstance currentInstance = instances.getById(instanceId);
+ DeltaCloudInstance currentInstance = instanceRepo.getById(instanceId);
// FIXME: remove BOGUS state when server fixes state
// problems
if (!(deltaCloudInstance.getState().equals(DeltaCloudInstance.BOGUS))
&& !(currentInstance.getState().equals(deltaCloudInstance.getState()))) {
replaceInstance(deltaCloudInstance, currentInstance);
- notifyInstanceListListeners(getInstancesRepository().get());
}
} catch (DeltaCloudClientException e) {
// TODO: is this correct?
@@ -482,12 +487,17 @@
}
private void replaceInstance(DeltaCloudInstance deltaCloudInstance, DeltaCloudInstance
currentInstance) {
- getInstancesRepository().remove(currentInstance);
- getInstancesRepository().add(deltaCloudInstance);
+ DeltaCloudInstancesRepository repo = getInstancesRepository();
+ DeltaCloudInstance[] instances = repo.get();
+ repo.remove(currentInstance);
+ repo.add(deltaCloudInstance);
+ // TODO: remove notification with all instanceRepo, replace by
+ // notifying the changed instance
+ firePropertyChange(PROP_INSTANCES, instances, repo.get());
}
public boolean performInstanceAction(String instanceId, String actionId) throws
DeltaCloudException {
- return performInstanceAction(instances.getById(instanceId), actionId);
+ return performInstanceAction(instanceRepo.getById(instanceId), actionId);
}
protected boolean performInstanceAction(DeltaCloudInstance instance, String actionId)
throws DeltaCloudException {
@@ -495,12 +505,13 @@
if (instance == null) {
return false;
}
-
+ DeltaCloudInstancesRepository repo = getInstancesRepository();
+ DeltaCloudInstance[] instances = repo.get();
boolean result = instance.performInstanceAction(actionId, client);
if (result) {
- // TODO: remove notification with all instances, replace by
+ // TODO: remove notification with all instanceRepo, replace by
// notifying the changed instance
- notifyInstanceListListeners(getInstancesRepository().get());
+ firePropertyChange(PROP_INSTANCES, instances, repo.get());
}
return result;
} catch (DeltaCloudClientException e) {
@@ -535,8 +546,12 @@
*/
private void loadImages() throws DeltaCloudException {
try {
- getImagesRepository().add(client.listImages(), this);
- notifyImageListListeners(images.get());
+ DeltaCloudImagesRepository repo = getImagesRepository();
+ DeltaCloudImage[] oldImages = repo.get();
+ repo.add(client.listImages(), this);
+ // TODO: remove notification with all instanceRepo, replace by
+ // notifying the changed instance
+ firePropertyChange(PROP_IMAGES, oldImages, repo.get());
} catch (DeltaCloudClientException e) {
clearImages();
throw new DeltaCloudException(MessageFormat.format("Could not load images of
cloud {0}: {1}",
@@ -583,9 +598,13 @@
instance = client.createInstance(imageId, profileId, realmId, name, memory,
storage);
}
if (instance != null) {
- DeltaCloudInstance deltaCloudInstance = getInstancesRepository().add(instance,
this);
+ DeltaCloudInstancesRepository repo = getInstancesRepository();
+ DeltaCloudInstance[] instances = repo.get();
+ DeltaCloudInstance deltaCloudInstance = repo.add(instance, this);
deltaCloudInstance.setGivenName(name);
- notifyInstanceListListeners(getInstancesRepository().get());
+ // TODO: remove notification with all instanceRepo, replace by
+ // notifying the changed instance
+ firePropertyChange(PROP_INSTANCES, instances, repo.get());
return deltaCloudInstance;
}
} catch (DeltaCloudClientException e) {
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java 2010-12-10
13:40:26 UTC (rev 27351)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java 2010-12-10
14:10:08 UTC (rev 27352)
@@ -188,28 +188,23 @@
public void addCloud(DeltaCloud d) throws DeltaCloudException {
doGetClouds().add(d);
saveClouds();
- notifyListeners(ICloudManagerListener.ADD_EVENT, d);
+ notifyListeners(IDeltaCloudManagerListener.ADD_EVENT, d);
}
public void removeCloud(DeltaCloud d) throws DeltaCloudException {
doGetClouds().remove(d);
d.dispose();
saveClouds();
- notifyListeners(ICloudManagerListener.REMOVE_EVENT, d);
+ notifyListeners(IDeltaCloudManagerListener.REMOVE_EVENT, d);
}
- public void notifyCloudRename(DeltaCloud cloud) throws DeltaCloudException {
- saveClouds();
- notifyListeners(ICloudManagerListener.RENAME_EVENT, cloud);
- }
-
- public void addCloudManagerListener(ICloudManagerListener listener) {
+ public void addCloudManagerListener(IDeltaCloudManagerListener listener) {
if (cloudManagerListeners == null)
cloudManagerListeners = new ListenerList(ListenerList.IDENTITY);
cloudManagerListeners.add(listener);
}
- public void removeCloudManagerListener(ICloudManagerListener listener) {
+ public void removeCloudManagerListener(IDeltaCloudManagerListener listener) {
if (cloudManagerListeners != null)
cloudManagerListeners.remove(listener);
}
@@ -218,7 +213,7 @@
if (cloudManagerListeners != null) {
Object[] listeners = cloudManagerListeners.getListeners();
for (int i = 0; i < listeners.length; ++i) {
- ((ICloudManagerListener) listeners[i]).cloudsChanged(type, cloud);
+ ((IDeltaCloudManagerListener) listeners[i]).cloudsChanged(type, cloud);
}
}
}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java 2010-12-10
13:40:26 UTC (rev 27351)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java 2010-12-10
14:10:08 UTC (rev 27352)
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are 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 Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.core;
-
-public interface ICloudManagerListener {
-
- public static int ADD_EVENT = 1;
- public static int REMOVE_EVENT = 2;
- public static int RENAME_EVENT = 3;
-
- void cloudsChanged(int type, DeltaCloud cloud);
-}
Copied:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IDeltaCloudManagerListener.java
(from rev 27269,
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java)
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IDeltaCloudManagerListener.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IDeltaCloudManagerListener.java 2010-12-10
14:10:08 UTC (rev 27352)
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are 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 Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.core;
+
+public interface IDeltaCloudManagerListener {
+
+ public static int ADD_EVENT = 1;
+ public static int REMOVE_EVENT = 2;
+
+ void cloudsChanged(int type, DeltaCloud cloud);
+}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IImageListListener.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IImageListListener.java 2010-12-10
13:40:26 UTC (rev 27351)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IImageListListener.java 2010-12-10
14:10:08 UTC (rev 27352)
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are 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 Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.core;
-
-public interface IImageListListener {
-
- public void listChanged(DeltaCloud cloud, DeltaCloudImage[] imges);
-
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IInstanceListListener.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IInstanceListListener.java 2010-12-10
13:40:26 UTC (rev 27351)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IInstanceListListener.java 2010-12-10
14:10:08 UTC (rev 27352)
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are 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 Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.core;
-
-public interface IInstanceListListener {
-
- public void listChanged(DeltaCloud cloud, DeltaCloudInstance[] list);
-
-}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/SecurePasswordStore.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/SecurePasswordStore.java 2010-12-10
13:40:26 UTC (rev 27351)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/SecurePasswordStore.java 2010-12-10
14:10:08 UTC (rev 27352)
@@ -51,6 +51,10 @@
}
}
}
+
+ public void setPassword(String password) throws DeltaCloudException {
+ update(storageKey, password);
+ }
public void update(IStorageKey key, String password) throws DeltaCloudException {
if (!storageKey.equals(key)
Copied:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java
(from rev 27269,
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/ObservablePojo.java)
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java 2010-12-10
14:10:08 UTC (rev 27352)
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.internal.deltacloud.core.observable;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+/**
+ * A POJO base class that may notify observers on behalf of
+ * {@link PropertyChangeSupport}
+ */
+public abstract class ObservablePojo {
+
+ private PropertyChangeSupport propertyChangeSupport;
+
+ public ObservablePojo() {
+ this.propertyChangeSupport = new PropertyChangeSupport(this);
+ }
+
+ public void firePropertyChange(String propertyName,
+ Object oldValue, Object newValue) {
+ propertyChangeSupport.firePropertyChange(propertyName, oldValue, newValue);
+ }
+
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener
listener) {
+ propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
+ }
+
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener
listener) {
+ propertyChangeSupport.removePropertyChangeListener(propertyName, listener);
+ }
+
+ public void removePropertyChangeListener(
+ PropertyChangeListener listener) {
+ propertyChangeSupport.removePropertyChangeListener(listener);
+ }
+
+ protected PropertyChangeSupport getPropertyChangeSupport() {
+ return propertyChangeSupport;
+ }
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain