@Override public void createItems ( final ItemCreator itemCreator ) { final String name = this.analyzer.getConnection ().getId (); createForConnection ( itemCreator, new ConnectionProvider () { @Override public Connection getConnection ( final MasterServer master ) { return Locator.findConnection ( master, name, DataAccessConnection.class ); } } ); } }
/** * Find the access credentials for the target * * @param masterImport * the target * @return the access credentials, or <code>null</code> if there were none */ public static Credentials findConnectionCredentials ( final MasterImport masterImport ) { if ( masterImport.getCredentials () != null ) { return masterImport.getCredentials (); } return findInterconnectCredentials ( masterImport.getImportedMaster () ); }
@Override public void generate ( final GenerationContext context ) { final MasterServer master = this.globalize.getSourceMaster ().getMaster (); final MasterContext mappedMaster = this.context.getMasterContext ( master ); if ( mappedMaster == null ) { throw new IllegalStateException ( String.format ( "No mapped master found for: %s", master ) ); } createItems ( createItemCreator ( mappedMaster ) ); }
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 ) ) ); final MasterContext importedMaster = this.ctxMap.get ( masterImport.getImportedMaster () ); importedMaster.getGlobalContext ().add ( new GlobalContext ( local, masterImport ) );
@Override public void setMaster ( final SourceItem item, final MasterContext master ) { final MasterContext importedMaster = ItemCreatorImpl.this.ctx.getMasterContext ( masterImport.getImportedMaster () ); final DataAccessConnection con = findConnection ( master.getImplementation (), importedMaster.getImplementation () ); if ( con == null ) { throw new IllegalStateException ( String.format ( "Unable to find DataAccess connection from %s to %s", master.getImplementation (), importedMaster.getImplementation () ) ); } item.setConnection ( con ); } } );
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public MasterImport getSourceMaster () { if ( sourceMaster != null && sourceMaster.eIsProxy () ) { InternalEObject oldSourceMaster = (InternalEObject)sourceMaster; sourceMaster = (MasterImport)eResolveProxy ( oldSourceMaster ); if ( sourceMaster != oldSourceMaster ) { if ( eNotificationRequired () ) eNotify ( new ENotificationImpl ( this, Notification.RESOLVE, ComponentPackage.GLOBALIZE_COMPONENT__SOURCE_MASTER, oldSourceMaster, sourceMaster ) ); } } return sourceMaster; }
final MasterServer im = glob.getSourceMaster ().getImportedMaster (); if ( im == null )
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MasterImport getConnection () { if ( connection != null && connection.eIsProxy () ) { InternalEObject oldConnection = (InternalEObject)connection; connection = (MasterImport)eResolveProxy ( oldConnection ); if ( connection != oldConnection ) { if ( eNotificationRequired () ) eNotify ( new ENotificationImpl ( this, Notification.RESOLVE, ComponentPackage.MASTER_IMPORT_CONNECTION_ANALYZER__CONNECTION, oldConnection, connection ) ); } } return connection; }
final MasterServer im = glob.getSourceMaster ().getImportedMaster (); if ( im == null )
/** * 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 = ( (MasterImport)object ).getId (); StyledString styledLabel = new StyledString (); if ( label == null || label.length () == 0 ) { styledLabel.append ( getString ( "_UI_MasterImport_type" ), StyledString.Style.QUALIFIER_STYLER ); //$NON-NLS-1$ } else { styledLabel.append ( getString ( "_UI_MasterImport_type" ), StyledString.Style.QUALIFIER_STYLER ).append ( " " + label ); //$NON-NLS-1$ //$NON-NLS-2$ } return styledLabel; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public EList<MasterServer> getMasterOn () { if ( getSourceMaster () != null && getSourceMaster ().getMaster () != null ) { return ECollections.singletonEList ( getSourceMaster ().getMaster () ); } else { return ECollections.emptyEList (); } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public MasterImport getSourceMaster () { if ( sourceMaster != null && sourceMaster.eIsProxy () ) { InternalEObject oldSourceMaster = (InternalEObject)sourceMaster; sourceMaster = (MasterImport)eResolveProxy ( oldSourceMaster ); if ( sourceMaster != oldSourceMaster ) { if ( eNotificationRequired () ) eNotify ( new ENotificationImpl ( this, Notification.RESOLVE, ComponentPackage.GLOBALIZE_COMPONENT__SOURCE_MASTER, oldSourceMaster, sourceMaster ) ); } } return sourceMaster; }
/** * 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 = ( (MasterImport)object ).getId (); StyledString styledLabel = new StyledString (); if ( label == null || label.length () == 0 ) { styledLabel.append ( getString ( "_UI_MasterImport_type" ), StyledString.Style.QUALIFIER_STYLER ); //$NON-NLS-1$ } else { styledLabel.append ( getString ( "_UI_MasterImport_type" ), StyledString.Style.QUALIFIER_STYLER ).append ( " " + label ); //$NON-NLS-1$ //$NON-NLS-2$ } return styledLabel; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public EList<MasterServer> getMasterOn () { if ( getSourceMaster () != null && getSourceMaster ().getMaster () != null ) { return ECollections.singletonEList ( getSourceMaster ().getMaster () ); } else { return ECollections.emptyEList (); } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MasterImport getConnection () { if ( connection != null && connection.eIsProxy () ) { InternalEObject oldConnection = (InternalEObject)connection; connection = (MasterImport)eResolveProxy ( oldConnection ); if ( connection != oldConnection ) { if ( eNotificationRequired () ) eNotify ( new ENotificationImpl ( this, Notification.RESOLVE, ComponentPackage.MASTER_IMPORT_CONNECTION_ANALYZER__CONNECTION, oldConnection, connection ) ); } } return connection; }