Package de.innovationgate.wgpublisher.plugins

Examples of de.innovationgate.wgpublisher.plugins.WGAPluginSet$RuntimeContext


    if (!isAdminSession(session)) {
      throw new WGAServiceException("You need an administrative login to access this service.");
    }
       
    try {
      WGAPluginSet pluginSet = _core.getPluginSet();
      List<WorkspaceOperation> operations = new ArrayList<WorkspaceOperation>();
      Iterator<DataSource> pluginIt = plugins.iterator();
     
      while (pluginIt.hasNext()) {
        InstallPluginOperation operation = pluginSet.loadPluginToWorkspace(pluginIt.next().getInputStream());
        operations.add(operation);
      }
      pluginSet.performOperations(operations);
      pluginSet.save();
     
      operations.clear();
      _core.updatePlugins();
    } catch (Exception e) {
      throw new WGAServiceException("Plugin installation failed.", e);
View Full Code Here


        if (!isAdminSession(session)) {
            throw new WGAServiceException("You need an administrative login to access this service.");
        }
               
        try {
            WGAPluginSet pluginSet = _core.getPluginSet();
            WGAPlugin plugin = pluginSet.getPluginByUniqueName(pluginInfo.getUniqueName());
            if (plugin != null) {
                File file = plugin.getPluginFile();
                if (file != null && file.isFile()) {
                    return new FileDataSource(file);
                }
View Full Code Here

        if (!isAdminSession(session)) {
            throw new WGAServiceException("You need an administrative login to access this service.");
        }
               
        try {
            WGAPluginSet pluginSet = _core.getPluginSet();
            // create plugin id from info
            PluginID id = new PluginID();
            id.setUniqueName(pluginInfo.getUniqueName());
            id.setVersion(toConfigVersionBean(pluginInfo.getVersion()));
            WGAPlugin plugin = pluginSet.getPluginByID(id);
            if (plugin != null) {
                if (!plugin.isActive()) {
                    List<WorkspaceOperation> ops = new ArrayList<WorkspaceOperation>();
                    ops.add(new ActivatePluginOperation(id, WGAPluginSet.UPDATESTRATEGY_UPDATE_KEEP_DATA));
                    pluginSet.performOperations(ops);
                }
            }
        } catch (Exception e) {
            throw new WGAServiceException("Activation of plugin '" + pluginInfo.getUniqueName() + "' failed.", e);
        }
View Full Code Here

        if (!isAdminSession(session)) {
            throw new WGAServiceException("You need an administrative login to access this service.");
        }
               
        try {
            WGAPluginSet pluginSet = _core.getPluginSet();
            // create plugin id from info
            PluginID id = new PluginID();
            id.setUniqueName(pluginInfo.getUniqueName());
            id.setVersion(toConfigVersionBean(pluginInfo.getVersion()));
            WGAPlugin plugin = pluginSet.getPluginByID(id);
            if (plugin != null) {
                if (plugin.isActive()) {
                    pluginSet.deactivatePlugin(plugin);
                }
            }
        } catch (Exception e) {
            throw new WGAServiceException("Deactivation of plugin '" + pluginInfo.getUniqueName() + "' failed.", e);
        }
View Full Code Here

                return;
            }
           
            // Load plugins definition file
            File pluginsDefFile = new File(pluginsDir, "plugins.xml");
            WGAPluginSet currentPlugins;
            boolean reinstallPluginsDir = false;
            if (pluginsDefFile.exists()) {
                currentPlugins = WGAPluginSet.load(pluginsDefFile);
            }
            else {
                currentPlugins = new WGAPluginSet();
                reinstallPluginsDir = true;
            }
            currentPlugins.init(this, pluginsDir);
            if (this.pluginSet != null) {
                currentPlugins.importRuntimeContexts(this.pluginSet);
            }
           
            // Replace plugins field with new plugin set - This must be done before connecting plugins so plugin init/connection scripts can
            // refer to already installed plugins
            this.pluginSet = currentPlugins;
           
            // Cope with default plugins. Install new, uninstall removed (must be in that order so installation can determine status of previous version)
            installDefaultPlugins(currentPlugins, reinstallPluginsDir);
            uninstallRemovedDefaultPlugins();
           
            // Validate and connect plugins
            currentPlugins.validatePlugins();
            newConnectedDBKeys = currentPlugins.connectPlugins(domainConfigs);
           
            // Save plugins def file
            this.pluginSet.save();
           
            // Update module registry if it is already available
View Full Code Here

         log.debug("performRequest: " + retryCount + " attempt(s) out of " + MAXIMUM_RETRY_NUMBER + " possible");
         SessionHandler sessionHandler = consumer.getSessionHandler();

         // prepare everything for the request
         updateRegistrationContext(request);
         RuntimeContext runtimeContext = getRuntimeContextFrom(request);

         WindowContext windowContext = invocation.getWindowContext();
         runtimeContext.setNamespacePrefix(getNamespaceFrom(windowContext));

         InstanceContext instanceContext = invocation.getInstanceContext();
         runtimeContext.setPortletInstanceKey(instanceContext == null ? null : instanceContext.getId());

         updateUserContext(request, consumer.getUserContextFrom(invocation, runtimeContext));
         consumer.setTemplatesIfNeeded(invocation, runtimeContext);

         try
View Full Code Here

      // retrieve the registration associated with the request or fail
      Registration registration = producer.getRegistrationOrFailIfInvalid(getRegistrationContext());

      // get session information and deal with it
      final RuntimeContext runtimeContext = getRuntimeContext();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(runtimeContext, "RuntimeContext", contextName);
      checkForSessionIDs(runtimeContext);

      // get parameters
      final MimeRequest params = getParams();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(params, "MarkupParams", contextName);

      // get portlet handle
      PortletContext wsrpPC = getPortletContext();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(wsrpPC, "PortletContext", contextName);
      org.gatein.pc.api.PortletContext portletContext = WSRPUtils.convertToPortalPortletContext(wsrpPC);

      // check locales
      final List<String> desiredLocales = params.getLocales();
      for (String locale : desiredLocales)
      {
         try
         {
            WSRPUtils.getLocale(locale);
         }
         catch (IllegalArgumentException e)
         {
            throw WSRP2ExceptionFactory.throwWSException(UnsupportedLocale.class, e.getLocalizedMessage(), null);
         }
      }

      // retrieve the portlet
      try
      {
         // calls RegistrationLocal.setRegistration so no need to here
         portlet = producer.getPortletWith(portletContext, registration);
      }
      catch (PortletInvokerException e)
      {
         throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "Could not retrieve portlet '" + portletContext + "'", e);
      }

      // get portlet description for the desired portlet...
      portletDescription = producer.getPortletDescription(wsrpPC, null, registration);
      if (Boolean.TRUE.equals(portletDescription.isUsesMethodGet()))
      {
         throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "Portlets using GET method in forms are not currently supported.", null);
      }

      List<MarkupType> markupTypes = portletDescription.getMarkupTypes();

      // based on the markup parameters and portlet description generate the most appropriate markup request
      markupRequest = createMarkupRequestFrom(markupTypes, params, portlet);

      // prepare information for invocation
      final org.oasis.wsrp.v2.UserContext wsrpUserContext = getUserContext();
      checkUserContext(wsrpUserContext);
      SecurityContext securityContext = createSecurityContext(params, runtimeContext, wsrpUserContext);
      final MediaType mediaType = createMediaType(markupRequest);
      PortalContext portalContext = createPortalContext(params, markupRequest);
      UserContext userContext = createUserContext(wsrpUserContext, markupRequest.getLocale(), desiredLocales);
      String portletInstanceKey = runtimeContext.getPortletInstanceKey();
      instanceContext = createInstanceContext(portletContext, getAccessMode(), portletInstanceKey);
      WindowContext windowContext = createWindowContext(portletContext.getId(), runtimeContext);

      // prepare the invocation context
      WSRPPortletInvocationContext context = new WSRPPortletInvocationContext(mediaType, securityContext, portalContext, userContext, instanceContext, windowContext);
View Full Code Here

            log.debug("performRequest: " + retryCount + " attempt(s) out of " + MAXIMUM_RETRY_NUMBER + " possible");
         }
         SessionHandler sessionHandler = consumer.getSessionHandler();

         // prepare everything for the request
         RuntimeContext runtimeContext = getRuntimeContextFrom(request);

         if (runtimeContext != null)
         {
            WindowContext windowContext = invocation.getWindowContext();
            runtimeContext.setNamespacePrefix(WSRPTypeFactory.getNamespaceFrom(windowContext));

            InstanceContext instanceContext = invocation.getInstanceContext();
            runtimeContext.setPortletInstanceKey(instanceContext == null ? null : instanceContext.getId());
         }

         try
         {
            sessionHandler.initCookieIfNeeded(invocation);
View Full Code Here

            log.debug("performRequest: " + retryCount + " attempt(s) out of " + MAXIMUM_RETRY_NUMBER + " possible");
         }
         SessionHandler sessionHandler = consumer.getSessionHandler();

         // prepare everything for the request
         RuntimeContext runtimeContext = getRuntimeContextFrom(request);

         if (runtimeContext != null)
         {
            WindowContext windowContext = invocation.getWindowContext();
            runtimeContext.setNamespacePrefix(WSRPTypeFactory.getNamespaceFrom(windowContext));

            // GTNWSRP-369: InstanceContext doesn't actually provide any useful information, use WindowContext's id instead
            /*InstanceContext instanceContext = invocation.getInstanceContext();
            runtimeContext.setPortletInstanceKey(WSRPTypeFactory.getPortletInstanceKey(instanceContext));*/
            runtimeContext.setPortletInstanceKey(windowContext.getId());
         }

         try
         {
            sessionHandler.initCookieIfNeeded(invocation);
View Full Code Here

         else
         {
            namespacePrefix = v1RuntimeContext.getNamespacePrefix();
         }
        
         RuntimeContext runtimeContext = WSRPTypeFactory.createRuntimeContext(v1RuntimeContext.getUserAuthentication(), portletInstanceKey, namespacePrefix);

         SessionParams sessionParams = WSRPTypeFactory.createSessionParams(v1RuntimeContext.getSessionID());

         runtimeContext.setSessionParams(sessionParams);
         runtimeContext.setTemplates(toV2Templates(v1RuntimeContext.getTemplates()));

         List<V1Extension> extensions = v1RuntimeContext.getExtensions();
         if (extensions != null)
         {
            runtimeContext.getExtensions().addAll(WSRPUtils.transform(extensions, EXTENSION));
         }

         return runtimeContext;
      }
      else
View Full Code Here

TOP

Related Classes of de.innovationgate.wgpublisher.plugins.WGAPluginSet$RuntimeContext

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.