本文整理汇总了Java中org.eclipse.scada.utils.str.StringHelper类的典型用法代码示例。如果您正苦于以下问题:Java StringHelper类的具体用法?Java StringHelper怎么用?Java StringHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringHelper类属于org.eclipse.scada.utils.str包,在下文中一共展示了StringHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import org.eclipse.scada.utils.str.StringHelper; //导入依赖的package包/类
@Override
public String toString ()
{
final StringBuilder sb = new StringBuilder ();
sb.append ( "[UserInformation - name=" );
if ( this.name != null )
{
sb.append ( this.name );
}
else
{
sb.append ( "<anonymous>" );
}
sb.append ( ", roles=[" );
sb.append ( StringHelper.join ( this.roles, ", " ) );
sb.append ( "]]" );
return sb.toString ();
}
示例2: request
import org.eclipse.scada.utils.str.StringHelper; //导入依赖的package包/类
@Override
public void request ( final HandshakeContext context, final Map<String, String> helloProperties )
{
final List<ProtocolDescriptor> protocols = context.getProtocolConfiguration ().getProtocols ();
for ( final ProtocolDescriptor protocol : protocols )
{
logger.debug ( "Offering protocol : {}", protocol.getProtocolId () );
helloProperties.put ( "protocol." + protocol.getProtocolId (), "true" );
}
if ( context.getProtocolConfiguration ().getPreferredProtocols () != null )
{
helloProperties.put ( PROP_CLIENT_PROTOCOL_PREFS, StringHelper.join ( context.getProtocolConfiguration ().getPreferredProtocols (), ", " ) );
}
}
示例3: populateFromAssertion
import org.eclipse.scada.utils.str.StringHelper; //导入依赖的package包/类
private void populateFromAssertion ( final boolean negate, final FilterAssertion filter )
{
final FieldEntry fieldEntry = this.fields.get ( filter.getAttribute () );
if ( fieldEntry instanceof TextFieldEntry )
{
final VariantEditor ve = new VariantEditor ();
// special case if filter is substring
if ( filter.getValue () instanceof String )
{
ve.setAsText ( (String)filter.getValue () );
}
else if ( filter.getValue () instanceof Collection<?> )
{
ve.setAsText ( StringHelper.join ( (Collection<?>)filter.getValue (), "*" ) ); //$NON-NLS-1$
}
final Variant value = (Variant)ve.getValue ();
( (TextFieldEntry)fieldEntry ).setValue ( value.toLabel ( "" ) ); //$NON-NLS-1$
( (TextFieldEntry)fieldEntry ).setNegation ( negate );
}
}
示例4: createStatusLabel
import org.eclipse.scada.utils.str.StringHelper; //导入依赖的package包/类
protected String createStatusLabel ()
{
final List<String> labels = new LinkedList<String> ();
labels.add ( getLabelForConnection () );
if ( this.currentFilter != null )
{
labels.add ( String.format ( Messages.EventHistoryView_Label_Format_Filter, this.currentFilter.second.replace ( "&", "&&" ) ) ); //$NON-NLS-2$
}
if ( this.queryState.get () == QueryState.LOADING )
{
labels.add ( Messages.EventHistoryView_Label_Format_IsLoading );
}
labels.add ( String.format ( Messages.EventHistoryView_Label_Format_CountEvents, EventHistoryView.this.events.size () ) );
return StringHelper.join ( labels, Messages.EventHistoryView_Sep );
}
示例5: createStatusLabel
import org.eclipse.scada.utils.str.StringHelper; //导入依赖的package包/类
protected String createStatusLabel ()
{
final List<String> labels = new LinkedList<String> ();
labels.add ( getLabelForConnection () );
if ( this.monitorSubscriptionState != null )
{
labels.add ( this.monitorSubscriptionState.toString () );
}
if ( this.monitorsId != null )
{
labels.add ( String.format ( Messages.MonitorsView_Label_Format_Monitors, this.monitorsId ) );
}
else
{
labels.add ( Messages.MonitorsView_Label_Format_NoMonitors );
}
labels.add ( String.format ( Messages.MonitorsView_Label_Format_CountMonitors, MonitorsView.this.monitors.size () ) );
return StringHelper.join ( labels, Messages.MonitorsView_Sep );
}
示例6: makeOptions
import org.eclipse.scada.utils.str.StringHelper; //导入依赖的package包/类
private String makeOptions ( final SerialToNetworkMapping entry )
{
final List<String> options = new LinkedList<> ();
options.add ( "" + entry.getBaudRate () );
options.add ( entry.getDataBits () + "DATABITS" );
options.add ( MessageFormat.format ( "{0,choice,1#1STOPBIT|1<{0}STOPBITS}", entry.getStopBits () ) );
options.add ( "" + entry.getParity () );
if ( !entry.isBreak () )
{
options.add ( "NOBREAK" );
}
addOption ( options, !entry.isModemControl (), "LOCAL" );
addOption ( options, entry.isXonxoff (), "XONXOFF" );
addOption ( options, entry.isRtscts (), "RTSCTS" );
return StringHelper.join ( options, " " );
}
示例7: validate
import org.eclipse.scada.utils.str.StringHelper; //导入依赖的package包/类
@Override
protected void validate ( final SerialToNetworkMapping target, final ValidationContext context )
{
if ( target.getBaudRate () <= 0 )
{
context.add ( CommonPackage.Literals.SERIAL_TO_NETWORK_MAPPING__BAUD_RATE, "Baud rate must be greater than zero" );
}
if ( !validDataBits.contains ( (int)target.getDataBits () ) )
{
context.add ( CommonPackage.Literals.SERIAL_TO_NETWORK_MAPPING__DATA_BITS, "Data bits must be one of: {0}", StringHelper.join ( validDataBits, ", " ) );
}
if ( !validStopBits.contains ( (int)target.getStopBits () ) )
{
context.add ( CommonPackage.Literals.SERIAL_TO_NETWORK_MAPPING__STOP_BITS, "Stop bits must be one of: {0}", StringHelper.join ( validStopBits, ", " ) );
}
if ( target.getTcpPort () < MIN_PORT || target.getTcpPort () > MAX_PORT )
{
context.add ( CommonPackage.Literals.SERIAL_TO_NETWORK_MAPPING__TCP_PORT, "TCP port must be between {0} and {1}", MIN_PORT, MAX_PORT );
}
}
示例8: walk
import org.eclipse.scada.utils.str.StringHelper; //导入依赖的package包/类
private void walk ( final Stack<DataSourceNode> stack, final DataSourceNode node )
{
if ( stack.contains ( node ) )
{
this.logStream.println ( "Loop found: " + StringHelper.join ( stack, " -> " ) );
// loop found
return;
}
stack.push ( node );
for ( final DataSourceNode ref : node.getReferences () )
{
walk ( stack, ref );
}
stack.pop ();
}
示例9: makeDependencies
import org.eclipse.scada.utils.str.StringHelper; //导入依赖的package包/类
private String makeDependencies ( final Set<String> dependencies )
{
final Set<String> result = new HashSet<> ();
if ( needP2 () )
{
result.add ( "org.eclipse.scada.p2" ); //$NON-NLS-1$
}
result.add ( "org.eclipse.scada.deploy.p2-incubation" ); //$NON-NLS-1$
result.addAll ( this.deploy.getAdditionalDependencies () );
final StartupHandler sh = getStartupHandler ();
if ( sh != null )
{
result.addAll ( sh.getAdditionalPackageDependencies () );
}
result.addAll ( dependencies );
return StringHelper.join ( result, ", " ); //$NON-NLS-1$
}
示例10: visit
import org.eclipse.scada.utils.str.StringHelper; //导入依赖的package包/类
@Override
public void visit ( final BlockGroup group ) throws Exception
{
if ( group.getHandlers ().isEmpty () )
{
return;
}
final List<String> masterIds = new ArrayList<> ( group.getHandlers ().size () );
for ( final BlockHandler handler : group.getHandlers () )
{
masterIds.add ( Items.makeMasterId ( handler.getItem () ) );
}
Collections.sort ( masterIds );
final String blockId = Names.makeName ( group );
final Map<String, String> data = new HashMap<String, String> ();
data.put ( "master.id", StringHelper.join ( masterIds, "," ) ); //$NON-NLS-1$ //$NON-NLS-2$
final Map<String, String> infoAttributes = new HashMap<> ();
Configurations.fillAttributesWithHierarchy ( infoAttributes, group.getHierarchy () );
Configurations.applyInfoAttributes ( infoAttributes, data );
addData ( Factories.FACTORY_MASTER_HANDLER_BLOCK, blockId, data );
}
示例11: addAlias
import org.eclipse.scada.utils.str.StringHelper; //导入依赖的package包/类
private void addAlias ( final String id, final String itemId, final String dataSourceId, final EList<IODirection> directions, final String description )
{
final Map<String, String> data = new HashMap<String, String> ();
data.put ( "datasource.id", dataSourceId ); //$NON-NLS-1$
data.put ( "item.id", itemId ); //$NON-NLS-1$
if ( directions != null )
{
final ArrayList<String> dirs = new ArrayList<> ( 2 );
for ( final IODirection dir : directions )
{
dirs.add ( dir.name () );
}
Collections.sort ( dirs ); // always generate the same order
data.put ( "io.directions", StringHelper.join ( dirs, "," ) );
}
if ( description != null )
{
data.put ( "description", description ); //$NON-NLS-1$
}
addData ( Factories.FACTORY_DA_EXPORTER, id, data );
}
示例12: createProxy
import org.eclipse.scada.utils.str.StringHelper; //导入依赖的package包/类
private String createProxy ( final ValueArchive archive, final List<String> sources )
{
final Map<String, String> data = new HashMap<String, String> ();
final String id = Names.makeName ( archive ) + ".proxy";
for ( final String source : sources )
{
if ( source.contains ( "," ) )
{
throw new IllegalArgumentException ( String.format ( "Item name '%s' is invalid. Proxy sources must not contain comma (,) in their name.", source ) );
}
}
Collections.sort ( sources ); // make output reproducible
data.put ( "sources", StringHelper.join ( sources, ", " ) );
addData ( Factories.FACTORY_DA_PROXY_SOURCE, id, data );
return id;
}
示例13: addMarker
import org.eclipse.scada.utils.str.StringHelper; //导入依赖的package包/类
private void addMarker ( final String id, final Collection<Item> items, final Collection<MarkerEntry> entries, final Map<String, String> attributes )
{
final Map<String, String> data = new HashMap<> ();
final int priority = this.priorities.findPriority ( Factories.FACTORY_MASTER_HANDLER_MARKER, id );
data.put ( "handlerPriority", "" + priority );
final Set<String> masterIds = new TreeSet<String> ();
for ( final Item item : items )
{
masterIds.add ( Items.makeMasterId ( item ) );
}
data.put ( "master.id", StringHelper.join ( masterIds, ", " ) ); //$NON-NLS-1$ //$NON-NLS-2$
data.put ( "exportAttribute", "true" ); //$NON-NLS-1$ //$NON-NLS-2$
data.put ( "alwaysExport", "true" ); //$NON-NLS-1$ //$NON-NLS-2$
for ( final MarkerEntry entry : entries )
{
data.put ( "marker." + entry.getName (), entry.getValue () == null ? "" : entry.getValue () ); //$NON-NLS-1$ //$NON-NLS-2$
}
Configurations.applyInfoAttributes ( attributes, data );
addData ( Factories.FACTORY_MASTER_HANDLER_MARKER, id, data );
}
示例14: addJvmOptions
import org.eclipse.scada.utils.str.StringHelper; //导入依赖的package包/类
private void addJvmOptions ( final ILaunchConfigurationWorkingCopy cfg, final Profile profile, final IContainer container ) throws CoreException
{
final List<String> args = new LinkedList<> ();
args.addAll ( profile.getJvmArguments () );
for ( final SystemProperty p : profile.getProperty () )
{
addSystemProperty ( profile, args, p.getKey (), p.getValue (), p.isEval () );
}
for ( final Map.Entry<String, String> entry : getInitialProperties ().entrySet () )
{
addSystemProperty ( profile, args, entry.getKey (), entry.getValue (), false );
}
final IFile dataJson = container.getFile ( new Path ( "data.json" ) ); //$NON-NLS-1$
if ( dataJson.exists () )
{
addJvmArg ( args, "org.eclipse.scada.ca.file.provisionJsonUrl", escapeArgValue ( dataJson.getLocation ().toFile ().toURI ().toString () ) ); //$NON-NLS-1$
}
cfg.setAttribute ( IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, StringHelper.join ( args, "\n" ) );
cfg.setAttribute ( IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, StringHelper.join ( profile.getArguments (), "\n" ) );
}
示例15: setSourceConnectionFromEndpoints
import org.eclipse.scada.utils.str.StringHelper; //导入依赖的package包/类
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 );
}