Package org.gatein.wsrp.consumer

Examples of org.gatein.wsrp.consumer.ProducerInfo


      private WSRPConsumer getUpdatedConsumer(String id, WSRPConsumer consumer)
      {
         if (consumer == null || consumer.getProducerInfo().getLastModified() < registry.getPersistedLastModifiedForProducerInfoWith(id))
         {
            // if consumer is not in cache (null) or was modified in persistence, (re-)load it from persistence
            ProducerInfo info = registry.loadProducerInfo(id);
            if (info != null)
            {
               consumer = createConsumer(info);
               consumers.put(id, consumer);
               return consumer;
View Full Code Here


               getUpdatedConsumer(id, consumerInfo);
            }
            else
            {
               // if we don't have a consumer for that id, load it from persistence and cache it
               ProducerInfo producerInfo = registry.loadProducerInfo(id);
               consumers.put(id, createConsumer(producerInfo));
            }
         }

         // state that we're not invalid anymore if we previously were
View Full Code Here

   public void setId(String id)
   {
      if (consumer != null)
      {
         // renaming scenario
         ProducerInfo info = getProducerInfo();
         String oldId = info.getId();

         // need to check that the new id is valid
         if (isOldAndNewDifferent(oldId, id))
         {
            id = checkNameValidity(id, "edit-cons-form:id");
            if (id != null)
            {
               info.setId(id);

               // properly update the registry after change of id
               getRegistry().updateProducerInfo(info);

               // we're not using modifyIfNeeded here to avoid double equality check, so we need to set modified manually
View Full Code Here

      return getProducerInfo().isRegistrationRequired();
   }

   public boolean isRegistrationCheckNeeded()
   {
      ProducerInfo info = getProducerInfo();
      if (info.isRefreshNeeded(true))
      {
         RegistrationInfo regInfo = info.getRegistrationInfo();
         if (regInfo == null)
         {
            return true;
         }
         else
View Full Code Here

      }
   }

   public boolean isDisplayExpectedNeeded()
   {
      ProducerInfo producerInfo = getProducerInfo();

      // only show expected registration info if it is different from the one we currently have
      return producerInfo.isModifyRegistrationRequired() && producerInfo.getRegistrationInfo() != producerInfo.getExpectedRegistrationInfo();
   }
View Full Code Here

         if (isModified())
         {
            try
            {
               // update values
               ProducerInfo prodInfo = getProducerInfo();
               EndpointConfigurationInfo endpointInfo = prodInfo.getEndpointConfigurationInfo();
               internalSetWsdl(wsdl);

               saveToRegistry(prodInfo);
            }
            catch (Exception e)
View Full Code Here

   public String modifyRegistration()
   {
      if (getConsumer() != null)
      {
         ProducerInfo info = getProducerInfo();
         if (isModified())
         {
            // get updated registration info
            RegistrationInfo newReg = getExpectedRegistrationInfo();

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

            // save old info in case something goes wrong
            RegistrationInfo oldReg = getProducerInfo().getRegistrationInfo();

            // 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
            {
               // todo: this should be done better cf regPropListener
               newReg.setModifiedSinceLastRefresh(true); // mark as modified to force refresh of RegistrationData
               // attempt to modify the registration using new registration info
               info.setRegistrationInfo(newReg);
               info.modifyRegistration();
               newReg.setModifiedSinceLastRefresh(false);

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

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

         log.debug("Invalid registration");
         consumer.handleInvalidRegistrationFault();
      }
      else if (error instanceof ModifyRegistrationRequired)
      {
         ProducerInfo producerInfo = consumer.getProducerInfo();

         log.debug("Producer " + producerInfo.getId() + " indicated that modifyRegistration should be called.");

         producerInfo.setModifyRegistrationRequired(true);
         producerInfo.setActiveAndSave(false);

         return new ErrorResponse(error);
      }
      else
      {
View Full Code Here

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


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

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

      log.debug(CONSUMER_WITH_ID + id + "' created");
      return createConsumerFrom(info);
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

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.