/** * Register the current connection as an OSGi service */ private EntryImpl registerConnection ( final ConnectionDescriptor connectionDescriptor, final ConnectionService connectionService ) { final Class<?>[] interfaces = connectionService.getSupportedInterfaces (); final String[] clazzes = new String[interfaces.length]; int i = 0; for ( final Class<?> iface : interfaces ) { clazzes[i] = iface.getName (); i++; } final Dictionary<String, String> properties = new Hashtable<String, String> (); properties.put ( ConnectionService.CONNECTION_URI, connectionDescriptor.getConnectionInformation ().toString () ); if ( connectionDescriptor.getServiceId () != null ) { properties.put ( Constants.SERVICE_PID, connectionDescriptor.getServiceId () ); } final ServiceRegistration<?> serviceRegistration = this.context.registerService ( clazzes, connectionService, properties ); return new EntryImpl ( connectionDescriptor, connectionService, serviceRegistration ); }
/** * Register the current connection as an OSGi service */ private EntryImpl registerConnection ( final ConnectionDescriptor connectionDescriptor, final ConnectionService connectionService ) { final Class<?>[] interfaces = connectionService.getSupportedInterfaces (); final String[] clazzes = new String[interfaces.length]; int i = 0; for ( final Class<?> iface : interfaces ) { clazzes[i] = iface.getName (); i++; } final Dictionary<String, String> properties = new Hashtable<String, String> (); properties.put ( ConnectionService.CONNECTION_URI, connectionDescriptor.getConnectionInformation ().toString () ); if ( connectionDescriptor.getServiceId () != null ) { properties.put ( Constants.SERVICE_PID, connectionDescriptor.getServiceId () ); } final ServiceRegistration<?> serviceRegistration = this.context.registerService ( clazzes, connectionService, properties ); return new EntryImpl ( connectionDescriptor, connectionService, serviceRegistration ); }
private void store () throws CoreException { PrintWriter printer = null; try { printer = new PrintWriter ( getFile () ); for ( final ConnectionDescriptor descriptor : getConnections () ) { if ( descriptor.getServiceId () != null ) { printer.println ( descriptor.getServiceId () + STORE_ID_DELIM + descriptor.getConnectionInformation () ); } else { printer.println ( descriptor.getConnectionInformation ().toString () ); } } } catch ( final IOException e ) { throw new CoreException ( new Status ( IStatus.ERROR, Activator.PLUGIN_ID, Messages.DefaultFileResourceDiscoverer_ErrorStore, e ) ); } finally { if ( printer != null ) { printer.close (); } } }
if ( this.connectionInformation.getServiceId () != null ) this.idText.setText ( this.connectionInformation.getServiceId () );
if ( this.connectionInformation.getServiceId () != null ) this.idText.setText ( this.connectionInformation.getServiceId () );
private StyledString getConnectionString ( final ConnectionHolder holder ) { final ConnectionService service = holder.getConnectionService (); final ConnectionDescriptor desc = holder.getConnectionInformation (); final StyledString str = new StyledString ( makeLabel ( desc.getConnectionInformation () ) ); if ( service != null ) { str.append ( " [", StyledString.DECORATIONS_STYLER ); //$NON-NLS-1$ final Connection connection = service.getConnection (); if ( connection != null ) { str.append ( String.format ( "%s", holder.getConnectionState () ), StyledString.DECORATIONS_STYLER ); //$NON-NLS-1$ } str.append ( "]", StyledString.DECORATIONS_STYLER ); //$NON-NLS-1$ } if ( desc.getServiceId () != null ) { str.append ( String.format ( " (%s)", desc.getServiceId () ), StyledString.QUALIFIER_STYLER ); //$NON-NLS-1$ } return str; }
private StyledString getConnectionString ( final ConnectionHolder holder ) { final ConnectionService service = holder.getConnectionService (); final ConnectionDescriptor desc = holder.getConnectionInformation (); final StyledString str = new StyledString ( makeLabel ( desc.getConnectionInformation () ) ); if ( service != null ) { str.append ( " [", StyledString.DECORATIONS_STYLER ); //$NON-NLS-1$ final Connection connection = service.getConnection (); if ( connection != null ) { str.append ( String.format ( "%s", holder.getConnectionState () ), StyledString.DECORATIONS_STYLER ); //$NON-NLS-1$ } str.append ( "]", StyledString.DECORATIONS_STYLER ); //$NON-NLS-1$ } if ( desc.getServiceId () != null ) { str.append ( String.format ( " (%s)", desc.getServiceId () ), StyledString.QUALIFIER_STYLER ); //$NON-NLS-1$ } return str; }
return this.connectionHolder.getConnectionInformation ().getServiceId ();
return this.connectionHolder.getConnectionInformation ().getServiceId ();