• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TFile类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中de.schlichtherle.truezip.file.TFile的典型用法代码示例。如果您正苦于以下问题:Java TFile类的具体用法?Java TFile怎么用?Java TFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TFile类属于de.schlichtherle.truezip.file包,在下文中一共展示了TFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: checkCompatibleVersion

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
@Override
public void checkCompatibleVersion(TFile war, ModuleDetails installingModuleDetails)
{
    //Version check
    TFile propsFile = new TFile(war+VERSION_PROPERTIES);
    if (propsFile != null && propsFile.exists())
    {
        log.info("INFO: Checking the war version using "+VERSION_PROPERTIES);
        Properties warVers = loadProperties(propsFile);
        VersionNumber warVersion = new VersionNumber(warVers.getProperty("version.major")+"."+warVers.getProperty("version.minor")+"."+warVers.getProperty("version.revision"));
        checkVersions(warVersion, installingModuleDetails);
    }
    else 
    {
        log.info("INFO: Checking the war version using the manifest.");
    	checkCompatibleVersionUsingManifest(war,installingModuleDetails);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:WarHelperImpl.java


示例2: checkCompatibleEditionUsingManifest

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
/**
 * Checks to see if the module that is being installed is compatible with the war, (using the entry in the manifest).
 * This is more accurate and works for both alfresco.war and share.war, however
 * valid manifest entries weren't added until 3.4.11, 4.1.1 and Community 4.2 
 * @param war TFile
 * @param installingModuleDetails ModuleDetails
 */
public void checkCompatibleEditionUsingManifest(TFile war, ModuleDetails installingModuleDetails)
{
    List<String> installableEditions = installingModuleDetails.getEditions();

    if (installableEditions != null && installableEditions.size() > 0) {
        
		String warEdition = findManifestArtibute(war, MANIFEST_IMPLEMENTATION_TITLE);
		if (warEdition != null && warEdition.length() > 0)
		{
			warEdition = warEdition.toLowerCase();
            for (String edition : installableEditions)
            {
                if (warEdition.endsWith(edition.toLowerCase()))
                {
                    return;  //successful match.
                }
            }
            throw new ModuleManagementToolException("The module ("+installingModuleDetails.getTitle()
                        +") can only be installed in one of the following editions"+installableEditions);
        } else {
            log.info("WARNING: No edition information detected in war, edition validation is disabled, continuing anyway. Is this war prior to 3.4.11, 4.1.1 and Community 4.2 ?");
        }
    }	
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:32,代码来源:WarHelperImpl.java


示例3: checkModuleDependencies

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
@Override
public void checkModuleDependencies(TFile war, ModuleDetails installingModuleDetails)
{
    // Check that the target war has the necessary dependencies for this install
    List<ModuleDependency> installingModuleDependencies = installingModuleDetails.getDependencies();
    List<ModuleDependency> missingDependencies = new ArrayList<ModuleDependency>(0);
    for (ModuleDependency dependency : installingModuleDependencies)
    {
        String dependencyId = dependency.getDependencyId();
        ModuleDetails dependencyModuleDetails = getModuleDetails(war, dependencyId);
        // Check the dependency.  The API specifies that a null returns false, so no null check is required
        if (!dependency.isValidDependency(dependencyModuleDetails))
        {
            missingDependencies.add(dependency);
            continue;
        }
    }
    if (missingDependencies.size() > 0)
    {
        throw new ModuleManagementToolException("The following modules must first be installed: " + missingDependencies);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:WarHelperImpl.java


示例4: getModuleDetailsOrAlias

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
@Override
public ModuleDetails getModuleDetailsOrAlias(TFile war, ModuleDetails installingModuleDetails)
{
    ModuleDetails installedModuleDetails = getModuleDetails(war, installingModuleDetails.getId());
    if (installedModuleDetails == null)
    {
        // It might be there as one of the aliases
        List<String> installingAliases = installingModuleDetails.getAliases();
        for (String installingAlias : installingAliases)
        {
            ModuleDetails installedAliasModuleDetails = getModuleDetails(war, installingAlias);
            if (installedAliasModuleDetails == null)
            {
                // There is nothing by that alias
                continue;
            }
            // We found an alias and will treat it as the same module
            installedModuleDetails = installedAliasModuleDetails;
            //outputMessage("Module '" + installingAlias + "' is installed and is an alias of '" + installingModuleDetails + "'", false);
            break;
        }
    }
    return installedModuleDetails;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:WarHelperImpl.java


示例5: extractToDir

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
private String extractToDir(String extension, String location)
{
   File tmpDir = TempFileProvider.getTempDir();

   try {
       TFile zipFile = new TFile(this.getClass().getClassLoader().getResource(location).getPath());
       TFile outDir = new TFile(tmpDir.getAbsolutePath()+"/moduleManagementToolTestDir"+System.currentTimeMillis());
       outDir.mkdir();
       zipFile.cp_rp(outDir);
       TVFS.umount(zipFile);
       return outDir.getPath();
   } catch (Exception e) {
           e.printStackTrace();
   }
   return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:ModuleManagementToolTest.java


示例6: checkContentsOfFile

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
private void checkContentsOfFile(String location, String expectedContents)
    throws IOException
{
    File file = new TFile(location);
    assertTrue(file.exists());  
    BufferedReader reader = null;
    try
    {
        reader = new BufferedReader(new InputStreamReader(new TFileInputStream(file)));
        String line = reader.readLine();
        assertNotNull(line);
        assertEquals(expectedContents, line.trim());
    }
    finally
    {
        if (reader != null)
        {
            try { reader.close(); } catch (Throwable e ) {}
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:ModuleManagementToolTest.java


示例7: testfindManifest

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
@Test
public void testfindManifest() throws Exception {
    //Now check the compatible versions using the manifest
    TFile theWar = getFile(".war", "module/share-3.4.11.war");
    Manifest manifest = this.findManifest(theWar);

    assertNotNull(manifest);
    assertEquals("Alfresco Share Enterprise", manifest.getMainAttributes().getValue(MANIFEST_IMPLEMENTATION_TITLE));
    assertEquals("3.4.11", manifest.getMainAttributes().getValue(MANIFEST_SPECIFICATION_VERSION));

    theWar = getFile(".war", "module/alfresco-4.2.a.war");
    manifest = this.findManifest(theWar);

    assertNotNull(manifest);
    assertEquals("Alfresco Repository Community", manifest.getMainAttributes().getValue(MANIFEST_IMPLEMENTATION_TITLE));
    assertEquals("4.2.a", manifest.getMainAttributes().getValue(MANIFEST_SPECIFICATION_VERSION));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:WarHelperImplTest.java


示例8: testListModules

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
@Test
public void testListModules() throws Exception
{
    TFile theWar =  getFile(".war", "module/test.war");

    List<ModuleDetails> details = this.listModules(theWar);
    assertNotNull(details);
    assertEquals(details.size(), 0);

    theWar =  getFile(".war", "module/share-4.2.a.war");
    details = this.listModules(theWar);
    assertNotNull(details);
    assertEquals(details.size(), 1);
    ModuleDetails aModule = details.get(0);
    assertEquals("alfresco-mm-share", aModule.getId());
    assertEquals("0.1.5.6", aModule.getModuleVersionNumber().toString());
    assertEquals(ModuleInstallState.INSTALLED, aModule.getInstallState());

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:WarHelperImplTest.java


示例9: testIsShareWar

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
/**
 * Tests to see if the war is a share war.
 */
@Test
public void testIsShareWar()
{
	TFile theWar = getFile(".war", "module/test.war");   //Version 4.1.0
	assertFalse(this.isShareWar(theWar));

	theWar = getFile(".war", "module/empty.war");  
	assertFalse(this.isShareWar(theWar));
	
	theWar = getFile(".war", "module/alfresco-4.2.a.war");
	assertFalse(this.isShareWar(theWar));
	
	theWar = getFile(".war", "module/share-4.2.a.war");
	assertTrue(this.isShareWar(theWar));
	
	
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:WarHelperImplTest.java


示例10: getFile

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
private TFile getFile(String extension, String location) 
    {
        File file = TempFileProvider.createTempFile("moduleManagementToolTest-", extension);        
        InputStream is = this.getClass().getClassLoader().getResourceAsStream(location);
        assertNotNull(is);
        OutputStream os;
        try
        {
            os = new FileOutputStream(file);
            FileCopyUtils.copy(is, os);
        }
        catch (IOException error)
        {
            error.printStackTrace();
        }        
        return new TFile(file);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:WarHelperImplTest.java


示例11: removeVersionFromFileNames

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
private void removeVersionFromFileNames(String ouptutDirectory, File ear) throws IOException, JDOMException {
	for (Dependency dependency : this.getJarDependencies()) {
		Pattern p = Pattern.compile("(.*)-" + dependency.getVersion() + JAR_EXTENSION);

		String includeOrigin = getJarName(dependency, false);
		String includeDestination;

		Matcher m = p.matcher(includeOrigin);
		if (m.matches()) {
			includeDestination = m.group(1)+JAR_EXTENSION;
			
			truezip.moveFile(new TFile(ouptutDirectory + File.separator + includeOrigin), new TFile(ouptutDirectory + File.separator + includeDestination));
			
			updateAlias(includeOrigin, includeDestination, ear);
		}
	}

	truezip.sync();
}
 
开发者ID:fastconnect,项目名称:tibco-bwmaven,代码行数:20,代码来源:IncludeDependenciesInEARMojo.java


示例12: updateAlias

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
private void updateAlias(String includeOrigin, String includeDestination, File ear) throws JDOMException, IOException, JDOMException {
	TFile xmlTIBCO = new TFile(ear.getAbsolutePath() + File.separator + "TIBCO.xml");
	String tempPath = ear.getParentFile().getAbsolutePath() + File.separator + "TIBCO.xml";
	TFile xmlTIBCOTemp = new TFile(tempPath);

	truezip.copyFile(xmlTIBCO, xmlTIBCOTemp);

	File xmlTIBCOFile = new File(tempPath);

	SAXBuilder sxb = new SAXBuilder();
	Document document = sxb.build(xmlTIBCOFile);

	XPath xpa = XPath.newInstance("//dd:NameValuePairs/dd:NameValuePair[starts-with(dd:name, 'tibco.alias') and dd:value='" + includeOrigin + "']/dd:value");
	xpa.addNamespace("dd", "http://www.tibco.com/xmlns/dd");

	Element singleNode = (Element) xpa.selectSingleNode(document);
	if (singleNode != null) {
		singleNode.setText(includeDestination);
		XMLOutputter xmlOutput = new XMLOutputter();
		xmlOutput.setFormat(Format.getPrettyFormat().setIndent("    "));
		xmlOutput.output(document, new FileWriter(xmlTIBCOFile));

		truezip.copyFile(xmlTIBCOTemp, xmlTIBCO);
	}

	updateAliasInPARs(includeOrigin, includeDestination, ear);
}
 
开发者ID:fastconnect,项目名称:tibco-bwmaven,代码行数:28,代码来源:IncludeDependenciesInEARMojo.java


示例13: updateAliasInPARs

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
private void updateAliasInPARs(String includeOrigin, String includeDestination, File ear) throws IOException, JDOMException {
	TrueZipFileSet pars = new TrueZipFileSet();
	pars.setDirectory(ear.getAbsolutePath());
	pars.addInclude("*.par");
	List<TFile> parsXML = truezip.list(pars);
	for (TFile parXML : parsXML) {
		TFile xmlTIBCO = new TFile(parXML, "TIBCO.xml");

		String tempPath = ear.getParentFile().getAbsolutePath() + File.separator + "TIBCO.xml";
		TFile xmlTIBCOTemp = new TFile(tempPath);

		truezip.copyFile(xmlTIBCO, xmlTIBCOTemp);

		File xmlTIBCOFile = new File(tempPath);

		SAXBuilder sxb = new SAXBuilder();
		Document document = sxb.build(xmlTIBCOFile);

		XPath xpa = XPath.newInstance("//dd:NameValuePairs/dd:NameValuePair[dd:name='EXTERNAL_JAR_DEPENDENCY']/dd:value");
		xpa.addNamespace("dd", "http://www.tibco.com/xmlns/dd");

		Element singleNode = (Element) xpa.selectSingleNode(document);
		if (singleNode != null) {
			String value = singleNode.getText().replace(includeOrigin, includeDestination);
			singleNode.setText(value);
			XMLOutputter xmlOutput = new XMLOutputter();
			xmlOutput.setFormat(Format.getPrettyFormat().setIndent("    "));
			xmlOutput.output(document, new FileWriter(xmlTIBCOFile));

			truezip.copyFile(xmlTIBCOTemp, xmlTIBCO);
		}
	}
}
 
开发者ID:fastconnect,项目名称:tibco-bwmaven,代码行数:34,代码来源:IncludeDependenciesInEARMojo.java


示例14: perform

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
@Override
public void perform() throws ServiceException, SecurityServiceException {
	LOGGER.info("Performing MigrationTest upgrade");
	
	try {
		
		entityManagerUtils.openEntityManager();
		importDataService.importDirectory(new TFile( // May be inside a Jar
				BasicApplicationCorePackage.class.getResource("/init").toURI()
		));
		
		hibernateSearchService.reindexAll();
		LOGGER.info("Initialization complete");
	} catch (Throwable e) { // NOSONAR We just want to log the Exception/Error, no error handling here.
		LOGGER.error("Error during initialization", e);
		throw new IllegalStateException(e);
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:19,代码来源:ImportExcel.java


示例15: main

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
public static void main(String[] args) throws ServiceException, SecurityServiceException, IOException {
	ConfigurableApplicationContext context = null;
	try {
		context = new AnnotationConfigApplicationContext(BasicApplicationInitConfig.class);
		
		SpringContextWrapper contextWrapper = context.getBean("springContextWrapper", SpringContextWrapper.class);
		
		contextWrapper.openEntityManager();
		contextWrapper.importDirectory(new TFile( // May be inside a Jar
				BasicApplicationInitFromExcelMain.class.getResource("/init").toURI()
		));
		
		contextWrapper.reindexAll();
		
		LOGGER.info("Initialization complete");
	} catch (Throwable e) { // NOSONAR We just want to log the Exception/Error, no error handling here.
		LOGGER.error("Error during initialization", e);
		throw new IllegalStateException(e);
	} finally {
		if (context != null) {
			context.close();
		}
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:25,代码来源:BasicApplicationInitFromExcelMain.java


示例16: list

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
public static List<File> list(File directory, FilenameFilter filter) {
	List<File> files = new ArrayList<File>();
	
	if (directory != null) {
		String[] filesPaths = directory.list(filter);
		if (filesPaths != null) {
			Arrays.sort(filesPaths);
			for (int i = 0; i < filesPaths.length; i++) {
				TFile file = new TFile(FilenameUtils.concat(directory.getAbsolutePath(), filesPaths[i]));
				if (file.canRead()) {
					files.add(file);
				}
			}
		} else {
			// le résultat filesPaths est null si et seulement si il y a un problème avec la lecture du répertoire
			throw new IllegalStateException("Error reading directory: " + directory.getPath());
		}
	}
	
	return files;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:22,代码来源:FileUtils.java


示例17: checkCompatibleVersionUsingManifest

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
/**
  * Checks if the module is compatible using the entry in the manifest. This is more accurate and works for both alfresco.war and share.war, however
  * valid manifest entries weren't added until 3.4.11, 4.1.1 and Community 4.2 
  * @param war TFile
  * @param installingModuleDetails ModuleDetails
  */
 protected void checkCompatibleVersionUsingManifest(TFile war, ModuleDetails installingModuleDetails)
 {
String version = findManifestArtibute(war, MANIFEST_SPECIFICATION_VERSION);
      if (version != null && version.length() > 0)
      {	        	
      	if (version.matches(REGEX_NUMBER_OR_DOT)) {
        VersionNumber warVersion = new VersionNumber(version);
           checkVersions(warVersion, installingModuleDetails);	        		
      	}
      	else 
      	{
      		//A non-numeric version number.  Currently our VersionNumber class doesn't support Strings in the version
      		String edition = findManifestArtibute(war, MANIFEST_IMPLEMENTATION_TITLE);
      		if (edition.endsWith(MANIFEST_COMMUNITY))
      		{
      			//If it's a community version, so don't worry about it
                  log.info("WARNING: Community edition war detected, the version number is non-numeric so we will not validate it.");
      		}
      		else
      		{
      			throw new ModuleManagementToolException("Invalid version number specified: "+ version);  
      		}
      	}

      }
      else
      {
             log.info("WARNING: No version information detected in war, therefore version validation is disabled, continuing anyway.  Is this war prior to 3.4.11, 4.1.1 and Community 4.2 ?");    	
      }
 }
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:37,代码来源:WarHelperImpl.java


示例18: checkCompatibleEdition

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
@Override
public void checkCompatibleEdition(TFile war, ModuleDetails installingModuleDetails)
{

    List<String> installableEditions = installingModuleDetails.getEditions();

    if (installableEditions != null && installableEditions.size() > 0) {
        
        TFile propsFile = new TFile(war+VERSION_PROPERTIES);
        if (propsFile != null && propsFile.exists())
        {
            Properties warVers = loadProperties(propsFile);
            String warEdition = warVers.getProperty("version.edition");
            
            for (String edition : installableEditions)
            {
                if (warEdition.equalsIgnoreCase(edition))
                {
                    return;  //successful match.
                }
            }
            throw new ModuleManagementToolException("The module ("+installingModuleDetails.getTitle()
                        +") can only be installed in one of the following editions"+installableEditions);
        } else {
        	checkCompatibleEditionUsingManifest(war,installingModuleDetails);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:WarHelperImpl.java


示例19: isShareWar

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
@Override
public boolean isShareWar(TFile warFile)
{
    if (!warFile.exists())
    {
        throw new ModuleManagementToolException("The war file '" + warFile + "' does not exist.");     
    }
    
    String title = findManifestArtibute(warFile, MANIFEST_SPECIFICATION_TITLE);
    if (MANIFEST_SHARE.equals(title)) return true;  //It is share
    
    return false; //default
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:WarHelperImpl.java


示例20: getModuleDetailsFileFromWarAndId

import de.schlichtherle.truezip.file.TFile; //导入依赖的package包/类
/**
 * @param warLocation   the location of the WAR file
 * @param moduleId      the module ID within the WAR
 * @return              Returns a file handle to the module properties file within the given WAR.
 *                      The file may or may not exist.
 */
public static TFile getModuleDetailsFileFromWarAndId(String warLocation, String moduleId)
{
    String location = ModuleDetailsHelper.getModulePropertiesFileLocation(warLocation, moduleId);
    TFile file = new TFile(location);
    return file;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:13,代码来源:ModuleDetailsHelper.java



注:本文中的de.schlichtherle.truezip.file.TFile类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IntHolder类代码示例发布时间:2022-05-22
下一篇:
Java EncloseType类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap