本文整理汇总了Java中org.opendaylight.yangtools.yang.binding.util.BindingReflections类的典型用法代码示例。如果您正苦于以下问题:Java BindingReflections类的具体用法?Java BindingReflections怎么用?Java BindingReflections使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BindingReflections类属于org.opendaylight.yangtools.yang.binding.util包,在下文中一共展示了BindingReflections类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: decomposeRpcService
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
static Collection<SchemaPath> decomposeRpcService(final Class<RpcService> service,
final SchemaContext schemaContext, final Predicate<RpcRoutingStrategy> filter) {
final QNameModule moduleName = BindingReflections.getQNameModule(service);
final Module module = schemaContext.findModuleByNamespaceAndRevision(moduleName.getNamespace(),
moduleName.getRevision());
LOG.debug("Resolved service {} to module {}", service, module);
final Collection<RpcDefinition> rpcs = module.getRpcs();
final Collection<SchemaPath> ret = new ArrayList<>(rpcs.size());
for (RpcDefinition rpc : rpcs) {
final RpcRoutingStrategy strategy = RpcRoutingStrategy.from(rpc);
if (filter.test(strategy)) {
ret.add(rpc.getPath());
}
}
return ret;
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:RpcUtil.java
示例2: setUp
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
final BindingBrokerTestFactory testFactory = new BindingBrokerTestFactory();
testFactory.setExecutor(MoreExecutors.newDirectExecutorService());
testFactory.setStartWithParsedSchema(true);
testContext = testFactory.getTestContext();
testContext.start();
domMountPointService = testContext.getDomMountProviderService();
bindingMountPointService = testContext.getBindingMountPointService();
assertNotNull(domMountPointService);
final InputStream moduleStream = BindingReflections.getModuleInfo(
OpendaylightTestRpcServiceService.class)
.getModuleSourceStream();
assertNotNull(moduleStream);
final List<InputStream> rpcModels = Collections.singletonList(moduleStream);
schemaContext = YangParserTestUtils.parseYangStreams(rpcModels);
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:24,代码来源:DOMRpcServiceTestBugfix560.java
示例3: NotificationInvoker
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
private NotificationInvoker(final NotificationListener listener) {
delegate = listener;
final Map<Class<? extends Notification>, InvokerContext> builder = new HashMap<>();
for(final TypeToken<?> ifaceToken : TypeToken.of(listener.getClass()).getTypes().interfaces()) {
final Class<?> iface = ifaceToken.getRawType();
if(NotificationListener.class.isAssignableFrom(iface) && BindingReflections.isBindingClass(iface)) {
@SuppressWarnings("unchecked")
final Class<? extends NotificationListener> listenerType = (Class<? extends NotificationListener>) iface;
final NotificationListenerInvoker invoker = NotificationListenerInvoker.from(listenerType);
for(final Class<? extends Notification> type : getNotificationTypes(listenerType)) {
builder.put(type, new InvokerContext(BindingReflections.findQName(type) , invoker));
}
}
}
invokers = ImmutableMap.copyOf(builder);
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:NotificationInvoker.java
示例4: getSchemaNodeForDataObject
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
/**
* DON'T CALL THIS IN PRODUCTION CODE EVER!!! UNTIL IT IS FIXED!
* <p>
* Return the {@link DataSchemaNode}
*
* @param context SchemaContext
* @param d DataObject
* @return DataSchemaNode
* @deprecated
*/
@Deprecated
public static final DataSchemaNode getSchemaNodeForDataObject(final SchemaContext context,
final DataObject d) {
final QName qn = BindingReflections.findQName(d.getClass());
final Set<DataSchemaNode> allTheNodes = getAllTheNode(context);
// TODO: create a map to make this faster!!!!
for (final DataSchemaNode dsn : allTheNodes) {
if (dsn instanceof DataNodeContainer) {
allTheNodes.addAll(((DataNodeContainer) dsn).getChildNodes());
}
if (dsn.getQName().equals(qn)) {
return dsn;
}
}
return null;
}
开发者ID:opendaylight,项目名称:ttp,代码行数:29,代码来源:TTPUtils.java
示例5: getSchemaNodeForDataObject
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
/**
* DON'T CALL THIS IN PRODUCTION CODE EVER!!! UNTIL IT IS FIXED!
*
* Return the {@link DataSchemaNode}
*
* @param context SchemaContext
* @param d DataObject
* @return null
* @deprecated
*/
@Deprecated
public DataSchemaNode getSchemaNodeForDataObject(final SchemaContext context, final DataObject d) {
final QName qn = BindingReflections.findQName(d.getClass());
final Set<DataSchemaNode> allTheNodes = getAllTheNode(context);
// TODO: create a map to make this faster!!!!
for ( final DataSchemaNode dsn : allTheNodes ) {
if(dsn instanceof DataNodeContainer) {
allTheNodes.addAll(((DataNodeContainer)dsn).getChildNodes());
}
if (dsn.getQName().equals(qn)) {
return dsn;
}
}
return null;
}
开发者ID:opendaylight,项目名称:ttp,代码行数:30,代码来源:TTPYangModelTest.java
示例6: AbstractRIBSupport
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
/**
* Default constructor. Requires the QName of the container augmented under the routes choice
* node in instantiations of the rib grouping. It is assumed that this container is defined by
* the same model which populates it with route grouping instantiation, and by extension with
* the route attributes container.
* @param cazeClass Binding class of the AFI/SAFI-specific case statement, must not be null
* @param containerClass Binding class of the container in routes choice, must not be null.
* @param listClass Binding class of the route list, nust not be null;
* @param afiClass address Family Class
* @param safiClass SubsequentAddressFamily
* @param destinationQname destination Qname
*/
protected AbstractRIBSupport(final Class<? extends Routes> cazeClass,
final Class<? extends DataObject> containerClass,
final Class<? extends Route> listClass, final Class<? extends AddressFamily> afiClass,
final Class<? extends SubsequentAddressFamily> safiClass,
final QName destinationQname) {
final QName qname = BindingReflections.findQName(containerClass).intern();
this.routesContainerIdentifier = new NodeIdentifier(qname);
this.routeAttributesIdentifier = new NodeIdentifier(QName.create(qname,
Attributes.QNAME.getLocalName().intern()));
this.cazeClass = requireNonNull(cazeClass);
this.containerClass = requireNonNull(containerClass);
this.listClass = requireNonNull(listClass);
this.routeQname = QName.create(qname, BindingReflections.findQName(listClass).intern().getLocalName());
this.routesListIdentifier = new NodeIdentifier(this.routeQname);
this.emptyRoutes = Builders.choiceBuilder().withNodeIdentifier(ROUTES).addChild(Builders.containerBuilder()
.withNodeIdentifier(routesContainerIdentifier()).withChild(ImmutableNodes.mapNodeBuilder(this.routeQname)
.build()).build()).build();
this.afiClass = afiClass;
this.safiClass = safiClass;
this.destinationNid = new NodeIdentifier(destinationQname);
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:34,代码来源:AbstractRIBSupport.java
示例7: setUp
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
this.ribActivator = new RIBActivator();
this.ribExtension = new SimpleRIBExtensionProviderContext();
this.ribActivator.startRIBExtensionProvider(this.ribExtension);
this.bgpActivator = new BGPActivator();
this.inetActivator = new org.opendaylight.protocol.bgp.inet.BGPActivator();
this.context = new SimpleBGPExtensionProviderContext();
this.bgpActivator.start(this.context);
this.inetActivator.start(this.context);
this.mappingService = new BindingToNormalizedNodeCodec(
GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(),
new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(
JavassistUtils.forClassPool(ClassPool.getDefault()))));
final ModuleInfoBackedContext moduleInfoBackedContext = ModuleInfoBackedContext.create();
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(BgpParameters.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(MultiprotocolCapability.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(DestinationIpv4Case.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(AdvertizedRoutes.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(BgpRib.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(Attributes1.class));
moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(MpReachNlri.class));
this.mappingService.onGlobalContextUpdated(moduleInfoBackedContext.tryToCreateSchemaContext().get());
this.schemaContext = moduleInfoBackedContext.getSchemaContext();
if (!Epoll.isAvailable()) {
this.worker = new NioEventLoopGroup();
this.boss = new NioEventLoopGroup();
}
this.serverRegistry = new StrictBGPPeerRegistry();
this.serverDispatcher = new BGPDispatcherImpl(this.context.getMessageRegistry(), this.boss, this.worker,
this.serverRegistry);
doReturn(Mockito.mock(ClusterSingletonServiceRegistration.class)).when(this.clusterSingletonServiceProvider)
.registerClusterSingletonService(any(ClusterSingletonService.class));
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:39,代码来源:AbstractAddPathTest.java
示例8: get
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
/**
* Creates a FpcCodecUtils instance.
* @param module - Yang Module the instance should use for basis
* @param topPath - Top path for the instance
* @return FpcCodecUtils
*/
static public FpcCodecUtils get(Class<?> module,
YangInstanceIdentifier topPath) {
try {
return new FpcCodecUtils(Collections.singleton(BindingReflections
.getModuleInfo(module)), topPath);
} catch (Exception e) {
LOG.error("Exception occured during FpcCodecUtilsInitialization");
throw Throwables.propagate(e);
}
}
开发者ID:opendaylight,项目名称:fpc,代码行数:17,代码来源:FpcCodecUtils.java
示例9: get
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
/**
* Creates a NameResolver for a specific module.
* @param module - Class instance of a Yang Module
* @return NameResolver instance
*/
static public NameResolver get(Class<?> module) {
try {
return new NameResolver(Collections.singleton(BindingReflections
.getModuleInfo(module)));
} catch (Exception e) {
LOG.error("Exception occured during FpcCodecUtilsInitialization");
throw Throwables.propagate(e);
}
}
开发者ID:opendaylight,项目名称:fpc,代码行数:15,代码来源:NameResolver.java
示例10: get
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
/**
* Returns a new ModuleInfoBackedContext loaded with default modules
* @return ModuleInfoBackedContext
*/
public static ModuleInfoBackedContext get() {
ModuleInfoBackedContext returnValue = ModuleInfoBackedContext.create();
loadDefaultModules(returnValue);
moduleContext.addModuleInfos(BindingReflections.loadModuleInfos());
return returnValue;
}
开发者ID:opendaylight,项目名称:fpc,代码行数:11,代码来源:SchemaManager.java
示例11: BindingContext
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
private BindingContext(final Class<DataObject> appConfigBindingClass,
final InstanceIdentifier<DataObject> appConfigPath, final Class<? extends DataSchemaNode> schemaType) {
this.appConfigBindingClass = appConfigBindingClass;
this.appConfigPath = appConfigPath;
this.schemaType = schemaType;
bindingQName = BindingReflections.findQName(appConfigBindingClass);
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:BindingContext.java
示例12: loadSchemas
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
public void loadSchemas(final Class<?>... classes) {
YangModuleInfo moduleInfo;
try {
final ModuleInfoBackedContext context = ModuleInfoBackedContext.create();
for (final Class<?> clz : classes) {
moduleInfo = BindingReflections.getModuleInfo(clz);
context.registerModuleInfo(moduleInfo);
}
this.schemaContext = context.tryToCreateSchemaContext().get();
this.domStore.onGlobalContextUpdated(this.schemaContext);
} catch (final Exception e) {
Throwables.propagateIfPossible(e);
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:16,代码来源:SchemaUpdateForTransactionTest.java
示例13: setup
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
@Before
public final void setup() throws Exception {
final YangModuleInfo moduleInfo = BindingReflections
.getModuleInfo(TwoLevelList.class);
final ModuleInfoBackedContext context = ModuleInfoBackedContext.create();
context.registerModuleInfo(moduleInfo);
this.schemaContext = context.tryToCreateSchemaContext().get();
this.dclExecutorService = new TestDCLExecutorService(
SpecialExecutors.newBlockingBoundedFastThreadPool(1, 10, "DCL" ));
this.datastore = new InMemoryDOMDataStore("TEST", this.dclExecutorService);
this.datastore.onGlobalContextUpdated(this.schemaContext);
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:15,代码来源:AbstractDataChangeListenerTest.java
示例14: registerNotificationListener
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
@Override
public <T extends Notification> ListenerRegistration<NotificationListener<T>> registerNotificationListener(
final Class<T> type, final NotificationListener<T> listener) {
final FunctionalNotificationListenerAdapter<T> adapter = new FunctionalNotificationListenerAdapter<>(codec, type, listener);
final SchemaPath domType = SchemaPath.create(true, BindingReflections.findQName(type));
final ListenerRegistration<?> domReg = domService.registerNotificationListener(adapter, domType);
return new AbstractListenerRegistration<NotificationListener<T>>(listener) {
@Override
protected void removeRegistration() {
domReg.close();
}
};
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:16,代码来源:HeliumNotificationProviderServiceWithInterestListeners.java
示例15: getNotificationTypes
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static Set<Class<? extends Notification>> getNotificationTypes(final Class<? extends org.opendaylight.yangtools.yang.binding.NotificationListener> type) {
// TODO: Investigate possibility and performance impact if we cache this or expose
// it from NotificationListenerInvoker
final Set<Class<? extends Notification>> ret = new HashSet<>();
for(final Method method : type.getMethods()) {
if(BindingReflections.isNotificationCallback(method)) {
final Class<? extends Notification> notification = (Class<? extends Notification>) method.getParameterTypes()[0];
ret.add(notification);
}
}
return ret;
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:14,代码来源:NotificationInvoker.java
示例16: getModuleBlocking
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
private Module getModuleBlocking(final Class<?> modeledClass) {
final QNameModule moduleName = BindingReflections.getQNameModule(modeledClass);
final URI namespace = moduleName.getNamespace();
final Date revision = moduleName.getRevision();
Module module = runtimeContext().getSchemaContext().findModuleByNamespaceAndRevision(namespace, revision);
if ((module == null) && this.futureSchema.waitForSchema(namespace, revision)) {
module = runtimeContext().getSchemaContext().findModuleByNamespaceAndRevision(namespace, revision);
}
Preconditions.checkState(module != null, "Schema for %s is not available.", modeledClass);
return module;
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:12,代码来源:BindingToNormalizedNodeCodec.java
示例17: createInvokerMapFor
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
public static Map<SchemaPath, NotificationListenerInvoker> createInvokerMapFor(final Class<? extends NotificationListener> implClz) {
final Map<SchemaPath, NotificationListenerInvoker> builder = new HashMap<>();
for(final TypeToken<?> ifaceToken : TypeToken.of(implClz).getTypes().interfaces()) {
Class<?> iface = ifaceToken.getRawType();
if(NotificationListener.class.isAssignableFrom(iface) && BindingReflections.isBindingClass(iface)) {
@SuppressWarnings("unchecked")
final Class<? extends NotificationListener> listenerType = (Class<? extends NotificationListener>) iface;
final NotificationListenerInvoker invoker = NotificationListenerInvoker.from(listenerType);
for(final SchemaPath path : getNotificationTypes(listenerType)) {
builder.put(path, invoker);
}
}
}
return ImmutableMap.copyOf(builder);
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:16,代码来源:BindingDOMNotificationListenerAdapter.java
示例18: getNotificationTypes
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
private static Set<SchemaPath> getNotificationTypes(final Class<? extends NotificationListener> type) {
// TODO: Investigate possibility and performance impact if we cache this or expose
// it from NotificationListenerInvoker
final Set<SchemaPath> ret = new HashSet<>();
for(final Method method : type.getMethods()) {
if(BindingReflections.isNotificationCallback(method)) {
final Class<?> notification = method.getParameterTypes()[0];
final QName name = BindingReflections.findQName(notification);
ret.add(SchemaPath.create(true, name));
}
}
return ret;
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:14,代码来源:BindingDOMNotificationListenerAdapter.java
示例19: getModuleInfos
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
@Override
protected Iterable<YangModuleInfo> getModuleInfos() throws Exception {
return ImmutableSet.of(
BindingReflections.getModuleInfo(TwoLevelList.class),
BindingReflections.getModuleInfo(TreeComplexUsesAugment.class)
);
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:8,代码来源:DataTreeChangeListenerTest.java
示例20: getModuleInfos
import org.opendaylight.yangtools.yang.binding.util.BindingReflections; //导入依赖的package包/类
@Override
protected Iterable<YangModuleInfo> getModuleInfos() throws Exception {
Builder<YangModuleInfo> moduleInfoSet = ImmutableSet.<YangModuleInfo>builder();
for (Class<?> moduleClass : ImmutableList.<Class<?>>of(
NetworkTopology.class, Neutron.class, NetconfNode.class)) {
YangModuleInfo moduleInfo = BindingReflections.getModuleInfo(moduleClass);
Preconditions.checkNotNull(moduleInfo, "Module Info for %s is not available.", moduleClass);
collectYangModuleInfo(moduleInfo, moduleInfoSet);
}
return moduleInfoSet.build();
}
开发者ID:opendaylight,项目名称:neutron,代码行数:12,代码来源:HostconfigsDataBrokerTest.java
注:本文中的org.opendaylight.yangtools.yang.binding.util.BindingReflections类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论