@Override public void process ( final Module module, final Collection<ApplicationModule> modules, final EquinoxBase app, final org.eclipse.scada.configuration.world.osgi.EquinoxApplication implApp ) { final EquinoxApplication eqApp = (EquinoxApplication)app; if ( app instanceof EquinoxApplication ) { final RestExporter s = OsgiFactory.eINSTANCE.createRestExporter (); s.setContextId ( ( (RestExporterModule)module ).getContextId () ); s.getHiveProperties ().addAll ( Worlds.convertToProperties ( Worlds.findInterconnectCredentials ( eqApp ) ) ); modules.add ( s ); } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public RestExporterModule getDefinition () { if ( definition != null && definition.eIsProxy () ) { InternalEObject oldDefinition = (InternalEObject)definition; definition = (RestExporterModule)eResolveProxy ( oldDefinition ); if ( definition != oldDefinition ) { if ( eNotificationRequired () ) eNotify ( new ENotificationImpl ( this, Notification.RESOLVE, ComponentPackage.REST_INTERCEPTOR__DEFINITION, oldDefinition, definition ) ); } } return definition; }
@Override protected boolean processInterceptItem ( final Item item, final ItemInterceptor interceptorElement, final MasterContext masterContext, final Properties properties ) { final RestInterceptor interceptor = (RestInterceptor)interceptorElement; final String contextId = interceptor.getDefinition ().getContextId (); for ( final ApplicationModule a : masterContext.getImplementation ().getModules () ) { if ( a instanceof RestExporter ) { if ( ( (RestExporter)a ).getContextId ().equals ( contextId ) ) { // found context -> insert ( (RestExporter)a ).getItems ().add ( item ); return true; } } } throw new IllegalStateException ( String.format ( "Unable to find REST exporter: %s", contextId ) ); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public RestExporterModule getDefinition () { if ( definition != null && definition.eIsProxy () ) { InternalEObject oldDefinition = (InternalEObject)definition; definition = (RestExporterModule)eResolveProxy ( oldDefinition ); if ( definition != oldDefinition ) { if ( eNotificationRequired () ) eNotify ( new ENotificationImpl ( this, Notification.RESOLVE, ComponentPackage.REST_INTERCEPTOR__DEFINITION, oldDefinition, definition ) ); } } return definition; }
/** * 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 = ( (RestExporterModule)object ).getContextId (); StyledString styledLabel = new StyledString (); if ( label == null || label.length () == 0 ) { styledLabel.append ( getString ( "_UI_RestExporterModule_type" ), StyledString.Style.QUALIFIER_STYLER ); //$NON-NLS-1$ } else { styledLabel.append ( getString ( "_UI_RestExporterModule_type" ), StyledString.Style.QUALIFIER_STYLER ).append ( " " + label ); //$NON-NLS-1$ //$NON-NLS-2$ } return styledLabel; }
/** * 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 = ( (RestExporterModule)object ).getContextId (); StyledString styledLabel = new StyledString (); if ( label == null || label.length () == 0 ) { styledLabel.append ( getString ( "_UI_RestExporterModule_type" ), StyledString.Style.QUALIFIER_STYLER ); //$NON-NLS-1$ } else { styledLabel.append ( getString ( "_UI_RestExporterModule_type" ), StyledString.Style.QUALIFIER_STYLER ).append ( " " + label ); //$NON-NLS-1$ //$NON-NLS-2$ } return styledLabel; }