Retrieve user-defined component properties

You can add user defined properties for your components using the Advanced tab in the EAServer Manager Component Properties Dialog box. To access these properties at run time, use the Jaguar::Repository API as shown in the example below. For details on this API, see the generated reference documentation in the html/ir subdirectory of your installation. The function below returns an array of Jaguar::Property instances that contain the properties defined for the currently executing component:

public static Property[] getMyComponentProps() { 
    Repository theRep; 
    Property[] myProps; 
    try { 
        java.util.Properties orbProps = new java.util.Properties(); 
        orbProps.put("org.omg.CORBA.ORBClass", 
                 "com.sybase.CORBA.ORB"); 
        ORB theOrb = ORB.init((java.lang.String[])null, orbProps); 
        theRep = RepositoryHelper.narrow 
           (theOrb.string_to_object("Jaguar/Repository")); 
    } catch (Exception e) { 
        System.out.println("Exception instantiating Repository component:" 
                           + "\n" + e); 
        return null; 
    } 
    try { 
        String myPackage = JContext.getPackageName(); 
        String myComponent = myPackage + "/" + JContext.getComponentName(); 
        myProps = theRep.lookup("Component", myComponent); 
    } catch (Exception e) { 
        System.out.println("Exception getting component properties:" 
                           + "\n" + e); 
        return null; 
    }   
    return myProps;       
}

You can also retrieve user-defined properties with the CtsComponents::ObjectContext interface. To obtain a class instance, call the Orb.string_to_object method, passing the string “CtsComponents/ObjectContext”. For details on the interface methods, see the generated reference documentation in the html/ir subdirectory of your installation.