Exemple #1
0
  private static void _invalidate(long companyId) {
    for (SPI spi : MPIHelperUtil.getSPIs()) {
      try {
        RegistrationReference registrationReference = spi.getRegistrationReference();

        IntrabandRPCUtil.execute(registrationReference, new InvalidateProcessCallable(companyId));
      } catch (Exception e) {
        _log.error("Unable to invalidate SPI " + spi + " for company " + companyId, e);
      }
    }
  }
  @Override
  public void init(SPI spi) throws PortalResiliencyException {
    try {
      SPIConfiguration spiConfiguration = spi.getSPIConfiguration();

      spi.addServlet(
          SPI_AGENT_CONTEXT_PATH, spiConfiguration.getBaseDir(),
          MAPPING_PATTERN, AcceptorServlet.class.getName());
    } catch (Exception e) {
      throw new PortalResiliencyException(e);
    }
  }
  public static <K extends Serializable, V extends Serializable>
      PortalCacheManager<K, V> createSPIPortalCacheManager(
          PortalCacheManager<K, V> portalCacheManager) throws RemoteException {

    if (!SPIUtil.isSPI()) {
      return portalCacheManager;
    }

    SPI spi = SPIUtil.getSPI();

    return new IntrabandPortalCacheManager<K, V>(spi.getRegistrationReference());
  }
  private RegistrationReference _getRegistrationReference(String portletId) {
    SPI spi = SPIRegistryUtil.getPortletSPI(portletId);

    if (spi == null) {
      return null;
    }

    try {
      return spi.getRegistrationReference();
    } catch (RemoteException re) {
      throw new RuntimeException(re);
    }
  }
  protected SPIAgent getSPIAgentForPortlet(Portlet portlet) throws PortletContainerException {

    try {
      SPI spi = SPIRegistryUtil.getPortletSPI(portlet.getRootPortletId());

      if (spi == null) {
        return null;
      }

      if (_log.isDebugEnabled()) {
        _log.debug("Portlet " + portlet + " is registered to SPI " + spi);
      }

      return spi.getSPIAgent();
    } catch (Exception e) {
      throw new PortletContainerException(e);
    }
  }