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


Java Sardine.createDirectory方法代码示例

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


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

示例1: createFolder

import com.github.sardine.Sardine; //导入方法依赖的package包/类
/**
 * Creates a folder at the specified path
 *
 * @param rootPath path of the folder
 */
public void createFolder(String rootPath)
{
    String path=  (_serverConfig.isUseHTTPS() ? "https" : "http") +"://"+_serverConfig.getServerName()+"/"+WEB_DAV_BASE_PATH+rootPath ;

    Sardine sardine = SardineFactory.begin();
    sardine.setCredentials(_serverConfig.getUserName(), _serverConfig.getPassword());
    try {
        sardine.createDirectory(path);
    } catch (IOException e) {
        throw new NextcloudApiException(e);
    }
}
 
开发者ID:a-schild,项目名称:nextcloud-java-api,代码行数:18,代码来源:Folders.java

示例2: mkdir

import com.github.sardine.Sardine; //导入方法依赖的package包/类
@Override
public void mkdir(String remotePath, boolean parents) throws Throwable {
	if (remotePath == null) {
		return;
	}
	remotePath = remotePath.trim();
	if (remotePath.isEmpty() || remotePath.equals("/")) {
		return;
	}
	remotePath = PathUtil.trimTrailingSlash(remotePath);
	String url = PathUtil.join(_serverAddress,
			PathUtil.appendSlash(remotePath));
	String uri = URIEncoder.encode(url);
	if (exists(uri)) {
		// already exists
		return;
	}
	Sardine sardine = getSardineInstance();
	if (parents) {
		// create parent directories. If parent directories do not exist and
		// you will not be able to create the child directory.
		mkdir(PathUtil.getParentDirectory(remotePath, true), true);
	}
	try {
		sardine.createDirectory(uri);
	} catch (SardineException e) {
		String msg = e.getMessage();
		if (msg != null && msg.contains("405 Method Not Allowed")) {
			// NOTE: if http response 405, means the directory already
			// exists. That might be created by other threads.
			System.out
					.println("WebDAV Sink: HTTP Response: '405 Method Not Allowed' when creating directory "
							+ uri
							+ ". It indicates the directory already exists.");
		} else {
			// log it in the server log.
			System.out.println("WebDav Error: " + e.getMessage());
			throw e;
		}
	}
}
 
开发者ID:uom-daris,项目名称:daris,代码行数:42,代码来源:WebdavClientImpl.java

示例3: createComponentFeature

import com.github.sardine.Sardine; //导入方法依赖的package包/类
@Override
public void createComponentFeature (String component, String feature) throws Exception
{
    if(component == null)
    {
        throw new Exception("The component is invalid");
    }
    else if(feature == null)
    {
        throw new Exception("The feature is invalid");
    }
    else
    {   
        String componentUrl = "" + getProjectUrl() + "/" + component + "/";
        String componentFeatureUrl = "" + getProjectUrl() + "/" + component + "/" + feature + "/";
        
        if(!projectExists(componentFeatureUrl))
        {
            Sardine method =  SardineFactory.begin(apiUserName, apiPassword);
            try
           {
               if(!projectExists(componentUrl))
               {
                   method.createDirectory(componentUrl);
               }   
               
               method.createDirectory( componentFeatureUrl );                   
           }
           catch (IOException ioe)
           {
                String error = "Could add a new component feature because : " + ioe.getMessage();
                throw new Exception( error, ioe );
           }
            
        }
        
    }
    
}
 
开发者ID:it-innovation,项目名称:EXPERImonitor,代码行数:40,代码来源:ECCConfigAPIImpl.java

示例4: createDefaultComponentFeature

import com.github.sardine.Sardine; //导入方法依赖的package包/类
@Override
public void createDefaultComponentFeature (String component, String feature) throws Exception
{
    if(component == null)
    {
        throw new Exception("The component is invalid");
    }
    else if(feature == null)
    {
        throw new Exception("The feature is invalid");
    }
    else
    {   
        String componentUrl = "" + apiDefaultPath + "/" + component + "/";
        String componentFeatureUrl = "" + apiDefaultPath + "/" + component + "/" + feature + "/";
        
        if(!projectExists(componentFeatureUrl))
        {
            Sardine method =  SardineFactory.begin(apiUserName, apiPassword);
            try
           {
               if(!projectExists(componentUrl))
               {
                   method.createDirectory(componentUrl);
               }   
               
               method.createDirectory( componentFeatureUrl );                   
           }
           catch (IOException ioe)
           {
                String error = "Could add a new component feature because : " + ioe.getMessage();
                throw new Exception( error, ioe );
           }
            
        }
        
    }
    
}
 
开发者ID:it-innovation,项目名称:EXPERImonitor,代码行数:40,代码来源:ECCConfigAPIImpl.java

示例5: addDirectory

import com.github.sardine.Sardine; //导入方法依赖的package包/类
@Override
public void addDirectory(String directoryName) throws Exception
{
    if(directoryName == null)
    {
        throw new Exception("The directory name is invalid");
    }
    else
    {
    
        try {

             String directoryUrl = "" + apiRepositoryUrl + directoryName + "/";

             if(!projectExists(directoryUrl))
             {
                 Sardine method = SardineFactory.begin(apiUserName, apiPassword);
                 method.createDirectory(directoryUrl);
             }
             else
             {
                 throw new Exception("A directory with this name already exists");
             }

        } 
        catch (IOException ioe) 
        {
            String error = "Could add a new directory because : " + ioe.getMessage();
            throw new Exception( error, ioe );
        }
    }
}
 
开发者ID:it-innovation,项目名称:EXPERImonitor,代码行数:33,代码来源:ECCConfigAPIImpl.java


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