sakai和jcloud操作流程

https://github.com/botimer/sakai/tree/master/cloud-content

这里为sakai新建了一种资源,叫做swift文件处理器。用于将文件保存到云中。

1 实现

/**
* The cloud implementation of FileSystemHandler.
*

* This class read and write files to and from OpenStack-Swift cloud storage.
*
* @author OpenCollab
*/
public class SwiftFileSystemHandler implements FileSystemHandler {

这个类重载接口,并实现了文件的存、取、关、开。

2 打包依赖(impl pom)

dependency>
groupId>org.apache.jclouds.drivergroupId>
artifactId>jclouds-slf4jartifactId>
version>${jclouds.version}version>
exclusions>
exclusion>
groupId>aopalliancegroupId>
artifactId>aopallianceartifactId>
exclusion>
exclusions>
dependency>

3 定义bean实体

bean id=org.sakaiproject.content.api.FileSystemHandler.swift class=coza.opencollab.sakai.cloudcontent.SwiftFileSystemHandler
init-method=init destroy-method=destroy lazy-init=true>
bean>

4 定义pack (pack pom)

 
name>Sakai Cloud Resources Componentsname>
groupId>org.sakaiproject.contentgroupId>
artifactId>cloud-content-packartifactId>
 
packaging>sakai-componentpackaging>
properties>
deploy.target>componentsdeploy.target>
properties>
dependencies>
dependency>
groupId>org.sakaiproject.contentgroupId>
artifactId>cloud-content-implartifactId>
version>${project.version}version>
dependency>
dependencies>

在使用的时候使用方法

5 定义使用该类替代传统的文件处理 sakai-configuration.xml

6 定义实现中的一些值的属性

例如region对应实现里面的

/**
* The region to connect to.
*/
public void setRegion(String region) {
this.region = region;
}

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2016年2月11日
下一篇 2016年2月11日

相关推荐