summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorabranson <andrew.branson@cern.ch>2011-09-28 14:19:34 +0200
committerabranson <andrew.branson@cern.ch>2011-09-28 14:19:34 +0200
commit38d30cd4f69178cef983ec13262a6f02826a9a45 (patch)
treea76ee954e3b420b4ae63ec5be4c6120427207ef3
parent385ba566319734f37a3970822ea88a3622ad3970 (diff)
Schema and resource
-rw-r--r--.classpath4
-rw-r--r--[-rwxr-xr-x]changelog1
-rw-r--r--resources/boot/OD/CristalModule.xsd149
-rw-r--r--source/com/c2kernel/utils/Resource.java39
4 files changed, 161 insertions, 32 deletions
diff --git a/.classpath b/.classpath
index 79ed770..86010e1 100644
--- a/.classpath
+++ b/.classpath
@@ -7,13 +7,13 @@
<classpathentry kind="lib" path="lib/xml-apis.jar"/>
<classpathentry kind="lib" path="lib/wrapper.jar"/>
<classpathentry kind="lib" path="lib/bsf.jar"/>
- <classpathentry kind="lib" path="lib/dom4j.jar"/>
<classpathentry kind="lib" path="lib/ldap.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/castor-1.3.2-core.jar"/>
<classpathentry kind="lib" path="lib/castor-1.3.2-xml-schema.jar"/>
<classpathentry kind="lib" path="lib/castor-1.3.2-xml.jar"/>
<classpathentry kind="lib" path="lib/commons-lang-2.6.jar"/>
<classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
+ <classpathentry kind="lib" path="lib/dom4j.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
diff --git a/changelog b/changelog
index 0fcaa3f..9bdb497 100755..100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,4 @@
+Build 6 - Module support
Build 5 - Java 1.6 Compliance
Build 4 - First GIT commit
- WF: Added 'AlwaysUseOutcome' activity property to require an outcome for every state change
diff --git a/resources/boot/OD/CristalModule.xsd b/resources/boot/OD/CristalModule.xsd
new file mode 100644
index 0000000..348ab8b
--- /dev/null
+++ b/resources/boot/OD/CristalModule.xsd
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- edited with XMLSpy v2007 rel. 3 (http://www.altova.com) by Andrew Branson (CERN) -->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
+ <xs:element name="CristalModule">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Info">
+ <xs:annotation>
+ <xs:documentation>Module Metadata</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Description" type="xs:string"/>
+ <xs:element name="Version" type="xs:string"/>
+ <xs:element name="Dependency" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="ResourceURL" type="xs:string" minOccurs="0"/>
+ <xs:element name="Config" minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>Configuration parameters to add to the Cristal VM on launch. May target either client or server processes.</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute ref="target"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Script" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute ref="event"/>
+ <xs:attribute ref="target"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Imports" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Items to import into or verify within the Cristal server upon launch.</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:choice maxOccurs="unbounded">
+ <xs:element name="Activity" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="CompositeActivity" minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>A composite activity outcome. </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Schema" minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>Elementary activities</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Script" minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>Elementary activities</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Item" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Outcome" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="Schema" type="xs:string" use="required"/>
+ <xs:attribute name="Version" type="xs:string" use="required"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Agent" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Role" type="xs:string" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="passwordHash" type="xs:string" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:choice>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="ns" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation>Prefix for module components</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:attribute name="target">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="client"/>
+ <xs:enumeration value="server"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="event">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="startup"/>
+ <xs:enumeration value="shutdown"/>
+ <xs:enumeration value="uninstall"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+</xs:schema>
diff --git a/source/com/c2kernel/utils/Resource.java b/source/com/c2kernel/utils/Resource.java
index 361549d..ba2f71a 100644
--- a/source/com/c2kernel/utils/Resource.java
+++ b/source/com/c2kernel/utils/Resource.java
@@ -3,6 +3,7 @@ package com.c2kernel.utils;
//Java
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.ArrayList;
import java.util.Hashtable;
import javax.swing.ImageIcon;
@@ -17,13 +18,9 @@ import com.c2kernel.common.ObjectNotFoundException;
public class Resource {
static private Hashtable<String, String> txtCache = new Hashtable<String, String>();
static private Hashtable<String, ImageIcon> imgCache = new Hashtable<String, ImageIcon>();
- static private URL baseURL = null;
- static private URL domainBaseURL = null;
- static private URL importURL = null;
+ static private URL baseURL = getURLorResURL("com/c2kernel/utils/resources/");
+ static private ArrayList<URL> domainBaseURL = new ArrayList<URL>();
static public ImageIcon nullImg = new ImageIcon(new byte[] { 0 });
- static {
- setKernelBaseURL("com/c2kernel/utils/resources/");
- }
/*
* Kernel Resource URL section
@@ -32,10 +29,6 @@ public class Resource {
baseURL = getURLorResURL(newBaseURL);
}
- public static void setKernelBaseURL(URL newBaseURL) {
- baseURL = newBaseURL;
- }
-
public static URL getKernelBaseURL() {
return baseURL;
}
@@ -43,19 +36,20 @@ public class Resource {
static public URL getKernelResourceURL(String resName) throws MalformedURLException {
return new URL(baseURL, resName);
}
+
/*
* Domain Resource URL section
*/
- public static void setDomainBaseURL(URL newBaseURL) {
- domainBaseURL = newBaseURL;
+ public static void addDomainBaseURL(URL newBaseURL) {
+ domainBaseURL.add(newBaseURL);
}
- public static void setDomainBaseURL(String newBaseURL) {
- domainBaseURL = getURLorResURL(newBaseURL);
+ public static void addDomainBaseURL(String newBaseURL) {
+ addDomainBaseURL(getURLorResURL(newBaseURL));
}
- public static URL getDomainBaseURL() {
+ public static ArrayList<URL> getDomainBaseURL() {
return domainBaseURL;
}
@@ -153,21 +147,6 @@ public class Resource {
return newImg;
}
-
- /**
- * Retrieves the stored import URL
- * @return
- */
- public static URL getImportURL() {
- return importURL;
- }
-
- /**
- * @param url
- */
- public static void setImportURL(URL url) {
- importURL = url;
- }
static public String getDomainVersion() {
try {
return FileStringUtility.url2String(getDomainResourceURL("version.txt"));