Package org.gatein.registration

Examples of org.gatein.registration.Registration


   }

   public Set<Portlet> getPortlets() throws PortletInvokerException
   {
      Set<Portlet> portlets = new HashSet<Portlet>(super.getPortlets());
      Registration registration = RegistrationLocal.getRegistration();

      if (registration != null)
      {
         Set<PortletContext> contexts = registration.getKnownPortletContexts();
         for (PortletContext context : contexts)
         {
            try
            {
               portlets.add(super.getPortlet(context));
            }
            catch (NoSuchPortletException e)
            {
               final RegistrationSPI registrationSPI = getRegistrationAsSPI();
               try
               {
                  registrationSPI.removePortletContext(context);
                  log.debug("Removed '" + context + "' from Registration '" + registration.getRegistrationHandle() + "' because it cannot be resolved anymore.");
               }
               catch (RegistrationException e1)
               {
                  throw new PortletInvokerException(e1);
               }
View Full Code Here


      return portlets;
   }

   private RegistrationSPI getRegistrationAsSPI() throws PortletInvokerException
   {
      Registration registration = RegistrationLocal.getRegistration();

      if (registration == null)
      {
         return null;
      }
View Full Code Here

         Boolean wantSecureBool = urlFormat.getWantSecure();
         boolean wantSecure = (wantSecureBool != null ? wantSecureBool : false);
         WSRPPortletURL.URLContext context = new WSRPPortletURL.URLContext(WSRPPortletURL.URLContext.SERVER_ADDRESS,
            URLTools.getServerAddressFrom(request), WSRPPortletURL.URLContext.PORTLET_CONTEXT, instanceContext.getPortletContext());

         Registration registration = RegistrationLocal.getRegistration();
         if (registration != null)
         {
            context.setValueFor(WSRPPortletURL.URLContext.REGISTRATION_HANDLE, registration.getRegistrationHandle());
         }
         context.setValueFor(WSRPPortletURL.URLContext.INSTANCE_KEY, WSRPTypeFactory.getPortletInstanceKey(instanceContext));
         context.setValueFor(WSRPPortletURL.URLContext.NAMESPACE, WSRPTypeFactory.getNamespacePrefix(windowContext, instanceContext.getPortletContext().getId()));

         WSRPPortletURL url = WSRPPortletURL.create(containerURL, wantSecure, context);
View Full Code Here

   }

   void prepareInvocation() throws InvalidRegistration, OperationFailed, InvalidHandle,
      UnsupportedMimeType, UnsupportedWindowState, UnsupportedMode, MissingParameters, ModifyRegistrationRequired, UnsupportedLocale
   {
      Registration registration = producer.getRegistrationOrFailIfInvalid(getRegistrationContext());

      // get session information and deal with it
      final RuntimeContext runtimeContext = getRuntimeContext();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(runtimeContext, "RuntimeContext", getContextName());
View Full Code Here

      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 + "'";
         log.debug(msg, e);
         throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, msg, e);
      }

      RegistrationContext registrationContext = WSRPTypeFactory.createRegistrationContext(registration.getRegistrationHandle());
      log.debug("Registration completed without error.");
      return registrationContext;
   }
View Full Code Here

         log.debug("Attempting to modify registration with handle '" + registrationHandle + "'");
         String msg = "Could not modify registration with handle '" + registrationHandle + "'";
         try
         {
            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)
         {
            log.debug(msg, e);
View Full Code Here

            throwInvalidRegistrationFault("registration handle is missing but registration is required");
         }

         try
         {
            Registration registration = producer.getRegistrationManager().getRegistration(regHandle);
            if (registration == null)
            {
               throwInvalidRegistrationFault("provided registration handle '" + regHandle + "' is not registered with this producer");
            }
            return registration;
         }
         catch (RegistrationException e)
         {
            throwOperationFailedFault("Failed to retrieve registration information associated with handle " + regHandle, e);
            return null;
         }
      }
      else
      {
         try
         {
            Registration registration = producer.getRegistrationManager().getNonRegisteredRegistration();
            if (registration == null)
            {
               throwInvalidRegistrationFault("Could not acquire the nonregistered registration from the RegistrationManager");
            }
            return registration;
View Full Code Here

TOP

Related Classes of org.gatein.registration.Registration

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.