public static void setSourceConnectionFromEndpoints ( final SourceItem item, final MasterServer master, final Collection<Endpoint> endpoints ) { final Connection connection = Locator.findConnection ( master, endpoints ); if ( connection == null ) { final String nodeName = Nodes.makeName ( Nodes.fromApp ( master ) ); throw new IllegalStateException ( String.format ( "Master '%s' on node '%s' does not have a connection to endpoints %s", master.getName (), nodeName, StringHelper.join ( endpoints, ", " ) ) ); } if ( ! ( connection instanceof DataAccessConnection ) ) { throw new IllegalStateException ( String.format ( "Connection is of type %s but must be of type %s (Endpoints: %s)", connection.getClass ().getName (), DataAccessConnection.class.getName (), StringHelper.join ( endpoints, ", " ) ) ); } item.setConnection ( (DataAccessConnection)connection ); }
public static void setSourceConnectionFromEndpoints ( final SourceItem item, final MasterServer master, final Collection<Endpoint> endpoints ) { final Connection connection = Locator.findConnection ( master, endpoints ); if ( connection == null ) { final String nodeName = Nodes.makeName ( Nodes.fromApp ( master ) ); throw new IllegalStateException ( String.format ( "Master '%s' on node '%s' does not have a connection to endpoints %s", master.getName (), nodeName, StringHelper.join ( endpoints, ", " ) ) ); } if ( ! ( connection instanceof DataAccessConnection ) ) { throw new IllegalStateException ( String.format ( "Connection is of type %s but must be of type %s (Endpoints: %s)", connection.getClass ().getName (), DataAccessConnection.class.getName (), StringHelper.join ( endpoints, ", " ) ) ); } item.setConnection ( (DataAccessConnection)connection ); }
@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 ); } } );
private SourceItem createGlobalItem ( final Global global, final Local local, final Item item, final DataAccessConnection da ) { final SourceItem sourceItem = OsgiFactory.eINSTANCE.createSourceItem (); sourceItem.setInformation ( EcoreUtil.copy ( item.getInformation () ) ); sourceItem.setSourceName ( item.getName () ); sourceItem.setConnection ( da ); if ( item instanceof SummaryItem ) { sourceItem.setName ( makeGlobalSummaryName ( global, local, item ) ); } else { sourceItem.setName ( item.getName () ); } // FIXME: customize global item final int level = findAttributesHierarchyLevel ( item ) + 1; DefaultFeatures.ASUM ( level ).customize ( sourceItem ); this.hierarchyLevelMap.put ( sourceItem, level ); return sourceItem; }