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

Java Bind类代码示例

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

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



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

示例1: bindMessageConsumer

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * 
 * is invoked when new provider message consumer is registered in the OSGi context.
 * 
 * @param consumer
 *            registered provider message consumer
 */
@Bind(aggregate = true, optional = true)
public void bindMessageConsumer(ProviderMessageConsumer consumer) {
    try {
        MessageConsumer jmsConsumer = getSession().createConsumer(
                getDestination(),
                getMessageTypeSelector(consumer.getConsumedMessageType(),
                        consumer.getConsumedMessageVersion()));
        JMSMessageConsumerImpl cntJMSMessageConsumer = new JMSMessageConsumerImpl();
        cntJMSMessageConsumer.setCommunoteMessageConsumer(consumer);
        cntJMSMessageConsumer.setJmsMessageConsumer(jmsConsumer);
        cntJMSMessageConsumer.setJmsSender(jmsSender);
        jmsMessageConsumers.put(consumer, cntJMSMessageConsumer);
        cntJMSMessageConsumer.start();
        LOG.debug("JMS message consumer has been instantiated and bound.");
    } catch (JMSException e) {
        LOG.error("JMS message consumer has not been instantiated. "
                + consumer.getClass().getName(), e);
    }
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:27,代码来源:ConsumerFactory.java


示例2: bindHttpService

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * HTTP service ready
 * 
 * MOD_BD_20170724
 * 
 * @param aHttpService
 *            The bound service
 * @param aServiceProperties
 *            The HTTP service properties
 */
@Bind(id = IPOJO_ID_HTTP)
private void bindHttpService(final HttpService aHttpService,
        final Map<?, ?> aServiceProperties) {

    final Object rawPort = aServiceProperties.get(HTTP_SERVICE_PORT);

    if (rawPort instanceof Number) {
        // Get the integer
    	pHttpDefaultPort = ((Number) rawPort).intValue();

    } else if (rawPort instanceof CharSequence) {
        // Parse the string
    	pHttpDefaultPort = Integer.parseInt(rawPort.toString());

    } else {
        // Unknown port type
        pLogger.log(LogService.LOG_WARNING, "Couldn't read access port="
                + rawPort);
        pHttpDefaultPort = -1;
    }

    pLogger.log(LogService.LOG_INFO, String.format("Default Http port provided by Http Service [%s]",
    				pHttpDefaultPort));
    
}
 
开发者ID:cohorte,项目名称:cohorte-herald,代码行数:36,代码来源:CHttpServiceAvailabilityChecker.java


示例3: bindListener

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * A message listener has been bound
 *
 * @param aListener
 *            A message listener
 * @param aReference
 *            The injected service reference
 */
@Bind(id = ID_LISTENERS, aggregate = true, optional = true)
protected void bindListener(final IMessageListener aListener,
		final ServiceReference<IMessageListener> aReference) {

	final Object rawFilters = aReference
			.getProperty(IConstants.PROP_FILTERS);
	String[] filters;
	if (rawFilters instanceof String) {
		// Single filter
		filters = new String[] { (String) rawFilters };

	} else if (rawFilters instanceof String[]) {
		// Copy the array
		final String[] givenFilters = (String[]) rawFilters;
		filters = Arrays.copyOf(givenFilters, givenFilters.length);

	} else {
		// Unreadable filters
		return;
	}

	addMessageListener(aListener, filters);
}
 
开发者ID:cohorte,项目名称:cohorte-herald,代码行数:32,代码来源:Herald.java


示例4: bindTransport

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * A transport implementation has been bound
 *
 * @param aTransport
 *            A transport implementation
 * @param aReference
 *            The injected service reference
 */
@Bind(id = ID_TRANSPORTS, aggregate = true, optional = true)
protected void bindTransport(final ITransport aTransport,
		final ServiceReference<ITransport> aReference) {

	final String accessId = (String) aReference
			.getProperty(IConstants.PROP_ACCESS_ID);
	if (accessId == null || accessId.isEmpty()) {
		// Ignore invalid access IDs
		return;
	}

	synchronized (pTransports) {
		// Store the service
		pTransports.put(accessId, aTransport);

		if (pSvcRegistration == null) {
			// We have at least one service: provide our service
			pSvcRegistration = pContext.registerService(IHerald.class,
					this, null);
		}
	}
}
 
开发者ID:cohorte,项目名称:cohorte-herald,代码行数:31,代码来源:Herald.java


示例5: bindHttpService

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * HTTP service ready
 * 
 * @param aHttpService
 *            The bound service
 * @param aServiceProperties
 *            The HTTP service properties
 */
@Bind(id = IPOJO_ID_HTTP)
private void bindHttpService(final HttpService aHttpService,
        final Map<?, ?> aServiceProperties) {

    final Object rawPort = aServiceProperties.get(HTTP_SERVICE_PORT);

    if (rawPort instanceof Number) {
        // Get the integer
        pHttpPort = ((Number) rawPort).intValue();

    } else if (rawPort instanceof CharSequence) {
        // Parse the string
        pHttpPort = Integer.parseInt(rawPort.toString());

    } else {
        // Unknown port type
        pLogger.log(LogService.LOG_WARNING, "Couldn't read access port "
                + rawPort);
        pHttpPort = -1;
    }
}
 
开发者ID:cohorte,项目名称:cohorte-remote-services,代码行数:30,代码来源:ServletWrapper.java


示例6: bindHttpService

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * HTTP service ready: store its listening port
 *
 * @param aHttpService
 *            The bound service
 * @param aServiceProperties
 *            The HTTP service properties
 */
@Bind(id = IPOJO_ID_HTTP)
private void bindHttpService(final HttpService aHttpService,
        final Map<?, ?> aServiceProperties) {

    final Object rawPort = aServiceProperties.get(HTTP_SERVICE_PORT);

    if (rawPort instanceof Number) {
        // Get the integer
        pHttpPort = ((Number) rawPort).intValue();

    } else if (rawPort instanceof CharSequence) {
        // Parse the string
        pHttpPort = Integer.parseInt(rawPort.toString());

    } else {
        // Unknown port type
        pLogger.log(LogService.LOG_WARNING, "Couldn't read access port="
                + rawPort);
        pHttpPort = -1;
    }

    pLogger.log(LogService.LOG_INFO, "JABSORB-RPC endpoint bound to port="
            + pHttpPort);
}
 
开发者ID:cohorte,项目名称:cohorte-remote-services,代码行数:33,代码来源:JabsorbRpcExporter.java


示例7: bind

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * Callback that binds a REST module.
 *
 * @param aApplication
 *            REST module
 */
@Bind(aggregate = true)
private void bind(IRestApplication aApplication) {
	pLogger.log(LogService.LOG_INFO, "Binding to a REST application.");
	boolean valid = false;
	synchronized (this) {
		if (this.pValid) {
			register(aApplication);
			valid = true;
		} else {
			this.pAwaiting.add(aApplication);
		}
	}
	pLogger.log(LogService.LOG_INFO, valid ? "Valid application."
			: "Invalid application.");
}
 
开发者ID:isandlaTech,项目名称:cohorte-utilities,代码行数:22,代码来源:CRestPublisher.java


示例8: registerNoteContentPreProcessor

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * Adds the given processor to the list of processors.
 * 
 * @param noteRenderingPreProcessor
 *            The processor.
 */
@Bind(id = "registerContentProcessor", optional = true, aggregate = true)
public void registerNoteContentPreProcessor(
        NoteContentRenderingPreProcessor noteRenderingPreProcessor) {
    ServiceLocator.findService(NoteRenderingPreProcessorManager.class).addProcessor(
            noteRenderingPreProcessor);
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:13,代码来源:NoteRenderingPreProcessorRegistry.java


示例9: registerNoteMetadataPreProcessor

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * Adds the given processor to the list of processors.
 * 
 * @param noteRenderingPreProcessor
 *            The processor.
 */
@Bind(id = "registerProcessor", optional = true, aggregate = true)
public void registerNoteMetadataPreProcessor(
        NoteMetadataRenderingPreProcessor noteRenderingPreProcessor) {
    ServiceLocator.findService(NoteRenderingPreProcessorManager.class).addProcessor(
            noteRenderingPreProcessor);
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:13,代码来源:NoteRenderingPreProcessorRegistry.java


示例10: registerImmutablePreProcessor

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * Adds the given processor to the list of processors.
 * 
 * @param notePreProcessor
 *            The processor.
 */
@Bind(id = "noteStoringImmutableContentPreProcessorHook", optional = true, aggregate = true)
public void registerImmutablePreProcessor(
        NoteStoringImmutableContentPreProcessor notePreProcessor) {
    ServiceLocator.instance().getService(NoteStoringPreProcessorManager.class)
            .addProcessor(notePreProcessor);
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:13,代码来源:NoteStoringEditableContentPreProcessorRegistry.java


示例11: register

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * Registers the Service.
 *
 * @param controller
 *            The controller.
 */
@Bind(id = "controllerRegistry", optional = true, aggregate = true)
public void register(Controller controller) {
    List<String> urlPatterns = new ArrayList<String>();
    UrlMapping mapping = controller.getClass().getAnnotation(UrlMapping.class);
    if (mapping != null) {
        urlPatterns.add(mapping.value());
        addAdministrationView(mapping, controller);
    }
    UrlMappings mappings = controller.getClass().getAnnotation(UrlMappings.class);
    if (mappings != null) {
        for (String urlMapping : mappings.mappings()) {
            urlPatterns.add(urlMapping);
        }
    }
    mapper.registerController(controller, urlPatterns);

    StartpageController startpageMarker = controller.getClass().getAnnotation(
            StartpageController.class);
    if (startpageMarker != null) {
        if (urlPatterns.size() == 0) {
            LOGGER.warn("Startpage marker ignored because no URL mapping is defined");
        } else {
            registerStartpageController(controller, urlPatterns.get(0));
        }
    } else {
        LOGGER.debug("No startpage marker found");
    }
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:35,代码来源:DynamicUrlHandlerMappingRegistry.java


示例12: registerPermissionFilter

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * Registers the given filter.
 * 
 * @param permissionFilter
 *            The filter to register.
 */
@Bind(id = "registerFilter", optional = true, aggregate = true)
public void registerPermissionFilter(NotePermissionFilter permissionFilter) {
    ServiceLocator.instance().getService(NotePermissionManagement.class)
            .addPermissionFilter(permissionFilter);
    LOGGER.debug("Added note permission filter {}", permissionFilter.getClass().getName());
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:13,代码来源:NotePermissionFilterRegistry.java


示例13: register

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * Register a JS messages extension
 *
 * @param extension
 *            the extension to register
 * @param reference
 *            reference to the OSGI service
 */
@Bind(id = "registerJsMessagesExtension", aggregate = true, optional = true)
public void register(JsMessagesExtension extension, ServiceReference reference) {
    String symbolicName = reference.getBundle().getSymbolicName();
    JsMessagesRegistry registry = getMessagesRegistry();
    for (String category : extension.getJsMessageKeys().keySet()) {
        registry.addMessageKeys(symbolicName, category, extension.getJsMessageKeys().get(
                category));
    }
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:18,代码来源:JsMessagesExtensionRegistry.java


示例14: registerAttachmentStoringPreProcessor

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * Adds the given processor to the list of processors.
 * 
 * @param attachmentStoringPreProcessor
 *            The processor.
 */
@Bind(id = "registerAttachmentStoringPreProcessor", optional = true, aggregate = true)
public void registerAttachmentStoringPreProcessor(
        AttachmentStoringPreProcessor attachmentStoringPreProcessor) {
    ServiceLocator.instance().getService(ResourceStoringManagement.class)
            .addAttachmentStoringPreProcessor(attachmentStoringPreProcessor);
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:13,代码来源:AttachmentStoringPreProcessorRegistry.java


示例15: registerCommunoteAuthenticationFilter

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * Method to register a filter.
 * 
 * @param filter
 *            The filter to register.
 */
@Bind(id = "registerFilter", optional = true, aggregate = true)
public void registerCommunoteAuthenticationFilter(CommunoteAuthenticationFilter filter) {
    AuthenticationManager authenticationManager = WebServiceLocator.instance()
            .getWebApplicationContext()
            .getBean("authenticationManager", AuthenticationManager.class);
    filter.setAuthenticationManager(authenticationManager);
    ServiceLocator.instance().getService(AuthenticationFilterManagement.class)
            .addFilter(filter);
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:16,代码来源:CommunoteAuthenticationFilterRegistry.java


示例16: bindService

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * Bind the activity service
 * 
 * @param activityService
 *            the ActivityService service
 */
// using bind method because Requires annotation does not work (the service is null when
// accessing it - no idea why)
@Bind
public void bindService(ActivityService activityService) {
    this.activityService = activityService;
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:13,代码来源:ActivityBaseActivator.java


示例17: bindEmbeddedConfiguration

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * If there is a embedded configuration set it
 * 
 * @param embeddedConfiguration
 *            the configuration
 */
@Bind(optional = true)
public synchronized void bindEmbeddedConfiguration(
        ActiveMQEmbeddedConfiguration embeddedConfiguration) {
    this.embeddedConfiguration = embeddedConfiguration;
    if (callback != null) {
        callback.onConfigurationChanged();
    }
}
 
开发者ID:Communote,项目名称:communote-server,代码行数:15,代码来源:ActiveMQAdapterConfiguration.java


示例18: bindShape

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * Injects an available <tt>SimpleShape</tt> into the drawing frame.
 * 
 * @param name The name of the injected <tt>SimpleShape</tt>.
 * @param icon The icon associated with the injected <tt>SimpleShape</tt>.
 * @param shape The injected <tt>SimpleShape</tt> instance.
 **/
@Bind(aggregate=true)
public void bindShape(SimpleShape shape, Map attrs) {
  final DefaultShape delegate = new DefaultShape(shape);
  final String name = (String) attrs.get(SimpleShape.NAME_PROPERTY);
  final Icon icon = (Icon) attrs.get(SimpleShape.ICON_PROPERTY);
  
  if ( name == null || icon == null ) return;
  
  m_shapes.put(name, delegate);
  
  SwingUtils.invokeAndWait( new Runnable() {
    public void run() {
      JButton button = new JButton(icon);
      button.setActionCommand(name);
      button.setToolTipText(name);
      button.addActionListener(m_reusableActionListener);

      if (m_selected == null) {
        button.doClick();
      }

      m_toolbar.add(button);
      m_toolbar.validate();
      repaint();
    }      
  });
}
 
开发者ID:mcculls,项目名称:osgi-in-action,代码行数:35,代码来源:PaintFrame.java


示例19: bindHttpService

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * HTTP service ready
 *
 * @param aHttpService
 *            The bound service
 * @param aServiceProperties
 *            The HTTP service properties
 * @deprecated
 */
@Bind(id = IPOJO_ID_HTTP)
private void bindHttpService(final HttpService aHttpService,
        final Map<?, ?> aServiceProperties) {
	// MOD_BD_20160915 using HttpServiceAvailabilityChecker component to retrieve the right port
	/* 
    final Object rawPort = aServiceProperties.get(HTTP_SERVICE_PORT);

    if (rawPort instanceof Number) {
        // Get the integer
        pHttpPort = ((Number) rawPort).intValue();

    } else if (rawPort instanceof CharSequence) {
        // Parse the string
        pHttpPort = Integer.parseInt(rawPort.toString());

    } else {
        // Unknown port type
        pLogger.log(LogService.LOG_WARNING, "Couldn't read access port="
                + rawPort);
        pHttpPort = -1;
    }

    pLogger.log(LogService.LOG_INFO, "HTTP Receiver bound to port="
            + pHttpPort);
    */
}
 
开发者ID:cohorte,项目名称:cohorte-herald,代码行数:36,代码来源:HttpReceiver.java


示例20: bindHttpServiceAvailabilityChecker

import org.apache.felix.ipojo.annotations.Bind; //导入依赖的package包/类
/**
 * Http Service Availability Checker ready
 * 
 * @param aHttpServiceAvailablityChecker
 * 				The bound service
 */
@Bind(id = BIND_ID_HTTPSERVICE_AVAILABILITY_CHECKER)
private void bindHttpServiceAvailabilityChecker(final IHttpServiceAvailabilityChecker aHttpServiceAvailablityChecker) {
	// update port
	pHttpPort = aHttpServiceAvailablityChecker.getPort();
	pLogger.log(LogService.LOG_INFO, "HTTP Receiver bound to port="
            + pHttpPort);
}
 
开发者ID:cohorte,项目名称:cohorte-herald,代码行数:14,代码来源:HttpReceiver.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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