diff --git a/.classpath b/.classpath index 84750b8..fb6bcdd 100644 --- a/.classpath +++ b/.classpath @@ -7,12 +7,22 @@ - + + + + + + + + + + + @@ -24,5 +34,6 @@ + diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 2852ff5..c72f385 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -4,6 +4,12 @@ + + uses + + + uses + diff --git a/pom.xml b/pom.xml index 93144b9..840238a 100644 --- a/pom.xml +++ b/pom.xml @@ -145,6 +145,11 @@ software-upload-wizard [1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT) + + org.gcube.portlets.admin + activation-record-widgets + [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT) + com.allen-sauer.gwt.log gwt-log diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/ResourceManagementPortlet.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/ResourceManagementPortlet.java index e236e4b..2fc4111 100644 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/ResourceManagementPortlet.java +++ b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/ResourceManagementPortlet.java @@ -17,11 +17,11 @@ package org.gcube.portlets.admin.resourcemanagement.client; +import org.gcube.portlets.admin.client.forms.ActivationRecordVMForm; +import org.gcube.portlets.admin.client.forms.GenericResourceCMForm; +import org.gcube.portlets.admin.client.forms.GenericResourceTreeManagerForm; import org.gcube.portlets.admin.ishealthmonitor.client.dialog.ISMonitor; -import org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources.ActivationRecordVMForm; import org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources.DeployVirtualCollection; -import org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources.GenericResourceCMForm; -import org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources.GenericResourceTreeManagerForm; import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry; import org.gcube.portlets.admin.resourcemanagement.client.utils.Commands; import org.gcube.portlets.admin.resourcemanagement.client.utils.Messages; @@ -35,8 +35,6 @@ import org.gcube.portlets.admin.resourcemanagement.client.widgets.panels.MainPan import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.UIIdentifiers; import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.WidgetsRegistry; import org.gcube.portlets.admin.resourcemanagement.client.widgets.viewport.MainContainer; -import org.gcube.portlets.admin.resourcemanagement.shared.Configuration; -import org.gcube.portlets.admin.resourcemanagement.shared.utils.DelayedOperation; import org.gcube.portlets.admin.resourcesweeper.client.dialog.SweeperDialog; import org.gcube.resourcemanagement.support.client.Resource_support; import org.gcube.resourcemanagement.support.client.events.SetScopeEvent; @@ -47,6 +45,7 @@ import org.gcube.resourcemanagement.support.shared.exceptions.InvalidParameterEx import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations; import org.gcube.resourcemanagement.support.shared.types.RunningMode; import org.gcube.resourcemanagement.support.shared.types.UserGroup; +import org.gcube.resourcemanagement.support.shared.util.Configuration; import com.extjs.gxt.ui.client.Style.LayoutRegion; import com.extjs.gxt.ui.client.Style.Scroll; @@ -502,7 +501,17 @@ public class ResourceManagementPortlet implements EntryPoint { protected void onClick(final ComponentEvent be) { super.onClick(be); if (SupportedOperations.GENERIC_RESOURCE_CREATE.isAllowed(StatusHandler.getStatus().getCredentials())) { - new GenericResourceTreeManagerForm().show(); + GWT.runAsync(GenericResourceTreeManagerForm.class, new RunAsyncCallback() { + @Override + public void onSuccess() { + String currentScope = StatusHandler.getStatus().getCurrentScope(); + new GenericResourceTreeManagerForm(currentScope).show(); + } + + public void onFailure(Throwable reason) { + Window.alert("There are networks problem, please check your connection."); + } + }); } else { MessageBox.alert("Activation Record for TM", "You are not allowed to execute this operation", null); } @@ -516,7 +525,18 @@ public class ResourceManagementPortlet implements EntryPoint { protected void onClick(final ComponentEvent be) { super.onClick(be); if (SupportedOperations.GENERIC_RESOURCE_CREATE.isAllowed(StatusHandler.getStatus().getCredentials())) { - new GenericResourceCMForm().show(); + GWT.runAsync(GenericResourceCMForm.class, new RunAsyncCallback() { + @Override + public void onSuccess() { + String currentScope = StatusHandler.getStatus().getCurrentScope(); + new GenericResourceCMForm(currentScope).show(); + } + + public void onFailure(Throwable reason) { + Window.alert("There are networks problem, please check your connection."); + } + }); + } else { MessageBox.alert("Activation Record for CM", "You are not allowed to execute this operation", null); } @@ -531,7 +551,18 @@ public class ResourceManagementPortlet implements EntryPoint { super.onClick(be); if (SupportedOperations.GENERIC_RESOURCE_CREATE.isAllowed(StatusHandler.getStatus().getCredentials())) { //MessageBox.alert("Activation Record for VM", "Operation not implemented yet.", null); - new ActivationRecordVMForm().show(); + + GWT.runAsync(ActivationRecordVMForm.class, new RunAsyncCallback() { + @Override + public void onSuccess() { + String currentScope = StatusHandler.getStatus().getCurrentScope(); + new ActivationRecordVMForm(currentScope).show(); + } + + public void onFailure(Throwable reason) { + Window.alert("There are networks problem, please check your connection."); + } + }); } else { MessageBox.alert("Activation Record for VM", "You are not allowed to execute this operation", null); } diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/forms/genericresources/ActivationRecordVMForm.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/forms/genericresources/ActivationRecordVMForm.java deleted file mode 100644 index 7c3d086..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/forms/genericresources/ActivationRecordVMForm.java +++ /dev/null @@ -1,420 +0,0 @@ -/**************************************************************************** -= * This software is part of the gCube Project. - * Site: http://www.gcube-system.org/ - **************************************************************************** - * The gCube/gCore software is licensed as Free Open Source software - * conveying to the EUPL (http://ec.europa.eu/idabc/eupl). - * The software and documentation is provided by its authors/distributors - * "as is" and no expressed or - * implied warranty is given for its use, quality or fitness for a - * particular case. - **************************************************************************** - * Filename: ActivationRecordVMForm.java - **************************************************************************** - * @author Daniele Strollo - ***************************************************************************/ - -package org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources; - -import java.util.List; -import java.util.Vector; -import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry; -import org.gcube.portlets.admin.resourcemanagement.client.utils.Commands; -import org.gcube.portlets.admin.resourcemanagement.client.utils.OpCommands; - - -import org.gcube.resourcemanagement.support.client.utils.StatusHandler; -import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator; -import org.gcube.resourcemanagement.support.client.views.validators.SelectValidator; -import org.gcube.resourcemanagement.support.shared.exceptions.InvalidParameterException; -import org.gcube.resourcemanagement.support.shared.types.Tuple; -import org.gcube.resourcemanagement.support.shared.types.datamodel.AtomicTreeNode; -import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor; - -import com.extjs.gxt.ui.client.Style.HorizontalAlignment; -import com.extjs.gxt.ui.client.Style.Scroll; -import com.extjs.gxt.ui.client.data.ModelData; -import com.extjs.gxt.ui.client.event.ComponentEvent; -import com.extjs.gxt.ui.client.store.ListStore; -import com.extjs.gxt.ui.client.widget.Dialog; -import com.extjs.gxt.ui.client.widget.HorizontalPanel; -import com.extjs.gxt.ui.client.widget.MessageBox; -import com.extjs.gxt.ui.client.widget.button.Button; -import com.extjs.gxt.ui.client.widget.form.ComboBox; -import com.extjs.gxt.ui.client.widget.form.Field; -import com.extjs.gxt.ui.client.widget.form.FieldSet; -import com.extjs.gxt.ui.client.widget.form.FormButtonBinding; -import com.extjs.gxt.ui.client.widget.form.FormPanel; -import com.extjs.gxt.ui.client.widget.form.TextArea; -import com.extjs.gxt.ui.client.widget.form.TextField; -import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction; -import com.extjs.gxt.ui.client.widget.layout.FitLayout; -import com.extjs.gxt.ui.client.widget.layout.FormData; -import com.extjs.gxt.ui.client.widget.layout.FormLayout; -import com.google.gwt.user.client.Element; -import com.google.gwt.user.client.rpc.AsyncCallback; - -enum StaticFields { - VIEW_NAME("name", "e.g.: the name of the property", "e.g.: put here the name"), - METADATA_NAME("schemaName", "e.g.: metadata prefix", "e.g.: FARM_dc"), - METADATA_LANG("language", "e.g.: metadata language", "e.g.: en"), - METADATA_SCHEMA("schemaURI", "e.g.: metadata schema", "e.g.: http://193.43.36.238:8282/fi/figis/devcon/schema/dc/qualifieddc.xsd"), - IS_EDITABLE("isEditable", "e.g.: editable", "e.g.: true"), - IS_INDEXABLE("isIndexable", "e.g.: indexable", "e.g.: true"), - IS_USER_COLLECTION("isUserCollection", "e.g.: user collection", "e.g.: true"); - - private String name = null; - private String description = null; - private String value = null; - - - private StaticFields(final String name, final String description, final String value) { - this.name = name; - this.description = description; - this.value = value; - } - - - public String getName() { - return name; - } - - public String getDescription() { - return description; - } - - public String getValue() { - return value; - } -} - -public class ActivationRecordVMForm extends Dialog { - private FormData formData = null; - private FormPanel form = null; - - public ActivationRecordVMForm() { - this.setLayout(new FitLayout()); - this.setHeading("Activation Record for VM"); - this.setModal(true); - this.setWidth(700); - this.setHeight(500); - this.setResizable(false); - this.getButtonBar().removeAll(); - this.setHideOnButtonClick(true); - } - - @Override - protected final void onRender(final Element parent, final int index) { - super.onRender(parent, index); - formData = new FormData("-20"); - createForm(); - } - - public final void closeDialog() { - this.hide(); - } - - private void addStaticProperty(final String pfield, final String pdescription, final String pvalue) { - final FieldSet fieldSet = new FieldSet(); - fieldSet.setLayout(new FormLayout()); - - fieldSet.setHeading("Property"); - fieldSet.setCollapsible(false); - - TextField name = new TextField(); - name.setFieldLabel("Name"); - name.setValue(pfield); - name.setEnabled(false); - name.setAllowBlank(false); - fieldSet.add(name, formData); - - TextField description = new TextField(); - description.setFieldLabel("Description"); - description.setEmptyText(pdescription); - description.setAllowBlank(true); - fieldSet.add(description, formData); - - TextField value = new TextField(); - value.setFieldLabel("Value"); - value.setEmptyText(pvalue); - value.setAllowBlank(false); - fieldSet.add(value, formData); - - form.add(fieldSet, formData); - fieldSet.recalculate(); - this.doLayout(true); - } - - private void addProperty() { - final FieldSet fieldSet = new FieldSet(); - fieldSet.setLayout(new FormLayout()); - - fieldSet.setHeading("Property"); - fieldSet.setCollapsible(false); - - TextField name = new TextField(); - name.setFieldLabel("Name"); - name.setAllowBlank(false); - fieldSet.add(name, formData); - - TextField description = new TextField(); - description.setFieldLabel("Description"); - description.setAllowBlank(true); - fieldSet.add(description, formData); - - TextField value = new TextField(); - value.setFieldLabel("Value"); - value.setAllowBlank(false); - fieldSet.add(value, formData); - - final HorizontalPanel buttonPanel = new HorizontalPanel(); - Button addButton = new Button("Add New Property") { - @Override - protected void onClick(final ComponentEvent ce) { - addProperty(); - } - }; - addButton.setIconStyle("new-icon"); - buttonPanel.add(addButton); - - Button delButton = new Button("Remove This Property") { - @Override - protected void onClick(final ComponentEvent ce) { - form.remove(fieldSet); - } - }; - delButton.setIconStyle("delete-icon"); - buttonPanel.add(delButton); - fieldSet.add(buttonPanel, formData); - - form.add(fieldSet, formData); - fieldSet.recalculate(); - this.doLayout(true); - } - - private void createForm() { - form = new FormPanel(); - form.setFrame(true); - form.setAutoWidth(true); - - //form.setLayout(new FlowLayout()); - form.setScrollMode(Scroll.AUTO); - - form.setHeaderVisible(false); - form.getHeader().setStyleName("x-hide-panel-header"); - - TextField resID = new TextField(); - resID.setFieldLabel("Resource ID"); - resID.setEnabled(false); - resID.setAllowBlank(true); // is required - - resID.setEmptyText(""); - - form.add(resID, formData); - - TextField resName = new TextField(); - resName.setFieldLabel("Resource Name"); - resName.setValue("VMRecord"); - resName.setEnabled(false); - //resName.setValidator(new StringValidator(20, false)); - resName.setAllowBlank(false); // is required - form.add(resName, formData); - - TextField resType = new TextField(); - resType.setFieldLabel("Secondary type"); - resType.setValue("ActivationRecord"); - resType.setEnabled(false); - // resType.setValidator(new StringValidator(20, false)); - resType.setAllowBlank(false); // is required - form.add(resType, formData); - - TextArea description = new TextArea(); - description.setFieldLabel("Description"); - form.add(description, formData); - - ComboBox pluginSelect = new ComboBox(); - ListStore storePlugin = new ListStore(); - storePlugin.add(new AtomicTreeNode("Metadata")); - storePlugin.add(new AtomicTreeNode("Annotation")); - pluginSelect.setStore(storePlugin); - pluginSelect.setFieldLabel("Plugin Kind:"); - pluginSelect.setEmptyText("Select a plugin..."); - pluginSelect.setTypeAhead(true); - pluginSelect.setTriggerAction(TriggerAction.ALL); - pluginSelect.setDisplayField("name"); - pluginSelect.setForceSelection(true); - form.add(pluginSelect, formData); - - // The select for collections - ComboBox collectionSelect = new ComboBox(); - ListStore store = new ListStore(); - try { - store.add(new ResourceDescriptor("type", "subtype", "ID", "the name")); - } catch (InvalidParameterException e) { - e.printStackTrace(); - } - collectionSelect.setStore(store); - collectionSelect.setFieldLabel("Collection"); - collectionSelect.setEmptyText("Select a collection..."); - collectionSelect.setDisplayField("name"); - collectionSelect.setTypeAhead(true); - collectionSelect.setTriggerAction(TriggerAction.ALL); - collectionSelect.setForceSelection(true); - collectionSelect.setData("text", "Select a collection"); - - form.add(collectionSelect, formData); - - loadCollections(StatusHandler.getStatus().getCurrentScope(), collectionSelect); - // -- ENDOF The select for collections - - // Inserts the static fields - for (StaticFields entry : StaticFields.values()) { - this.addStaticProperty(entry.getName(), entry.getDescription(), entry.getValue()); - } - - HorizontalPanel buttonPanel = new HorizontalPanel(); - Button addButton = new Button("Add New Property") { - @Override - protected void onClick(final ComponentEvent ce) { - addProperty(); - } - }; - addButton.setIconStyle("new-icon"); - buttonPanel.add(addButton); - - form.add(buttonPanel, formData); - - Button submitBtn = new Button("Submit") { - @Override - protected void onClick(final ComponentEvent ce) { - super.onClick(ce); - if (!form.isValid()) { - return; - } - - List> fields = form.getFields(); - - // Creation mode - // the parameter in position 0 is the - // auto-generated ID. - String resName = fields.get(1).getRawValue(); - String resType = fields.get(2).getRawValue(); - String description = fields.get(3).getRawValue(); - String plugin = fields.get(4).getRawValue() + "Plugin"; - String viewType = fields.get(4).getRawValue() + "View"; - String viewID = generateID(); - - String collectionID = ((ResourceDescriptor) fields.get(5).getValue()).getID(); - - // builds a list of tuples each one representing a single property - // properties are supposed to be represented by three fields each one. - List> properties = new Vector>(); - if (fields.size() > StaticFields.values().length - 1) { - for (int i = StaticFields.values().length - 1; i < fields.size(); i = i + 3) { - properties.add(new Tuple( - fields.get(i).getRawValue().trim(), - (fields.get(i + 1).getRawValue() != null) ? fields.get(i + 1).getRawValue().trim() : "", // description can be null - fields.get(i + 2).getRawValue().trim())); - } - } else { - MessageBox.alert("Create Activation Form for VM", "No properties defined", null); - return; - } - - StringBuilder body = new StringBuilder(); - - body.append(""); - body.append("ResourceManagementPortlet"); - body.append("" + plugin + ""); - - body.append(""); - - body.append("" + viewID + ""); - body.append("" + collectionID + ""); - body.append("" + viewType + ""); - body.append(""); - body.append("" + fields.get(4).getRawValue() + " view for collection " + collectionID + ""); - body.append("0"); - body.append("" + "2010-10-25T14:01:55.948+00:00" + ""); - - for (Tuple prop : properties) { - body.append(""); - - body.append("" + prop.get(0) + ""); - body.append("" + prop.get(1) + ""); - body.append("" + prop.get(2) + ""); - - body.append(""); - } - - body.append(""); - body.append(""); - - OpCommands.doCreateGenericResource(viewID, resName, description, body.toString(), resType); - closeDialog(); - } - }; - form.addButton(submitBtn); - form.addButton(new Button("Cancel") { - @Override - protected void onClick(final ComponentEvent ce) { - super.onClick(ce); - closeDialog(); - } - }); - - form.setButtonAlign(HorizontalAlignment.CENTER); - - FormButtonBinding binding = new FormButtonBinding(form); - binding.addButton(submitBtn); - - this.add(form); - } - - private String generateID() { - char[] s = new char[36]; - String itoh = "0123456789abcdef"; - - // Make array of random hex digits. The UUID only has 32 digits in it, but we - // allocate an extra items to make room for the '-'s we'll be inserting. - for (int i = 0; i < 36; i++) { - s[i] = (char) Math.floor(Math.random() * 0x10); - } - - // Conform to RFC-4122, section 4.4 - s[14] = 4; // Set 4 high bits of time_high field to version - s[19] = (char) ((s[19] & 0x3) | 0x8); // Specify 2 high bits of clock sequence - - // Convert to hex chars - for (int i = 0; i < 36; i++) { - s[i] = itoh.charAt((int) s[i]); - } - - // Insert '-'s - s[8] = s[13] = s[18] = s[23] = '-'; - return new String(s); - } - - private void loadCollections(final String scope, final ComboBox combo) { - ProxyRegistry.getProxyInstance().getResourcesModel(scope, - ResourceTypeDecorator.GenericResource.name(), - "GCUBECollection", - null, - new AsyncCallback>() { - - public void onSuccess(final List result) { - combo.getStore().removeAll(); - combo.getStore().add(result); - - combo.setValidator(new SelectValidator(false)); - combo.setAllowBlank(false); - combo.setTriggerAction(TriggerAction.ALL); - combo.recalculate(); - Commands.showPopup("Collection load", "Loaded (" + result.size() + ") Collections"); - } - public void onFailure(final Throwable e) { - MessageBox.alert("Error getting collections", e.getMessage(), null); - } - }); - } -} diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/forms/genericresources/GenericResourceCMForm.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/forms/genericresources/GenericResourceCMForm.java deleted file mode 100644 index d2355bf..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/forms/genericresources/GenericResourceCMForm.java +++ /dev/null @@ -1,329 +0,0 @@ -/**************************************************************************** - * This software is part of the gCube Project. - * Site: http://www.gcube-system.org/ - **************************************************************************** - * The gCube/gCore software is licensed as Free Open Source software - * conveying to the EUPL (http://ec.europa.eu/idabc/eupl). - * The software and documentation is provided by its authors/distributors - * "as is" and no expressed or - * implied warranty is given for its use, quality or fitness for a - * particular case. - **************************************************************************** - * Filename: GenericResourcePluginForm.java - **************************************************************************** - * @author Daniele Strollo - ***************************************************************************/ - -package org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry; -import org.gcube.portlets.admin.resourcemanagement.client.utils.OpCommands; -import org.gcube.resourcemanagement.support.client.views.validators.SelectValidator; -import org.gcube.resourcemanagement.support.shared.plugins.GenericResourcePlugin; -import org.gcube.resourcemanagement.support.shared.types.Tuple; -import org.gcube.resourcemanagement.support.shared.types.datamodel.AtomicTreeNode; - -import com.extjs.gxt.ui.client.Style.Scroll; -import com.extjs.gxt.ui.client.data.ModelData; -import com.extjs.gxt.ui.client.event.ComponentEvent; -import com.extjs.gxt.ui.client.event.SelectionChangedEvent; -import com.extjs.gxt.ui.client.event.SelectionChangedListener; -import com.extjs.gxt.ui.client.store.ListStore; -import com.extjs.gxt.ui.client.widget.Component; -import com.extjs.gxt.ui.client.widget.Dialog; -import com.extjs.gxt.ui.client.widget.MessageBox; -import com.extjs.gxt.ui.client.widget.button.Button; -import com.extjs.gxt.ui.client.widget.form.ComboBox; -import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction; -import com.extjs.gxt.ui.client.widget.form.Field; -import com.extjs.gxt.ui.client.widget.form.FieldSet; -import com.extjs.gxt.ui.client.widget.form.FormButtonBinding; -import com.extjs.gxt.ui.client.widget.form.FormPanel; -import com.extjs.gxt.ui.client.widget.form.TextArea; -import com.extjs.gxt.ui.client.widget.form.TextField; -import com.extjs.gxt.ui.client.widget.layout.FitLayout; -import com.extjs.gxt.ui.client.widget.layout.FlowLayout; -import com.extjs.gxt.ui.client.widget.layout.FormData; -import com.extjs.gxt.ui.client.widget.layout.FormLayout; -import com.google.gwt.user.client.Element; -import com.google.gwt.user.client.rpc.AsyncCallback; - -public class GenericResourceCMForm extends Dialog { - private FormData formData = null; - private FormPanel form = null; - private FieldSet pluginFieldSet = null; - private String selectedPlugin = null; - private Map loadedPlugins = null; - private TextField resName = null; - - public GenericResourceCMForm() { - this.setLayout(new FitLayout()); - this.setHeading("Generic Resource Creation (Plugin)"); - this.setModal(true); - this.setWidth(700); - this.setHeight(500); - this.setResizable(false); - this.getButtonBar().removeAll(); - this.setHideOnButtonClick(true); - } - - @Override - protected final void onRender(final Element parent, final int index) { - super.onRender(parent, index); - formData = new FormData("-20"); - createForm(); - createPluginForm(); - this.add(form); - - this.initButtons(); - - this.recalculate(); - this.doLayout(true); - - this.form.mask("Loading plugins..."); - // Gets the plugins - ProxyRegistry.getProxyInstance().getGenericResourcePlugins(new AsyncCallback>() { - public void onSuccess(final Map result) { - addPluginSelect(result); - form.unmask(); - } - - public void onFailure(final Throwable caught) { - MessageBox.alert("Create Generic Resource (Plugin)", - "Received an exception: " + caught.getMessage(), null); - form.unmask(); - } - }); - } - - public final void closeDialog() { - this.hide(); - } - - private void setPluginFields(final GenericResourcePlugin plugin) { - if (plugin.getParams().size() == 0) { - return; - } - Component select = pluginFieldSet.getItem(0); - pluginFieldSet.removeAll(); - pluginFieldSet.add(select); - - for (GenericResourcePlugin.Field field : plugin.getParams()) { - if (field.getType() == GenericResourcePlugin.FieldType.string) { - TextField toAdd = new TextField(); - toAdd.setFieldLabel(field.getLabel() + (field.isRequired() ? "*" : "")); - toAdd.setName(field.getName()); - //toAdd.setValidator(new StringValidator(128, !field.isRequired())); - toAdd.setAllowBlank(!field.isRequired()); // is required - toAdd.setValue(field.getDefaultValue()); - pluginFieldSet.add(toAdd, formData); - pluginFieldSet.recalculate(); - this.doLayout(true); - } - } - } - - private void addPluginSelect(final Map plugins) { - ListStore store = new ListStore(); - for (String pluginName : plugins.keySet()) { - store.add(new AtomicTreeNode(pluginName)); - } - - ComboBox combo = new ComboBox(); - combo.setFieldLabel("Plugin"); - combo.addSelectionChangedListener(new SelectionChangedListener() { - @Override - public void selectionChanged(final SelectionChangedEvent se) { - if (se != null && - se.getSelection() != null - && se.getSelection() instanceof ArrayList) { - @SuppressWarnings("rawtypes") - String selection = ((ArrayList) se.getSelection()).get(0).toString(); - selectedPlugin = selection; - setPluginFields(loadedPlugins.get(selection)); - } - } - }); - combo.setEmptyText("Select a plugin..."); - combo.setDisplayField("name"); - combo.setStore(store); - combo.setTypeAhead(true); - combo.setValidator(new SelectValidator(false)); - combo.setAllowBlank(false); - combo.setForceSelection(true); - combo.setTriggerAction(TriggerAction.ALL); - combo.recalculate(); - - - pluginFieldSet.recalculate(); - pluginFieldSet.add(combo, formData); - this.doLayout(true); - this.loadedPlugins = plugins; - } - - private void createForm() { - form = new FormPanel(); - form.setFrame(true); - form.setAutoWidth(true); - - form.setHeaderVisible(false); - form.getHeader().setStyleName("x-hide-panel-header"); - form.setLayout(new FlowLayout()); - - form.setScrollMode(Scroll.AUTO); - - FieldSet formHead = new FieldSet(); - formHead.setHeading("Basic parameters"); - formHead.setCollapsible(true); - - FormLayout layout = new FormLayout(); - layout.setLabelWidth(90); - formHead.setLayout(layout); - - TextField resID = new TextField(); - resID.setFieldLabel("Resource ID"); - // resID.setValidator(new StringValidator(64, false)); - resID.setAllowBlank(false); // is required - // If in editing mode - - resID.setEmptyText(""); - resID.setEnabled(false); - formHead.add(resID, formData); - - this.resName = new TextField(); - resName.setFieldLabel("Resource Name"); - // resName.setValidator(new StringValidator(64, false)); - resName.setAllowBlank(false); // is required - resName.setValue("CMSRecord"); - resName.setEnabled(false); - formHead.add(resName, formData); - - ComboBox resType = new ComboBox(); - ListStore storePlugin = new ListStore(); - storePlugin.add(new AtomicTreeNode("ActivationRecord")); - storePlugin.add(new AtomicTreeNode("VirtualCollection")); - resType.setStore(storePlugin); - resType.setFieldLabel("Secondary Type"); - //resType.setEmptyText("Select a subtype..."); - resType.setValue(storePlugin.getAt(0)); - resType.setDisplayField("name"); - resType.setAllowBlank(false); - resType.setTypeAhead(true); - resType.setTriggerAction(TriggerAction.ALL); - resType.setForceSelection(true); - resType.addSelectionChangedListener(new SelectionChangedListener() { - @Override - public void selectionChanged(final SelectionChangedEvent se) { - // The usual casting trick for fixing invalid class specification - // of generic return in models. - if (se.getSelection().get(0).getName().equals("VirtualCollection")) { - resName.setFieldLabel("Collection Name"); - resName.setValue(null); - resName.setEnabled(true); - } else { - resName.setFieldLabel("Resource Name"); - resName.setValue("CMSRecord"); - resName.setEnabled(false); - } - } - }); - formHead.add(resType, formData); - - TextArea description = new TextArea(); - description.setFieldLabel("Description"); - description.setPreventScrollbars(false); - //description.setHeight(50); - formHead.add(description, formData); - - form.add(formHead); - } - - private void createPluginForm() { - this.pluginFieldSet = new FieldSet(); - pluginFieldSet.setHeading("Plugin parameters"); - pluginFieldSet.setCollapsible(true); - - FormLayout layout = new FormLayout(); - layout.setLabelWidth(110); - pluginFieldSet.setLayout(layout); - form.add(pluginFieldSet); - } - - public final void initButtons() { - Button submitBtn = new Button("Submit") { - @SuppressWarnings("deprecation") - @Override - protected void onClick(final ComponentEvent ce) { - super.onClick(ce); - if (!form.isValid()) { - return; - } - Tuple values = new Tuple(); - for (Field field : form.getFields()) { - values.append(field.getRawValue()); - } - - String resName = values.get(1); - String resType = values.get(2); - String description = values.get(3); - - StringBuilder body = new StringBuilder(); - body.append(""); - body.append("ResourceManagementPortlet"); - body.append(""); - body.append("true"); - - if (selectedPlugin == null) { - return; - } - GenericResourcePlugin plugin = loadedPlugins.get(selectedPlugin); - body.append(""); - Map submitted = new HashMap(); - for (Field field : form.getFields()) { - submitted.put(field.getName(), field.getRawValue()); - } - if (plugin.getParams() != null && plugin.getParams().size() > 0) { - for (GenericResourcePlugin.Field field : plugin.getParams()) { - try { - String tag = field.getName(); - String value = submitted.get(tag).toString(); - if (value != null && value.trim().length() > 0) { - body.append("<" + tag + ">" + value + ""); - } - } catch (RuntimeException e) { - // parsing errors will be skipped - } - } - } - - body.append(""); - body.append("" + plugin.getName() + ""); - body.append(""); - body.append(""); - - OpCommands.doCreateGenericResource(null, resName, description, body.toString(), resType); - - - closeDialog(); - } - }; - this.form.addButton(submitBtn); - - this.form.addButton(new Button("Cancel") { - @Override - protected void onClick(final ComponentEvent ce) { - super.onClick(ce); - closeDialog(); - } - }); - - ///form.setButtonAlign(HorizontalAlignment.CENTER); - - FormButtonBinding binding = new FormButtonBinding(form); - binding.addButton(submitBtn); - } -} diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/forms/genericresources/GenericResourceTreeManagerForm.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/forms/genericresources/GenericResourceTreeManagerForm.java deleted file mode 100644 index d28a4f9..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/forms/genericresources/GenericResourceTreeManagerForm.java +++ /dev/null @@ -1,343 +0,0 @@ -/**************************************************************************** - * This software is part of the gCube Project. - * Site: http://www.gcube-system.org/ - **************************************************************************** - * The gCube/gCore software is licensed as Free Open Source software - * conveying to the EUPL (http://ec.europa.eu/idabc/eupl). - * The software and documentation is provided by its authors/distributors - * "as is" and no expressed or - * implied warranty is given for its use, quality or fitness for a - * particular case. - **************************************************************************** - * Filename: GenericResourceTreeManagerForm.java - **************************************************************************** - * @author Massimiliano Assante - ***************************************************************************/ - -package org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry; -import org.gcube.portlets.admin.resourcemanagement.client.utils.OpCommands; -import org.gcube.resourcemanagement.support.client.views.validators.SelectValidator; -import org.gcube.resourcemanagement.support.shared.plugins.TMPluginFormField; -import org.gcube.resourcemanagement.support.shared.types.Tuple; -import org.gcube.resourcemanagement.support.shared.types.datamodel.AtomicTreeNode; - -import com.extjs.gxt.ui.client.Style.Scroll; -import com.extjs.gxt.ui.client.data.ModelData; -import com.extjs.gxt.ui.client.event.ComponentEvent; -import com.extjs.gxt.ui.client.event.SelectionChangedEvent; -import com.extjs.gxt.ui.client.event.SelectionChangedListener; -import com.extjs.gxt.ui.client.store.ListStore; -import com.extjs.gxt.ui.client.widget.Component; -import com.extjs.gxt.ui.client.widget.Dialog; -import com.extjs.gxt.ui.client.widget.MessageBox; -import com.extjs.gxt.ui.client.widget.button.Button; -import com.extjs.gxt.ui.client.widget.form.ComboBox; -import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction; -import com.extjs.gxt.ui.client.widget.form.Field; -import com.extjs.gxt.ui.client.widget.form.FieldSet; -import com.extjs.gxt.ui.client.widget.form.FormButtonBinding; -import com.extjs.gxt.ui.client.widget.form.FormPanel; -import com.extjs.gxt.ui.client.widget.form.TextArea; -import com.extjs.gxt.ui.client.widget.form.TextField; -import com.extjs.gxt.ui.client.widget.layout.FitLayout; -import com.extjs.gxt.ui.client.widget.layout.FlowLayout; -import com.extjs.gxt.ui.client.widget.layout.FormData; -import com.extjs.gxt.ui.client.widget.layout.FormLayout; -import com.google.gwt.user.client.Element; -import com.google.gwt.user.client.rpc.AsyncCallback; -/** - * - * @author Massimiliano Assante, ISTI-CNR - * @version 1.0 Oct 2012 - * - */ -public class GenericResourceTreeManagerForm extends Dialog { - private FormData formData = null; - private FormPanel form = null; - private FieldSet pluginFieldSet = null; - private String selectedPlugin = null; - private HashMap> loadedPlugins = null; - private TextField resName = null; - - public GenericResourceTreeManagerForm() { - this.setLayout(new FitLayout()); - this.setHeading("Generic Resource Creation (TM Plugin)"); - this.setModal(true); - this.setWidth(700); - this.setHeight(500); - this.setResizable(false); - this.getButtonBar().removeAll(); - this.setHideOnButtonClick(true); - } - - @Override - protected final void onRender(final Element parent, final int index) { - super.onRender(parent, index); - formData = new FormData("-20"); - createForm(); - createPluginForm(); - this.add(form); - - this.initButtons(); - - this.recalculate(); - this.doLayout(true); - - this.form.mask("Loading plugins..."); - // Gets the plugins - ProxyRegistry.getProxyInstance().getGenericResourceTreeMagnagerPlugins(new AsyncCallback>>() { - @Override - public void onSuccess(HashMap> result) { - addPluginSelect(result); - form.unmask(); - } - @Override - public void onFailure(final Throwable caught) { - MessageBox.alert("Create Generic Resource (Tree Manager Plugin)", - "Received an exception: " + caught.getMessage(), null); - form.unmask(); - } - }); - } - - public final void closeDialog() { - this.hide(); - } - - private void setPluginFields(final ArrayList fields) { - if (fields.size() == 0) { - return; - } - Component select = pluginFieldSet.getItem(0); - pluginFieldSet.removeAll(); - pluginFieldSet.add(select); - - for (TMPluginFormField field : fields) { - - TextField toAdd = new TextField(); - toAdd.setFieldLabel(field.getLabel() + (field.isRequired() ? "*" : "")); - toAdd.setName(field.getLabel()); - //toAdd.setValidator(new StringValidator(128, !field.isRequired())); - toAdd.setAllowBlank(!field.isRequired()); // is required - toAdd.setValue(field.getDefaultValue() + (field.isRepeatable() ? "," + field.getDefaultValue() + "2 (Repeatable, use comma to separate " + field.getLabel() + ")" : "")); - pluginFieldSet.add(toAdd, formData); - pluginFieldSet.recalculate(); - this.doLayout(true); - - } - } - - private void addPluginSelect(final HashMap> plugins) { - ListStore store = new ListStore(); - for (String pluginName : plugins.keySet()) { - store.add(new AtomicTreeNode(pluginName)); - } - - ComboBox combo = new ComboBox(); - combo.setFieldLabel("Plugin"); - combo.addSelectionChangedListener(new SelectionChangedListener() { - @Override - public void selectionChanged(final SelectionChangedEvent se) { - if (se != null && - se.getSelection() != null - && se.getSelection() instanceof ArrayList) { - @SuppressWarnings("rawtypes") - String selection = ((ArrayList) se.getSelection()).get(0).toString(); - selectedPlugin = selection; - setPluginFields(loadedPlugins.get(selection)); - } - } - }); - combo.setEmptyText("Select a plugin..."); - combo.setDisplayField("name"); - combo.setStore(store); - combo.setTypeAhead(true); - combo.setValidator(new SelectValidator(false)); - combo.setAllowBlank(false); - combo.setForceSelection(true); - combo.setTriggerAction(TriggerAction.ALL); - combo.recalculate(); - - - pluginFieldSet.recalculate(); - pluginFieldSet.add(combo, formData); - this.doLayout(true); - this.loadedPlugins = plugins; - } - - private void createForm() { - form = new FormPanel(); - form.setFrame(true); - form.setAutoWidth(true); - - form.setHeaderVisible(false); - form.getHeader().setStyleName("x-hide-panel-header"); - form.setLayout(new FlowLayout()); - - form.setScrollMode(Scroll.AUTO); - - FieldSet formHead = new FieldSet(); - formHead.setHeading("Basic parameters"); - formHead.setCollapsible(true); - - FormLayout layout = new FormLayout(); - layout.setLabelWidth(90); - formHead.setLayout(layout); - - TextField resID = new TextField(); - resID.setFieldLabel("Resource ID"); - // resID.setValidator(new StringValidator(64, false)); - resID.setAllowBlank(false); // is required - // If in editing mode - - resID.setEmptyText(""); - resID.setEnabled(false); - formHead.add(resID, formData); - - this.resName = new TextField(); - resName.setFieldLabel("Resource Name"); - // resName.setValidator(new StringValidator(64, false)); - resName.setAllowBlank(false); // is required - resName.setValue("TMRecord"); - resName.setEnabled(false); - formHead.add(resName, formData); - - ComboBox resType = new ComboBox(); - ListStore storePlugin = new ListStore(); - storePlugin.add(new AtomicTreeNode("ActivationRecord")); - resType.setStore(storePlugin); - resType.setFieldLabel("Secondary Type"); - //resType.setEmptyText("Select a subtype..."); - resType.setValue(storePlugin.getAt(0)); - resType.setDisplayField("name"); - resType.setAllowBlank(false); - resType.setEditable(false); - resType.setTypeAhead(false); - resType.setTriggerAction(TriggerAction.ALL); - resType.setForceSelection(true); - resType.addSelectionChangedListener(new SelectionChangedListener() { - @Override - public void selectionChanged(final SelectionChangedEvent se) { - // The usual casting trick for fixing invalid class specification - // of generic return in models. - if (se.getSelection().get(0).getName().equals("VirtualCollection")) { - resName.setFieldLabel("Collection Name"); - resName.setValue(null); - resName.setEnabled(true); - } else { - resName.setFieldLabel("Resource Name"); - resName.setValue("TMRecord"); - resName.setEnabled(false); - } - } - }); - formHead.add(resType, formData); - - TextArea description = new TextArea(); - description.setFieldLabel("Description"); - description.setPreventScrollbars(false); - //description.setHeight(50); - formHead.add(description, formData); - - form.add(formHead); - } - - private void createPluginForm() { - this.pluginFieldSet = new FieldSet(); - pluginFieldSet.setHeading("Plugin parameters"); - pluginFieldSet.setCollapsible(true); - - FormLayout layout = new FormLayout(); - layout.setLabelWidth(110); - pluginFieldSet.setLayout(layout); - form.add(pluginFieldSet); - } - - public final void initButtons() { - Button submitBtn = new Button("Submit") { - @SuppressWarnings("deprecation") - @Override - protected void onClick(final ComponentEvent ce) { - super.onClick(ce); - if (!form.isValid()) { - return; - } - Tuple values = new Tuple(); - for (Field field : form.getFields()) { - values.append(field.getRawValue()); - } - - String resName = values.get(1); - String resType = values.get(2); - String description = values.get(3); - - StringBuilder body = new StringBuilder(); - body.append(""); - body.append("ResourceManagementPortlet"); - body.append(""); - body.append("true"); - - if (selectedPlugin == null) { - return; - } - ArrayList fields = loadedPlugins.get(selectedPlugin); - body.append(""); - Map submitted = new HashMap(); - for (Field field : form.getFields()) { - submitted.put(field.getName(), field.getRawValue()); - } - if (fields != null && fields.size() > 0) { - for (TMPluginFormField field : fields) { - try { - String tag = field.getLabel(); - String value = submitted.get(tag).toString(); - if (value != null && value.trim().length() > 0) { - if (value.split(",").length > 0) { - String[] toAdd = value.split(","); - for (int i = 0; i < toAdd.length; i++) { - body.append("<" + tag + ">" + toAdd[i] + ""); - } - } - else - body.append("<" + tag + ">" + value + ""); - } - } catch (RuntimeException e) { - // parsing errors will be skipped - } - } - } - - body.append(""); - body.append("" + selectedPlugin + ""); - body.append(""); - body.append(""); - - - OpCommands.doCreateGenericResource(null, resName, description, body.toString(), resType); - - - closeDialog(); - } - }; - this.form.addButton(submitBtn); - - this.form.addButton(new Button("Cancel") { - @Override - protected void onClick(final ComponentEvent ce) { - super.onClick(ce); - closeDialog(); - } - }); - - ///form.setButtonAlign(HorizontalAlignment.CENTER); - - FormButtonBinding binding = new FormButtonBinding(form); - binding.addButton(submitBtn); - } -} diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/remote/ServiceProxy.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/remote/ServiceProxy.java index d672e25..3513756 100644 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/remote/ServiceProxy.java +++ b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/remote/ServiceProxy.java @@ -24,7 +24,6 @@ import java.util.Map; import org.gcube.resourcemanagement.support.client.utils.CurrentStatus; import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations; import org.gcube.resourcemanagement.support.shared.plugins.GenericResourcePlugin; -import org.gcube.resourcemanagement.support.shared.plugins.TMPluginFormField; import org.gcube.resourcemanagement.support.shared.types.Tuple; import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile; import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor; @@ -168,8 +167,6 @@ public interface ServiceProxy extends RemoteService { Map getGenericResourcePlugins() throws Exception; - HashMap> getGenericResourceTreeMagnagerPlugins() throws Exception; - /*********************************************************** * RESOURCE OPERATIONS **********************************************************/ diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/remote/ServiceProxyAsync.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/remote/ServiceProxyAsync.java index 999b135..8aaa720 100644 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/remote/ServiceProxyAsync.java +++ b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/remote/ServiceProxyAsync.java @@ -21,16 +21,13 @@ import java.util.HashMap; import java.util.List; import java.util.Map; - import org.gcube.resourcemanagement.support.client.utils.CurrentStatus; import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations; import org.gcube.resourcemanagement.support.shared.plugins.GenericResourcePlugin; -import org.gcube.resourcemanagement.support.shared.plugins.TMPluginFormField; import org.gcube.resourcemanagement.support.shared.types.Tuple; import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile; import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor; - import com.google.gwt.user.client.rpc.AsyncCallback; /** @@ -120,6 +117,5 @@ public interface ServiceProxyAsync { * RESOURCE OPERATIONS **********************************************************/ void doOperation(SupportedOperations opCode, String scope, List resources, AsyncCallback callback) throws Exception; - void getGenericResourceTreeMagnagerPlugins( - AsyncCallback>> callback); + } diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/utils/Commands.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/utils/Commands.java index 48a9c0f..d2b263c 100644 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/utils/Commands.java +++ b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/utils/Commands.java @@ -30,14 +30,14 @@ import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.Widge import org.gcube.portlets.admin.resourcemanagement.client.widgets.taskbar.TaskbarItem; import org.gcube.portlets.admin.resourcemanagement.client.widgets.taskbar.TaskbarRegister; import org.gcube.portlets.admin.resourcemanagement.client.widgets.viewport.MainContainer; -import org.gcube.portlets.admin.resourcemanagement.shared.Configuration; import org.gcube.portlets.admin.resourcemanagement.shared.exceptions.WidgetNotRegistered; -import org.gcube.portlets.admin.resourcemanagement.shared.utils.DelayedOperation; import org.gcube.resourcemanagement.support.client.utils.StatusHandler; import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator; import org.gcube.resourcemanagement.support.shared.types.Tuple; import org.gcube.resourcemanagement.support.shared.types.UserGroup; +import org.gcube.resourcemanagement.support.shared.util.Configuration; +import org.gcube.resourcemanagement.support.shared.util.DelayedOperation; import com.extjs.gxt.ui.client.data.ModelData; import com.extjs.gxt.ui.client.widget.Component; diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/utils/OpCommands.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/utils/OpCommands.java index ed285af..05ac796 100644 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/utils/OpCommands.java +++ b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/utils/OpCommands.java @@ -9,7 +9,7 @@ * implied warranty is given for its use, quality or fitness for a * particular case. **************************************************************************** - * Filename: OpCommands.java + * Filename: CommonOperations.java **************************************************************************** * @author Daniele Strollo ***************************************************************************/ @@ -23,12 +23,12 @@ import org.gcube.portlets.admin.resourcemanagement.client.forms.genericresources import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry; import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker; import org.gcube.portlets.admin.resourcemanagement.client.widgets.registry.UIIdentifiers; -import org.gcube.portlets.admin.resourcemanagement.shared.utils.DelayedOperation; import org.gcube.resourcemanagement.support.client.utils.StatusHandler; import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator; import org.gcube.resourcemanagement.support.shared.exceptions.InvalidParameterException; import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations; import org.gcube.resourcemanagement.support.shared.types.datamodel.ResourceDescriptor; +import org.gcube.resourcemanagement.support.shared.util.DelayedOperation; import com.extjs.gxt.ui.client.data.ModelData; import com.extjs.gxt.ui.client.event.Listener; diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/views/resourcedetails/ResourceDetailsPanel.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/views/resourcedetails/ResourceDetailsPanel.java index 4cca817..b15d258 100644 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/views/resourcedetails/ResourceDetailsPanel.java +++ b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/views/resourcedetails/ResourceDetailsPanel.java @@ -270,7 +270,7 @@ public class ResourceDetailsPanel { // @Override // protected void onClick(final ComponentEvent ce) { // super.onClick(ce); - // OpCommands.doOpenServiceForm(); + // CommonOperations.doOpenServiceForm(); // } // }; // createNew.setToolTip("Create new Software"); diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/widgets/taskbar/TaskbarItem.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/widgets/taskbar/TaskbarItem.java index 1f7c042..e76701a 100644 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/widgets/taskbar/TaskbarItem.java +++ b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/widgets/taskbar/TaskbarItem.java @@ -20,8 +20,8 @@ import org.gcube.portlets.admin.resourcemanagement.client.remote.ProxyRegistry; import org.gcube.portlets.admin.resourcemanagement.client.utils.Callbacks; import org.gcube.portlets.admin.resourcemanagement.client.utils.Commands; import org.gcube.portlets.admin.resourcemanagement.client.widgets.panels.MainPanel; -import org.gcube.portlets.admin.resourcemanagement.shared.Configuration; import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator; +import org.gcube.resourcemanagement.support.shared.util.Configuration; import com.extjs.gxt.ui.client.event.ComponentEvent; import com.extjs.gxt.ui.client.widget.menu.Menu; diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/widgets/taskbar/TaskbarWindow.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/widgets/taskbar/TaskbarWindow.java index 452df1d..4eef3a8 100644 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/widgets/taskbar/TaskbarWindow.java +++ b/src/main/java/org/gcube/portlets/admin/resourcemanagement/client/widgets/taskbar/TaskbarWindow.java @@ -17,7 +17,7 @@ package org.gcube.portlets.admin.resourcemanagement.client.widgets.taskbar; import org.gcube.portlets.admin.resourcemanagement.client.widgets.console.ConsoleMessageBroker; -import org.gcube.portlets.admin.resourcemanagement.shared.Configuration; +import org.gcube.resourcemanagement.support.shared.util.Configuration; import com.extjs.gxt.ui.client.event.IconButtonEvent; import com.extjs.gxt.ui.client.event.SelectionListener; diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/server/ServiceProxyImpl.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/server/ServiceProxyImpl.java index d9bc871..3b1e1ad 100644 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/server/ServiceProxyImpl.java +++ b/src/main/java/org/gcube/portlets/admin/resourcemanagement/server/ServiceProxyImpl.java @@ -35,7 +35,6 @@ import org.gcube.common.core.scope.GCUBEScope; import org.gcube.portlets.admin.resourcemanagement.client.remote.ServiceProxy; import org.gcube.portlets.admin.resourcemanagement.server.gcube.services.StatusHandler; import org.gcube.portlets.admin.resourcemanagement.server.gcube.services.configuration.ConfigurationLoader; -import org.gcube.portlets.admin.resourcemanagement.shared.exceptions.InvalidPermissionsException; import org.gcube.resourcemanagement.support.client.utils.CurrentStatus; import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator; import org.gcube.resourcemanagement.support.server.gcube.CacheManager; @@ -48,9 +47,9 @@ import org.gcube.resourcemanagement.support.server.managers.resources.ResourceFa import org.gcube.resourcemanagement.support.server.managers.scope.ScopeManager; import org.gcube.resourcemanagement.support.server.types.AllowedResourceTypes; import org.gcube.resourcemanagement.support.server.utils.ServerConsole; +import org.gcube.resourcemanagement.support.shared.exceptions.InvalidPermissionsException; import org.gcube.resourcemanagement.support.shared.operations.SupportedOperations; import org.gcube.resourcemanagement.support.shared.plugins.GenericResourcePlugin; -import org.gcube.resourcemanagement.support.shared.plugins.TMPluginFormField; import org.gcube.resourcemanagement.support.shared.types.Tuple; import org.gcube.resourcemanagement.support.shared.types.UserGroup; import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile; @@ -137,11 +136,6 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro "scopedata.xml"); } - private String getRepositoryUpdgradeDirPath() { - String startDirectory = getServletFSPath(); - return startDirectory + File.separator + "reports"; - } - private String getXML2HTMLMapping() { String startDirectory = getServletFSPath(); return startDirectory + File.separator + "xml" + File.separator + "xmlverbatim.xsl"; @@ -471,11 +465,6 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro public final Map getGenericResourcePlugins() throws Exception { return ISClientRequester.getGenericResourcePlugins(ScopeManager.getScope(this.getCurrentStatus().getCurrentScope())); } - - - public final HashMap> getGenericResourceTreeMagnagerPlugins() throws Exception { - return ISClientRequester.getGenericResourceTreeManagerPlugins(ScopeManager.getScope(this.getCurrentStatus().getCurrentScope())); - } private CurrentStatus getCurrentStatus() { return StatusHandler.getStatus(this.getHttpSession()); diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/shared/Configuration.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/shared/Configuration.java deleted file mode 100644 index bdfcc2c..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/shared/Configuration.java +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************************** - * This software is part of the gCube Project. - * Site: http://www.gcube-system.org/ - **************************************************************************** - * The gCube/gCore software is licensed as Free Open Source software - * conveying to the EUPL (http://ec.europa.eu/idabc/eupl). - * The software and documentation is provided by its authors/distributors - * "as is" and no expressed or - * implied warranty is given for its use, quality or fitness for a - * particular case. - **************************************************************************** - * Filename: Configuration.java - **************************************************************************** - * @author Daniele Strollo - ***************************************************************************/ - -package org.gcube.portlets.admin.resourcemanagement.shared; - -/** - * The client side UI configuration. - * @author Daniele Strollo (ISTI-CNR) - */ -public class Configuration { - // Delay of popups in mills - public static final int popupDelay = 4000; - // Configuration parameters that can be changed through options - // menu. - public static boolean openProfileOnLoad = false; - public static boolean allowMultipleProfiles = false; - //public static String scopeFile = null; - - public static final String SUPER_USER_CODE = "gcube2010"; - /* - * Forces to use flash based charts also in portal mode. - * Due to conflicts in the portal with the flash based - * charts this functionality usually is avoided. - */ - public static final boolean DISABLE_FLASH = false; -} diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/shared/exceptions/InvalidPermissionsException.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/shared/exceptions/InvalidPermissionsException.java deleted file mode 100644 index d1e04e2..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/shared/exceptions/InvalidPermissionsException.java +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** - * This software is part of the gCube Project. - * Site: http://www.gcube-system.org/ - **************************************************************************** - * The gCube/gCore software is licensed as Free Open Source software - * conveying to the EUPL (http://ec.europa.eu/idabc/eupl). - * The software and documentation is provided by its authors/distributors - * "as is" and no expressed or - * implied warranty is given for its use, quality or fitness for a - * particular case. - **************************************************************************** - * Filename: InvalidPermissionsException.java - **************************************************************************** - * @author Daniele Strollo - ***************************************************************************/ - -package org.gcube.portlets.admin.resourcemanagement.shared.exceptions; - -import com.google.gwt.user.client.rpc.IsSerializable; - -/** - * @author Daniele Strollo (ISTI-CNR) - * - */ -public class InvalidPermissionsException extends Exception implements IsSerializable { - private static final long serialVersionUID = 1L; - - public InvalidPermissionsException() { - super(); - } - - public InvalidPermissionsException(String message, Throwable cause) { - super(message, cause); - } - - public InvalidPermissionsException(String message) { - super(message); - } - - public InvalidPermissionsException(Throwable cause) { - super(cause); - } - -} diff --git a/src/main/java/org/gcube/portlets/admin/resourcemanagement/shared/utils/DelayedOperation.java b/src/main/java/org/gcube/portlets/admin/resourcemanagement/shared/utils/DelayedOperation.java deleted file mode 100644 index b4712d4..0000000 --- a/src/main/java/org/gcube/portlets/admin/resourcemanagement/shared/utils/DelayedOperation.java +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** - * This software is part of the gCube Project. - * Site: http://www.gcube-system.org/ - **************************************************************************** - * The gCube/gCore software is licensed as Free Open Source software - * conveying to the EUPL (http://ec.europa.eu/idabc/eupl). - * The software and documentation is provided by its authors/distributors - * "as is" and no expressed or - * implied warranty is given for its use, quality or fitness for a - * particular case. - **************************************************************************** - * Filename: DelayedOperation.java - **************************************************************************** - * @author Daniele Strollo - ***************************************************************************/ - -package org.gcube.portlets.admin.resourcemanagement.shared.utils; - -import com.google.gwt.user.client.Timer; - -/** - * Performs a delayed action on client side. - * Usage: - *
- *  new DelayedOperation() {
- *    // @Override
- *    public void doJob() {
- *      // Here the code...
- *    }
- *  }.start(5000); // the operation will start after 5 secs.
- * 
- * @author Daniele Strollo (ISTI-CNR) - */ -public abstract class DelayedOperation { - public final void start(final int delayMills) { - Timer t = new Timer() { - @Override - public void run() { - doJob(); - } - }; - t.schedule(delayMills); - } - - public final void loop(final int delayMills) { - Timer t = new Timer() { - @Override - public void run() { - doJob(); - this.schedule(delayMills); - } - }; - t.schedule(delayMills); - } - - public abstract void doJob(); -} diff --git a/src/main/resources/org/gcube/portlets/admin/resourcemanagement/ResourceManagementPortlet.gwt.xml b/src/main/resources/org/gcube/portlets/admin/resourcemanagement/ResourceManagementPortlet.gwt.xml index 71a01a9..b2e8435 100644 --- a/src/main/resources/org/gcube/portlets/admin/resourcemanagement/ResourceManagementPortlet.gwt.xml +++ b/src/main/resources/org/gcube/portlets/admin/resourcemanagement/ResourceManagementPortlet.gwt.xml @@ -2,10 +2,10 @@ - - - + + + @@ -15,9 +15,13 @@ name='org.gcube.portlets.admin.software_upload_wizard.SoftwareUploadWizard' /> - + + + + + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 18ce158..8eb050a 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -51,6 +51,18 @@ /resourcemanagementportlet/ishealth + + + arServlet + org.gcube.portlets.admin.server.ARServiceImpl + + + + arServlet + /resourcemanagementportlet/activeservice + + + jUnitHostImpl com.google.gwt.junit.server.JUnitHostImpl