Class RAConfig
- java.lang.Object
-
- org.ow2.joram.jakarta.connector.utils.RAConfig
-
public class RAConfig extends Object
This class allows to handle the RA configuration file.
-
-
Field Summary
Fields Modifier and Type Field Description private static StringA3SERVERS_XMLprivate static intBUFFER_SIZEprivate static StringconfDirprivate static booleandebugprivate static StringJORAMADMIN_CFGprivate static StringJORAMADMIN_XMLprivate static StringRA_PROPERTIESprivate static StringRA_XMLprivate static StringtmpDirprivate static booleanverbose
-
Constructor Summary
Constructors Modifier Constructor Description privateRAConfig()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleancopy(String file1, String file2)private voidcreateFile(String path, InputStream is)create the filename in the tmp directory by writing the input stream in the file name.private voidcreateFile(String path, String input)create the filename in the tmp directory, by writing the input in the file name.private voidcreateRaProperties(String rarName)create ra.properties build from the ra.xml file from RAR.private voiddump(InputStream is, OutputStream os)write the inputstream in outputstream.private InputStreamextractFromJAR(String fileName, InputStream reader)Extract fileName from the JAR file.private voidextractFromJAR(String jarName, String fileName)Extract config files from the JAR file.private voidextractFromRAR(String rarName, String fileName)Extract the fileName from the RAR file.private StringgetFileName(String path)static voidmain(String[] args)private Stringparse(InputStream is)parse input stream.private Stringupdate(InputStream is, Map map)update input stream with map value.private voidupdateA3Servers(String rarName, String hostName, String port, short serverId)update A3SERVERS_XML fileprivate voidupdateHostPort(String rarName, String hostName, String port, short serverId)update host/port in ra.xml and a3server.xml in RAR.private voidupdateJoramAdminCfg(String hostName, String port)private voidupdateJoramAdminXml(String hostName, String port)private voidupdateRAR(String raProperties, boolean updateA3servers)update RA_XML fileprivate voidupdateRootName(String rarName, String rootName, String rootPasswd, String identityClass)update host/port in ra.xml and a3server.xml in RAR.private voidupdateZIP(String zipName, String path, String newFileName, String oldFileName)Update the RAR filestatic voidusage()Usage of RAConfig.
-
-
-
Field Detail
-
RA_XML
private static final String RA_XML
- See Also:
- Constant Field Values
-
A3SERVERS_XML
private static final String A3SERVERS_XML
- See Also:
- Constant Field Values
-
RA_PROPERTIES
private static final String RA_PROPERTIES
- See Also:
- Constant Field Values
-
JORAMADMIN_CFG
private static final String JORAMADMIN_CFG
- See Also:
- Constant Field Values
-
JORAMADMIN_XML
private static final String JORAMADMIN_XML
- See Also:
- Constant Field Values
-
BUFFER_SIZE
private static final int BUFFER_SIZE
- See Also:
- Constant Field Values
-
debug
private static boolean debug
-
verbose
private static boolean verbose
-
confDir
private static String confDir
-
tmpDir
private static String tmpDir
-
-
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 namefileName- 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 namereader- 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 namefileName- 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 streamos- 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 fileis- 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 fileinput- string to write- Throws:
Exception- to throw if an Exception occurs
-
parse
private String parse(InputStream is) throws Exception
parse input stream.- Parameters:
is- input stream- 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 streammap- 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 namehostName- new host nameport- new portserverId- 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 namerootName- new root namerootPasswd- new RootPasswdidentityClass- new IdentityClassserverId- 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 namehostName- new host nameport- new portserverId- server Id- Throws:
Exception
-
updateJoramAdminCfg
private void updateJoramAdminCfg(String hostName, String port) throws Exception
- Throws:
Exception
-
updateJoramAdminXml
private void updateJoramAdminXml(String hostName, String port) throws Exception
- 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 filepath- path in JAR or RAR filenewFileName- add new filenameoldFileName- remove old file from JAR or RAR- Throws:
Exception
-
-