Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Raphael
histream
Commits
9a4a938e
Commit
9a4a938e
authored
Mar 02, 2017
by
R.W.Majeed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more verbose error messages
parent
437801bb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
5 deletions
+18
-5
histream-import/src/main/java/de/sekmi/histream/etl/config/DataSource.java
...rc/main/java/de/sekmi/histream/etl/config/DataSource.java
+12
-3
histream-import/src/main/java/de/sekmi/histream/etl/config/DecimalColumn.java
...main/java/de/sekmi/histream/etl/config/DecimalColumn.java
+3
-1
histream-import/src/main/java/de/sekmi/histream/etl/config/IntegerColumn.java
...main/java/de/sekmi/histream/etl/config/IntegerColumn.java
+1
-0
histream-skos/src/main/java/de/sekmi/histream/ontology/skos/Store.java
.../src/main/java/de/sekmi/histream/ontology/skos/Store.java
+2
-1
No files found.
histream-import/src/main/java/de/sekmi/histream/etl/config/DataSource.java
View file @
9a4a938e
...
...
@@ -6,6 +6,7 @@ import java.net.URL;
import
java.net.URLConnection
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Objects
;
import
javax.xml.bind.JAXB
;
import
javax.xml.bind.annotation.XmlAccessType
;
...
...
@@ -28,7 +29,7 @@ import de.sekmi.histream.etl.ScriptProcessingQueue;
* the location of the data source description.
*
* @see JAXB#unmarshal(java.io.File, Class)
* @author R
aphael
* @author R
.W.Majeed
*
*/
@XmlRootElement
(
name
=
"datasource"
)
...
...
@@ -89,14 +90,22 @@ public class DataSource {
return
Arrays
.
asList
();
}
}
public
static
DataSource
load
(
URL
configuration
)
throws
IOException
{
/**
* Load the datasource configuration from the given URL.
* @param configuration configuration URL
* @return data source object
* @throws IOException IO error
* @throws NullPointerException /datasource or /datasource/meta missing
*/
public
static
DataSource
load
(
URL
configuration
)
throws
IOException
,
NullPointerException
{
URLConnection
conn
=
configuration
.
openConnection
();
conn
.
connect
();
DataSource
ds
;
try
(
InputStream
in
=
conn
.
getInputStream
()
){
ds
=
JAXB
.
unmarshal
(
configuration
,
DataSource
.
class
);
}
Objects
.
requireNonNull
(
ds
,
"JAXB unmarshall returned null for URL "
+
configuration
);
Objects
.
requireNonNull
(
ds
.
getMeta
(),
"/datasource/meta element missing"
);
ds
.
getMeta
().
setLastModified
(
conn
.
getLastModified
());
ds
.
getMeta
().
setLocation
(
configuration
);
return
ds
;
...
...
histream-import/src/main/java/de/sekmi/histream/etl/config/DecimalColumn.java
View file @
9a4a938e
...
...
@@ -32,6 +32,8 @@ public class DecimalColumn extends Column<BigDecimal>{
@Override
public
BigDecimal
valueFromString
(
String
input
)
throws
ParseException
{
// remove leading/trailing spaces
input
=
input
.
trim
();
// TODO warning for user feedback if spaces were removed
if
(
locale
==
null
){
// parse according to BigDecimal(String)
try
{
...
...
@@ -48,7 +50,7 @@ public class DecimalColumn extends Column<BigDecimal>{
try
{
return
(
BigDecimal
)
decimalFormat
.
parse
(
input
);
}
catch
(
java
.
text
.
ParseException
e
)
{
throw
new
ParseException
(
"Unable to parse number '"
+
input
+
"'
"
,
e
);
throw
new
ParseException
(
"Unable to parse number '"
+
input
+
"'
with locale "
+
locale
,
e
);
}
}
}
...
...
histream-import/src/main/java/de/sekmi/histream/etl/config/IntegerColumn.java
View file @
9a4a938e
...
...
@@ -20,6 +20,7 @@ public class IntegerColumn extends Column<Long> {
@Override
public
Long
valueFromString
(
String
input
)
throws
ParseException
{
input
=
input
.
trim
();
// TODO warning for user feedback if spaces were removed
return
Long
.
parseLong
(
input
);
}
...
...
histream-skos/src/main/java/de/sekmi/histream/ontology/skos/Store.java
View file @
9a4a938e
...
...
@@ -37,6 +37,7 @@ import de.sekmi.histream.ontology.OntologyException;
import
de.sekmi.histream.ontology.skos.transform.ConditionType
;
import
de.sekmi.histream.ontology.skos.transform.Rule
;
import
de.sekmi.histream.ontology.skos.transform.TransformationRules
;
import
de.sekmi.histream.xml.NamespaceResolver
;
public
class
Store
implements
Ontology
,
Plugin
{
private
static
final
Logger
log
=
Logger
.
getLogger
(
Store
.
class
.
getName
());
...
...
@@ -47,7 +48,7 @@ public class Store implements Ontology, Plugin {
private
Resource
inferredContext
;
// SKOS scheme to enforce unique notations
private
Resource
scheme
;
/// XXX namespace resolver
/**
* Plugin constructor which accepts configuration parameters.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment