/** * 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 ); }
/** * 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 ); }
public static boolean isLocal ( final Node node1, final Application app ) { return isLocal ( node1, fromApp ( app ) ); }
public static boolean isLocal ( final Node node1, final Application app ) { return isLocal ( node1, fromApp ( app ) ); }
public static String makeHostname ( final Application app, final Node node ) { if ( isLocal ( fromApp ( app ), node ) ) { return LOCALHOST; } return node.getHostName (); } }
public static String makeHostname ( final Application app, final Node node ) { if ( isLocal ( fromApp ( app ), node ) ) { return LOCALHOST; } return node.getHostName (); } }
public static boolean isLocal ( final Application app1, final Endpoint ep ) { return isLocal ( fromApp ( app1 ), ep.getNode () ); }
public static boolean isLocal ( final Application app1, final Endpoint ep ) { return isLocal ( fromApp ( app1 ), ep.getNode () ); }
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 ); }
protected void addDebianDependency ( final MasterServer master, final String dependecy ) { try { new TypeWalker<> ( DebianDeploymentMechanism.class ).walk ( Nodes.fromApp ( master ).getDeployments (), new TypeVisitor<DebianDeploymentMechanism> () { @Override public void visit ( final DebianDeploymentMechanism item ) throws Exception { item.getAdditionalDependencies ().add ( dependecy ); } } ); } catch ( final Exception e ) { throw new RuntimeException ( e ); } }
@Override protected <T extends Item> void itemAdded ( final T item, final CustomizationRequest customizationRequest, final List<String> originalLocalTags, final Set<MasterListener<T>> masterListeners ) { super.itemAdded ( item, customizationRequest, originalLocalTags, masterListeners ); registerMappedItem ( this.ctx, this.component, originalLocalTags, item ); if ( isArchive ( item, customizationRequest ) ) { logger.debug ( "Archive item: {}", item ); final ValueArchiveServer archive = this.ctx.getArchiveServer ( this.master.getImplementation () ); if ( archive == null ) { final Node node = Nodes.fromApp ( this.master.getImplementation () ); throw new IllegalStateException ( String.format ( "Item %s should be archived but no archive server is configured for %s on %s", item, this.master, node ) ); } Items.addArchive ( archive, item ); } }
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 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; }
@Override public void process ( final Module module, final Collection<ApplicationModule> modules, final EquinoxBase app, final org.eclipse.scada.configuration.world.osgi.EquinoxApplication implApp ) { final JMXSettings s = (JMXSettings)module; final Profile p = Profiles.createOrGetCustomizationProfile ( implApp ); // the next line will enable JMX remote Profiles.addSystemProperty ( p, "com.sun.management.jmxremote", "" ); final Integer port = makePort ( s, app ); Profiles.addSystemProperty ( p, "com.sun.management.jmxremote.port", port ); Profiles.addSystemProperty ( p, "com.sun.management.jmxremote.local.only", s.getLocalOnly () ); Profiles.addSystemProperty ( p, "com.sun.management.jmxremote.authenticate", s.getAuthenticated () ); Profiles.addSystemProperty ( p, "com.sun.management.jmxremote.ssl", s.getSsl () ); final Node node = Nodes.fromApp ( implApp ); if ( s.isAssignNodeHostname () && node != null && node.getHostName () != null && !node.getHostName ().isEmpty () ) { Profiles.addSystemProperty ( p, "java.rmi.server.hostname", node.getHostName () ); } }