当前位置: 首页>>代码示例>>Java>>正文


Java RuntimeExec.setCommandMap方法代码示例

本文整理汇总了Java中org.alfresco.util.exec.RuntimeExec.setCommandMap方法的典型用法代码示例。如果您正苦于以下问题:Java RuntimeExec.setCommandMap方法的具体用法?Java RuntimeExec.setCommandMap怎么用?Java RuntimeExec.setCommandMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.alfresco.util.exec.RuntimeExec的用法示例。


在下文中一共展示了RuntimeExec.setCommandMap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import org.alfresco.util.exec.RuntimeExec; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception
{
    super.setUp();
    
    RuntimeExecutableContentTransformerWorker worker = new RuntimeExecutableContentTransformerWorker();
    // the command to execute
    RuntimeExec transformCommand = new RuntimeExec();
    Map<String, String> commandMap = new HashMap<String, String>(5);
    commandMap.put("Mac OS X", "mv -f ${source} ${target}");
    commandMap.put("Linux", "mv -f ${source} ${target}");
    commandMap.put(".*", "cmd /c copy /Y \"${source}\" \"${target}\"");
    transformCommand.setCommandMap(commandMap);
    transformCommand.setErrorCodes("1, 2");
    worker.setTransformCommand(transformCommand);
    worker.setMimetypeService(serviceRegistry.getMimetypeService());
    // set the explicit transformations
    List<ExplictTransformationDetails> explicitTranformations = new ArrayList<ExplictTransformationDetails>(1);
    explicitTranformations.add(
            new ExplictTransformationDetails(MimetypeMap.MIMETYPE_TEXT_PLAIN, MimetypeMap.MIMETYPE_XML));
    worker.setExplicitTransformations(explicitTranformations);
    
    // initialise so that it doesn't score 0
    worker.afterPropertiesSet();
    
    TransformerDebug transformerDebug = (TransformerDebug) ctx.getBean("transformerDebug");
    TransformerConfig transformerConfig = (TransformerConfig) ctx.getBean("transformerConfig");

    ProxyContentTransformer transformer = new ProxyContentTransformer();
    transformer.setMimetypeService(serviceRegistry.getMimetypeService());
    transformer.setTransformerDebug(transformerDebug);
    transformer.setTransformerConfig(transformerConfig);
    transformer.setWorker(worker);
    this.transformer = transformer;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:36,代码来源:RuntimeExecutableContentTransformerTest.java

示例2: unmountFilesystem

import org.alfresco.util.exec.RuntimeExec; //导入方法依赖的package包/类
/**
 * Unmount a remote CIFS shared filesystem
 * 
 * @param driveLetter String
 * @param mountPoint String
 * @exception CifsMountException
 */
public void unmountFilesystem( String driveLetter, String mountPoint)
	throws CifsMountException
{
	// Create the command line launcher
	
       RuntimeExec exec = new RuntimeExec();

       // Create the command map and properties
       
       Map<String, String> commandMap = new HashMap<String, String>( 1);
       Map<String, String> defProperties = new HashMap<String, String>( 10);
	
	// Determine the platform type and build the appropriate command line string
	
	Platform.Type platform = Platform.isPlatformType();
	
	switch ( platform)
	{
	// Windows
	
	case WINDOWS:
		commandMap.put( "Windows.*", WindowsUnMountCmd);
		break;
		
	// Linux
		
	case LINUX:
		commandMap.put( "Linux", LinuxUnMountCmd);
		break;
		
	// Mac OS X
		
	case MACOSX:
		commandMap.put( "Mac OS X", MacOSXUnMountCmd);
		break;
	}
	
	// Set the command map
	
	exec.setCommandMap( commandMap);
	
	// Build the command line properties list
	
       defProperties.put( "drive", driveLetter);
       defProperties.put( "mountpoint", mountPoint);
       
       exec.setDefaultProperties(defProperties);
	
       // Get the command to be used on this platform

       if ( logger.isDebugEnabled())
       	logger.debug( "UnMount CIFS share, cmdLine=" + Arrays.toString(exec.getCommand()));
       
       // Run the command
       
       ExecutionResult execRes = exec.execute();
       
       if ( logger.isDebugEnabled())
       	logger.debug( "UnMount result=" + execRes);
       
       // Check if the command was successful
       
       if ( execRes.getSuccess() == false)
       	throw new CifsMountException( execRes.getExitValue(), execRes.getStdOut(), execRes.getStdErr());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:73,代码来源:CifsMounter.java


注:本文中的org.alfresco.util.exec.RuntimeExec.setCommandMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。