Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
krosse committed Mar 7, 2011
0 parents commit 6fecac4
Show file tree
Hide file tree
Showing 31 changed files with 2,585 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .hgignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
syntax: glob
target
META-INF/MANIFEST.MF
bin
*.ctm
*.xtm
9 changes: 9 additions & 0 deletions jtm-writer/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
23 changes: 23 additions & 0 deletions jtm-writer/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>jtm-writer</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<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.eclipse.jdt.core.javanature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>
3 changes: 3 additions & 0 deletions jtm-writer/.settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#Mon Mar 07 11:53:57 CET 2011
eclipse.preferences.version=1
encoding/<project>=UTF-8
274 changes: 274 additions & 0 deletions jtm-writer/.settings/org.eclipse.jdt.core.prefs

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions jtm-writer/.settings/org.eclipse.jdt.ui.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#Mon Mar 07 10:41:43 CET 2011
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Eclipse
formatter_settings_version=11
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
sp_cleanup.add_missing_deprecated_annotations=true
sp_cleanup.add_missing_methods=false
sp_cleanup.add_missing_nls_tags=false
sp_cleanup.add_missing_override_annotations=true
sp_cleanup.add_missing_override_annotations_interface_methods=true
sp_cleanup.add_serial_version_id=false
sp_cleanup.always_use_blocks=true
sp_cleanup.always_use_parentheses_in_expressions=false
sp_cleanup.always_use_this_for_non_static_field_access=false
sp_cleanup.always_use_this_for_non_static_method_access=false
sp_cleanup.convert_to_enhanced_for_loop=true
sp_cleanup.correct_indentation=false
sp_cleanup.format_source_code=true
sp_cleanup.format_source_code_changes_only=false
sp_cleanup.make_local_variable_final=false
sp_cleanup.make_parameters_final=false
sp_cleanup.make_private_fields_final=true
sp_cleanup.make_type_abstract_if_missing_method=false
sp_cleanup.make_variable_declarations_final=true
sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=true
sp_cleanup.on_save_use_additional_actions=true
sp_cleanup.organize_imports=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
sp_cleanup.remove_trailing_whitespaces=true
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
sp_cleanup.remove_unnecessary_casts=true
sp_cleanup.remove_unnecessary_nls_tags=false
sp_cleanup.remove_unused_imports=true
sp_cleanup.remove_unused_local_variables=false
sp_cleanup.remove_unused_private_fields=true
sp_cleanup.remove_unused_private_members=false
sp_cleanup.remove_unused_private_methods=true
sp_cleanup.remove_unused_private_types=true
sp_cleanup.sort_members=false
sp_cleanup.sort_members_all=false
sp_cleanup.use_blocks=true
sp_cleanup.use_blocks_only_for_return_and_throw=false
sp_cleanup.use_parentheses_in_expressions=false
sp_cleanup.use_this_for_non_static_field_access=false
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
sp_cleanup.use_this_for_non_static_method_access=false
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
8 changes: 8 additions & 0 deletions jtm-writer/.settings/org.maven.ide.eclipse.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#Thu Jan 13 14:26:06 CET 2011
activeProfiles=
eclipse.preferences.version=1
fullBuildGoals=process-test-resources
resolveWorkspaceProjects=true
resourceFilterGoals=process-resources resources\:testResources
skipCompilerPlugin=true
version=1
180 changes: 180 additions & 0 deletions jtm-writer/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>de.topicmapslab</groupId>
<artifactId>jtm-writer</artifactId>
<version>1.0.0</version>
<name>JTMWriter</name>

<properties>
<osgi.version>1.0.0.${maven.build.timestamp}</osgi.version>
<maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>1.0-beta-2</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<archive>
<manifestFile>META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<version>2.2.0</version>
<!-- configure plugin to generate MANIFEST.MF -->
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- configure plugin to support jar packaging -->
<supportedProjectTypes>
<supportedProjectType>jar</supportedProjectType>
</supportedProjectTypes>
<manifestLocation>META-INF</manifestLocation>
<instructions>
<Bundle-Version>${osgi.version}</Bundle-Version>
<Export-Package>de.topicmapslab.jtm.writer.*
</Export-Package>
<Import-Package>
org.codehaus.jackson;version="[1.6.1,2)",
org.codehaus.jackson.map;version="[1.6.1,2)",
org.codehaus.jackson.map.annotate;version="[1.6.1,2)",
org.tmapi.core;version="[2.0.3,3)"
</Import-Package>
<Bundle-SymbolicName>de.topicmapslab.jtm.writer</Bundle-SymbolicName>
<Bundle-Name>JTM Writer</Bundle-Name>
<Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
<Bundle-RequiredExecutionEnvironment>JavaSE-1.6</Bundle-RequiredExecutionEnvironment>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>topicmapslab-public</id>
<name>Topic Maps Lab Repositiory</name>
<url>scp://atlantis.tm.informatik.uni-leipzig.de/disk/localhome/maven/webdir/maven.topicmapslab.de/public/public</url>
</repository>
</distributionManagement>
<repositories>
<repository>
<id>tmapi</id>
<url>http://www.tmapi.org/maven-repository</url>
</repository>
<repository>
<id>tmapi-snapshots</id>
<url>http://www.tmapi.org/maven-repository/snapshots</url>
</repository>
<repository>
<id>tmapix</id>
<url>http://repository.semagia.com/snapshots/</url>
</repository>
<repository>
<id>tmapix releases</id>
<url>http://repository.semagia.com/releases/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.tmapi</groupId>
<artifactId>tmapi</artifactId>
<version>2.0.3-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.6.1</version>
</dependency>

<!-- For testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>


<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.6.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.tmapix</groupId>
<artifactId>tmapix-io</artifactId>
<version>1.0.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>slf4j-jdk14</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<groupId>org.tmapi</groupId>
<artifactId>tmapi</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>de.topicmapslab.majortom</groupId>
<artifactId>majortom-inMemory</artifactId>
<version>1.2.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package de.topicmapslab.jtm.writer;

import java.io.IOException;

import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.map.SerializerProvider;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.tmapi.core.Association;

/**
* Class to convert an association to JTM
*
* Author: mhoyer Created: 28.10.2010 01:04
*/
public class AssociationSerializer extends ConstructSerializer<Association> {

/**
* Jackson Mapper
*/
@JsonSerialize(using = AssociationSerializer.class)
public class AssociationMixIn {
// VOID
}

/**
* {@inheritDoc}
*/
@Override
public void serialize(Association value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
if (value.getRoles().size() == 0) {
throw new JsonGenerationException("JTM 1.0 and 1.1 does not support associations without a role.");
}

writeStart(jgen);
{
writeId(jgen, value.getId());
writeType(jgen, value);
writeScope(jgen, value);
writeList(jgen, value.getRoles(), IJTMConstants.ROLES);
writeReifier(jgen, value);
writeLocators(jgen, value.getItemIdentifiers(), IJTMConstants.ITEM_IDENTIFIERS);
}
jgen.writeEndObject();
}
}
Loading

0 comments on commit 6fecac4

Please sign in to comment.