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

Java ActivationSpec类代码示例

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

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



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

示例1: afterPropertiesSet

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
/**
 * Prepares the message endpoint, and automatically activates it
 * if the "autoStartup" flag is set to "true".
 */
@Override
public void afterPropertiesSet() throws ResourceException {
	if (getResourceAdapter() == null) {
		throw new IllegalArgumentException("Property 'resourceAdapter' is required");
	}
	if (getMessageEndpointFactory() == null) {
		throw new IllegalArgumentException("Property 'messageEndpointFactory' is required");
	}
	ActivationSpec activationSpec = getActivationSpec();
	if (activationSpec == null) {
		throw new IllegalArgumentException("Property 'activationSpec' is required");
	}

	if (activationSpec.getResourceAdapter() == null) {
		activationSpec.setResourceAdapter(getResourceAdapter());
	}
	else if (activationSpec.getResourceAdapter() != getResourceAdapter()) {
		throw new IllegalArgumentException("ActivationSpec [" + activationSpec +
				"] is associated with a different ResourceAdapter: " + activationSpec.getResourceAdapter());
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:GenericMessageEndpointManager.java


示例2: createActivationSpec

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
@Override
public ActivationSpec createActivationSpec(ResourceAdapter adapter, JmsActivationSpecConfig config) {
	Class<?> activationSpecClassToUse = this.activationSpecClass;
	if (activationSpecClassToUse == null) {
		activationSpecClassToUse = determineActivationSpecClass(adapter);
		if (activationSpecClassToUse == null) {
			throw new IllegalStateException("Property 'activationSpecClass' is required");
		}
	}

	ActivationSpec spec = (ActivationSpec) BeanUtils.instantiateClass(activationSpecClassToUse);
	BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(spec);
	if (this.defaultProperties != null) {
		bw.setPropertyValues(this.defaultProperties);
	}
	populateActivationSpecProperties(bw, config);
	return spec;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:19,代码来源:StandardJmsActivationSpecFactory.java


示例3: endpointActivation

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
/**
 * This is called during the activation of a message endpoint.
 *
 * @param endpointFactory
 *            A message endpoint factory instance.
 * @param spec
 *            An activation spec JavaBean instance.
 * @throws ResourceException
 *             generic exception
 */
public void endpointActivation(MessageEndpointFactory endpointFactory,
		ActivationSpec spec) throws ResourceException {

	if (!equals(spec.getResourceAdapter())) {
		throw new ResourceException(
				"Activation spec not initialized with this ResourceAdapter instance ("
						+ spec.getResourceAdapter() + " != " + this + ")");
	}

	if (!(spec instanceof RabbitmqActivationSpec)) {
		throw new NotSupportedException(
				"That type of ActivationSpec not supported: "
						+ spec.getClass());
	}

	RabbitmqActivation activation = new RabbitmqActivation(this,
			(RabbitmqActivationSpec) spec, endpointFactory);
	activations.put((RabbitmqActivationSpec) spec, activation);
	activation.start();

	log.tracef("endpointActivation(%s, %s)", endpointFactory, spec);

}
 
开发者ID:leogsilva,项目名称:rabbitmq-resource-adapter,代码行数:34,代码来源:RabbitmqResourceAdapter.java


示例4: endpointActivation

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
/**
 * Endpoint activation
 *
 * @param endpointFactory The endpoint factory
 * @param spec            The activation spec
 * @throws ResourceException Thrown if an error occurs
 */
@Override
public void endpointActivation(final MessageEndpointFactory endpointFactory,
                               final ActivationSpec spec) throws ResourceException {
   if (spec == null) {
      throw ActiveMQRABundle.BUNDLE.noActivationSpec();
   }
   if (!configured.getAndSet(true)) {
      try {
         setup();
      } catch (ActiveMQException e) {
         throw new ResourceException("Unable to create activation", e);
      }
   }
   if (logger.isTraceEnabled()) {
      logger.trace("endpointActivation(" + endpointFactory + ", " + spec + ")");
   }

   ActiveMQActivation activation = new ActiveMQActivation(this, endpointFactory, (ActiveMQActivationSpec) spec);
   activations.put(spec, activation);
   activation.start();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:29,代码来源:ActiveMQResourceAdapter.java


示例5: getXAResources

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
/**
 * Get XA resources
 *
 * @param specs The activation specs
 * @return The XA resources
 * @throws ResourceException Thrown if an error occurs or unsupported
 */
@Override
public XAResource[] getXAResources(final ActivationSpec[] specs) throws ResourceException {
   if (logger.isTraceEnabled()) {
      logger.trace("getXAResources(" + Arrays.toString(specs) + ")");
   }

   if (useAutoRecovery) {
      // let the TM handle the recovery
      return null;
   } else {
      List<XAResource> xaresources = new ArrayList<>();
      for (ActivationSpec spec : specs) {
         ActiveMQActivation activation = activations.get(spec);
         if (activation != null) {
            xaresources.addAll(activation.getXAResources());
         }
      }
      return xaresources.toArray(new XAResource[xaresources.size()]);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:28,代码来源:ActiveMQResourceAdapter.java


示例6: afterPropertiesSet

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
/**
 * Prepares the message endpoint, and automatically activates it
 * if the "autoStartup" flag is set to "true".
 */
public void afterPropertiesSet() throws ResourceException {
	if (getResourceAdapter() == null) {
		throw new IllegalArgumentException("Property 'resourceAdapter' is required");
	}
	if (getMessageEndpointFactory() == null) {
		throw new IllegalArgumentException("Property 'messageEndpointFactory' is required");
	}
	ActivationSpec activationSpec = getActivationSpec();
	if (activationSpec == null) {
		throw new IllegalArgumentException("Property 'activationSpec' is required");
	}

	if (activationSpec.getResourceAdapter() == null) {
		activationSpec.setResourceAdapter(getResourceAdapter());
	}
	else if (activationSpec.getResourceAdapter() != getResourceAdapter()) {
		throw new IllegalArgumentException("ActivationSpec [" + activationSpec +
				"] is associated with a different ResourceAdapter: " + activationSpec.getResourceAdapter());
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:25,代码来源:GenericMessageEndpointManager.java


示例7: createActivationSpec

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
public ActivationSpec createActivationSpec(ResourceAdapter adapter, JmsActivationSpecConfig config) {
	Class activationSpecClassToUse = this.activationSpecClass;
	if (activationSpecClassToUse == null) {
		activationSpecClassToUse = determineActivationSpecClass(adapter);
		if (activationSpecClassToUse == null) {
			throw new IllegalStateException("Property 'activationSpecClass' is required");
		}
	}

	ActivationSpec spec = (ActivationSpec) BeanUtils.instantiateClass(activationSpecClassToUse);
	BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(spec);
	if (this.defaultProperties != null) {
		bw.setPropertyValues(this.defaultProperties);
	}
	populateActivationSpecProperties(bw, config);
	return spec;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:18,代码来源:StandardJmsActivationSpecFactory.java


示例8: endpointActivation

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
@Override
public void endpointActivation(MessageEndpointFactory endpointFactory, 
                               ActivationSpec spec) 
                               throws ResourceException {
    
    log.info("[TrafficResourceAdapter] endpointActivation()"); 
    tSpec = (TrafficActivationSpec) spec;
    /* New in JCA 1.7 - Get the endpoint class implementation (i.e. the
     * MDB class). This allows looking at the MDB implementation for
     * annotations. */
    Class endpointClass = endpointFactory.getEndpointClass();
    tSpec.setBeanClass(endpointClass);
    tSpec.findCommandsInMDB();
    
    /* MessageEndpoint msgEndpoint = endpointFactory.createEndpoint(null);
     * but we need to do that in a different thread, otherwise the MDB
     * never deploys. */
    ObtainEndpointWork work = new ObtainEndpointWork(this, endpointFactory);
    workManager.scheduleWork(work);      
}
 
开发者ID:osmanpub,项目名称:oracle-samples,代码行数:21,代码来源:TrafficResourceAdapter.java


示例9: endpointActivation

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
@Override
public void endpointActivation(MessageEndpointFactory endpointFactory, ActivationSpec activationSpec) throws ResourceException {
	FSWatcherActivationSpec fsWatcherAS = (FSWatcherActivationSpec) activationSpec;
	
	try {
		WatchKey watchKey = fileSystem.getPath(fsWatcherAS.getDir()).register(watchService, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY);
		listeners.put(watchKey, endpointFactory);

		// On TomEE the endpoint class is available via activationSpec.getBeanClass() 
		// even though not JavaEE 7 compliant yet!
		endpointFactoryToBeanClass.put(
				endpointFactory, 
				fsWatcherAS.getBeanClass() != null ? fsWatcherAS.getBeanClass() : endpointFactory.getEndpointClass());
	} catch (IOException e) {
		throw new ResourceException(e);
	}
}
 
开发者ID:robertpanzer,项目名称:filesystemwatch-connector,代码行数:18,代码来源:FSWatcherResourceAdapter.java


示例10: validate

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
/**
 * Validate
 * @param vo The validate object
 * @param rb The resource bundle
 * @return The list of failures found; <code>null</code> if none
 */
@SuppressWarnings("unchecked")
public List<Failure> validate(Validate vo, ResourceBundle rb)
{
   if (vo != null && Key.ACTIVATION_SPEC == vo.getKey())
   {
      if (vo.getClazz() != null && !ActivationSpec.class.isAssignableFrom(vo.getClazz()))
      {
         List<Failure> failures = new ArrayList<Failure>(1);

         Failure failure = new Failure(Severity.ERROR,
                                       SECTION,
                                       rb.getString("as.AS"),
                                       vo.getClazz().getName());
         failures.add(failure);

         return failures;
      }
   }

   return null;
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:28,代码来源:AS.java


示例11: validate

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
/**
 * Validate
 * @param v The validate object
 * @param rb The resource bundle
 * @return The list of failures found; <code>null</code> if none
 */
@SuppressWarnings("unchecked")
public List<Failure> validate(Validate v, ResourceBundle rb)
{
   if (v != null &&
       Key.ACTIVATION_SPEC == v.getKey() &&
       v.getClazz() != null &&
       ActivationSpec.class.isAssignableFrom(v.getClazz()))
   {
      ValidateClass vo = (ValidateClass)v;
      if (vo.getConfigProperties() != null && !vo.getConfigProperties().isEmpty())
      {
         return ConfigPropertiesHelper.validateConfigPropertiesType(vo, SECTION,
            rb.getString("as.ASConfigProperties"));
      }
   }

   return null;
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:25,代码来源:ASConfigProperties.java


示例12: XAResourceRecoveryInflowImpl

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
/**
 * Constructor
 *
 * @param rar The resource adapter
 * @param as The activation spec
 * @param productName The product name
 * @param productVersion The product version
 */
public XAResourceRecoveryInflowImpl(ResourceAdapter rar, ActivationSpec as,
                                    String productName, String productVersion)
{
   if (rar == null)
      throw new IllegalArgumentException("ResourceAdapter is null");

   if (as == null)
      throw new IllegalArgumentException("ActivationSpec is null");

   this.resourceAdapter = rar;
   this.activationSpec = as;
   this.productName = productName;
   this.productVersion = productVersion;
   this.jndiName = null;
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:24,代码来源:XAResourceRecoveryInflowImpl.java


示例13: initialize

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void initialize() throws Exception
{
   if (rar != null)
   {
      for (XAResource xar : rar.getXAResources(new ActivationSpec[] {as}))
      {
         // Trigger a recovery pass
         xar.recover(XAResource.TMSTARTRSCAN);
         xar.recover(XAResource.TMENDRSCAN);
      }
   }
   else
   {
      // Create ManagedConnection
      mc = mcf.createManagedConnection(subjectFactory.createSubject(securityDomain), null);
      
      // Trigger a recovery pass
      mc.getXAResource().recover(XAResource.TMSTARTRSCAN);
      mc.getXAResource().recover(XAResource.TMENDRSCAN);
   }
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:26,代码来源:XAResourceRecoveryImpl.java


示例14: endpointDeactivation

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void endpointDeactivation(MessageEndpointFactory mef, ActivationSpec as) throws Exception
{
   if (mef == null)
      throw new Exception("MessageEndpointFactory is null");

   if (as == null)
      throw new Exception("ActivationSpec is null");

   Endpoint e = new Endpoint(mef, as);
   InflowRecovery ir = activeEndpoints.get(e);

   if (ir != null)
      ir.deactivate();
   
   try
   {
      resourceAdapter.endpointDeactivation(mef, as);
   }
   finally
   {
      activeEndpoints.remove(e);
   }
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:27,代码来源:ResourceAdapterImpl.java


示例15: endpointActivation

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
@Override
public void endpointActivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec) throws ResourceException {

    final Scheduler s = scheduler.get();
    if (null == s) {
        throw new ResourceException("Quartz Scheduler is not available");
    }

    try {

        final JobSpec spec = (JobSpec) activationSpec;

        final MessageEndpoint endpoint = messageEndpointFactory.createEndpoint(null);
        spec.setEndpoint(endpoint);

        final Job job = (Job) endpoint;

        final JobDataMap jobDataMap = spec.getDetail().getJobDataMap();
        jobDataMap.put(Data.class.getName(), new Data(job));

        s.scheduleJob(spec.getDetail(), spec.getTrigger());
    } catch (final SchedulerException e) {
        throw new ResourceException("Failed to schedule job", e);
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:26,代码来源:QuartzResourceAdapter.java


示例16: endpointDeactivation

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
@Override
public void endpointDeactivation(final MessageEndpointFactory messageEndpointFactory, final ActivationSpec activationSpec) {

    final Scheduler s = scheduler.get();
    if (null == s) {
        throw new IllegalStateException("Quartz Scheduler is not available");
    }

    JobSpec spec = null;

    try {
        spec = (JobSpec) activationSpec;
        s.deleteJob(spec.jobKey());

    } catch (final SchedulerException e) {
        throw new IllegalStateException("Failed to delete job", e);
    } finally {
        if (null != spec) {
            spec.getEndpoint().release();
        }
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:23,代码来源:QuartzResourceAdapter.java


示例17: deploy

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
public void deploy(final BeanContext beanContext) throws OpenEJBException {
    final Object deploymentId = beanContext.getDeploymentID();
    if (!beanContext.getMdbInterface().equals(messageListenerInterface)) {
        throw new OpenEJBException("Deployment '" + deploymentId + "' has message listener interface " +
                beanContext.getMdbInterface().getName() + " but this MDB container only supports " +
                messageListenerInterface);
    }

    // create the activation spec
    final ActivationSpec activationSpec = createActivationSpec(beanContext);

    final EndpointFactory endpointFactory = new EndpointFactory(activationSpec, this, beanContext, null, instanceManager, xaResourceWrapper, true);

    // update the data structures
    // this must be done before activating the endpoint since the ra may immedately begin delivering messages
    beanContext.setContainer(this);
    deployments.put(deploymentId, beanContext);
    try {
        instanceManager.deploy(beanContext, activationSpec, endpointFactory);
    } catch (OpenEJBException e) {
        beanContext.setContainer(null);
        beanContext.setContainerData(null);
        deployments.remove(deploymentId);
        throw new OpenEJBException(e);
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:27,代码来源:MdbPoolContainer.java


示例18: EndpointFactory

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
public EndpointFactory(final ActivationSpec activationSpec, final BaseMdbContainer container, final BeanContext beanContext, final MdbInstanceFactory instanceFactory, final MdbInstanceManager instanceManager, final XAResourceWrapper xaResourceWrapper, boolean usePool) {
    this.activationSpec = activationSpec;
    this.container = container;
    this.beanContext = beanContext;
    this.instanceFactory = instanceFactory;
    this.instanceManager = instanceManager;
    classLoader = container.getMessageListenerInterface().getClassLoader();
    interfaces = new Class[]{container.getMessageListenerInterface(), MessageEndpoint.class};
    this.xaResourceWrapper = xaResourceWrapper;
    this.usePool = usePool;
    final BeanContext.ProxyClass proxyClass = beanContext.get(BeanContext.ProxyClass.class);
    if (proxyClass == null) {
        proxy = LocalBeanProxyFactory.createProxy(beanContext.getBeanClass(), beanContext.getClassLoader(), interfaces);
        beanContext.set(BeanContext.ProxyClass.class, new BeanContext.ProxyClass(beanContext, interfaces));
    } else {
        proxy = proxyClass.getProxy();
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:19,代码来源:EndpointFactory.java


示例19: endpointActivation

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
/**
 * @see ResourceAdapter#endpointActivation(MessageEndpointFactory,ActivationSpec)
 */
@Override
public void endpointActivation(MessageEndpointFactory endpointFactory, ActivationSpec as) throws ResourceException {
    this.logger.info("Activating message endpoint with factory " + endpointFactory + " and activation spec " + as);
    if (as instanceof KismetActivationSpec) {
        // Validate the activation spec first
        KismetActivationSpec activationSpec = (KismetActivationSpec) as;
        activationSpec.validate();

        try {
            // Establish a new connection to the given kismet server
            KismetServerConnection connection = new KismetServerConnection(activationSpec, endpointFactory);
            this.workManager.scheduleWork(connection);
            this.connections.add(connection);
        }
        catch (Throwable cause) {
            throw new ResourceException("Failed to establish new connection to kismet server at " + activationSpec.getServerName() + " on port " + activationSpec.getPortNumber(), cause);
        }
    }
    else {
        throw new ResourceException("Expected " + KismetActivationSpec.class.getName() + ", but got " + as.getClass().getName());
    }
}
 
开发者ID:os-cillation,项目名称:kismet-connector,代码行数:26,代码来源:KismetResourceAdapter.java


示例20: endpointActivation

import javax.resource.spi.ActivationSpec; //导入依赖的package包/类
/**
 * This implementation always throws a NotSupportedException.
 */
@Override
public void endpointActivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec)
		throws ResourceException {

	throw new NotSupportedException("SpringContextResourceAdapter does not support message endpoints");
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:SpringContextResourceAdapter.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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