ConnectionID
- the connection identifying how to retrieve the structure view.S
- the provided structure.public abstract class AbstractStructureProvider<ConnectionID,S extends Structure> extends Object implements StructureProvider, Disposable
Clients may subclass this class.
Constructor and Description |
---|
AbstractStructureProvider()
Instantiates a new structure provider.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes temporary resources allocated when reading the structure.
|
List<Node> |
getChildren(PropertySet properties,
String parentId)
Returns the list of child nodes of the specified parent.
|
protected abstract ConnectionID |
getConnectionID(PropertySet properties)
Identifies the connection parameters necessary to connect to the data source and to compute the structure.
|
List<Node> |
getRoots(PropertySet properties)
Returns the list of root nodes of the structure.
|
protected S |
getStructure(PropertySet properties,
boolean forceRefresh)
Retrieve the structure for the specified connection parameters.
|
protected abstract S |
loadStructure(PropertySet properties,
ConnectionID connection)
Connects to the data source using the specified connection parameters and loads the structure.
|
protected String |
verifyHeader(PropertySet properties,
String name)
Retrieves the value of the specified header name or query parameter in the servlet request.
|
protected String |
verifyPasswordHeader(PropertySet properties,
String name)
Retrieves the password value of the specified header name or query parameter in the servlet request,
|
protected String |
verifySystemProperty(String name)
Retrieves the value of the specified System property name or servlet context parameter.
|
public AbstractStructureProvider()
public void dispose()
dispose
in interface Disposable
protected S getStructure(PropertySet properties, boolean forceRefresh) throws CoreException
Subclass is not required to override and shall use the base implementation as-is.
properties
- options configuring the retrieval of the structure.
Those options are provided by the servlet request through headers or query parameters.forceRefresh
- if true
the structure is forced to recompute.
If false
, the structure is computed only if not present in the cache (as read by a previous request).CoreException
- if anything prevents from connecting to the data source and to read the structure.protected abstract ConnectionID getConnectionID(PropertySet properties) throws CoreException
The class hosting the connection parameters is required to override the hashCode()
and equals()
methods, so that two
instances constructed with the same properties are considered equal and so the structure can be cached efficiently.
properties
- options configuring the retrieval of the structure.
Those options are provided by the servlet request through headers or query parameters.CoreException
- if anything prevents from computing the connection parameters.protected String verifyHeader(PropertySet properties, String name) throws CoreException
properties
- options configuring the retrieval of the structure.
Those options are provided by the servlet request through headers or query parameters.name
- the name of the property to look for.CoreException
- if the property is not defined.protected String verifyPasswordHeader(PropertySet properties, String name) throws CoreException
If a value matching the specified property name is found, it is decrypted using the EncryptionProvider
class, provided the
"encryptionAlgorithm"
and "encryptionIV"
properties are also set.
properties
- options configuring the retrieval of the structure.
Those options are provided by the servlet request through headers or query parameters.name
- the name of the property to look for.CoreException
- if the property is not defined.EncryptionProvider
protected String verifySystemProperty(String name) throws CoreException
name
- the name of the property to look for.CoreException
- if the property is not defined.protected abstract S loadStructure(PropertySet properties, ConnectionID connection) throws CoreException
properties
- options configuring the retrieval of the structure.
Those options are provided by the servlet request through headers or query parameters.connection
- the connection parameters necessary to connect to the data source,
as returned by the getConnectionID()
method.CoreException
- if anything prevents from connecting to the data source and to read the structure.getConnectionID(PropertySet)
public List<Node> getRoots(PropertySet properties) throws CoreException
Subclass is not required to override and shall use the base implementation as-is.
getRoots
in interface StructureProvider
properties
- options configuring the retrieval of the root nodes.
Those options are provided by the servlet request through headers or query parameters.CoreException
- if anything prevents from retrieving the nodes.public List<Node> getChildren(PropertySet properties, String parentId) throws CoreException
Subclass is not required to override and shall use the base implementation as-is.
getChildren
in interface StructureProvider
properties
- options configuring the retrieval of the children nodes.
Those options are provided by the servlet request through headers or query parameters.parentId
- the identifier of the parent node.CoreException
- if anything prevents from retrieving the nodes.Node.getId()