first Release for new Is
git-svn-id: https://svn.d4science-ii.research-infrastructures.eu/gcube/private/alessandro.pieve/resource-management@148281 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c6bc4af914
commit
a3422e77de
4
pom.xml
4
pom.xml
|
@ -84,13 +84,13 @@
|
||||||
<artifactId>xercesImpl</artifactId>
|
<artifactId>xercesImpl</artifactId>
|
||||||
<version>2.9.1</version>
|
<version>2.9.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- new registry deps -->
|
<!-- new registry deps -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.information-system</groupId>
|
<groupId>org.gcube.information-system</groupId>
|
||||||
<artifactId>resource-registry-client</artifactId>
|
<artifactId>resource-registry-client</artifactId>
|
||||||
<version>1.3.0-SNAPSHOT</version>
|
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.information-system</groupId>
|
<groupId>org.gcube.information-system</groupId>
|
||||||
|
|
|
@ -261,6 +261,9 @@ public class Callbacks {
|
||||||
new AsyncCallback<CompleteResourceProfile>() {
|
new AsyncCallback<CompleteResourceProfile>() {
|
||||||
|
|
||||||
public void onSuccess(final CompleteResourceProfile result) {
|
public void onSuccess(final CompleteResourceProfile result) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Dialog dlg = new Dialog();
|
Dialog dlg = new Dialog();
|
||||||
dlg.setLayout(new FitLayout());
|
dlg.setLayout(new FitLayout());
|
||||||
dlg.setHeading("XML Resource Profile");
|
dlg.setHeading("XML Resource Profile");
|
||||||
|
@ -273,10 +276,13 @@ public class Callbacks {
|
||||||
// This resource has already been opened
|
// This resource has already been opened
|
||||||
if (TaskbarRegister.contains(result.getID())) {
|
if (TaskbarRegister.contains(result.getID())) {
|
||||||
TaskbarRegister.getTaskbarItem(result.getID()).destroy();
|
TaskbarRegister.getTaskbarItem(result.getID()).destroy();
|
||||||
|
|
||||||
Commands.showPopup("Retrieve Resource Profile", "Refreshing profile for id: " +
|
Commands.showPopup("Retrieve Resource Profile", "Refreshing profile for id: " +
|
||||||
result.getID(), 3000);
|
result.getID(), 3000);
|
||||||
}
|
}
|
||||||
MainPanel taskbarContainer = WidgetsRegistry.getPanel(UIIdentifiers.TASKBAR_PANEL);
|
MainPanel taskbarContainer = WidgetsRegistry.getPanel(UIIdentifiers.TASKBAR_PANEL);
|
||||||
|
|
||||||
|
|
||||||
TaskbarItem tkItem = new TaskbarItem(
|
TaskbarItem tkItem = new TaskbarItem(
|
||||||
StatusHandler.getStatus().getCurrentScope(),
|
StatusHandler.getStatus().getCurrentScope(),
|
||||||
result.getType(),
|
result.getType(),
|
||||||
|
@ -286,12 +292,16 @@ public class Callbacks {
|
||||||
result.getTitle(),
|
result.getTitle(),
|
||||||
"resource-profile-taskbar-item",
|
"resource-profile-taskbar-item",
|
||||||
"profile-big-icon");
|
"profile-big-icon");
|
||||||
|
/*
|
||||||
tkItem.getRelatedWindow().setMainWidget(
|
tkItem.getRelatedWindow().setMainWidget(
|
||||||
new ResourceProfilePanel(
|
new ResourceProfilePanel(
|
||||||
result.getType(),
|
result.getType(),
|
||||||
result.getXmlRepresentation(),
|
result.getXmlRepresentation(),
|
||||||
result.getHtmlRepresentation()).getWidget());
|
result.getHtmlRepresentation()).getWidget());
|
||||||
TaskbarRegister.registerTaskbarWidget(result.getID(), tkItem);
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
//TaskbarRegister.registerTaskbarWidget(result.getID(), tkItem);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
GWT.log("During HTML conversion", e);
|
GWT.log("During HTML conversion", e);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -312,6 +322,9 @@ public class Callbacks {
|
||||||
|
|
||||||
public void onSuccess(final Tuple<String> result) {
|
public void onSuccess(final Tuple<String> result) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (result.size() < 3) {
|
if (result.size() < 3) {
|
||||||
MessageBox.alert("Invalid Report Received", "Don't know why :(", null);
|
MessageBox.alert("Invalid Report Received", "Don't know why :(", null);
|
||||||
Commands.unmask(UIIdentifiers.GLOBAL_STATUS_BAR_ID);
|
Commands.unmask(UIIdentifiers.GLOBAL_STATUS_BAR_ID);
|
||||||
|
@ -339,6 +352,8 @@ public class Callbacks {
|
||||||
reportID, 3000);
|
reportID, 3000);
|
||||||
}
|
}
|
||||||
MainPanel taskbarContainer = WidgetsRegistry.getPanel(UIIdentifiers.TASKBAR_PANEL);
|
MainPanel taskbarContainer = WidgetsRegistry.getPanel(UIIdentifiers.TASKBAR_PANEL);
|
||||||
|
|
||||||
|
|
||||||
TaskbarItem tkItem = new TaskbarItem(
|
TaskbarItem tkItem = new TaskbarItem(
|
||||||
StatusHandler.getStatus().getCurrentScope(),
|
StatusHandler.getStatus().getCurrentScope(),
|
||||||
ResourceTypeDecorator.DeployReport,
|
ResourceTypeDecorator.DeployReport,
|
||||||
|
|
|
@ -196,6 +196,7 @@ public class Commands {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final void doGetResourceProfileByID(final Object caller, final String scope, final String resourceID) {
|
public static final void doGetResourceProfileByID(final Object caller, final String scope, final String resourceID) {
|
||||||
|
|
||||||
ProxyRegistry.getProxyInstance().getResourceByID(
|
ProxyRegistry.getProxyInstance().getResourceByID(
|
||||||
scope,
|
scope,
|
||||||
null, // no type specified
|
null, // no type specified
|
||||||
|
@ -217,6 +218,8 @@ public class Commands {
|
||||||
"Getting Profile details for " + FWSTranslate.getFWSNameFromLabel(resourceType) + ": " + resourceID,
|
"Getting Profile details for " + FWSTranslate.getFWSNameFromLabel(resourceType) + ": " + resourceID,
|
||||||
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).getContainer()
|
WidgetsRegistry.getPanel(UIIdentifiers.RESOURCE_DETAIL_GRID_PANEL).getContainer()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
ProxyRegistry.getProxyInstance().getResourceByID(
|
ProxyRegistry.getProxyInstance().getResourceByID(
|
||||||
scope,
|
scope,
|
||||||
resourceType,
|
resourceType,
|
||||||
|
@ -237,6 +240,8 @@ public class Commands {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GWT.log("TEST--- on handleGetDeploymentReport", null);
|
||||||
|
|
||||||
Dialog dlg = new Dialog();
|
Dialog dlg = new Dialog();
|
||||||
dlg.setLayout(new FitLayout());
|
dlg.setLayout(new FitLayout());
|
||||||
dlg.setHeading("XML Resource Profile");
|
dlg.setHeading("XML Resource Profile");
|
||||||
|
@ -290,6 +295,8 @@ public class Commands {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Dialog dlg = new Dialog();
|
Dialog dlg = new Dialog();
|
||||||
dlg.setLayout(new FitLayout());
|
dlg.setLayout(new FitLayout());
|
||||||
dlg.setHeading("XML Resource Profile");
|
dlg.setHeading("XML Resource Profile");
|
||||||
|
@ -559,9 +566,13 @@ public class Commands {
|
||||||
|
|
||||||
public static void showPopup(final String title, final String text) {
|
public static void showPopup(final String title, final String text) {
|
||||||
showPopup(title, text, Configuration.popupDelay);
|
showPopup(title, text, Configuration.popupDelay);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showPopup(final String title, final String text, final int delayMills) {
|
public static void showPopup(final String title, final String text, final int delayMills) {
|
||||||
|
|
||||||
|
|
||||||
InfoConfig cfg = new InfoConfig(title, text);
|
InfoConfig cfg = new InfoConfig(title, text);
|
||||||
cfg.display = delayMills;
|
cfg.display = delayMills;
|
||||||
Info.display(cfg);
|
Info.display(cfg);
|
||||||
|
|
|
@ -27,7 +27,7 @@ import com.extjs.gxt.ui.client.widget.Html;
|
||||||
import com.extjs.gxt.ui.client.widget.TabItem;
|
import com.extjs.gxt.ui.client.widget.TabItem;
|
||||||
import com.extjs.gxt.ui.client.widget.TabPanel;
|
import com.extjs.gxt.ui.client.widget.TabPanel;
|
||||||
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel;
|
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel;
|
||||||
import com.liferay.portal.kernel.json.JSON;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Daniele Strollo (ISTI-CNR)
|
* @author Daniele Strollo (ISTI-CNR)
|
||||||
|
@ -107,12 +107,13 @@ public class ResourceProfilePanel extends TabPanel {
|
||||||
|
|
||||||
this.add(jsonProfilePanel);
|
this.add(jsonProfilePanel);
|
||||||
*/
|
*/
|
||||||
|
/**End new registry ***/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Component getWidget() {
|
public final Component getWidget() {
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,10 +180,10 @@ public class ResourcesTreePanel {
|
||||||
if (StatusHandler.getStatus().isLoadGHNatStartup()) {
|
if (StatusHandler.getStatus().isLoadGHNatStartup()) {
|
||||||
GWT.log(""+StatusHandler.getStatus().isLoadGHNatStartup());
|
GWT.log(""+StatusHandler.getStatus().isLoadGHNatStartup());
|
||||||
|
|
||||||
// Commands.doLoadResourceDetailsGrid(this,
|
Commands.doLoadResourceDetailsGrid(this,
|
||||||
// StatusHandler.getStatus().getCurrentScope(),
|
StatusHandler.getStatus().getCurrentScope(),
|
||||||
// "GHN");
|
"GHN");
|
||||||
//
|
|
||||||
//select the GHN
|
//select the GHN
|
||||||
for (ModelData md: store.getAllItems()) {
|
for (ModelData md: store.getAllItems()) {
|
||||||
if (md.get("node").toString().compareTo("GHN") == 0)
|
if (md.get("node").toString().compareTo("GHN") == 0)
|
||||||
|
|
|
@ -67,7 +67,15 @@ public class TaskbarItem {
|
||||||
|
|
||||||
this.detachButton = new TaskbarButton("btn" + id, type, title) {
|
this.detachButton = new TaskbarButton("btn" + id, type, title) {
|
||||||
protected void onClick(final com.extjs.gxt.ui.client.event.ComponentEvent ce) {
|
protected void onClick(final com.extjs.gxt.ui.client.event.ComponentEvent ce) {
|
||||||
relatedWidget.doMinimize();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GWT.log("open tab for id resources:"+resourceID.trim());
|
||||||
|
Window.open( GWT.getModuleBaseURL().replace("resourcemanagementportlet/", "") +"resource/getResource?resId="+resourceID, "_blank", "");
|
||||||
|
//TODO Delete a pop up with detail
|
||||||
|
//relatedWidget.doMinimize();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.detachButton.setStyleName("taskbar-button");
|
this.detachButton.setStyleName("taskbar-button");
|
||||||
|
@ -79,8 +87,10 @@ public class TaskbarItem {
|
||||||
this.relatedWidget.setHeading(title);
|
this.relatedWidget.setHeading(title);
|
||||||
|
|
||||||
if (Configuration.openProfileOnLoad) {
|
if (Configuration.openProfileOnLoad) {
|
||||||
|
|
||||||
this.activate();
|
this.activate();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.relatedWidget.setIsMinimized(true);
|
this.relatedWidget.setIsMinimized(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,19 +115,12 @@ public class TaskbarItem {
|
||||||
closeAll.setIconStyle("closeall-icon");
|
closeAll.setIconStyle("closeall-icon");
|
||||||
mnu.add(closeAll);
|
mnu.add(closeAll);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (type != null && type == ResourceTypeDecorator.DeployReport) {
|
if (type != null && type == ResourceTypeDecorator.DeployReport) {
|
||||||
MenuItem refresh = new MenuItem("Refresh") {
|
MenuItem refresh = new MenuItem("Refresh") {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick(final ComponentEvent be) {
|
protected void onClick(final ComponentEvent be) {
|
||||||
|
|
||||||
super.onClick(be);
|
super.onClick(be);
|
||||||
ProxyRegistry.getProxyInstance().checkDeployStatus(
|
ProxyRegistry.getProxyInstance().checkDeployStatus(
|
||||||
getScope(),
|
getScope(),
|
||||||
|
@ -136,8 +139,7 @@ public class TaskbarItem {
|
||||||
protected void onClick(final ComponentEvent be) {
|
protected void onClick(final ComponentEvent be) {
|
||||||
super.onClick(be);
|
super.onClick(be);
|
||||||
GWT.log("open tab for id resources:"+resourceID.trim());
|
GWT.log("open tab for id resources:"+resourceID.trim());
|
||||||
Window.open("resource/getResource?resId="+resourceID, "_blank", "");
|
Window.open( GWT.getModuleBaseURL().replace("resourcemanagementportlet/", "") +"resource/getResource?resId="+resourceID, "_blank", "");
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
openNewTab.setIconStyle("openTab-icon");
|
openNewTab.setIconStyle("openTab-icon");
|
||||||
|
@ -158,6 +160,7 @@ public class TaskbarItem {
|
||||||
@Override
|
@Override
|
||||||
protected void onClick(final ComponentEvent be) {
|
protected void onClick(final ComponentEvent be) {
|
||||||
super.onClick(be);
|
super.onClick(be);
|
||||||
|
|
||||||
Commands.doGetResourceProfileByID(
|
Commands.doGetResourceProfileByID(
|
||||||
this,
|
this,
|
||||||
getScope(),
|
getScope(),
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.gcube.resourcemanagement.support.shared.util.Configuration;
|
||||||
import com.extjs.gxt.ui.client.event.IconButtonEvent;
|
import com.extjs.gxt.ui.client.event.IconButtonEvent;
|
||||||
import com.extjs.gxt.ui.client.event.SelectionListener;
|
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||||
import com.extjs.gxt.ui.client.widget.Component;
|
import com.extjs.gxt.ui.client.widget.Component;
|
||||||
|
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||||
import com.extjs.gxt.ui.client.widget.Window;
|
import com.extjs.gxt.ui.client.widget.Window;
|
||||||
import com.extjs.gxt.ui.client.widget.button.ToolButton;
|
import com.extjs.gxt.ui.client.widget.button.ToolButton;
|
||||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||||
|
@ -63,6 +64,7 @@ public class TaskbarWindow extends Window {
|
||||||
}));
|
}));
|
||||||
*/
|
*/
|
||||||
if (Configuration.openProfileOnLoad) {
|
if (Configuration.openProfileOnLoad) {
|
||||||
|
|
||||||
this.show();
|
this.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,16 +5,19 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.common.scope.impl.ScopeBean;
|
|
||||||
import org.gcube.informationsystem.model.entity.Resource;
|
import org.gcube.informationsystem.model.entity.Resource;
|
||||||
import org.gcube.informationsystem.resourceregistry.client.proxy.ResourceRegistryClient;
|
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
|
||||||
import org.gcube.informationsystem.resourceregistry.client.proxy.ResourceRegistryClientFactory;
|
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
|
||||||
import org.gcube.informationsystem.types.TypeBinder.TypeDefinition;
|
import org.gcube.informationsystem.types.TypeBinder.TypeDefinition;
|
||||||
import org.gcube.portlets.admin.resourcemanagement.shared.resource.CacheList;
|
import org.gcube.portlets.admin.resourcemanagement.shared.resource.CacheList;
|
||||||
import org.gcube.portlets.admin.resourcemanagement.shared.resource.UtilityResource;
|
import org.gcube.portlets.admin.resourcemanagement.shared.resource.UtilityResource;
|
||||||
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
import org.gcube.resourcemanagement.support.client.views.ResourceTypeDecorator;
|
||||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile;
|
import org.gcube.resourcemanagement.support.shared.types.datamodel.CompleteResourceProfile;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author pieve mail:alessandro.pieve@isti.cnr.it
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class RegistryClientRequester {
|
public class RegistryClientRequester {
|
||||||
private static ResourceRegistryClient resourceRegistryClient = ResourceRegistryClientFactory.create();
|
private static ResourceRegistryClient resourceRegistryClient = ResourceRegistryClientFactory.create();
|
||||||
/**
|
/**
|
||||||
|
@ -26,29 +29,31 @@ public class RegistryClientRequester {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//list a resource with a sub category
|
//list a resource with a sub category
|
||||||
public static final HashMap<String, ArrayList<String>> getResourcesTree(final ScopeBean queryScope) throws Exception {
|
public static final HashMap<String, ArrayList<String>> getResourcesTree(String scope) throws Exception {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HashMap<String, ArrayList<String>> retval = new HashMap<String, ArrayList<String>>();
|
HashMap<String, ArrayList<String>> retval = new HashMap<String, ArrayList<String>>();
|
||||||
ScopeProvider.instance.set(queryScope.toString());
|
|
||||||
|
ScopeProvider.instance.set(scope);
|
||||||
try {
|
try {
|
||||||
List<TypeDefinition> typeDefinitions = resourceRegistryClient.getSchema(Resource.class, true);
|
List<TypeDefinition> typeDefinitions = resourceRegistryClient.getSchema(Resource.class, true);
|
||||||
for (TypeDefinition td : typeDefinitions) {
|
for (TypeDefinition td : typeDefinitions) {
|
||||||
//da eliminare una volta modificato il decoratore
|
|
||||||
// if (td.getName().equals("EService"))
|
if (td.getName().equals("EService"))
|
||||||
// retval.put("RunningInstance", UtilityResource.getSubResourcesTree(td.getName(),queryScope.toString()));
|
retval.put("RunningInstance", UtilityResource.getSubResourcesTreeQuery(td.getName(),scope));
|
||||||
if (td.getName().equals("Configuration"))
|
if (td.getName().equals("Configuration"))
|
||||||
retval.put("GenericResource", UtilityResource.getSubResourcesTree(td.getName(),queryScope.toString()));
|
retval.put("GenericResource", UtilityResource.getSubResourcesTreeQuery(td.getName(),scope));
|
||||||
|
if (td.getName().equals("HostingNode"))
|
||||||
|
retval.put("GHN", UtilityResource.getSubResourcesTreeQuery(td.getName(),scope));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,8 +62,12 @@ public class RegistryClientRequester {
|
||||||
|
|
||||||
//list string (xml formatted) for table
|
//list string (xml formatted) for table
|
||||||
public static final List<String> getResourcesByTypeSubType( String scope,String type,String subType) throws Exception {
|
public static final List<String> getResourcesByTypeSubType( String scope,String type,String subType) throws Exception {
|
||||||
CacheList.resourceid.clear();
|
|
||||||
|
|
||||||
|
//CacheList.resourceid.clear();
|
||||||
|
ScopeProvider.instance.set(scope);
|
||||||
List<String>resource=new ArrayList<String>();
|
List<String>resource=new ArrayList<String>();
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "RunningInstance":
|
case "RunningInstance":
|
||||||
System.out.println("---------------->RunningInstance ");
|
System.out.println("---------------->RunningInstance ");
|
||||||
|
@ -66,7 +75,12 @@ public class RegistryClientRequester {
|
||||||
break;
|
break;
|
||||||
case "GenericResource":
|
case "GenericResource":
|
||||||
System.out.println("---------------->GenericResource ");
|
System.out.println("---------------->GenericResource ");
|
||||||
resource=UtilityResource.CreateListConfiguration(scope,type,subType);
|
//resource=UtilityResource.CreateListConfiguration(scope,type,subType);
|
||||||
|
resource=UtilityResource.CreateListConfigurationQuery(scope,type,subType);
|
||||||
|
break;
|
||||||
|
case "GHN":
|
||||||
|
System.out.println("---------------->GHN ");
|
||||||
|
resource=UtilityResource.CreateListHostingNode(scope,type,subType);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -80,7 +94,6 @@ public class RegistryClientRequester {
|
||||||
public static CompleteResourceProfile getResourceByID(
|
public static CompleteResourceProfile getResourceByID(
|
||||||
String xml2htmlMapping, String scope, String type,
|
String xml2htmlMapping, String scope, String type,
|
||||||
String resID) {
|
String resID) {
|
||||||
|
|
||||||
|
|
||||||
String representation=CacheList.resourceid.get(resID).getBody();
|
String representation=CacheList.resourceid.get(resID).getBody();
|
||||||
//get resource by id
|
//get resource by id
|
||||||
|
@ -88,8 +101,9 @@ public class RegistryClientRequester {
|
||||||
String xmlRepresentation="<Resource>"
|
String xmlRepresentation="<Resource>"
|
||||||
+ "<ID>"+resID+"</ID>"
|
+ "<ID>"+resID+"</ID>"
|
||||||
+ "<Type>"+type+"</Type>"
|
+ "<Type>"+type+"</Type>"
|
||||||
+ representation
|
+ "<Scope>"+scope+"</Scope>"
|
||||||
+ "</Resource>";
|
+ representation
|
||||||
|
+ "</Resource>";
|
||||||
String htmlRepresentation=representation;
|
String htmlRepresentation=representation;
|
||||||
ScopeProvider.instance.set(scope);
|
ScopeProvider.instance.set(scope);
|
||||||
return new CompleteResourceProfile(resID, ResourceTypeDecorator.valueOf(type),title,xmlRepresentation, htmlRepresentation);
|
return new CompleteResourceProfile(resID, ResourceTypeDecorator.valueOf(type),title,xmlRepresentation, htmlRepresentation);
|
||||||
|
|
|
@ -297,17 +297,19 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
|
||||||
/**LISTA DI RISORSE*/
|
/**LISTA DI RISORSE*/
|
||||||
public final HashMap<String, ArrayList<String>> getResourceTypeTree(final String scope) throws Exception {
|
public final HashMap<String, ArrayList<String>> getResourceTypeTree(final String scope) throws Exception {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ScopeBean gscope = new ScopeBean(scope);
|
ScopeBean gscope = new ScopeBean(scope);
|
||||||
|
|
||||||
//Old Registry
|
//Old Registry
|
||||||
//HashMap<String, ArrayList<String>> results = ISClientRequester.getResourcesTree(getCacheManager(this.getCurrentStatus()), gscope);
|
//HashMap<String, ArrayList<String>> results = ISClientRequester.getResourcesTree(getCacheManager(this.getCurrentStatus()), gscope);
|
||||||
//New Registry
|
//New Registry
|
||||||
HashMap<String, ArrayList<String>> results = RegistryClientRequester.getResourcesTree(gscope);
|
|
||||||
|
|
||||||
/*TEST */
|
//before is not necessary
|
||||||
for (String key : results.keySet()) {
|
ScopeProvider.instance.set(scope);
|
||||||
System.out.println("***->"+key);
|
HashMap<String, ArrayList<String>> results = RegistryClientRequester.getResourcesTree(scope);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
|
@ -344,10 +346,6 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
|
||||||
//New code
|
//New code
|
||||||
List<String> request=RegistryClientRequester.getResourcesByTypeSubType(scope, type,null);
|
List<String> request=RegistryClientRequester.getResourcesByTypeSubType(scope, type,null);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ServerConsole.error(LOG_PREFIX, e);
|
ServerConsole.error(LOG_PREFIX, e);
|
||||||
|
@ -447,12 +445,10 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
|
||||||
try {
|
try {
|
||||||
System.out.println("---------------->getResourcesBySubType type:"+type+ "- subtype:"+subType);
|
System.out.println("---------------->getResourcesBySubType type:"+type+ "- subtype:"+subType);
|
||||||
//Old code
|
//Old code
|
||||||
//List<String> request=ISClientRequester.getResourcesByType(getCacheManager(this.getCurrentStatus()), new ScopeBean(scope), type, subtype);
|
//List<String> request=ISClientRequester.getResourcesByType(getCacheManager(this.getCurrentStatus()), new ScopeBean(scope), type, subType);
|
||||||
|
|
||||||
//New code
|
//New code
|
||||||
List<String> request=RegistryClientRequester.getResourcesByTypeSubType(scope, type,subType);
|
List<String> request=RegistryClientRequester.getResourcesByTypeSubType(scope, type,subType);
|
||||||
|
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
|
|
||||||
|
|
||||||
|
@ -469,9 +465,8 @@ public class ServiceProxyImpl extends RemoteServiceServlet implements ServicePro
|
||||||
System.out.println("---------------->getResourceByID scope:"+scope+" type:"+type+" resID:"+resID);
|
System.out.println("---------------->getResourceByID scope:"+scope+" type:"+type+" resID:"+resID);
|
||||||
System.out.println("---------------->getResourceByID this.getXML2HTMLMapping():"+this.getXML2HTMLMapping());
|
System.out.println("---------------->getResourceByID this.getXML2HTMLMapping():"+this.getXML2HTMLMapping());
|
||||||
//OLD CODE
|
//OLD CODE
|
||||||
/*
|
//CompleteResourceProfile profile = ISClientRequester.getResourceByID(this.getXML2HTMLMapping(), new ScopeBean(scope), type, resID);
|
||||||
CompleteResourceProfile profile = ISClientRequester.getResourceByID(this.getXML2HTMLMapping(), new ScopeBean(scope), type, resID);
|
|
||||||
*/
|
|
||||||
//NEW CODE
|
//NEW CODE
|
||||||
CompleteResourceProfile profile = RegistryClientRequester.getResourceByID(this.getXML2HTMLMapping(), scope, type, resID);
|
CompleteResourceProfile profile = RegistryClientRequester.getResourceByID(this.getXML2HTMLMapping(), scope, type, resID);
|
||||||
|
|
||||||
|
|
|
@ -9,20 +9,17 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.gcube.portlets.admin.resourcemanagement.shared.resource.CacheList;
|
import org.gcube.portlets.admin.resourcemanagement.shared.resource.CacheList;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
public class ServletResource extends HttpServlet {
|
public class ServletResource extends HttpServlet {
|
||||||
private static final Logger log = LoggerFactory.getLogger(ServletResource.class);
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 8877769357760713039L;
|
private static final long serialVersionUID = 8877769357760713039L;
|
||||||
private String message;
|
|
||||||
public void init() throws ServletException
|
public void init() throws ServletException
|
||||||
{
|
{
|
||||||
// Do required initialization
|
// Do required initialization
|
||||||
log.debug("+++++++++++++Servlet Resource path"+this.getServletContext().getContextPath());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
|
|
|
@ -11,5 +11,5 @@ public class CacheList {
|
||||||
//use from
|
//use from
|
||||||
//type-subtype, list di resource
|
//type-subtype, list di resource
|
||||||
|
|
||||||
public static Map<String,List<String>> resourceTable = Collections.synchronizedMap(new HashMap());
|
//public static Map<String,List<String>> resourceTable = Collections.synchronizedMap(new HashMap());
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
<Name>http:$$cloud.recas.ba.infn.it:8787$occi$compute$0805c2db-ae17-4418-9ecd-8e81552791d2@dded8184-c033-48af-8633-b1adcf3e3308</Name>
|
<Name>http:$$cloud.recas.ba.infn.it:8787$occi$compute$0805c2db-ae17-4418-9ecd-8e81552791d2@dded8184-c033-48af-8633-b1adcf3e3308</Name>
|
||||||
<Description>Node deployed to Provider dded8184-c033-48af-8633-b1adcf3e3308with serviceProfile3b6633b7-593a-4626-af19-61295fe23bc1</Description>
|
<Description>Node deployed to Provider dded8184-c033-48af-8633-b1adcf3e3308with serviceProfile3b6633b7-593a-4626-af19-61295fe23bc1</Description>
|
||||||
</Resource>
|
</Resource>
|
||||||
* @author pieve
|
* @author pieve mail:alessandro.pieve@isti.cnr.it
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name = "Resource")
|
@XmlRootElement(name = "Resource")
|
||||||
|
|
|
@ -0,0 +1,204 @@
|
||||||
|
package org.gcube.portlets.admin.resourcemanagement.shared.resource;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
<Resource>
|
||||||
|
<ID>a7597dbc-28a3-4ad5-ba6d-19e7a0a2d41d</ID>
|
||||||
|
<Type>GHN</Type>
|
||||||
|
<SubType>upv.es</SubType>
|
||||||
|
<Status>certified</Status>
|
||||||
|
<Name>niebla.i3m.upv.es:80</Name>
|
||||||
|
<Uptime>17:07</Uptime>
|
||||||
|
<LastUpdate>2017-03-28T10:10:33+02:00</LastUpdate>
|
||||||
|
<LocalAvailableSpace>2832216</LocalAvailableSpace>
|
||||||
|
<VirtualSize>17957</VirtualSize>
|
||||||
|
<VirtualAvailable>17676</VirtualAvailable>
|
||||||
|
<LoadLast1Min>0.87</LoadLast1Min>
|
||||||
|
<LoadLast5Min>0.36</LoadLast5Min>
|
||||||
|
<LoadLast15Min>0.39</LoadLast15Min>
|
||||||
|
<gcf-version>2.1.0-4.2.0-139932</gcf-version>
|
||||||
|
<ghn-version>2.0.0-4.2.0-132475</ghn-version>
|
||||||
|
<Scopes>/gcube/devNext;/gcube</Scopes>
|
||||||
|
</Resource>
|
||||||
|
*@author pieve mail:alessandro.pieve@isti.cnr.it
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "Resource")
|
||||||
|
public class HostingNodeObject {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String type;
|
||||||
|
private String subType;
|
||||||
|
private String status;
|
||||||
|
private String name;
|
||||||
|
private String upTime;
|
||||||
|
private String lastUpdate;
|
||||||
|
private long localAvailableSpace;
|
||||||
|
private long virtualSize;
|
||||||
|
private long virtualAvailable;
|
||||||
|
private String loadLast1Min;
|
||||||
|
private String loadLast5Min;
|
||||||
|
private String loadLast15Min;
|
||||||
|
private String gcfVersion;
|
||||||
|
private String ghnVersion;
|
||||||
|
private String scopes;
|
||||||
|
|
||||||
|
public HostingNodeObject(){}
|
||||||
|
|
||||||
|
|
||||||
|
public HostingNodeObject(String id, String type, String subType,
|
||||||
|
String status, String name, String upTime, String lastUpdate,
|
||||||
|
long localAvailableSpace, long virtualSize,
|
||||||
|
long virtualAvailable, String loadLast1Min, String loadLast5Min,
|
||||||
|
String loadLast15Min, String gcfVersion, String ghnVersion,
|
||||||
|
String scopes) {
|
||||||
|
super();
|
||||||
|
this.id = id;
|
||||||
|
this.type = type;
|
||||||
|
this.subType = subType;
|
||||||
|
this.status = status;
|
||||||
|
this.name = name;
|
||||||
|
this.upTime = upTime;
|
||||||
|
this.lastUpdate = lastUpdate;
|
||||||
|
this.localAvailableSpace = localAvailableSpace;
|
||||||
|
this.virtualSize = virtualSize;
|
||||||
|
this.virtualAvailable = virtualAvailable;
|
||||||
|
this.loadLast1Min = loadLast1Min;
|
||||||
|
this.loadLast5Min = loadLast5Min;
|
||||||
|
this.loadLast15Min = loadLast15Min;
|
||||||
|
this.gcfVersion = gcfVersion;
|
||||||
|
this.ghnVersion = ghnVersion;
|
||||||
|
this.scopes = scopes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "ID")
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "Type")
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "SubType")
|
||||||
|
public String getSubType() {
|
||||||
|
return subType;
|
||||||
|
}
|
||||||
|
public void setSubType(String subType) {
|
||||||
|
this.subType = subType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "Status")
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "Name")
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "Uptime")
|
||||||
|
public String getUpTime() {
|
||||||
|
return upTime;
|
||||||
|
}
|
||||||
|
public void setUpTime(String upTime) {
|
||||||
|
this.upTime = upTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "LastUpdate")
|
||||||
|
public String getLastUpdate() {
|
||||||
|
return lastUpdate;
|
||||||
|
}
|
||||||
|
public void setLastUpdate(String lastUpdate) {
|
||||||
|
this.lastUpdate = lastUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "LocalAvailableSpace")
|
||||||
|
public long getLocalAvailableSpace() {
|
||||||
|
return localAvailableSpace;
|
||||||
|
}
|
||||||
|
public void setLocalAvailableSpace(long localAvailableSpace) {
|
||||||
|
this.localAvailableSpace = localAvailableSpace;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "VirtualSize")
|
||||||
|
public long getVirtualSize() {
|
||||||
|
return virtualSize;
|
||||||
|
}
|
||||||
|
public void setVirtualSize(long virtualSize) {
|
||||||
|
this.virtualSize = virtualSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "VirtualAvailable")
|
||||||
|
public long getVirtualAvailable() {
|
||||||
|
return virtualAvailable;
|
||||||
|
}
|
||||||
|
public void setVirtualAvailable(long virtualAvailable) {
|
||||||
|
this.virtualAvailable = virtualAvailable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "LoadLast1Min")
|
||||||
|
public String getLoadLast1Min() {
|
||||||
|
return loadLast1Min;
|
||||||
|
}
|
||||||
|
public void setLoadLast1Min(String loadLast1Min) {
|
||||||
|
this.loadLast1Min = loadLast1Min;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "LoadLast5Min")
|
||||||
|
public String getLoadLast5Min() {
|
||||||
|
return loadLast5Min;
|
||||||
|
}
|
||||||
|
public void setLoadLast5Min(String loadLast5Min) {
|
||||||
|
this.loadLast5Min = loadLast5Min;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "LoadLast15Min")
|
||||||
|
public String getLoadLast15Min() {
|
||||||
|
return loadLast15Min;
|
||||||
|
}
|
||||||
|
public void setLoadLast15Min(String loadLast15Min) {
|
||||||
|
this.loadLast15Min = loadLast15Min;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "gcf-version")
|
||||||
|
public String getGcfVersion() {
|
||||||
|
return gcfVersion;
|
||||||
|
}
|
||||||
|
public void setGcfVersion(String gcfVersion) {
|
||||||
|
this.gcfVersion = gcfVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "ghn-version")
|
||||||
|
public String getGhnVersion() {
|
||||||
|
return ghnVersion;
|
||||||
|
}
|
||||||
|
public void setGhnVersion(String ghnVersion) {
|
||||||
|
this.ghnVersion = ghnVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@XmlElement(name = "Scopes")
|
||||||
|
public String getScopes() {
|
||||||
|
return scopes;
|
||||||
|
}
|
||||||
|
public void setScopes(String scopes) {
|
||||||
|
this.scopes = scopes;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -3,32 +3,45 @@ package org.gcube.portlets.admin.resourcemanagement.shared.resource;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.xml.bind.JAXBContext;
|
import javax.xml.bind.JAXBContext;
|
||||||
import javax.xml.bind.JAXBException;
|
|
||||||
import javax.xml.bind.Marshaller;
|
import javax.xml.bind.Marshaller;
|
||||||
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.informationsystem.model.ER;
|
||||||
import org.gcube.informationsystem.model.entity.Facet;
|
import org.gcube.informationsystem.model.entity.Facet;
|
||||||
import org.gcube.informationsystem.model.entity.Resource;
|
import org.gcube.informationsystem.model.entity.Resource;
|
||||||
import org.gcube.informationsystem.model.entity.facet.AccessPointFacet;
|
import org.gcube.informationsystem.model.entity.facet.AccessPointFacet;
|
||||||
import org.gcube.informationsystem.model.entity.facet.IdentifierFacet;
|
import org.gcube.informationsystem.model.entity.facet.MemoryFacet;
|
||||||
import org.gcube.informationsystem.model.entity.facet.NetworkingFacet;
|
import org.gcube.informationsystem.model.entity.facet.NetworkingFacet;
|
||||||
import org.gcube.informationsystem.model.entity.facet.ServiceStateFacet;
|
import org.gcube.informationsystem.model.entity.facet.ServiceStateFacet;
|
||||||
|
import org.gcube.informationsystem.model.entity.facet.SimplePropertyFacet;
|
||||||
import org.gcube.informationsystem.model.entity.facet.SoftwareFacet;
|
import org.gcube.informationsystem.model.entity.facet.SoftwareFacet;
|
||||||
|
import org.gcube.informationsystem.model.entity.facet.StateFacet;
|
||||||
import org.gcube.informationsystem.model.entity.resource.Configuration;
|
import org.gcube.informationsystem.model.entity.resource.Configuration;
|
||||||
import org.gcube.informationsystem.model.entity.resource.EService;
|
import org.gcube.informationsystem.model.entity.resource.EService;
|
||||||
|
import org.gcube.informationsystem.model.entity.resource.HostingNode;
|
||||||
import org.gcube.informationsystem.model.relation.ConsistsOf;
|
import org.gcube.informationsystem.model.relation.ConsistsOf;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
import org.gcube.informationsystem.model.relation.consistsof.HasPersistentMemory;
|
||||||
import org.gcube.informationsystem.resourceregistry.client.proxy.ResourceRegistryClient;
|
import org.gcube.informationsystem.model.relation.consistsof.HasVolatileMemory;
|
||||||
import org.gcube.informationsystem.resourceregistry.client.proxy.ResourceRegistryClientFactory;
|
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
|
||||||
|
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
|
||||||
|
|
||||||
|
import com.google.gwt.thirdparty.json.JSONArray;
|
||||||
|
import com.google.gwt.thirdparty.json.JSONObject;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author pieve mail:alessandro.pieve@isti.cnr.it
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class UtilityResource {
|
public class UtilityResource {
|
||||||
|
|
||||||
|
|
||||||
private static ResourceRegistryClient resourceRegistryClient = ResourceRegistryClientFactory.create();
|
private static ResourceRegistryClient resourceRegistryClient = ResourceRegistryClientFactory.create();
|
||||||
|
|
||||||
//UTILITY per Calcolare i sotto alberi
|
|
||||||
public static ArrayList<String> getSubResourcesTree(String entity, String scope) throws Exception{
|
public static ArrayList<String> getSubResourcesTree(String entity, String scope) throws Exception{
|
||||||
ArrayList<String> list = new ArrayList<>();
|
ArrayList<String> list = new ArrayList<>();
|
||||||
List<Resource> resources = (List<Resource>) resourceRegistryClient.getInstances(entity, true);
|
List<Resource> resources = (List<Resource>) resourceRegistryClient.getInstances(entity, true);
|
||||||
|
@ -38,7 +51,7 @@ public class UtilityResource {
|
||||||
for (Facet f : facets) {
|
for (Facet f : facets) {
|
||||||
|
|
||||||
switch (entity) {
|
switch (entity) {
|
||||||
/*
|
/*
|
||||||
case "Software":
|
case "Software":
|
||||||
if(f instanceof NetworkingFacet){
|
if(f instanceof NetworkingFacet){
|
||||||
NetworkingFacet nf = (NetworkingFacet) f;
|
NetworkingFacet nf = (NetworkingFacet) f;
|
||||||
|
@ -70,14 +83,16 @@ public class UtilityResource {
|
||||||
list.add(nf.getHostName());
|
list.add(nf.getHostName());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
*/
|
||||||
case "HostingNode":
|
case "HostingNode":
|
||||||
if(f instanceof NetworkingFacet){
|
if(f instanceof NetworkingFacet){
|
||||||
NetworkingFacet nf = (NetworkingFacet) f;
|
NetworkingFacet nf = (NetworkingFacet) f;
|
||||||
list.add(nf.getDomainName());
|
if (!list.contains(nf.getDomainName())){
|
||||||
|
list.add(nf.getDomainName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
/*
|
||||||
case "Dataset":
|
case "Dataset":
|
||||||
if(f instanceof NetworkingFacet){
|
if(f instanceof NetworkingFacet){
|
||||||
NetworkingFacet nf = (NetworkingFacet) f;
|
NetworkingFacet nf = (NetworkingFacet) f;
|
||||||
|
@ -99,17 +114,11 @@ public class UtilityResource {
|
||||||
*/
|
*/
|
||||||
case "Configuration":
|
case "Configuration":
|
||||||
if(f instanceof SoftwareFacet){
|
if(f instanceof SoftwareFacet){
|
||||||
System.out.println("------------Configuration--SoftwareFacet-- identified by GenericResource");
|
// System.out.println("------------Configuration--SoftwareFacet-- identified by GenericResource");
|
||||||
SoftwareFacet sf = (SoftwareFacet) f;
|
SoftwareFacet sf = (SoftwareFacet) f;
|
||||||
if (!list.contains(sf.getGroup())){
|
if (!list.contains(sf.getGroup())){
|
||||||
list.add(sf.getGroup());
|
list.add(sf.getGroup());
|
||||||
System.out.println("------------sf.getGroup()"+sf.getGroup());
|
|
||||||
}
|
}
|
||||||
//creo mappa con tutta la struttura
|
|
||||||
//passo lo scope
|
|
||||||
UtilityResource.CreateCacheListConfiguration(scope);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/*
|
/*
|
||||||
|
@ -155,28 +164,170 @@ public class UtilityResource {
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static ArrayList<String> getSubResourcesTreeQuery(String entity, String scope) throws Exception{
|
||||||
|
|
||||||
|
ArrayList<String> list = new ArrayList<>();
|
||||||
|
String field = null;
|
||||||
|
String identifiedFacet = null;
|
||||||
|
switch (entity) {
|
||||||
|
|
||||||
|
case "HostingNode":
|
||||||
|
field="domainName";
|
||||||
|
identifiedFacet="NetworkingFacet";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "Configuration":
|
||||||
|
field="group";
|
||||||
|
identifiedFacet="SoftwareFacet";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "EService": //GcoreEndPoint
|
||||||
|
field="group";
|
||||||
|
identifiedFacet="SoftwareFacet";
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
String query="SELECT DISTINCT("+field+") AS "+field+" "
|
||||||
|
+ "FROM (TRAVERSE outE('IsIdentifiedBy'),inV('"+identifiedFacet+"') FROM "+entity+")";
|
||||||
|
|
||||||
|
System.out.println("------------query----------->"+query);
|
||||||
|
String result=resourceRegistryClient.query(query, 1000, null);
|
||||||
|
JSONObject jsonObj = new JSONObject(result);
|
||||||
|
JSONArray jsonArray=jsonObj.getJSONArray("result");
|
||||||
|
|
||||||
|
for(int i=0;i < jsonArray.length();i++){
|
||||||
|
list.add(jsonArray.getJSONObject(i).getString(field));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Create a list for configuration (aka GenericResourceObject)
|
||||||
|
* @param scope
|
||||||
|
* @param typeE
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static List<String> CreateListConfigurationQuery(String scope,
|
||||||
|
String typeC, String subTypeC) throws Exception {
|
||||||
|
|
||||||
|
ScopeProvider.instance.set(scope);
|
||||||
|
|
||||||
|
String query=null;
|
||||||
|
if (subTypeC==null){
|
||||||
|
query="SELECT header,name, description FROM (TRAVERSE outE('IsIdentifiedBy'),inV('SoftwareFacet') "
|
||||||
|
+ " FROM Configuration WHILE $depth<=0)";
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
query="SELECT header,name, description FROM (TRAVERSE outE('IsIdentifiedBy'),inV('SoftwareFacet') "
|
||||||
|
+ " FROM Configuration ) where group='"+subTypeC+"'";
|
||||||
|
}
|
||||||
|
System.out.println("------------query list configuration----------->"+query);
|
||||||
|
|
||||||
|
JAXBContext context = JAXBContext.newInstance(GenericResourceObject.class);
|
||||||
|
Marshaller m = context.createMarshaller();
|
||||||
|
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
|
||||||
|
m.setProperty(Marshaller.JAXB_FRAGMENT, true);
|
||||||
|
|
||||||
|
List<String>resource=new ArrayList<String>();
|
||||||
|
String id="";
|
||||||
|
//String type="EService";
|
||||||
|
String type="GenericResource";
|
||||||
|
String subType="";
|
||||||
|
String name="";
|
||||||
|
String description="";
|
||||||
|
|
||||||
|
String result=resourceRegistryClient.query(query, 1000, null);
|
||||||
|
JSONObject jsonObj = new JSONObject(result);
|
||||||
|
JSONArray jsonArray=jsonObj.getJSONArray("result");
|
||||||
|
|
||||||
|
for(int i=0;i < jsonArray.length();i++){
|
||||||
|
//TODO
|
||||||
|
//id=jsonArray.getJSONObject(i).getString("header");
|
||||||
|
//id="b981efde-18ea-4867-98e7-5d024fcfc0cb"+i;
|
||||||
|
JSONObject header=new JSONObject(jsonArray.getJSONObject(i).getString("header"));
|
||||||
|
id=(String) header.get("uuid");
|
||||||
|
System.out.println("------------id----------->"+id);
|
||||||
|
|
||||||
|
try{
|
||||||
|
name=jsonArray.getJSONObject(i).getString("name");
|
||||||
|
}catch(Exception e){
|
||||||
|
name="";
|
||||||
|
}
|
||||||
|
try{
|
||||||
|
description=jsonArray.getJSONObject(i).getString("description");
|
||||||
|
}catch(Exception e){
|
||||||
|
description="";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GenericResourceObject temp =new GenericResourceObject(id, type, subType, name, description,scope);
|
||||||
|
|
||||||
|
|
||||||
|
StringWriter sw = new StringWriter();
|
||||||
|
m.marshal(temp,sw);
|
||||||
|
|
||||||
|
UUID uuid =UUID.fromString(id);
|
||||||
|
// ER configurationRegistry=resourceRegistryClient.getInstance(Configuration.class, uuid);
|
||||||
|
// CacheList.resourceid.put(id, new ResourceObject(name, configurationRegistry.toString()));
|
||||||
|
|
||||||
|
resource.add(sw.toString());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
List<Configuration> econfiguration = (List<Configuration>) resourceRegistryClient.getInstances(Configuration.NAME,false);
|
||||||
|
for (Configuration et : econfiguration) {
|
||||||
|
id=et.getHeader().getUUID().toString();
|
||||||
|
List<? extends Facet> facets = et.getIdentificationFacets();
|
||||||
|
for (Facet f : facets) {
|
||||||
|
if(f instanceof SoftwareFacet){
|
||||||
|
SoftwareFacet sf = (SoftwareFacet) f;
|
||||||
|
name=sf.getName();
|
||||||
|
subType=sf.getGroup();
|
||||||
|
description= sf.getDescription();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CacheList.resourceid.put(id, new ResourceObject(name, et.toString()));
|
||||||
|
GenericResourceObject temp =new GenericResourceObject(id, type, subType, name, description,scope);
|
||||||
|
|
||||||
|
StringWriter sw = new StringWriter();
|
||||||
|
m.marshal(temp,sw);
|
||||||
|
// filter to subtype
|
||||||
|
if (subTypeC!=null){
|
||||||
|
if (subType.equals(subTypeC)){
|
||||||
|
resource.add(sw.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
resource.add(sw.toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
return resource;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Create a list for eservice (aka gcore endpoint)
|
* Create a list for eservice (aka gcore endpoint)
|
||||||
|
@ -320,65 +471,130 @@ public class UtilityResource {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//NOT WORK it's too slow
|
/***
|
||||||
private static void CreateCacheListConfiguration(String scope) throws Exception {
|
* Create a list for hosting node (aka GHN)
|
||||||
// TODO Auto-generated method stub
|
* @param scope
|
||||||
|
* @param typeE
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static List<String> CreateListHostingNode(String scope, String typeC,String subTypeC) throws Exception {
|
||||||
|
|
||||||
|
|
||||||
ScopeProvider.instance.set(scope);
|
ScopeProvider.instance.set(scope);
|
||||||
JAXBContext context = JAXBContext.newInstance(GenericResourceObject.class);
|
JAXBContext context = JAXBContext.newInstance(HostingNodeObject.class);
|
||||||
Marshaller m = context.createMarshaller();
|
Marshaller m = context.createMarshaller();
|
||||||
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
|
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
|
||||||
m.setProperty(Marshaller.JAXB_FRAGMENT, true);
|
m.setProperty(Marshaller.JAXB_FRAGMENT, true);
|
||||||
|
|
||||||
List<String>resource=new ArrayList<String>();
|
List<String>resource=new ArrayList<String>();
|
||||||
String id="";
|
String id="";
|
||||||
//String type="EService";
|
//String type="HostingNode";
|
||||||
String type="GenericResource";
|
String type="GHN";
|
||||||
String subType="";
|
String subType="";//--
|
||||||
String name="";
|
String status="";//---
|
||||||
String description="";
|
String name="";//
|
||||||
List<Configuration> econfiguration = (List<Configuration>) resourceRegistryClient.getInstances(Configuration.NAME,false);
|
String upTime="-";
|
||||||
for (Configuration et : econfiguration) {
|
String lastUpdate="-";
|
||||||
id=et.getHeader().getUUID().toString();
|
long localAvailableSpace = 0;
|
||||||
List<? extends Facet> facets = et.getIdentificationFacets();
|
long virtualSize=0;
|
||||||
|
long virtualAvailable=0;
|
||||||
|
String loadLast1Min="-";
|
||||||
|
String loadLast5Min="-";
|
||||||
|
String loadLast15Min="-";
|
||||||
|
String gcfVersion="";
|
||||||
|
String ghnVersion="";
|
||||||
|
|
||||||
|
List<HostingNode> ehosting = (List<HostingNode>) resourceRegistryClient.getInstances(HostingNode.NAME,false);
|
||||||
|
for (HostingNode eh : ehosting) {
|
||||||
|
id=eh.getHeader().getUUID().toString();
|
||||||
|
lastUpdate=eh.getHeader().getLastUpdateTime().toString();
|
||||||
|
List<? extends Facet> facets = eh.getIdentificationFacets();
|
||||||
for (Facet f : facets) {
|
for (Facet f : facets) {
|
||||||
if(f instanceof SoftwareFacet){
|
if(f instanceof NetworkingFacet){
|
||||||
SoftwareFacet sf = (SoftwareFacet) f;
|
NetworkingFacet nf = (NetworkingFacet) f;
|
||||||
|
subType=nf.getDomainName();
|
||||||
name=sf.getName();
|
name=nf.getHostName();
|
||||||
subType=sf.getGroup();
|
|
||||||
description= sf.getDescription();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CacheList.resourceid.put(id, new ResourceObject(name, et.toString()));
|
CacheList.resourceid.put(id, new ResourceObject(name, eh.toString()));
|
||||||
|
List<ConsistsOf<? extends Resource, ? extends Facet>> consist = eh.getConsistsOf();
|
||||||
GenericResourceObject temp =new GenericResourceObject(id, type, subType, name, description,scope);
|
for (ConsistsOf<? extends Resource, ? extends Facet> c : consist) {
|
||||||
|
//System.out.println("------------ConsistsOf--ConsistsOf-- c"+c.toString());
|
||||||
|
if(c instanceof ConsistsOf){
|
||||||
|
|
||||||
|
if (c.getTarget() instanceof SimplePropertyFacet){
|
||||||
|
SimplePropertyFacet sp = (SimplePropertyFacet) c.getTarget();
|
||||||
|
try {
|
||||||
|
gcfVersion=sp.getAdditionalProperty("SmartGearsDistribution").toString();
|
||||||
|
ghnVersion=sp.getAdditionalProperty("SmartGears").toString();
|
||||||
|
}
|
||||||
|
catch(Exception e){
|
||||||
|
gcfVersion="";
|
||||||
|
ghnVersion="";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//get disk space
|
||||||
|
if (c instanceof HasPersistentMemory){
|
||||||
|
HasPersistentMemory hpm = (HasPersistentMemory) c;
|
||||||
|
try {
|
||||||
|
MemoryFacet mfh = (MemoryFacet) hpm.getTarget();
|
||||||
|
localAvailableSpace=mfh.getSize()- mfh.getUsed();
|
||||||
|
}
|
||||||
|
catch(Exception e){
|
||||||
|
localAvailableSpace=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//get ram space
|
||||||
|
if (c instanceof HasVolatileMemory){
|
||||||
|
HasVolatileMemory hvm = (HasVolatileMemory) c;
|
||||||
|
try {
|
||||||
|
if (hvm.getAdditionalProperty("memoryType").equals("RAM")){
|
||||||
|
MemoryFacet mf = (MemoryFacet) hvm.getTarget();
|
||||||
|
virtualAvailable=mf.getSize()-mf.getUsed();
|
||||||
|
virtualSize=mf.getSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e){
|
||||||
|
virtualAvailable=0;
|
||||||
|
virtualSize=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//get status
|
||||||
|
if (c.getTarget() instanceof StateFacet){
|
||||||
|
StateFacet st = (StateFacet) c.getTarget();
|
||||||
|
try {
|
||||||
|
status=st.getValue();
|
||||||
|
}
|
||||||
|
catch(Exception e){
|
||||||
|
status="";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HostingNodeObject temp =new HostingNodeObject( id, type, subType,
|
||||||
|
status, name, upTime, lastUpdate,
|
||||||
|
localAvailableSpace, virtualSize,
|
||||||
|
virtualAvailable, loadLast1Min, loadLast5Min,
|
||||||
|
loadLast15Min, gcfVersion, ghnVersion,
|
||||||
|
scope);
|
||||||
|
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
m.marshal(temp,sw);
|
m.marshal(temp,sw);
|
||||||
System.out.println("---------------->sw.toString "+sw.toString());
|
// filter to subtype
|
||||||
|
if (subTypeC!=null){
|
||||||
if (CacheList.resourceTable.containsKey(type+subType)){
|
if (subType.equals(subTypeC)){
|
||||||
List<String> listResource=CacheList.resourceTable.get(type+subType);
|
resource.add(sw.toString());
|
||||||
if (!listResource.contains(sw.toString()))
|
}
|
||||||
listResource.add(sw.toString());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else
|
||||||
List<String>listResource=new ArrayList<String>();
|
resource.add(sw.toString());
|
||||||
listResource.add(sw.toString());
|
|
||||||
CacheList.resourceTable.put(type+subType, listResource);
|
}
|
||||||
}
|
return resource;
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue