public class MetadataWriter extends MetadataSource
add(Object)
method is
invoked.
No more than one instance of MetadataWriter
should be used for the same database.
However multiple instances of MetadataSource
can be used concurrently with a single
MetadataWriter
instance on the same database.
MetadataSource
and all other entries are ignored:
Key | Value type | Description |
---|---|---|
"catalog" |
String |
The database catalog where the metadata schema is stored. |
"classloader" |
ClassLoader |
The class loader to use for creating Proxy instances. |
"maxStatements" |
Integer |
Maximal number of PreparedStatement s that can be kept simultaneously open. |
"maximumIdentifierLength" |
Integer |
The maximal number of characters allowed for primary keys.
This is the value given to the VARCHAR type when creating new "ID" columns. |
"maximumValueLength" |
Integer |
Maximal number of characters allowed in text columns. This is the parameter given to the VARCHAR
type when creating new columns. Attempts to insert a text longer than this limit will typically throws
a SQLException , but the exact behavior is database-dependent. |
"columnCreationPolicy" |
ValueExistencePolicy |
Whether columns should be created only for non-empty attributes (NON_EMPTY , the default) or for all attributes (ALL ) |
Defined in the sis-metadata
module
standard
Constructor and Description |
---|
MetadataWriter(MetadataStandard standard,
DataSource dataSource,
String schema,
Map<String,?> properties)
Creates a new metadata writer.
|
Modifier and Type | Method and Description |
---|---|
String |
add(Object metadata)
Adds the given metadata object to the database, if it does not already exists.
|
protected String |
suggestIdentifier(Object metadata,
Map<String,Object> asValueMap)
Suggests an identifier (primary key) to be used for the given metadata.
|
addWarningListener, close, getProvided, lookup, removeWarningListener, search
public MetadataWriter(MetadataStandard standard, DataSource dataSource, String schema, Map<String,?> properties)
standard
- the metadata standard to implement.dataSource
- the source for getting a connection to the database.schema
- the database schema were metadata tables are stored, or null
if none.properties
- additional options, or null
if none. See class javadoc for a description.public String add(Object metadata) throws MetadataStoreException
metadata
- the metadata object to add.MetadataStoreException
- if the metadata object does not implement a metadata interface
of the expected package, if an exception occurred while reading or writing the database.
In such case, the database content is left unchanged
(i.e. this method is a all or nothing operation).protected String suggestIdentifier(Object metadata, Map<String,Object> asValueMap) throws SQLException
Identifier
and Citation
. Subclasses can override this method
for implementing their own heuristic.
This method does not need to care about key collision. The caller will adds some suffix if this is necessary for differentiating otherwise identical identifiers.
metadata
- the metadata instance for which to suggests an identifier.asValueMap
- a view of all metadata properties as a map.
Keys are UML identifiers.null
if this method does not have any suggestion.SQLException
- if an access to the database was desired but failed.Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.