Package ch.entwine.weblounge.common.site

Examples of ch.entwine.weblounge.common.site.Environment


      NodeList valueNodes = XPathHelper.selectList(option, "ns:value", xpathProcessor);

      for (int j = 0; j < valueNodes.getLength(); j++) {

        String env = XPathHelper.valueOf(valueNodes.item(j), "@environment");
        Environment environment = Environment.Any;
        if (StringUtils.isNotBlank(env)) {
          try {
            environment = Environment.valueOf(StringUtils.capitalize(env));
          } catch (Throwable t) {
            throw new IllegalStateException("Environment '" + env + "' is unknown");
View Full Code Here


          logger.warn("Skipping pagelet {} in feed due to missing renderer '{}/{}'", new Object[] { pagelet, pagelet.getModule(), pagelet.getIdentifier() });
          continue;
        }

        URL rendererURL = renderer.getRenderer(RendererType.Feed.toString());
        Environment environment = request.getEnvironment();
        if (rendererURL == null)
          rendererURL = renderer.getRenderer();
        if (rendererURL != null) {
          String rendererContent = null;
          try {
View Full Code Here

  public void updated(Dictionary properties) throws ConfigurationException {
    if (properties == null)
      return;

    // Environment
    Environment env = null;
    String environmentValue = StringUtils.trimToNull((String) properties.get(OPT_ENVIRONMENT));
    if (StringUtils.isNotBlank(environmentValue)) {
      try {
        env = Environment.valueOf(StringUtils.capitalize(environmentValue));
        logger.debug("Configured value for the default runtime environment is '{}'", env.toString().toLowerCase());
      } catch (IllegalArgumentException e) {
        throw new ConfigurationException(OPT_ENVIRONMENT, environmentValue);
      }
    } else {
      env = DEFAULT_ENVIRONMENT;
      logger.debug("Using default value '{}' for runtime environment", env.toString().toLowerCase());
    }

    // Did the setting change?
    if (!env.equals(environment)) {
      this.environment = env;
      if (registration != null) {
        try {
          registration.unregister();
        } catch (IllegalStateException e) {
View Full Code Here

    try {
      for (int i = 0; i < urlNodes.getLength(); i++) {
        Node urlNode = urlNodes.item(i);
        url = urlNode.getFirstChild().getNodeValue();
        boolean defaultUrl = ConfigurationUtils.isDefault(urlNode);
        Environment environment = Environment.Production;
        Node environmentAttribute = urlNode.getAttributes().getNamedItem("environment");
        if (environmentAttribute != null && environmentAttribute.getNodeValue() != null)
          environment = Environment.valueOf(StringUtils.capitalize(environmentAttribute.getNodeValue()));

        SiteURLImpl siteURL = new SiteURLImpl(new URL(url));
View Full Code Here

    synchronized (sites) {
      sites.add(site);
      siteBundles.put(site, reference.getBundle());

      // Make sure we have an environment
      Environment env = environment;
      if (env == null) {
        logger.warn("No environment has been defined. Assuming '{}'", Environment.Production.toString().toLowerCase());
        env = Environment.Production;
      }

      // Register the site urls and make sure we don't double book
      try {
        site.initialize(env);
      } catch (Throwable t) {
        logger.error("Error loading site '{}': {}", site.getIdentifier(), t.getMessage());
        return;
      }

      for (SiteURL url : site.getHostnames()) {
        if (!env.equals(url.getEnvironment()))
          continue;
        String hostName = url.getURL().getHost();
        Site registeredFirst = sitesByServerName.get(hostName);
        if (registeredFirst != null && !site.equals(registeredFirst)) {
View Full Code Here

   * @see org.osgi.util.tracker.ServiceTracker#removedService(org.osgi.framework.ServiceReference,
   *      java.lang.Object)
   */
  @Override
  public void removedService(ServiceReference reference, Object service) {
    Environment environment = (Environment) service;
    logger.trace("Environment '{}' went away", environment);
    this.environment = null;
    if (reference.getBundle() != null) {
      try {
        super.removedService(reference, service);
View Full Code Here

TOP

Related Classes of ch.entwine.weblounge.common.site.Environment

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.