Class EffigyFactory

    • Method Detail

      • canCreateBlankEffigy

        public boolean canCreateBlankEffigy()
        Return true if this effigy factory is capable of creating an effigy without a URL being specified. That is, it is capable of creating a blank effigy with no model data. In this base class, this method returns true if at least one contained effigy factory returns true.
        Returns:
        True if this factory can create a blank effigy.
      • checkForDTD

        public static boolean checkForDTD​(java.net.URL input,
                                          java.lang.String dtdStart,
                                          java.lang.String dtdEndRegExp)
                                   throws java.io.IOException
        Check the URL input for a DTD. Only the first 5 lines are read from the URL. Any text that matches <?xml.*?> is removed before checking.
        Parameters:
        input - The DTD to check.
        dtdStart - The start of the DTD, typically "<!DOCTYPE".
        dtdEndRegExp - The optional ending regular expression. If this parameter is null, then it is ignored.
        Returns:
        True if the input starts with dtdStart and, if dtdEndRegExp is non-null, ends with dtdEndRegExp.
        Throws:
        java.io.IOException - if there is a problem opening or reading the input.
      • createEffigy

        public Effigy createEffigy​(CompositeEntity container)
                            throws java.lang.Exception
        Create a new blank effigy in the given container. This base class defers to each contained effigy factory until one returns an effigy. If there are no contained effigies, or if none returns an effigy, then this method returns null. Subclasses will override this method to create an effigy of an appropriate type.
        Parameters:
        container - The container for the effigy.
        Returns:
        A new effigy.
        Throws:
        java.lang.Exception - If the effigy created by one of the contained factories is incompatible with the specified container, or a name duplication occurs.
      • createEffigy

        public Effigy createEffigy​(CompositeEntity container,
                                   java.net.URL base,
                                   java.net.URL in)
                            throws java.lang.Exception
        Create a new effigy in the given container by reading the specified URL. If the specified URL is null, then create a blank effigy. The specified base is used to expand any relative file references within the URL. This base class defers to each contained effigy factory until one returns an effigy. If there are no contained effigies, or if none returns an effigy, then this method returns null. Subclasses will override this method to create an effigy of an appropriate type.
        Parameters:
        container - The container for the effigy.
        base - The base for relative file references, or null if there are no relative file references.
        in - The input URL.
        Returns:
        A new effigy.
        Throws:
        java.lang.Exception - If the stream cannot be read, or if the data is malformed in some way.
      • getExtension

        public static java.lang.String getExtension​(java.net.URL url)
        Return the extension on the name of the specified URL. This is a utility method designed to help derived classes decide whether the URL matches the particular type of effigy they can create. If the URL has no extension, return an empty string.
        Parameters:
        url - A URL.
        Returns:
        The extension on the URL.