Skip navigation links

Oracle® OLAP Java API Reference
11g Release 1 (11.1)

B28128-01


oracle.olapi
Interface HasLocalizedMessage

All Known Implementing Classes:
ActiveSubtransactionsException, CommitException, CommitWarningsException, CursorLockException, CursorManagerSpecificationExpiredException, DataProviderMismatchException, DeploymentException, DuplicateMetadataIDException, ErrorDescription, ErrorStack, ExpressNotCommittableException, ExpressServerException, ExpressUnsupportedFeatureException, IncorrectDataValueException, IncrementalChangeException, InvalidMetadataException, MetadataFactoryException, MetadataModificationException, MetadataUpdateNotSupportedException, NotCommittableException, NotPreparedException, ObjectClosedException, OLAPIException, OLAPIIllegalStateException, OLAPIRuntimeException, ServerVersionException, SyntaxException, TaskInterruptedException, TransactionalObjectInvalidException, TransactionInactiveException, TransactionTypeUnavailableException, UnexpectedException, UnmatchedInputsException, UnsupportedOperationException, WriteLockException

public interface HasLocalizedMessage

An interface for an Exception that can provide its message in a language that is appropriate to a specified Locale. This interface is implemented by Exception classes that are generated by the OLAP API client software, not by those generated by the server-side software.

To find out if an Exception implements this interface, use the instanceof operator.

The following code illustrates the use of the getLocalizedMessage method. The example creates a Locale object, and then tries to create an MdmValueHierarchy. The mdmDim object is an MdmPrimaryDimension that has mdmLevelHier as one of its MdmLevelHierarchy components. If mdmLevelHier is mapped to a solved level hierarchy, then the operation succeeds. If it is mapped to an unsolved level hierarchy, then the createValueHierarchy method throws a MetadataFactoryException.

  // Specify a Locale.
 Locale myLocale = new Locale("fr", "CA");
 
 try
 {
   MdmValueHierarchy mdmValHier = mdmDim.createValueHierarchy("ValueHier",
                                                               mdmLevelHier);
 }
 catch (Exception e)
 {
   String msg = null;
   if (e instanceof HasLocalizedMessage) 
   {
      // Get the localized message.
      msg = ((HasLocalizedMessage) e).getLocalizedMessage(myLocale);
   }
   else
   {
     // Use the default Locale.
     msg = e.getLocalizedMessage(); 
   }
   // Handle the exception.
 } 

You can also use the toString method, instead of the getLocalizedMessage method, to get the message from an Exception in the language of the default Locale for the Java Virtual Machine in which the OLAP API application is running, as in the following.

 System.err.println(e.toString());

Method Summary
 java.lang.String getLocalizedMessage(java.util.Locale locale)
          Gets a message in the language of the specified Locale.

 

Method Detail

getLocalizedMessage

java.lang.String getLocalizedMessage(java.util.Locale locale)
Gets a message in the language of the specified Locale.
Parameters:
locale - A Locale object, which indicates the language in which the message should be rendered.
Returns:
A String that contains the message for this Exception. The message is in the language of the specified Locale.

Skip navigation links

Copyright © 2002, 2007, Oracle. All rights reserved.