本文整理汇总了Java中org.onosproject.store.service.Serializer类的典型用法代码示例。如果您正苦于以下问题:Java Serializer类的具体用法?Java Serializer怎么用?Java Serializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Serializer类属于org.onosproject.store.service包,在下文中一共展示了Serializer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: activate
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
@Activate
public void activate() {
KryoNamespace.Builder kryoBuilder = new KryoNamespace.Builder()
.register(KryoNamespaces.API)
.register(UiTopoLayoutId.class)
.register(UiTopoLayout.class);
layouts = storageService.<UiTopoLayoutId, UiTopoLayout>consistentMapBuilder()
.withSerializer(Serializer.using(kryoBuilder.build()))
.withName("onos-topo-layouts")
.withRelaxedReadConsistency()
.build();
layoutMap = layouts.asJavaMap();
// Create and add the default layout, if needed.
layoutMap.computeIfAbsent(DEFAULT_ID, k -> new UiTopoLayout(k, null, null));
log.info("Started");
}
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:UiTopoLayoutManager.java
示例2: activate
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
@Activate
public void activate() {
Serializer serializer = Serializer.using(KryoNamespaces.API,
ObjectNode.class, ArrayNode.class,
JsonNodeFactory.class, LinkedHashMap.class,
TextNode.class, BooleanNode.class,
LongNode.class, DoubleNode.class, ShortNode.class,
IntNode.class, NullNode.class);
prefsConsistentMap = storageService.<String, ObjectNode>consistentMapBuilder()
.withName(ONOS_USER_PREFERENCES)
.withSerializer(serializer)
.withRelaxedReadConsistency()
.build();
prefsConsistentMap.addListener(prefsListener);
prefs = prefsConsistentMap.asJavaMap();
register(core);
log.info("Started");
}
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:UiExtensionManager.java
示例3: activate
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
@Activate
public void activate() {
mcastRib = storageService.<McastRoute, MulticastData>consistentMapBuilder()
.withName(MCASTRIB)
.withSerializer(Serializer.using(KryoNamespace.newBuilder()
.register(KryoNamespaces.API)
.register(
AtomicReference.class,
MulticastData.class,
McastRoute.class,
McastRoute.Type.class
).build()))
//.withRelaxedReadConsistency()
.build();
mcastRib.addListener(mcastMapListener);
mcastRoutes = mcastRib.asJavaMap();
log.info("Started");
}
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:DistributedMcastStore.java
示例4: activate
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
@Activate
public void activate() {
local = clusterService.getLocalNode().id();
meters = storageService.<MeterKey, MeterData>consistentMapBuilder()
.withName(METERSTORE)
.withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API),
MeterKey.class,
MeterData.class,
DefaultMeter.class,
DefaultBand.class,
Band.Type.class,
MeterState.class,
Meter.Unit.class,
MeterFailReason.class)).build();
meters.addListener(mapListener);
log.info("Started");
}
开发者ID:shlee89,项目名称:athena,代码行数:23,代码来源:DistributedMeterStore.java
示例5: activate
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
@Activate
public void activate() {
log.info("Started");
alarms = storageService.<AlarmId, Alarm>consistentMapBuilder()
.withName("onos-alarm-table")
.withSerializer(Serializer.using(KryoNamespaces.API,
Alarm.class,
DefaultAlarm.class,
AlarmId.class,
AlarmEvent.Type.class,
Alarm.SeverityLevel.class,
AlarmEntityId.class))
.build();
alarms.addListener(listener);
alarmsMap = alarms.asJavaMap();
}
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:DistributedAlarmStore.java
示例6: activate
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
@Activate
protected void activate() {
allocationMap = storageService.<HostId, IpAssignment>consistentMapBuilder()
.withName("onos-dhcp-assignedIP")
.withSerializer(Serializer.using(
new KryoNamespace.Builder()
.register(KryoNamespaces.API)
.register(IpAssignment.class,
IpAssignment.AssignmentStatus.class,
Date.class,
long.class,
Ip4Address.class)
.build()))
.build();
freeIPPool = storageService.<Ip4Address>setBuilder()
.withName("onos-dhcp-freeIP")
.withSerializer(Serializer.using(KryoNamespaces.API))
.build()
.asDistributedSet();
log.info("Started");
}
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:DistributedDhcpStore.java
示例7: activate
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
@Activate
public void activate() {
appId = coreService.registerApplication(VTNRSC_APP);
networkIdAsKeyStore = storageService.<TenantNetworkId, TenantNetwork>consistentMapBuilder()
.withName(TENANTNETWORK)
.withApplicationId(appId)
.withPurgeOnUninstall()
.withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API),
TenantNetworkId.class,
DefaultTenantNetwork.class,
TenantNetwork.State.class,
TenantId.class,
TenantNetwork.Type.class,
PhysicalNetwork.class,
SegmentationId.class))
.build().asJavaMap();
log.info("Started");
}
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:TenantNetworkManager.java
示例8: activate
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
@Activate
public void activate() {
appId = coreService.registerApplication(VTNRSC_APP);
subnetStore = storageService.<SubnetId, Subnet>consistentMapBuilder()
.withName(SUBNET)
.withApplicationId(appId)
.withPurgeOnUninstall()
.withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API),
Subnet.class,
SubnetId.class,
TenantNetworkId.class,
TenantId.class,
HostRoute.class,
DefaultHostRoute.class,
Subnet.Mode.class,
AllocationPool.class,
DefaultAllocationPool.class,
DefaultSubnet.class,
IpAddress.Version.class))
.build().asJavaMap();
log.info("Started");
}
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:SubnetManager.java
示例9: McastHandler
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
/**
* Constructs the McastEventHandler.
*
* @param srManager Segment Routing manager
*/
public McastHandler(SegmentRoutingManager srManager) {
coreAppId = srManager.coreService.getAppId(CoreService.CORE_APP_NAME);
this.srManager = srManager;
this.storageService = srManager.storageService;
this.topologyService = srManager.topologyService;
mcastKryo = new KryoNamespace.Builder()
.register(KryoNamespaces.API)
.register(McastStoreKey.class)
.register(McastRole.class);
mcastNextObjStore = storageService
.<McastStoreKey, NextObjective>consistentMapBuilder()
.withName("onos-mcast-nextobj-store")
.withSerializer(Serializer.using(mcastKryo.build("McastHandler-NextObj")))
.build();
mcastRoleStore = storageService
.<McastStoreKey, McastRole>consistentMapBuilder()
.withName("onos-mcast-role-store")
.withSerializer(Serializer.using(mcastKryo.build("McastHandler-Role")))
.build();
}
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:McastHandler.java
示例10: activate
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
@Activate
protected void activate() {
appId = coreService.registerApplication(OPENSTACK_NODEMANAGER_ID);
localNodeId = clusterService.getLocalNode().id();
leadershipService.runForLeadership(appId.name());
nodeStore = storageService.<OpenstackNode, NodeState>consistentMapBuilder()
.withSerializer(Serializer.using(NODE_SERIALIZER.build()))
.withName(OPENSTACK_NODESTORE)
.withApplicationId(appId)
.build();
deviceService.addListener(deviceListener);
configRegistry.registerConfigFactory(configFactory);
configService.addListener(configListener);
readConfiguration();
log.info("Started");
}
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:OpenstackNodeManager.java
示例11: activate
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
@Activate
public void activate() {
Map<PartitionId, DistributedPrimitiveCreator> partitionMap = Maps.newHashMap();
partitionService.getAllPartitionIds().stream()
.filter(id -> !id.equals(PartitionId.from(0)))
.forEach(id -> partitionMap.put(id, partitionService.getDistributedPrimitiveCreator(id)));
federatedPrimitiveCreator = new FederatedDistributedPrimitiveCreator(partitionMap);
transactions = this.<TransactionId, Transaction.State>consistentMapBuilder()
.withName("onos-transactions")
.withSerializer(Serializer.using(KryoNamespaces.API,
Transaction.class,
Transaction.State.class))
.buildAsyncMap();
transactionCoordinator = new TransactionCoordinator(transactions);
log.info("Started");
}
开发者ID:shlee89,项目名称:athena,代码行数:17,代码来源:StorageManager.java
示例12: newAsyncConsistentMap
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
@Override
public <K, V> AsyncConsistentMap<K, V> newAsyncConsistentMap(String name, Serializer serializer) {
AtomixConsistentMap atomixConsistentMap = client.getResource(name, AtomixConsistentMap.class).join();
Consumer<State> statusListener = state -> {
atomixConsistentMap.statusChangeListeners()
.forEach(listener -> listener.accept(mapper.apply(state)));
};
resourceClient.client().onStateChange(statusListener);
AsyncConsistentMap<String, byte[]> rawMap =
new DelegatingAsyncConsistentMap<String, byte[]>(atomixConsistentMap) {
@Override
public String name() {
return name;
}
};
AsyncConsistentMap<K, V> transcodedMap = DistributedPrimitives.<K, V, String, byte[]>newTranscodingMap(rawMap,
key -> HexString.toHexString(serializer.encode(key)),
string -> serializer.decode(HexString.fromHexString(string)),
value -> value == null ? null : serializer.encode(value),
bytes -> serializer.decode(bytes));
return transcodedMap;
}
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:StoragePartitionClient.java
示例13: newResourceClient
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
private ResourceClient newResourceClient(Transport transport,
io.atomix.catalyst.serializer.Serializer serializer,
Collection<ResourceType> resourceTypes) {
ResourceRegistry registry = new ResourceRegistry();
resourceTypes.forEach(registry::register);
CopycatClient copycatClient = CopycatClient.builder()
.withServerSelectionStrategy(ServerSelectionStrategies.ANY)
.withConnectionStrategy(ConnectionStrategies.FIBONACCI_BACKOFF)
.withRecoveryStrategy(RecoveryStrategies.RECOVER)
.withTransport(transport)
.withSerializer(serializer)
.build();
copycatClient.serializer().resolve(new ResourceManagerTypeResolver());
for (ResourceType type : registry.types()) {
try {
type.factory()
.newInstance()
.createSerializableTypeResolver()
.resolve(copycatClient.serializer().registry());
} catch (InstantiationException | IllegalAccessException e) {
throw new ResourceManagerException(e);
}
}
return new ResourceClient(new OnosCopycatClient(copycatClient, 5, 100));
}
开发者ID:shlee89,项目名称:athena,代码行数:26,代码来源:StoragePartitionClient.java
示例14: getFlowTable
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
/**
* Returns the flow table for specified device.
*
* @param deviceId identifier of the device
* @return Map representing Flow Table of given device.
*/
private Map<FlowId, Map<StoredFlowEntry, StoredFlowEntry>> getFlowTable(DeviceId deviceId) {
if (persistenceEnabled) {
return flowEntries.computeIfAbsent(deviceId, id -> persistenceService
.<FlowId, Map<StoredFlowEntry, StoredFlowEntry>>persistentMapBuilder()
.withName("FlowTable:" + deviceId.toString())
.withSerializer(new Serializer() {
@Override
public <T> byte[] encode(T object) {
return SERIALIZER.encode(object);
}
@Override
public <T> T decode(byte[] bytes) {
return SERIALIZER.decode(bytes);
}
})
.build());
} else {
return flowEntries.computeIfAbsent(deviceId, id -> Maps.newConcurrentMap());
}
}
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:DistributedFlowRuleStore.java
示例15: activate
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
@Activate
public void activate() {
tpool = Executors.newFixedThreadPool(4, groupedThreads("onos/flobj-notifier", "%d", log));
eventQ = new LinkedBlockingQueue<ObjectiveEvent>();
tpool.execute(new FlowObjectiveNotifier());
nextGroups = storageService.<Integer, byte[]>consistentMapBuilder()
.withName("flowobjective-groups")
.withSerializer(Serializer.using(
new KryoNamespace.Builder()
.register(byte[].class)
.register(Versioned.class)
.build("DistributedFlowObjectiveStore")))
.build();
nextGroups.addListener(mapListener);
nextIds = storageService.getAtomicCounter("next-objective-counter");
log.info("Started");
}
开发者ID:shlee89,项目名称:athena,代码行数:18,代码来源:DistributedFlowObjectiveStore.java
示例16: activate
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
@Activate
public void activate() {
KryoNamespace.Builder hostSerializer = KryoNamespace.newBuilder()
.register(KryoNamespaces.API);
hostsConsistentMap = storageService.<HostId, DefaultHost>consistentMapBuilder()
.withName("onos-hosts")
.withRelaxedReadConsistency()
.withSerializer(Serializer.using(hostSerializer.build()))
.build();
hosts = hostsConsistentMap.asJavaMap();
prevHosts.putAll(hosts);
hostsConsistentMap.addListener(hostLocationTracker);
log.info("Started");
}
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:DistributedHostStore.java
示例17: activate
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
@Activate
public void activate() {
KryoNamespace.Builder kryoBuilder = new KryoNamespace.Builder()
.register(KryoNamespaces.API)
.register(ConfigKey.class, ObjectNode.class, ArrayNode.class,
JsonNodeFactory.class, LinkedHashMap.class,
TextNode.class, BooleanNode.class,
LongNode.class, DoubleNode.class, ShortNode.class, IntNode.class,
NullNode.class);
configs = storageService.<ConfigKey, JsonNode>consistentMapBuilder()
.withSerializer(Serializer.using(kryoBuilder.build()))
.withName("onos-network-configs")
.withRelaxedReadConsistency()
.build();
configs.addListener(listener);
log.info("Started");
}
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:DistributedNetworkConfigStore.java
示例18: activate
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
/**
* Activate the distributed device key store.
*/
@Activate
public void activate() {
deviceKeys = storageService.<DeviceKeyId, DeviceKey>consistentMapBuilder()
.withSerializer(Serializer.using(Arrays.asList(KryoNamespaces.API),
DeviceKey.class,
DeviceKeyId.class,
DeviceKey.Type.class))
.withName("onos-device-keys")
.withRelaxedReadConsistency()
.build();
deviceKeys.addListener(listener);
deviceKeysMap = deviceKeys.asJavaMap();
log.info("Started");
}
开发者ID:shlee89,项目名称:athena,代码行数:19,代码来源:DistributedDeviceKeyStore.java
示例19: activate
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
@Activate
protected void activate() {
ApplicationId appId = coreService.registerApplication(CORDVTN_APP_ID);
serviceNetworkStore = storageService.<NetworkId, ServiceNetwork>consistentMapBuilder()
.withSerializer(Serializer.using(SERIALIZER_SERVICE))
.withName("cordvtn-servicenetstore")
.withApplicationId(appId)
.build();
serviceNetworkStore.addListener(serviceNetworkListener);
servicePortStore = storageService.<PortId, ServicePort>consistentMapBuilder()
.withSerializer(Serializer.using(SERIALIZER_SERVICE))
.withName("cordvtn-serviceportstore")
.withApplicationId(appId)
.build();
servicePortStore.addListener(servicePortListener);
log.info("Started");
}
开发者ID:opencord,项目名称:vtn,代码行数:20,代码来源:DistributedServiceNetworkStore.java
示例20: PacketRequestTracker
import org.onosproject.store.service.Serializer; //导入依赖的package包/类
public PacketRequestTracker() {
requests = storageService.<PacketRequest, Boolean>consistentMapBuilder()
.withName("packet-requests")
.withSerializer(new Serializer() {
KryoNamespace kryo = new KryoNamespace.Builder()
.register(KryoNamespaces.API)
.build();
@Override
public <T> byte[] encode(T object) {
return kryo.serialize(object);
}
@Override
public <T> T decode(byte[] bytes) {
return kryo.deserialize(bytes);
}
}).build();
}
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:19,代码来源:DistributedPacketStore.java
注:本文中的org.onosproject.store.service.Serializer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论