Class RepositoryManager
- java.lang.Object
-
- com.sun.enterprise.admin.servermgmt.KeystoreManager
-
- com.sun.enterprise.admin.servermgmt.MasterPasswordFileManager
-
- com.sun.enterprise.admin.servermgmt.RepositoryManager
-
- Direct Known Subclasses:
PEDomainsManager
public class RepositoryManager extends MasterPasswordFileManager
The RepositoryManager serves as a common base class for the following PEDomainsManager, PEInstancesManager, AgentManager (the SE Node Agent). Its purpose is to abstract out any shared functionality related to lifecycle management of domains, instances and node agents. This includes creation, deletion, listing, and starting and stopping.- Since:
- August 19, 2003, 2:29 PM
- Author:
- kebbs
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
RepositoryManager.RepositoryManagerMessages
The RepositoryManagerMessages class is used to abstract out ResourceBundle messages that are specific to a domain, node-agent, or server instance.-
Nested classes/interfaces inherited from class com.sun.enterprise.admin.servermgmt.KeystoreManager
KeystoreManager.KeytoolExecutor
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
CERTUTIL_CMD
static String
DEBUG
protected RepositoryManager.RepositoryManagerMessages
messages
protected static String
NEW_LINE
-
Fields inherited from class com.sun.enterprise.admin.servermgmt.KeystoreManager
_fileLayout, CERTIFICATE_ALIAS, DEFAULT_MASTER_PASSWORD, INSTANCE_SECURE_ADMIN_ALIAS
-
-
Constructor Summary
Constructors Constructor Description RepositoryManager()
Creates a new instance of RepositoryManager
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
changePasswordAliasKeystorePassword(RepositoryConfig config, String oldPassword, String newPassword)
Change the password protecting the password alias keystoreprotected void
checkRepository(RepositoryConfig config)
void
checkRepository(RepositoryConfig config, boolean existingRepository)
void
checkRepository(RepositoryConfig config, boolean existingRepository, boolean checkRootDir)
Sanity check on the repository.This is executed prior to create/delete/start/stop.void
createHttpBCInstallRoot(PEFileLayout layout)
This method is used to create httpsoapbc install rootvoid
createJavaEESEInstallRoot(PEFileLayout layout)
This method is used to create Java EESE install rootprotected void
createJBIInstance(String instanceName, RepositoryConfig config)
Create JBI instance.protected void
createMQInstance(RepositoryConfig config)
Create MQ instance.protected void
createTimerDbn(RepositoryConfig config)
Create the timer database dbn file.protected void
createTimerWal(RepositoryConfig config)
Create the timer database wal file.void
createWSDLSLInstallRoot(PEFileLayout layout)
This method is used to create WSDLSL install rootprotected void
deleteRepository(RepositoryConfig config)
Deletes the repository (domain, node agent, server instance).protected void
deleteRepository(RepositoryConfig config, boolean deleteJMSProvider)
Deletes the repository (domain, node agent, server instance).protected void
generateFromTemplate(TokenValueSet tokens, File template, File destinationFile)
String
getClearPasswordForAlias(RepositoryConfig config, String password, String alias)
retrieve clear password from password alias keystoreprotected RepositoryConfig
getConfigForRepositoryStatus(RepositoryConfig config, String repository)
Return all repositories (domains, node agents, server instances) and their corresponding status (e.g.running or stopped) in string form.protected String[]
getInteractiveOptions(String user, String password, String masterPassword, HashMap<Object,Object> extraPasswords)
protected RepositoryManager.RepositoryManagerMessages
getMessages()
protected File
getRepositoryDir(RepositoryConfig config)
protected File
getRepositoryRootDir(RepositoryConfig config)
static boolean
isNSSSupportAvailable()
Determines if the NSS support is available in this installation.protected boolean
isValidRepository(RepositoryConfig config)
protected boolean
isValidRepository(File f)
protected String[]
listRepository(RepositoryConfig config)
Return all repositories (domains, node agents, server instances)protected boolean
repositoryExists(RepositoryConfig config)
protected void
setMessages(RepositoryManager.RepositoryManagerMessages messages)
protected void
setPermissions(RepositoryConfig repositoryConfig)
Sets the permissions for the domain directory, its config directory, startserv/stopserv scripts etc.void
validateMasterPassword(RepositoryConfig config, String password)
We validate the master password by trying to open the password alias keystore.-
Methods inherited from class com.sun.enterprise.admin.servermgmt.MasterPasswordFileManager
changeMasterPasswordInMasterPasswordFile, changeMasterPasswordInMasterPasswordFile, createMasterPasswordFile, deleteMasterPasswordFile, readMasterPasswordFile
-
Methods inherited from class com.sun.enterprise.admin.servermgmt.KeystoreManager
addKeyPair, addKeyPair, changeKeyPassword, changeKeyStorePassword, changeKeyStorePassword, changeKeyStorePassword, changeS1ASAliasPassword, changeSSLCertificateDatabasePassword, chmod, copyCert, copyCertificates, createKeyStore, enforcePasswordComplexity, getCertificateDN, getDASCertDN, getFileLayout, getInstanceCertDN, getInvalidCertificates, getValidCertificates, openKeyStore, readPemCertificateChain, readPlainPKCS8PrivateKey, readPlainPKCS8PrivateKey, saveKeyStore, updateCertificates
-
-
-
-
Field Detail
-
CERTUTIL_CMD
protected static final String CERTUTIL_CMD
-
NEW_LINE
protected static final String NEW_LINE
-
messages
protected RepositoryManager.RepositoryManagerMessages messages
-
DEBUG
public static final String DEBUG
- See Also:
- Constant Field Values
-
-
Method Detail
-
setMessages
protected void setMessages(RepositoryManager.RepositoryManagerMessages messages)
-
getMessages
protected RepositoryManager.RepositoryManagerMessages getMessages()
-
generateFromTemplate
protected void generateFromTemplate(TokenValueSet tokens, File template, File destinationFile) throws IOException
- Throws:
IOException
-
repositoryExists
protected boolean repositoryExists(RepositoryConfig config)
-
isValidRepository
protected boolean isValidRepository(File f)
-
isValidRepository
protected boolean isValidRepository(RepositoryConfig config)
-
getRepositoryDir
protected File getRepositoryDir(RepositoryConfig config)
-
getRepositoryRootDir
protected File getRepositoryRootDir(RepositoryConfig config)
-
checkRepository
protected void checkRepository(RepositoryConfig config) throws RepositoryException
- Throws:
RepositoryException
-
checkRepository
public void checkRepository(RepositoryConfig config, boolean existingRepository) throws RepositoryException
- Throws:
RepositoryException
-
checkRepository
public void checkRepository(RepositoryConfig config, boolean existingRepository, boolean checkRootDir) throws RepositoryException
Sanity check on the repository.This is executed prior to create/delete/start/stop.- Parameters:
config
- The base configurationexistingRepository
- true if the domain or instance must exist, false if it must notcheckRootDir
- whether to check if the root directory is read/writable- Throws:
RepositoryException
-
setPermissions
protected void setPermissions(RepositoryConfig repositoryConfig) throws RepositoryException
Sets the permissions for the domain directory, its config directory, startserv/stopserv scripts etc.- Parameters:
repositoryConfig
- theRepositoryConfig
to set permissions for- Throws:
RepositoryException
- if unable to set permissions
-
deleteRepository
protected void deleteRepository(RepositoryConfig config) throws RepositoryException
Deletes the repository (domain, node agent, server instance).- Parameters:
config
- the repository to delete- Throws:
RepositoryException
- if it was unable to delete the repository
-
deleteRepository
protected void deleteRepository(RepositoryConfig config, boolean deleteJMSProvider) throws RepositoryException
Deletes the repository (domain, node agent, server instance). If the deleteJMSProvider flag is set, we delete the jms instance.The jms instance is present in the domain only and not when the repository corresponds to a server instance or node agent.- Parameters:
config
- the repository to deletedeleteJMSProvider
- if the JMS provider should be deleted as well- Throws:
RepositoryException
- if it failed to delete the repository
-
listRepository
protected String[] listRepository(RepositoryConfig config) throws RepositoryException
Return all repositories (domains, node agents, server instances)- Parameters:
config
- the configuration to look in- Returns:
- an array of the filepaths of all repositories' root folders
- Throws:
RepositoryException
-
getConfigForRepositoryStatus
protected RepositoryConfig getConfigForRepositoryStatus(RepositoryConfig config, String repository)
Return all repositories (domains, node agents, server instances) and their corresponding status (e.g.running or stopped) in string form.- Parameters:
config
- the baseRepositoryConfig
repository
- the domain or agent name- Returns:
- The repository here corresponds to either the domain or node agent name
-
validateMasterPassword
public void validateMasterPassword(RepositoryConfig config, String password) throws RepositoryException
We validate the master password by trying to open the password alias keystore. This means that the keystore must already exist.- Parameters:
config
- theRepositoryConfig
to check againstpassword
- the master password to validate- Throws:
RepositoryException
- if the master password failed to validate
-
getClearPasswordForAlias
public String getClearPasswordForAlias(RepositoryConfig config, String password, String alias) throws RepositoryException
retrieve clear password from password alias keystore- Parameters:
config
- theRepositoryConfig
which has the alias keystorepassword
- the master passwordalias
- for which the clear text password would returns- Returns:
- the cleartext password
- Throws:
RepositoryException
-
changePasswordAliasKeystorePassword
protected void changePasswordAliasKeystorePassword(RepositoryConfig config, String oldPassword, String newPassword) throws RepositoryException
Change the password protecting the password alias keystore- Parameters:
config
- the config to find the keystore location fromoldPassword
- old passwordnewPassword
- new password- Throws:
RepositoryException
-
createJBIInstance
protected void createJBIInstance(String instanceName, RepositoryConfig config) throws RepositoryException
Create JBI instance.- Parameters:
instanceName
- the name of the instance to createconfig
- theRepositoryConfig
to create the JBI instance within- Throws:
RepositoryException
- if an error occured creating the JBI instance
-
createHttpBCInstallRoot
public void createHttpBCInstallRoot(PEFileLayout layout) throws Exception
This method is used to create httpsoapbc install root- Parameters:
layout
- PEFileLayout- Throws:
Exception
- if an error occured creating the file
-
createJavaEESEInstallRoot
public void createJavaEESEInstallRoot(PEFileLayout layout) throws Exception
This method is used to create Java EESE install root- Parameters:
layout
- PEFileLayout- Throws:
Exception
-IllegalArgumentException
if source does not exist,RuntimeException
if the a parent directory of the destination cannot be created or aIOException
if there is an error creating the output file or coping it.
-
createWSDLSLInstallRoot
public void createWSDLSLInstallRoot(PEFileLayout layout) throws Exception
This method is used to create WSDLSL install root- Parameters:
layout
- PEFileLayout- Throws:
Exception
- if an error occured creating the file
-
createMQInstance
protected void createMQInstance(RepositoryConfig config)
Create MQ instance.- Parameters:
config
- theRepositoryConfig
to create the MQ instance within
-
createTimerWal
protected void createTimerWal(RepositoryConfig config) throws RepositoryException
Create the timer database wal file.- Parameters:
config
- theRepositoryConfig
to get the file locations from- Throws:
RepositoryException
- if an error occured creating the file
-
createTimerDbn
protected void createTimerDbn(RepositoryConfig config) throws RepositoryException
Create the timer database dbn file.- Parameters:
config
- theRepositoryConfig
- Throws:
RepositoryException
- if an error occurred creating the file
-
getInteractiveOptions
protected String[] getInteractiveOptions(String user, String password, String masterPassword, HashMap<Object,Object> extraPasswords)
-
isNSSSupportAvailable
public static boolean isNSSSupportAvailable()
Determines if the NSS support is available in this installation. The check involves availability of thecertutil
executable.- Returns:
- true if certutil exists false otherwise
-
-