@Override public void process ( final Module module, final Collection<ApplicationModule> modules, final EquinoxBase app, final org.eclipse.scada.configuration.world.osgi.EquinoxApplication implApp ) { final HttpService s = OsgiFactory.eINSTANCE.createHttpService (); final Endpoint ep = Endpoints.registerEndpoint ( implApp, ( (HttpServiceModule)module ).getPort (), Endpoints.reference ( s ), "HTTP Endpoint" ); s.setEndpoint ( ep ); modules.add ( s ); }
Endpoint ep = Endpoints.findEndpoint ( node, port ); if ( ep != null && ep.getBoundService () != null && serviceBinding != null ) final String oldService = makeLabel ( ep.getBoundService () ); final String newService = makeLabel ( serviceBinding ); throw new IllegalStateException ( String.format ( "Endpoint %s already exists on node %s and is bound by %s (re-binding service: %s)", port, Nodes.makeName ( node ), oldService, newService ) ); ep = Endpoints.createEndpoint ( port, name ); node.getEndpoints ().add ( ep ); Endpoints.bind ( ep, serviceBinding ); if ( serviceBinding != null )
final ServiceBinding bindingService = ( (ExternalDriver)driver ).isBinding () ? Endpoints.contain ( result ) : null; result.getEndpoints ().add ( Endpoints.registerEndpoint ( node, ( (ExternalDriver)driver ).getPortNumber (), bindingService, "ExternalDriver Endpoint: " + driver.getName () ) );
/** * Register a new endpoint <br/> * The endpoint must not exists if the binding service is set, but will * exists after the call returns * * @return the newly created endpoint */ public static Endpoint registerEndpoint ( final Application app, final int port, final ServiceBinding serviceBinding, final String name ) { return registerEndpoint ( Nodes.fromApp ( app ), port, serviceBinding, name ); }
/** * Find the containing node which must be of the provided type * * @param ep * the endpoint * @param clazz * the node clazz * @return the node * @throws IllegalStateException * if the endpoint is not contained by the correct node type */ public static <N extends Node> N findNode ( final Endpoint ep, final Class<N> clazz ) { final Node node = findNode ( ep ); if ( node != null && clazz.isAssignableFrom ( node.getClass () ) ) { return clazz.cast ( node ); } throw new IllegalStateException ( String.format ( "Endpoint %s is not contained by node of type %s", ep, clazz.getName () ) ); }
/** * Register a new endpoint <br/> * The endpoint must not exists if the binding service is set, but will * exists after the call returns * * @return the newly created endpoint */ public static Endpoint registerEndpoint ( final Application app, final int port, final ServiceBinding serviceBinding, final String name ) { return registerEndpoint ( Nodes.fromApp ( app ), port, serviceBinding, name ); }
/** * Find the containing node which must be of the provided type * * @param ep * the endpoint * @param clazz * the node clazz * @return the node * @throws IllegalStateException * if the endpoint is not contained by the correct node type */ public static <N extends Node> N findNode ( final Endpoint ep, final Class<N> clazz ) { final Node node = findNode ( ep ); if ( node != null && clazz.isAssignableFrom ( node.getClass () ) ) { return clazz.cast ( node ); } throw new IllegalStateException ( String.format ( "Endpoint %s is not contained by node of type %s", ep, clazz.getName () ) ); }
private Endpoint createExporter ( final EClass exporterClass, final Node node, final EquinoxApplication application, final int port ) { final Exporter exporter = (Exporter)EcoreUtil.create ( exporterClass ); final Endpoint ep = Endpoints.registerEndpoint ( node, port, Endpoints.reference ( exporter ), String.format ( "Exporter Endpoint: %s - %s", exporter.getTypeTag (), exporter.getName () ) ); node.getEndpoints ().add ( ep ); exporter.setName ( application.getName () + "/exporter" ); exporter.getEndpoints ().add ( ep ); application.getExporter ().add ( exporter ); return ep; }
Endpoint ep = Endpoints.findEndpoint ( node, port ); if ( ep != null && ep.getBoundService () != null && serviceBinding != null ) final String oldService = makeLabel ( ep.getBoundService () ); final String newService = makeLabel ( serviceBinding ); throw new IllegalStateException ( String.format ( "Endpoint %s already exists on node %s and is bound by %s (re-binding service: %s)", port, Nodes.makeName ( node ), oldService, newService ) ); ep = Endpoints.createEndpoint ( port, name ); node.getEndpoints ().add ( ep ); Endpoints.bind ( ep, serviceBinding ); if ( serviceBinding != null )
@Override public Driver createDriver ( final World world, final AbstractFactoryDriver infraDriver, final Map<Node, org.eclipse.scada.configuration.world.Node> nodes ) { final T driver = createDriver (); driver.setPassword ( EcoreUtil.copy ( Worlds.findCommonDriverPassword ( (org.eclipse.scada.configuration.infrastructure.CommonDriver)infraDriver ) ) ); final Endpoint ep = Endpoints.registerEndpoint ( nodes.get ( infraDriver.getNode () ), ( (org.eclipse.scada.configuration.infrastructure.CommonDriver)infraDriver ).getPortNumber (), Endpoints.reference ( driver ), "CommonDriver Endpoint: " + driver.getName () ); driver.getEndpoints ().add ( ep ); configureDriver ( world, infraDriver, driver ); return driver; }
@SuppressWarnings ( "unchecked" ) @Override public Driver process ( final org.eclipse.scada.configuration.infrastructure.Driver infraDriver, final Map<Node, org.eclipse.scada.configuration.world.Node> nodes ) { final T driver = (T)infraDriver; final S result = createDriver ( driver ); result.setName ( driver.getName () ); result.setPassword ( EcoreUtil.copy ( Worlds.findCommonDriverPassword ( driver ) ) ); final Endpoint ep = Endpoints.registerEndpoint ( nodes.get ( driver.getNode () ), driver.getPortNumber (), Endpoints.reference ( result ), String.format ( "Driver Endpoint: %s", driver.getName () ) ); result.getEndpoints ().add ( ep ); return result; }
@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 ); } final EventInjectorSyslog s = OsgiFactory.eINSTANCE.createEventInjectorSyslog (); final org.eclipse.scada.configuration.infrastructure.EventInjectorSyslog m = (org.eclipse.scada.configuration.infrastructure.EventInjectorSyslog)module; final Endpoint ep = Endpoints.registerEndpoint ( implApp, m.getPort (), Endpoints.reference ( s ), "Syslog Receiver Endpoint" ); s.setBindAddress ( m.getBindAddress () ); s.setEndpoint ( ep ); modules.add ( s ); } }
@Override public Driver createDriver ( final World world, final AbstractFactoryDriver driver, final Map<Node, org.eclipse.scada.configuration.world.Node> nodes ) { final T result = createDriver (); final EquinoxDriver eDriver = (EquinoxDriver)driver; final DataAccessExporter exporter = OsgiFactory.eINSTANCE.createDataAccessExporter (); exporter.setName ( "exporter" ); //$NON-NLS-1$ result.getExporter ().add ( exporter ); exporter.getEndpoints ().add ( Endpoints.registerEndpoint ( nodes.get ( driver.getNode () ), world.getOptions ().getBaseDaNgpPort () + eDriver.getInstanceNumber (), Endpoints.reference ( exporter ), "EquinoxDriver Endpoint: " + driver.getName () ) ); final ConfigurationAdministratorExporter caExporter = OsgiFactory.eINSTANCE.createConfigurationAdministratorExporter (); caExporter.setName ( "caExporter" ); //$NON-NLS-1$ result.getExporter ().add ( caExporter ); caExporter.getEndpoints ().add ( Endpoints.registerEndpoint ( nodes.get ( driver.getNode () ), world.getOptions ().getBaseCaNgpPort () + eDriver.getInstanceNumber (), Endpoints.reference ( caExporter ), "CA Exporter: " + driver.getName () ) ); Worlds.addUserService ( result, eDriver ); result.setSecurityConfiguration ( Worlds.findSecurityConfiguration ( eDriver ) ); result.getModules ().addAll ( WorldGenerator.makeModules ( world, eDriver, result ) ); configureDriver ( driver, result, nodes ); return result; }
@SuppressWarnings ( "unchecked" ) @Override public Driver process ( final org.eclipse.scada.configuration.infrastructure.Driver infraDriver, final Map<Node, org.eclipse.scada.configuration.world.Node> nodes ) { final T driver = (T)infraDriver; final S result = createDriver ( driver, nodes ); result.setName ( driver.getName () ); result.setSecurityConfiguration ( Worlds.findSecurityConfiguration ( driver ) ); Worlds.addUserService ( result, driver ); final World world = Containers.findContainer ( infraDriver, World.class ); final DataAccessExporter exporter = OsgiFactory.eINSTANCE.createDataAccessExporter (); exporter.setName ( "exporter" ); //$NON-NLS-1$ result.getExporter ().add ( exporter ); exporter.getEndpoints ().add ( Endpoints.registerEndpoint ( nodes.get ( driver.getNode () ), world.getOptions ().getBaseDaNgpPort () + driver.getInstanceNumber (), Endpoints.reference ( exporter ), "EquinoxDriver Endpoint: " + driver.getName () ) ); final ConfigurationAdministratorExporter caExporter = OsgiFactory.eINSTANCE.createConfigurationAdministratorExporter (); caExporter.setName ( "caExporter" ); //$NON-NLS-1$ result.getExporter ().add ( caExporter ); caExporter.getEndpoints ().add ( Endpoints.registerEndpoint ( nodes.get ( driver.getNode () ), world.getOptions ().getBaseCaNgpPort () + driver.getInstanceNumber (), Endpoints.reference ( caExporter ), "CA Exporter: " + driver.getName () ) ); result.getModules ().addAll ( WorldGenerator.makeModules ( world, driver, result ) ); return result; }