Package org.gatein.wsrp.consumer

Examples of org.gatein.wsrp.consumer.ProducerInfo


      if (consumer != null)
      {
         if (isModified())
         {
            // update values
            ProducerInfo prodInfo = getProducerInfo();
            internalSetWsdl(wsdl);

            saveToRegistry(prodInfo);
         }
View Full Code Here


   public String modifyRegistration()
   {
      if (getConsumer() != null)
      {
         ProducerInfo info = getProducerInfo();
         if (isModified())
         {
            // save old info in case something goes wrong
            RegistrationInfo oldReg = getProducerInfo().getRegistrationInfo();

            // get updated registration info
            RegistrationInfo newReg = getExpectedRegistrationInfo();

            // make sure we save any modified registration properties
            saveToRegistry(info);

            // check that we have the proper state
            if (newReg == null)
            {
               // if we want to change an existing registration property (for example, to upgrade service) then there are
               // no expected information, we're just using the modified local version
               newReg = new RegistrationInfo(oldReg);

               if (!isRegistrationLocallyModified())
               {
                  IllegalStateException e =
                     new IllegalStateException("Registration not locally modified: there should be expected registration from producer!");
                  log.debug("Couldn't modify registration", e);
                  throw e;
               }
            }

            try
            {
               // attempt to modify the registration using new registration info
               info.setRegistrationInfo(newReg);
               info.modifyRegistration(true);

               beanContext.createInfoMessage(MODIFY_REG_SUCCESS);
            }
            catch (Exception e)
            {
               // restore old info
               info.setRegistrationInfo(oldReg);

               beanContext.createErrorMessageFrom(e);
               return null;
            }
View Full Code Here

   {
      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

      if (DEBUG)
      {
         System.out.println("newchild service " + localName);
      }

      ProducerInfo prodInfo = consumer.getProducerInfo();

      if ("endpoint-wsdl-url".equals(localName))
      {
         return prodInfo.getEndpointConfigurationInfo();
      }
      else if ("registration-data".equals(localName))
      {
         return new RegistrationInfo(prodInfo);
      }
View Full Code Here

   }

   public void addChild(SortedMap<String, WSRPConsumer> consumers, WSRPConsumer consumer, UnmarshallingContext nav, String nsURI,
                        String localName)
   {
      ProducerInfo info = consumer.getProducerInfo();

      if (DEBUG)
      {
         System.out.println("adding consumer " + info.getId() + " to deployment - localName: " + localName);
      }

      String id = consumer.getProducerId();
      consumers.put(id, consumer);
      log.info("Added consumer for producer '" + id + "' from xml configuration.");


      // update the producer info once the whole information is known
      try
      {
         consumerRegistry.updateProducerInfo(info);
      }
      catch (Exception e)
      {
         // if we couldn't update the info, remove it from the list of service to be activated
         consumers.remove(id);
         log.info("Couldn't update the ProducerInfo for Consumer '" + info.getId() + "'", e);
      }
   }
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

      startOrStopConsumer(consumer, false, true);
   }

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

      if (startConsumers)
      {
         for (WSRPConsumer consumer : consumerz)
         {
            final ProducerInfo info = consumer.getProducerInfo();
            if (info.isActive() && !consumer.isActive())
            {
               try
               {
                  consumer.refresh(false);
               }
               catch (Exception e)
               {
                  log.info("Couldn't activate consumer " + consumer.getProducerId());
                  info.setActiveAndSave(false);
               }
            }
         }
      }
View Full Code Here

         // then load ProducerInfos from persistence and create consumers from them
         Iterator<ProducerInfo> infosFromStorage = registry.getProducerInfosFromStorage();
         while (infosFromStorage.hasNext())
         {
            ProducerInfo info = infosFromStorage.next();
            consumers.put(info.getId(), createConsumer(info));
         }

         // since our state is fresh from persistence, we can't possibly be invalidated! :)
         setInvalidated(false);
      }
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.