congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
ApplicationContext.getService
Code IndexAdd Tabnine to your IDE (free)

How to use
getService
method
in
com.b2international.snowowl.core.ApplicationContext

Best Java code snippets using com.b2international.snowowl.core.ApplicationContext.getService (Showing top 20 results out of 315)

origin: com.b2international.snowowl/com.b2international.snowowl.core

/**
 * Returns with the service instance associated with the passed in service interface.
 * May throw runtime exception if the service associated with the passed in interface is not registered or {@code null}.  
 * @param serviceInterface the interface of the required service. Should not be {@code null}.
 * @return the available registered service instance.
 * @param <T> type of the service.
 */
public <T> T getServiceChecked(final Class<T> serviceInterface) {
  Preconditions.checkNotNull(serviceInterface, "Service interface argument cannot be null.");
  final T service = getService(serviceInterface);
  Preconditions.checkNotNull(service, "Service for " + serviceInterface.getSimpleName() + " service cannot be null.");
  return service;
}

origin: com.b2international.snowowl/com.b2international.snowowl.datastore.server

  @Override
  public <T> T getServiceImplementation(final Class<T> serviceInterface) {
    return ApplicationContext.getInstance().getService(serviceInterface);
  }
}
origin: com.b2international.snowowl/com.b2international.snowowl.datastore.server

  private ICDORepositoryManager getRepositoryManager() {
    return ApplicationContext.getInstance().getService(ICDORepositoryManager.class);
  }
}
origin: com.b2international.snowowl/com.b2international.snowowl.snomed.api.impl

private IEventBus getEventBus() {
  return ApplicationContext.getInstance().getService(IEventBus.class);
}

origin: com.b2international.snowowl/com.b2international.snowowl.datastore.server

  private ICDOConnectionManager getConnectionManager() {
    return ApplicationContext.getInstance().getService(ICDOConnectionManager.class);
  }
}
origin: com.b2international.snowowl/com.b2international.snowowl.core

/**Returns with the service registered for the class argument key from the shared application context.*/
public static <T> T getServiceForClass(final Class<T> clazz) {
  return getInstance().getService(clazz);
}

origin: com.b2international.snowowl/com.b2international.snowowl.core

protected <T> T getService(Class<T> type) {
  return checkNotNull(ApplicationContext.getInstance().getService(type), "%s service should not be null. Use @Provides instead of direct member injection", type.getSimpleName());
}

origin: com.b2international.snowowl/com.b2international.snowowl.datastore.server

public SnowowlSessionManager() {
  this(ApplicationContext.getInstance().getService(IApplicationSessionManager.class));
}
origin: com.b2international.snowowl/com.b2international.snowowl.datastore.server

private static ICDOConnectionManager getConnectionManager() {
  return ApplicationContext.getInstance().getService(ICDOConnectionManager.class);
}
origin: com.b2international.snowowl/com.b2international.snowowl.datastore.server

public VersionProcessor() {
  this(ApplicationContext.getInstance().getService(PreferencesService.class));
}
origin: com.b2international.snowowl/com.b2international.snowowl.datastore.server

protected IEventBus getEventBus() {
  return ApplicationContext.getInstance().getService(IEventBus.class);
}
origin: com.b2international.snowowl/com.b2international.snowowl.datastore.server

private static ICDOConnectionManager getConnectionManager() {
  return ApplicationContext.getInstance().getService(ICDOConnectionManager.class);
}
origin: com.b2international.snowowl/com.b2international.snowowl.datastore.server

private static ICDORepository getRepository(final String nsUri) {
  Preconditions.checkNotNull(nsUri, "Namespace URI argument cannot be null.");
  final ICDORepositoryManager repositoryManager = ApplicationContext.getInstance().getService(ICDORepositoryManager.class);
  return repositoryManager.get(nsUri);
  
}        

origin: com.b2international.snowowl/com.b2international.snowowl.snomed.api.impl

private List<ExtendedLocale> getLocales() {
  return ApplicationContext.getInstance().getService(LanguageSetting.class).getLanguagePreference();
}
origin: com.b2international.snowowl/com.b2international.snowowl.datastore.server

/**
 * Calculates the CDO change set between two branch points in all repositories. 
 * @param sourceBranchPath the source branch path. 
 * @param sourceTimestamp the source timestamp.
 * @param targetBranchPath the target branch path.
 * @param targetTimestamp the target timestamp.
 * @return a map of change set data where the keys are the repository unique IDs and the values are the actual change set.
 */
public Map<String, CDOChangeSetData> getChangeSetData(final IBranchPath sourceBranchPath, final long sourceTimestamp, final IBranchPath targetBranchPath, final long targetTimestamp) {
  
  final ICDOConnectionManager manager = ApplicationContext.getInstance().getService(ICDOConnectionManager.class);
  final Iterable<Pair<String, CDOChangeSetData>> itr = 
      Iterables.transform(manager, new GetChangeSetDataFunction(sourceBranchPath, sourceTimestamp, targetBranchPath, targetTimestamp));
    
  final Map<String, CDOChangeSetData> $ = Maps.newHashMap();
  
  for (final Pair<String, CDOChangeSetData> pair : itr) {
    
    $.put(pair.getA(), pair.getB());
    
  }
  
  return Collections.unmodifiableMap($);
  
}

origin: com.b2international.snowowl/com.b2international.snowowl.datastore.server

public DelegateCDOServerChangeManager(final ICDOCommitChangeSet commitChangeSet, final Collection<CDOChangeProcessorFactory> factories, final boolean copySession, boolean isCommitNotificationEnabled) {
  this.isCommitNotificationEnabled = isCommitNotificationEnabled;
  this.commitChangeSet = Preconditions.checkNotNull(commitChangeSet, "Commit change set data argument cannot be null.");
  final CDOView view = commitChangeSet.getView();
  this.repositoryUuid = ApplicationContext.getInstance().getService(ICDOConnectionManager.class).get(view).getUuid();
  this.branchPath = BranchPathUtils.createPath(view);
  this.factories = Preconditions.checkNotNull(factories, "CDO change processor factories argument cannot be null.");
}

origin: com.b2international.snowowl/com.b2international.snowowl.datastore.server

/**
 * Returns with the {@link EClass} of an object identified by its unique {@link CDOID}. May return with {@code null}.
 * @param branchPath the branch path.
 * @param cdoId the unique CDO ID.
 * @return the {@link EClass} of an object.
 */
@Nullable public EClass getEClass(final IBranchPath branchPath, final long storageKey) {
  Preconditions.checkNotNull(branchPath, "Branch path argument cannot be null.");
  
  final ICDOConnection connection = ApplicationContext.getInstance().getService(ICDOConnectionManager.class).get(storageKey);
  final String repositoryUuid = connection.getUuid();
  
  for (final IEClassProvider provider : getProviders().get(repositoryUuid)) {
    
    final EClass eClass = provider.getEClass(branchPath, storageKey);
    
    if (null != eClass) {
      return eClass;
    }
    
  }
  
  return null;
} 
origin: com.b2international.snowowl/com.b2international.snowowl.datastore.server

private Multimap<String, CDORemoteSession> getRemoteSessions() {
    
  LifecycleUtil.checkActive(this);
  
  final HashMultimap<String, CDORemoteSession> $ = HashMultimap.create();
  
  for (final ICDORepository repository : this) {
  
    final String uuid = repository.getUuid();
    
    final ICDOConnection connection = ApplicationContext.getInstance().getService(ICDOConnectionManager.class).getByUuid(uuid);
    final CDORemoteSessionManager remoteSessionManager = connection.getSession().getRemoteSessionManager();
    
    for (final CDORemoteSession session : remoteSessionManager.getElements()) {
      
      $.put(session.getUserID(), session);
      
    }
    
  }
  
  return Multimaps.unmodifiableMultimap($);
  
}

origin: com.b2international.snowowl/com.b2international.snowowl.datastore.server

public static Connection createConnection(final EPackage ePackage, final RepositoryConfiguration configuration) {
  
  Preconditions.checkNotNull(ePackage, "EClass argument cannot be null.");
  
  final String driverName = configuration.getDatabaseConfiguration().getDriverClass();
  final JdbcUrl jdbcUrl = configuration.getDatabaseUrl();
  final String username = configuration.getDatabaseConfiguration().getUsername();
  final String password = configuration.getDatabaseConfiguration().getPassword();
  
  final ICDORepositoryManager repositoryManager = ApplicationContext.getInstance().getService(ICDORepositoryManager.class);
  final String repositoryUuid = repositoryManager.get(ePackage).getUuid();
  
  final String localDbUrl = jdbcUrl.build(repositoryUuid);
  
  return JdbcUtils.createConnection(driverName, localDbUrl, username, password);
}

origin: com.b2international.snowowl/com.b2international.snowowl.datastore.server

public static long getClassMetaID(final EClass eClass) {
  
  final ICDORepositoryManager repositoryManager = ApplicationContext.getInstance().getService(ICDORepositoryManager.class);
  final ICDORepository cdoRepository = repositoryManager.get(eClass);
  final IDBStore dbStore = cdoRepository.getDbStore();		
  final IRepository repository = cdoRepository.getRepository();
  
  final ISession session = repository.getSessionManager().getSessions()[0];
  StoreThreadLocal.setSession((InternalSession) session);
  final long lastCommitTime = dbStore.getLastCommitTime();
  return CDOIDUtil.getLong(dbStore.getMetaDataManager().getMetaID(eClass, lastCommitTime));
}

com.b2international.snowowl.coreApplicationContextgetService

Javadoc

Returns with the service instance associated with the passed in service interface. May throw runtime exception if the service associated with the passed in interface is not registered or null.

Popular methods of ApplicationContext

  • getInstance
    Factory method.
  • getServiceForClass
    Returns with the service registered for the class argument key from the shared application context.
  • getServiceChecked
    Returns with the service instance associated with the passed in service interface. May throw runtime
  • registerService
  • isServerMode
    Returns true if the application for the current application context is running in server mode. Other
  • <init>
  • addServiceListener
  • checkStrictServices
    Checks the availability of the registered services strictly, which means that null implementations
  • dispose
  • exists
    Returns true if a the service given with it interface is registered to the application context with
  • getServiceEntry
  • getServiceInfo
    Initializes the project specific MultiStatus object for generic serviceablility support for the plug
  • getServiceEntry,
  • getServiceInfo

Popular in Java

  • Start an intent from android
  • requestLocationUpdates (LocationManager)
  • getExternalFilesDir (Context)
  • onRequestPermissionsResult (Fragment)
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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