Package org.gatein.wsrp

Examples of org.gatein.wsrp.WSRPConsumer


   }

   @Override
   public WSRPConsumer createConsumerFrom(ProducerInfo producerInfo, boolean putInCache)
   {
      WSRPConsumer consumer = super.createConsumerFrom(producerInfo, putInCache);

      String id = consumer.getProducerId();
      consumers.put(id, consumer);
      ProducerInfo info = consumer.getProducerInfo();
      keysToIds.put(info.getKey(), id);

      return consumer;
   }
View Full Code Here


         return null;
      }
      else
      {
         keysToIds.put(key, newId);
         WSRPConsumer consumer = consumers.get(oldId);
         consumers.put(newId, consumer);
         return oldId;
      }
   }
View Full Code Here

   public ProducerInfo loadProducerInfo(String id)
   {
      if (keysToIds.containsValue(id))
      {
         final WSRPConsumer consumer = consumers.get(id);
         return consumer != null ? consumer.getProducerInfo() : null;
      }
      else
      {
         return null;
      }
View Full Code Here

{
   private transient ConsumerRegistrySPI consumerRegistry;

   public FederatedPortletInvoker resolvePortletInvokerFor(String invokerId, FederatingPortletInvoker callingInvoker, String compoundPortletId) throws NoSuchPortletException
   {
      WSRPConsumer consumer = consumerRegistry.getConsumer(invokerId);

      if (consumer == null)
      {
         // if there's no consumer with that invoker id, then there's nothing much we can do
         if (compoundPortletId != null)
View Full Code Here

      {
         String id = attrs.getValue("id");
         ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "producer identifier", "Configuring a producer");

         // check that the consumer doesn't exist in the database first
         WSRPConsumer consumer = consumerRegistry.getConsumer(id);
         if (consumer != null)
         {
            String message = "Added consumer for producer '" + id + "' with status: ";

            // if consumer is active, add it to the list of services
            if (consumer.getProducerInfo().isActive())
            {
               consumers.put(id, consumer);
               message += "active";
            }
            else
            {
               message += "inactive";
            }

            log.info(message + " (loaded from database).");

            // consumer already exists, do not further process this producer and use the DB configuration instead
            return null;
         }

         String expirationCache = attrs.getValue("expiration-cache");
         Integer expirationCacheSeconds = ProducerInfo.DEFAULT_CACHE_VALUE;
         if (!ParameterValidation.isNullOrEmpty(expirationCache))
         {
            try
            {
               expirationCacheSeconds = new Integer(expirationCache);
            }
            catch (NumberFormatException e)
            {
               log.info("Ignoring bad expiration cache value " + expirationCache + " for producer '" + id + "'. Using default value instead.");
            }
         }

         String wsTimeout = attrs.getValue("ws-timeout");
         Integer wsTimeoutMS = ServiceFactory.DEFAULT_TIMEOUT_MS;
         if (!ParameterValidation.isNullOrEmpty(wsTimeout))
         {
            try
            {
               wsTimeoutMS = new Integer(wsTimeout);
            }
            catch (NumberFormatException e)
            {
               log.info("Ignoring bad WS timeout value " + wsTimeout + " for producer '" + id + "'");
            }
         }

         final String useWSS = attrs.getValue("use-wss");
         boolean enableWSS = false;
         if (!ParameterValidation.isNullOrEmpty(useWSS))
         {
            enableWSS = Boolean.parseBoolean(useWSS);
         }

         // consumer didn't exist in the database, so create one and configure it
         consumer = consumerRegistry.createConsumer(id, expirationCacheSeconds, null);
         final EndpointConfigurationInfo endpoint = consumer.getProducerInfo().getEndpointConfigurationInfo();
         endpoint.setWSOperationTimeOut(wsTimeoutMS);
         endpoint.setWSSEnabled(enableWSS);

         return consumer;
      }
View Full Code Here

   public void destroyConsumer(String id)
   {
      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 + "'");
         }
View Full Code Here

         String oldId = update(producerInfo);

         // if we updated and oldId is not null, we need to update the local information
         if (oldId != null)
         {
            WSRPConsumer consumer = createConsumerFrom(producerInfo, true);

            // update the federating portlet invoker if needed
            if (federatingPortletInvoker.isResolved(oldId))
            {
               federatingPortletInvoker.unregisterInvoker(oldId);
View Full Code Here

   public void registerOrDeregisterConsumerWith(String id, boolean register)
   {
      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "Consumer identifier", "Registering or deregistering a Consumer");

      WSRPConsumer consumer = getConsumer(id);

      if (consumer == null)
      {
         throw new ConsumerException(CONSUMER_WITH_ID + id + "' doesn't exist!");
      }

      try
      {
         if (register)
         {
            consumer.getProducerInfo().register();
         }
         else
         {
            consumer.getProducerInfo().deregister();
         }
      }
      catch (Exception e)
      {
         // unexpected exception: deactivate the consumer
View Full Code Here

      }

      public WSRPConsumer getConsumer(String id)
      {
         // try cache first
         WSRPConsumer consumer = consumers.get(id);

         return getUpdatedConsumer(id, consumer);
      }
View Full Code Here

         // then check, for each consumer, if it has been modified since we last checked
         for (String id : consumersIds)
         {
            // get the cached consumer
            WSRPConsumer consumerInfo = consumers.get(id);

            if (consumerInfo != null)
            {
               // if we have a consumer for that id, check that it's up-to-date and update it if needed
               getUpdatedConsumer(id, consumerInfo);
View Full Code Here

TOP

Related Classes of org.gatein.wsrp.WSRPConsumer

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.