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; }
/** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void collectNewChildDescriptors ( Collection<Object> newChildDescriptors, Object object ) { super.collectNewChildDescriptors ( newChildDescriptors, object ); newChildDescriptors.add ( createChildParameter ( ProfilePackage.Literals.PROFILE__START, ProfileFactory.eINSTANCE.createStartBundle () ) ); newChildDescriptors.add ( createChildParameter ( ProfilePackage.Literals.PROFILE__SETBSL, ProfileFactory.eINSTANCE.createBundleStartLevel () ) ); newChildDescriptors.add ( createChildParameter ( ProfilePackage.Literals.PROFILE__PROPERTY, ProfileFactory.eINSTANCE.createSystemProperty () ) ); newChildDescriptors.add ( createChildParameter ( ProfilePackage.Literals.PROFILE__PROFILE, ProfileFactory.eINSTANCE.createSubProfile () ) ); }
/** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void collectNewChildDescriptors ( Collection<Object> newChildDescriptors, Object object ) { super.collectNewChildDescriptors ( newChildDescriptors, object ); newChildDescriptors.add ( createChildParameter ( ProfilePackage.Literals.SUB_PROFILE__PROPERTY, ProfileFactory.eINSTANCE.createSystemProperty () ) ); }
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 addStartBundle ( final Profile profile, final String name ) { if ( name == null ) { // no name return; } for ( final StartBundle bundle : profile.getStart () ) { if ( name.equals ( bundle.getName () ) ) { // already added return; } } final StartBundle sb = ProfileFactory.eINSTANCE.createStartBundle (); sb.setName ( name ); profile.getStart ().add ( sb ); }
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 ); }
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 addStartBundle ( final Profile profile, final String name ) { if ( name == null ) { // no name return; } for ( final StartBundle bundle : profile.getStart () ) { if ( name.equals ( bundle.getName () ) ) { // already added return; } } final StartBundle sb = ProfileFactory.eINSTANCE.createStartBundle (); sb.setName ( name ); profile.getStart ().add ( sb ); }
public static Profile createOrGetCustomizationProfile ( final EquinoxApplication app ) { Profile profile = app.getCustomizationProfile (); if ( profile == null ) { profile = ProfileFactory.eINSTANCE.createProfile (); app.setCustomizationProfile ( profile ); } return profile; }
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 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 void process () { if ( this.app.getCustomizationProfile () == null ) { this.app.setCustomizationProfile ( ProfileFactory.eINSTANCE.createProfile () ); } final Profile prof = this.app.getCustomizationProfile (); final Map<Class<?>, Exporter> countMap = new HashMap<> (); for ( final Exporter exporter : this.app.getExporter () ) { if ( exporter.getEndpoints ().size () != 1 ) { throw new IllegalStateException ( "At the moment each exporter must not have exactly than one endpoint" ); } if ( countMap.containsKey ( exporter.getClass () ) ) { throw new IllegalStateException ( String.format ( "At the moment there must not me more than one exporter at a time for the type: %s", exporter.getClass () ) ); } countMap.put ( exporter.getClass (), exporter ); final String tag = exporter.getTypeTag (); put ( prof, String.format ( "org.eclipse.scada.%s.server.exporter.ngp.exportUri", tag ), makeUri ( tag, exporter.getEndpoints ().get ( 0 ) ) ); } }
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 () { if ( this.app.getCustomizationProfile () == null ) { this.app.setCustomizationProfile ( ProfileFactory.eINSTANCE.createProfile () ); } final Profile prof = this.app.getCustomizationProfile (); final Map<Class<?>, Exporter> countMap = new HashMap<> (); for ( final Exporter exporter : this.app.getExporter () ) { if ( exporter.getEndpoints ().size () != 1 ) { throw new IllegalStateException ( "At the moment each exporter must not have exactly than one endpoint" ); } if ( countMap.containsKey ( exporter.getClass () ) ) { throw new IllegalStateException ( String.format ( "At the moment there must not me more than one exporter at a time for the type: %s", exporter.getClass () ) ); } countMap.put ( exporter.getClass (), exporter ); final String tag = exporter.getTypeTag (); put ( prof, String.format ( "org.eclipse.scada.%s.server.exporter.ngp.exportUri", tag ), makeUri ( tag, exporter.getEndpoints ().get ( 0 ) ) ); } }
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" ); }
newChildDescriptors.add ( createChildParameter ( OsgiPackage.Literals.EQUINOX_APPLICATION__CUSTOMIZATION_PROFILE, ProfileFactory.eINSTANCE.createProfile () ) );
newChildDescriptors.add ( createChildParameter ( OsgiPackage.Literals.EQUINOX_APPLICATION__CUSTOMIZATION_PROFILE, ProfileFactory.eINSTANCE.createProfile () ) );
newChildDescriptors.add ( createChildParameter ( OsgiPackage.Literals.EQUINOX_APPLICATION__CUSTOMIZATION_PROFILE, ProfileFactory.eINSTANCE.createProfile () ) );