1 31 32 package org.opencms.main; 33 34 import org.opencms.db.CmsDbEntryNotFoundException; 35 import org.opencms.db.CmsLoginMessage; 36 import org.opencms.file.CmsFile; 37 import org.opencms.file.CmsGroup; 38 import org.opencms.file.CmsObject; 39 import org.opencms.file.CmsProject; 40 import org.opencms.file.CmsPropertyDefinition; 41 import org.opencms.file.CmsResource; 42 import org.opencms.file.CmsResourceFilter; 43 import org.opencms.file.CmsUser; 44 import org.opencms.file.types.CmsResourceTypeFolder; 45 import org.opencms.i18n.CmsLocaleManager; 46 import org.opencms.i18n.CmsMessages; 47 import org.opencms.importexport.CmsVfsImportExportHandler; 48 import org.opencms.module.CmsModule; 49 import org.opencms.module.CmsModuleImportExportHandler; 50 import org.opencms.report.CmsShellReport; 51 import org.opencms.report.I_CmsReport; 52 import org.opencms.security.CmsAccessControlEntry; 53 import org.opencms.security.CmsAccessControlList; 54 import org.opencms.security.CmsRole; 55 import org.opencms.security.I_CmsPrincipal; 56 import org.opencms.staticexport.CmsLinkManager; 57 import org.opencms.util.CmsFileUtil; 58 import org.opencms.util.CmsUUID; 59 import org.opencms.workplace.CmsWorkplace; 60 61 import java.util.ArrayList ; 62 import java.util.Collections ; 63 import java.util.HashMap ; 64 import java.util.Hashtable ; 65 import java.util.Iterator ; 66 import java.util.List ; 67 import java.util.Locale ; 68 import java.util.Random ; 69 import java.util.Set ; 70 import java.util.StringTokenizer ; 71 72 85 class CmsShellCommands implements I_CmsShellCommands { 86 87 88 private CmsObject m_cms; 89 90 91 private CmsShell m_shell; 92 93 100 protected CmsShellCommands() { 101 102 } 104 105 116 public CmsUser addWebUser(String name, String password, String group, String description) throws Exception { 117 118 return m_cms.addWebUser(name, password, group, description, new Hashtable ()); 119 } 120 121 128 public void cd(String target) throws Exception { 129 130 String folder = CmsResource.getFolderPath(m_cms.getRequestContext().getUri()); 131 if (!target.endsWith("/")) { 132 target += "/"; 133 } 134 String resolvedTarget = CmsLinkManager.getAbsoluteUri(target, folder); 135 CmsResource res = m_cms.readResource(resolvedTarget); 136 if (!res.isFolder()) { 137 throw new CmsIllegalArgumentException(Messages.get().container(Messages.ERR_NOT_A_FOLDER_1, resolvedTarget)); 138 } 139 m_cms.getRequestContext().setUri(resolvedTarget); 140 System.out.println('\n' + getMessages().key(Messages.GUI_SHELL_CURRENT_FOLDER_1, new Object [] {resolvedTarget})); 141 System.out.println(); 142 } 143 144 154 public void chacc(String resourceName, String principalType, String principalName, String permissionString) 155 throws CmsException { 156 157 m_cms.lockResource(resourceName); 158 if (I_CmsPrincipal.PRINCIPAL_GROUP.equalsIgnoreCase(principalType.trim())) { 159 principalName = OpenCms.getImportExportManager().translateGroup(principalName); 160 } else { 161 principalName = OpenCms.getImportExportManager().translateUser(principalName); 162 } 163 m_cms.chacc(resourceName, principalType, principalName, permissionString); 164 } 165 166 171 public void clearCaches() throws Exception { 172 173 OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_CLEAR_CACHES, Collections.EMPTY_MAP)); 174 } 175 176 179 public void copyright() { 180 181 String [] copy = Messages.COPYRIGHT_BY_ALKACON; 182 for (int i = 0; i < copy.length; i++) { 183 System.out.println(copy[i]); 184 } 185 } 186 187 200 public void createDefaultProject(String name, String description) throws Exception { 201 202 m_cms.getRequestContext().saveSiteRoot(); 203 m_cms.getRequestContext().setSiteRoot("/"); 204 try { 205 CmsProject project = m_cms.createProject( 206 name, 207 description, 208 OpenCms.getDefaultUsers().getGroupUsers(), 209 OpenCms.getDefaultUsers().getGroupProjectmanagers(), 210 CmsProject.PROJECT_TYPE_NORMAL); 211 m_cms.getRequestContext().setCurrentProject(project); 212 m_cms.copyResourceToProject("/"); 213 } finally { 214 m_cms.getRequestContext().restoreSiteRoot(); 215 } 216 if (m_cms.hasRole(CmsRole.SEARCH_MANAGER)) { 217 OpenCms.getSearchManager().initialize(m_cms); 219 } 220 } 221 222 230 public CmsResource createFolder(String targetFolder, String folderName) throws Exception { 231 232 return m_cms.createResource(targetFolder + folderName, CmsResourceTypeFolder.RESOURCE_TYPE_ID); 233 } 234 235 244 public CmsGroup createGroup(String name, String description) throws Exception { 245 246 return m_cms.createGroup(name, description, I_CmsPrincipal.FLAG_ENABLED, null); 247 } 248 249 257 public CmsPropertyDefinition createPropertydefinition(String name) throws Exception { 258 259 return m_cms.createPropertyDefinition(name); 260 } 261 262 273 public CmsUser createUser(String name, String password, String description) throws Exception { 274 275 return m_cms.createUser(name, password, description, new Hashtable ()); 276 } 277 278 292 public CmsUser createUser( 293 String name, 294 String password, 295 String description, 296 String firstname, 297 String lastname, 298 String email) throws Exception { 299 300 CmsUser user = m_cms.createUser(name, password, description, new Hashtable ()); 301 user.setEmail(email); 302 user.setFirstname(firstname); 303 user.setLastname(lastname); 304 m_cms.writeUser(user); 305 return user; 306 } 307 308 315 public void deleteBackups(int weeks) throws Exception { 316 317 long oneWeek = 604800000; 318 long maxDate = System.currentTimeMillis() - (weeks * oneWeek); 319 m_cms.deleteBackups(maxDate, 100, new CmsShellReport(m_cms.getRequestContext().getLocale())); 320 } 321 322 328 public void deleteModule(String moduleName) throws Exception { 329 330 OpenCms.getModuleManager().deleteModule( 331 m_cms, 332 moduleName, 333 false, 334 new CmsShellReport(m_cms.getRequestContext().getLocale())); 335 } 336 337 346 public void deleteProject(String name) throws Exception { 347 348 m_cms.deleteProject(m_cms.readProject(name).getId()); 349 } 350 351 358 public void deletepropertydefinition(String name) throws Exception { 359 360 m_cms.deletePropertyDefinition(name); 361 } 362 363 368 public void echo(String echo) { 369 370 if (echo == null) { 371 return; 372 } 373 boolean b = "on".equalsIgnoreCase(echo.trim()); 374 m_shell.setEcho(b); 375 if (b) { 376 System.out.println(getMessages().key(Messages.GUI_SHELL_ECHO_ON_0)); 377 } else { 378 System.out.println(getMessages().key(Messages.GUI_SHELL_ECHO_OFF_0)); 379 } 380 } 381 382 385 public void exit() { 386 387 m_shell.exit(); 388 } 389 390 396 public void exportAllResources(String exportFile) throws Exception { 397 398 List exportPaths = new ArrayList (1); 399 exportPaths.add("/"); 400 401 CmsVfsImportExportHandler vfsExportHandler = new CmsVfsImportExportHandler(); 402 vfsExportHandler.setFileName(exportFile); 403 vfsExportHandler.setExportPaths(exportPaths); 404 vfsExportHandler.setIncludeSystem(true); 405 vfsExportHandler.setIncludeUnchanged(true); 406 vfsExportHandler.setExportUserdata(false); 407 408 OpenCms.getImportExportManager().exportData( 409 m_cms, 410 vfsExportHandler, 411 new CmsShellReport(m_cms.getRequestContext().getLocale())); 412 } 413 414 421 public void exportModule(String moduleName) throws Exception { 422 423 CmsModule module = OpenCms.getModuleManager().getModule(moduleName); 424 425 if (module == null) { 426 throw new CmsDbEntryNotFoundException(Messages.get().container(Messages.ERR_UNKNOWN_MODULE_1, moduleName)); 427 } 428 429 String filename = OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf( 430 OpenCms.getSystemInfo().getPackagesRfsPath() 431 + CmsSystemInfo.FOLDER_MODULES 432 + moduleName 433 + "_" 434 + OpenCms.getModuleManager().getModule(moduleName).getVersion().toString()); 435 436 String [] resources = new String [module.getResources().size()]; 437 System.arraycopy(module.getResources().toArray(), 0, resources, 0, resources.length); 438 439 CmsModuleImportExportHandler moduleExportHandler = new CmsModuleImportExportHandler(); 441 moduleExportHandler.setFileName(filename); 442 moduleExportHandler.setAdditionalResources(resources); 443 moduleExportHandler.setModuleName(module.getName().replace('\\', '/')); 444 moduleExportHandler.setDescription(getMessages().key( 445 Messages.GUI_SHELL_IMPORTEXPORT_MODULE_HANDLER_NAME_1, 446 new Object [] {moduleExportHandler.getModuleName()})); 447 448 OpenCms.getImportExportManager().exportData( 450 m_cms, 451 moduleExportHandler, 452 new CmsShellReport(m_cms.getRequestContext().getLocale())); 453 } 454 455 464 public void exportResources(String exportFile, String pathList) throws Exception { 465 466 StringTokenizer tok = new StringTokenizer (pathList, ";"); 467 List exportPaths = new ArrayList (); 468 while (tok.hasMoreTokens()) { 469 exportPaths.add(tok.nextToken()); 470 } 471 boolean includeSystem = false; 472 if (pathList.startsWith(CmsWorkplace.VFS_PATH_SYSTEM) 473 || (pathList.indexOf(";" + CmsWorkplace.VFS_PATH_SYSTEM) > -1)) { 474 includeSystem = true; 475 } 476 477 CmsVfsImportExportHandler vfsExportHandler = new CmsVfsImportExportHandler(); 478 vfsExportHandler.setFileName(exportFile); 479 vfsExportHandler.setExportPaths(exportPaths); 480 vfsExportHandler.setIncludeSystem(includeSystem); 481 vfsExportHandler.setIncludeUnchanged(true); 482 vfsExportHandler.setExportUserdata(false); 483 484 OpenCms.getImportExportManager().exportData( 485 m_cms, 486 vfsExportHandler, 487 new CmsShellReport(m_cms.getRequestContext().getLocale())); 488 } 489 490 499 public void exportResourcesAndUserdata(String exportFile, String pathList) throws Exception { 500 501 StringTokenizer tok = new StringTokenizer (pathList, ";"); 502 List exportPaths = new ArrayList (); 503 while (tok.hasMoreTokens()) { 504 exportPaths.add(tok.nextToken()); 505 } 506 boolean includeSystem = false; 507 if (pathList.startsWith(CmsWorkplace.VFS_PATH_SYSTEM) 508 || (pathList.indexOf(";" + CmsWorkplace.VFS_PATH_SYSTEM) > -1)) { 509 includeSystem = true; 510 } 511 512 CmsVfsImportExportHandler vfsExportHandler = new CmsVfsImportExportHandler(); 513 vfsExportHandler.setFileName(exportFile); 514 vfsExportHandler.setExportPaths(exportPaths); 515 vfsExportHandler.setIncludeSystem(includeSystem); 516 vfsExportHandler.setIncludeUnchanged(true); 517 vfsExportHandler.setExportUserdata(true); 518 519 OpenCms.getImportExportManager().exportData( 520 m_cms, 521 vfsExportHandler, 522 new CmsShellReport(m_cms.getRequestContext().getLocale())); 523 } 524 525 532 public void getAcl(String resourceName) throws Exception { 533 534 CmsAccessControlList acList = m_cms.getAccessControlList(resourceName); 535 Iterator principals = acList.getPrincipals().iterator(); 536 while (principals.hasNext()) { 537 I_CmsPrincipal p = m_cms.lookupPrincipal((CmsUUID)principals.next()); 538 System.out.println(p.getName() + ": " + acList.getPermissions(p).getPermissionString()); 539 } 540 } 541 542 550 public void getLocales() { 551 552 System.out.println(getMessages().key(Messages.GUI_SHELL_LOCALES_AVAILABLE_0)); 553 Locale [] locales = Locale.getAvailableLocales(); 554 for (int i = locales.length - 1; i >= 0; i--) { 555 System.out.println(" \"" + locales[i].toString() + "\""); 556 } 557 } 558 559 562 public void help() { 563 564 System.out.println(); 565 System.out.println(getMessages().key(Messages.GUI_SHELL_HELP1_0)); 566 System.out.println(getMessages().key(Messages.GUI_SHELL_HELP2_0)); 567 System.out.println(getMessages().key(Messages.GUI_SHELL_HELP3_0)); 568 System.out.println(getMessages().key(Messages.GUI_SHELL_HELP4_0)); 569 System.out.println(); 570 } 571 572 577 public void help(String command) { 578 579 if ("*".equalsIgnoreCase(command)) { 580 m_shell.help(null); 581 } else if ("help".equalsIgnoreCase(command)) { 582 help(); 583 } else { 584 m_shell.help(command); 585 } 586 } 587 588 595 public void importModule(String importFile) throws Exception { 596 597 OpenCms.getImportExportManager().importData( 598 m_cms, 599 importFile, 600 null, 601 new CmsShellReport(m_cms.getRequestContext().getLocale())); 602 } 603 604 612 public void importModuleFromDefault(String importFile) throws Exception { 613 614 String exportPath = OpenCms.getSystemInfo().getPackagesRfsPath(); 615 String fileName = OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf( 616 exportPath + CmsSystemInfo.FOLDER_MODULES + importFile); 617 OpenCms.getImportExportManager().importData( 618 m_cms, 619 fileName, 620 null, 621 new CmsShellReport(m_cms.getRequestContext().getLocale())); 622 } 623 624 627 public void importModulesFromSetupBean() { 628 629 } 631 632 639 public void importResources(String importFile, String importPath) throws Exception { 640 641 OpenCms.getImportExportManager().importData( 642 m_cms, 643 OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf(importFile), 644 importPath, 645 new CmsShellReport(m_cms.getRequestContext().getLocale())); 646 } 647 648 655 public void importResourcesWithTempProject(String importFile) throws Exception { 656 657 CmsProject project = m_cms.createProject( 658 "SystemUpdate", 659 getMessages().key(Messages.GUI_SHELL_IMPORT_TEMP_PROJECT_NAME_0), 660 OpenCms.getDefaultUsers().getGroupAdministrators(), 661 OpenCms.getDefaultUsers().getGroupAdministrators(), 662 CmsProject.PROJECT_TYPE_TEMPORARY); 663 int id = project.getId(); 664 m_cms.getRequestContext().setCurrentProject(project); 665 m_cms.copyResourceToProject("/"); 666 OpenCms.getImportExportManager().importData( 667 m_cms, 668 importFile, 669 "/", 670 new CmsShellReport(m_cms.getRequestContext().getLocale())); 671 m_cms.unlockProject(id); 672 m_cms.publishProject(); 673 } 674 675 678 public void initShellCmsObject(CmsObject cms, CmsShell shell) { 679 680 m_cms = cms; 681 m_shell = shell; 682 } 683 684 689 public void listModules() throws Exception { 690 691 Set modules = OpenCms.getModuleManager().getModuleNames(); 692 System.out.println("\n" + getMessages().key(Messages.GUI_SHELL_LIST_MODULES_1, new Integer (modules.size()))); 693 Iterator i = modules.iterator(); 694 while (i.hasNext()) { 695 String moduleName = (String )i.next(); 696 System.out.println(moduleName); 697 } 698 System.out.println(); 699 } 700 701 707 public void login(String username, String password) { 708 709 username = OpenCms.getImportExportManager().translateUser(username); 710 try { 711 m_cms.loginUser(username, password); 712 m_shell.initSettings(); 714 System.out.println(getMessages().key(Messages.GUI_SHELL_LOGIN_1, whoami().getName())); 715 CmsLoginMessage message = OpenCms.getLoginManager().getLoginMessage(); 717 if ((message != null) && (message.isActive())) { 718 System.out.println(message.getMessage()); 719 } 720 } catch (Exception exc) { 721 System.out.println(getMessages().key(Messages.GUI_SHELL_LOGIN_FAILED_0)); 722 } 723 } 724 725 731 public void ls() throws Exception { 732 733 String folder = CmsResource.getFolderPath(m_cms.getRequestContext().getUri()); 734 List resources = m_cms.getResourcesInFolder(folder, CmsResourceFilter.IGNORE_EXPIRATION); 735 System.out.println("\n" + getMessages().key(Messages.GUI_SHELL_LS_2, folder, new Integer (resources.size()))); 736 Iterator i = resources.iterator(); 737 while (i.hasNext()) { 738 CmsResource r = (CmsResource)i.next(); 739 System.out.println(m_cms.getSitePath(r)); 740 } 741 System.out.println(); 742 } 743 744 750 public void lsacc(String resourceName) throws Exception { 751 752 List acList = m_cms.getAccessControlEntries(resourceName); 753 for (int i = 0; i < acList.size(); i++) { 754 CmsAccessControlEntry ace = (CmsAccessControlEntry)acList.get(i); 755 I_CmsPrincipal acePrincipal = m_cms.lookupPrincipal(ace.getPrincipal()); 756 if (true) { 757 String pName = (acePrincipal != null) ? acePrincipal.getName() : ace.getPrincipal().toString(); 758 System.out.println(pName + ": " + ace.getPermissions().getPermissionString() + " " + ace); 759 } 760 } 761 } 762 763 770 public void lsacc(String resourceName, String principalName) throws Exception { 771 772 I_CmsPrincipal principal = m_cms.lookupPrincipal(principalName); 773 List acList = m_cms.getAccessControlEntries(resourceName); 774 for (int i = 0; i < acList.size(); i++) { 775 CmsAccessControlEntry ace = (CmsAccessControlEntry)acList.get(i); 776 I_CmsPrincipal acePrincipal = m_cms.lookupPrincipal(ace.getPrincipal()); 777 if (acePrincipal.equals(principal)) { 778 String pName = (acePrincipal != null) ? acePrincipal.getName() : ace.getPrincipal().toString(); 779 System.out.println(pName + ": " + ace.getPermissions().getPermissionString() + " " + ace); 780 } 781 } 782 } 783 784 789 public void perf() throws Exception { 790 791 int maxTests = 50000; 792 m_cms.getRequestContext().saveSiteRoot(); 793 m_cms.getRequestContext().setSiteRoot("/"); 794 try { 795 Random random = new Random (); 796 List testResources = m_cms.readResources("/", CmsResourceFilter.ALL); 798 int resourceCount = testResources.size(); 799 System.out.println("#Resources:\t" + resourceCount); 800 long start, time; 801 long totalTime = 0; 802 long minTime = Long.MAX_VALUE; 803 long maxTime = Long.MIN_VALUE; 804 System.out.print("readFileHeader:\t"); 805 for (int i = maxTests; i > 0; --i) { 806 int index = random.nextInt(resourceCount); 807 CmsResource resource = (CmsResource)testResources.get(index); 808 start = System.currentTimeMillis(); 809 m_cms.readResource(m_cms.getSitePath(resource), CmsResourceFilter.ALL); 810 time = System.currentTimeMillis() - start; 811 totalTime += time; 812 if (time < minTime) { 813 minTime = time; 814 } 815 if (time > maxTime) { 816 maxTime = time; 817 } 818 if ((i % 100) == 0) { 819 System.out.print('.'); 820 } 821 } 822 System.out.println("\nreadFileHeader:\t" 823 + minTime 824 + "\t" 825 + maxTime 826 + "\t" 827 + (((float)totalTime) / maxTests) 828 + " ms"); 829 830 } finally { 831 m_cms.getRequestContext().restoreSiteRoot(); 832 } 833 } 834 835 841 public void prompt(String prompt) { 842 843 m_shell.setPrompt(prompt); 844 } 845 846 853 public void purgeJspRepository() throws Exception { 854 855 OpenCms.fireCmsEvent(new CmsEvent( 856 I_CmsEventListener.EVENT_FLEX_PURGE_JSP_REPOSITORY, 857 new HashMap (0))); 858 } 859 860 868 public String pwd() throws Exception { 869 870 return CmsResource.getFolderPath(m_cms.getRequestContext().getUri()); 871 } 872 873 878 public void quit() { 879 880 exit(); 881 } 882 883 890 public String readFileContent(String filename) throws CmsException { 891 892 filename = CmsLinkManager.getAbsoluteUri( 893 filename, 894 CmsResource.getFolderPath(m_cms.getRequestContext().getUri())); 895 CmsFile file = m_cms.readFile(filename, CmsResourceFilter.IGNORE_EXPIRATION); 896 return new String (file.getContents()); 897 } 898 899 906 public CmsGroup readGroupOfProject(int project) throws Exception { 907 908 return m_cms.readGroup(m_cms.readProject(project)); 909 } 910 911 918 public CmsGroup readManagerGroup(int project) throws Exception { 919 920 return m_cms.readManagerGroup(m_cms.readProject(project)); 921 } 922 923 930 public CmsUser readOwnerOfProject(int project) throws Exception { 931 932 return m_cms.readOwner(m_cms.readProject(project)); 933 } 934 935 942 public void rebuildAllIndexes() throws Exception { 943 944 I_CmsReport report = new CmsShellReport(m_cms.getRequestContext().getLocale()); 945 try { 946 OpenCms.getSearchManager().rebuildAllIndexes(report, true); 947 } catch (CmsException e) { 948 report.println(e); 949 } 950 } 951 952 959 public void rebuildIndex(String index) throws Exception { 960 961 OpenCms.getSearchManager().rebuildIndex(index, new CmsShellReport(m_cms.getRequestContext().getLocale())); 962 } 963 964 972 public void replaceModule(String moduleName, String importFile) throws Exception { 973 974 if (OpenCms.getModuleManager().getModule(moduleName) != null) { 975 OpenCms.getModuleManager().deleteModule( 976 m_cms, 977 moduleName, 978 true, 979 new CmsShellReport(m_cms.getRequestContext().getLocale())); 980 } 981 982 importModule(importFile); 983 } 984 985 992 public void replaceModuleFromDefault(String moduleName, String importFile) throws Exception { 993 994 if (OpenCms.getModuleManager().getModule(moduleName) != null) { 995 OpenCms.getModuleManager().deleteModule( 996 m_cms, 997 moduleName, 998 true, 999 new CmsShellReport(m_cms.getRequestContext().getLocale())); 1000 } 1001 1002 importModuleFromDefault(importFile); 1003 } 1004 1005 1012 public CmsProject setCurrentProject(int id) throws Exception { 1013 1014 return m_cms.getRequestContext().setCurrentProject(m_cms.readProject(id)); 1015 } 1016 1017 1024 public CmsProject setCurrentProject(String name) throws Exception { 1025 1026 return m_cms.getRequestContext().setCurrentProject(m_cms.readProject(name)); 1027 } 1028 1029 1047 public void setLocale(String localeName) throws CmsException { 1048 1049 Locale locale = CmsLocaleManager.getLocale(localeName); 1050 System.out.println(getMessages().key( 1051 Messages.GUI_SHELL_SETLOCALE_2, 1052 locale, 1053 m_cms.getRequestContext().currentUser().getName())); 1054 1055 m_shell.setLocale(locale); 1056 System.out.println(getMessages().key(Messages.GUI_SHELL_SETLOCALE_POST_1, locale)); 1057 } 1058 1059 1062 public void shellExit() { 1063 1064 System.out.println(); 1065 System.out.println(getMessages().key(Messages.GUI_SHELL_GOODBYE_0)); 1066 } 1067 1068 1071 public void shellStart() { 1072 1073 System.out.println(); 1074 System.out.println(getMessages().key(Messages.GUI_SHELL_WELCOME_0)); 1075 System.out.println(); 1076 1077 version(); 1079 copyright(); 1081 help(); 1083 } 1084 1085 1089 public void unlockCurrentProject() throws Exception { 1090 1091 m_cms.unlockProject(m_cms.getRequestContext().currentProject().getId()); 1092 } 1093 1094 1107 public CmsResource uploadFile(String localfile, String folder, String filename, String type) 1108 throws Exception , CmsIllegalArgumentException { 1109 1110 int t = OpenCms.getResourceManager().getResourceType(type).getTypeId(); 1111 return m_cms.createResource(folder + filename, t, CmsFileUtil.readFile(localfile), null); 1112 } 1113 1114 1117 public void version() { 1118 1119 System.out.println(); 1120 System.out.println(getMessages().key(Messages.GUI_SHELL_VERSION_1, OpenCms.getSystemInfo().getVersionName())); 1121 } 1122 1123 1128 public CmsUser whoami() { 1129 1130 return m_cms.getRequestContext().currentUser(); 1131 } 1132 1133 1138 protected CmsMessages getMessages() { 1139 1140 return m_shell.getMessages(); 1141 } 1142} | Popular Tags |