private Credentials findCredentials ( final Global global, final Local local ) { if ( local.getLogonCredentials () != null ) { return local.getLogonCredentials (); } else if ( global.getDefaultLogonCredentials () != null ) { return global.getDefaultLogonCredentials (); } else { return this.globalizationModel.getDefaultLogonCredentials (); } }
private boolean isIncluded ( final Local local, final Item item ) { Boolean result; result = isIncluded ( local.getFilters (), item ); if ( result != null ) { return result; } result = isIncluded ( local.getGlobal ().getFilters (), item ); if ( result != null ) { return result; } return local.isDefaultInclude (); // default is not to include }
protected int countJobs () { int count = 0; for ( final Global global : this.globalizationModel.getGlobals () ) { count += global.getLocals ().size (); } return count; }
final Global global = GlobalizeFactory.eINSTANCE.createGlobal (); this.globalize.getGlobals ().add ( global ); global.setGlobal ( master.getImplementation () ); final EventPoolImport eventImport = GlobalizeFactory.eINSTANCE.createEventPoolImport (); eventImport.setIncludeLocal ( true ); eventImport.setLocalName ( pool.getName () ); eventImport.setPoolSize ( pool.getSize () ); eventImport.setName ( "proxy." + pool.getName () ); global.getEventPoolImports ().add ( eventImport ); final MonitorPoolImport monitorImport = GlobalizeFactory.eINSTANCE.createMonitorPoolImport (); monitorImport.setIncludeLocal ( true ); monitorImport.setLocalName ( pool.getName () ); monitorImport.setName ( "proxy." + pool.getName () ); global.getMonitorPoolImports ().add ( monitorImport ); final Local local = GlobalizeFactory.eINSTANCE.createLocal (); global.getLocals ().add ( local ); local.setId ( masterImport.getId () ); local.setLocal ( this.ctxMap.get ( masterImport.getImportedMaster () ).getImplementation () ); local.getAuthoratives ().addAll ( EcoreUtil.copyAll ( masterImport.getImportedMaster ().getAuthoratives () ) ); local.setLogonCredentials ( EcoreUtil.copy ( Worlds.findConnectionCredentials ( masterImport ) ) );
protected void processEventPools ( final Global global, final AlarmsEventsModule module ) for ( final EventPoolImport events : global.getEventPoolImports () ) eventProxy.setName ( events.getName () ); eventProxy.setShortDescription ( events.getShortDescription () ); eventProxy.setSize ( events.getPoolSize () ); if ( events.isIncludeLocal () ) eventProxy.getLocal ().addAll ( global.getGlobal ().getEventPools () ); for ( final Local local : global.getLocals () ) for ( final EventPool localPool : local.getLocal ().getEventPools () ) if ( localPool.getName ().equals ( events.getLocalName () ) ) throw new IllegalStateException ( String.format ( "Event pool '%s' could not be found on instance '%s'", events.getLocalName (), Names.makeName ( local.getLocal () ) ) );
private void postProcessEntry ( final Entry entry ) { processItems ( entry.getGlobal (), entry.getLocal (), entry.getDaConnection () ); final AlarmsEventsModule module = findAEModule ( entry.getGlobal () ); for ( final Authorative auth : entry.getLocal ().getAuthoratives () ) { final AknProxy aknProxy = OsgiFactory.eINSTANCE.createAknProxy (); aknProxy.setConnection ( entry.getAeConnection () ); aknProxy.setPriority ( this.aknProxyCounter * 100 ); aknProxy.setPattern ( makeAknProxyPattern ( auth.getHierarchy () ) ); this.aknProxyCounter++; module.getAknProxies ().add ( aknProxy ); } }
/** * 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 ( GlobalizePackage.Literals.LOCAL__LOGON_CREDENTIALS, WorldFactory.eINSTANCE.createUsernamePasswordCredentials () ) ); newChildDescriptors.add ( createChildParameter ( GlobalizePackage.Literals.LOCAL__LOGON_CREDENTIALS, WorldFactory.eINSTANCE.createPasswordCredentials () ) ); newChildDescriptors.add ( createChildParameter ( GlobalizePackage.Literals.LOCAL__FILTERS, GlobalizeFactory.eINSTANCE.createInclude () ) ); newChildDescriptors.add ( createChildParameter ( GlobalizePackage.Literals.LOCAL__FILTERS, GlobalizeFactory.eINSTANCE.createExclude () ) ); newChildDescriptors.add ( createChildParameter ( GlobalizePackage.Literals.LOCAL__FILTERS, GlobalizeFactory.eINSTANCE.createItemNameFilter () ) ); newChildDescriptors.add ( createChildParameter ( GlobalizePackage.Literals.LOCAL__AUTHORATIVES, GlobalizeFactory.eINSTANCE.createAuthorative () ) ); }
private void postProcessGlobal ( final IProgressMonitor monitor ) { for ( final Global global : this.globalizationModel.getGlobals () ) { final AlarmsEventsModule module = addAEModule ( global ); processPull ( module, global ); processEventPools ( global, module ); processMonitorPools ( global, module ); monitor.worked ( 1 ); } }
public void preProcess ( final IProgressMonitor monitor ) { monitor.beginTask ( "Globalizing world - Phase 1/2", countJobs () ); try { for ( final Global global : this.globalizationModel.getGlobals () ) { for ( final Local local : global.getLocals () ) { preProcessRule ( global, local ); monitor.worked ( 1 ); } } } finally { monitor.done (); } }
if ( ( (Exclude)filter ).getPattern ().matcher ( item.getName () ).matches () ) if ( ( (Exclude)filter ).getPattern ().matcher ( item.getName () ).matches () ) final String itemName = ( (ItemNameFilter)filter ).getItemName (); if ( itemName != null && itemName.equals ( item.getName () ) ) return ( (ItemNameFilter)filter ).isInclude ();
public void postProcess ( final IProgressMonitor monitor ) { monitor.beginTask ( "Globalizing world - Phase 2/2", this.entries.size () + this.globalizationModel.getGlobals ().size () ); try { postProcessGlobal ( monitor ); // process after since we need the AE module for ( final Entry entry : this.entries ) { postProcessEntry ( entry ); monitor.worked ( 1 ); } } finally { monitor.done (); } }
/** * 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 ( InfrastructurePackage.Literals.MASTER_SERVER__AUTHORATIVES, GlobalizeFactory.eINSTANCE.createAuthorative () ) ); newChildDescriptors.add ( createChildParameter ( InfrastructurePackage.Literals.MASTER_SERVER__IMPORT_MASTER, InfrastructureFactory.eINSTANCE.createMasterImport () ) ); }
/** * 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 ( GlobalizePackage.Literals.GLOBALIZATION__DEFAULT_LOGON_CREDENTIALS, WorldFactory.eINSTANCE.createUsernamePasswordCredentials () ) ); newChildDescriptors.add ( createChildParameter ( GlobalizePackage.Literals.GLOBALIZATION__DEFAULT_LOGON_CREDENTIALS, WorldFactory.eINSTANCE.createPasswordCredentials () ) ); newChildDescriptors.add ( createChildParameter ( GlobalizePackage.Literals.GLOBALIZATION__GLOBALS, GlobalizeFactory.eINSTANCE.createGlobal () ) ); }
/** * This returns the label styled text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getStyledText ( Object object ) { String label = ( (ItemNameFilter)object ).getItemName (); StyledString styledLabel = new StyledString (); if ( label == null || label.length () == 0 ) { styledLabel.append ( getString ( "_UI_ItemNameFilter_type" ), StyledString.Style.QUALIFIER_STYLER ); //$NON-NLS-1$ } else { styledLabel.append ( getString ( "_UI_ItemNameFilter_type" ), StyledString.Style.QUALIFIER_STYLER ).append ( " " + label ); //$NON-NLS-1$ //$NON-NLS-2$ } return styledLabel; }
private String makeGlobalSummaryName ( final Global global, final Local local, final Item item ) { return "SYSTEM" + Names.delimiter + "globalizedSummaries" + Names.delimiter + local.getId () + Names.delimiter + item.getName (); }
public void generate ( final IProgressMonitor monitor ) throws Exception { this.world = WorldFactory.eINSTANCE.createWorld (); this.world.setOptions ( WorldFactory.eINSTANCE.createOptions () ); this.world.getOptions ().setMasterHandlerPriorities ( this.infrastructure.getDefaultMasterHandlerPriorities () ); // FIXME: don't create globalize if there is nothing to globalize this.globalize = GlobalizeFactory.eINSTANCE.createGlobalization (); this.globalize.setWorld ( this.world ); fillWorld (); fillGlobalize (); }
private AlarmsEventsModule addAEModule ( final Global global ) { final AlarmsEventsModule aeModule = OsgiFactory.eINSTANCE.createAlarmsEventsModule (); final Iterator<ApplicationModule> i = global.getGlobal ().getModules ().iterator (); while ( i.hasNext () ) { if ( i.next () instanceof AlarmsEventsModule ) { i.remove (); } } global.getGlobal ().getModules ().add ( aeModule ); return aeModule; }
protected void processPull ( final AlarmsEventsModule module, final Global global ) { if ( global.getLocalPull () == null ) { return; } module.getPullEvents ().add ( EcoreUtil.copy ( global.getLocalPull () ) ); }
/** * 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 ( InfrastructurePackage.Literals.MASTER_SERVER__AUTHORATIVES, GlobalizeFactory.eINSTANCE.createAuthorative () ) ); newChildDescriptors.add ( createChildParameter ( InfrastructurePackage.Literals.MASTER_SERVER__IMPORT_MASTER, InfrastructureFactory.eINSTANCE.createMasterImport () ) ); }
private AlarmsEventsModule findAEModule ( final Global global ) { final Iterator<ApplicationModule> i = global.getGlobal ().getModules ().iterator (); while ( i.hasNext () ) { final ApplicationModule current = i.next (); if ( current instanceof AlarmsEventsModule ) { return (AlarmsEventsModule)current; } } throw new IllegalStateException ( String.format ( "Unable to find %s", AlarmsEventsModule.class ) ); }