public abstract class DynamicConfiguration extends Object
DynamicConfiguration
is a map containing adapter specific message attributes.
It associates DynamicConfigurationKey
s with string values.
DynamicConfiguration
and copies the payload.
package test.dynamic;
import java.io.*;
import java.util.*;
import com.sap.aii.mapping.api.*;
public class DynamicMapping implements StreamTransformation {
private static final DynamicConfigurationKey KEY_FILENAME =
DynamicConfigurationKey.create(
"http://sap.com/xi/XI/System/File",
"filename");
private Map param;
public void setParameter(Map param) {
this.param = param;
}
public void execute(InputStream in, OutputStream out)
throws StreamTransformationException {
// copy payload
copyPayload(in, out);
// access dynamic configuration
DynamicConfiguration conf = (DynamicConfiguration) param.get(
StreamTransformationConstants.DYNAMIC_CONFIGURATION);
// read value
String valueOld = conf.get(KEY_FILENAME);
if (valueOld == null) {
throw new StreamTransformationException(
"Filename is missing. ");
}
// compute new value
String valueNew = valueOld.replaceAll("input", "output");
// set new value
conf.put(KEY_FILENAME, valueNew);
}
private void copyPayload(InputStream in, OutputStream out)
throws StreamTransformationException {
int c;
try {
c = in.read();
while (c != -1) {
out.write(c);
c = in.read();
}
} catch (IOException e) {
throw new StreamTransformationException(e.getMessage());
}
}
}
DynamicConfigurationKey
Constructor and Description |
---|
DynamicConfiguration() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
containsKey(DynamicConfigurationKey key)
Returns
true if this map contains an entry for the specified
key, and false otherwise. |
abstract String |
get(DynamicConfigurationKey key)
Returns the value for the specified key.
|
abstract Iterator |
getKeys()
Returns an iterator over all keys of this
DynamicConfiguration . |
abstract Iterator |
getKeys(String namespace)
Returns an iterator over the keys with the specified namespace.
|
abstract String |
put(DynamicConfigurationKey key,
String value)
Associates the specified value with the specified key.
|
abstract String |
remove(DynamicConfigurationKey key)
Removes the entry for this key if it is present.
|
abstract void |
removeAll()
Removes all entries from the
DynamicConfiguration . |
abstract void |
removeNamespace(String namespace)
Removes the entries whose keys have the specified namespace.
|
abstract int |
size()
Returns the number of entries of this
DynamicConfiguration . |
abstract int |
size(String namespace)
Returns the number of entries with the specified namespace.
|
public abstract String get(DynamicConfigurationKey key)
null
if the DynamicConfiguration
contains no mapping for this key.key
- key whose associated value is to be returned.null
if the map contains no
mapping for this key.public abstract Iterator getKeys()
DynamicConfiguration
.
The objects returned by the iterators next
method are instances of
DynamicConfigurationKey
.
The keys are returned in no particular order. If the
DynamicConfiguration
is modified while the iteration over its
keys is in progress, the results of the iteration is undefined.
The Iterator.remove
method removes the corresponding
entry from the DynamicConfiguration
.
DynamicConfiguration
.public abstract int size()
DynamicConfiguration
.DynamicConfiguration
.public abstract Iterator getKeys(String namespace)
next
method
are instances of DynamicConfigurationKey
.
The keys are returned in no particular order.
If the DynamicConfiguration
is modified while the
iteration over its keys is in progress, the results of the iteration
is undefined. The Iterator.remove
method removes the
corresponding entry from the DynamicConfiguration
.
namespace
- the namespacepublic abstract int size(String namespace)
namespace
- the namespacepublic abstract boolean containsKey(DynamicConfigurationKey key)
true
if this map contains an entry for the specified
key, and false
otherwise.key
- key whose presence in this map is to be tested.true
if this map contains an entry for the specified
key, and false
otherwise.public abstract String put(DynamicConfigurationKey key, String value)
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.null
if there was no mapping for key.IllegalArgumentException
- if the key or value is null, or if
the value is too long.public abstract String remove(DynamicConfigurationKey key)
key
- key whose mapping is to be removed from the map.null
if there was no mapping for this key.public abstract void removeNamespace(String namespace)
namespace
- the namespacepublic abstract void removeAll()
DynamicConfiguration
.Access Rights |
---|
SC | DC | Public Part | ACH |
---|---|---|---|
[sap.com] SAP_XIAF
|
[sap.com] com.sap.aii.mapping.lib.facade
|
api
|
BC-XI
|
Copyright 2019 SAP AG Complete Copyright Notice