You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2012/05/20 01:24:56 UTC
svn commit: r1340591 - in /incubator/airavata/trunk/modules:
workflow-model/src/main/java/org/apache/airavata/workflow/model/component/
workflow-model/src/main/java/org/apache/airavata/workflow/model/utils/
xbaya-gui/src/main/java/org/apache/airavata/x...
Author: samindaw
Date: Sat May 19 23:24:55 2012
New Revision: 1340591
URL: http://svn.apache.org/viewvc?rev=1340591&view=rev
Log:
https://issues.apache.org/jira/browse/AIRAVATA-414: xbaya refactor- workflow controller/view refactoring step 2 [package rearranging, class rearranging, adding compoenent registry controller class] etc.
Added:
incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ComponentReference.java
incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ComponentRegistryException.java
incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/utils/FileConstants.java
incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/ComponentController.java
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ComponentReference.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ComponentReference.java?rev=1340591&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ComponentReference.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ComponentReference.java Sat May 19 23:24:55 2012
@@ -0,0 +1,95 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.workflow.model.component;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class ComponentReference {
+
+ private String name;
+ private List<ComponentReference> componentReferences;
+
+ /**
+ * Creates a ComponentLeaf
+ *
+ * @param name
+ * The name of the ComponentLeaf
+ */
+ public ComponentReference(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return The name
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * @return The component.
+ * @throws ComponentRegistryException
+ * @throws ComponentException
+ * @throws IOException
+ */
+ public abstract Component getComponent() throws ComponentRegistryException, ComponentException;
+
+ /**
+ * @return The list of components
+ * @throws ComponentRegistryException
+ * @throws ComponentException
+ * @throws IOException
+ */
+ public abstract List<? extends Component> getComponents() throws ComponentRegistryException, ComponentException;
+
+ /**
+ * Indicates if this Component reference should be considered as an parent for child component references
+ * @return
+ */
+ public boolean isParentComponent(){
+ return getChildComponentReferences().size()==0;
+ }
+
+
+ /**
+ * Get a list of ComponentReferences that is nesting this component reference
+ * @return
+ */
+ public List<ComponentReference> getChildComponentReferences(){
+ if (componentReferences==null){
+ componentReferences=new ArrayList<ComponentReference>();
+ }
+ return componentReferences;
+ }
+
+ /**
+ * The result of this method is used by DefaultMutableTreeNode to show a name in JTree.
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return this.name;
+ }
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ComponentRegistryException.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ComponentRegistryException.java?rev=1340591&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ComponentRegistryException.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/component/ComponentRegistryException.java Sat May 19 23:24:55 2012
@@ -0,0 +1,61 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.workflow.model.component;
+
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+
+public class ComponentRegistryException extends WorkflowException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3908646466269971824L;
+
+ /**
+ * Constructs a ComponentRegistryException.
+ */
+ public ComponentRegistryException() {
+ super();
+ }
+
+ /**
+ * @param message
+ */
+ public ComponentRegistryException(String message) {
+ super(message);
+ }
+
+ /**
+ * @param cause
+ */
+ public ComponentRegistryException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public ComponentRegistryException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
\ No newline at end of file
Added: incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/utils/FileConstants.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/utils/FileConstants.java?rev=1340591&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/utils/FileConstants.java (added)
+++ incubator/airavata/trunk/modules/workflow-model/src/main/java/org/apache/airavata/workflow/model/utils/FileConstants.java Sat May 19 23:24:55 2012
@@ -0,0 +1,40 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.workflow.model.utils;
+
+public class FileConstants {
+ /**
+ * File suffix for XML
+ */
+ public static final String XML_SUFFIX = ".xml";
+
+ /**
+ * File suffix for WSDL
+ */
+ public static final String WSDL_SUFFIX = ".wsdl";
+
+ /**
+ * File suffix for WSDL
+ */
+ public static final String WSDL_SUFFIX2 = "-wsdl.xml";
+
+}
Added: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/ComponentController.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/ComponentController.java?rev=1340591&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/ComponentController.java (added)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/ComponentController.java Sat May 19 23:24:55 2012
@@ -0,0 +1,50 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.component.registry;
+
+import java.util.List;
+
+import org.apache.airavata.workflow.model.component.ComponentReference;
+import org.apache.airavata.workflow.model.component.ComponentRegistryException;
+import org.apache.airavata.workflow.model.component.registry.ComponentRegistry;
+import org.apache.airavata.xbaya.ui.widgets.component.ComponentTreeNode;
+
+public class ComponentController {
+
+ public static ComponentTreeNode getComponentTree(ComponentRegistry registry) throws ComponentRegistryException {
+ ComponentTreeNode tree = new ComponentTreeNode(registry);
+ addComponentReferencesToTree(tree, registry.getComponentReferenceList());
+ return tree;
+ }
+
+ private static void addComponentReferencesToTree(ComponentTreeNode tree,
+ List<ComponentReference> componentReferenceList) {
+ for (ComponentReference componentReference : componentReferenceList) {
+ ComponentTreeNode componentTreeNode = new ComponentTreeNode(componentReference);
+ if (componentReference.isParentComponent()){
+ addComponentReferencesToTree(componentTreeNode, componentReference.getChildComponentReferences());
+ }
+ tree.add(componentTreeNode);
+ }
+ }
+
+}