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

Java PlainCallbackHandler类代码示例

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

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



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

示例1: SASLConnectReconnect

import net.spy.memcached.auth.PlainCallbackHandler; //导入依赖的package包/类
SASLConnectReconnect(String username, String password, String host) {

		AuthDescriptor ad = new AuthDescriptor(new String[] { "PLAIN" },
				new PlainCallbackHandler(username, password));
		try {
			List<InetSocketAddress> addresses = AddrUtil.getAddresses(host);
			mc = new MemcachedClient(
					new ConnectionFactoryBuilder().setProtocol(Protocol.BINARY)
							.setAuthDescriptor(ad).build(), addresses);
		} catch (IOException ex) {
			System.err
					.println("Couldn't create a connection, bailing out: \nIOException "
							+ ex.getMessage());
			if (mc != null) {
				mc.shutdown();
			}
		}

	}
 
开发者ID:naver,项目名称:arcus-java-client,代码行数:20,代码来源:SASLConnectReconnect.java


示例2: activateService

import net.spy.memcached.auth.PlainCallbackHandler; //导入依赖的package包/类
@Override
public void activateService()
    throws Exception
{
    MemcacheConfiguration config = configuration.get();
    expiration = ( config.expiration().get() == null )
                 ? 3600
                 : config.expiration().get();
    String addresses = ( config.addresses().get() == null )
                       ? "localhost:11211"
                       : config.addresses().get();
    Protocol protocol = ( config.protocol().get() == null )
                        ? Protocol.TEXT
                        : Protocol.valueOf( config.protocol().get().toUpperCase() );
    String username = config.username().get();
    String password = config.password().get();
    String authMech = config.authMechanism().get() == null
                      ? "PLAIN"
                      : config.authMechanism().get();

    ConnectionFactoryBuilder builder = new ConnectionFactoryBuilder();
    builder.setProtocol( protocol );
    if( username != null && !username.isEmpty() )
    {
        String[] authType = { authMech };
        AuthDescriptor to = new AuthDescriptor( authType, new PlainCallbackHandler( username, password ) );
        builder.setAuthDescriptor( to );
    }

    client = new MemcachedClient( builder.build(), AddrUtil.getAddresses( addresses ) );
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:32,代码来源:MemcachePoolMixin.java


示例3: createAuthDescriptor

import net.spy.memcached.auth.PlainCallbackHandler; //导入依赖的package包/类
protected AuthDescriptor createAuthDescriptor() {
    String username = properties.get(PROP_USERNAME);
    String password = properties.get(PROP_PASSWORD);
    if (username == null || password == null) {
        return null;
    }
    return new AuthDescriptor(new String[]{"PLAIN"}, new PlainCallbackHandler(username, password));
}
 
开发者ID:mihaicostin,项目名称:hibernate-l2-memcached,代码行数:9,代码来源:SpyMemcacheClientFactory.java


示例4: generate

import net.spy.memcached.auth.PlainCallbackHandler; //导入依赖的package包/类
@Override
public AuthDescriptor generate(OverridableReadOnlyProperties properties) {
    String username = properties.getRequiredProperty(USERNAME_PROPERTY_KEY);
    String password = properties.getRequiredProperty(PASSWORD_PROPERTY_KEY);

    AuthDescriptor authDescriptor = new AuthDescriptor(new String[]{"PLAIN"}, new PlainCallbackHandler(username, password));
    return authDescriptor;
}
 
开发者ID:kwon37xi,项目名称:hibernate4-memcached,代码行数:9,代码来源:PlainAuthDescriptorGenerator.java


示例5: generate

import net.spy.memcached.auth.PlainCallbackHandler; //导入依赖的package包/类
@Test
public void generate() throws Exception {
    Properties props = new Properties();
    props.setProperty(PlainAuthDescriptorGenerator.USERNAME_PROPERTY_KEY, "username");
    props.setProperty(PlainAuthDescriptorGenerator.PASSWORD_PROPERTY_KEY, "password");

    AuthDescriptor authDescriptor = generator.generate(new OverridableReadOnlyPropertiesImpl(props));

    assertThat(authDescriptor).isNotNull();
    assertThat(authDescriptor.getMechs()).isEqualTo(new String[]{"PLAIN"});
    assertThat(authDescriptor.getCallback()).isExactlyInstanceOf(PlainCallbackHandler.class);
}
 
开发者ID:kwon37xi,项目名称:hibernate4-memcached,代码行数:13,代码来源:PlainAuthDescriptorGeneratorTest.java


示例6: onActivate

import net.spy.memcached.auth.PlainCallbackHandler; //导入依赖的package包/类
@Override
public void onActivate( Application application )
    throws ActivationException
{
    // Gather Configuration
    Config config = application.config().atKey( "memcache" );
    Protocol protocol = Protocol.valueOf( config.string( "protocol" ).toUpperCase( Locale.US ) );
    String addresses = config.string( "addresses" );
    String username = config.has( "username" ) ? config.string( "username" ) : null;
    String password = config.has( "password" ) ? config.string( "password" ) : null;
    String authMech = config.string( "authMechanism" );

    // Create Client
    try
    {
        ConnectionFactoryBuilder builder = new ConnectionFactoryBuilder();
        builder.setProtocol( protocol );
        if( !Strings.isEmpty( username ) )
        {
            builder.setAuthDescriptor(
                new AuthDescriptor(
                    new String[]
                    {
                        authMech
                    },
                    new PlainCallbackHandler( username, password )
                )
            );
        }
        client = new MemcachedClient( builder.build(), AddrUtil.getAddresses( addresses ) );
    }
    catch( IOException ex )
    {
        throw new ActivationException( "Unable to Activate MemcachePlugin: " + ex.getMessage(), ex );
    }

    // Create Cache Instance
    backingCache = config.bool( "metrics" )
                   ? new MemcacheCache( application.plugin( Metrics.class ), client )
                   : new MemcacheCache( client );
}
 
开发者ID:werval,项目名称:werval,代码行数:42,代码来源:MemcachePlugin.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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