mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
take updates from ScormEngine codebase
This commit is contained in:
parent
e107488078
commit
ea9e609506
@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<faceted-project>
|
|
||||||
<runtime name="JVM 1.6.0 (MacOS X Default)"/>
|
|
||||||
</faceted-project>
|
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
This file is
|
This file is
|
||||||
@ -117,6 +117,14 @@
|
|||||||
<Name>RemoveAt</Name>
|
<Name>RemoveAt</Name>
|
||||||
<Return>System.Void</Return>
|
<Return>System.Void</Return>
|
||||||
</Method>
|
</Method>
|
||||||
|
<Method>
|
||||||
|
<Imports />
|
||||||
|
<Java>${this:16}.reverse()</Java>
|
||||||
|
<Params>
|
||||||
|
</Params>
|
||||||
|
<Name>Reverse</Name>
|
||||||
|
<Return>System.Void</Return>
|
||||||
|
</Method>
|
||||||
<Method>
|
<Method>
|
||||||
<Imports>
|
<Imports>
|
||||||
<Import>CS2JNet.System.Collections.ArrayListSupport</Import>
|
<Import>CS2JNet.System.Collections.ArrayListSupport</Import>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
This file is
|
This file is
|
||||||
@ -244,6 +244,12 @@
|
|||||||
</Method>
|
</Method>
|
||||||
</Methods>
|
</Methods>
|
||||||
<Properties>
|
<Properties>
|
||||||
|
<Property>
|
||||||
|
<Java>Calendar.getInstance().getTime()</Java>
|
||||||
|
<Type>System.DateTime</Type>
|
||||||
|
<Name>MinDate</Name>
|
||||||
|
<Get>new Date(Long.MIN_VALUE)</Get>
|
||||||
|
</Property>
|
||||||
<Property>
|
<Property>
|
||||||
<Imports>
|
<Imports>
|
||||||
<Import>java.util.Calendar</Import>
|
<Import>java.util.Calendar</Import>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
This file is
|
This file is
|
||||||
@ -18,7 +18,13 @@
|
|||||||
<Type>System.Object</Type>
|
<Type>System.Object</Type>
|
||||||
</Inherits>
|
</Inherits>
|
||||||
<Methods />
|
<Methods />
|
||||||
<Properties />
|
<Properties>
|
||||||
|
<Property>
|
||||||
|
<Type>System.String</Type>
|
||||||
|
<Name>HttpMethod</Name>
|
||||||
|
<Get>${this:16}.getMethod()</Get>
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
<Events />
|
<Events />
|
||||||
<Indexers />
|
<Indexers />
|
||||||
<Constructors />
|
<Constructors />
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
This file is
|
This file is
|
||||||
@ -17,7 +17,23 @@
|
|||||||
<Inherits>
|
<Inherits>
|
||||||
<Type>System.Object</Type>
|
<Type>System.Object</Type>
|
||||||
</Inherits>
|
</Inherits>
|
||||||
<Methods />
|
<Methods>
|
||||||
|
<Method>
|
||||||
|
<Return>System.Void</Return>
|
||||||
|
<Name>AddHeader</Name>
|
||||||
|
<Params>
|
||||||
|
<Param>
|
||||||
|
<Type>System.String</Type>
|
||||||
|
<Name>name</Name>
|
||||||
|
</Param>
|
||||||
|
<Param>
|
||||||
|
<Type>System.String</Type>
|
||||||
|
<Name>value</Name>
|
||||||
|
</Param>
|
||||||
|
</Params>
|
||||||
|
<Java>${this:16}.setHeader(${name},${value})</Java>
|
||||||
|
</Method>
|
||||||
|
</Methods>
|
||||||
<Properties />
|
<Properties />
|
||||||
<Events />
|
<Events />
|
||||||
<Indexers />
|
<Indexers />
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
This file is
|
This file is
|
||||||
@ -14,7 +14,9 @@
|
|||||||
<Java>XmlAttributeCollection</Java>
|
<Java>XmlAttributeCollection</Java>
|
||||||
<Name>System.Xml.XmlAttributeCollection</Name>
|
<Name>System.Xml.XmlAttributeCollection</Name>
|
||||||
<Uses />
|
<Uses />
|
||||||
<Inherits> <Type>System.Object</Type> </Inherits>
|
<Inherits>
|
||||||
|
<Type>System.Object</Type>
|
||||||
|
</Inherits>
|
||||||
<Methods>
|
<Methods>
|
||||||
<Method>
|
<Method>
|
||||||
<Imports />
|
<Imports />
|
||||||
|
@ -1,110 +1,115 @@
|
|||||||
<project name="cs2jsupport" default="package" basedir=".">
|
<project name="cs2jsupport" default="package" basedir=".">
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
This build file builds and packages the CS2J Support
|
This build file builds and packages the CS2J Support
|
||||||
library into a jar file.
|
library into a jar file.
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<property file="${user.home}/${ant.project.name}.build.properties" />
|
<property file="${user.home}/${ant.project.name}.build.properties" />
|
||||||
<property file="${user.home}/build.properties" />
|
<property file="${user.home}/build.properties" />
|
||||||
<property file="build.properties" />
|
<property file="build.properties" />
|
||||||
|
|
||||||
<tstamp>
|
|
||||||
<format property="timestamp.isoformat" pattern="yyyy-MM-dd'T'HH:mm:ss" />
|
|
||||||
</tstamp>
|
|
||||||
|
|
||||||
<target name="revision" unless="svn.revision">
|
<tstamp>
|
||||||
<exec executable="svnversion" outputproperty="svn.revision">
|
<format property="timestamp.isoformat" pattern="yyyy-MM-dd'T'HH:mm:ss" />
|
||||||
<arg value="." />
|
</tstamp>
|
||||||
|
|
||||||
|
<target name="revision" unless="git.revision">
|
||||||
|
<exec executable="git" outputproperty="git.revision">
|
||||||
|
<arg value="rev-parse" />
|
||||||
|
<arg value="HEAD" />
|
||||||
</exec>
|
</exec>
|
||||||
<echo message="_REVISION_=${svn.revision}" />
|
<exec executable="git" outputproperty="git.branch">
|
||||||
|
<arg value="name-rev" />
|
||||||
|
<arg value="--name-only" />
|
||||||
|
<arg value="--always" />
|
||||||
|
<arg value="${git.revision}" />
|
||||||
|
</exec>
|
||||||
|
<echo message="At revision ${git.revision} on branch ${git.branch}." />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="package" depends="compile,revision">
|
<target name="package" depends="compile,revision">
|
||||||
<mkdir dir="${jar.dir}" />
|
<mkdir dir="${jar.dir}" />
|
||||||
<jar destfile="${jar.dir}/${ant.project.name}.jar" index="true">
|
<jar destfile="${jar.dir}/${ant.project.name}.jar" index="true">
|
||||||
<fileset dir="${classes.dir}/${ant.project.name}" id="jar.files">
|
<fileset dir="${classes.dir}/${ant.project.name}" id="jar.files">
|
||||||
<include name="**/*.class" />
|
<include name="**/*.class" />
|
||||||
</fileset>
|
</fileset>
|
||||||
<fileset dir="${src.dir}">
|
<fileset dir="${src.dir}">
|
||||||
<include name="**/*.xsl" />
|
<include name="**/*.xsl" />
|
||||||
</fileset>
|
</fileset>
|
||||||
<metainf dir="${basedir}">
|
<metainf dir="${basedir}">
|
||||||
<include name="LICENSE" />
|
<include name="LICENSE" />
|
||||||
<include name="NOTICE" />
|
<include name="NOTICE" />
|
||||||
</metainf>
|
</metainf>
|
||||||
<manifest>
|
<manifest>
|
||||||
<attribute name="Built-By" value="${user.name}" />
|
<attribute name="Built-By" value="${user.name}" />
|
||||||
<attribute name="Built-On" value="${timestamp.isoformat}" />
|
<attribute name="Built-On" value="${timestamp.isoformat}" />
|
||||||
</manifest>
|
<attribute name="Git-Branch" value="${git.branch}" />
|
||||||
</jar>
|
<attribute name="Git-Revision" value="${git.revision}" />
|
||||||
<!-- And copy any 3rd party jars needed by cs2j. -->
|
</manifest>
|
||||||
<copy todir="${jar.dir}">
|
</jar>
|
||||||
<fileset dir="${basedir}/lib">
|
<!-- And copy any 3rd party jars needed by cs2j. -->
|
||||||
<include name="**/*.jar" />
|
<copy todir="${jar.dir}">
|
||||||
</fileset>
|
<fileset dir="${basedir}/lib">
|
||||||
</copy>
|
<include name="**/*.jar" />
|
||||||
</target>
|
</fileset>
|
||||||
|
</copy>
|
||||||
<target name="src" description="Make a source distribution">
|
</target>
|
||||||
<mkdir dir="${zip.dir}" />
|
|
||||||
<exec executable="git" outputproperty="build.version">
|
<target name="src" description="Make a source distribution">
|
||||||
<arg line="describe"/>
|
<mkdir dir="${zip.dir}" />
|
||||||
</exec>
|
<zip destfile="${src.zip}">
|
||||||
<property name="src.zip" value="${zip.dir}/cs2jlibrary-src-${build.version}.zip"/>
|
<fileset dir="${basedir}">
|
||||||
<zip destfile="${src.zip}">
|
<include name="src/**/*" />
|
||||||
<fileset dir="${basedir}">
|
<include name="LICENSE" />
|
||||||
<include name="src/**/*" />
|
<include name="NOTICE" />
|
||||||
<include name="LICENSE" />
|
<include name="build.*" />
|
||||||
<include name="NOTICE" />
|
<include name=".project" />
|
||||||
<include name="build.*" />
|
<include name=".classpath" />
|
||||||
<include name=".project" />
|
<include name="lib/*" />
|
||||||
<include name=".classpath" />
|
</fileset>
|
||||||
<include name="lib/*" />
|
</zip>
|
||||||
</fileset>
|
</target>
|
||||||
</zip>
|
|
||||||
</target>
|
<target name="clean-package" depends="clean,package">
|
||||||
|
</target>
|
||||||
<target name="clean-package" depends="clean,package">
|
|
||||||
</target>
|
<target name="compile" depends="init">
|
||||||
|
<echo message="Compiling Source files from ${basedir}/${src.dir}" />
|
||||||
<target name="compile" depends="init">
|
<javac
|
||||||
<echo message="Compiling Source files from ${basedir}/${src.dir}" />
|
srcdir="${src.dir}/"
|
||||||
<javac
|
includes="**/*.java"
|
||||||
srcdir="${src.dir}/"
|
excludes=""
|
||||||
includes="**/*.java"
|
destdir="${classes.dir}/${ant.project.name}"
|
||||||
excludes=""
|
fork="true"
|
||||||
destdir="${classes.dir}/${ant.project.name}"
|
deprecation="false"
|
||||||
fork="true"
|
debug="true"
|
||||||
deprecation="false"
|
memoryMaximumSize="512m"
|
||||||
debug="true"
|
nowarn="true"
|
||||||
memoryMaximumSize="512m"
|
target="${java.target.vm}">
|
||||||
nowarn="true"
|
<classpath>
|
||||||
target="${java.target.vm}">
|
<fileset dir="${lib.dir}">
|
||||||
<classpath>
|
<include name="**/*.jar" />
|
||||||
<fileset dir="${lib.dir}">
|
</fileset>
|
||||||
<include name="**/*.jar" />
|
</classpath>
|
||||||
</fileset>
|
</javac>
|
||||||
</classpath>
|
</target>
|
||||||
</javac>
|
|
||||||
</target>
|
<target name="init" depends="">
|
||||||
|
<mkdir dir="${build.dir}" />
|
||||||
<target name="init" depends="">
|
<mkdir dir="${classes.dir}/${ant.project.name}" />
|
||||||
<mkdir dir="${build.dir}" />
|
</target>
|
||||||
<mkdir dir="${classes.dir}/${ant.project.name}" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="clean" depends="">
|
<target name="clean" depends="">
|
||||||
<delete failonerror="false" dir="${build.dir}" />
|
<delete failonerror="false" dir="${build.dir}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="deploy" depends="package">
|
<target name="deploy" depends="package">
|
||||||
<copy file="${jar.dir}/${ant.project.name}.jar" todir="${export.dir}" />
|
<copy file="${jar.dir}/${ant.project.name}.jar" todir="${export.dir}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="dumpProperties" description="output all set properties, a useful sanity check">
|
<target name="dumpProperties" description="output all set properties, a useful sanity check">
|
||||||
<echoproperties/>
|
<echoproperties/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -26,6 +26,7 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import CS2JNet.JavaSupport.util.LocaleSupport;
|
import CS2JNet.JavaSupport.util.LocaleSupport;
|
||||||
|
|
||||||
@ -81,11 +82,16 @@ public class DateTimeSupport {
|
|||||||
"yyyy-MM-dd"};
|
"yyyy-MM-dd"};
|
||||||
|
|
||||||
public static Date parse(String s) throws ParseException
|
public static Date parse(String s) throws ParseException
|
||||||
{
|
{
|
||||||
|
return parse(s, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Date parse(String s, boolean utc) throws ParseException
|
||||||
|
{
|
||||||
String val = trimMilliSecondsToThreeDigits(s);
|
String val = trimMilliSecondsToThreeDigits(s);
|
||||||
return parse(val, DATE_FORMATS, Locale.getDefault());
|
return parse(val, DATE_FORMATS, Locale.getDefault(), utc);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static String trimMilliSecondsToThreeDigits(String dateString){
|
protected static String trimMilliSecondsToThreeDigits(String dateString){
|
||||||
String val = dateString;
|
String val = dateString;
|
||||||
if(val != null){
|
if(val != null){
|
||||||
@ -115,12 +121,21 @@ public class DateTimeSupport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Date parse(String s, String[] formats, Locale loc) throws ParseException
|
public static Date parse(String s, String[] formats, Locale loc) throws ParseException
|
||||||
{
|
{
|
||||||
|
return parse(s, formats, loc, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Date parse(String s, String[] formats, Locale loc, boolean utc) throws ParseException
|
||||||
|
{
|
||||||
for (String f : formats)
|
for (String f : formats)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Date d = (new SimpleDateFormat(f)).parse(s);
|
SimpleDateFormat sdf = new SimpleDateFormat(f);
|
||||||
|
if(utc){
|
||||||
|
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
|
}
|
||||||
|
Date d = sdf.parse(s);
|
||||||
// System.out.println("Date: "+ d.toString());
|
// System.out.println("Date: "+ d.toString());
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ public class DirectorySupport {
|
|||||||
String[] allFilePaths = new String[allFiles.length];
|
String[] allFilePaths = new String[allFiles.length];
|
||||||
|
|
||||||
for (int i = 0; i < allFilePaths.length; i++) {
|
for (int i = 0; i < allFilePaths.length; i++) {
|
||||||
allFilePaths[i] = allFiles[i].getCanonicalPath();
|
allFilePaths[i] = allFiles[i].getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
return allFilePaths;
|
return allFilePaths;
|
||||||
@ -131,7 +131,7 @@ public class DirectorySupport {
|
|||||||
File[] matchDirs = new File(path).listFiles(DirectorySupport.dirFilter(patternComponents[0]));
|
File[] matchDirs = new File(path).listFiles(DirectorySupport.dirFilter(patternComponents[0]));
|
||||||
for (File d : matchDirs)
|
for (File d : matchDirs)
|
||||||
{
|
{
|
||||||
allMatches.addAll(Arrays.asList(getFiles(d.getCanonicalPath(),patternComponents[1])));
|
allMatches.addAll(Arrays.asList(getFiles(d.getAbsolutePath(),patternComponents[1])));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@ public class DirectorySupport {
|
|||||||
|
|
||||||
for (int i = 0; i < allFiles.length; i++)
|
for (int i = 0; i < allFiles.length; i++)
|
||||||
{
|
{
|
||||||
allMatches.add(i,((File)allFiles[i]).getCanonicalPath());
|
allMatches.add(i,((File)allFiles[i]).getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ public class DirectorySupport {
|
|||||||
String[] allDirPaths = new String[allDirs.length];
|
String[] allDirPaths = new String[allDirs.length];
|
||||||
|
|
||||||
for (int i = 0; i < allDirPaths.length; i++) {
|
for (int i = 0; i < allDirPaths.length; i++) {
|
||||||
allDirPaths[i] = allDirs[i].getCanonicalPath();
|
allDirPaths[i] = allDirs[i].getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
return allDirPaths;
|
return allDirPaths;
|
||||||
|
@ -259,8 +259,8 @@ public class XmlNode implements Iterable {
|
|||||||
{
|
{
|
||||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||||
Node dummyD = builder.parse(new InputSource(new StringReader("<DUMMY>" + value + "</DUMMY>")));
|
Document dummyDoc = builder.parse(new InputSource(new StringReader("<DUMMY>" + value + "</DUMMY>")));
|
||||||
Node importableNode = getNode().getOwnerDocument().importNode(dummyD.getFirstChild(), true);
|
Node importableNode = getNode().getOwnerDocument().importNode(dummyDoc.getDocumentElement(), true);
|
||||||
Node myNode = getNode();
|
Node myNode = getNode();
|
||||||
|
|
||||||
// First we remove all existing children
|
// First we remove all existing children
|
||||||
@ -273,7 +273,7 @@ public class XmlNode implements Iterable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now we insert the new children
|
// Now we insert the new children
|
||||||
child = importableNode.getLastChild();
|
child = importableNode.getFirstChild();
|
||||||
while (child != null)
|
while (child != null)
|
||||||
{
|
{
|
||||||
Node tmp = child;
|
Node tmp = child;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user