@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; }
private Object lookupRegistryByName(String name) { return registry.lookupByName(name); }
@Override public Object lookupByName(String name) { for (Registry registry : applicationContextsRegistry.values()) { Object result = registry.lookupByName(name); if (result != null) { return result; } } return null; }
protected Object lookupBean() { return registry.lookupByName(getName()); }
@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); }
/** * 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; }
/** * 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; }
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); }
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); } }
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); } }
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; }
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(); }
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(); }
/** * 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); }
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()); } }
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(); }
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()); }
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); }
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); }
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()); }