Skip to content

Commit 99e88eb

Browse files
authored
Merge pull request #417 from metafacture/variousFixesAndImprovements
Various fixes and improvements.
2 parents 27780be + aa21e39 commit 99e88eb

File tree

34 files changed

+187
-88
lines changed

34 files changed

+187
-88
lines changed

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,63 +4,63 @@
44

55
Metafacture is a toolkit for processing semi-structured data with a focus on library metadata. It provides a versatile set of tools for reading, writing and transforming data. Metafacture can be used as a stand-alone application or as a Java library in other applications. The name Metafacture is a portmanteau of the words *meta*data and manu*facture*.
66

7-
Metafacture includes a [large number of modules](https://github.com/metafacture/metafacture-documentation/blob/master/flux-commands.md) for operating on semi-structured data. These modules can be combined to build pipelines to perform complex metadata processing tasks. The pipelines can be constructed either in Java code or with the domain-specific language **Flux**. One of the core features of Metafacture is the **Metamorph** module. Metamorph is an xml-based language for specifying transformations of semi-structured data. It can be seamlessly integrated into Java code.
7+
Metafacture includes a [large number of modules](https://github.com/metafacture/metafacture-documentation/blob/master/flux-commands.md) for operating on semi-structured data. These modules can be combined to build pipelines to perform complex metadata processing tasks. The pipelines can be constructed either in Java code or with the domain-specific language **Flux**. One of the core features of Metafacture is the **Metamorph** module. Metamorph is an XML-based language for specifying transformations of semi-structured data. It can be seamlessly integrated into Java code.
88

99
At its heart Metafacture is a framework for implementing modules for metadata processing. This makes Metafacture easily extendable with additional modules. The [plugins and tools page](https://github.com/metafacture/metafacture-core/wiki/Plugins-and-Tools) on the wiki shows supplementary packages and projects which extend Metafacture.
1010

11-
Originally, Metafacture was developed as part of the [Culturegraph](http://culturegraph.org) platform but it is developed independently now and used by others, too: [see who uses Metafacture](https://github.com/metafacture/metafacture-core/wiki/Who-uses-Metafacture).
11+
Originally, Metafacture was developed as part of the [Culturegraph](http://www.culturegraph.org) platform but it is developed independently now and used by others, too: [see who uses Metafacture](https://github.com/metafacture/metafacture-core/wiki/Who-uses-Metafacture).
1212

1313
# Getting started
1414

1515
You can either use Metafacture as a stand-alone application or include it as a Java library in your own projects.
1616

1717
## Metafacture as a stand-alone application
1818

19-
If you are only interested in running Flux scripts without doing any Java programming this is the way to go. The instructions assume that you are using a *nix-like shell. [See more information in the wiki page about Flux](https://github.com/metafacture/metafacture-core/wiki/Flux-user-guide).
19+
If you are only interested in running Flux scripts without doing any Java programming this is the way to go. The instructions assume that you are using a \*nix-like shell. [See more information in the wiki page about Flux](https://github.com/metafacture/metafacture-core/wiki/Flux-user-guide).
2020

21-
1. Download the latest distribution package from the [metafacture-core/releases](https://github.com/metafacture/metafacture-core/releases) page. Make sure that you do download a distribution package and _not_ a source code package (the file name should include *-dist*).
21+
1. Download the latest distribution package from the [release page](https://github.com/metafacture/metafacture-core/releases). Make sure that you do download a distribution package and *not* a source code package (the file name should include `*-dist*`).
2222

2323
2. Extract the downloaded archive:
2424
```bash
25-
$ tar xzf metafacture-core-VERSION-dist.tar.gz
25+
$ tar xzf metafacture-core-$VERSION-dist.tar.gz
2626
```
27-
This will create a new directory containing a ready-to-use metafacture distribution.
27+
This will create a new directory containing a ready-to-use Metafacture distribution.
2828
3. Change into the newly created directory:
2929
```bash
30-
$ cd metafacture-core-VERSION
30+
$ cd metafacture-core-$VERSION
3131
```
3232
4. Run one of the example scripts:
3333
```bash
3434
$ ./flux.sh examples/read/marc21/read-marc21.flux
3535
```
36-
This example will print a number of marc21 records on standard out.
36+
This example will print a number of MARC 21 records on standard output.
3737

38-
The _examples_ folder contains many more examples which provide a good starting point for learning metafacture. If you have any questions please join our [mailing list](http://lists.dnb.de/mailman/listinfo/metafacture) or use our issue-based discussion forum over at [metafacture-documentation](https://github.com/metafacture/metafacture-documentation).
38+
The `examples` folder contains many more examples which provide a good starting point for learning Metafacture. If you have any questions please join our [mailing list](http://lists.dnb.de/mailman/listinfo/metafacture) or use our issue-based discussion forum over at [metafacture-documentation](https://github.com/metafacture/metafacture-documentation).
3939

4040

41-
## Using Metafacture as a Java libary
41+
## Using Metafacture as a Java library
4242

43-
If you want use Metafacture in your own Java projects all you need to add some dependencies to your project. As of Metafacture 5 the single metafacture-core package has been replaced with a number of domain-specific packages. You can find the list of packages on [Maven Central](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.metafacture%22).
43+
If you want to use Metafacture in your own Java projects all you need is to add some dependencies to your project. As of Metafacture 5, the single metafacture-core package has been replaced with a number of domain-specific packages. You can find the list of packages on [Maven Central](https://search.maven.org/search?q=g:org.metafacture).
4444

4545
Alternatively, you can simply guess the package names from the top-level folders in the source code repository -- they are the same. For instance, if you want to use Metamorph in your project, simply add the following dependency to your `pom.xml`:
4646

4747
```xml
4848
<dependency>
4949
<groupId>org.metafacture</groupId>
5050
<artifactId>metamorph</artifactId>
51-
<version>VERSION</version>
51+
<version>$VERSION</version>
5252
</dependency>
5353
```
5454

5555
or if Gradle is your build tool of choice use:
5656

5757
```groovy
5858
dependencies {
59-
implementation 'org.metafacture:metamorph:VERSION'
59+
implementation 'org.metafacture:metamorph:$VERSION'
6060
}
6161
```
6262

63-
Our integration server automatically publishes successful builds of all branches as snapshot versions on [Sonatype OSS Repository](https://oss.sonatype.org/index.html#nexus-search;quick~metafacture). The version number is derived from the branch name. Snapshot builds from the master branch always have the version "master-SNAPSHOT".
63+
Occasionally, we publish snapshot builds on [Sonatype OSS Repository](https://oss.sonatype.org/index.html#nexus-search;gav~org.metafacture~~~~). The version number is derived from the branch name. Snapshot builds from the master branch always have the version `master-SNAPSHOT`.
6464

6565
<!--
6666
TODO: Link to getting started tutorial
@@ -77,7 +77,7 @@ $ git clone https://github.com/metafacture/metafacture-core.git
7777
$ cd metafacture-core
7878
```
7979

80-
2. Invoke the gradle-wrapper to download Gradle and build metafacture-core (on Windows call `gradlew.bat install`):
80+
2. Invoke the Gradle wrapper to download Gradle and build metafacture-core (on Windows call `gradlew.bat install` instead):
8181

8282
```bash
8383
$ ./gradlew install

build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,14 @@ subprojects {
6464
targetCompatibility = 1.8
6565

6666
tasks.withType(JavaCompile) {
67+
'all -processing -rawtypes -serial'.split().each {
68+
options.compilerArgs << "-Xlint:${it}"
69+
}
70+
71+
options.compilerArgs << '-Werror'
6772
options.encoding = 'UTF-8'
6873
}
74+
6975
task sourceJar(type: Jar) {
7076
dependsOn tasks.classes
7177
from sourceSets.main.allJava
@@ -98,6 +104,15 @@ subprojects {
98104
checkstyleTest.enabled = false
99105
}
100106

107+
test {
108+
systemProperties['org.slf4j.simpleLogger.defaultLogLevel'] = 'warn'
109+
110+
testLogging {
111+
showStandardStreams = true
112+
exceptionFormat = 'full'
113+
}
114+
}
115+
101116
signing {
102117
required {
103118
scmInfo.isRelease() && gradle.taskGraph.hasTask(tasks.uploadArchives)

config/checkstyle/checkstyle.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<module name="CustomImportOrder">
3030
<property name="customImportOrderRules" value="SAME_PACKAGE(2)###THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE###SPECIAL_IMPORTS###STATIC"/>
3131
<property name="separateLineBetweenGroups" value="true"/>
32+
<property name="sortImportsInGroupAlphabetically" value="true"/>
3233
</module>
3334
<module name="CyclomaticComplexity"/>
3435
<module name="DeclarationOrder"/>

metafacture-biblio/build.gradle

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,3 @@ dependencies {
3131
testImplementation 'junit:junit:4.12'
3232
testImplementation 'org.mockito:mockito-core:2.5.5'
3333
}
34-
35-
test {
36-
testLogging {
37-
showStandardStreams = true
38-
exceptionFormat = 'full'
39-
}
40-
}

metafacture-biblio/src/main/java/org/metafacture/biblio/ComarcXmlHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ else if (RECORD.equals(localName) && NAMESPACE.equals(uri)) {
8989
}
9090

9191
@Override
92+
@SuppressWarnings("fallthrough")
9293
public void endElement(final String uri, final String localName,
9394
final String qName) throws SAXException {
9495
if (SUBFIELD.equals(localName)) {

metafacture-biblio/src/main/java/org/metafacture/biblio/marc21/Marc21Encoder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.metafacture.biblio.marc21;
1818

1919
import org.metafacture.biblio.iso2709.RecordBuilder;
20+
import org.metafacture.biblio.iso2709.RecordFormat;
2021
import org.metafacture.framework.FluxCommand;
2122
import org.metafacture.framework.FormatException;
2223
import org.metafacture.framework.ObjectReceiver;
@@ -71,7 +72,7 @@
7172
public final class Marc21Encoder extends
7273
DefaultStreamPipe<ObjectReceiver<String>> {
7374

74-
private static final int NAME_LENGTH = Marc21Constants.MARC21_FORMAT.TAG_LENGTH +
75+
private static final int NAME_LENGTH = RecordFormat.TAG_LENGTH +
7576
Marc21Constants.MARC21_FORMAT.getIndicatorLength();
7677

7778
private final RecordBuilder builder;
@@ -157,7 +158,7 @@ private void startField(final String name) {
157158
if (name.length() != NAME_LENGTH) {
158159
throw new FormatException("invalid entity name: " + name);
159160
}
160-
final char[] tag = new char[Marc21Constants.MARC21_FORMAT.TAG_LENGTH];
161+
final char[] tag = new char[RecordFormat.TAG_LENGTH];
161162
final char[] indicators = new char[Marc21Constants.MARC21_FORMAT.getIndicatorLength()];
162163
name.getChars(0, tag.length, tag, 0);
163164
name.getChars(tag.length, name.length(), indicators, 0);

metafacture-biblio/src/main/java/org/metafacture/biblio/pica/PicaEncoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
import org.metafacture.framework.annotations.Out;
2727
import org.metafacture.framework.helpers.DefaultStreamPipe;
2828

29-
import java.text.Normalizer.Form;
3029
import java.text.Normalizer;
30+
import java.text.Normalizer.Form;
3131
import java.util.regex.Matcher;
3232
import java.util.regex.Pattern;
3333

metafacture-biblio/src/main/java/org/metafacture/biblio/pica/PicaParserContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
import org.metafacture.framework.StreamReceiver;
2020

21-
import java.text.Normalizer.Form;
2221
import java.text.Normalizer;
22+
import java.text.Normalizer.Form;
2323

2424
/**
2525
* Parser context for the PICA+ parser.The context implements

metafacture-commons/src/main/java/org/metafacture/commons/reflection/ConfigurableClass.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private void applySetters(final T target, final Map<String, String> setterValues
188188
}
189189
}
190190

191-
private Object convertValue(final String value, final Class<?> type) {
191+
private <T extends Enum<T>> Object convertValue(final String value, final Class<?> type) {
192192
final Object result;
193193

194194
if (type == boolean.class) {
@@ -199,7 +199,7 @@ else if (type == int.class) {
199199
}
200200
else if (type.isEnum()) {
201201
@SuppressWarnings("unchecked") // protected by type.isEnum() check
202-
final Class<Enum> enumType = (Class<Enum>) type;
202+
final Class<T> enumType = (Class<T>) type;
203203
result = Enum.valueOf(enumType, value.toUpperCase());
204204
}
205205
else {

metafacture-commons/src/main/java/org/metafacture/commons/tries/SetReplacer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import java.util.Collections;
2222
import java.util.Comparator;
2323
import java.util.List;
24-
import java.util.Map.Entry;
2524
import java.util.Map;
25+
import java.util.Map.Entry;
2626

2727
/**
2828
* Replaces Strings by other Strings.

0 commit comments

Comments
 (0)