The DataAdapterEnvironment Interface

OutputStream openResourceForWriting(String resourceName) throws FileNotFoundException;

This method opens a resource with a given name for writing. It is used for saving persistent data for the integration. This method should be used instead of trying to load files using java methods. The user should ensure that the stream is closed when finished writing to the stream. close()/flush() will save the resource. This method creates a runtime resource (it may not overwrite files that came in the adapter package).

Parameter

  • resourceName: The name of the resource to retrieve. This name should be unique across all integrations of the same adapter.

Return Value

Returns a stream to which to write.

Exceptions

  • This method throws the FileNotFoundException if the resource type is file and the file does not exist, if the resource is a directory rather than a regular file, or for some other reason the resource cannot be opened for reading.
  • This method throws the SecurityException if a security manager exists and its checkRead method denies access to the file.

InputStream openResourceForReading(String resourceName) throws FileNotFoundException;

This method opens a resource with a given name for reading. It is used for reading persistent data for the integration. This method should be used instead of trying to load a file using java methods.The user should ensure that the stream is closed when finished reading it. It first attempts to load files that came in the adapter package. If not found, it attempts to load a runtime created resource from DataAdapterEnvironment.openResourceForWriting(String). The runtime resources can be viewed using JMX (of the probe and server accordingly).

Parameter

  • resourceName: The name of the resource to retrieve. This name should be unique across all integrations of the same adapter.

Return Value

Returns a stream to read.

Exceptions

  • This method throws the FileNotFoundException if the resource type is file and the file does not exist, if the resource is a directory rather than a regular file, or for some other reason the resource cannot be opened for reading.
  • This method throws the SecurityException if a security manager exists and its checkRead method denies read access to the file.

Properties openResourceAsProperties(String propertiesFile) throws IOException;

This method opens a resource with a given name and loads it as a Properties structure. It is used for reading persistent data for the integration. This method should be used instead of attempting to load the .properties files using java methods. It first attempts to load files that came in the adapter package. If not found, it attempts to load a runtime created resource from DataAdapterEnvironment.openResourceForWriting(String). The runtime resources can be viewed using JMX (of the probe and server accordingly).

Parameter

  • propertiesFile: The name of the resource to retrieve. This name should be unique across all integrations of the same adapter.

Return Value

Returns the file content represented in Properties.

Exceptions

  • This method throws the FileNotFoundException if the resource type is file and the file does not exist, if the resource is a directory rather than a regular file, or for some other reason the resource cannot be opened for reading.
  • This method throws the SecurityException if a security manager exists and its checkRead method denies read access to the file.
  • This method throws the IOException if the properties file failed to convert to the Properties Object.

String openResourceAsString(String resourceName) throws IOException;

This method opens a resource with a given name and loads it as a string. It is used for reading persistent data for the integration. This method should be used instead of trying to load files using java methods.

It first attempts to load files that came in the adapter package. If not found, it attempts to load a runtime created resource from DataAdapterEnvironment.openResourceForWriting(String). The runtime resources can be viewed using JMX (of the probe and server accordingly).

Parameter

  • resourceName: The name of resource to retrieve. This name should be unique across all integrations of the same adapter.

Return Value

Returns the file content represented in String format.

Exceptions

  • This method throws the FileNotFoundException if the resource type is file and the file does not exist, if the resource is a directory rather than a regular file, or for some other reason the resource cannot be opened for reading.
  • This method throws the SecurityException if a security manager exists and its checkRead method denies read access to the file.
  • This method throws the IOException if an I/O error occurs.

public void saveResourceFromString(String relativeFileName, String value) throws IOException;

This method receives a String and saves it as a resource. It is used for saving persistent data for the integration. This method should be used instead of trying to save files using java methods. This method converts the String into a stream and saves it to the resource. It creates a runtime resource, but cannot overwrite files that came in the adapter package). The runtime resources can be viewed using JMX (of the probe and server accordingly).

Parameter

  • relativeFileName: The name of resource to retrieve. This name should be unique across all integrations of the same adapter.
  • value: The String to save as a resource

Exceptions

This method throws the IOException if an I/O error occurs.

boolean resourceExists(String resourceName);

This method checks if the given resource name exists. It looks for files that came in the adapter package and for runtime created resources from DataAdapterEnvironment.openResourceForWriting(String).

Parameter

  • resourceName: The name of the resource to retrieve. This name should be unique across all integrations of the same adapter.

Return Value

Returns True if resourceName exists.

boolean deleteResource(String resourceName);

This method deletes the given resource from persistent data. It deletes a runtime resource, and may not delete files that came in the adapter package. The runtime resources can be viewed using JMX (for the probe and server accordingly).

Parameter

  • resourceName: The name of the resource to delete. This name should be unique across all integrations of the same adapter.

Return Value

Returns True if the resource is successfully deleted.

Collection<String> listResourcesInPath(String path);

This method retrieves a list of resources in the given resource path. It looks for files that came in the adapter package and for a runtime created resources from DataAdapterEnvironment.openResourceForWriting(String). The runtime resources can be viewed using JMX (for the probe and server accordingly).

Parameter

  • path: The resource path. For example, "META-INF/myfiles/"

Return Value

Return a list of resources in the path.

DataAdapterLogger getLogger();

Retrieves the logger to be used by the adapter.This logger is used for logging events in your adapter.

Return Value

Returns the logger that is used by the DataAdapter.

DestinationConfig getDestinationConfig();

This method retrieves the destination configuration of the integration. This configuration holds all connection and running settings for the integration.

Return Value

Returns the DestinationConfig of the Adapter.

int getChunkSize();

This method retrieves the population chunk size requested for this integration.

Return Value

Returns the population chunk size.

int getPushChunkSize();

This method retrieves the push chunk size requested for this integration.

Return Value

Returns the push chunk size.

ClassModel getLocalClassModel();

This method retrieves a class model for querying information about the local UCMDB's class model. This method brings an updated ClassModel. Once the ClassModel object is returned, it is not updated for any class model changes. In order to retrieve an updated class model, use this method again to retrieve it.

Return Value

Returns the UCMDB's class model.

CustomerInformation getLocalCustomerInformation();

This method retrieves customer information for the customer that is executing the adapter.

Return Value

Returns customer information for the customer that is executing the adapter.

Object getSettingValue(String name);

This method retrieves a specific adapter setting.

Parameter

name: The name of setting.

Return Value

Returns the Object setting value.

Map<String, Object> getAllSettings();

This method retrieves all adapter settings.

Return Value

Returns the adapter settings.

boolean isMTEnabled();

This method checks if the server environment supports Multiple Tenancy (MT).

Return Value

Returns true if the server environment supports MT, otherwise returns false.

String getUcmdbServerHostName();

This method returns the local UCMDB server host name.

Return Value

Returns the local UCMDB server host name.