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.
|
convertToInputStreampublic static final int MODE_CONNECTION_STRING
public static final int MODE_RAW_TEXT
public JsonDataSource(java.io.File src)
throws DataConnectionException
src - - File to useDataConnectionExceptionpublic 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_* valuesDataConnectionExceptionpublic JsonDataSource(java.io.File src,
java.lang.String encoding)
throws DataConnectionException
src - - File to useencoding - - character encoding of the fileDataConnectionExceptionpublic JsonDataSource(java.io.InputStream jsonStream,
java.lang.String encoding)
throws DataConnectionException
jsonStream - - Stream to create the data source from.encoding - - character encoding of the fileDataConnectionExceptionpublic 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.DataConnectionExceptionpublic 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 = trueDataConnectionExceptionpublic 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 downloadedDataConnectionExceptionpublic java.lang.String getDatasourceName()
getDatasourceName in interface DataSourceProviderpublic boolean isIgnoreEvaluateExceptions()
public void setIgnoreEvaluateExceptions(boolean ignoreEvaluateExceptions)
public int getParamMode()
DataSourceProvidergetParamMode in interface DataSourceProviderpublic void setParamMode(int paramMode)
DataSourceProvidersetParamMode in interface DataSourceProviderparamMode - the parameter substitution mode.public void setMap(java.util.Map map)
setMap in interface DataSourceProvidermap - The map of string pairs.public java.util.Map getMap()
DataSourceProvidergetMap in interface DataSourceProviderpublic void setDatasets(java.lang.Object[] datasets)
DataSourceProvidersetDatasets in interface DataSourceProviderdatasets - 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
DataSourceProvidergetRootNode in interface DataSourceProviderDataSourceException - Could not retrieve the data. Generally wraps a SqlException or XpathException.public void close()
throws DataSourceException
DataSourceProviderclose in interface DataSourceProviderDataSourceException - Could not retrieve the data. Generally wraps a SqlException or XpathException.public TagAttributes[] getTagAttributes()
DataSourceProvidergetTagAttributes in interface DataSourceProviderpublic void validateTag(BaseTag tagToCheck)
throws TagException
DataSourceProvidervalidateTag in interface DataSourceProvidertagToCheck - The tag to checkTagException - thrown if illegal parameters passed in.public void approveDenyModifySelect(BaseTag xmlTag)
throws DataSourceException
DataSourceProviderapproveDenyModifySelect in interface DataSourceProviderxmlTag - The tag to checkDataSourceException - thrown if illegal parameters passed in.public int getQueryMode(java.lang.String select,
BaseTag tag)
throws DataSourceException
DataSourceProvidergetQueryMode in interface DataSourceProviderselect - The querytag - The tag this select is for. This may be null.DataSourceExceptionpublic void populateDatasourceException(DataSourceException exception, BaseTag tag, DataSourceNode[] stack)
populateDatasourceException in interface DataSourceProviderexception - 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