Package org.objectstyle.woenvironment.plist

Examples of org.objectstyle.woenvironment.plist.ToHellWithProperties


  public void init(WOVariables variables, Map<Object, Object> existingProperties) {
    _wolipsPropertiesDefaults = new Properties();
   
    if (variables == null) {
      _wolipsProperties = new ToHellWithProperties();

      String wolipsPropertiesPath;

      if (existingProperties != null) {
        wolipsPropertiesPath = (String) existingProperties.get(WOVariables.WOLIPS_PROPERTIES);
        if (wolipsPropertiesPath == null) {
          wolipsPropertiesPath = (String) existingProperties.get("wolips.global.properties");
        }
      }
      else {
        wolipsPropertiesPath = System.getProperty(WOVariables.WOLIPS_PROPERTIES);
      }
     
      if (wolipsPropertiesPath == null) {
        wolipsPropertiesPath = System.getenv(WOVariables.WOLIPS_PROPERTIES);
      }


      File wolipsPropertiesFile = null;
      if (wolipsPropertiesPath != null) {
        wolipsPropertiesFile = getWOLipsPropertiesFile(wolipsPropertiesPath);
        if (!isValidWOlipsPropertiesFile(wolipsPropertiesFile)) {
          wolipsPropertiesFile = null;
        }
      }
      else {
        String environmentName = null;
        String woVersion = null;
        if (existingProperties != null) {
          environmentName = (String) existingProperties.get("wolips.environment");
          woVersion = (String) existingProperties.get("wo.version");
        }
        if (woVersion != null) {
          if (environmentName != null) {
            wolipsPropertiesPath = "wolips." + environmentName + "." + woVersion + ".properties";
          }
          else {
            wolipsPropertiesPath = "wolips." + woVersion + ".properties";
          }
          wolipsPropertiesFile = getWOLipsPropertiesFile(wolipsPropertiesPath);
          if (!isValidWOlipsPropertiesFile(wolipsPropertiesFile)) {
            wolipsPropertiesFile = null;
          }
        }

        if (wolipsPropertiesFile == null) {
          if (environmentName != null) {
            wolipsPropertiesPath = "wolips." + environmentName + ".properties";
            wolipsPropertiesFile = getWOLipsPropertiesFile(wolipsPropertiesPath);
            if (!isValidWOlipsPropertiesFile(wolipsPropertiesFile)) {
              wolipsPropertiesPath = "wolips.properties";
              wolipsPropertiesFile = getWOLipsPropertiesFile(wolipsPropertiesPath);
            }
          }
          else {
            wolipsPropertiesPath = "wolips.properties";
            wolipsPropertiesFile = getWOLipsPropertiesFile(wolipsPropertiesPath);
          }
        }
      }
      _wolipsPropertiesFile = wolipsPropertiesFile;

      if (isValidWOlipsPropertiesFile(_wolipsPropertiesFile)) {
        CachedProperties cachedProperties;
        synchronized (_cachedProperties) {
          cachedProperties = _cachedProperties.get(_wolipsPropertiesFile);
          if (cachedProperties == null) {
            cachedProperties = new CachedProperties(_wolipsPropertiesFile);
            _cachedProperties.put(_wolipsPropertiesFile, cachedProperties);
          }
        }
        cachedProperties.reloadIfNecessary();
        _wolipsProperties = new ToHellWithProperties();
        Properties backingProperties = cachedProperties.properties();
        synchronized(backingProperties) {
          _wolipsProperties.putAll(backingProperties);
        }
      }
      else if (_wolipsProperties == null || _wolipsProperties.isEmpty()) {
        createDefaultProperties();
        if (wolipsPropertiesPath != null) {
          _wolipsPropertiesFile = getWOLipsPropertiesFile(wolipsPropertiesPath);
        }
        save();
       
        /*
        if (existingProperties != null) {
          String wolipsPropertiesName = (String)existingProperties.get("wolips.properties");
          if (wolipsPropertiesName != null && "wolips.properties".equals(wolipsPropertiesName)) {
            _wolipsPropertiesFile = getWOLipsPropertiesFile(wolipsPropertiesName);
            save();
          }
        }
        else {
          _wolipsPropertiesFile = getWOLipsPropertiesFile("wolips.properties");
          save();
        }
        */
      }
    }
    else {
      _wolipsProperties = new ToHellWithProperties();
      _wolipsProperties.putAll(variables._wolipsProperties);
    }

    if (existingProperties != null) {
      for (Map.Entry<Object, Object> entry : existingProperties.entrySet()) {
View Full Code Here


      properties.setProperty(WOVariables.WEBOBJECTS_EXTENSIONS, "/Library/WebObjects/Extensions");
    }
  }
 
  public void createDefaultProperties() {
    _wolipsProperties = new ToHellWithProperties();
    setDefaults(_wolipsProperties);
  }
View Full Code Here

    private long _lastLoaded;
    private Properties _properties;

    public CachedProperties(File propertiesFile) {
      _propertiesFile = propertiesFile;
      _properties = new ToHellWithProperties();
    }
View Full Code Here

      return _properties;
    }

    public void reload() {
      try {
        _properties = new ToHellWithProperties();
        _properties.load(new FileInputStream(_propertiesFile));
      }
      catch (IOException e) {
        throw new RuntimeException("Failed to load " + _propertiesFile + ".", e);
      }
View Full Code Here

      throw new RuntimeException("Failed to load the build properties for the project '" + _project + "'.", e);
    }
  }

  public synchronized void save() throws CoreException, IOException {
    Properties properties = new ToHellWithProperties();
    properties.putAll(_properties);
   
    if (!_dirty) {
      return;
    }

    File file = getBuildPropertiesFile();
    FileOutputStream fos = new FileOutputStream(file);
    try {
      properties.store(fos, null);
    }
    finally {
      fos.close();
    }
View Full Code Here

TOP

Related Classes of org.objectstyle.woenvironment.plist.ToHellWithProperties

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.