当前位置: 首页>>代码示例>>Java>>正文


Java ActivationSpec类代码示例

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


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


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