Class RAConfig


  • public class RAConfig
    extends Object
    This class allows to handle the RA configuration file.
    • Constructor Detail

      • RAConfig

        private RAConfig()
    • Method Detail

      • usage

        public static void usage()
        Usage of RAConfig.
      • createRaProperties

        private void createRaProperties​(String rarName)
                                 throws Exception
        create ra.properties build from the ra.xml file from RAR.
        Parameters:
        rarName - String input RAR file name
        Throws:
        Exception - to throw if an Exception occurs
      • extractFromRAR

        private void extractFromRAR​(String rarName,
                                    String fileName)
                             throws Exception
        Extract the fileName from the RAR file.
        Parameters:
        rarName - RAR file name
        fileName - file name
        Throws:
        Exception - to throw if an Exception occurs
      • extractFromJAR

        private InputStream extractFromJAR​(String fileName,
                                           InputStream reader)
                                    throws Exception
        Extract fileName from the JAR file.
        Parameters:
        fileName - file name
        reader - Input stream
        Throws:
        Exception - to throw if an Exception occurs
      • extractFromJAR

        private void extractFromJAR​(String jarName,
                                    String fileName)
                             throws Exception
        Extract config files from the JAR file.
        Parameters:
        jarName - JAR file name
        fileName - file to be extract
        Throws:
        Exception - to throw if an Exception occurs
      • dump

        private void dump​(InputStream is,
                          OutputStream os)
                   throws Exception
        write the inputstream in outputstream.
        Parameters:
        is - input stream
        os - output stream
        Throws:
        Exception - to throw if an Exception occurs
      • createFile

        private void createFile​(String path,
                                InputStream is)
                         throws Exception
        create the filename in the tmp directory by writing the input stream in the file name.
        Parameters:
        path - new file
        is - input stream
        Throws:
        Exception - to throw if an Exception occurs
      • createFile

        private void createFile​(String path,
                                String input)
                         throws Exception
        create the filename in the tmp directory, by writing the input in the file name.
        Parameters:
        path - new file
        input - string to write
        Throws:
        Exception - to throw if an Exception occurs
      • update

        private String update​(InputStream is,
                              Map map)
                       throws Exception
        update input stream with map value.
        Parameters:
        is - input stream
        map - map value (see ra.properties)
        Throws:
        Exception - to throw if an Exception occurs
      • updateHostPort

        private void updateHostPort​(String rarName,
                                    String hostName,
                                    String port,
                                    short serverId)
                             throws Exception
        update host/port in ra.xml and a3server.xml in RAR.
        Parameters:
        rarName - rar file name
        hostName - new host name
        port - new port
        serverId - server Id
        Throws:
        Exception
      • updateRootName

        private void updateRootName​(String rarName,
                                    String rootName,
                                    String rootPasswd,
                                    String identityClass)
                             throws Exception
        update host/port in ra.xml and a3server.xml in RAR.
        Parameters:
        rarName - rar file name
        rootName - new root name
        rootPasswd - new RootPasswd
        identityClass - new IdentityClass
        serverId - server Id
        Throws:
        Exception
      • updateA3Servers

        private void updateA3Servers​(String rarName,
                                     String hostName,
                                     String port,
                                     short serverId)
                              throws Exception
        update A3SERVERS_XML file
        Parameters:
        rarName - rar file name
        hostName - new host name
        port - new port
        serverId - server Id
        Throws:
        Exception
      • updateRAR

        private void updateRAR​(String raProperties,
                               boolean updateA3servers)
                        throws Exception
        update RA_XML file
        Parameters:
        raProperties - ra.properties file
        Throws:
        Exception
      • updateZIP

        private void updateZIP​(String zipName,
                               String path,
                               String newFileName,
                               String oldFileName)
                        throws Exception
        Update the RAR file
        Parameters:
        zipName - String JAR or RAR file
        path - path in JAR or RAR file
        newFileName - add new filename
        oldFileName - remove old file from JAR or RAR
        Throws:
        Exception