/** * Returns the absolute path to the "opencms.properties" configuration file (in the "real" file system).<p> * * @return the absolute path to the "opencms.properties" configuration file */ public String getConfigurationFileRfsPath() { if (m_configurationFileRfsPath == null) { m_configurationFileRfsPath = getAbsoluteRfsPathRelativeToWebInf(FOLDER_CONFIG + FILE_PROPERTIES); } return m_configurationFileRfsPath; }
/** * Returns the absolute path to the "packages" folder (in the "real" file system).<p> * * @return the absolute path to the "packages" folder */ public String getPackagesRfsPath() { if (m_packagesRfsPath == null) { m_packagesRfsPath = getAbsoluteRfsPathRelativeToWebInf(CmsSystemInfo.FOLDER_PACKAGES); } return m_packagesRfsPath; }
/** * Returns the absolute path to the "packages" folder (in the "real" file system).<p> * * @return the absolute path to the "packages" folder */ public String getPackagesRfsPath() { if (m_packagesRfsPath == null) { m_packagesRfsPath = getAbsoluteRfsPathRelativeToWebInf(CmsSystemInfo.FOLDER_PACKAGES); } return m_packagesRfsPath; }
/** * Returns the absolute path to the "persistence.xml" file (in the "real" file system).<p> * * @return the absolute path to the "persistence.xml" configuration file */ public String getPersistenceFileRfsPath() { if (m_persistenceFileRfsPath == null) { m_persistenceFileRfsPath = getAbsoluteRfsPathRelativeToWebInf(FILE_PERSISTENCE); } return m_persistenceFileRfsPath; }
/** * Gets the log file for the given module name.<p> * * @param moduleName the module * * @return the log file */ public File getLogFile(String moduleName) { return new File( OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf("packages/_modulelogs/" + moduleName + ".log")); }
/** * Makes sure that the folders used to store the import/export data exist.<p> */ private void ensureFoldersExist() { for (String path : Arrays.asList(IMPORT_FOLDER_PATH, EXPORT_FOLDER_PATH)) { String folderPath = OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf(path); File folder = new File(folderPath); if (!folder.exists()) { folder.mkdirs(); } } }
/** * Gets the path of the opencms config folder.<p> * Per default this is the "/WEB-INF/config/ folder. * If configured with the "-Dopencms.config=..." java startup parameter, OpenCms can access an external config * folder outside its webapplication. * @return complete rfs path to the config folder. */ public String getConfigFolder() { // check if the system property is set and return its value if (CmsStringUtil.isNotEmpty(System.getProperty(CONFIG_FOLDER_PROPERTY))) { return System.getProperty(CONFIG_FOLDER_PROPERTY); } else { return getAbsoluteRfsPathRelativeToWebInf(FOLDER_CONFIG_DEFAULT); } }
/** * Starts the JLAN server in a new thread.<p> */ public synchronized void start() { String path = OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf("config/jlanConfig.xml"); File configFile = new File(path); if (configFile.exists()) { if (m_thread == null) { m_thread = new JlanThread(path); m_thread.start(); } } else { String message = "Not starting JLAN server because no config file was found at " + path; System.out.println(message); LOG.warn(message); } }
/** * Returns the home directory of Solr as String.<p> * * @return the home directory of Solr as String */ public String getHome() { if (m_homeFolderPath == null) { if (CmsStringUtil.isNotEmpty(System.getProperty(SOLR_HOME_PROPERTY))) { m_home = System.getProperty(SOLR_HOME_PROPERTY); } else { m_home = OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf(SOLR_HOME_DEFAULT); } m_home = (m_home.endsWith(File.separator) ? m_home.substring(0, m_home.lastIndexOf(File.separator)) : m_home); } else { m_home = m_homeFolderPath; } return m_home; }
/** * Opens the import file.<p> * * @throws IOException if the file could not be opened */ public void openFile() throws IOException { // get the import resource m_folder = new File(OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf(m_params.getPath())); // if it is a file it must be a zip-file if (m_folder.isFile()) { m_zipFile = new ZipFile(m_params.getPath()); m_folder = null; } }
/** * Opens the import file.<p> * * @throws IOException if the file could not be opened */ public void openFile() throws IOException { // get the import resource m_folder = new File(OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf(m_params.getPath())); // if it is a file it must be a zip-file if (m_folder.isFile()) { m_zipFile = new ZipFile(m_params.getPath()); m_folder = null; } } }
/** * Creates a randomized path for the temporary file used to store the import data.<p> * * @param name the module name * * @return the generated path */ private String createImportZipPath(String name) { String path = ""; do { String prefix = RandomStringUtils.randomAlphanumeric(6) + "-"; path = OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf( CmsStringUtil.joinPaths(IMPORT_FOLDER_PATH, prefix + name)); } while (new File(path).exists()); return path; }
/** * Generates the directory on the RFS for this index.<p> * * @return the directory on the RFS for this index */ protected String generateIndexDirectory() { return OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf( OpenCms.getSearchManager().getDirectory() + "/" + getName()); }
/** * * @see org.opencms.workplace.list.A_CmsListReport#initializeThread() */ @Override public I_CmsReportThread initializeThread() { String modulename = getParamModule(); String importpath = OpenCms.getSystemInfo().getPackagesRfsPath(); importpath = OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf(importpath + "modules/" + modulename); I_CmsReportThread importThread = new CmsDatabaseImportThread(getCms(), importpath, true); return importThread; }
/** * @see org.opencms.workplace.list.A_CmsListReport#initializeThread() */ @Override public I_CmsReportThread initializeThread() { String module = getParamModule(); String modulename = getParamModulename(); String importpath = OpenCms.getSystemInfo().getPackagesRfsPath(); importpath = OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf(importpath + "modules/" + module); I_CmsReportThread replaceThread = new CmsModuleReplaceThread(getCms(), modulename, importpath); return replaceThread; }
/** * Imports a resource into the Cms.<p> * * @param importFile the name (absolute Path) of the import resource (zip or folder) * @param importPath the name (absolute Path) of folder in which should be imported * * @throws Exception if something goes wrong */ public void importResources(String importFile, String importPath) throws Exception { CmsImportParameters params = new CmsImportParameters( OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf(importFile), importPath, true); OpenCms.getImportExportManager().importData( m_cms, new CmsShellReport(m_cms.getRequestContext().getLocale()), params); }
/** * Imports a resource into the Cms.<p> * * @param importFile the name (absolute Path) of the import resource (zip or folder) * @param importPath the name (absolute Path) of folder in which should be imported * * @throws Exception if something goes wrong */ public void importResources(String importFile, String importPath) throws Exception { CmsImportParameters params = new CmsImportParameters( OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf(importFile), importPath, true); OpenCms.getImportExportManager().importData( m_cms, new CmsShellReport(m_cms.getRequestContext().getLocale()), params); }
/** * Imports a resource into the Cms.<p> * * @param importFile the name (absolute Path) of the import resource (zip or folder) * @param importPath the name (absolute Path) of folder in which should be imported * @param keepPermissions if set, the permissions set on existing resources will not be modified * * @throws Exception if something goes wrong */ public void importResources(String importFile, String importPath, boolean keepPermissions) throws Exception { CmsImportParameters params = new CmsImportParameters( OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf(importFile), importPath, keepPermissions); OpenCms.getImportExportManager().importData( m_cms, new CmsShellReport(m_cms.getRequestContext().getLocale()), params); }
/** * Imports a module (zipfile) from the default module directory, * creating a temporary project for this.<p> * * @param importFile the name of the import module located in the default module directory * * @throws Exception if something goes wrong * * @see org.opencms.importexport.CmsImportExportManager#importData(CmsObject, I_CmsReport, CmsImportParameters) */ public void importModuleFromDefault(String importFile) throws Exception { String exportPath = OpenCms.getSystemInfo().getPackagesRfsPath(); String fileName = OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf( exportPath + CmsSystemInfo.FOLDER_MODULES + importFile); CmsImportParameters params = new CmsImportParameters(fileName, "/", true); OpenCms.getImportExportManager().importData( m_cms, new CmsShellReport(m_cms.getRequestContext().getLocale()), params); }
/** * Imports a module (zipfile) from the default module directory, * creating a temporary project for this.<p> * * @param importFile the name of the import module located in the default module directory * * @throws Exception if something goes wrong * * @see org.opencms.importexport.CmsImportExportManager#importData(CmsObject, I_CmsReport, CmsImportParameters) */ public void importModuleFromDefault(String importFile) throws Exception { String exportPath = OpenCms.getSystemInfo().getPackagesRfsPath(); String fileName = OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf( exportPath + CmsSystemInfo.FOLDER_MODULES + importFile); CmsImportParameters params = new CmsImportParameters(fileName, "/", true); OpenCms.getImportExportManager().importData( m_cms, new CmsShellReport(m_cms.getRequestContext().getLocale()), params); }