public class JsonDataSource extends DataSourceBase implements DataSourceProvider
Modifier and Type | Class and Description |
---|---|
static class |
JsonDataSource.SortingComparer |
Modifier and Type | Field and Description |
---|---|
static int |
MODE_CONNECTION_STRING
constructor using mode the string is a connection string.
|
static int |
MODE_RAW_TEXT
constructor using mode the string is the JSON in the string.
|
Constructor and Description |
---|
JsonDataSource(java.io.File src)
Deprecated.
use connection string constructor instead
|
JsonDataSource(java.io.File src,
java.lang.String encoding)
Deprecated.
use connection string constructor instead
|
JsonDataSource(java.io.InputStream jsonStream,
java.lang.String encoding)
Creates a Json data source from an InputStream.
|
JsonDataSource(java.lang.String urlOrFilename,
boolean isLocation)
Deprecated.
use connection string constructor instead
|
JsonDataSource(java.lang.String locationOrRawJson,
boolean isLocation,
java.lang.String encoding)
Deprecated.
use connection string constructor instead
|
JsonDataSource(java.lang.String jsonConnectionString,
int mode)
Create a DataSourceProvider using the passed in connection strings.
|
JsonDataSource(java.lang.String location,
java.lang.String encoding,
java.lang.String username,
java.lang.String password)
Deprecated.
use connection string constructor instead
|
Modifier and Type | Method and Description |
---|---|
void |
approveDenyModifySelect(BaseTag xmlTag)
Verifys that a tag select is approved by a user defined callback
Or denies by throwing a DatasourceException or modifies the select
Called in XmlSubNodeVisitor when tag is validated
|
void |
close()
Called when processing is complete.
|
java.lang.Object |
convertToDataClass(java.lang.Object entity,
int mode) |
java.lang.Object |
convertToDataClass(java.lang.String tagType,
java.lang.Object entity,
int mode) |
java.lang.String |
getDatasourceName()
returns the name of this type in the form "sql", "xml", etc.
|
java.util.Map |
getMap()
Returns the map of variables for this datasource.
|
int |
getParamMode()
Get the parameter substitution mode.
|
int |
getQueryMode(java.lang.String select,
BaseTag tag)
Returns the mode of a query.
|
DataSourceNode |
getRootNode()
Returns the root node for this data set.
|
TagAttributes[] |
getTagAttributes()
Returns the allowed attributes for all tags.
|
boolean |
isIgnoreEvaluateExceptions() |
void |
populateDatasourceException(DataSourceException exception,
BaseTag tag,
DataSourceNode[] stack)
Populates that properties in a DataSourceException via DataSourceException.setProperties().
|
void |
setDatasets(java.lang.Object[] datasets)
Set the datasets to use with this datasource.
|
void |
setIgnoreEvaluateExceptions(boolean ignoreEvaluateExceptions) |
void |
setMap(java.util.Map map)
Adds a map that is used for ${variable} substitution.
|
void |
setParamMode(int paramMode)
Set the parameter substitution mode.
|
void |
validateTag(BaseTag tagToCheck)
Verifys that a tag has all required attributes and no unknown attributes.
|
convertToInputStream
public static final int MODE_CONNECTION_STRING
public static final int MODE_RAW_TEXT
public JsonDataSource(java.io.File src) throws DataConnectionException
src
- - File to useDataConnectionException
public JsonDataSource(java.lang.String jsonConnectionString, int mode) throws DataConnectionException
jsonConnectionString
- Connection string to read the XML file. Or if mode is raw text, the actual JSON.mode
- One of the MODE_CONNECTION_* valuesDataConnectionException
public JsonDataSource(java.io.File src, java.lang.String encoding) throws DataConnectionException
src
- - File to useencoding
- - character encoding of the fileDataConnectionException
public JsonDataSource(java.io.InputStream jsonStream, java.lang.String encoding) throws DataConnectionException
jsonStream
- - Stream to create the data source from.encoding
- - character encoding of the fileDataConnectionException
public JsonDataSource(java.lang.String urlOrFilename, boolean isLocation) throws DataConnectionException
urlOrFilename
- - URL or file locationisLocation
- - True if locationOrRawJson is a URL/file path, false if it is a raw json string.DataConnectionException
public JsonDataSource(java.lang.String locationOrRawJson, boolean isLocation, java.lang.String encoding) throws DataConnectionException
locationOrRawJson
- - URL or file locationisLocation
- - True if locationOrRawJson is a URL/file path, false if it is a raw json string.encoding
- -encoding of the file if isLocation = trueDataConnectionException
public JsonDataSource(java.lang.String location, java.lang.String encoding, java.lang.String username, java.lang.String password) throws DataConnectionException
location
- username
- password
- encoding
- the encoding of the json file to be downloadedDataConnectionException
public java.lang.String getDatasourceName()
getDatasourceName
in interface DataSourceProvider
public boolean isIgnoreEvaluateExceptions()
public void setIgnoreEvaluateExceptions(boolean ignoreEvaluateExceptions)
public int getParamMode()
DataSourceProvider
getParamMode
in interface DataSourceProvider
public void setParamMode(int paramMode)
DataSourceProvider
setParamMode
in interface DataSourceProvider
paramMode
- the parameter substitution mode.public void setMap(java.util.Map map)
setMap
in interface DataSourceProvider
map
- The map of string pairs.public java.util.Map getMap()
DataSourceProvider
getMap
in interface DataSourceProvider
public void setDatasets(java.lang.Object[] datasets)
DataSourceProvider
setDatasets
in interface DataSourceProvider
datasets
- The datasets to use. Can be null to turn off datasets. This is a DatasetBase[] but because of
how the .NET engine is structured, we need to declare it as an object.public DataSourceNode getRootNode() throws DataSourceException
DataSourceProvider
getRootNode
in interface DataSourceProvider
DataSourceException
- Could not retrieve the data. Generally wraps a SqlException or XpathException.public void close() throws DataSourceException
DataSourceProvider
close
in interface DataSourceProvider
DataSourceException
- Could not retrieve the data. Generally wraps a SqlException or XpathException.public TagAttributes[] getTagAttributes()
DataSourceProvider
getTagAttributes
in interface DataSourceProvider
public void validateTag(BaseTag tagToCheck) throws TagException
DataSourceProvider
validateTag
in interface DataSourceProvider
tagToCheck
- The tag to checkTagException
- thrown if illegal parameters passed in.public void approveDenyModifySelect(BaseTag xmlTag) throws DataSourceException
DataSourceProvider
approveDenyModifySelect
in interface DataSourceProvider
xmlTag
- The tag to checkDataSourceException
- thrown if illegal parameters passed in.public int getQueryMode(java.lang.String select, BaseTag tag) throws DataSourceException
DataSourceProvider
getQueryMode
in interface DataSourceProvider
select
- The querytag
- The tag this select is for. This may be null.DataSourceException
public void populateDatasourceException(DataSourceException exception, BaseTag tag, DataSourceNode[] stack)
populateDatasourceException
in interface DataSourceProvider
exception
- The exception to populate.tag
- The tag we're processing. null if no tag.stack
- The node stack at the time of the exception. null if not relevant.public java.lang.Object convertToDataClass(java.lang.String tagType, java.lang.Object entity, int mode)
public java.lang.Object convertToDataClass(java.lang.Object entity, int mode)
Copyright © 2017 Windward Reports - All Rights Reserved. We are java reporting software