Package com.zeroc.Ice

Class Util

java.lang.Object
com.zeroc.Ice.Util

public final class Util extends Object
Utility methods for the Ice run time.
  • Field Details

  • Constructor Details

    • Util

      public Util()
  • Method Details

    • createProperties

      public static Properties createProperties()
      Creates a new empty property set.
      Returns:
      A new empty property set.
    • createProperties

      public static Properties createProperties(String[] args)
      Creates a property set initialized from an argument vector.
      Parameters:
      args - A command-line argument vector, possibly containing options to set properties. If the command-line options include a --Ice.Config option, the corresponding configuration files are parsed. If the same property is set in a configuration file and in the argument vector, the argument vector takes precedence.
      Returns:
      A new property set initialized with the property settings that were removed from the argument vector.
    • createProperties

      public static Properties createProperties(String[] args, List<String> remainingArgs)
      Creates a property set initialized from an argument vector and return the remaining arguments.
      Parameters:
      args - A command-line argument vector, possibly containing options to set properties. If the command-line options include a --Ice.Config option, the corresponding configuration files are parsed. If the same property is set in a configuration file and in the argument vector, the argument vector takes precedence.
      remainingArgs - If non null, the given list will contain on return the command-line arguments that were not used to set properties.
      Returns:
      A new property set initialized with the property settings that were removed from the argument vector.
    • createProperties

      public static Properties createProperties(String[] args, Properties defaults)
      Creates a property set initialized from an argument vector.
      Parameters:
      args - A command-line argument vector, possibly containing options to set properties. If the command-line options include a --Ice.Config option, the corresponding configuration files are parsed. If the same property is set in a configuration file and in the argument vector, the argument vector takes precedence.
      defaults - Default values for the property set. Settings in configuration files and args override these defaults.
      Returns:
      A new property set initialized with the property settings that were removed from the argument vector.
    • createProperties

      public static Properties createProperties(String[] args, Properties defaults, List<String> remainingArgs)
      Creates a property set initialized from an argument vector and return the remaining arguments.
      Parameters:
      args - A command-line argument vector, possibly containing options to set properties. If the command-line options include a --Ice.Config option, the corresponding configuration files are parsed. If the same property is set in a configuration file and in the argument vector, the argument vector takes precedence.
      defaults - Default values for the property set. Settings in configuration files and args override these defaults.
      remainingArgs - If non null, the given list will contain on return the command-line arguments that were not used to set properties.
      Returns:
      A new property set initialized with the property settings that were removed from the argument vector.
    • initialize

      public static Communicator initialize()
      Creates a communicator using a default configuration.
      Returns:
      A new communicator instance.
    • initialize

      public static Communicator initialize(String[] args)
      Creates a communicator.
      Parameters:
      args - A command-line argument vector. Any Ice-related options in this vector are used to initialize the communicator.
      Returns:
      The new communicator.
    • initialize

      public static Communicator initialize(String[] args, List<String> remainingArgs)
      Creates a communicator.
      Parameters:
      args - A command-line argument vector. Any Ice-related options in this vector are used to initialize the communicator.
      remainingArgs - If non null, the given list will contain on return the command-line arguments that were not used to set properties.
      Returns:
      The new communicator.
    • initialize

      public static Communicator initialize(InitializationData initData)
      Creates a communicator.
      Parameters:
      initData - Additional initialization data.
      Returns:
      The new communicator.
    • initialize

      public static Communicator initialize(String[] args, InitializationData initData)
      Creates a communicator.
      Parameters:
      args - A command-line argument vector. Any Ice-related options in this vector are used to initialize the communicator.
      initData - Additional initialization data.
      Returns:
      The new communicator.
    • initialize

      public static Communicator initialize(String[] args, String configFile)
      Creates a communicator.
      Parameters:
      args - A command-line argument vector. Any Ice-related options in this vector are used to initialize the communicator.
      configFile - Path to a config file that sets the new communicator's default properties.
      Returns:
      The new communicator.
    • initialize

      public static Communicator initialize(String[] args, InitializationData initData, List<String> remainingArgs)
      Creates a communicator.
      Parameters:
      args - A command-line argument vector. Any Ice-related options in this vector are used to initialize the communicator.
      initData - Additional initialization data. Property settings in args override property settings in initData.
      remainingArgs - If non null, the given list will contain on return the command-line arguments that were not used to set properties.
      Returns:
      The new communicator.
      See Also:
    • initialize

      public static Communicator initialize(String[] args, String configFile, List<String> remainingArgs)
      Creates a communicator.
      Parameters:
      args - A command-line argument vector. Any Ice-related options in this vector are used to initialize the communicator.
      configFile - Path to a config file that sets the new communicator's default properties.
      remainingArgs - If non null, the given list will contain on return the command-line arguments that were not used to set properties.
      Returns:
      The new communicator.
    • stringToIdentity

      public static Identity stringToIdentity(String s)
      Converts a string to an object identity.
      Parameters:
      s - The string to convert.
      Returns:
      The converted object identity.
    • identityToString

      public static String identityToString(Identity ident, ToStringMode toStringMode)
      Converts an object identity to a string.
      Parameters:
      ident - The object identity to convert.
      toStringMode - Specifies if and how non-printable ASCII characters are escaped in the result.
      Returns:
      The string representation of the object identity.
    • identityToString

      public static String identityToString(Identity ident)
      Converts an object identity to a string.
      Parameters:
      ident - The object identity to convert.
      Returns:
      The string representation of the object identity using the default mode (Unicode)
    • proxyIdentityCompare

      public static int proxyIdentityCompare(ObjectPrx lhs, ObjectPrx rhs)
      Compares the object identities of two proxies.
      Parameters:
      lhs - A proxy.
      rhs - A proxy.
      Returns:
      -1 if the identity in lhs compares less than the identity in rhs; 0 if the identities compare equal; 1, otherwise.
      See Also:
    • proxyIdentityAndFacetCompare

      public static int proxyIdentityAndFacetCompare(ObjectPrx lhs, ObjectPrx rhs)
      Compares the object identities and facets of two proxies.
      Parameters:
      lhs - A proxy.
      rhs - A proxy.
      Returns:
      -1 if the identity and facet in lhs compare less than the identity and facet in rhs; 0 if the identities and facets compare equal; 1, otherwise.
      See Also:
    • getProcessLogger

      public static Logger getProcessLogger()
      Returns the process-wide logger.
      Returns:
      The process-wide logger.
    • setProcessLogger

      public static void setProcessLogger(Logger logger)
      Changes the process-wide logger.
      Parameters:
      logger - The new process-wide logger.
    • stringVersion

      public static String stringVersion()
      Returns the Ice version in the form A.B.C, where A indicates the major version, B indicates the minor version, and C indicates the patch level.
      Returns:
      The Ice version.
    • intVersion

      public static int intVersion()
      Returns the Ice version as an integer in the form A.BB.CC, where A indicates the major version, BB indicates the minor version, and CC indicates the patch level. For example, for Ice 3.3.1, the returned value is 30301.
      Returns:
      The Ice version.
    • stringToProtocolVersion

      public static ProtocolVersion stringToProtocolVersion(String version)
      Converts a string to a protocol version.
      Parameters:
      version - The string to convert.
      Returns:
      The converted protocol version.
    • stringToEncodingVersion

      public static EncodingVersion stringToEncodingVersion(String version)
      Converts a string to an encoding version.
      Parameters:
      version - The string to convert.
      Returns:
      The converted encoding version.
    • protocolVersionToString

      public static String protocolVersionToString(ProtocolVersion v)
      Converts a protocol version to a string.
      Parameters:
      v - The protocol version to convert.
      Returns:
      The converted string.
    • encodingVersionToString

      public static String encodingVersionToString(EncodingVersion v)
      Converts an encoding version to a string.
      Parameters:
      v - The encoding version to convert.
      Returns:
      The converted string.
    • currentProtocol

      public static ProtocolVersion currentProtocol()
      Returns the supported Ice protocol version.
      Returns:
      The Ice protocol version.
    • currentEncoding

      public static EncodingVersion currentEncoding()
      Returns the supported Ice encoding version.
      Returns:
      The Ice encoding version.
    • getInvocationFuture

      public static <T> InvocationFuture<T> getInvocationFuture(CompletableFuture<T> f)
      Returns the InvocationFuture equivalent of the given CompletableFuture.
      Type Parameters:
      T - The result type.
      Parameters:
      f - The CompletableFuture returned by an asynchronous Ice proxy invocation.
      Returns:
      The InvocationFuture object.
    • typeIdToClass

      public static String typeIdToClass(String id)
      Translates a Slice type id to a Java class name.
      Parameters:
      id - The Slice type id, such as ::Module::Type.
      Returns:
      The equivalent Java class name, or null if the type id is malformed.