List of usage examples for org.apache.commons.io FileUtils openInputStream
public static FileInputStream openInputStream(File file) throws IOException
new FileInputStream(file)
. From source file:org.codehaus.httpcache4j.cache.PersistentCacheStorage.java
private void getCacheFromDisk() { if (cache == null) { cache = new InvalidateOnRemoveLRUHashMap(capacity); }//from ww w. j a v a2s. c om if (serializationFile.exists()) { FileInputStream inputStream = null; try { inputStream = FileUtils.openInputStream(serializationFile); cache = (InvalidateOnRemoveLRUHashMap) SerializationUtils.deserialize(inputStream); } catch (Exception e) { serializationFile.delete(); //Ignored, we create a new one. cache = new InvalidateOnRemoveLRUHashMap(capacity); } finally { IOUtils.closeQuietly(inputStream); } } }
From source file:org.codice.ddf.ui.searchui.query.solr.FilteringSolrIndex.java
private static EmbeddedSolrServer createSolrServer(String coreName, ConfigurationFileProxy configProxy) { File configFile = getConfigFile(IMMEMORY_SOLRCONFIG_XML, configProxy); File schemaFile = getConfigFile(DEFAULT_SCHEMA_XML, configProxy); File solrConfigHome = new File(configFile.getParent()); ClassLoader tccl = Thread.currentThread().getContextClassLoader(); try {// w w w .ja v a2 s . com Thread.currentThread().setContextClassLoader(EmbeddedSolrFactory.class.getClassLoader()); SolrConfig solrConfig = new SolrConfig(Paths.get(solrConfigHome.getParent()), IMMEMORY_SOLRCONFIG_XML, new InputSource(FileUtils.openInputStream(configFile))); if (indexSchema == null) { indexSchema = new IndexSchema(solrConfig, DEFAULT_SCHEMA_XML, new InputSource(FileUtils.openInputStream(schemaFile))); } SolrResourceLoader loader = new SolrResourceLoader(Paths.get(solrConfigHome.getAbsolutePath())); SolrCoreContainer container = new SolrCoreContainer(loader); CoreDescriptor coreDescriptor = new CoreDescriptor(container, coreName, solrConfig.getResourceLoader().getInstancePath()); SolrCore core = new SolrCore(coreName, null, solrConfig, indexSchema, null, coreDescriptor, null, null, null); container.register(coreName, core, false); return new EmbeddedSolrServer(container, coreName); } catch (ParserConfigurationException | SAXException | IOException e) { throw new IllegalArgumentException("Unable to parse Solr configuration file", e); } finally { Thread.currentThread().setContextClassLoader(tccl); } }
From source file:org.codice.solr.factory.EmbeddedSolrFactory.java
/** * Provides an already instantiated {@link org.apache.solr.client.solrj.SolrClient} object. If an instance has not already * been instantiated, then the single instance will be instantiated with the provided * configuration file. If an instance already exists, it cannot be overwritten with a new * configuration.//from ww w.ja v a 2 s . c o m * * @param solrConfigXml the name of the solr configuration filename such as solrconfig.xml * @param schemaXml filename of the schema such as schema.xml * @param givenConfigFileProxy a ConfigurationFileProxy instance. If instance is <code>null</code>, a new * {@link ConfigurationFileProxy} is used instead. * @return {@link org.apache.solr.client.solrj.SolrClient} instance */ public static EmbeddedSolrServer getEmbeddedSolrServer(String solrConfigXml, String schemaXml, ConfigurationFileProxy givenConfigFileProxy) { LOGGER.debug("Retrieving embedded solr with the following properties: [{},{},{}]", solrConfigXml, schemaXml, givenConfigFileProxy); String solrConfigFileName = DEFAULT_SOLRCONFIG_XML; String schemaFileName = DEFAULT_SCHEMA_XML; if (isNotBlank(solrConfigXml)) { solrConfigFileName = solrConfigXml; } if (isNotBlank(schemaXml)) { schemaFileName = schemaXml; } ConfigurationFileProxy configProxy = givenConfigFileProxy; if (givenConfigFileProxy == null) { configProxy = new ConfigurationFileProxy(ConfigurationStore.getInstance()); } File solrConfigFile = getConfigFile(solrConfigFileName, configProxy); File solrSchemaFile = getConfigFile(schemaFileName, configProxy); File solrConfigHome = new File(solrConfigFile.getParent()); ClassLoader tccl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(EmbeddedSolrFactory.class.getClassLoader()); // NamedSPILoader uses the thread context classloader to lookup // codecs, posting formats, and analyzers SolrConfig solrConfig = new SolrConfig(Paths.get(solrConfigHome.getParent()), solrConfigFileName, new InputSource(FileUtils.openInputStream(solrConfigFile))); IndexSchema indexSchema = new IndexSchema(solrConfig, schemaFileName, new InputSource(FileUtils.openInputStream(solrSchemaFile))); SolrResourceLoader loader = new SolrResourceLoader(Paths.get(solrConfigHome.getAbsolutePath())); SolrCoreContainer container = new SolrCoreContainer(loader); String dataDirPath = null; if (!ConfigurationStore.getInstance().isInMemory()) { File dataDir = configProxy.getDataDirectory(); if (dataDir != null) { LOGGER.debug("Using data directory [{}]", dataDir); dataDirPath = dataDir.getAbsolutePath(); } } else { PluginInfo info = solrConfig.getPluginInfo(DirectoryFactory.class.getName()); if (!"solr.RAMDirectoryFactory".equals(info.className)) { LOGGER.warn("Using in-memory configuration without RAMDirectoryFactory."); } } CoreDescriptor coreDescriptor = new CoreDescriptor(container, DEFAULT_EMBEDDED_CORE_NAME, solrConfig.getResourceLoader().getInstancePath()); SolrCore core = new SolrCore(DEFAULT_EMBEDDED_CORE_NAME, dataDirPath, solrConfig, indexSchema, null, coreDescriptor, null, null, null); container.register(DEFAULT_EMBEDDED_CORE_NAME, core, false); return new EmbeddedSolrServer(container, DEFAULT_EMBEDDED_CORE_NAME); } catch (ParserConfigurationException | IOException | SAXException e) { throw new IllegalArgumentException("Unable to parse Solr configuration file: " + solrConfigFileName, e); } finally { Thread.currentThread().setContextClassLoader(tccl); } }
From source file:org.codice.solr.factory.impl.EmbeddedSolrFiles.java
/** * Creates or retrieves the schema index corresponding to this set of Solr files. * * @return a corresponding index for the schema * @throws IllegalArgumentException if unable to load or parse the corresponding schema or config *//*from w w w. j ava 2 s. co m*/ public IndexSchema getSchemaIndex() { if (schemaIndex == null) { final SolrConfig cfg = getConfig(); // make sure it is initialized InputStream is = null; LOGGER.debug("Loading and creating index for {} schema using file [{} ({})]", coreName, schemaName, schemaFile); try { is = FileUtils.openInputStream(schemaFile); this.schemaIndex = newIndexSchema(cfg, schemaName, new InputSource(is)); } catch (IOException e) { LOGGER.debug("failed to open {} Solr schema file [{} ({})]", coreName, schemaName, schemaFile, e); throw new IllegalArgumentException("Unable to open Solr schema file: " + schemaName, e); } catch (RuntimeException e) { // thrown as is by IndexSchema() LOGGER.debug("failed to parse {} Solr schema file [{} ({})]", coreName, schemaName, schemaFile, e); throw new IllegalArgumentException("Unable to parse Solr schema file: " + schemaName, e); } finally { Closeables.closeQuietly(is); } } return schemaIndex; }
From source file:org.codice.solr.factory.impl.EmbeddedSolrFiles.java
/** * Creates or retrieves the Solr config for this set of Solr files. * * @return a corresponding Solr config// w w w . java2 s . co m * @throws IllegalArgumentException if unable to load or parse the corresponding config */ public SolrConfig getConfig() { if (solrConfig == null) { InputStream is = null; LOGGER.debug("Loading and creating Solr config for {} using file [{} ({})]", coreName, configName, configFile); try { is = FileUtils.openInputStream(configFile); } catch (IOException e) { LOGGER.debug("failed to open {} Solr config file [{} ({})]", coreName, configName, configFile, e); throw new IllegalArgumentException("Unable to open Solr configuration file: " + configName, e); } try { this.solrConfig = newConfig(getConfigHome().getParentFile().toPath(), configName, new InputSource(is)); } catch (ParserConfigurationException | IOException | SAXException e) { LOGGER.debug("failed to parse {} Solr config file [{} ({})]", coreName, configName, configFile, e); throw new IllegalArgumentException("Unable to parse Solr configuration file: " + configName, e); } finally { Closeables.closeQuietly(is); } } return solrConfig; }
From source file:org.codice.solr.factory.SolrServerFactory.java
/** * Provides an already instantiated {@link org.apache.solr.client.solrj.SolrServer} object. If an instance has not already * been instantiated, then the single instance will be instantiated with the provided * configuration file. If an instance already exists, it cannot be overwritten with a new * configuration./*w w w . j a va 2s . c o m*/ * * @param solrConfigXml the name of the solr configuration filename such as solrconfig.xml * @param schemaXml filename of the schema such as schema.xml * @param givenConfigFileProxy a ConfigurationFileProxy instance. If instance is <code>null</code>, a new * {@link ConfigurationFileProxy} is used instead. * @return {@link org.apache.solr.client.solrj.SolrServer} instance */ public static EmbeddedSolrServer getEmbeddedSolrServer(String solrConfigXml, String schemaXml, ConfigurationFileProxy givenConfigFileProxy) { LOGGER.debug("Retrieving embedded solr with the following properties: [{},{},{}]", solrConfigXml, schemaXml, givenConfigFileProxy); String solrConfigFileName = DEFAULT_SOLRCONFIG_XML; String schemaFileName = DEFAULT_SCHEMA_XML; if (isNotBlank(solrConfigXml)) { solrConfigFileName = solrConfigXml; } if (isNotBlank(schemaXml)) { schemaFileName = schemaXml; } ConfigurationFileProxy configProxy = givenConfigFileProxy; if (givenConfigFileProxy == null) { configProxy = new ConfigurationFileProxy(ConfigurationStore.getInstance()); } File solrConfigFile = getConfigFile(solrConfigFileName, configProxy); File solrSchemaFile = getConfigFile(schemaFileName, configProxy); File solrFile = getConfigFile(DEFAULT_SOLR_XML, configProxy); File solrConfigHome = new File(solrConfigFile.getParent()); ClassLoader tccl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(SolrServerFactory.class.getClassLoader()); // NamedSPILoader uses the thread context classloader to lookup // codecs, posting formats, and analyzers SolrConfig solrConfig = new SolrConfig(solrConfigHome.getParent(), solrConfigFileName, new InputSource(FileUtils.openInputStream(solrConfigFile))); IndexSchema indexSchema = new IndexSchema(solrConfig, schemaFileName, new InputSource(FileUtils.openInputStream(solrSchemaFile))); SolrResourceLoader loader = new SolrResourceLoader(solrConfigHome.getAbsolutePath()); SolrCoreContainer container = new SolrCoreContainer(loader, solrFile); String dataDirPath = null; if (!ConfigurationStore.getInstance().isInMemory()) { File dataDir = configProxy.getDataDirectory(); if (dataDir != null) { LOGGER.debug("Using data directory [{}]", dataDir); dataDirPath = dataDir.getAbsolutePath(); } } else { PluginInfo info = solrConfig.getPluginInfo(DirectoryFactory.class.getName()); if (!"solr.RAMDirectoryFactory".equals(info.className)) { LOGGER.warn("Using in-memory configuration without RAMDirectoryFactory."); } } CoreDescriptor coreDescriptor = new CoreDescriptor(container, DEFAULT_EMBEDDED_CORE_NAME, solrConfig.getResourceLoader().getInstanceDir()); SolrCore core = new SolrCore(DEFAULT_EMBEDDED_CORE_NAME, dataDirPath, solrConfig, indexSchema, coreDescriptor); container.register(DEFAULT_EMBEDDED_CORE_NAME, core, false); return new EmbeddedSolrServer(container, DEFAULT_EMBEDDED_CORE_NAME); } catch (ParserConfigurationException | IOException | SAXException e) { throw new IllegalArgumentException("Unable to parse Solr configuration file: " + solrConfigFileName, e); } finally { Thread.currentThread().setContextClassLoader(tccl); } }
From source file:org.codice.solr.query.SolrQueryFilterVisitorTest.java
@Test @Ignore/*from www . j a v a2s . c o m*/ public void test() throws Exception { LOGGER.info("Running test ..."); // setup String workingDir = System.getProperty("user.dir") + "/src/test/resources/"; String solrConfDir = workingDir + "solr/conf/"; File solrConfigFile = new File(solrConfDir + "solrconfig.xml"); //getConfigFile(solrConfigFileName, configProxy); assertTrue(solrConfigFile.exists()); File solrSchemaFile = new File(solrConfDir + "schema.xml"); //getConfigFile(schemaFileName, configProxy); assertTrue(solrSchemaFile.exists()); File solrFile = new File(solrConfDir + "solr.xml"); //getConfigFile(DEFAULT_SOLR_XML, configProxy); assertTrue(solrFile.exists()); File solrConfigHome = new File(solrConfigFile.getParent()); assertTrue(solrConfigHome.exists()); SolrConfig solrConfig = null; IndexSchema indexSchema = null; SolrResourceLoader resourceLoader = null; SolrCoreContainer container = null; try { // NamedSPILoader uses the thread context classloader to lookup // codecs, posting formats, and analyzers solrConfig = new SolrConfig(solrConfigHome.getParent(), "solrConfig.xml", new InputSource(FileUtils.openInputStream(solrConfigFile))); assertNotNull(solrConfig); indexSchema = new IndexSchema(solrConfig, "schema.xml", new InputSource(FileUtils.openInputStream(solrSchemaFile))); assertNotNull(indexSchema); resourceLoader = new SolrResourceLoader(solrConfigHome.getAbsolutePath()); assertNotNull(resourceLoader); container = new SolrCoreContainer(resourceLoader, solrFile); assertNotNull(container); CoreDescriptor coreDescriptor = new CoreDescriptor(container, CORE_NAME, solrConfig.getResourceLoader().getInstanceDir()); assertNotNull(coreDescriptor); File dataDir = new File(workingDir + "data"); //configProxy.getDataDirectory(); LOGGER.debug("Using data directory [{}]", dataDir); SolrCore core = new SolrCore(CORE_NAME, dataDir.getAbsolutePath(), solrConfig, indexSchema, coreDescriptor); container.register(CORE_NAME, core, false); assertNotNull(core); EmbeddedSolrServer solrServer = new EmbeddedSolrServer(container, CORE_NAME); // the test SolrQueryFilterVisitor visitor = new SolrQueryFilterVisitor(solrServer, CORE_NAME); Filter filter = ECQL.toFilter("Name = 'Hugh'"); SolrQuery solrQuery = (SolrQuery) filter.accept(visitor, null); assertNotNull(solrQuery); // Solr does not support outside parenthesis in certain queries and throws EOF exception. String queryPhrase = solrQuery.getQuery().trim(); if (queryPhrase.matches("\\(\\s*\\{!.*\\)")) { solrQuery.setQuery(queryPhrase.replaceAll("^\\(\\s*|\\s*\\)$", "")); } LOGGER.info("solrQuery = {}", solrQuery); QueryResponse solrResponse = solrServer.query(solrQuery, METHOD.POST); assertNotNull(solrResponse); long numResults = solrResponse.getResults().getNumFound(); LOGGER.info("numResults = {}", numResults); } catch (ParserConfigurationException e) { LOGGER.warn("Parser configuration exception loading index schema", e); } catch (IOException e) { LOGGER.warn("IO exception loading index schema", e); } catch (SAXException e) { LOGGER.warn("SAX exception loading index schema", e); } }
From source file:org.commonjava.indy.subsys.infinispan.CacheProducer.java
private void startEmbeddedManager() { // FIXME This is just here to trigger shutdown hook init for embedded log4j in infinispan-embedded-query. // FIXES:/*from w w w . jav a 2 s. c o m*/ // // Thread-15 ERROR Unable to register shutdown hook because JVM is shutting down. // java.lang.IllegalStateException: Cannot add new shutdown hook as this is not started. Current state: STOPPED // new MarshallableTypeHints().getBufferSizePredictor(CacheHandle.class); File confDir = indyConfiguration.getIndyConfDir(); File ispnConf = new File(confDir, ISPN_XML); try (InputStream resouceStream = Thread.currentThread().getContextClassLoader() .getResourceAsStream(ISPN_XML)) { String resourceStr = interpolateStrFromStream(resouceStream, "CLASSPATH:" + ISPN_XML); if (ispnConf.exists()) { try (InputStream confStream = FileUtils.openInputStream(ispnConf)) { String confStr = interpolateStrFromStream(confStream, ispnConf.getPath()); mergedCachesFromConfig(confStr, "CUSTOMER"); mergedCachesFromConfig(resourceStr, "CLASSPATH"); } catch (IOException e) { throw new RuntimeException("Cannot read infinispan configuration from file: " + ispnConf, e); } } else { try { logger.info("Using CLASSPATH resource Infinispan configuration:\n\n{}\n\n", resourceStr); cacheManager = new DefaultCacheManager( new ByteArrayInputStream(resourceStr.getBytes(StandardCharsets.UTF_8))); } catch (IOException e) { throw new RuntimeException( "Failed to construct ISPN cacheManger due to CLASSPATH xml stream read error.", e); } } } catch (IOException e) { throw new RuntimeException( "Failed to construct ISPN cacheManger due to CLASSPATH xml stream read error.", e); } }
From source file:org.craftercms.studio.impl.v1.deployment.SyncTargetDeployer.java
@Override public void deployFiles(String site, List<String> paths, List<String> deletedFiles) throws ContentNotFoundForPublishingException, UploadFailedException { logger.debug("Start deploying items for site \"{0}\", target \"{1}\", number of items \"{2}\"", site, endpointConfig.getName(), paths.size()); URL requestUrl = null;// www . ja va 2 s . c om try { requestUrl = new URL(endpointConfig.getServerUrl()); } catch (MalformedURLException e) { logger.error("Invalid server URL for target {0}", endpointConfig.getName()); throw new UploadFailedException(site, endpointConfig.getName(), endpointConfig.getServerUrl(), e); } ByteArrayPartSource baps = null; PartSource metadataPart = null; StringPart stringPart = null; FilePart filePart = null; // TODO: implement reactor version of deployment events int cntFiles = 0; StringBuilder sbDeletedFiles = new StringBuilder(); List<Part> formParts = new ArrayList<Part>(); formParts.add(new StringPart(PASSWORD_REQUEST_PARAMETER, endpointConfig.getPassword())); formParts.add(new StringPart(TARGET_REQUEST_PARAMETER, endpointConfig.getTarget())); String siteId = endpointConfig.getSiteId(); if (StringUtils.isEmpty(siteId)) { siteId = site; } formParts.add(new StringPart(SITE_REQUEST_PARAMETER, siteId)); logger.debug("Preparing deployment items for target {0}", endpointConfig.getName()); for (String path : paths) { logger.debug("Parsing \"{0}\" , site \"{1}\"; for publishing on target \"{2}\"", path, site, endpointConfig.getName()); logger.debug("Get content for \"{0}\" , site \"{1}\", environment \"{2}\"", path, site, environment); File file = new File(getDestinationPath(site, path, environment)); InputStream input = null; try { input = FileUtils.openInputStream(file); if (input == null || input.available() < 0) { if (file.exists() && !file.isDirectory()) { baps = null; stringPart = null; filePart = null; formParts = null; throw new ContentNotFoundForPublishingException(site, endpointConfig.getName(), path); } else { // Content does not exist - skip deploying file continue; } } } catch (IOException err) { logger.error("Error reading input stream from envirnoment store for content at path: " + path + " site: " + site + " environment: " + environment); if (!file.exists()) { logger.error("File expected, but does not exist at path: " + file.getAbsolutePath()); } continue; } String fileName = file.getName(); byte[] byteArray = null; try { byteArray = IOUtils.toByteArray(input); } catch (IOException e) { logger.error("Error while converting input stream to byte array", e); baps = null; stringPart = null; filePart = null; formParts = null; } finally { IOUtils.closeQuietly(input); input = null; } baps = new ByteArrayPartSource(fileName, byteArray); logger.debug("Create http request parameters for \"{0}\" , site \"{1}\"; publishing on target \"{2}\"", path, site, endpointConfig.getName()); int idx = path.lastIndexOf("/"); String relativePath = path.substring(0, idx + 1) + fileName; stringPart = new StringPart(CONTENT_LOCATION_REQUEST_PARAMETER + cntFiles, relativePath); formParts.add(stringPart); filePart = new FilePart(CONTENT_FILE_REQUEST_PARAMETER + cntFiles, baps); formParts.add(filePart); /* if (item.getAction() == PublishingSyncItem.Action.MOVE) { if (item.getOldPath() != null && !item.getOldPath().equalsIgnoreCase(item.getPath())) { LOGGER.debug("Add old path to be deleted for MOVE action (\"{0}\")", item.getOldPath()); eventItem.setOldPath(item.getOldPath()); if (sbDeletedFiles.length() > 0) { sbDeletedFiles.append(",").append(item.getOldPath()); } else { sbDeletedFiles.append(item.getOldPath()); } if (item.getOldPath().endsWith("/" + _indexFile)) { sbDeletedFiles.append(FILES_SEPARATOR).append(item.getOldPath().replace("/" + _indexFile, "")); } } }*/ cntFiles++; // TODO: implement metadata transfer } for (int i = 0; i < deletedFiles.size(); i++) { if (i > 0) { sbDeletedFiles.append(FILES_SEPARATOR); } sbDeletedFiles.append(deletedFiles.get(i)); } if (sbDeletedFiles.length() > 0) { formParts.add(new StringPart(DELETED_FILES_REQUEST_PARAMETER, sbDeletedFiles.toString())); } logger.debug("Create http request to deploy content for target {0} ({1})", endpointConfig.getName(), endpointConfig.getTarget()); PostMethod postMethod = null; HttpClient client = null; try { logger.debug("Create HTTP Post Method"); postMethod = new PostMethod(requestUrl.toString()); postMethod.getParams().setBooleanParameter(HttpMethodParams.USE_EXPECT_CONTINUE, true); Part[] parts = new Part[formParts.size()]; for (int i = 0; i < formParts.size(); i++) parts[i] = formParts.get(i); postMethod.setRequestEntity(new MultipartRequestEntity(parts, postMethod.getParams())); client = new HttpClient(); logger.debug("Execute HTTP POST request \"{0}\"", postMethod.getURI()); int status = client.executeMethod(postMethod); if (status == HttpStatus.SC_OK) { logger.info("Successfully deployed on target {0}", endpointConfig.getName()); } else { logger.error("Deployment failed for on target {1}. Deployment agent returned status {2}", endpointConfig.getName(), HttpStatus.getStatusText(status)); throw new UploadFailedException(site, endpointConfig.getName(), endpointConfig.getServerUrl()); } } catch (HttpException e) { logger.error("Publish failed for target {0} due to http protocol exception", endpointConfig.getName()); throw new UploadFailedException(site, endpointConfig.getName(), endpointConfig.getServerUrl(), e); } catch (IOException e) { logger.error("Publish failed for target {0} due to I/O (transport) exception", endpointConfig.getName()); throw new UploadFailedException(site, endpointConfig.getName(), endpointConfig.getServerUrl(), e); } finally { logger.debug("Release http connection and release resources"); if (client != null) { HttpConnectionManager mgr = client.getHttpConnectionManager(); if (mgr instanceof SimpleHttpConnectionManager) { ((SimpleHttpConnectionManager) mgr).shutdown(); } } if (postMethod != null) { postMethod.releaseConnection(); postMethod = null; client = null; } baps = null; stringPart = null; filePart = null; formParts = null; } //LOGGER.debug("Publishing deployment event for target \"{0}\" with \"{1}\" items.", target.getName(), 0/*eventItems.size()*/); //contentRepository.publishDeployEvent(target.getName(), eventItems); logger.info("Deployment successful on target {0}", endpointConfig.getName()); logger.debug("Finished deploying items for site \"{0}\", target \"{1}\", number of items \"{2}\"", site, endpointConfig.getName(), paths.size()); }
From source file:org.craftercms.studio.impl.v1.repository.alfresco.AlfrescoContentRepository.java
private void bootstrapDir(File dir, String rootPath) { Collection<File> children = FileUtils.listFilesAndDirs(dir, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);/*from ww w .jav a 2s . c o m*/ for (File child : children) { String childPath = child.getAbsolutePath(); logger.debug("BOOTSTRAP Processing path: {0}", childPath); if (!rootPath.equals(childPath)) { String relativePath = childPath.replace(rootPath, ""); relativePath = relativePath.replace(File.separator, "/"); String parentPath = child.getParent().replace(rootPath, ""); parentPath = parentPath.replace(File.separator, "/"); if (StringUtils.isEmpty(parentPath)) { parentPath = "/"; } if (child.isDirectory()) { createFolderInternalCMIS(parentPath, child.getName()); } else if (child.isFile()) { try { writeContentCMIS(relativePath, FileUtils.openInputStream(child)); } catch (IOException e) { logger.error("Error while bootstrapping file: " + relativePath, e); } } } } }