- 浏览: 78336 次
- 性别:
- 来自: 广州
最新评论
-
yyf365:
想请问,你的实现中可否支持多线程?
cassandra内部API使用一2010-07-07
文章列表
/**
* 返回需压缩目录内文件的相对路径 去除其压缩目录信息 如当前需压缩目录内文件是目录,则返回目录信息
*
* @param zipSrcDir 检索路径
* @param jarfile 需压缩目录内文件
* @return 截去之后的路径
*/
private static String getRelativePath(final String zipSrcDir,
final File jarfile)
{
String jarfileName = jarfi ...
/**
* 取压缩目录内文件逐一进行压缩
* @param baseDir 需压缩目录根路径
* @param currentZipDir 需压缩目录中的目录
* @param zos 写入压缩文件的输出流
*/
private static void writeZip(String baseDir, String currentZipDir,
ZipOutputStream zos)
{
File curFile = new File(currentZipDir);
...
package com.huawei.support.utils;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io ...
导航树webService接口实现类:
/**
* 导航树webService接口实现
*/
@SuppressWarnings("unchecked")
@Service("navigationWsImpl")
@WebService
public class NavigationWsImpl implements INavigationWs
{
@Autowired
@Qualifier("navigationSevImpl")
private INavigationSev iNavigationSev ...
接口类:
package com.huawei.support.navigation.ws;
import java.util.Map;
import javax.jws.WebService;
import com.huawei.support.exception.ApplicationException;
/**
* 导航树webService接口
*/
@WebService
public interface INavigationWs
{
/**获取默认的产品线列表
* @return String 产品线列表字符串
* @throws Excepti ...
package com.huawei.support.cache;
import java.io.Serializable;
import java.util.Map;
/**
* 缓存操作接口.
*/
public interface ICassCache
{
/**向缓存中存放数据.
*
* @param aKeyArea Key
* @param aName column
* @param aSerialObj 缓存对象
*/
void put(String aKeyArea, String aName, Serializable ...
/** 根据属性名从绑定中取得属性值.
*
* @param aPropertyName 属性名
* @return 从绑定中取得的属性值
*/
public String getPropertyFromBinding(String aPropertyName)
{
return CacheConfigReader.getInstance()
.getPropertyFromBinding(aPropertyName);
}
/** 释放client.
*
...
/** 根据Key从缓存删除缓存数据.
*
* @param aKeyArea Key
*/
public void remove(String aKeyArea)
{
CassandraClientPool pool = CassandraClientPoolFactory.INSTANCE.get();
// 取得客户端(群集服务器)
CassandraClient client = null;
try
{
// 从群集服务器获得一个客 ...
/**根据Key和column从缓存读取数据.
* @param aKeyArea Key
* @param aName column
* @return Object 缓存数据
*/
public Object get(String aKeyArea, String aName)
{
Map<String, Object> resultMap = getResultMap(aKeyArea, aName);
if (resultMap != null)
{
...
package com.huawei.support.cache.impl;
import static me.prettyprint.cassandra.utils.StringUtils.bytes;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import me.prettyprint.cassandra.service.CassandraClient;
import me.prettyprint.cassandra.service.CassandraClientPool;
imp ...
/** 解析默认Keyspace.
*/
private String readDefaultKeyspace(XPath aXpath, Document aDoc)
throws XPathExpressionException
{
XPathExpression pathExpression = aXpath.compile("//defaultKeyspace");
Node node = (Node) pathExpression.evaluate(aDoc, XPathConst ...
/** 解析默认Keyspace.
*/
private String readDefaultKeyspace(XPath aXpath, Document aDoc)
throws XPathExpressionException
{
XPathExpression pathExpression = aXpath.compile("//defaultKeyspace");
Node node = (Node) pathExpression.evaluate(aDoc, XPathConstan ...
/** 获取本实例.
* @return CacheConfigReader cache配置文件读取实例
*/
public static CacheConfigReader getInstance()
{
// 从classpath中读取配置文件
ClassLoader loader = Thread.currentThread().getContextClassLoader();
URL url = loader.getResource("cacheConfig.xml");
...
package com.huawei.support.cache.impl;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException ...
<?xml version="1.0" encoding="UTF-8" ?>
<cacheConfig>
<!--缓存服务器集群-->
<servers id="cassandraServers">
<list>
<value>10.71.144.80:9160</value>
<value>10.71.144.81:9160</value>
...