Package com.arjuna.common.util.propertyservice

Examples of com.arjuna.common.util.propertyservice.PropertyManager


{
  public static void main(String[] args)
  {
    System.setProperty("com.arjuna.ats.arjuna.Test","SysOverride");

    PropertyManager arjunaPM = PropertyManagerFactory.getPropertyManager( "test-property-manager", "Arjuna" );
    PropertyManager txojPM = PropertyManagerFactory.getPropertyManager( "test-property-manager", "TXOJ" );
    PropertyManager orbPM = PropertyManagerFactory.getPropertyManager( "test-property-manager", "ORB Portability" );

    try
    {
      arjunaPM.load(XMLFilePlugin.class.getName(), "test-product.xml");
    }
    catch (Exception e)
    {
      e.printStackTrace()//To change body of catch statement use Options | File Templates.
    }

    boolean passed = true;
    int count = 0;

    String value = arjunaPM.getProperty("com.arjuna.ats.arjuna.Test");
    System.out.println("Value["+(++count)+"] :"+value);
    passed &= value.equals("SysOverride");

    value = txojPM.getProperty("com.arjuna.ats.arjuna.Test");
    System.out.println("Value["+(++count)+"] :"+value);
    passed &= value.equals("SysOverride");

    value = arjunaPM.getProperty("com.arjuna.ats.txoj.Test");
    System.out.println("Value["+(++count)+"] :"+value);
    passed &= ( value == null );

    value = txojPM.getProperty("com.arjuna.ats.txoj.Test");
    System.out.println("Value["+(++count)+"] :"+value);
    passed &= value.equals("Test2");

    value = orbPM.getProperty("com.arjuna.ats.txoj.Test");
    System.out.println("Value["+(++count)+"] :"+value);
    passed &= ( value == null );

    value = orbPM.getProperty("com.arjuna.orbportability.Test");
    System.out.println("Value["+(++count)+"] :"+value);
    passed &= value.equals("Test3");

    System.out.println( passed ? "Passed" : "Failed" );
  }
View Full Code Here


                throw new IllegalStateException("Cannot set transactionStatusManagerPort once the MBean has configured");
            }
        }
        else
        {
            PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
            pm.setProperty(com.arjuna.ats.arjuna.common.Environment.TRANSACTION_STATUS_MANAGER_PORT, ""+port);
        }
    }
View Full Code Here



    public InetAddress getRecoveryInetAddress()
    {
        PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
        try {
            return Utility.hostNameToInetAddress(pm.getProperty(com.arjuna.ats.arjuna.common.Environment.RECOVERY_MANAGER_ADDRESS), "");
        } catch(UnknownHostException e) {
            log.warn("UnknownHostException from getRecoveryInetAddress, input was: "+pm.getProperty(com.arjuna.ats.arjuna.common.Environment.RECOVERY_MANAGER_ADDRESS));
            return null;
        }
    }
View Full Code Here

public class SimpleTest
{
  public static void main(String[] args)
  {
    PropertyManager arjunaPM = PropertyManagerFactory.getPropertyManager( "test-property-manager", "Arjuna" );
    PropertyManager txojPM = PropertyManagerFactory.getPropertyManager( "test-property-manager", "TXOJ" );
    PropertyManager orbPM = PropertyManagerFactory.getPropertyManager( "test-property-manager", "ORB Portability" );

    try
    {
      arjunaPM.load(XMLFilePlugin.class.getName(), "test-product.xml");
    }
    catch (Exception e)
    {
      e.printStackTrace()//To change body of catch statement use Options | File Templates.
    }

    boolean passed = true;
    int count = 0;

    String value = arjunaPM.getProperty("com.arjuna.ats.arjuna.Test");
    System.out.println("Value["+(++count)+"] :"+value);
    passed &= value.equals("Test");

    value = txojPM.getProperty("com.arjuna.ats.arjuna.Test");
    System.out.println("Value["+(++count)+"] :"+value);
    passed &= value.equals("Overridden");

    value = arjunaPM.getProperty("com.arjuna.ats.txoj.Test");
    System.out.println("Value["+(++count)+"] :"+value);
    passed &= ( value == null );

    value = txojPM.getProperty("com.arjuna.ats.txoj.Test");
    System.out.println("Value["+(++count)+"] :"+value);
    passed &= value.equals("Test2");

    value = orbPM.getProperty("com.arjuna.ats.txoj.Test");
    System.out.println("Value["+(++count)+"] :"+value);
    passed &= ( value == null );

    value = orbPM.getProperty("com.arjuna.orbportability.Test");
    System.out.println("Value["+(++count)+"] :"+value);
    passed &= value.equals("Test3");

    System.out.println( passed ? "Passed" : "Failed" );
  }
View Full Code Here

                throw new IllegalStateException("Cannot set recoveryInetAddress once the MBean has configured");
            }
        }
        else
        {
            PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
            pm.setProperty(com.arjuna.ats.arjuna.common.Environment.RECOVERY_MANAGER_ADDRESS, recoveryInetAddress.getHostAddress());
            isRecoveryManagerBindAddressSet = true;
        }
    }
View Full Code Here

        }
    }

    public int getRecoveryPort()
    {
        PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
        return Integer.parseInt(pm.getProperty(com.arjuna.ats.arjuna.common.Environment.RECOVERY_MANAGER_PORT));
    }
View Full Code Here

                throw new IllegalStateException("Cannot set recoveryPort once the MBean has configured");
            }
        }
        else
        {
            PropertyManager pm = PropertyManagerFactory.getPropertyManager("com.arjuna.ats.propertymanager", "recoverymanager");
            pm.setProperty(com.arjuna.ats.arjuna.common.Environment.RECOVERY_MANAGER_PORT, ""+port);
        }
    }
View Full Code Here

public class PropertiesTest
{
  public static void main(String[] args)
  {
    PropertyManager arjunaPM = PropertyManagerFactory.getPropertyManager( "test-property-manager", "Arjuna" );
    PropertyManager txojPM = PropertyManagerFactory.getPropertyManager( "test-property-manager", "TXOJ" );
    PropertyManager orbPM = PropertyManagerFactory.getPropertyManager( "test-property-manager", "ORB Portability" );

    try
    {
      arjunaPM.load(XMLFilePlugin.class.getName(), "test-properties.xml");
    }
    catch (Exception e)
    {
      e.printStackTrace()//To change body of catch statement use Options | File Templates.
    }

    boolean passed = true;
        int count = 0;
    Properties p = txojPM.getProperties();

    System.out.println("TXOJ Properties size = "+p.size());

    for (Enumeration e = p.keys();e.hasMoreElements();)
    {
      String propertyName = (String)e.nextElement();
      String propertyValue = p.getProperty(propertyName);

      if ( ( propertyName.equals("com.arjuna.ats.arjuna.Test") ) ||
           ( propertyName.equals("com.arjuna.ats.txoj.Test") ) )
      {
        System.out.println("Found property '"+propertyName+"', value: "+propertyValue);
        count++;
      }
      else
      {
        System.out.println("Found unexpected property '"+propertyName+"' failed");
        passed = false;
      }
    }

    passed &= (count == 2);

    count = 0;

    p = orbPM.getProperties();

    System.out.println("ORB Portability Properties size = "+p.size());

    for (Enumeration e = p.keys();e.hasMoreElements();)
    {
View Full Code Here

    }


    public int getSocketProcessIdPort()
    {
        PropertyManager pm = arjPropertyManager.getPropertyManager();
        return Integer.parseInt(pm.getProperty(com.arjuna.ats.arjuna.common.Environment.SOCKET_PROCESS_ID_PORT));
    }
View Full Code Here

                throw new IllegalStateException("Cannot set socketProcessIdPort once the MBean has configured");
            }
        }
        else
        {
            PropertyManager pm = arjPropertyManager.getPropertyManager();
            pm.setProperty(com.arjuna.ats.arjuna.common.Environment.SOCKET_PROCESS_ID_PORT, ""+port);
        }
    }
View Full Code Here

TOP

Related Classes of com.arjuna.common.util.propertyservice.PropertyManager

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.