Package org.gatein.wsrp.consumer

Examples of org.gatein.wsrp.consumer.ProducerInfo


         // Save to JCR
         List<WSRPConsumer> consumers = fromXML.getConfiguredConsumers();
         for (WSRPConsumer consumer : consumers)
         {
            ProducerInfo info = consumer.getProducerInfo();

            ProducerInfoMapping pim = producerInfosMapping.createProducerInfo(info.getId());

            // need to add to parent first to attach newly created ProducerInfoMapping
            infos.add(pim);

            // init it from ProducerInfo
View Full Code Here


   {
      String id = "test";
      WSRPConsumer consumer = registry.createConsumer(id, null, null);
      assertNotNull(consumer);
      assertEquals(id, consumer.getProducerId());
      ProducerInfo info = consumer.getProducerInfo();
      assertNotNull(info);
      assertEquals(consumer.getProducerId(), info.getId());
      EndpointConfigurationInfo endpoint = info.getEndpointConfigurationInfo();
      assertNotNull(endpoint);
      RegistrationInfo regInfo = info.getRegistrationInfo();
      assertTrue(regInfo.isUndetermined());

      WSRPConsumer fromRegistry = registry.getConsumer(id);
      assertNotNull(fromRegistry);
      assertEquals(consumer.getProducerId(), fromRegistry.getProducerId());
      ProducerInfo fromRegistryInfo = fromRegistry.getProducerInfo();
      assertNotNull(fromRegistryInfo);
      assertEquals(fromRegistry.getProducerId(), fromRegistryInfo.getId());
      assertNotNull(fromRegistryInfo.getEndpointConfigurationInfo());
      assertTrue(fromRegistryInfo.getRegistrationInfo().isUndetermined());

      assertEquals(info.getId(), fromRegistryInfo.getId());
      assertEquals(info.getEndpointConfigurationInfo(), fromRegistryInfo.getEndpointConfigurationInfo());
      assertEquals(info.getRegistrationInfo(), fromRegistryInfo.getRegistrationInfo());

      Collection consumers = registry.getConfiguredConsumers();
      assertNotNull(consumers);
      assertEquals(1, consumers.size());
      assertTrue(consumers.contains(consumer));
View Full Code Here

   }

   public ProducerInfo toProducerInfo()
   {
      // todo: should probably use a ProducerInfo implementation backed by mapping at some point
      ProducerInfo info = new ProducerInfo();

      // basic properties
      info.setKey(getKey());
      info.setId(getId());
      info.setActive(getActive());
      info.setExpirationCacheSeconds(getExpirationCacheSeconds());

      // endpoint
      EndpointConfigurationInfo endInfo = getEndpointInfo().toEndpointConfigurationInfo(info.getEndpointConfigurationInfo());
      info.setEndpointConfigurationInfo(endInfo);

      // registration
      RegistrationInfo regInfo = getRegistrationInfo().toRegistrationInfo(info.getRegistrationInfo());
      info.setRegistrationInfo(regInfo);

      return info;
   }
View Full Code Here

   }

   public void testGetProducerInfoByKey()
   {
      WSRPConsumer consumer = registry.createConsumer("id", null, null);
      ProducerInfo info = consumer.getProducerInfo();

      String key = info.getKey();
      assertNotNull(key);

      assertEquals(info, registry.getProducerInfoByKey(key));
   }
View Full Code Here

   public void testUpdateProducerInfo()
   {
      // create a foo consumer
      String id = "foo";
      WSRPConsumer consumer = registry.createConsumer(id, null, null);
      ProducerInfo info = consumer.getProducerInfo();
      String key = info.getKey();

      // change the id on the consumer's producer info and save it
      info.setId("bar");
      registry.updateProducerInfo(info);

      assertNull(registry.getConsumer(id));
      assertEquals(info, consumer.getProducerInfo());
      assertEquals(info, registry.getProducerInfoByKey(key));
View Full Code Here

   }

   public ProducerInfo toModel(ProducerInfo initial, ConsumerRegistrySPI registry)
   {
      // todo: should probably use a ProducerInfo implementation backed by mapping at some point
      ProducerInfo info = initial;
      if (initial == null)
      {
         info = new ProducerInfo(registry);
      }

      // basic properties
      info.setKey(getKey());
      info.setId(getId());
      info.setActive(getActive());
      info.setExpirationCacheSeconds(getExpirationCacheSeconds());
      info.setLastModified(getLastModified());

      // endpoint
      EndpointConfigurationInfo endInfo = getEndpointInfo().toModel(info.getEndpointConfigurationInfo(), info);
      info.setEndpointConfigurationInfo(endInfo);

      // registration
      RegistrationInfo regInfo = getRegistrationInfo().toModel(info.getRegistrationInfo(), info);
      info.setRegistrationInfo(regInfo);

      return info;
   }
View Full Code Here

      {
         throw new ConsumerException(CONSUMER_WITH_ID + id + "' already exists!");
      }


      ProducerInfo info = new ProducerInfo(this);
      info.setId(id);
      info.setExpirationCacheSeconds(expirationCacheSeconds);
      info.getEndpointConfigurationInfo().setWsdlDefinitionURL(wsdlURL);

      save(info, "Couldn't create Consumer '" + id + "'");

      log.debug(CONSUMER_WITH_ID + id + "' created");
      return createConsumerFrom(info, true);
View Full Code Here

      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "Consumer identifier", "Destroying a Consumer");

      WSRPConsumer consumer = getConsumer(id);
      if (consumer != null)
      {
         ProducerInfo info = consumer.getProducerInfo();

         try
         {
            consumer.releaseSessions();
         }
         catch (PortletInvokerException e)
         {
            log.debug("releaseSessions failed when attempting to destroy " + CONSUMER_WITH_ID + id + "'");
         }

         // if the consumer is registered, deregister it
         if (info.isRegistered())
         {
            registerOrDeregisterConsumerWith(id, false);
         }

         deactivateConsumer(consumer);
View Full Code Here

   public void persistConsumer(WSRPConsumer consumer)
   {
      ParameterValidation.throwIllegalArgExceptionIfNull(consumer, "Consumer");

      ProducerInfo info = consumer.getProducerInfo();

      save(info, CONSUMER_WITH_ID + info.getId() + "' couldn't be persisted!");

      createConsumerFrom(info, true);
   }
View Full Code Here

      startOrStopConsumer(consumer, false, true);
   }

   public long getPersistedLastModifiedForProducerInfoWith(String id)
   {
      ProducerInfo producerInfo = loadProducerInfo(id);
      if (producerInfo == null)
      {
         return Long.MAX_VALUE;
      }
      else
      {
         return producerInfo.getLastModified();
      }
   }
View Full Code Here

TOP

Related Classes of org.gatein.wsrp.consumer.ProducerInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.