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


Java DefaultLwM2mNodeDecoder类代码示例

本文整理汇总了Java中org.eclipse.leshan.core.node.codec.DefaultLwM2mNodeDecoder的典型用法代码示例。如果您正苦于以下问题:Java DefaultLwM2mNodeDecoder类的具体用法?Java DefaultLwM2mNodeDecoder怎么用?Java DefaultLwM2mNodeDecoder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setUp

import org.eclipse.leshan.core.node.codec.DefaultLwM2mNodeDecoder; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    support.givenASimpleClient();
    store = new InMemoryRegistrationStore();
    observationService = new ObservationServiceImpl(store, new StandardModelProvider(),
            new DefaultLwM2mNodeDecoder());
}
 
开发者ID:eclipse,项目名称:leshan,代码行数:8,代码来源:ObservationServiceTest.java

示例2: createAndStartServer

import org.eclipse.leshan.core.node.codec.DefaultLwM2mNodeDecoder; //导入依赖的package包/类
public static void createAndStartServer(String clusterInstanceId, String localAddress, int localPort,
        String secureLocalAddress, int secureLocalPort, String modelsFolderPath, String redisUrl) throws Exception {
    // Create Redis connector.
    // TODO: support sentinel pool and make pool configurable
    Pool<Jedis> jedis = new JedisPool(new URI(redisUrl));

    // Prepare LWM2M server.
    LeshanServerBuilder builder = new LeshanServerBuilder();
    builder.setLocalAddress(localAddress, localPort);
    builder.setLocalSecureAddress(secureLocalAddress, secureLocalPort);
    DefaultLwM2mNodeDecoder decoder = new DefaultLwM2mNodeDecoder();
    builder.setDecoder(decoder);
    builder.setCoapConfig(NetworkConfig.getStandard());

    List<ObjectModel> models = ObjectLoader.loadDefault();
    if (modelsFolderPath != null) {
        models.addAll(ObjectLoader.loadObjectsFromDir(new File(modelsFolderPath)));
    }
    LwM2mModelProvider modelProvider = new StaticModelProvider(models);
    builder.setObjectModelProvider(modelProvider);

    RedisRegistrationStore registrationStore = new RedisRegistrationStore(jedis);
    builder.setRegistrationStore(registrationStore);

    // TODO add support of public and private server key
    builder.setSecurityStore(new RedisSecurityStore(jedis));

    // Create and start LWM2M server
    LeshanServer lwServer = builder.build();

    // Create Clustering support
    RedisTokenHandler tokenHandler = new RedisTokenHandler(jedis, clusterInstanceId);
    new RedisRequestResponseHandler(jedis, lwServer, lwServer.getRegistrationService(), tokenHandler,
            lwServer.getObservationService());
    lwServer.getRegistrationService().addListener(tokenHandler);
    lwServer.getRegistrationService().addListener(new RedisRegistrationEventPublisher(jedis));

    // Start Jetty & Leshan
    lwServer.start();
}
 
开发者ID:eclipse,项目名称:leshan,代码行数:41,代码来源:LeshanClusterServer.java


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