public static Profile flatten ( final Profile profile ) { flatten ( profile, profile.getIncludes () ); profile.getIncludes ().clear (); return profile; }
static void mergeIntoProfile ( final Profile source, final Profile target ) { target.getInstallationUnits ().addAll ( source.getInstallationUnits () ); target.getJvmArguments ().addAll ( source.getJvmArguments () ); target.getArguments ().addAll ( source.getArguments () ); target.getNotes ().addAll ( source.getNotes () ); target.getSetbsl ().addAll ( EcoreUtil.copyAll ( source.getSetbsl () ) ); target.getStart ().addAll ( EcoreUtil.copyAll ( source.getStart () ) ); target.getProperty ().addAll ( EcoreUtil.copyAll ( source.getProperty () ) ); // merge sub profiles for ( final SubProfile subProfile : source.getProfile () ) { mergeSubProfile ( subProfile, findTargetSubProfile ( subProfile.getName (), target ) ); } }
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; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Profile getProfile () { if ( profile != null && profile.eIsProxy () ) { InternalEObject oldProfile = (InternalEObject)profile; profile = (Profile)eResolveProxy ( oldProfile ); if ( profile != oldProfile ) { if ( eNotificationRequired () ) eNotify ( new ENotificationImpl ( this, Notification.RESOLVE, OsgiPackage.DEFAULT_EQUINOX_APPLICATION__PROFILE, oldProfile, profile ) ); } } return profile; }
@Override public void process ( final Module module, final Collection<ApplicationModule> modules, final EquinoxBase app, final org.eclipse.scada.configuration.world.osgi.EquinoxApplication implApp ) { final Profile p = Profiles.createOrGetCustomizationProfile ( implApp ); for ( final String bundle : BUNDLES ) { p.getInstallationUnits ().add ( bundle ); Profiles.addStartBundle ( p, bundle ); } }
p.setProperty ( "osgi.noShutdown", "true" ); //$NON-NLS-1$ //$NON-NLS-2$ p.setProperty ( "osgi.syspath", String.format ( "[INSTALLDIR]\\apps\\%1$s\\plugins", eas.getName () ) ); //$NON-NLS-1$ //$NON-NLS-2$ for ( final SystemProperty prop : profile.getProperty () ) cfg.stopMethod = "stop"; //$NON-NLS-1$ cfg.properties = p; cfg.jvmArgs = profile.getJvmArguments (); cfg.startArguments = profile.getArguments () != null ? profile.getArguments ().toArray ( new String[profile.getArguments ().size ()] ) : null; cfg.classpath = String.format ( "[INSTALLDIR]\\apps\\%1$s\\daemon.jar;[INSTALLDIR]\\apps\\%1$s\\osgi.jar", eas.getName () ); //$NON-NLS-1$ createProcrunService ( comp, serviceName, cfg );
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 (); } } }
public static boolean hasStartBundle ( final Profile profile, final String name ) { for ( final StartBundle sb : profile.getStart () ) { if ( sb.getName ().equals ( name ) ) { return true; } } return false; } }
public static Profile makeProfile ( final EquinoxApplication app ) { final Profile profile = flatten ( EcoreUtil.copy ( app.getProfile () ) ); if ( profile == null ) { throw new IllegalStateException ( "Application implemenation did not return a profile" ); } if ( app.getCustomizationProfile () != null ) { mergeIntoProfile ( flatten ( EcoreUtil.copy ( app.getCustomizationProfile () ) ), profile ); } profile.setName ( String.format ( "Custom profile for %s on node %s", app.getName (), Nodes.fromApp ( app ).getHostName () ) ); profile.setDescription ( null ); // finally clear null system properties clearNulls ( profile ); return profile; }
public static void addProgramArugment ( final Profile profile, final String argument ) { profile.getArguments ().add ( argument ); }
@Override public void process ( final Module module, final Collection<ApplicationModule> modules, final EquinoxBase app, final org.eclipse.scada.configuration.world.osgi.EquinoxApplication implApp ) { final GenericVMSettings s = (GenericVMSettings)module; final Profile p = Profiles.createOrGetCustomizationProfile ( implApp ); p.getJvmArguments ().addAll ( s.getArguments () ); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Profile getProfile () { if ( profile != null && profile.eIsProxy () ) { InternalEObject oldProfile = (InternalEObject)profile; profile = (Profile)eResolveProxy ( oldProfile ); if ( profile != oldProfile ) { if ( eNotificationRequired () ) eNotify ( new ENotificationImpl ( this, Notification.RESOLVE, OsgiPackage.CUSTOM_MASTER_SERVER__PROFILE, oldProfile, profile ) ); } } return profile; }
@Override public void process ( final Module module, final Collection<ApplicationModule> modules, final EquinoxBase app, final org.eclipse.scada.configuration.world.osgi.EquinoxApplication implApp ) { final Profile p = Profiles.createOrGetCustomizationProfile ( implApp ); for ( final String bundle : BUNDLES ) { p.getInstallationUnits ().add ( bundle ); Profiles.addStartBundle ( p, bundle ); } }
p.setProperty ( "osgi.noShutdown", "true" ); //$NON-NLS-1$ //$NON-NLS-2$ p.setProperty ( "osgi.syspath", String.format ( "[INSTALLDIR]\\apps\\%1$s\\plugins", eas.getName () ) ); //$NON-NLS-1$ //$NON-NLS-2$ for ( final SystemProperty prop : profile.getProperty () ) cfg.stopMethod = "stop"; //$NON-NLS-1$ cfg.properties = p; cfg.jvmArgs = profile.getJvmArguments (); cfg.startArguments = profile.getArguments () != null ? profile.getArguments ().toArray ( new String[profile.getArguments ().size ()] ) : null; cfg.classpath = String.format ( "[INSTALLDIR]\\apps\\%1$s\\daemon.jar;[INSTALLDIR]\\apps\\%1$s\\osgi.jar", eas.getName () ); //$NON-NLS-1$ createProcrunService ( comp, serviceName, cfg );
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 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; }
public static boolean hasStartBundle ( final Profile profile, final String name ) { for ( final StartBundle sb : profile.getStart () ) { if ( sb.getName ().equals ( name ) ) { return true; } } return false; } }
public static Profile makeProfile ( final EquinoxApplication app ) { final Profile profile = flatten ( EcoreUtil.copy ( app.getProfile () ) ); if ( profile == null ) { throw new IllegalStateException ( "Application implemenation did not return a profile" ); } if ( app.getCustomizationProfile () != null ) { mergeIntoProfile ( flatten ( EcoreUtil.copy ( app.getCustomizationProfile () ) ), profile ); } profile.setName ( String.format ( "Custom profile for %s on node %s", app.getName (), Nodes.fromApp ( app ).getHostName () ) ); profile.setDescription ( null ); // finally clear null system properties clearNulls ( profile ); return profile; }
public static void addProgramArugment ( final Profile profile, final String argument ) { profile.getArguments ().add ( argument ); }