Package com.arjuna.common.util.propertyservice.propertycontainer

Examples of com.arjuna.common.util.propertyservice.propertycontainer.PropertyManagerPluginInterface


            String dependsName = dependsNode != null ? dependsNode.getNodeValue() : "";

            NodeList propertyNodes = propertiesNode.getElementsByTagName(PROPERTY_ELEMENT_NAME);

                        /** If the name is provided get the OM from the top level else just load into the current PM **/
            PropertyManagerPluginInterface pm = propertiesName != null ? pcm.getTopLevelPropertyManager().getChild(propertiesName) : pcm;

            /** If the child doesn't already exist create one **/
            if ( pm == null )
            {
              pm = pcm.createPropertyManager(propertiesName);
            }

            if ( verbose )
            {
              System.out.println("Properties loaded ("+uri+"):");
            }

            /** Associate the current URI with this property manager **/
            pm.setUri(uri);
            /** Associate this plugin with the property manager **/
            pm.setIOPluginClassname(this.getClass().getName());

            for (int nodeCount=0;nodeCount<propertyNodes.getLength();nodeCount++)
            {
              Element propertyNode = (Element)propertyNodes.item(nodeCount);
              String propertyName = propertyNode.getAttribute(NAME_ATTRIBUTE_NAME);
              String propertyValue = propertyNode.getAttribute(VALUE_ATTRIBUTE_NAME);
              String propertyType = propertyNode.getAttribute(PROPERTY_TYPE_ATTRIBUTE_NAME);

              if ( verbose )
              {
                System.out.println( propertyName +"="+ propertyValue );
              }
                           
                            // perform JBossAS style property substitutions. JBTM-369
                            propertyValue = StringPropertyReplacer.replaceProperties(propertyValue);

              /** Set the property but don't allow any system property to be overridden **/
              pm.setProperty(propertyName, propertyValue, false);

              /** If the property is specified as a System property and it's not already a system property **/
              if ( propertyType != null &&
                   propertyType.equalsIgnoreCase(SYSTEM_PROPERTY_TYPE_NAME) &&
                 System.getProperty(propertyName) == null )
              {
                /** Set this as a system property also **/
                System.setProperty(propertyName, propertyValue);
              }
            }

            /** If this has no dependents then it is a top-level module **/
            if ( dependsName.length() == 0 && pm != pcm)
            {
              pcm.addChild(pm);
            }

            pmDependents.put(pm, dependsName);

                        /** If these properties belond to a named set store them **/
                        if ( propertiesName != null )
                        {
                pms.put(propertiesName, pm);
                        }
          }

          /** Ensure dependency tree is kept **/
          for (Enumeration e = pmDependents.keys();e.hasMoreElements();)
          {
            PropertyManagerPluginInterface pm = (PropertyManagerPluginInterface)e.nextElement();
            String depends = (String)pmDependents.get(pm);

            StringTokenizer strtok = new StringTokenizer(depends,",");

            while (strtok.hasMoreElements())
            {
              String dependantName = strtok.nextToken().trim();
              PropertyManager dependant = (PropertyManager)pms.get(dependantName);

                            if ( dependant == null )
                            {
                                throw new LoadPropertiesException("Dependency not found - property file invalid");
                            }
              pm.addParent(dependant);
            }
          }
        }
        else
        {
View Full Code Here


    }
  }

  public PropertyManagerPluginInterface getChild(String moduleName)
  {
    PropertyManagerPluginInterface returnPm = null;
      Iterator itr = _childPropertyManagers.iterator();

    while ( returnPm == null && itr.hasNext() )
    {
      PropertyManagerImpl pm = (PropertyManagerImpl)itr.next();
View Full Code Here

            String dependsName = dependsNode != null ? dependsNode.getNodeValue() : "";

            NodeList propertyNodes = propertiesNode.getElementsByTagName(PROPERTY_ELEMENT_NAME);

                        /** If the name is provided get the OM from the top level else just load into the current PM **/
            PropertyManagerPluginInterface pm = propertiesName != null ? pcm.getTopLevelPropertyManager().getChild(propertiesName) : pcm;

            /** If the child doesn't already exist create one **/
            if ( pm == null )
            {
              pm = pcm.createPropertyManager(propertiesName);
            }

            if ( verbose )
            {
              System.out.println("Properties loaded ("+uri+"):");
            }

            /** Associate the current URI with this property manager **/
            pm.setUri(uri);
            /** Associate this plugin with the property manager **/
            pm.setIOPluginClassname(this.getClass().getName());

            for (int nodeCount=0;nodeCount<propertyNodes.getLength();nodeCount++)
            {
              Element propertyNode = (Element)propertyNodes.item(nodeCount);
              String propertyName = propertyNode.getAttribute(NAME_ATTRIBUTE_NAME);
              String propertyValue = propertyNode.getAttribute(VALUE_ATTRIBUTE_NAME);
              String propertyType = propertyNode.getAttribute(PROPERTY_TYPE_ATTRIBUTE_NAME);

              if ( verbose )
              {
                System.out.println( propertyName +"="+ propertyValue );
              }
                           
                            // perform JBossAS style property substitutions. JBTM-369
                            propertyValue = StringPropertyReplacer.replaceProperties(propertyValue);

              /** Set the property but don't allow any system property to be overridden **/
              pm.setProperty(propertyName, propertyValue, false);

              /** If the property is specified as a System property and it's not already a system property **/
              if ( propertyType != null &&
                   propertyType.equalsIgnoreCase(SYSTEM_PROPERTY_TYPE_NAME) &&
                 System.getProperty(propertyName) == null )
              {
                /** Set this as a system property also **/
                System.setProperty(propertyName, propertyValue);
              }
            }

            /** If this has no dependents then it is a top-level module **/
            if ( dependsName.length() == 0 && pm != pcm)
            {
              pcm.addChild(pm);
            }

            pmDependents.put(pm, dependsName);

                        /** If these properties belond to a named set store them **/
                        if ( propertiesName != null )
                        {
                pms.put(propertiesName, pm);
                        }
          }

          /** Ensure dependency tree is kept **/
          for (Enumeration e = pmDependents.keys();e.hasMoreElements();)
          {
            PropertyManagerPluginInterface pm = (PropertyManagerPluginInterface)e.nextElement();
            String depends = (String)pmDependents.get(pm);

            StringTokenizer strtok = new StringTokenizer(depends,",");

            while (strtok.hasMoreElements())
            {
              String dependantName = strtok.nextToken().trim();
              PropertyManager dependant = (PropertyManager)pms.get(dependantName);

                            if ( dependant == null )
                            {
                                throw new LoadPropertiesException("Dependency not found - property file invalid");
                            }
              pm.addParent(dependant);
            }
          }
        }
        else
        {
View Full Code Here

/*     */     }
/*     */   }
/*     */
/*     */   public PropertyManagerPluginInterface getChild(String moduleName)
/*     */   {
/* 502 */     PropertyManagerPluginInterface returnPm = null;
/* 503 */     Iterator itr = this._childPropertyManagers.iterator();
/*     */
/* 505 */     while ((returnPm == null) && (itr.hasNext()))
/*     */     {
/* 507 */       PropertyManagerImpl pm = (PropertyManagerImpl)itr.next();
View Full Code Here

/* 147 */             Node dependsNode = propertiesNode.getAttributeNode("depends");
/* 148 */             String dependsName = dependsNode != null ? dependsNode.getNodeValue() : "";
/*     */
/* 150 */             NodeList propertyNodes = propertiesNode.getElementsByTagName("property");
/*     */
/* 153 */             PropertyManagerPluginInterface pm = propertiesName != null ? pcm.getTopLevelPropertyManager().getChild(propertiesName) : pcm;
/*     */
/* 156 */             if (pm == null)
/*     */             {
/* 158 */               pm = pcm.createPropertyManager(propertiesName);
/*     */             }
/*     */
/* 161 */             if (verbose)
/*     */             {
/* 163 */               System.out.println("Properties loaded (" + uri + "):");
/*     */             }
/*     */
/* 167 */             pm.setUri(uri);
/*     */
/* 169 */             pm.setIOPluginClassname(getClass().getName());
/*     */
/* 171 */             for (int nodeCount = 0; nodeCount < propertyNodes.getLength(); nodeCount++)
/*     */             {
/* 173 */               Element propertyNode = (Element)propertyNodes.item(nodeCount);
/* 174 */               String propertyName = propertyNode.getAttribute("name");
/* 175 */               String propertyValue = propertyNode.getAttribute("value");
/* 176 */               String propertyType = propertyNode.getAttribute("type");
/*     */
/* 178 */               if (verbose)
/*     */               {
/* 180 */                 System.out.println(propertyName + "=" + propertyValue);
/*     */               }
/*     */
/* 184 */               pm.setProperty(propertyName, propertyValue, false);
/*     */
/* 187 */               if ((propertyType == null) || (!propertyType.equalsIgnoreCase("system")) || (System.getProperty(propertyName) != null))
/*     */               {
/*     */                 continue;
/*     */               }
/*     */
/* 192 */               System.setProperty(propertyName, propertyValue);
/*     */             }
/*     */
/* 197 */             if ((dependsName.length() == 0) && (pm != pcm))
/*     */             {
/* 199 */               pcm.addChild(pm);
/*     */             }
/*     */
/* 202 */             pmDependents.put(pm, dependsName);
/*     */
/* 205 */             if (propertiesName == null)
/*     */               continue;
/* 207 */             pms.put(propertiesName, pm);
/*     */           }
/*     */
/* 212 */           for (e = pmDependents.keys(); e.hasMoreElements(); )
/*     */           {
/* 214 */             PropertyManagerPluginInterface pm = (PropertyManagerPluginInterface)e.nextElement();
/* 215 */             String depends = (String)pmDependents.get(pm);
/*     */
/* 217 */             StringTokenizer strtok = new StringTokenizer(depends, ",");
/*     */
/* 219 */             while (strtok.hasMoreElements())
/*     */             {
/* 221 */               String dependantName = strtok.nextToken().trim();
/* 222 */               PropertyManager dependant = (PropertyManager)pms.get(dependantName);
/*     */
/* 224 */               if (dependant == null)
/*     */               {
/* 226 */                 throw new LoadPropertiesException("Dependency not found - property file invalid");
/*     */               }
/* 228 */               pm.addParent(dependant);
/*     */             }
/*     */           }
/*     */         }
/*     */         else
/*     */         {
View Full Code Here

            String dependsName = dependsNode != null ? dependsNode.getNodeValue() : "";

            NodeList propertyNodes = propertiesNode.getElementsByTagName(PROPERTY_ELEMENT_NAME);

                        /** If the name is provided get the OM from the top level else just load into the current PM **/
            PropertyManagerPluginInterface pm = propertiesName != null ? pcm.getTopLevelPropertyManager().getChild(propertiesName) : pcm;

            /** If the child doesn't already exist create one **/
            if ( pm == null )
            {
              pm = pcm.createPropertyManager(propertiesName);
            }

            if ( verbose )
            {
              System.out.println("Properties loaded ("+uri+"):");
            }

            /** Associate the current URI with this property manager **/
            pm.setUri(uri);
            /** Associate this plugin with the property manager **/
            pm.setIOPluginClassname(this.getClass().getName());

            for (int nodeCount=0;nodeCount<propertyNodes.getLength();nodeCount++)
            {
              Element propertyNode = (Element)propertyNodes.item(nodeCount);
              String propertyName = propertyNode.getAttribute(NAME_ATTRIBUTE_NAME);
              String propertyValue = propertyNode.getAttribute(VALUE_ATTRIBUTE_NAME);
              String propertyType = propertyNode.getAttribute(PROPERTY_TYPE_ATTRIBUTE_NAME);

              if ( verbose )
              {
                System.out.println( propertyName +"="+ propertyValue );
              }

              /** Set the property but don't allow any system property to be overridden **/
              pm.setProperty(propertyName, propertyValue, false);

              /** If the property is specified as a System property and it's not already a system property **/
              if ( propertyType != null &&
                   propertyType.equalsIgnoreCase(SYSTEM_PROPERTY_TYPE_NAME) &&
                 System.getProperty(propertyName) == null )
              {
                /** Set this as a system property also **/
                System.setProperty(propertyName, propertyValue);
              }
            }

            /** If this has no dependents then it is a top-level module **/
            if ( dependsName.length() == 0 && pm != pcm)
            {
              pcm.addChild(pm);
            }

            pmDependents.put(pm, dependsName);

                        /** If these properties belond to a named set store them **/
                        if ( propertiesName != null )
                        {
                pms.put(propertiesName, pm);
                        }
          }

          /** Ensure dependency tree is kept **/
          for (Enumeration e = pmDependents.keys();e.hasMoreElements();)
          {
            PropertyManagerPluginInterface pm = (PropertyManagerPluginInterface)e.nextElement();
            String depends = (String)pmDependents.get(pm);

            StringTokenizer strtok = new StringTokenizer(depends,",");

            while (strtok.hasMoreElements())
            {
              String dependantName = strtok.nextToken().trim();
              PropertyManager dependant = (PropertyManager)pms.get(dependantName);

                            if ( dependant == null )
                            {
                                throw new LoadPropertiesException("Dependency not found - property file invalid");
                            }
              pm.addParent(dependant);
            }
          }
        }
        else
        {
View Full Code Here

    }
  }

  public PropertyManagerPluginInterface getChild(String moduleName)
  {
    PropertyManagerPluginInterface returnPm = null;
      Iterator itr = _childPropertyManagers.iterator();

    while ( returnPm == null && itr.hasNext() )
    {
      PropertyManagerImpl pm = (PropertyManagerImpl)itr.next();
View Full Code Here

TOP

Related Classes of com.arjuna.common.util.propertyservice.propertycontainer.PropertyManagerPluginInterface

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.