airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1514142 - in /airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya: XBayaEngine.java ui/dialogs/descriptors/DescriptorEditorDialog.java ui/menues/XBayaMenuItem.java ui/widgets/component/ComponentSelector.java
Date Thu, 15 Aug 2013 02:45:12 GMT
Author: samindaw
Date: Thu Aug 15 02:45:11 2013
New Revision: 1514142

URL: http://svn.apache.org/r1514142
Log:
https://issues.apache.org/jira/browse/AIRAVATA-866

Modified:
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DescriptorEditorDialog.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/XBayaMenuItem.java
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSelector.java

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java?rev=1514142&r1=1514141&r2=1514142&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java
Thu Aug 15 02:45:11 2013
@@ -67,6 +67,8 @@ public class XBayaEngine {
     private WorkflowInterpreter workflowInterpreter;
 
     private AiravataAPI airavataAPI;
+    
+    private ComponentSelector componentTreeViewer; 
 
     /**
      * Constructs a ApplicationClient.
@@ -168,7 +170,7 @@ public class XBayaEngine {
      */
     private void initRegistry() {
 
-        final ComponentSelector componentTreeViewer = this.gui.getComponentSelector();
+        componentTreeViewer = this.gui.getComponentSelector();
         try {
             this.componentRegistry = new SystemComponentRegistry();
             // This does not take time, so we can do it in the same thread.
@@ -200,7 +202,6 @@ public class XBayaEngine {
                 getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
             }
         }
-
     }
 
     /**
@@ -279,4 +280,8 @@ public class XBayaEngine {
     public void setAiravataAPI(AiravataAPI airavataAPI) {
         this.airavataAPI = airavataAPI;
     }
+    
+    public void reloadRegistry(){
+    	componentTreeViewer.refresh();
+    }
 }
\ No newline at end of file

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DescriptorEditorDialog.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DescriptorEditorDialog.java?rev=1514142&r1=1514141&r2=1514142&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DescriptorEditorDialog.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/descriptors/DescriptorEditorDialog.java
Thu Aug 15 02:45:11 2013
@@ -26,6 +26,8 @@ import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -50,9 +52,11 @@ import org.apache.airavata.commons.gfac.
 import org.apache.airavata.commons.gfac.type.HostDescription;
 import org.apache.airavata.commons.gfac.type.ServiceDescription;
 import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.component.registry.ComponentRegistryLoader;
 import org.apache.airavata.xbaya.registrybrowser.nodes.JCRBrowserIcons;
 import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
 import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.util.RegistryConstants;
 //import org.apache.airavata.registry.api.AiravataRegistry2;
 
 public class DescriptorEditorDialog extends JDialog {
@@ -73,6 +77,8 @@ public class DescriptorEditorDialog exte
 
 	private AbstractButton removeButton;
 	
+	private boolean descriptorChanged=false;
+	
 	public enum DescriptorType{
 		HOST,
 		SERVICE,
@@ -84,12 +90,11 @@ public class DescriptorEditorDialog exte
     /**
      * @param engine XBaya workflow engine
      */
-    public DescriptorEditorDialog(XBayaEngine engine,DescriptorType descriptorType) {
+    public DescriptorEditorDialog(XBayaEngine engine, DescriptorType descriptorType) {
         this.engine = engine;
-        setRegistry(engine.getConfiguration().getAiravataAPI());
         this.descriptorType=descriptorType;
+        setRegistry(engine.getConfiguration().getAiravataAPI());
         initGUI();
-        
     }
 
     /**
@@ -218,6 +223,7 @@ public class DescriptorEditorDialog exte
 	    		hostDescriptionDialog.open();
 	    		if (hostDescriptionDialog.isHostCreated()) {
 					loadDescriptors();
+					setAsChanged();
 				}
 	    		break;
 	    	case SERVICE:
@@ -228,6 +234,7 @@ public class DescriptorEditorDialog exte
 //	    		serviceDescriptionDialog.open();
 	    		if (serviceDescriptionDialog.isServiceCreated()) {
 					loadDescriptors();
+					setAsChanged();
 				}
 	    		break;
 	    	case APPLICATION:
@@ -238,11 +245,19 @@ public class DescriptorEditorDialog exte
                 aDescriptionDialog.open();
                 if (aDescriptionDialog.isApplicationDescCreated()) {
                     loadDescriptors();
+					setAsChanged();
                 }
 			break;
     	}
 	}
 
+	private void setAsChanged() {
+		descriptorChanged=true;
+    	if (DescriptorEditorDialog.this.descriptorType==DescriptorType.SERVICE){
+			reloadComponentRegistry();
+		}
+	}
+
     private void newDescriptor() throws AiravataAPIInvocationException {
     	switch (descriptorType){
 	    	case HOST:
@@ -250,6 +265,7 @@ public class DescriptorEditorDialog exte
 	    		hostDescriptionDialog.open();
 	    		if (hostDescriptionDialog.isHostCreated()){
 	    			loadDescriptors();
+					setAsChanged();
 	    		}
 	    		break;
 	    	case SERVICE:
@@ -259,6 +275,7 @@ public class DescriptorEditorDialog exte
 //	    		serviceDescriptionDialog.open();
 	    		if (serviceDescriptionDialog.isServiceCreated()){
 	    			loadDescriptors();
+					setAsChanged();
 	    		}
 	    		break;
 	    	case APPLICATION:
@@ -267,6 +284,7 @@ public class DescriptorEditorDialog exte
 	    		applicationDescriptionDialog.open();
 	    		if (applicationDescriptionDialog.isApplicationDescCreated()){
 	    			loadDescriptors();
+					setAsChanged();
 	    		}
 	    		break;
     	}
@@ -310,23 +328,31 @@ public class DescriptorEditorDialog exte
 	    	    		HostDescription h = (HostDescription) getSelected();
 	    	        	getAPI().getApplicationManager().deleteHostDescription(h.getType().getHostName());
                         loadDescriptors();
+    					setAsChanged();
 	    	    		break;
 	    	    	case SERVICE:
 	    	        	ServiceDescription d = (ServiceDescription) getSelected();
 	    	        	getAPI().getApplicationManager().deleteServiceDescription(d.getType().getName());
                         loadDescriptors();
+    					setAsChanged();
 	    	    		break;
 	    	    	case APPLICATION:
 	    	    		ApplicationDescription a = (ApplicationDescription) getSelected();
 	    	    		String[] s = dlist.get(a).split("\\$");
 	    	        	getAPI().getApplicationManager().deleteApplicationDescription(s[0], s[1],
a.getType().getApplicationName().getStringValue());
 	    	    		loadDescriptors();
+						setAsChanged();
                         break;
             	}
 //				loadDescriptors();
         }
         return true;
     }
+
+	private void reloadComponentRegistry() {
+		ComponentRegistryLoader loader = ComponentRegistryLoader.getLoader(engine, RegistryConstants.REGISTRY_TYPE_JCR);
+		loader.load(engine.getConfiguration().getJcrComponentRegistry());
+	}
     
     private void loadDescriptors() throws AiravataAPIInvocationException {
     	try {

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/XBayaMenuItem.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/XBayaMenuItem.java?rev=1514142&r1=1514141&r2=1514142&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/XBayaMenuItem.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/XBayaMenuItem.java
Thu Aug 15 02:45:11 2013
@@ -39,6 +39,7 @@ import javax.swing.event.MenuListener;
 import org.apache.airavata.xbaya.XBayaConfiguration;
 import org.apache.airavata.xbaya.XBayaConfiguration.XBayaExecutionMode;
 import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.component.registry.ComponentRegistryLoader;
 import org.apache.airavata.xbaya.core.generators.BPELFiler;
 import org.apache.airavata.xbaya.core.generators.ImageFiler;
 import org.apache.airavata.xbaya.core.generators.JythonFiler;
@@ -54,6 +55,7 @@ import org.apache.airavata.xbaya.ui.expe
 import org.apache.airavata.xbaya.ui.graph.GraphCanvas;
 import org.apache.airavata.xbaya.ui.widgets.ToolbarButton;
 import org.apache.airavata.xbaya.ui.widgets.XBayaToolBar;
+import org.apache.airavata.xbaya.util.RegistryConstants;
 import org.apache.airavata.xbaya.util.XBayaUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -318,6 +320,11 @@ public class XBayaMenuItem implements XB
 //                                engine.getConfiguration().getJcrComponentRegistry()
 //                                        .getRegistry());
 //                        serviceDescriptionDialog.open();
+                    	if (serviceDescriptionDialog.isServiceCreated()){
+//                    		engine.reloadRegistry();
+                    		ComponentRegistryLoader loader = ComponentRegistryLoader.getLoader(engine,
RegistryConstants.REGISTRY_TYPE_JCR);
+                    		loader.load(engine.getConfiguration().getJcrComponentRegistry());
+                    	}
                     } catch (Exception e1) {
                         engine.getGUI().getErrorWindow().error(e1);
                     }

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSelector.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSelector.java?rev=1514142&r1=1514141&r2=1514142&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSelector.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentSelector.java
Thu Aug 15 02:45:11 2013
@@ -211,20 +211,26 @@ public class ComponentSelector implement
 
         if (selectionPath.getPathCount() >= 2) {
             final ComponentTreeNode selectedNode = (ComponentTreeNode) selectionPath.getPath()[1];
-            ComponentRegistry registry = selectedNode.getComponentRegistry();
-            final ComponentTreeNode componentTree = ComponentController.getComponentTree(registry);
-
-            SwingUtilities.invokeLater(new Runnable() {
-                public void run() {
-                    ComponentTreeNode root = ComponentSelector.this.treeModel.getRoot();
-                    int index = root.getIndex(selectedNode);
-                    ComponentSelector.this.treeModel.removeNodeFromParent(selectedNode);
-                    ComponentSelector.this.treeModel.insertNodeInto(componentTree, root,
index);
-                }
-            });
+            reloadComponentRegistryNode(selectedNode);
         }
     }
 
+	private void reloadComponentRegistryNode(
+			final ComponentTreeNode selectedNode)
+			throws ComponentRegistryException {
+		ComponentRegistry registry = selectedNode.getComponentRegistry();
+		final ComponentTreeNode componentTree = ComponentController.getComponentTree(registry);
+
+		SwingUtilities.invokeLater(new Runnable() {
+		    public void run() {
+		        ComponentTreeNode root = ComponentSelector.this.treeModel.getRoot();
+		        int index = root.getIndex(selectedNode);
+		        ComponentSelector.this.treeModel.removeNodeFromParent(selectedNode);
+		        ComponentSelector.this.treeModel.insertNodeInto(componentTree, root, index);
+		    }
+		});
+	}
+
     /**
      * Updates all the registry entries.
      * 
@@ -518,6 +524,7 @@ public class ComponentSelector implement
         this.getSwingComponent().repaint();
 
         this.tree.repaint();
+        this.treeModel.reload();
     }
 
 }
\ No newline at end of file



Mime
View raw message