();
+
+ 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",
+ "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.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);
+ }
+
+ public static final ModelType getXMLMapping(final String nodeID) {
+ init();
+ return XML_MAPPING.get(nodeID);
+ }
+
+ public static final String[] getRequiredFields(final String type) {
+ init();
+ return REQUIRED_FIELDS.get(type);
+ }
+}
diff --git a/src/main/java/org/gcube/resourcemanagement/support/shared/util/Assertion.java b/src/main/java/org/gcube/resourcemanagement/support/shared/util/Assertion.java
new file mode 100644
index 0000000..5410c00
--- /dev/null
+++ b/src/main/java/org/gcube/resourcemanagement/support/shared/util/Assertion.java
@@ -0,0 +1,66 @@
+/****************************************************************************
+ * 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: Assertion.java
+ ****************************************************************************
+ * @author Daniele Strollo
+ ***************************************************************************/
+
+package org.gcube.resourcemanagement.support.shared.util;
+
+import java.io.Serializable;
+
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+/**
+ * General purpose assertion handler.
+ * Assertion can be generalized to check a boolean expression and
+ * to raise an exception in correspondence to a failure happening
+ * during checking.
+ *
+ * Example:
+ *
+ * Assertion<TheExceptionType> assertion = new Assertion<ParamException> ();
+ * assertion.validate (param != null, new TheExceptionType("invalid parameter null"));
+ *
+ * or, in a more compact form:
+ * // The exception to throw in case of failure
+ * // during the evaluation of the expected condition
+ * new Assertion<TheExceptionType>().validate(
+ * i>5, // The expected boolean condition
+ * new TheExceptionType("Parameter must be greater than 5")); //The error message
+ *
+ *
+ *
+ * @author Daniele Strollo (ISTI-CNR)
+ */
+public class Assertion implements Serializable, IsSerializable {
+ private static final long serialVersionUID = -2007903339251667541L;
+
+ /**
+ * Makes an assertion and if the expression evaluation fails, throws an
+ * exception of type T.
+ *
+ * Example:
+ * new Assertion<MyException>().validate(whatExpected, new MyException("guard failed"));
+ *
+ * @param assertion the boolean expression to evaluate
+ * @param exc the exception to throw if the condition does not hold
+ * @throws T the exception extending {@link java.lang.Throwable}
+ */
+ public final void validate(final boolean assertion, final T exc)
+ throws T {
+ if (!assertion) {
+ throw exc;
+ }
+ }
+}
+