/** * @see org.opencms.main.I_CmsShellCommands#shellStart() */ public void shellStart() { System.out.println(); System.out.println(getMessages().key(Messages.GUI_SHELL_WELCOME_0)); System.out.println(); // print the version information version(); // print the copyright message copyright(); // print the help information help(); }
/** * Exits the shell.<p> * * @see #exit() */ public void quit() { exit(); }
/** * Deletes the versions from the backup tables that are older then the given number of versions.<p> * * @param versionsToKeep number of versions to keep * * @throws Exception if something goes wrong * * @see CmsObject#deleteHistoricalVersions(int, int, long, I_CmsReport) * * @deprecated Use {@link #deleteHistoricalVersions(int, int, long)} instead */ public void deleteBackups(int versionsToKeep) throws Exception { deleteHistoricalVersions(versionsToKeep, versionsToKeep, -1); }
/** * Creates a new user.<p> * * @param name the name for the new user * @param password the password for the new user * @param description the description for the new user * * @throws Exception if something goes wrong * @see CmsObject#createUser(String, String, String, java.util.Map) * @return the created user */ public CmsUser createUser(String name, String password, String description) throws Exception { if (existsUser(name)) { m_shell.getOut().println(getMessages().key(Messages.GUI_SHELL_USER_ALREADY_EXISTS_1, name)); return null; } return m_cms.createUser(name, password, description, new Hashtable<String, Object>()); }
/** * @see org.opencms.main.I_CmsShellCommands#shellExit() */ public void shellExit() { System.out.println(); System.out.println(getMessages().key(Messages.GUI_SHELL_GOODBYE_0)); }
/** * Log a user in to the the CmsSell.<p> * * @param username the name of the user to log in * @param password the password of the user */ public void login(String username, String password) { username = OpenCms.getImportExportManager().translateUser(username); try { m_cms.loginUser(username, password); // reset the settings, this will switch the startup site root etc. m_shell.initSettings(); System.out.println(getMessages().key(Messages.GUI_SHELL_LOGIN_1, whoami().getName())); // output the login message if required CmsLoginMessage message = OpenCms.getLoginManager().getLoginMessage(); if ((message != null) && (message.isActive())) { System.out.println(message.getMessage()); } } catch (Exception exc) { System.out.println(getMessages().key(Messages.GUI_SHELL_LOGIN_FAILED_0)); } }
/** * Executes the given help command.<p> * * @param command the help command to execute */ public void help(String command) { if ("*".equalsIgnoreCase(command)) { m_shell.help(null); } else if ("help".equalsIgnoreCase(command)) { help(); } else { m_shell.help(command); } }
/** * Replaces a module with another revision.<p> * * @param moduleName the name of the module * @param importFile the name of the import file * * @throws Exception if something goes wrong */ public void replaceModule(String moduleName, String importFile) throws Exception { if (OpenCms.getModuleManager().getModule(moduleName) != null) { OpenCms.getModuleManager().deleteModule( m_cms, moduleName, true, new CmsShellReport(m_cms.getRequestContext().getLocale())); } importModule(importFile); }
/** * Replaces a module with another revision.<p> * * @param moduleName the name of the module * @param importFile the name of the import file * @throws Exception if something goes wrong */ public void replaceModuleFromDefault(String moduleName, String importFile) throws Exception { if (OpenCms.getModuleManager().getModule(moduleName) != null) { OpenCms.getModuleManager().deleteModule( m_cms, moduleName, true, new CmsShellReport(m_cms.getRequestContext().getLocale())); } importModuleFromDefault(importFile); }
m_shellCommands = new CmsShellCommands(); m_shellCommands.initShellCmsObject(m_cms, this);
/** * Provides help information for the CmsShell.<p> */ public void help() { System.out.println(); System.out.println(getMessages().key(Messages.GUI_SHELL_HELP1_0)); System.out.println(getMessages().key(Messages.GUI_SHELL_HELP2_0)); System.out.println(getMessages().key(Messages.GUI_SHELL_HELP3_0)); System.out.println(getMessages().key(Messages.GUI_SHELL_HELP4_0)); System.out.println(); }
/** * Log a user in to the the CmsSell.<p> * * @param username the name of the user to log in * @param password the password of the user */ public void login(String username, String password) { username = OpenCms.getImportExportManager().translateUser(username); try { m_cms.loginUser(username, password); // reset the settings, this will switch the startup site root etc. m_shell.initSettings(); m_shell.getOut().println(getMessages().key(Messages.GUI_SHELL_LOGIN_1, whoami().getName())); // output the login message if required CmsLoginMessage message = OpenCms.getLoginManager().getLoginMessage(); if ((message != null) && (message.isActive())) { m_shell.getOut().println(message.getMessage()); } } catch (Exception exc) { m_shell.getOut().println(getMessages().key(Messages.GUI_SHELL_LOGIN_FAILED_0)); } }
throws Exception { if (existsUser(name)) { m_shell.getOut().println(getMessages().key(Messages.GUI_SHELL_USER_ALREADY_EXISTS_1, name)); return null;
/** * Executes the given help command.<p> * * @param command the help command to execute */ public void help(String command) { if ("*".equalsIgnoreCase(command)) { m_shell.help(null); } else if ("help".equalsIgnoreCase(command)) { help(); } else { m_shell.help(command); } }
/** * Replaces a module with another revision.<p> * * @param moduleName the name of the module * @param importFile the name of the import file * * @throws Exception if something goes wrong */ public void replaceModule(String moduleName, String importFile) throws Exception { if (OpenCms.getModuleManager().getModule(moduleName) != null) { OpenCms.getModuleManager().deleteModule( m_cms, moduleName, true, new CmsShellReport(m_cms.getRequestContext().getLocale())); } importModule(importFile); }
/** * Replaces a module with another revision.<p> * * @param moduleName the name of the module * @param importFile the name of the import file * @throws Exception if something goes wrong */ public void replaceModuleFromDefault(String moduleName, String importFile) throws Exception { if (OpenCms.getModuleManager().getModule(moduleName) != null) { OpenCms.getModuleManager().deleteModule( m_cms, moduleName, true, new CmsShellReport(m_cms.getRequestContext().getLocale())); } importModuleFromDefault(importFile); }
m_shellCommands = new CmsShellCommands(); m_shellCommands.initShellCmsObject(m_cms, this);
/** * @see org.opencms.main.I_CmsShellCommands#shellStart() */ public void shellStart() { m_shell.getOut().println(); m_shell.getOut().println(getMessages().key(Messages.GUI_SHELL_WELCOME_0)); m_shell.getOut().println(); // print the version information version(); // print the copyright message copyright(); if (m_shell.isInteractive()) { // print the help information for interactive terminals help(); } }
/** * Returns the Locales available on the system ready to use on Method * {@link #setLocale(String)} from the <code>{@link CmsShell}</code>. <p> * * Note that the full name containing language, country and optional variant seperated * by underscores is returned always but the latter two parts may be left out. <p> */ public void getLocales() { System.out.println(getMessages().key(Messages.GUI_SHELL_LOCALES_AVAILABLE_0)); Locale[] locales = Locale.getAvailableLocales(); for (int i = locales.length - 1; i >= 0; i--) { System.out.println(" \"" + locales[i].toString() + "\""); } }
((CmsShellCommands)m_shellCommands).help();