/** * Public constructor to instantiate the helper. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ProfileXMLProcessor () { super ( ( EPackage.Registry.INSTANCE ) ); ProfilePackage.eINSTANCE.eClass (); }
private void put ( final Profile prof, final String key, final String value ) { final SystemProperty prop = ProfileFactory.eINSTANCE.createSystemProperty (); prof.getProperty ().add ( prop ); prop.setEval ( false ); prop.setKey ( key ); prop.setValue ( value ); }
private Profile createProfile ( final Profile profile ) { if ( profile == null ) { return null; } final Profile newProfile = ProfileFactory.eINSTANCE.createProfile (); newProfile.getIncludes ().add ( profile ); newProfile.setName ( "Local customization profile" ); return newProfile; }
public static Map<String, Integer> makeStartLevelMap ( final Profile profile ) { final Map<String, Integer> result = new HashMap<> (); for ( final StartBundle start : profile.getStart () ) { result.put ( start.getName (), -1 ); } for ( final BundleStartLevel bsl : profile.getSetbsl () ) { result.put ( bsl.getName (), bsl.getLevel () ); } return result; }
static SubProfile findTargetSubProfile ( final String name, final Profile target ) { for ( final SubProfile sub : target.getProfile () ) { if ( sub.getName ().equals ( name ) ) { return sub; } } // did not find, create a new one final SubProfile sub = ProfileFactory.eINSTANCE.createSubProfile (); sub.setName ( name ); target.getProfile ().add ( sub ); return sub; } }
public static void removeSystemProperty ( final Profile profile, final String key ) { for ( final Iterator<SystemProperty> i = profile.getProperty ().iterator (); i.hasNext (); ) { final SystemProperty p = i.next (); if ( p.getKey ().equals ( key ) ) { i.remove (); } } }
protected static void clearNulls ( final Profile profile ) { for ( final Iterator<SystemProperty> i = profile.getProperty ().iterator (); i.hasNext (); ) { final SystemProperty prop = i.next (); if ( prop.getValue () == null ) { i.remove (); } } }
public static Profile createOrGetCustomizationProfile ( final EquinoxApplication app ) { Profile profile = app.getCustomizationProfile (); if ( profile == null ) { profile = ProfileFactory.eINSTANCE.createProfile (); app.setCustomizationProfile ( profile ); } return profile; }
static void flatten ( final Profile profile, final EList<Profile> includes ) { for ( final Profile include : includes ) { mergeIntoProfile ( include, profile ); flatten ( profile, include.getIncludes () ); } }
static void mergeSubProfile ( final SubProfile source, final SubProfile target ) { target.getProperty ().addAll ( target.getProperty () ); }
private void put ( final Profile prof, final String key, final String value ) { final SystemProperty prop = ProfileFactory.eINSTANCE.createSystemProperty (); prof.getProperty ().add ( prop ); prop.setEval ( false ); prop.setKey ( key ); prop.setValue ( value ); }
public static Map<String, Integer> makeStartLevelMap ( final Profile profile ) { final Map<String, Integer> result = new HashMap<> (); for ( final StartBundle start : profile.getStart () ) { result.put ( start.getName (), -1 ); } for ( final BundleStartLevel bsl : profile.getSetbsl () ) { result.put ( bsl.getName (), bsl.getLevel () ); } return result; }
static SubProfile findTargetSubProfile ( final String name, final Profile target ) { for ( final SubProfile sub : target.getProfile () ) { if ( sub.getName ().equals ( name ) ) { return sub; } } // did not find, create a new one final SubProfile sub = ProfileFactory.eINSTANCE.createSubProfile (); sub.setName ( name ); target.getProfile ().add ( sub ); return sub; } }
protected static void clearNulls ( final Profile profile ) { for ( final Iterator<SystemProperty> i = profile.getProperty ().iterator (); i.hasNext (); ) { final SystemProperty prop = i.next (); if ( prop.getValue () == null ) { i.remove (); } } }
public static Profile createOrGetCustomizationProfile ( final EquinoxApplication app ) { Profile profile = app.getCustomizationProfile (); if ( profile == null ) { profile = ProfileFactory.eINSTANCE.createProfile (); app.setCustomizationProfile ( profile ); } return profile; }
public static void addSystemProperty ( final Profile profile, final String key, final Object value ) { removeSystemProperty ( profile, key ); // now add final SystemProperty prop = ProfileFactory.eINSTANCE.createSystemProperty (); prop.setKey ( key ); if ( value != null ) { prop.setValue ( "" + value ); } else { // we do set null here since we want to cancel out higher level values prop.setValue ( null ); } profile.getProperty ().add ( prop ); }
public static void addSystemProperty ( final Profile profile, final String key, final Object value ) { removeSystemProperty ( profile, key ); // now add final SystemProperty prop = ProfileFactory.eINSTANCE.createSystemProperty (); prop.setKey ( key ); if ( value != null ) { prop.setValue ( "" + value ); } else { // we do set null here since we want to cancel out higher level values prop.setValue ( null ); } profile.getProperty ().add ( prop ); }
public void process ( final EquinoxApplication app ) { // get profile final Profile profile = Profiles.createOrGetCustomizationProfile ( app ); // add system property final SystemProperty prop = ProfileFactory.eINSTANCE.createSystemProperty (); prop.setKey ( PropertyAuthenticationService.PROP ); prop.setValue ( makeValue ( this.userService.getUsers () ) ); profile.getProperty ().add ( prop ); // add service Profiles.addStartBundle ( profile, "org.eclipse.scada.sec.provider.plain.property" ); }