Tabnine Logo
ScopeGenerator.generateStringRep
Code IndexAdd Tabnine to your IDE (free)

How to use
generateStringRep
method
in
org.openbase.jul.extension.rsb.scope.ScopeGenerator

Best Java code snippets using org.openbase.jul.extension.rsb.scope.ScopeGenerator.generateStringRep (Showing top 20 results out of 315)

origin: org.openbase/jul.extension.rsb.com

private String getScopeStringRep() {
  try {
    return ScopeGenerator.generateStringRep(scope);
  } catch (CouldNotPerformException ex) {
    return "?";
  }
}
origin: org.openbase/jul.extension.rsb.com

/**
 * Method prints a class instance representation.
 *
 * @return the class string representation.
 */
@Override
public String toString() {
  try {
    return getClass().getSimpleName() + "[scope:" + ScopeGenerator.generateStringRep(scope) + "]";
  } catch (CouldNotPerformException ex) {
    return getClass().getSimpleName() + "[scope:?]";
  }
}
origin: org.openbase.bco/registry.util

  @Override
  public int compare(UnitConfig o1, UnitConfig o2) {
    try {
      return ScopeGenerator.generateStringRep(o1.getScope()).compareTo(ScopeGenerator.generateStringRep(o2.getScope()));
    } catch (CouldNotPerformException ex) {
      ExceptionPrinter.printHistory("Could not sort scope!", ex, System.err);
      return 0;
    }
  }
});
origin: org.openbase.bco/dal.visual

private void scopeCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_scopeCancelButtonActionPerformed
  try {
    scopeTextField.setText(ScopeGenerator.generateStringRep(unitConfigObservable.getValue().getScope()));
  } catch (CouldNotPerformException | NullPointerException ex) {
    scopeTextField.setText("");
  }
  updateButtonStates();
}//GEN-LAST:event_scopeCancelButtonActionPerformed
origin: org.openbase.bco/dal.visual

public void setUnitRemote(final Scope scope) throws CouldNotPerformException, InterruptedException {
  try {
    logger.info("Setup unit remote: " + ScopeGenerator.generateStringRep(scope));
    RS remote = (RS) Units.getUnitByScope(scope, false);
    setRemoteService(remote);
  } catch (CouldNotPerformException ex) {
    throw new CouldNotPerformException("Could not setup unit remote config!", ex);
  }
}
origin: org.openbase.bco/registry.unit.core

@Override
public void processData(String id, IdentifiableMessage<String, UnitConfig, Builder> entry, ProtoBufMessageMap<String, UnitConfig, Builder> entryMap, ProtoBufRegistry<String, UnitConfig, Builder> registry) throws CouldNotPerformException, EntryModification {
  final UnitConfig.Builder unitConfig = entry.getMessage().toBuilder();
  for (final String alias : unitConfig.getAliasList()) {
    if (!aliasUnitIdMap.containsKey(alias.toLowerCase())) {
      aliasUnitIdMap.put(alias.toLowerCase(), unitConfig.getId());
    } else {
      // if already known check if this unit is owning the alias otherwise throw invalid state
      if (!aliasUnitIdMap.get(alias.toLowerCase()).equals(unitConfig.getId())) {
        throw new RejectedException("Alias[" + alias.toLowerCase() + "] of Unit[" + ScopeGenerator.generateStringRep(unitConfig.getScope()) + ", " + unitConfig.getId() + "] is already used by Unit[" + aliasUnitIdMap.get(alias.toLowerCase()) + "]");
      }
    }
  }
}
origin: org.openbase/jul.extension.rsb.scope

public static String generateStringRep(final Scope scope) throws CouldNotPerformException {
  try {
    if (scope == null) {
      throw new NotAvailableException("scope");
    }
    return generateStringRep(scope.getComponents());
  } catch (CouldNotPerformException ex) {
    throw new CouldNotPerformException("Could not generate scope string representation!", ex);
  }
}
origin: org.openbase/jul.extension.rsb.scope

public static String generateStringRep(final ScopeType.Scope scope) throws CouldNotPerformException {
  try {
    if (scope == null) {
      throw new NotAvailableException("scope");
    }
    return generateStringRep(scope.getComponentList());
  } catch (CouldNotPerformException ex) {
    throw new CouldNotPerformException("Could not generate scope string representation!", ex);
  }
}
origin: org.openbase.bco/registry.unit.lib

@RPCMethod
default public String getUnitScopeById(final String id) throws CouldNotPerformException {
  return ScopeGenerator.generateStringRep(getUnitConfigById(id).getScope());
}
origin: org.openbase.bco/registry.unit.core

  @Override
  public void processData(String id, IdentifiableMessage<String, UnitConfig, UnitConfig.Builder> entry, ProtoBufMessageMap<String, UnitConfig, UnitConfig.Builder> entryMap, ProtoBufRegistry<String, UnitConfig, UnitConfig.Builder> registry) throws CouldNotPerformException, EntryModification {
    UnitConfig locationConfig = entry.getMessage();
    ScopeType.Scope newScope = ScopeGenerator.generateLocationScope(locationConfig, entryMap);

    // verify and update scope
    if (!ScopeGenerator.generateStringRep(locationConfig.getScope()).equals(ScopeGenerator.generateStringRep(newScope))) {
      entry.setMessage(locationConfig.toBuilder().setScope(newScope));
      throw new EntryModification(entry, this);
    }
  }
}
origin: org.openbase.bco/registry.unit.lib

@RPCMethod
default public String getUnitScopeByAlias(final String alias) throws CouldNotPerformException {
  return ScopeGenerator.generateStringRep(getUnitConfigByAlias(alias).getScope());
}
origin: org.openbase.bco/registry.unit.core

@Override
public void processData(String id, IdentifiableMessage<String, UnitConfig, UnitConfig.Builder> entry, ProtoBufMessageMap<String, UnitConfig, UnitConfig.Builder> entryMap, ProtoBufRegistry<String, UnitConfig, UnitConfig.Builder> registry) throws CouldNotPerformException, EntryModification {
  UnitConfig authorizationGroupUnitConfig = entry.getMessage();
  if (!authorizationGroupUnitConfig.hasLabel() || authorizationGroupUnitConfig.getLabel().isEmpty()) {
    throw new NotAvailableException("user.label");
  }
  ScopeType.Scope newScope = ScopeGenerator.generateAuthorizationGroupScope(authorizationGroupUnitConfig);
  // verify and update scope
  if (!ScopeGenerator.generateStringRep(authorizationGroupUnitConfig.getScope()).equals(ScopeGenerator.generateStringRep(newScope))) {
    entry.setMessage(authorizationGroupUnitConfig.toBuilder().setScope(newScope));
    throw new EntryModification(entry, this);
  }
}
origin: org.openbase.bco/registry.unit.core

  @Override
  public void processData(String id, IdentifiableMessage<String, UnitConfig, UnitConfig.Builder> entry, ProtoBufMessageMap<String, UnitConfig, UnitConfig.Builder> entryMap, ProtoBufRegistry<String, UnitConfig, UnitConfig.Builder> registry) throws CouldNotPerformException, EntryModification {
    UnitConfig connectionUnitConfig = entry.getMessage();

    Scope newScope = ScopeGenerator.generateConnectionScope(connectionUnitConfig, locationRegistry.getMessage(connectionUnitConfig.getPlacementConfig().getLocationId()));
    // verify and update scope
    if (!ScopeGenerator.generateStringRep(connectionUnitConfig.getScope()).equals(ScopeGenerator.generateStringRep(newScope))) {
      entry.setMessage(connectionUnitConfig.toBuilder().setScope(newScope));
      throw new EntryModification(entry, this);
    }
  }
}
origin: org.openbase/jul.extension.rsb.scope

public static rsb.Scope transform(final ScopeType.Scope scope) throws CouldNotTransformException {
  try {
    if (scope == null) {
      throw new NotAvailableException("scope");
    }            
    return new Scope(ScopeGenerator.generateStringRep(scope.getComponentList()));
  } catch (Exception ex) {
    throw new CouldNotTransformException(scope, rsb.Scope.class, ex);
  }
}
origin: org.openbase.bco/registry.unit.core

  @Override
  public void processData(String id, IdentifiableMessage<String, UnitConfig, UnitConfig.Builder> entry, ProtoBufMessageMap<String, UnitConfig, UnitConfig.Builder> entryMap, ProtoBufRegistry<String, UnitConfig, UnitConfig.Builder> registry) throws CouldNotPerformException, EntryModification {
    UnitConfig userUnitConfig = entry.getMessage();

    if (!userUnitConfig.getUserConfig().hasUserName() || userUnitConfig.getUserConfig().getUserName().isEmpty()) {
      throw new NotAvailableException("user.userName");
    }

    ScopeType.Scope newScope = ScopeGenerator.generateUserScope(userUnitConfig);

    // verify and update scope
    if (!ScopeGenerator.generateStringRep(userUnitConfig.getScope()).equals(ScopeGenerator.generateStringRep(newScope))) {
      throw new EntryModification(entry.setMessage(userUnitConfig.toBuilder().setScope(newScope)), this);
    }
  }
}
origin: org.openbase.bco/dal.lib

  public static Class<? extends AbstractUnitController> transform(final UnitConfig unitConfig) throws CouldNotTransformException {

    String className = AbstractUnitController.class.getPackage().getName() + "." + StringProcessor.transformUpperCaseToCamelCase(unitConfig.getType().name()) + "Controller";
    try {
      return (Class<? extends AbstractUnitController>) Class.forName(className);
    } catch (ClassNotFoundException ex) {
      try {
        throw new CouldNotTransformException(ScopeGenerator.generateStringRep(unitConfig.getScope()), AbstractUnitController.class, new NotAvailableException("Class", ex));
      } catch (CouldNotPerformException ex1) {
        throw new CouldNotTransformException(unitConfig.getLabel(), AbstractUnitController.class, new NotAvailableException("Class", ex));
      }
    }
  }
}
origin: org.openbase.bco/dal.visual

  @Override
  public Void call() throws Exception {
    try {
      scopeTextField.setForeground(Color.BLACK);
      Scope scope = ScopeTransformer.transform(new rsb.Scope(scopeTextField.getText().toLowerCase()));
      unitConfigObservable.notifyObservers(Registries.getUnitRegistry().getUnitConfigByScope(scope));
      scopeTextField.setText(ScopeGenerator.generateStringRep(unitConfigObservable.getValue().getScope()));
    } catch (CouldNotPerformException ex) {
      scopeTextField.setForeground(Color.RED);
      statusPanel.setError(ExceptionPrinter.printHistoryAndReturnThrowable(ex, logger));
    }
    return null;
  }
}));
origin: org.openbase.bco/registry.unit.remote

@Override
public UnitConfig getUnitConfigByScope(ScopeType.Scope scope) throws CouldNotPerformException {
  if (scope == null) {
    throw new NotAvailableException("scope");
  }
  validateData();
  for (UnitConfig unitConfig : getUnitConfigs()) {
    if (unitConfig.getScope().equals(scope)) {
      return unitConfig;
    }
  }
  throw new NotAvailableException("No unit config available for given Scope[" + ScopeGenerator.generateStringRep(scope) + "]!");
}
origin: org.openbase.bco/registry.util

public static void printUnit(final UnitConfig unitConfig, final int maxAliasLength, final int maxUnitLabelLength, final int maxLocationUnitLabelLength, final int maxScopeLength) throws InterruptedException, CouldNotPerformException {
  System.out.println(unitConfig.getId()
      + "  "
      + "[ " + StringProcessor.fillWithSpaces(generateStringRep(unitConfig.getAliasList()), maxAliasLength) + " ]"
      + "  "
      + StringProcessor.fillWithSpaces(unitConfig.getLabel(), maxUnitLabelLength, StringProcessor.Alignment.RIGHT)
      + " @ " + StringProcessor.fillWithSpaces(getLocationLabel(unitConfig), maxLocationUnitLabelLength)
      + "  "
      + "[ " + StringProcessor.fillWithSpaces(ScopeGenerator.generateStringRep(unitConfig.getScope()), maxScopeLength) + " ]"
  );
}
origin: org.openbase.bco/dal.remote

private void verifyUnitConfig(final UnitConfig unitConfig) throws VerificationFailedException {
  if (!unitConfig.getEnablingState().getValue().equals(EnablingStateType.EnablingState.State.ENABLED)) {
    try {
      throw new VerificationFailedException("Referred Unit[" + ScopeGenerator.generateStringRep(unitConfig.getScope()) + "] is disabled!");
    } catch (CouldNotPerformException ex) {
      ExceptionPrinter.printHistory(ex, LOGGER, LogLevel.WARN);
      throw new VerificationFailedException("Referred Unit[" + unitConfig.getLabel() + "] is disabled!");
    }
  }
}
org.openbase.jul.extension.rsb.scopeScopeGeneratorgenerateStringRep

Popular methods of ScopeGenerator

  • generateStringRepWithDelimiter
  • generateScope
  • convertIntoValidScopeComponent
  • generateAgentScope
  • generateAppScope
  • generateAuthorizationGroupScope
  • generateConnectionScope
  • generateDeviceScope
  • generateLocationScope
  • generateSceneScope
  • generateUnitGroupScope
  • generateUnitScope
  • generateUnitGroupScope,
  • generateUnitScope,
  • generateUserScope

Popular in Java

  • Reactive rest calls using spring rest template
  • setContentView (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • startActivity (Activity)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now