com.sap.dictionary.runtime

Class DdBroker

java.lang.Object
  extended bycom.sap.dictionary.runtime.DdBroker
All Implemented Interfaces:
com.sap.dictionary.runtime.DdConstants, IBroker

public class DdBroker
extends Object
implements IBroker, com.sap.dictionary.runtime.DdConstants


Field Summary
protected static String CURR_PACKAGE
           
protected static String CURRENCY
           
protected static String CURRENCY_NORMALIZED
           
protected static String QUAN_PACKAGE
           
protected static String QUANTITY
           
protected static String QUANTITY_NORMALIZED
           
 
Fields inherited from interface com.sap.dictionary.runtime.DdConstants
BIGGER_THAN_MIN_EXCL, BIGGER_THAN_MIN_INCL, CLASS_DOES_NOT_IMPLEMENT_INTERFACE, DDIC_NOT_CREATED, DDIC_TYPE_DOES_NOT_EXIST, DECIMAL_VALUE_TO_BIG, EMPTY_STRING_NOT_VALID, ERROR_DURING_PARSE, ERROR_DURING_PARSE_NO_VALID, LOGICAL_DDIC_DOES_NOT_EXIST, NO_DATATYPE_FOR_FIELD, NO_DATATYPE_IN_FIELD, NO_DDIC_NAME, NO_ENUM_MATCHING, NO_ENUM_MATCHING_S, NO_EXTERNAL_REPRESENTATION, NO_NUMERIC_VALUE, NO_PATTERN_MATCHING, NO_PATTERN_MATCHING_S, NO_REFERENCE_FIELD_FOUND, NO_TEXTSERVICE_AVAILABLE, NO_TYPE_IN_XML, NO_VALID_ENTRY, NO_VALUESERVICE_AVAILABLE, NOT_NORMALIZED, NOT_NUMERIC, NOT_VALID, NULL_NOT_VALID, NUMBER_OUT_OF_RANGE, PARSE_ERROR_NO_BIG_INTEGER, PARSE_ERROR_NO_INTEGER, PARSE_ERROR_UNALLOWED_CHARS, PARSE_NOT_POSSIBLE, PRECISION_TO_BIG, PROVIDER_CLASS_NOT_FOUND, PROVIDER_NOT_FOUND, REFERENCE_FIELD_DOES_NOT_EXIST, SIMPLE_TYPE_DOES_NOT_EXIST, SIMPLE_TYPE_NOT_CREATED, SMALLER_THAN_MAX_EXCL, SMALLER_THAN_MAX_INCL, STRUCTURE_TYPE_DOES_NOT_EXIST, TYPE_NOT_FOUND, WRONG_AMOUNT_TYPE, WRONG_BASE_TYPE_FOR_US, WRONG_CLASS, WRONG_CURRENCY_UNIT, WRONG_FIXED_LENGTH_S, WRONG_KEY_TYPE, WRONG_KEY_TYPE_FOR_FORMAT, WRONG_KEY_TYPE_FOR_US, WRONG_MAX_EXT_LENGTH, WRONG_MAX_EXT_LENGTH_S, WRONG_MAX_LENGTH_S, WRONG_MIN_LENGTH_S, WRONG_PRECISION, WRONG_UNIT_KEY_TYPE, WRONG_XML_FILE, YEAR_WITH_WRONG_VALUE
 
Constructor Summary
protected DdBroker(ClassLoader classLoader, Locale locale)
           
protected DdBroker(ClassLoader classLoader, Locale locale, com.sap.dictionary.types.services.IConfig configuration)
           
 
Method Summary
 Iterator dictionaryIterator()
          Returns an iterator over the dictionaries in squence of insertion
 ClassLoader getClassLoader()
          Returns the broker's classLoader
 IUnitService getCurrencyService(ISimpleType amountType, boolean normalized, Locale locale)
           
protected  IDataType getDataType(IField field)
           
 IDataType getDataType(String name)
          Returns a dataType with the given type name whereas name contains of package and typeName.
 IDataType getDataType(String dictionaryName, String name)
          Returns a dataType with the given dictionaryName and type name.
 com.sap.dictionary.runtime.DdDictionary getDictionary(String dictionaryName)
          Gets a DataDictionary as IDictionary out of the cache
 Locale getLocale()
          Returns the TypeBroker's locale
 ISimpleType getPredefinedSimpleType(BigDecimal value)
           
 ISimpleType getPredefinedSimpleType(BigInteger value)
           
 ISimpleType getPredefinedSimpleType(boolean value)
           
 ISimpleType getPredefinedSimpleType(Boolean value)
           
 ISimpleType getPredefinedSimpleType(byte value)
           
 ISimpleType getPredefinedSimpleType(Byte value)
           
 ISimpleType getPredefinedSimpleType(byte[] value)
           
 ISimpleType getPredefinedSimpleType(Class attributeClass)
           
 ISimpleType getPredefinedSimpleType(Date value)
           
 ISimpleType getPredefinedSimpleType(Date value)
           
 ISimpleType getPredefinedSimpleType(double value)
           
 ISimpleType getPredefinedSimpleType(Double value)
           
 ISimpleType getPredefinedSimpleType(float value)
           
 ISimpleType getPredefinedSimpleType(Float value)
           
 ISimpleType getPredefinedSimpleType(int value)
           
 ISimpleType getPredefinedSimpleType(Integer value)
           
 ISimpleType getPredefinedSimpleType(long value)
           
 ISimpleType getPredefinedSimpleType(Long value)
           
 ISimpleType getPredefinedSimpleType(short value)
           
 ISimpleType getPredefinedSimpleType(Short value)
           
 ISimpleType getPredefinedSimpleType(String value)
           
 ISimpleType getPredefinedSimpleType(Time value)
           
 ISimpleType getPredefinedSimpleType(Timestamp value)
           
 ISimpleType getPredefinedSimpleTypeByName(String typeName)
           
 IUnitService getQuantityService(ISimpleType amountType, boolean normalized, Locale locale)
           
 ISimpleType getSimpleType(String dictionaryName, String name)
          Returns a simpleType with the given given dictionaryName and SimpleType name.
 IStructure getStructure(String dictionaryName, String name)
          Returns a structure with the given dictionary name and structure name.
 IUnitService getUnitService(IField amountField)
          Returns a unit service for the given amount type.
 IUnitService getUnitService(IField amountField, boolean normalizingForced)
          Returns a unit service for the given amount field.
 IUnitService getUnitService(ISimpleType amountType, ISimpleType unitKeyType)
           
 boolean invalidateCache(String dictionaryName)
          Invalidates the cache for the dictionary with the given name.
 void prepare(String dictionaryName, String[] names)
           
 void putDictionary(String dictionaryName, IDataProvider provider)
          Introduce a new-dictionary to this TypeBroker
protected  void putDictionary(String dictionaryName, String logSystemName, IDataProvider provider)
           
 void putJavaDictionary(ClassLoader classLoader)
          Introduce a java-dictionary to this TypeBroker
 com.sap.dictionary.runtime.DdDictionary removeDictionary(String dictionaryName)
          Removes a dictionary from the TypeBroker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURRENCY

protected static final String CURRENCY
See Also:
Constant Field Values

CURRENCY_NORMALIZED

protected static final String CURRENCY_NORMALIZED
See Also:
Constant Field Values

QUANTITY

protected static final String QUANTITY
See Also:
Constant Field Values

QUANTITY_NORMALIZED

protected static final String QUANTITY_NORMALIZED
See Also:
Constant Field Values

CURR_PACKAGE

protected static final String CURR_PACKAGE
See Also:
Constant Field Values

QUAN_PACKAGE

protected static final String QUAN_PACKAGE
See Also:
Constant Field Values
Constructor Detail

DdBroker

protected DdBroker(ClassLoader classLoader,
                   Locale locale)
            throws DdException

DdBroker

protected DdBroker(ClassLoader classLoader,
                   Locale locale,
                   com.sap.dictionary.types.services.IConfig configuration)
            throws DdException
Method Detail

putDictionary

protected void putDictionary(String dictionaryName,
                             String logSystemName,
                             IDataProvider provider)

putDictionary

public void putDictionary(String dictionaryName,
                          IDataProvider provider)
Description copied from interface: IBroker
Introduce a new-dictionary to this TypeBroker

Specified by:
putDictionary in interface IBroker
Parameters:
dictionaryName - - the name to identify this dictionary
provider - - the provider-instance for backend-access

putJavaDictionary

public void putJavaDictionary(ClassLoader classLoader)
Description copied from interface: IBroker
Introduce a java-dictionary to this TypeBroker

Specified by:
putJavaDictionary in interface IBroker
Parameters:
classLoader - - the class loader to get the java-types

getDictionary

public com.sap.dictionary.runtime.DdDictionary getDictionary(String dictionaryName)
Description copied from interface: IBroker
Gets a DataDictionary as IDictionary out of the cache

Specified by:
getDictionary in interface IBroker
Parameters:
dictionaryName - - logical Name of this dictionary instance
Returns:
A DataDictionary instance

getClassLoader

public ClassLoader getClassLoader()
Description copied from interface: IBroker
Returns the broker's classLoader

Specified by:
getClassLoader in interface IBroker
Returns:
A ClassLoader instance

removeDictionary

public com.sap.dictionary.runtime.DdDictionary removeDictionary(String dictionaryName)
Description copied from interface: IBroker
Removes a dictionary from the TypeBroker

Specified by:
removeDictionary in interface IBroker
Parameters:
dictionaryName - - a DataDictionary name
Returns:
true - if deleting the dictionary instance was successful, false otherwise

dictionaryIterator

public Iterator dictionaryIterator()
Description copied from interface: IBroker
Returns an iterator over the dictionaries in squence of insertion

Specified by:
dictionaryIterator in interface IBroker
Returns:
an Iterator

invalidateCache

public boolean invalidateCache(String dictionaryName)
Description copied from interface: IBroker
Invalidates the cache for the dictionary with the given name. The dictionary remains known to the TypeBroker.

Specified by:
invalidateCache in interface IBroker
Parameters:
dictionaryName - - the logical name of the dictionary
Returns:
true - if invalidating the cache was possible, false otherwise

getDataType

public IDataType getDataType(String dictionaryName,
                             String name)
                      throws DdException
Description copied from interface: IBroker
Returns a dataType with the given dictionaryName and type name. This can be an ISimpleType or an IStructure. The name is built of the name of the logical dictionary which contains this type and the package name: dictionaryName:packageName

Specified by:
getDataType in interface IBroker
Parameters:
dictionaryName - the name of the locical dictionary
name - - the type's name, includes package if necessary
Returns:
a dataType
Throws:
DdException - - if dataType with given name not found

getSimpleType

public ISimpleType getSimpleType(String dictionaryName,
                                 String name)
                          throws DdException
Description copied from interface: IBroker
Returns a simpleType with the given given dictionaryName and SimpleType name.

Specified by:
getSimpleType in interface IBroker
Parameters:
dictionaryName - the name of the loccal dictionary
name - - the type's name, includes package if necessary
Returns:
a simpleType
Throws:
DdException - - if SimpleType with given name not found

getStructure

public IStructure getStructure(String dictionaryName,
                               String name)
                        throws DdException
Description copied from interface: IBroker
Returns a structure with the given dictionary name and structure name.

Specified by:
getStructure in interface IBroker
Parameters:
dictionaryName - the name of the loccal dictionary
name - - the type's name, includes package if necessary
Returns:
a structure
Throws:
DdException - - if Structure with given name not found

getDataType

public IDataType getDataType(String name)
                      throws DdException
Description copied from interface: IBroker
Returns a dataType with the given type name whereas name contains of package and typeName. This can be an ISimpleType or an IStructure.

Specified by:
getDataType in interface IBroker
Parameters:
name - - the type's name, includes package
Returns:
a dataType
Throws:
DdException - - if dataType with given name not found

getUnitService

public IUnitService getUnitService(IField amountField)
                            throws DdException
Returns a unit service for the given amount type. If the amountType is not of builtInType decimal or the keyType is not one of the following SimpleTypes com.sap.dictionary.currency.currency com.sap.dictionary.currency.normalized_currency com.sap.dictionary.quantity.quantity com.sap.dictionary.quantity.normalized_quantity an DdException is thrown

Specified by:
getUnitService in interface IBroker
Parameters:
amountField - - the reference field
Returns:
a unit Service, as instance of DdCurrencyService or DdQuantityService
Throws:
DdException - - if unit Service could not be instantiated

getUnitService

public IUnitService getUnitService(IField amountField,
                                   boolean normalizingForced)
                            throws DdException
Description copied from interface: IBroker
Returns a unit service for the given amount field. In case no reference- field exists a DdException is thrown.

Specified by:
getUnitService in interface IBroker
Parameters:
amountField - - the reference field
normalizingForced - - true means the currency-values are always normalized during parse and denormalized during formatting, false means that the type controls wether normalization is done or not. Then in case of R/3 backend de/normalization will never be done
Returns:
a unit Service, as instance of DdCurrencyService or DdQuantityService
Throws:
DdException - - if unit Service could not be instantiated

getLocale

public Locale getLocale()
Description copied from interface: IBroker
Returns the TypeBroker's locale

Specified by:
getLocale in interface IBroker
Returns:
the locale

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(Class attributeClass)
Specified by:
getPredefinedSimpleType in interface IBroker

getPredefinedSimpleTypeByName

public ISimpleType getPredefinedSimpleTypeByName(String typeName)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(String value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(byte[] value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(Boolean value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(boolean value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(BigDecimal value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(BigInteger value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(Byte value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(Double value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(Float value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(Integer value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(Long value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(Short value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(byte value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(double value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(float value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(int value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(long value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(short value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(Date value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(Date value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(Time value)

getPredefinedSimpleType

public ISimpleType getPredefinedSimpleType(Timestamp value)

prepare

public void prepare(String dictionaryName,
                    String[] names)
             throws DdException
Throws:
DdException

getDataType

protected IDataType getDataType(IField field)
                         throws DdException
Throws:
DdException

getCurrencyService

public IUnitService getCurrencyService(ISimpleType amountType,
                                       boolean normalized,
                                       Locale locale)
                                throws DdException
Throws:
DdException

getQuantityService

public IUnitService getQuantityService(ISimpleType amountType,
                                       boolean normalized,
                                       Locale locale)
                                throws DdException
Throws:
DdException

getUnitService

public IUnitService getUnitService(ISimpleType amountType,
                                   ISimpleType unitKeyType)
                            throws DdException
Throws:
DdException


Copyright 2006 SAP AG Complete Copyright Notice