org.apache.camel.spi.Registry.lookupByName()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中org.apache.camel.spi.Registry.lookupByName方法的一些代码示例,展示了Registry.lookupByName的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Registry.lookupByName方法的具体详情如下:
包路径:org.apache.camel.spi.Registry
类名称:Registry
方法名:lookupByName

Registry.lookupByName介绍

暂无

代码示例

代码示例来源:origin: org.apache.camel/camel-spring

@Override
public Object resolve(EvaluationContext context, String beanName) throws AccessException {
  Object bean = null;
  try {
    bean = registry.lookupByName(beanName);
  } catch (NoSuchBeanException e) {
    // ignore
  }
  if (bean == null) {
    throw new AccessException("Could not resolve bean reference against Registry");
  }
  return bean;
}

代码示例来源:origin: org.apache.camel/camel-servletlistener

private Object lookupRegistryByName(String name) {
  return registry.lookupByName(name);
}

代码示例来源:origin: OpenWiseSolutions/openhub-framework

@Override
public Object lookupByName(String name) {
  for (Registry registry : applicationContextsRegistry.values()) {
    Object result = registry.lookupByName(name);
    if (result != null) {
      return result;
    }
  }
  return null;
}

代码示例来源:origin: org.apache.camel/camel-ejb

protected Object lookupBean() {
  return registry.lookupByName(getName());
}

代码示例来源:origin: org.apache.camel/camel-blueprint

@Override
public Language resolveLanguage(String name, CamelContext context) {
  try {
    Object bean = context.getRegistry().lookupByName(".camelBlueprint.languageResolver." + name);
    if (bean instanceof LanguageResolver) {
      LOG.debug("Found language resolver: {} in registry: {}", name, bean);
      return ((LanguageResolver) bean).resolveLanguage(name, context);
    }
  } catch (Exception e) {
    LOG.trace("Ignored error looking up bean: " + name + " due: " + e.getMessage(), e);
  }
  return super.resolveLanguage(name, context);
}

代码示例来源:origin: jboss-switchyard/components

/**
 * Only add a namespace policy if the policy ref can be resolved, which will
 * be the case on EAP but not on Karaf.
 */
protected RouteDefinition addNamespacePolicy(final RouteDefinition route) {
  if (_camelContext.getRegistry().lookupByName(NAMESPACE_POLICY_REF) != null) {
    route.routePolicyRef(NAMESPACE_POLICY_REF);
  }
  return route;
}

代码示例来源:origin: org.switchyard.components/switchyard-component-common-camel

/**
 * Only add a namespace policy if the policy ref can be resolved, which will
 * be the case on EAP but not on Karaf.
 */
protected RouteDefinition addNamespacePolicy(final RouteDefinition route) {
  if (_camelContext.getRegistry().lookupByName(NAMESPACE_POLICY_REF) != null) {
    route.routePolicyRef(NAMESPACE_POLICY_REF);
  }
  return route;
}

代码示例来源:origin: org.apache.camel/camel-github

public PullRequestFilesProducer(GitHubEndpoint endpoint) throws Exception {
  super(endpoint);
  Registry registry = endpoint.getCamelContext().getRegistry();
  Object service = registry.lookupByName(GitHubConstants.GITHUB_PULL_REQUEST_SERVICE);
  if (service != null) {
    LOG.debug("Using PullRequestService found in registry {}", service.getClass().getCanonicalName());
    pullRequestService = (PullRequestService) service;
  } else {
    pullRequestService = new PullRequestService();
  }
  initService(pullRequestService);
}

代码示例来源:origin: org.milyn/milyn-smooks-all

public void start() throws Exception {
  final SmooksFactory smooksFactory = (SmooksFactory) camelContext.getRegistry().lookupByName(SmooksFactory.class.getName());
  if (smooksFactory != null) {
    smooks = smooksFactory.createInstance(smooksConfig);
  } else {
    smooks = new Smooks(smooksConfig);
  }
}

代码示例来源:origin: org.dhatim/milyn-smooks-camel

public void start() throws Exception {
  final SmooksFactory smooksFactory = (SmooksFactory) camelContext.getRegistry().lookupByName(SmooksFactory.class.getName());
  if (smooksFactory != null) {
    smooks = smooksFactory.createInstance(smooksConfig);
  } else {
    smooks = new Smooks(smooksConfig);
  }
}

代码示例来源:origin: org.switchyard.components/switchyard-component-camel

private static RouteBuilder lookupRouteBuilder(String beanName, SwitchYardCamelContext camelContext) {
  Object bean = camelContext.getRegistry().lookupByName(beanName);
  if (bean == null) {
    throw CamelComponentMessages.MESSAGES.noJavaDSLBeanFound(beanName);
  } else if (!(bean instanceof RouteBuilder)) {
    throw CamelComponentMessages.MESSAGES.javaDSLBeanMustExtend(beanName, RouteBuilder.class.getName());
  }
  return (RouteBuilder)bean;
}

代码示例来源:origin: org.milyn/milyn-smooks-all

private Smooks createSmooks(String configUri) throws IOException, SAXException
{
  final SmooksFactory smooksFactory = (SmooksFactory) camelContext.getRegistry().lookupByName(SmooksFactory.class.getName());
  return smooksFactory != null ? smooksFactory.createInstance() : new Smooks();
}

代码示例来源:origin: org.dhatim/milyn-smooks-camel

private Smooks createSmooks(String configUri) throws IOException, SAXException
{
  final SmooksFactory smooksFactory = (SmooksFactory) camelContext.getRegistry().lookupByName(SmooksFactory.class.getName());
  return smooksFactory != null ? smooksFactory.createInstance() : new Smooks();
}

代码示例来源:origin: org.apache.camel/camel-ldif

/**
 * Get the LdapConnection. Since the object is a factory, we'll just call
 * that. A future enhancement is to use the ApacheDS LdapConnectionPool
 * object to keep a pool of working connections that avoids the connection
 * pause.
 *
 * @return The created LDAP connection.
 */
protected LdapConnection getLdapConnection() throws CamelException {
  return (LdapConnection)getEndpoint().getCamelContext().getRegistry().lookupByName(ldapConnectionName);
}

代码示例来源:origin: org.apache.camel/camel-github

public CommitConsumer(GitHubEndpoint endpoint, Processor processor, String branchName) throws Exception {
  super(endpoint, processor);
  Registry registry = endpoint.getCamelContext().getRegistry();
  Object service = registry.lookupByName(GitHubConstants.GITHUB_COMMIT_SERVICE);
  if (service != null) {
    LOG.debug("Using CommitService found in registry {}", service.getClass().getCanonicalName());
    commitService = (CommitService) service;
  } else {
    commitService = new CommitService();
  }
  initService(commitService);
  
  LOG.info("GitHub CommitConsumer: Indexing current commits...");
  List<RepositoryCommit> commits = commitService.getCommits(getRepository(), branchName, null);
  for (RepositoryCommit commit : commits) {
    commitHashes.add(commit.getSha());
  }
}

代码示例来源:origin: org.apache.camel/camel-github

public PullRequestStateProducer(GitHubEndpoint endpoint) throws Exception {
  super(endpoint);
  Registry registry = endpoint.getCamelContext().getRegistry();
  Object service = registry.lookupByName(GitHubConstants.GITHUB_COMMIT_SERVICE);
  if (service != null) {
    LOG.debug("Using CommitService found in registry {}", service.getClass().getCanonicalName());
    commitService = (CommitService) service;
  } else {
    commitService = new CommitService();
  }
  initService(commitService);
  state = endpoint.getState();
  targetUrl = endpoint.getTargetUrl();
}

代码示例来源:origin: org.apache.camel/camel-github

public AbstractGitHubConsumer(GitHubEndpoint endpoint, Processor processor) throws Exception {
  super(endpoint, processor);
  this.endpoint = endpoint;
  Registry registry = endpoint.getCamelContext().getRegistry();
  Object service = registry.lookupByName(GitHubConstants.GITHUB_REPOSITORY_SERVICE);
  if (service != null) {
    LOG.debug("Using RepositoryService found in registry {}", service.getClass().getCanonicalName());
    repositoryService = (RepositoryService) service;
  } else {
    repositoryService = new RepositoryService();
  }
  initService(repositoryService);
  repository = repositoryService.getRepository(endpoint.getRepoOwner(), endpoint.getRepoName());
}

代码示例来源:origin: org.apache.camel/camel-github

public ClosePullRequestProducer(GitHubEndpoint endpoint) throws Exception {
  super(endpoint);
  
  Registry registry = endpoint.getCamelContext().getRegistry();
  Object service = registry.lookupByName(GitHubConstants.GITHUB_PULL_REQUEST_SERVICE);
  if (service != null) {
    pullRequestService = (PullRequestService) service;
  } else {
    pullRequestService = new PullRequestService();
  }
  initService(pullRequestService);
}

代码示例来源:origin: org.apache.camel/camel-github

public CreateIssueProducer(GitHubEndpoint endpoint) throws Exception {
  super(endpoint);
  
  Registry registry = endpoint.getCamelContext().getRegistry();
  Object service = registry.lookupByName(GitHubConstants.GITHUB_ISSUE_SERVICE);
  if (service != null) {
    issueService = (IssueService) service;
  } else {
    issueService = new IssueService();
  }
  initService(issueService);
}

代码示例来源:origin: org.apache.camel/camel-github

public AbstractGitHubProducer(GitHubEndpoint endpoint) throws Exception {
  super(endpoint);
  this.endpoint = endpoint;
  Registry registry = endpoint.getCamelContext().getRegistry();
  Object service = registry.lookupByName(GitHubConstants.GITHUB_REPOSITORY_SERVICE);
  if (service != null) {
    repositoryService = (RepositoryService) service;
  } else {
    repositoryService = new RepositoryService();
  }
  initService(repositoryService);
  repository = repositoryService.getRepository(endpoint.getRepoOwner(), endpoint.getRepoName());
}

相关文章