Class AppCmd


  • public class AppCmd
    extends Object
    IIS AppCmd utility support class.
    • Constructor Detail

      • AppCmd

        public AppCmd​(Path path)
        Creates a new instance of AppCmd utility support class for the provided utility location path.
        Parameters:
        path - the utility location path, cannot be null
    • Method Detail

      • find

        public static Optional<AppCmd> find()
        Finds and returns local installed system AppCmd utility. May not find ulitily in some cases:
        • If environment variable %systemroot% is not exist.
        • If the system AppCmd utility is not installed.
        • If the system AppCmd utility is not executable.
        Returns:
        an optional of local installed system AppCmd utility
      • addApplication

        public void addApplication​(String name,
                                   Path location)
                            throws IOException
        Registers a web application with the provided name and location.
        Parameters:
        name - the application name, cannot be null
        location - the application location, cannot be null
        Throws:
        IOException - if utility result read error occurred
      • editApplication

        public void editApplication​(String oldName,
                                    String newName,
                                    Path location)
                             throws IOException
        Edits a web application with the provided name.
        Parameters:
        oldName - the old application name, cannot be null
        newName - the new application name, cannot be null
        location - the application location, cannot be null
        Throws:
        IOException - if utility result read error occurred
      • containsApplication

        public boolean containsApplication​(String name)
                                    throws IOException
        Returns whether an application with the provided name is registered.
        Parameters:
        name - the application name, cannot be null
        Returns:
        whether an application with the provided name is registered
        Throws:
        IOException - if utility result read error occurred
      • configureApplicationWebExtension

        public void configureApplicationWebExtension​(String name,
                                                     Path webExtension)
                                              throws IOException
        Configures the path to the registered 1C:Enterprise web extension component for an application with the provided name.
        Parameters:
        name - the application name, cannot be null
        webExtension - the location of the 1C:Enterprise web extension component, cannot be null
        Throws:
        IOException - if utility result read error occurred
      • getApplicationConfiguredWebExtension

        public Optional<Path> getApplicationConfiguredWebExtension​(String name)
                                                            throws IOException
        Returns a path to the registered 1C:Enterprise web extension component for an application with the provided name.
        Parameters:
        name - the application name, cannot be null
        Returns:
        a path to the registered 1C:Enterprise web extension component for an application with the provided name
        Throws:
        IOException - if utility result read error occurred
      • getAllApplicationNames

        public List<String> getAllApplicationNames()
                                            throws IOException
        Returns a collection of all registered web applications.
        Returns:
        a collection of all registered web applications
        Throws:
        IOException - if utility result read error occurred
      • getApplicationUrl

        public Optional<URL> getApplicationUrl​(String name)
                                        throws IOException
        Returns an URL of the application with the provided name.
        Parameters:
        name - the application name, cannot be null
        Returns:
        an URL of the application with the provided name
        Throws:
        IOException - if utility result read error occurred
      • getApplicationWebPath

        public Optional<String> getApplicationWebPath​(String name)
                                               throws IOException
        Returns an application web path for the registered application with the provided name.
        Parameters:
        name - the application name, cannot be null
        Returns:
        an application web path for the registered application with the provided name
        Throws:
        IOException - if utility result read error occurred
      • getApplicationLocationPath

        public Optional<Path> getApplicationLocationPath​(String name)
                                                  throws IOException
        Returns an application physical locaion path for the registered application with the provided name.
        Parameters:
        name - the application name, cannot be null
        Returns:
        an application physical locaion path for the registered application with the provided name
        Throws:
        IOException - if utility result read error occurred
      • removeApplication

        public void removeApplication​(String name)
                               throws IOException
        Removes a web application with the provided name.
        Parameters:
        name - the application name, cannot be null
        Throws:
        IOException - if utility result read error occurred
      • getWebExtensions

        public List<Path> getWebExtensions()
                                    throws IOException
        Returns a collection of all registered 1C:Enterprise web extension component locations.
        Returns:
        a collection of all registered 1C:Enterprise web extension component locations
        Throws:
        IOException - if utility result read error occurred
      • addWebExtension

        public void addWebExtension​(Path location)
                             throws IOException
        Register 1C:Enterprise web extension component with the provided location.
        Parameters:
        location - the application location, cannot be null
        Throws:
        IOException - if utility result read error occurred
      • setApplicationDefaultDocument

        public void setApplicationDefaultDocument​(String name,
                                                  String documentName)
                                           throws IOException
        Sets the default document name for the application with the provided name.
        Parameters:
        name - the application name, cannot be null
        documentName - the document name, cannot be null
        Throws:
        IOException - if utility result read error occurred
      • hasApplicationDefaultDocument

        public boolean hasApplicationDefaultDocument​(String name,
                                                     String documentName)
                                              throws IOException
        Returns whether the application with the provided name has the default document with the provided name.
        Parameters:
        name - the application name, cannot be null
        documentName - the document name, cannot be null
        Returns:
        whether the application with the provided name has the default document with the provided name
        Throws:
        IOException - if utility result read error occurred