Package org.gatein.wsrp.producer.config

Examples of org.gatein.wsrp.producer.config.ProducerRegistrationRequirements


   {
      // save listeners if we already have a configuration
      List<ProducerConfigurationChangeListener> listeners = null;
      Set<RegistrationPolicyChangeListener> policyListeners = null;
      Set<RegistrationPropertyChangeListener> propertyListeners = null;
      ProducerRegistrationRequirements registrationRequirements;
      if (configuration.get() != null)
      {
         listeners = configuration.get().getChangeListeners();
         registrationRequirements = configuration.get().getRegistrationRequirements();
         if (registrationRequirements != null)
         {
            policyListeners = registrationRequirements.getPolicyChangeListeners();
            propertyListeners = registrationRequirements.getPropertyChangeListeners();
         }
      }

      // reload
      loadConfiguration();

      // make sure that we set strict mode on things which need to know about it regardless of listeners (which might
      // not exist when this method is called, as is the case at startup)
      WSRPValidator.setStrict(configuration.get().isUsingStrictMode());

      // restore listeners and trigger them if requested
      if (listeners != null)
      {
         for (ProducerConfigurationChangeListener listener : listeners)
         {
            configuration.get().addChangeListener(listener);
            if (triggerListeners)
            {
               listener.usingStrictModeChangedTo(configuration.get().isUsingStrictMode());
            }
         }
      }
      registrationRequirements = configuration.get().getRegistrationRequirements();
      if (registrationRequirements != null)
      {
         if (propertyListeners != null)
         {
            for (RegistrationPropertyChangeListener listener : propertyListeners)
            {
               registrationRequirements.addRegistrationPropertyChangeListener(listener);
               if (triggerListeners)
               {
                  listener.propertiesHaveChanged(registrationRequirements.getRegistrationProperties());
               }
            }
         }
         if (policyListeners != null)
         {
            for (RegistrationPolicyChangeListener listener : policyListeners)
            {
               registrationRequirements.addRegistrationPolicyChangeListener(listener);
               if (triggerListeners)
               {
                  listener.policyUpdatedTo(registrationRequirements.getPolicy());
               }
            }
         }
      }
   }
View Full Code Here


         {
            registration = producer.getRegistrationOrFailIfInvalid(registrationContext);
            RegistrationLocal.setRegistration(registration);
         }

         ProducerRegistrationRequirements requirements = producer.getProducerRegistrationRequirements();

         //update the registration properties with the registration requirements
         serviceDescription.updateRegistrationProperties(requirements);

         // if we don't have registration information but a registration is required, send registration props information
         boolean needsRegistrationProperties = registration == null && requirements.isRegistrationRequired();

         // if we allow sending portlet descriptions even when not registered
         boolean needsPortletDescriptions = !(registration == null && requirements.isRegistrationRequired()
            && requirements.isRegistrationRequiredForFullDescription());

         final List<String> portletHandles = WSRPUtils.replaceByEmptyListIfNeeded(gs.getPortletHandles());
         final List<String> desiredLocales = WSRPUtils.replaceByEmptyListIfNeeded(gs.getDesiredLocales());
         return serviceDescription.getServiceDescription(needsRegistrationProperties, needsPortletDescriptions, portletHandles, desiredLocales);
      }
View Full Code Here

      WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(register, "Register");

      RegistrationData registrationData = register.getRegistrationData();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(registrationData, "RegistrationData", "Register");

      ProducerRegistrationRequirements registrationRequirements = producer.getProducerRegistrationRequirements();

      String consumerName = registrationData.getConsumerName();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(consumerName, "consumer name", "RegistrationData");

      String consumerAgent = registrationData.getConsumerAgent();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(consumerAgent, "consumer agent", "RegistrationData");

      Registration registration;
      try
      {
         log.debug("Attempting to register consumer named '" + consumerName + "', agent '" + consumerAgent + "'.");

         // check that the consumer agent is valid before trying to register
         RegistrationUtils.validateConsumerAgent(consumerAgent);

         registration = producer.getRegistrationManager().addRegistrationTo(consumerName, createRegistrationProperties(registrationData), registrationRequirements.getRegistrationProperties(), true);
         updateRegistrationInformation(registration, registrationData);
      }
      catch (Exception e)
      {
         String msg = "Could not register consumer named '" + consumerName + "'";
View Full Code Here

            Registration registration = producer.getRegistrationManager().getRegistration(registrationHandle);

            Map<QName, Object> properties = createRegistrationProperties(registrationData);

            // check that the given registration properties are acceptable according to expectations and policy
            ProducerRegistrationRequirements req = producer.getProducerRegistrationRequirements();
            req.getPolicy().validateRegistrationDataFor(properties, consumerName, req.getRegistrationProperties(), producer.getRegistrationManager());

            registration.updateProperties(properties);
            updateRegistrationInformation(registration, registrationData);
         }
         catch (NoSuchRegistrationException e)
View Full Code Here

         if (registrationDone)
         {
            throw new IllegalArgumentException("Only one registration-configuration element can be defined!");
         }

         ProducerRegistrationRequirements registrationRequirements = new ProducerRegistrationRequirementsImpl();
         registrationRequirements.setRegistrationRequired(true);
         registrationRequirements.setRegistrationRequiredForFullDescription(getBooleanAttributeValue(attrs, "fullServiceDescriptionRequiresRegistration", false));
         registrationDone = true;
         return registrationRequirements;
      }
      return null;
   }
View Full Code Here

   public Object getChildren(ProducerConfigurationImpl configuration, String namespaceUri, String localName)
   {
      if ("registration-configuration".equals(localName))
      {
         ProducerRegistrationRequirements registrationRequirements = configuration.getRegistrationRequirements();
         if (registrationRequirements != null && registrationRequirements.isRegistrationRequired())
         {
            return registrationRequirements;
         }
      }
      else if ("producer-configuration".equals(localName))
View Full Code Here

      WSRP2ExceptionFactory.throwOperationFailedIfValueIsMissing(register, "Register");

      RegistrationData registrationData = register.getRegistrationData();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(registrationData, "RegistrationData", "Register");

      ProducerRegistrationRequirements registrationRequirements = producer.getProducerRegistrationRequirements();

      String consumerName = registrationData.getConsumerName();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(consumerName, "consumer name", "RegistrationData");

      String consumerAgent = registrationData.getConsumerAgent();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(consumerAgent, "consumer agent", "RegistrationData");

      Registration registration;
      try
      {
         log.debug("Attempting to register consumer named '" + consumerName + "', agent '" + consumerAgent + "'.");

         // check that the consumer agent is valid before trying to register
         RegistrationUtils.validateConsumerAgent(consumerAgent);

         registration = producer.getRegistrationManager().addRegistrationTo(consumerName, createRegistrationProperties(registrationData), registrationRequirements.getRegistrationProperties(), true);
         updateRegistrationInformation(registration, registrationData);
      }
      catch (Exception e)
      {
         String msg = "Could not register consumer named '" + consumerName + "'";
View Full Code Here

            Registration registration = producer.getRegistrationManager().getRegistration(registrationHandle);

            Map<QName, Object> properties = createRegistrationProperties(registrationData);

            // check that the given registration properties are acceptable according to expectations and policy
            ProducerRegistrationRequirements req = producer.getProducerRegistrationRequirements();
            req.getPolicy().validateRegistrationDataFor(properties, consumerName, req.getRegistrationProperties(), producer.getRegistrationManager());

            registration.updateProperties(properties);
            updateRegistrationInformation(registration, registrationData);
         }
         catch (NoSuchRegistrationException e)
View Full Code Here

      {
         // replicate local state to producer state
         ProducerConfiguration currentlyPersistedConfiguration = getConfiguration();
         LocalProducerConfiguration localConfiguration = getLocalConfiguration();

         ProducerRegistrationRequirements registrationRequirements = currentlyPersistedConfiguration.getRegistrationRequirements();

         registrationRequirements.setRegistrationRequiredForFullDescription(localConfiguration.isRegistrationRequiredForFullDescription());
         registrationRequirements.setRegistrationRequired(localConfiguration.isRegistrationRequired());

         registrationRequirements.reloadPolicyFrom(policyClassName, validatorClassName);

         registrationRequirements.setRegistrationProperties(localConfiguration.getRegistrationProperties());

         currentlyPersistedConfiguration.setUsingStrictMode(localConfiguration.isUsingStrictMode());

         getConfigurationService().saveConfiguration();
View Full Code Here

TOP

Related Classes of org.gatein.wsrp.producer.config.ProducerRegistrationRequirements

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.