Skip to content

Commit

Permalink
Added Lotus Charset property
Browse files Browse the repository at this point in the history
  • Loading branch information
benfortuna committed Nov 17, 2009
0 parents commit 20ccc7d
Show file tree
Hide file tree
Showing 10 changed files with 338 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .classpath
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="src" path="src/main/groovy"/>
<classpathentry kind="src" path="src/test/groovy"/>
<classpathentry kind="src" path="src/test/resources"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
1 change: 1 addition & 0 deletions .cvsignore
@@ -0,0 +1 @@
target
29 changes: 29 additions & 0 deletions .project
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ical4j-extensions</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.codehaus.groovy.eclipse.groovyBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.codehaus.groovy.eclipse.groovyNature</nature>
</natures>
</projectDescription>
3 changes: 3 additions & 0 deletions .settings/org.codehaus.groovy.eclipse.preferences.prefs
@@ -0,0 +1,3 @@
#Mon Nov 16 23:43:56 EST 2009
eclipse.preferences.version=1
groovy.compiler.output.path=bin-groovy
6 changes: 6 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,6 @@
#Mon Nov 16 23:43:57 EST 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,*.groovy
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.source=1.5
9 changes: 9 additions & 0 deletions .settings/org.maven.ide.eclipse.prefs
@@ -0,0 +1,9 @@
#Mon Nov 16 18:14:58 EST 2009
activeProfiles=
eclipse.preferences.version=1
fullBuildGoals=process-test-resources
includeModules=false
resolveWorkspaceProjects=true
resourceFilterGoals=process-resources resources\:testResources
skipCompilerPlugin=true
version=1
136 changes: 136 additions & 0 deletions pom.xml
@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>modularity-parent</artifactId>
<groupId>net.modularity</groupId>
<version>1.0.8-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>net.fortuna.ical4j</groupId>
<artifactId>ical4j-extensions</artifactId>
<packaging>bundle</packaging>
<name>iCal4j Extensions</name>
<version>0.9-SNAPSHOT</version>
<description>Support for additional non-standard iCalendar objects</description>
<url>http://ical4j.sourceforge.net</url>
<issueManagement>
<system>SourceForge.net</system>
<url>https://sourceforge.net/tracker/?group_id=107024</url>
</issueManagement>
<inceptionYear>2009</inceptionYear>

<licenses>
<license>
<name>iCal4j - License</name>
<url>LICENSE</url>
</license>
</licenses>

<scm>
<connection>scm:cvs:pserver:anonymous:@ical4j.cvs.sourceforge.net:/cvsroot/ical4j:ical4j-extensions</connection>
<developerConnection>scm:cvs:ext:fortuna@ical4j.cvs.sourceforge.net:/cvsroot/ical4j:ical4j-extensions</developerConnection>
<url>http://ical4j.cvs.sourceforge.net/ical4j/ical4j-extensions</url>
</scm>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>net.fortuna.ical4j.vcard.*</Export-Package>
<Import-Package>net.fortuna.ical4j.*,org.apache.commons.lang.*,org.apache.commons.logging,*;resolution:=optional</Import-Package>
</instructions>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clover-plugin</artifactId>
<configuration>
<jdk>1.5</jdk>
</configuration>
<!--
<executions>
<execution>
<phase>pre-site</phase>
<goals>
<goal>instrument</goal>
</goals>
</execution>
</executions>
-->
</plugin>

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/bin.xml</descriptor>
<descriptor>src/main/assembly/src.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>site-deploy</phase>
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>net.fortuna.ical4j</groupId>
<artifactId>ical4j</artifactId>
<version>1.0-rc3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<!-- -->
<!-- -->
</dependencies>

<repositories>
</repositories>

<reporting>
<plugins>

<!-- Override default suppressions.. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>http://svn.mnode.org/tools/checkstyle/mnode_checks.xml</configLocation>
<suppressionsFile>etc/checkstyle-suppressions.xml</suppressionsFile>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
@@ -0,0 +1,84 @@
package net.fortuna.ical4j.extensions.property;

import net.fortuna.ical4j.model.ParameterList;
import net.fortuna.ical4j.model.Property;
import net.fortuna.ical4j.model.PropertyFactory;
import net.fortuna.ical4j.model.ValidationException;

/**
* @author fortuna
*
*/
public class LotusCharset extends Property {

private static final long serialVersionUID = -3514682572599864426L;

private static final String NAME = "X-LOTUS-CHARSET";

public static final PropertyFactory FACTORY = new Factory();

public static final LotusCharset UTF8 = new LotusCharset(new ParameterList(true), FACTORY, "UTF-8");

private String value;

/**
* @param factory
*/
public LotusCharset(PropertyFactory factory) {
super(NAME, factory);
}

/**
* @param aList
* @param factory
*/
public LotusCharset(ParameterList aList, PropertyFactory factory, String value) {
super(NAME, aList, factory);
setValue(value);
}

/**
* {@inheritDoc}
*/
@Override
public void setValue(String aValue) {
this.value = aValue;
}

/**
* {@inheritDoc}
*/
@Override
public void validate() throws ValidationException {
// TODO Auto-generated method stub

}

/**
* {@inheritDoc}
*/
@Override
public String getValue() {
return value;
}

private static class Factory implements PropertyFactory {

private static final long serialVersionUID = 596282786680252116L;

public Property createProperty(String name) {
return new LotusCharset(this);
}

public Property createProperty(String name, ParameterList parameters, String value) {
LotusCharset property = null;
if (UTF8.getValue().equals(value)) {
property = UTF8;
}
else {
property = new LotusCharset(parameters, this, value);
}
return property;
}
}
}
@@ -0,0 +1,16 @@
package net.fortuna.ical4j.extensions.property



/**
* @author fortuna
*
*/
public class LotusCharsetTest extends GroovyTestCase {

void testFactory() {
def prop = LotusCharset.FACTORY.createProperty(null, null, "UTF-8")
assert prop.value == LotusCharset.UTF8
}

}
@@ -0,0 +1,42 @@
/**
* This file is part of Base Modules.
*
* Copyright (c) 2009, Ben Fortuna [fortuna@micronode.com]
*
* Base Modules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Base Modules is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Base Modules. If not, see <http://www.gnu.org/licenses/>.
*/

package net.fortuna.ical4j.extensions.property;

import java.io.IOException;
import java.net.URISyntaxException;
import java.text.ParseException;

import junit.framework.Assert;

import org.junit.Test;


/**
* @author fortuna
*
*/
public class LotusCharsetTest {

@Test
public void testFactoryUTF8() throws IOException, URISyntaxException, ParseException {
LotusCharset property = (LotusCharset) LotusCharset.FACTORY.createProperty(null, null, "UTF-8");
Assert.assertEquals(LotusCharset.UTF8, property);
}
}

0 comments on commit 20ccc7d

Please sign in to comment.