Added VirtualService
This commit is contained in:
parent
9611d5fa5e
commit
cd7f4dca11
11
.classpath
11
.classpath
|
@ -9,11 +9,7 @@
|
|||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
|
@ -23,5 +19,10 @@
|
|||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="owner.project.facets" value="java"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="rrm-common-library">
|
||||
<wb-resource deploy-path="/" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/" source-path="/src/test/java"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<installed facet="jst.utility" version="1.0"/>
|
||||
<installed facet="java" version="1.7"/>
|
||||
<installed facet="java" version="1.8"/>
|
||||
</faceted-project>
|
||||
|
|
|
@ -55,7 +55,7 @@ public enum ResourceTypeDecorator {
|
|||
ConcreteDataset("ConcreteDataset","ghn-icon","ConcreteDataset"),
|
||||
Configuration("Configuration","ghn-icon","Configuration"),
|
||||
RunningPlugin("RunningPlugin","ghn-icon","RunningPlugin"),
|
||||
VirtualService("VirtualService","ghn-icon","VirtualService"),
|
||||
VirtualService("VirtualService","runtimeresource-icon","VirtualService"),
|
||||
Actor("Actor","ghn-icon","Actor"),
|
||||
Plugin("Plugin","ghn-icon","Plugin"),
|
||||
|
||||
|
|
|
@ -0,0 +1,251 @@
|
|||
/****************************************************************************
|
||||
* 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: EserviceManager.java
|
||||
****************************************************************************
|
||||
* @author <a href="mailto:daniele.strollo@isti.cnr.it">Daniele Strollo</a>
|
||||
***************************************************************************/
|
||||
|
||||
package org.gcube.resourcemanagement.support.server.managers.resources;
|
||||
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
||||
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
|
||||
import org.gcube.common.resources.gcore.GCoreEndpoint;
|
||||
import org.gcube.common.resources.gcore.Resource;
|
||||
import org.gcube.common.resources.gcore.Software;
|
||||
import org.gcube.common.resources.gcore.Software.Profile.ServicePackage;
|
||||
import org.gcube.common.resources.gcore.Software.Profile.SoftwarePackage;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.resourcemanagement.support.server.exceptions.AbstractResourceException;
|
||||
import org.gcube.resourcemanagement.support.server.exceptions.ResourceAccessException;
|
||||
import org.gcube.resourcemanagement.support.server.exceptions.ResourceOperationException;
|
||||
import org.gcube.resourcemanagement.support.server.exceptions.ResourceParameterException;
|
||||
import org.gcube.resourcemanagement.support.server.types.AllowedResourceTypes;
|
||||
import org.gcube.resourcemanagement.support.server.utils.Assertion;
|
||||
import org.gcube.resourcemanagement.support.server.utils.ServerConsole;
|
||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||
import org.gcube.vremanagement.resourcemanager.client.RMBinderLibrary;
|
||||
import org.gcube.vremanagement.resourcemanager.client.RMReportingLibrary;
|
||||
import org.gcube.vremanagement.resourcemanager.client.fws.Types.AddResourcesParameters;
|
||||
import org.gcube.vremanagement.resourcemanager.client.fws.Types.PackageItem;
|
||||
import org.gcube.vremanagement.resourcemanager.client.fws.Types.RemoveResourcesParameters;
|
||||
import org.gcube.vremanagement.resourcemanager.client.fws.Types.ResourceItem;
|
||||
import org.gcube.vremanagement.resourcemanager.client.fws.Types.ResourceList;
|
||||
import org.gcube.vremanagement.resourcemanager.client.fws.Types.SoftwareList;
|
||||
|
||||
/**
|
||||
* @author Daniele Strollo (ISTI-CNR)
|
||||
* @author Massimiliano Assante (ISTI-CNR)
|
||||
*/
|
||||
public class VirtualServiceManager extends AbstractResourceManager {
|
||||
// Used internally to require static functionalities (e.g. deploy).
|
||||
private static final String LOG_PREFIX = "[VS-MGR]";
|
||||
|
||||
/**
|
||||
* @deprecated discouraged use. With no ID some operations cannot be accessed.
|
||||
*/
|
||||
public VirtualServiceManager()
|
||||
throws ResourceParameterException, ResourceAccessException {
|
||||
super(AllowedResourceTypes.VirtualService);
|
||||
}
|
||||
|
||||
public VirtualServiceManager(final String id)
|
||||
throws ResourceParameterException, ResourceAccessException {
|
||||
super(id, AllowedResourceTypes.VirtualService);
|
||||
}
|
||||
|
||||
public VirtualServiceManager(final String id, final String name)
|
||||
throws ResourceParameterException, ResourceAccessException {
|
||||
super(id, name, AllowedResourceTypes.VirtualService);
|
||||
}
|
||||
|
||||
public VirtualServiceManager(final String id, final String name, final String subType)
|
||||
throws ResourceParameterException, ResourceAccessException {
|
||||
super(id, name, AllowedResourceTypes.VirtualService, subType);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param scope
|
||||
* @param ghnsID
|
||||
* @param servicesID
|
||||
* @return
|
||||
* @throws ResourceParameterException
|
||||
* @throws ResourceOperationException
|
||||
*/
|
||||
public final String deploy(final ScopeBean scope, final String[] ghnsID, final String[] servicesID) throws ResourceParameterException, ResourceOperationException {
|
||||
Assertion<ResourceParameterException> checker = new Assertion<ResourceParameterException>();
|
||||
checker.validate(servicesID != null && servicesID.length != 0,
|
||||
new ResourceParameterException("Invalid servicesID parameter. It cannot be null or empty."));
|
||||
checker.validate(scope != null,
|
||||
new ResourceParameterException("Cannot retrieve the scope."));
|
||||
|
||||
ArrayList<PackageItem> serviceProfiles = new ArrayList<PackageItem>();
|
||||
|
||||
try {
|
||||
|
||||
SimpleQuery query = null;
|
||||
DiscoveryClient<Software> client = clientFor(Software.class);
|
||||
|
||||
prepareServices: for (String serviceID : servicesID) {
|
||||
query = queryFor(Software.class);
|
||||
query.addCondition("$resource/Profile/ID/text() eq '" + serviceID + "'");
|
||||
System.out.println("**** Query : " + query.toString());
|
||||
String curr = ScopeProvider.instance.get();
|
||||
ScopeProvider.instance.set(scope.toString());
|
||||
List<Software> results = client.submit(query);
|
||||
ScopeProvider.instance.set(curr);
|
||||
System.out.println("**** results received : " + results.size());
|
||||
Software ret = null;
|
||||
if (results != null && results.size() > 0) {
|
||||
ret = results.get(0);
|
||||
} else {
|
||||
continue prepareServices;
|
||||
}
|
||||
|
||||
if (ret == null ||
|
||||
ret.profile() == null ||
|
||||
ret.profile().softwareClass() == null ||
|
||||
ret.profile().softwareName() == null) {
|
||||
ServerConsole.error(LOG_PREFIX, "found an invalid service profile");
|
||||
continue;
|
||||
}
|
||||
PackageItem toAdd = new PackageItem();
|
||||
|
||||
toAdd.serviceClass = ret.profile().softwareClass();
|
||||
toAdd.serviceName = ret.profile().softwareName();
|
||||
toAdd.serviceVersion ="1.0.0";
|
||||
if (ret.profile().packages().size() == 1) {
|
||||
toAdd.packageName = ret.profile().packages().iterator().next().name();
|
||||
toAdd.packageVersion = ret.profile().packages().iterator().next().version();
|
||||
} else {
|
||||
for (SoftwarePackage p : ret.profile().packages()) {
|
||||
if (p.getClass().isAssignableFrom(ServicePackage.class)) {
|
||||
toAdd.packageName = p.name();
|
||||
toAdd.packageVersion = p.version();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
serviceProfiles.add(toAdd);
|
||||
}
|
||||
|
||||
SoftwareList serviceList = new SoftwareList();
|
||||
|
||||
ArrayList<String> arrayGHNSids = new ArrayList<String>();
|
||||
for (int i = 0; i < ghnsID.length; i++) {
|
||||
arrayGHNSids.add(ghnsID[i]);
|
||||
}
|
||||
serviceList.suggestedTargetGHNNames = arrayGHNSids;
|
||||
serviceList.software = serviceProfiles;
|
||||
|
||||
AddResourcesParameters addResourcesParameters = new AddResourcesParameters();
|
||||
addResourcesParameters.softwareList = serviceList;
|
||||
addResourcesParameters.setTargetScope(scope.toString());
|
||||
|
||||
System.out.println("\n\n**** These is the ServiceList i pass to ResourceManagerPortType: ");
|
||||
for (int i = 0; i < serviceList.software.size(); i++) {
|
||||
System.out.println(serviceList.software.get(i));
|
||||
}
|
||||
|
||||
String id = "";
|
||||
RMBinderLibrary manager = ResourceFactory.createResourceManager(AllowedResourceTypes.Service).getResourceManager(scope.toString());
|
||||
String curr = ScopeProvider.instance.get();
|
||||
ScopeProvider.instance.set(scope.toString());
|
||||
id = manager.addResources(addResourcesParameters);
|
||||
ScopeProvider.instance.set(curr);
|
||||
return id;
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, "Error during deployment.", e);
|
||||
throw new ResourceOperationException("Software deployment failure: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param scope
|
||||
* @return
|
||||
* @throws AbstractResourceException
|
||||
*/
|
||||
public final String undeploy(final ScopeBean scope) throws AbstractResourceException {
|
||||
Assertion<AbstractResourceException> checker = new Assertion<AbstractResourceException>();
|
||||
checker.validate(scope != null,
|
||||
new ResourceParameterException("Cannot retrieve the scope."));
|
||||
checker.validate(this.getID() != null,
|
||||
new ResourceOperationException("Invalid ID."));
|
||||
|
||||
try {
|
||||
RMBinderLibrary rm = ResourceFactory.createResourceManager(AllowedResourceTypes.Service).getResourceManager(scope.toString());
|
||||
//prepare the parameters
|
||||
RemoveResourcesParameters params = new RemoveResourcesParameters();
|
||||
ResourceItem[] resourcelist = new ResourceItem[1];
|
||||
resourcelist[0] = new ResourceItem();
|
||||
resourcelist[0].id = this.getID();
|
||||
resourcelist[0].type = this.getType().name();
|
||||
ResourceList r = new ResourceList();
|
||||
ArrayList<ResourceItem> temp =new ArrayList<ResourceItem>();
|
||||
temp.add(resourcelist[0]);
|
||||
r.setResource(temp);
|
||||
params.resources = r;
|
||||
params.targetScope = scope.toString();
|
||||
|
||||
//sending the request
|
||||
ServerConsole.info(LOG_PREFIX, "Sending the Remove Resource request....");
|
||||
String reportID = rm.removeResources(params);
|
||||
ServerConsole.info(LOG_PREFIX, "Returned report ID: " + reportID);
|
||||
return reportID;
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, "Error during deployment.", e);
|
||||
throw new ResourceOperationException("Software deployment failure: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public final String checkDeployStatus(final ScopeBean scope, final String deployID)
|
||||
throws AbstractResourceException {
|
||||
Assertion<ResourceParameterException> checker = new Assertion<ResourceParameterException>();
|
||||
checker.validate(scope != null,
|
||||
new ResourceParameterException("Invalid scope passed"));
|
||||
checker.validate(deployID != null && deployID.trim().length() > 0,
|
||||
new ResourceParameterException("Invalid reportID passed"));
|
||||
|
||||
RMReportingLibrary vreManagerPortType = this.getReportResourceManager(scope.toString());
|
||||
|
||||
try {
|
||||
return vreManagerPortType.getReport(deployID);
|
||||
} catch (Exception e) {
|
||||
ServerConsole.error(LOG_PREFIX, e);
|
||||
throw new ResourceOperationException("Cannot retrieve the report: " + deployID + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final Resource buildResource(final String xmlRepresentation) throws AbstractResourceException {
|
||||
try {
|
||||
JAXBContext ctx = JAXBContext.newInstance(GCoreEndpoint.class);
|
||||
Unmarshaller unmarshaller = ctx.createUnmarshaller();
|
||||
StringReader reader = new StringReader(xmlRepresentation);
|
||||
GCoreEndpoint deserialised = (GCoreEndpoint) unmarshaller.unmarshal(reader);
|
||||
return deserialised;
|
||||
} catch (Exception e) {
|
||||
throw new ResourceAccessException("Cannot load the stub for resource " + this.getType(), e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -28,5 +28,6 @@ public enum AllowedResourceTypes {
|
|||
GenericResource(),
|
||||
RuntimeResource(),
|
||||
Collection(),
|
||||
Eservice();
|
||||
Eservice(),
|
||||
VirtualService();
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ import com.google.gwt.i18n.client.NumberFormat;
|
|||
|
||||
/**
|
||||
* @author Massimiliano Assante (ISTI-CNR)
|
||||
* @author Daniele Strollo
|
||||
* @author Daniele Strollo
|
||||
*/
|
||||
public class ResourceDetailModel {
|
||||
private static boolean initialized = false;
|
||||
|
@ -68,106 +68,101 @@ public class ResourceDetailModel {
|
|||
List<ColumnConfig> modelColumns = new ArrayList<ColumnConfig>();
|
||||
|
||||
modelColumns.add(new ColumnConfig("Name", "Name", 250));
|
||||
|
||||
|
||||
|
||||
|
||||
ColumnConfig status = new ColumnConfig("Status", "Status", 65);
|
||||
|
||||
GridCellRenderer<BaseModelData> statusRender = new GridCellRenderer<BaseModelData>() {
|
||||
@Override
|
||||
public String render(BaseModelData model, String property, ColumnData config,
|
||||
int rowIndex, int colIndex, ListStore<BaseModelData> store, Grid<BaseModelData> grid) {
|
||||
String statusToCheck = (String)model.get(property);
|
||||
public String render(BaseModelData model, String property, ColumnData config, int rowIndex, int colIndex,
|
||||
ListStore<BaseModelData> store, Grid<BaseModelData> grid) {
|
||||
String statusToCheck = (String) model.get(property);
|
||||
String style = "gray";
|
||||
if (statusToCheck.compareTo("certified") == 0)
|
||||
style = "green";
|
||||
else if (statusToCheck.compareTo("ready") == 0)
|
||||
style = "orange";
|
||||
return "<span style='color:" + style + "'>" + statusToCheck + "</span>";
|
||||
}
|
||||
};
|
||||
status.setRenderer(statusRender);
|
||||
return "<span style='color:" + style + "'>" + statusToCheck + "</span>";
|
||||
}
|
||||
};
|
||||
status.setRenderer(statusRender);
|
||||
modelColumns.add(status);
|
||||
|
||||
|
||||
modelColumns.add(new ColumnConfig("LastUpdate", "Last Updated", 130));
|
||||
modelColumns.add(new ColumnConfig("gCoreVersion", "Version", 50));
|
||||
modelColumns.add(new ColumnConfig("ghnVersion", "Distro v.", 50));
|
||||
|
||||
|
||||
ColumnConfig ramLeft = new ColumnConfig("VirtualAvailable", "Mem avail.", 70);
|
||||
ramLeft.setAlignment(HorizontalAlignment.RIGHT);
|
||||
ramLeft.setEditor(new CellEditor(new NumberField()));
|
||||
final NumberFormat number = NumberFormat.getFormat("#,##0;(#,##0)");
|
||||
ramLeft.setEditor(new CellEditor(new NumberField()));
|
||||
final NumberFormat number = NumberFormat.getFormat("#,##0;(#,##0)");
|
||||
|
||||
GridCellRenderer<BaseModelData> ramRender = new GridCellRenderer<BaseModelData>() {
|
||||
@Override
|
||||
public String render(BaseModelData model, String property, ColumnData config,
|
||||
int rowIndex, int colIndex, ListStore<BaseModelData> store, Grid<BaseModelData> grid) {
|
||||
int val = Integer.parseInt((String)model.get(property));
|
||||
|
||||
public String render(BaseModelData model, String property, ColumnData config, int rowIndex, int colIndex,
|
||||
ListStore<BaseModelData> store, Grid<BaseModelData> grid) {
|
||||
int val = Integer.parseInt((String) model.get(property));
|
||||
|
||||
int tot = Integer.parseInt((String) model.get("VirtualSize"));
|
||||
|
||||
int percentage = (val * 100) / tot;
|
||||
|
||||
String style = val < 100 ? "red" : "green";
|
||||
String toDisplay = number.format(val).replaceAll(",", ".");
|
||||
|
||||
int percentage = (val * 100) / tot;
|
||||
|
||||
String style = val < 100 ? "red" : "green";
|
||||
String toDisplay = number.format(val).replaceAll(",", ".");
|
||||
toDisplay += " MB";
|
||||
|
||||
return "<span style='color:" + style + "'>" + percentage + "% ("+toDisplay+")</span>";
|
||||
}
|
||||
};
|
||||
ramLeft.setRenderer(ramRender);
|
||||
|
||||
return "<span style='color:" + style + "'>" + percentage + "% (" + toDisplay + ")</span>";
|
||||
}
|
||||
};
|
||||
ramLeft.setRenderer(ramRender);
|
||||
|
||||
modelColumns.add(ramLeft);
|
||||
|
||||
|
||||
|
||||
ColumnConfig localSpace = new ColumnConfig("LocalAvailableSpace", "HD Space left", 70);
|
||||
localSpace.setAlignment(HorizontalAlignment.RIGHT);
|
||||
localSpace.setEditor(new CellEditor(new NumberField()));
|
||||
localSpace.setEditor(new CellEditor(new NumberField()));
|
||||
|
||||
GridCellRenderer<BaseModelData> mbRender = new GridCellRenderer<BaseModelData>() {
|
||||
@Override
|
||||
public String render(BaseModelData model, String property, ColumnData config,
|
||||
int rowIndex, int colIndex, ListStore<BaseModelData> store, Grid<BaseModelData> grid) {
|
||||
public String render(BaseModelData model, String property, ColumnData config, int rowIndex, int colIndex,
|
||||
ListStore<BaseModelData> store, Grid<BaseModelData> grid) {
|
||||
int val = 0;
|
||||
try {
|
||||
val = Integer.parseInt((String)model.get(property));
|
||||
val = Integer.parseInt((String) model.get(property));
|
||||
} catch (NumberFormatException e) {
|
||||
val = 0;
|
||||
}
|
||||
String style = val < 1000000 ? "red" : "green";
|
||||
String toDisplay = number.format(val);
|
||||
String style = val < 1000000 ? "red" : "green";
|
||||
String toDisplay = number.format(val);
|
||||
if (toDisplay.length() > 4)
|
||||
toDisplay = toDisplay.substring(0, toDisplay.length()-4).replaceAll(",", ".");
|
||||
toDisplay = toDisplay.substring(0, toDisplay.length() - 4).replaceAll(",", ".");
|
||||
toDisplay += " MB";
|
||||
return "<span style='color:" + style + "'>" + toDisplay + "</span>";
|
||||
}
|
||||
};
|
||||
return "<span style='color:" + style + "'>" + toDisplay + "</span>";
|
||||
}
|
||||
};
|
||||
|
||||
localSpace.setRenderer(mbRender);
|
||||
localSpace.setRenderer(mbRender);
|
||||
modelColumns.add(localSpace);
|
||||
|
||||
|
||||
//Optional
|
||||
|
||||
// Optional
|
||||
ColumnConfig ramTotal = new ColumnConfig("VirtualSize", "V. Memory total", 70);
|
||||
ramTotal.setAlignment(HorizontalAlignment.RIGHT);
|
||||
ramTotal.setEditor(new CellEditor(new NumberField()));
|
||||
ramTotal.setEditor(new CellEditor(new NumberField()));
|
||||
|
||||
GridCellRenderer<BaseModelData> ramTotRender = new GridCellRenderer<BaseModelData>() {
|
||||
@Override
|
||||
public String render(BaseModelData model, String property, ColumnData config,
|
||||
int rowIndex, int colIndex, ListStore<BaseModelData> store, Grid<BaseModelData> grid) {
|
||||
int val = Integer.parseInt((String)model.get(property));
|
||||
String toDisplay = number.format(val).replaceAll(",", ".");
|
||||
public String render(BaseModelData model, String property, ColumnData config, int rowIndex, int colIndex,
|
||||
ListStore<BaseModelData> store, Grid<BaseModelData> grid) {
|
||||
int val = Integer.parseInt((String) model.get(property));
|
||||
String toDisplay = number.format(val).replaceAll(",", ".");
|
||||
toDisplay += " MB";
|
||||
return toDisplay;
|
||||
}
|
||||
};
|
||||
ramTotal.setRenderer(ramTotRender);
|
||||
modelColumns.add(ramTotal);
|
||||
|
||||
return toDisplay;
|
||||
}
|
||||
};
|
||||
ramTotal.setRenderer(ramTotRender);
|
||||
modelColumns.add(ramTotal);
|
||||
|
||||
modelColumns.add(new ColumnConfig("ID", "ID", 220));
|
||||
modelColumns.add(new ColumnConfig("Uptime", "Up Time", 100));
|
||||
modelColumns.add(new ColumnConfig("Uptime", "Up Time", 100));
|
||||
modelColumns.add(new ColumnConfig("LoadLast15Min", "Load Last 15 Min", 100));
|
||||
modelColumns.add(new ColumnConfig("LoadLast1Min", "Load Last 1 Min", 100));
|
||||
modelColumns.add(new ColumnConfig("LoadLast5Min", "Load Last 5 Min", 100));
|
||||
|
@ -191,8 +186,8 @@ public class ResourceDetailModel {
|
|||
type.addField("Name");
|
||||
type.addField("Uptime");
|
||||
type.addField("LastUpdate");
|
||||
type.addField("VirtualAvailable");
|
||||
type.addField("VirtualSize");
|
||||
type.addField("VirtualAvailable");
|
||||
type.addField("VirtualSize");
|
||||
type.addField("gCoreVersion", "gcf-version");
|
||||
type.addField("ghnVersion", "ghn-version");
|
||||
type.addField("LocalAvailableSpace");
|
||||
|
@ -207,7 +202,6 @@ public class ResourceDetailModel {
|
|||
|
||||
XML_MAPPING.put(ResourceTypeDecorator.GHN.name(), type);
|
||||
|
||||
|
||||
/*********************************************
|
||||
* Collection
|
||||
********************************************/
|
||||
|
@ -218,12 +212,12 @@ public class ResourceDetailModel {
|
|||
modelColumns.add(new ColumnConfig("LastUpdateTime", "Last Updated", 170));
|
||||
modelColumns.add(new ColumnConfig("ID", "ID", 220));
|
||||
|
||||
//Optional
|
||||
// Optional
|
||||
modelColumns.add(new ColumnConfig("CreationTime", "Creation Time", 170));
|
||||
modelColumns.add(new ColumnConfig("Scopes", "Scopes", 300));
|
||||
modelColumns.add(new ColumnConfig("SubType", "SubType", 200));
|
||||
//modelColumns.add(new ColumnConfig("NumberOfMembers", "Number Of Members", 115)); //not available anymore
|
||||
|
||||
// modelColumns.add(new ColumnConfig("NumberOfMembers", "Number Of
|
||||
// Members", 115)); //not available anymore
|
||||
|
||||
// create the column model
|
||||
cm = new ColumnModel(modelColumns);
|
||||
|
@ -245,10 +239,8 @@ public class ResourceDetailModel {
|
|||
type.addField("SubType");
|
||||
type.addField("Type");
|
||||
|
||||
|
||||
XML_MAPPING.put(ResourceTypeDecorator.Collection.name(), type);
|
||||
|
||||
|
||||
/*********************************************
|
||||
* Service
|
||||
********************************************/
|
||||
|
@ -258,7 +250,7 @@ public class ResourceDetailModel {
|
|||
modelColumns.add(new ColumnConfig("ServiceClass", "Service Class", 200));
|
||||
modelColumns.add(new ColumnConfig("ServiceName", "Service Name", 260));
|
||||
modelColumns.add(new ColumnConfig("Version", "Main Package Version", 100));
|
||||
//Optional
|
||||
// Optional
|
||||
modelColumns.add(new ColumnConfig("Shareable", "Shareable", 100));
|
||||
modelColumns.add(new ColumnConfig("Scopes", "Scopes", 300));
|
||||
modelColumns.add(new ColumnConfig("ID", "ID", 220));
|
||||
|
@ -286,11 +278,8 @@ public class ResourceDetailModel {
|
|||
type.addField("SubType");
|
||||
type.addField("Type");
|
||||
|
||||
|
||||
XML_MAPPING.put(ResourceTypeDecorator.Service.name(), type);
|
||||
|
||||
|
||||
|
||||
/*********************************************
|
||||
* InstallableSoftware
|
||||
********************************************/
|
||||
|
@ -298,8 +287,7 @@ public class ResourceDetailModel {
|
|||
modelColumns = new ArrayList<ColumnConfig>();
|
||||
|
||||
// adds the checkbox to the model
|
||||
CheckColumnConfig checkColumn =
|
||||
new CheckColumnConfig(ResourceDetailModel.SERVICE_INSTALL_KEY, "Deploy", 60);
|
||||
CheckColumnConfig checkColumn = new CheckColumnConfig(ResourceDetailModel.SERVICE_INSTALL_KEY, "Deploy", 60);
|
||||
CellEditor checkBoxEditor = new CellEditor(new CheckBox());
|
||||
checkColumn.setEditor(checkBoxEditor);
|
||||
modelColumns.add(checkColumn);
|
||||
|
@ -307,7 +295,7 @@ public class ResourceDetailModel {
|
|||
modelColumns.add(new ColumnConfig("ServiceClass", "Service Class", 250));
|
||||
modelColumns.add(new ColumnConfig("ServiceName", "Service Name", 250));
|
||||
modelColumns.add(new ColumnConfig("Version", "Main Package Version", 100));
|
||||
//Optional
|
||||
// Optional
|
||||
modelColumns.add(new ColumnConfig("Scopes", "Scopes", 300));
|
||||
modelColumns.add(new ColumnConfig("ID", "ID", 220));
|
||||
modelColumns.add(new ColumnConfig("SubType", "SubType", 200));
|
||||
|
@ -333,11 +321,8 @@ public class ResourceDetailModel {
|
|||
type.addField("SubType");
|
||||
type.addField("Type");
|
||||
|
||||
|
||||
XML_MAPPING.put(ResourceTypeDecorator.InstallableSoftware.name(), type);
|
||||
|
||||
|
||||
|
||||
/*********************************************
|
||||
* RunningInstance
|
||||
********************************************/
|
||||
|
@ -348,7 +333,7 @@ public class ResourceDetailModel {
|
|||
modelColumns.add(new ColumnConfig("Version", "Version", 100));
|
||||
modelColumns.add(new ColumnConfig("Status", "Status", 65));
|
||||
modelColumns.add(new ColumnConfig("GHN", "GHN", 300));
|
||||
//Optional
|
||||
// Optional
|
||||
modelColumns.add(new ColumnConfig("Scopes", "Scopes", 300));
|
||||
modelColumns.add(new ColumnConfig("ID", "ID", 220));
|
||||
modelColumns.add(new ColumnConfig("SubType", "SubType", 200));
|
||||
|
@ -378,12 +363,9 @@ public class ResourceDetailModel {
|
|||
type.addField("SubType");
|
||||
type.addField("Type");
|
||||
|
||||
|
||||
XML_MAPPING.put(ResourceTypeDecorator.RunningInstance.name(), type);
|
||||
|
||||
|
||||
|
||||
//NEW REGISTRY
|
||||
// NEW REGISTRY
|
||||
/*********************************************
|
||||
* EService
|
||||
********************************************/
|
||||
|
@ -394,7 +376,7 @@ public class ResourceDetailModel {
|
|||
modelColumns.add(new ColumnConfig("Version", "Version", 100));
|
||||
modelColumns.add(new ColumnConfig("Status", "Status", 65));
|
||||
modelColumns.add(new ColumnConfig("GHN", "GHN", 300));
|
||||
//Optional
|
||||
// Optional
|
||||
modelColumns.add(new ColumnConfig("Scopes", "Scopes", 300));
|
||||
modelColumns.add(new ColumnConfig("ID", "ID", 220));
|
||||
modelColumns.add(new ColumnConfig("SubType", "SubType", 200));
|
||||
|
@ -424,17 +406,47 @@ public class ResourceDetailModel {
|
|||
type.addField("SubType");
|
||||
type.addField("Type");
|
||||
|
||||
|
||||
XML_MAPPING.put(ResourceTypeDecorator.EService.name(), type);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//TODO VirtualService
|
||||
// NEW REGISTRY
|
||||
/*********************************************
|
||||
* VirtualService
|
||||
********************************************/
|
||||
// The column model for grid representation
|
||||
modelColumns = new ArrayList<ColumnConfig>();
|
||||
modelColumns.add(new ColumnConfig("Name", "Name", 260));
|
||||
modelColumns.add(new ColumnConfig("Description", "Description", 200));
|
||||
//modelColumns.add(new ColumnConfig("Version", "Version", 100));
|
||||
// Optional
|
||||
modelColumns.add(new ColumnConfig("ID", "ID", 220));
|
||||
modelColumns.add(new ColumnConfig("SubType", "SubType", 200));
|
||||
modelColumns.add(new ColumnConfig("Scopes", "Scopes", 300));
|
||||
|
||||
// create the column model
|
||||
cm = new ColumnModel(modelColumns);
|
||||
for (int i = 5; i < modelColumns.size(); i++) {
|
||||
cm.setHidden(i, true);
|
||||
}
|
||||
RECORD_DEFINITION.put(ResourceTypeDecorator.VirtualService.name(), cm);
|
||||
|
||||
// defines the xml structure
|
||||
type = new ModelType();
|
||||
type.setRoot("Resources");
|
||||
type.setRecordName("Resource");
|
||||
type.addField("ID");
|
||||
type.addField("Name");
|
||||
type.addField("Description");
|
||||
//type.addField("Version");
|
||||
// a) This is the GHNID type.addField("GHN", "/Profile/GHN/@UniqueID");
|
||||
// b) While this is its name
|
||||
type.addField("Scopes");
|
||||
|
||||
// These fields are internally used and not showable
|
||||
type.addField("SubType");
|
||||
type.addField("Type");
|
||||
|
||||
XML_MAPPING.put(ResourceTypeDecorator.VirtualService.name(), type);
|
||||
|
||||
/*********************************************
|
||||
* VIEW
|
||||
|
@ -444,11 +456,11 @@ public class ResourceDetailModel {
|
|||
modelColumns.add(new ColumnConfig("ViewName", "View Name", 200));
|
||||
modelColumns.add(new ColumnConfig("SourceKey", "Source Key", 200));
|
||||
modelColumns.add(new ColumnConfig("LastUpdate", "Last Update", 270));
|
||||
modelColumns.add(new ColumnConfig("Cardinality", "Cardinality", 100));
|
||||
//Optional
|
||||
modelColumns.add(new ColumnConfig("ViewType", "View Type", 170));
|
||||
modelColumns.add(new ColumnConfig("RelatedCollectionId", "Related Collection Id", 220));
|
||||
modelColumns.add(new ColumnConfig("ServiceName", "Service Name", 170));
|
||||
modelColumns.add(new ColumnConfig("Cardinality", "Cardinality", 100));
|
||||
// Optional
|
||||
modelColumns.add(new ColumnConfig("ViewType", "View Type", 170));
|
||||
modelColumns.add(new ColumnConfig("RelatedCollectionId", "Related Collection Id", 220));
|
||||
modelColumns.add(new ColumnConfig("ServiceName", "Service Name", 170));
|
||||
modelColumns.add(new ColumnConfig("Termination", "Termination Time", 270));
|
||||
|
||||
modelColumns.add(new ColumnConfig("Source", "Source", 230));
|
||||
|
@ -472,7 +484,7 @@ public class ResourceDetailModel {
|
|||
type.addField("ViewName");
|
||||
type.addField("Cardinality");
|
||||
type.addField("ViewType");
|
||||
type.addField("RelatedCollectionId");
|
||||
type.addField("RelatedCollectionId");
|
||||
type.addField("Source");
|
||||
type.addField("SourceKey");
|
||||
type.addField("ServiceClass");
|
||||
|
@ -483,12 +495,10 @@ public class ResourceDetailModel {
|
|||
type.addField("SubType", "SubType");
|
||||
type.addField("RI");
|
||||
type.addField("Type");
|
||||
|
||||
|
||||
|
||||
GWT.log("VIew Name: " + ResourceTypeDecorator.VIEW.name());
|
||||
XML_MAPPING.put(ResourceTypeDecorator.VIEW.name(), type);
|
||||
|
||||
|
||||
/*********************************************
|
||||
* GenericResource
|
||||
********************************************/
|
||||
|
@ -498,7 +508,7 @@ public class ResourceDetailModel {
|
|||
modelColumns.add(new ColumnConfig("Description", "Description", 400));
|
||||
modelColumns.add(new ColumnConfig("Scopes", "Scopes", 300));
|
||||
|
||||
//Optional
|
||||
// Optional
|
||||
modelColumns.add(new ColumnConfig("ID", "ID", 220));
|
||||
modelColumns.add(new ColumnConfig("SubType", "Secondary Type", 170));
|
||||
modelColumns.add(new ColumnConfig("SubType", "SubType", 200));
|
||||
|
@ -522,7 +532,7 @@ public class ResourceDetailModel {
|
|||
type.addField("Type");
|
||||
|
||||
XML_MAPPING.put(ResourceTypeDecorator.GenericResource.name(), type);
|
||||
|
||||
|
||||
/*********************************************
|
||||
* RuntimeResource
|
||||
********************************************/
|
||||
|
@ -532,8 +542,7 @@ public class ResourceDetailModel {
|
|||
modelColumns.add(new ColumnConfig("Host", "Host", 250));
|
||||
modelColumns.add(new ColumnConfig("Scopes", "Scopes", 300));
|
||||
|
||||
|
||||
//Optional
|
||||
// Optional
|
||||
modelColumns.add(new ColumnConfig("ID", "ID", 100));
|
||||
modelColumns.add(new ColumnConfig("SubType", "Category", 370));
|
||||
|
||||
|
@ -557,8 +566,6 @@ public class ResourceDetailModel {
|
|||
|
||||
XML_MAPPING.put(ResourceTypeDecorator.RuntimeResource.name(), type);
|
||||
|
||||
|
||||
|
||||
/*********************************************
|
||||
* WSResources
|
||||
********************************************/
|
||||
|
@ -568,7 +575,7 @@ public class ResourceDetailModel {
|
|||
modelColumns.add(new ColumnConfig("ServiceName", "Service Name", 170));
|
||||
modelColumns.add(new ColumnConfig("Termination", "Termination Time", 270));
|
||||
modelColumns.add(new ColumnConfig("LastUpdate", "Last Update", 270));
|
||||
//Optional
|
||||
// Optional
|
||||
modelColumns.add(new ColumnConfig("ID", "ID", 220));
|
||||
modelColumns.add(new ColumnConfig("Source", "Source", 230));
|
||||
modelColumns.add(new ColumnConfig("ServiceClass", "Service Class", 170));
|
||||
|
@ -601,7 +608,6 @@ public class ResourceDetailModel {
|
|||
type.addField("Type");
|
||||
XML_MAPPING.put(ResourceTypeDecorator.WSResource.name(), type);
|
||||
|
||||
|
||||
/*********************************************
|
||||
* PROFILES OF RELATED RESOURCES: GHN
|
||||
********************************************/
|
||||
|
@ -612,7 +618,7 @@ public class ResourceDetailModel {
|
|||
modelColumns.add(new ColumnConfig("ServiceVersion", "Service Version", 100));
|
||||
modelColumns.add(new ColumnConfig("MainVersion", "Main Version", 100));
|
||||
modelColumns.add(new ColumnConfig("Status", "Status", 65));
|
||||
//Optional
|
||||
// Optional
|
||||
modelColumns.add(new ColumnConfig("ID", "ID", 220));
|
||||
|
||||
// create the column model
|
||||
|
@ -634,7 +640,6 @@ public class ResourceDetailModel {
|
|||
type.addField("Status");
|
||||
XML_MAPPING.put(ResourceTypeDecorator.GHNRelated.name(), type);
|
||||
|
||||
|
||||
/*********************************************
|
||||
* PROFILES OF RELATED RESOURCES: RunningInstance
|
||||
********************************************/
|
||||
|
@ -654,8 +659,7 @@ public class ResourceDetailModel {
|
|||
type.addField("Value");
|
||||
XML_MAPPING.put(ResourceTypeDecorator.RunningInstanceRelated.name(), type);
|
||||
|
||||
|
||||
//NEW REGISTRY
|
||||
// NEW REGISTRY
|
||||
/*********************************************
|
||||
* PROFILES OF RELATED RESOURCES: EService
|
||||
********************************************/
|
||||
|
@ -674,8 +678,7 @@ public class ResourceDetailModel {
|
|||
type.addField("Key");
|
||||
type.addField("Value");
|
||||
XML_MAPPING.put(ResourceTypeDecorator.EService.name(), type);
|
||||
|
||||
|
||||
|
||||
|
||||
/*********************************************
|
||||
* PROFILES OF RELATED RESOURCES: Service
|
||||
|
@ -745,14 +748,12 @@ public class ResourceDetailModel {
|
|||
modelColumns.add(new ColumnConfig("IPAddress", "IPAddress", 100));
|
||||
modelColumns.add(new ColumnConfig("Scopes", "Scopes", 100));
|
||||
|
||||
|
||||
// create the column model
|
||||
cm = new ColumnModel(modelColumns);
|
||||
for (int i = 5; i < modelColumns.size(); i++) {
|
||||
cm.setHidden(i, true);
|
||||
}
|
||||
|
||||
|
||||
RECORD_DEFINITION.put(ResourceTypeDecorator.Sweeper_GHN.name(), cm);
|
||||
// defines the xml structure
|
||||
type = new ModelType();
|
||||
|
@ -773,7 +774,6 @@ public class ResourceDetailModel {
|
|||
type.addField("UpdateMinutesElapsed");
|
||||
XML_MAPPING.put(ResourceTypeDecorator.Sweeper_GHN.name(), type);
|
||||
|
||||
|
||||
/*********************************************
|
||||
* MODEL FOR SWEEPER RI
|
||||
********************************************/
|
||||
|
@ -790,7 +790,6 @@ public class ResourceDetailModel {
|
|||
modelColumns.add(new ColumnConfig("ServiceStatus", "Status", 90));
|
||||
modelColumns.add(new ColumnConfig("ActivationTime", "Activation Time", 140));
|
||||
|
||||
|
||||
// create the column model
|
||||
cm = new ColumnModel(modelColumns);
|
||||
for (int i = 4; i < modelColumns.size(); i++) {
|
||||
|
@ -812,6 +811,9 @@ public class ResourceDetailModel {
|
|||
XML_MAPPING.put(ResourceTypeDecorator.Sweeper_RI.name(), type);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*********************************************
|
||||
* VALIDATORS
|
||||
|
@ -822,88 +824,26 @@ public class ResourceDetailModel {
|
|||
|
||||
REQUIRED_FIELDS = new HashMap<String, String[]>();
|
||||
|
||||
REQUIRED_FIELDS.put(
|
||||
ResourceTypeDecorator.GHN.name(),
|
||||
new String[] {
|
||||
"Name",
|
||||
"SubType",
|
||||
"ID",
|
||||
"Scopes"
|
||||
});
|
||||
REQUIRED_FIELDS.put(
|
||||
ResourceTypeDecorator.Collection.name(),
|
||||
new String[] {
|
||||
"Name",
|
||||
"SubType",
|
||||
"ID",
|
||||
"Scopes"
|
||||
});
|
||||
REQUIRED_FIELDS.put(
|
||||
ResourceTypeDecorator.GenericResource.name(),
|
||||
new String[] {
|
||||
"Name",
|
||||
"SubType",
|
||||
"ID",
|
||||
"Scopes"
|
||||
});
|
||||
REQUIRED_FIELDS.put(
|
||||
ResourceTypeDecorator.RuntimeResource.name(),
|
||||
new String[] {
|
||||
"Name",
|
||||
"SubType",
|
||||
"ID",
|
||||
"Host",
|
||||
"Scopes"
|
||||
});
|
||||
REQUIRED_FIELDS.put(
|
||||
ResourceTypeDecorator.VIEW.name(),
|
||||
new String[] {
|
||||
"Name",
|
||||
"SubType",
|
||||
"ID",
|
||||
"Scopes"
|
||||
});
|
||||
REQUIRED_FIELDS.put(
|
||||
ResourceTypeDecorator.RunningInstance.name(),
|
||||
new String[] {
|
||||
"ServiceClass",
|
||||
"ServiceName",
|
||||
"ID",
|
||||
"SubType",
|
||||
"Scopes",
|
||||
"GHN"
|
||||
});
|
||||
REQUIRED_FIELDS.put(
|
||||
ResourceTypeDecorator.EService.name(),
|
||||
new String[] {
|
||||
"ServiceClass",
|
||||
"ServiceName",
|
||||
"ID",
|
||||
"SubType",
|
||||
"Scopes",
|
||||
"GHN"
|
||||
});
|
||||
REQUIRED_FIELDS.put(
|
||||
ResourceTypeDecorator.Service.name(),
|
||||
new String[] {
|
||||
"ServiceClass",
|
||||
"ServiceName",
|
||||
"ID",
|
||||
"SubType",
|
||||
"Scopes"
|
||||
});
|
||||
REQUIRED_FIELDS.put(
|
||||
ResourceTypeDecorator.WSResource.name(),
|
||||
new String[] {
|
||||
"SourceKey",
|
||||
"ServiceName",
|
||||
"ID",
|
||||
"SubType",
|
||||
"Scopes"
|
||||
});
|
||||
REQUIRED_FIELDS.put(ResourceTypeDecorator.GHN.name(), new String[] { "Name", "SubType", "ID", "Scopes" });
|
||||
REQUIRED_FIELDS.put(ResourceTypeDecorator.Collection.name(),
|
||||
new String[] { "Name", "SubType", "ID", "Scopes" });
|
||||
REQUIRED_FIELDS.put(ResourceTypeDecorator.GenericResource.name(),
|
||||
new String[] { "Name", "SubType", "ID", "Scopes" });
|
||||
REQUIRED_FIELDS.put(ResourceTypeDecorator.RuntimeResource.name(),
|
||||
new String[] { "Name", "SubType", "ID", "Host", "Scopes" });
|
||||
REQUIRED_FIELDS.put(ResourceTypeDecorator.VIEW.name(), new String[] { "Name", "SubType", "ID", "Scopes" });
|
||||
REQUIRED_FIELDS.put(ResourceTypeDecorator.RunningInstance.name(),
|
||||
new String[] { "ServiceClass", "ServiceName", "ID", "SubType", "Scopes", "GHN" });
|
||||
REQUIRED_FIELDS.put(ResourceTypeDecorator.EService.name(),
|
||||
new String[] { "ServiceClass", "ServiceName", "ID", "SubType", "Scopes", "GHN" });
|
||||
REQUIRED_FIELDS.put(ResourceTypeDecorator.VirtualService.name(),
|
||||
new String[] { "ServiceClass", "ServiceName", "ID", "SubType", "Scopes" });
|
||||
REQUIRED_FIELDS.put(ResourceTypeDecorator.Service.name(),
|
||||
new String[] { "ServiceClass", "ServiceName", "ID", "SubType", "Scopes" });
|
||||
REQUIRED_FIELDS.put(ResourceTypeDecorator.WSResource.name(),
|
||||
new String[] { "SourceKey", "ServiceName", "ID", "SubType", "Scopes" });
|
||||
}
|
||||
|
||||
|
||||
public static final ColumnModel getRecordDefinition(final String nodeID) {
|
||||
init();
|
||||
return RECORD_DEFINITION.get(nodeID);
|
||||
|
|
Loading…
Reference in New Issue