1
0
mirror of https://github.com/twiglet/cs2j.git synced 2025-01-18 13:15:17 +01:00

Sync from svn trunk

This commit is contained in:
Kevin Glynn 2010-06-21 16:31:42 -05:00
parent 4e9eef902d
commit 6262fde7e2
12 changed files with 266 additions and 120 deletions

View File

@ -18,6 +18,11 @@
<Name>Keys</Name>
<Get>${this}.keySet()</Get>
</Property>
<Property>
<Type>System.Collections.ICollection</Type>
<Name>Values</Name>
<Get>${this}.values()</Get>
</Property>
</Properties>
<Methods>
<Method>

View File

@ -169,5 +169,95 @@
</Imports>
<Java>(new DateTZ(${this}.getTime(), TimeZone.getTimeZone("UTC")))</Java>
</Method>
</Methods>
<Method>
<Return>System.DateTime</Return>
<Name>AddMinutes</Name>
<Params>
<Param>
<Type>System.Int32</Type>
<Name>amount</Name>
</Param>
</Params>
<Imports>
<Import>RusticiSoftware.System.DateTimeSupport</Import>
<Import>java.util.Calendar</Import>
</Imports>
<Java>DateTimeSupport.add(${this},Calendar.MINUTE,${amount})</Java>
</Method>
<Method>
<Return>System.DateTime</Return>
<Name>AddHours</Name>
<Params>
<Param>
<Type>System.Int32</Type>
<Name>amount</Name>
</Param>
</Params>
<Imports>
<Import>RusticiSoftware.System.DateTimeSupport</Import>
<Import>java.util.Calendar</Import>
</Imports>
<Java>DateTimeSupport.add(${this},Calendar.HOUR,${amount})</Java>
</Method>
<Method>
<Return>System.DateTime</Return>
<Name>AddMilliseconds</Name>
<Params>
<Param>
<Type>System.Int32</Type>
<Name>amount</Name>
</Param>
</Params>
<Imports>
<Import>RusticiSoftware.System.DateTimeSupport</Import>
<Import>java.util.Calendar</Import>
</Imports>
<Java>DateTimeSupport.add(${this},Calendar.MILLISECOND,${amount})</Java>
</Method>
<Method>
<Return>System.DateTime</Return>
<Name>AddSeconds</Name>
<Params>
<Param>
<Type>System.Int32</Type>
<Name>amount</Name>
</Param>
</Params>
<Imports>
<Import>RusticiSoftware.System.DateTimeSupport</Import>
<Import>java.util.Calendar</Import>
</Imports>
<Java>DateTimeSupport.add(${this},Calendar.SECOND,${amount})</Java>
</Method>
<Method>
<Return>System.DateTime</Return>
<Name>AddDays</Name>
<Params>
<Param>
<Type>System.Int32</Type>
<Name>amount</Name>
</Param>
</Params>
<Imports>
<Import>RusticiSoftware.System.DateTimeSupport</Import>
<Import>java.util.Calendar</Import>
</Imports>
<Java>DateTimeSupport.add(${this},Calendar.DAY_OF_YEAR,${amount})</Java>
</Method>
<Method>
<Return>System.DateTime</Return>
<Name>AddMonths</Name>
<Params>
<Param>
<Type>System.Int32</Type>
<Name>amount</Name>
</Param>
</Params>
<Imports>
<Import>RusticiSoftware.System.DateTimeSupport</Import>
<Import>java.util.Calendar</Import>
</Imports>
<Java>DateTimeSupport.add(${this},Calendar.MONTH,${amount})</Java>
</Method>
</Methods>
</Class>

View File

@ -12,5 +12,13 @@
<Type>System.String</Type>
<Get>System.getProperty("line.separator")</Get>
</Property>
<Property>
<Imports>
<Import>java.net.InetAddress</Import>
</Imports>
<Name>MachineName</Name>
<Type>System.String</Type>
<Get>InetAddress.getLocalHost().getHostName()</Get>
</Property>
</Properties>
</Class>

View File

@ -3,6 +3,10 @@
xsi:SchemaLocation="http://www.w3.org/2001/XMLSchema file://C:/Documents%20and%20Settings/kevin.glynn/My%20Documents/CS2JLibrary/Translation.xsd"
>
<Name>System.IDisposable</Name>
<Java>IDisposable</Java>
<Imports>
<Import>RusticiSoftware.System.IDisposable</Import>
</Imports>
<Methods>
<Method>
<Return>System.Void</Return>

View File

@ -61,7 +61,10 @@
<Type>System.String</Type>
</Param>
</Params>
<Java>StringSupport.Compare(${arg1}, ${arg2))</Java>
<Java>StringSupport.Compare(${arg1}, ${arg2})</Java>
<Imports>
<Import>RusticiSoftware.System.StringSupport</Import>
</Imports>
</Method>
<Method>
<Return>System.Int32</Return>
@ -80,7 +83,10 @@
<Type>System.Bool</Type>
</Param>
</Params>
<Java>StringSupport.Compare(${arg1}, ${arg2), ${isCaseSensitive})</Java>
<Java>StringSupport.Compare(${arg1}, ${arg2}, ${isCaseSensitive})</Java>
<Imports>
<Import>RusticiSoftware.System.StringSupport</Import>
</Imports>
</Method>
<Method>
<Return>System.String</Return>

View File

@ -8,6 +8,11 @@
<Constructors>
</Constructors>
<Properties>
<Property>
<Type>System.Boolean</Type>
<Name>IsAlive</Name>
<Get>${this}.isAlive()</Get>
</Property>
</Properties>
<Methods>
<Method>
@ -21,5 +26,10 @@
</Params>
<Java>Thread.sleep(${sleepTime})</Java>
</Method>
<Method>
<Return></Return>
<Name>Start</Name>
<Java>${this}.start()</Java>
</Method>
</Methods>
</Class>

View File

@ -1,27 +1,28 @@
/*
Copyright 2007-2010 Rustici Software, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author(s):
Kevin Glynn (kevin.glynn@scorm.com)
*/
/*
Copyright 2007-2010 Rustici Software, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author(s):
Kevin Glynn (kevin.glynn@scorm.com)
*/
package RusticiSoftware.System;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
@ -125,5 +126,13 @@ public class DateTimeSupport {
throw new ParseException("Could not parse " + s + " as a date", 0);
}
public static Date add(Date base,int field, int amount)
{
Calendar cal = Calendar.getInstance();
cal.setTime(base);
cal.add(field, amount);
return cal.getTime();
}
}

View File

@ -0,0 +1,5 @@
package RusticiSoftware.System;
public interface IDisposable {
void Dispose() throws Exception;
}

View File

@ -1,23 +1,23 @@
/*
Copyright 2007-2010 Rustici Software, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author(s):
Kevin Glynn (kevin.glynn@scorm.com)
*/
/*
Copyright 2007-2010 Rustici Software, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author(s):
Kevin Glynn (kevin.glynn@scorm.com)
*/
package RusticiSoftware.System.Xml;
import javax.xml.parsers.*;
@ -36,18 +36,21 @@ import java.io.StringReader;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import com.sun.org.apache.xerces.internal.dom.DocumentImpl;
public class XmlDocument extends XmlNode {
private static Logger logger = Logger.getLogger("com.rusticisoftware.scormcontentplayer");
public XmlDocument()
public XmlDocument() throws ParserConfigurationException
{
setNode(new DocumentImpl());
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
DOMImplementation impl = builder.getDOMImplementation();
Document doc = impl.createDocument(null,null,null);
setNode(doc);
}
public XmlDocument(Document d)
{
@ -79,12 +82,12 @@ public class XmlDocument extends XmlNode {
DocumentBuilder builder = factory.newDocumentBuilder();
setNode(builder.parse(r));
}
// overload for translation from .net, which treats load() as namespace aware
public void load(InputStream r) throws ParserConfigurationException, SAXException, IOException
{
load(r,true);
}
public void load(InputStream r) throws ParserConfigurationException, SAXException, IOException
{
load(r,true);
}
public void loadXml(String content) throws ParserConfigurationException, SAXException, IOException
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

View File

@ -1,23 +1,23 @@
/*
Copyright 2007-2010 Rustici Software, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author(s):
Kevin Glynn (kevin.glynn@scorm.com)
*/
/*
Copyright 2007-2010 Rustici Software, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author(s):
Kevin Glynn (kevin.glynn@scorm.com)
*/
package RusticiSoftware.System.Xml;
import java.io.IOException;
@ -28,8 +28,6 @@ import org.w3c.dom.*;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import com.sun.org.apache.xalan.internal.xsltc.runtime.AttributeList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

View File

@ -1,23 +1,23 @@
/*
Copyright 2007-2010 Rustici Software, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author(s):
Kevin Glynn (kevin.glynn@scorm.com)
*/
/*
Copyright 2007-2010 Rustici Software, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author(s):
Kevin Glynn (kevin.glynn@scorm.com)
*/
package RusticiSoftware.System.Xml;
import java.io.IOException;
@ -31,17 +31,23 @@ import RusticiSoftware.System.Xml.XmlDocument;
import RusticiSoftware.System.NotImplementedException;
public class XmlTextReader {
protected XmlDocument xmlDocument = new XmlDocument();
protected XmlDocument xmlDocument = null;
protected XmlDocument getXmlDocument() throws ParserConfigurationException {
if (xmlDocument == null) {
xmlDocument = new XmlDocument();
}
return xmlDocument;
}
public XmlTextReader() throws NotImplementedException {
throw new NotImplementedException();
}
public XmlTextReader(StringReader stringReader) throws NotImplementedException, ParserConfigurationException, SAXException, IOException {
xmlDocument.load(stringReader);
getXmlDocument().load(stringReader);
}
public String ToString() {
return xmlDocument.getOuterXml();
public String ToString() throws ParserConfigurationException {
return getXmlDocument().getOuterXml();
}
}

View File

@ -1,29 +1,31 @@
/*
Copyright 2007-2010 Rustici Software, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author(s):
Kevin Glynn (kevin.glynn@scorm.com)
*/
/*
Copyright 2007-2010 Rustici Software, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author(s):
Kevin Glynn (kevin.glynn@scorm.com)
*/
package RusticiSoftware.System.Xml.Xsl;
//
// This is now a wrapper for XslCompiledTransform because that has superseded XslTransform going to .Net 2.0
import java.io.StringWriter;
import java.io.StringReader;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.Transformer;
@ -40,7 +42,7 @@ public class XslTransform {
}
public void load(XmlTextReader xmlTextReader, String ignore, String ignore2) throws TransformerConfigurationException {
public void load(XmlTextReader xmlTextReader, String ignore, String ignore2) throws TransformerConfigurationException, ParserConfigurationException {
String xmlString = xmlTextReader.ToString();
StringReader stringReader = new StringReader(xmlString);
StreamSource streamSource = new StreamSource(stringReader);