org.wso2.carbon.integration.common.utils.mgt
Class ServerConfigurationManager

java.lang.Object
  extended by org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager

public class ServerConfigurationManager
extends Object

This class can be used to configure server by replacing axis2.xml or carbon.xml


Constructor Summary
ServerConfigurationManager(org.wso2.carbon.automation.engine.context.AutomationContext autoCtx)
          Create a ServerConfigurationManager
ServerConfigurationManager(String productGroup, org.wso2.carbon.automation.engine.context.TestUserMode userMode)
          Create a ServerConfigurationManager
 
Method Summary
 void applyConfiguration(File newConfig)
          apply configuration file and restart server to take effect the configuration
 void applyConfiguration(File sourceFile, File targetFile)
          Methods to replace configuration files in products.
 void applyConfiguration(File sourceFile, File targetFile, boolean backupConfigFile, boolean restartServer)
           
 void applyConfigurationWithoutRestart(File newConfig)
          apply configuration file and restart server to take effect the configuration
 void applyConfigurationWithoutRestart(File sourceFile, File targetFile, boolean backup)
          Apply configuration from source file to a target file without restarting.
 void copyToComponentDropins(File jar)
          /** Copy Jar file to server component/dropins
 void copyToComponentLib(File jar)
          Copy Jar file to server component/lib
static String getCarbonHome()
           
 void removeFromComponentDropins(String fileName)
           
 void removeFromComponentLib(String fileName)
           
 void restartForcefully()
          Restart Server forcefully from admin user
 void restartGracefully()
          Restart Server Gracefully from admin user
 void restartGracefully(String sessionCookie)
          Restart server gracefully from current user session
 void restoreToLastConfiguration()
          restore to a last configuration and restart the server
 void restoreToLastConfiguration(boolean isRestartRequired)
          restore all files to last configuration and restart the server
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerConfigurationManager

public ServerConfigurationManager(String productGroup,
                                  org.wso2.carbon.automation.engine.context.TestUserMode userMode)
                           throws IOException,
                                  XPathExpressionException,
                                  org.wso2.carbon.authenticator.stub.LoginAuthenticationExceptionException,
                                  URISyntaxException,
                                  SAXException,
                                  XMLStreamException
Create a ServerConfigurationManager

Parameters:
productGroup - product group
userMode - user mode
Throws:
IOException
XPathExpressionException
org.wso2.carbon.authenticator.stub.LoginAuthenticationExceptionException
URISyntaxException
SAXException
XMLStreamException

ServerConfigurationManager

public ServerConfigurationManager(org.wso2.carbon.automation.engine.context.AutomationContext autoCtx)
                           throws IOException,
                                  XPathExpressionException,
                                  org.wso2.carbon.authenticator.stub.LoginAuthenticationExceptionException,
                                  URISyntaxException,
                                  SAXException,
                                  XMLStreamException
Create a ServerConfigurationManager

Parameters:
autoCtx - automation context
Throws:
IOException
XPathExpressionException
org.wso2.carbon.authenticator.stub.LoginAuthenticationExceptionException
URISyntaxException
SAXException
XMLStreamException
Method Detail

getCarbonHome

public static String getCarbonHome()
Returns:
will return the carbon home. the location of the server instance

applyConfigurationWithoutRestart

public void applyConfigurationWithoutRestart(File sourceFile,
                                             File targetFile,
                                             boolean backup)
                                      throws Exception
Apply configuration from source file to a target file without restarting.

Parameters:
sourceFile - Source file to copy.
targetFile - Target file that is to be backed up and replaced.
backup - boolean value, set this to true if you want to backup the original file.
Throws:
Exception

applyConfiguration

public void applyConfiguration(File sourceFile,
                               File targetFile,
                               boolean backupConfigFile,
                               boolean restartServer)
                        throws Exception
Parameters:
sourceFile - file of the new configuration file
targetFile - configuration file required to replace in the server. File must be created with the absolute path.
backupConfigFile - require to back the existing file
restartServer - require to restart the server after replacing the config file
Throws:
Exception

restoreToLastConfiguration

public void restoreToLastConfiguration()
                                throws Exception
restore to a last configuration and restart the server

Throws:
Exception

restoreToLastConfiguration

public void restoreToLastConfiguration(boolean isRestartRequired)
                                throws Exception
restore all files to last configuration and restart the server

Throws:
Exception

applyConfiguration

public void applyConfiguration(File newConfig)
                        throws Exception
apply configuration file and restart server to take effect the configuration

Parameters:
newConfig - configuration file
Throws:
Exception

applyConfigurationWithoutRestart

public void applyConfigurationWithoutRestart(File newConfig)
                                      throws Exception
apply configuration file and restart server to take effect the configuration

Parameters:
newConfig - configuration file
Throws:
Exception

applyConfiguration

public void applyConfiguration(File sourceFile,
                               File targetFile)
                        throws Exception
Methods to replace configuration files in products.

Parameters:
sourceFile - - configuration file to be copied for your local machine or carbon server it self.
targetFile - - configuration file in carbon server. e.g - path to axis2.xml in config directory
Throws:
Exception - - if file IO error

restartGracefully

public void restartGracefully()
                       throws Exception
Restart Server Gracefully from admin user

Throws:
Exception

restartGracefully

public void restartGracefully(String sessionCookie)
                       throws Exception
Restart server gracefully from current user session

Parameters:
sessionCookie - session cookie
Throws:
Exception

restartForcefully

public void restartForcefully()
                       throws Exception
Restart Server forcefully from admin user

Throws:
Exception

copyToComponentLib

public void copyToComponentLib(File jar)
                        throws IOException,
                               URISyntaxException
Copy Jar file to server component/lib

Parameters:
jar - jar file
Throws:
IOException
URISyntaxException

removeFromComponentLib

public void removeFromComponentLib(String fileName)
                            throws IOException,
                                   URISyntaxException
Parameters:
fileName - file name
Throws:
IOException
URISyntaxException

copyToComponentDropins

public void copyToComponentDropins(File jar)
                            throws IOException,
                                   URISyntaxException
/** Copy Jar file to server component/dropins

Parameters:
jar - jar file
Throws:
IOException
URISyntaxException

removeFromComponentDropins

public void removeFromComponentDropins(String fileName)
                                throws IOException,
                                       URISyntaxException
Parameters:
fileName - file name
Throws:
IOException
URISyntaxException


Copyright © 2015 WSO2. All rights reserved.