Java Doc for AbstractPostgreSQLBackuper.java in  » Database-JDBC-Connection-Pool » sequoia-2.10.9 » org » continuent » sequoia » controller » backup » backupers » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » sequoia 2.10.9 » org.continuent.sequoia.controller.backup.backupers 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.continuent.sequoia.controller.backup.backupers.AbstractBackuper
      org.continuent.sequoia.controller.backup.backupers.AbstractPostgreSQLBackuper

All known Subclasses:   org.continuent.sequoia.controller.backup.backupers.PostgreSQLTarBackuper,  org.continuent.sequoia.controller.backup.backupers.PostgreSQLBinaryBackuper,  org.continuent.sequoia.controller.backup.backupers.PostgreSQLSplitPlainTextBackuper,  org.continuent.sequoia.controller.backup.backupers.PostgreSQLPlainTextBackuper,
AbstractPostgreSQLBackuper
abstract public class AbstractPostgreSQLBackuper extends AbstractBackuper (Code)
This abstract class provides base methods for PostgreSQL backupers.

Currently the Backupers takes 5 parameters (all are optional):

  • bindir: path to PostgreSQL binaries (if not set, the commands are searched in the path)
  • encoding: the encoding of the database that is created upon restore
  • authentication: flag to use PostgreSQL authentication (default false)
  • dumpServer: address of interface to offer dumps
  • preRestoreScript: location of script to run before restoring
  • postRestoreScript: location of script to run after restoring
  • dumpTimeout: Timeout period (seconds) while performing DB dump.
  • restoreTimeout: Timeout period (seconds) while performin DB restore.
  • pgDumpFlags: Extra pg_dump command-line options to use while performing DB dump.
More options can be easily added. This class makes calls to the pg_dump, createdb, dropdb, psql and pg_restore commands.
author:
   Dylan Hansen
author:
   Mathieu Peltier
version:
   1.1

Inner Class :protected class PostgreSQLUrlInfo

Field Summary
protected static  StringbinDir
    
protected static  StringdumpServer
    
protected static  StringdumpTimeout
    
protected static  Stringencoding
    
static  TraceendUserLogger
    
protected  NativeCommandExecnativeCmdExec
    
protected static  StringpgDumpFlags
    
protected static  StringpostRestoreScript
    
protected static  StringpreRestoreScript
    
protected static  StringrestoreTimeout
    
protected static  StringsplitSize
    
protected static  booleanuseAuthentication
    

Constructor Summary
public  AbstractPostgreSQLBackuper()
    

Method Summary
public  voiddeleteDump(String path, String dumpName)
    
protected  intexecuteNativeCommand(String[] stdinFeed, String[] commands)
     Executes a native operating system command with a standard-input feed.
protected  intexecuteNativeCommand(String command)
     Executes a native operating system command, which currently are one of: - psql - dropdb - createdb - pg_dump - pg_restore Output of these commands is captured and logged.
protected  intexecuteNativeCommand(String[] commands)
     Executes a native operating system command, which currently are one of:
 - psql
 - dropdb
 - createdb
 - pg_dump
 - pg_restore
 
Output of these commands is captured and logged.
protected  intgetDefaultPort()
    
protected  StringgetDumpPhysicalPath(String path, String dumpName)
    
protected  StringgetJdbcUrlPrefix()
    
public  StringgetOptions()
    
protected  StringgetPsqlCommand()
    
protected  StringmakeCommand(String command, PostgreSQLUrlInfo info, String options, String login)
     Creates a command string based on given info.
protected  String[]makeCommandWithAuthentication(String command, PostgreSQLUrlInfo info, String options, String login, String password, boolean isPsql)
     Creates a command String array used my exec().
protected  String[]makeExpectCommandReadingStdin()
     Creates a expect command reading the expect-script from standard-input. Hours of experiments has shown that the only reliable way of programatically invoking expect with an expect-script, is via stdin or explicit script-file.
protected  String[]makeExpectDialogueWithAuthentication(String command, PostgreSQLUrlInfo info, String options, String login, String password, int timeout)
     Creates an expect dialogue String array to be used as stadard input to a "expect" command, used to pass the password parameter to the command being run, thus allowing PostgreSQL to allow authentication.
protected  String[]makeSplitCommand(String command, PostgreSQLUrlInfo info, String options, String login)
     Creates a Splitted command string based on given info.
protected  String[]makeSplitCommandWithAuthentication(String command, PostgreSQLUrlInfo info, String options, String login, String password, boolean isPsql)
     Creates a Splitted command String array used my exec().
protected  voidprintErrors()
     Prints contents of error output (stderr).
protected  voidprintOutput()
     Prints contents of regular output (stdout).
protected  booleansafelyExecNativeCommand(String cmd, String[] inputArray, int timeout)
     Execute a native command with careful logging of output and errors.
protected  booleansafelyExecNativeCommand(String[] cmds, String[] inputArray, int timeout)
     Execute a native command with careful logging of output and errors.
public  voidsetOptions(String options)
    

Field Detail
binDir
protected static String binDir(Code)



dumpServer
protected static String dumpServer(Code)



dumpTimeout
protected static String dumpTimeout(Code)



encoding
protected static String encoding(Code)



endUserLogger
static Trace endUserLogger(Code)
end user logger



nativeCmdExec
protected NativeCommandExec nativeCmdExec(Code)



pgDumpFlags
protected static String pgDumpFlags(Code)



postRestoreScript
protected static String postRestoreScript(Code)



preRestoreScript
protected static String preRestoreScript(Code)



restoreTimeout
protected static String restoreTimeout(Code)



splitSize
protected static String splitSize(Code)



useAuthentication
protected static boolean useAuthentication(Code)




Constructor Detail
AbstractPostgreSQLBackuper
public AbstractPostgreSQLBackuper()(Code)
Creates a new AbstractPostgreSQLBackuper object




Method Detail
deleteDump
public void deleteDump(String path, String dumpName) throws BackupException(Code)

See Also:   org.continuent.sequoia.controller.backup.Backuper.deleteDump(java.lang.Stringjava.lang.String)



executeNativeCommand
protected int executeNativeCommand(String[] stdinFeed, String[] commands) throws IOException, InterruptedException(Code)
Executes a native operating system command with a standard-input feed. The commands are supposed to be one of the Postgres-utilities psql - dropdb - createdb - pg_dump - pg_restore. Output of the command is captured and logged.
Parameters:
  stdinFeed - Array of input strings
Parameters:
  commands - Array of strings (command + args) to execute 0 if successful, any number otherwise
throws:
  IOException -
throws:
  InterruptedException -



executeNativeCommand
protected int executeNativeCommand(String command) throws IOException, InterruptedException(Code)
Executes a native operating system command, which currently are one of: - psql - dropdb - createdb - pg_dump - pg_restore Output of these commands is captured and logged.
Parameters:
  command - String of command to execute 0 if successful, any number otherwise
throws:
  IOException -
throws:
  InterruptedException -



executeNativeCommand
protected int executeNativeCommand(String[] commands) throws IOException, InterruptedException(Code)
Executes a native operating system command, which currently are one of:
 - psql
 - dropdb
 - createdb
 - pg_dump
 - pg_restore
 
Output of these commands is captured and logged.
Parameters:
  commands - String array of command to execute 0 if successful, any number otherwise
throws:
  IOException -
throws:
  InterruptedException -



getDefaultPort
protected int getDefaultPort()(Code)



getDumpPhysicalPath
protected String getDumpPhysicalPath(String path, String dumpName)(Code)
Get the dump physical path from its logical name
Parameters:
  path - the path where the dump is stored
Parameters:
  dumpName - dump logical name path to dump file



getJdbcUrlPrefix
protected String getJdbcUrlPrefix()(Code)



getOptions
public String getOptions()(Code)

See Also:   Backuper.getOptions



getPsqlCommand
protected String getPsqlCommand()(Code)



makeCommand
protected String makeCommand(String command, PostgreSQLUrlInfo info, String options, String login)(Code)
Creates a command string based on given info. Will append binDir if supplied.
Parameters:
  command - Command to execute
Parameters:
  info - URL info to parse and create parameters
Parameters:
  options - Additional parameters
Parameters:
  login - User login String containing full command to run



makeCommandWithAuthentication
protected String[] makeCommandWithAuthentication(String command, PostgreSQLUrlInfo info, String options, String login, String password, boolean isPsql)(Code)
Creates a command String array used my exec(). This method uses the "expect" command to pass the password parameter to the command being run, thus allowing PostgreSQL to allow authentication. Also uses binDir if supplied. Note the "psql" command has different output needed by "expect" than other commands.
Parameters:
  command - Command to execute
Parameters:
  info - URL info to parse adn add parameters
Parameters:
  options - Additional parameters
Parameters:
  login - User login
Parameters:
  password - User password
Parameters:
  isPsql - Is the command being run a psql command? String array containing full command to run



makeExpectCommandReadingStdin
protected String[] makeExpectCommandReadingStdin()(Code)
Creates a expect command reading the expect-script from standard-input. Hours of experiments has shown that the only reliable way of programatically invoking expect with an expect-script, is via stdin or explicit script-file. The expect "-c command" option simply does not work the same way, and do cause a lot of problems. String array containing full command to run



makeExpectDialogueWithAuthentication
protected String[] makeExpectDialogueWithAuthentication(String command, PostgreSQLUrlInfo info, String options, String login, String password, int timeout)(Code)
Creates an expect dialogue String array to be used as stadard input to a "expect" command, used to pass the password parameter to the command being run, thus allowing PostgreSQL to allow authentication. Also uses binDir if supplied. Note that the "psql" command has different password promting than other Postgres utilities. This expect-dialogue do a much better job at detecting errors than the detection you get when using makeCommandWithAuthentication() and executeNativeCommand(). Above all, it will report failure if the PG- command never promts for a password. Secondly, it will report failure if the invoked command exits with a non-zero exit-status.
Parameters:
  command - Command to execute
Parameters:
  info - URL info to parse adn add parameters
Parameters:
  options - Additional parameters
Parameters:
  login - User login
Parameters:
  password - User password
Parameters:
  timeout - Is the command being run a psql command? String array containing full Expect dialogue



makeSplitCommand
protected String[] makeSplitCommand(String command, PostgreSQLUrlInfo info, String options, String login)(Code)
Creates a Splitted command string based on given info. Will append BINDIR if supplied.
Parameters:
  command - Command to execute
Parameters:
  info - URL info to parse and create parameters
Parameters:
  options - Additional parameters
Parameters:
  login - User login String containing full command to run



makeSplitCommandWithAuthentication
protected String[] makeSplitCommandWithAuthentication(String command, PostgreSQLUrlInfo info, String options, String login, String password, boolean isPsql)(Code)
Creates a Splitted command String array used my exec(). This method uses the "expect" command to pass the password parameter to the command being run, thus allowing PostgreSQL to allow authentication. Also uses BINDIR if supplied. Note the "psql" command has different output needed by "expect" than other commands.
Parameters:
  command - Command to execute
Parameters:
  info - URL info to parse adn add parameters
Parameters:
  options - Additional parameters
Parameters:
  login - User login
Parameters:
  password - User password
Parameters:
  isPsql - Is the command being run a psql command? String array containing full command to run



printErrors
protected void printErrors()(Code)
Prints contents of error output (stderr).



printOutput
protected void printOutput()(Code)
Prints contents of regular output (stdout).



safelyExecNativeCommand
protected boolean safelyExecNativeCommand(String cmd, String[] inputArray, int timeout)(Code)
Execute a native command with careful logging of output and errors.
Parameters:
  cmd - Command to execute
Parameters:
  inputArray - Array of input lines
Parameters:
  timeout - Timeout or 0 for no timeout True if command is successful



safelyExecNativeCommand
protected boolean safelyExecNativeCommand(String[] cmds, String[] inputArray, int timeout)(Code)
Execute a native command with careful logging of output and errors.
Parameters:
  cmds - Command array to execute
Parameters:
  inputArray - Array of input lines
Parameters:
  timeout - Timeout or 0 for no timeout True if command is successful



setOptions
public void setOptions(String options)(Code)

See Also:   Backuper.setOptions(java.lang.String)



Fields inherited from org.continuent.sequoia.controller.backup.backupers.AbstractBackuper
protected HashMap optionsMap(Code)(Java Doc)
protected String optionsString(Code)(Java Doc)

Methods inherited from org.continuent.sequoia.controller.backup.backupers.AbstractBackuper
public void fetchDump(DumpTransferInfo dumpTransferInfo, String path, String dumpName) throws BackupException, IOException(Code)(Java Doc)
public boolean getIgnoreStdErrOutput()(Code)(Java Doc)
public String getOptions()(Code)(Java Doc)
public void setOptions(String options)(Code)(Java Doc)
public DumpTransferInfo setupDumpServer() throws IOException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.