org.apache.polygene.api.structure.Module.serviceFinder()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中org.apache.polygene.api.structure.Module.serviceFinder()方法的一些代码示例,展示了Module.serviceFinder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Module.serviceFinder()方法的具体详情如下:
包路径:org.apache.polygene.api.structure.Module
类名称:Module
方法名:serviceFinder

Module.serviceFinder介绍

[英]Returns the ServiceFinder for this Module.
[中]返回此模块的ServiceFinder。

代码示例

代码示例来源:origin: apache/attic-polygene-java

protected ServiceFinder serviceFinder()
{
  return moduleInstance.serviceFinder();
}

代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.bootstrap

protected ServiceFinder serviceFinder()
{
  return moduleInstance.serviceFinder();
}

代码示例来源:origin: apache/attic-polygene-java

public ScriptMixin( @Structure PolygeneSPI spi,
          @This Object thisComposite,
          @State StateHolder state,
          @Structure Layer layer,
          @Structure Module module,
          @Structure Application application )
{
  descriptor = spi.compositeDescriptorFor( thisComposite );
  engine = createNewEngine();
  Bindings mixinBindings = engine.getBindings( ScriptContext.ENGINE_SCOPE );
  mixinBindings.put( "Polygene", spi );
  mixinBindings.put( "application", application );
  mixinBindings.put( "layer", layer );
  mixinBindings.put( "module", module );
  mixinBindings.put( "This", thisComposite );
  mixinBindings.put( "state", state );
  mixinBindings.put( "objectFactory", module.objectFactory() );
  mixinBindings.put( "unitOfWorkFactory", module.unitOfWorkFactory() );
  mixinBindings.put( "valueBuilderFactory", module.valueBuilderFactory() );
  mixinBindings.put( "transientBuilderFactory", module.transientBuilderFactory() );
  mixinBindings.put( "serviceFinder", module.serviceFinder() );
  mixinBindings.put( "typeLookup", module.typeLookup() );
}

代码示例来源:origin: apache/attic-polygene-java

private Client findClient( Module module )
  {
    Client client = module.serviceFinder().findService( ElasticSearchSupport.class ).get().client();
    if( client == null )
    {
      throw new IllegalStateException( "Embedded Elasticsearch Rule - Failed to find client" );
    }
    return client;
  }
}

代码示例来源:origin: apache/attic-polygene-java

if( value instanceof String && !propertyType.equals( String.class ) )
  ServiceFinder serviceFinder = module.instance().serviceFinder();
  Deserializer deserializer = serviceFinder.findService( Deserializer.class ).get();
  if( deserializer != null )

代码示例来源:origin: apache/attic-polygene-java

@Override
  public void tearDown()
    throws Exception
  {
    Module storageModule = application.findModule( "Infrastructure Layer", "Storage Module" );
    UnitOfWorkFactory uowf = storageModule.unitOfWorkFactory();
    ServiceFinder serviceFinder = storageModule.serviceFinder();
    UnitOfWork uow = uowf.newUnitOfWork(
      UsecaseBuilder.newUsecase( "Delete " + getClass().getSimpleName() + " test data" )
                      );
    try
    {
      SQLConfiguration config = uow.get( SQLConfiguration.class, DEFAULT_ENTITYSTORE_IDENTITY );
      Connection connection = serviceFinder.findService( DataSource.class ).get().getConnection();
      connection.setAutoCommit( false );
      String schemaName = config.schemaName().get();
      try( Statement stmt = connection.createStatement() )
      {
        stmt.execute( String.format( "DROP SCHEMA \"%s\" CASCADE", schemaName ) );
        connection.commit();
      }
    }
    finally
    {
      uow.discard();
      super.tearDown();
    }
  }
}

代码示例来源:origin: apache/attic-polygene-java

@Override
  public void tearDown()
    throws Exception
  {
    Module storageModule = application.findModule( "Infrastructure Layer","Storage Module" );
    UnitOfWorkFactory uowf = storageModule.unitOfWorkFactory();
    UnitOfWork uow = uowf.newUnitOfWork( UsecaseBuilder.newUsecase(
      "Delete " + getClass().getSimpleName() + " test data" ) );
    try
    {
      SQLEntityStoreConfiguration config = uow.get( SQLEntityStoreConfiguration.class,
                             DEFAULT_ENTITYSTORE_IDENTITY );
      Connection connection = storageModule.serviceFinder().findService( DataSource.class ).get().getConnection();
      connection.setAutoCommit( false );
      try( Statement stmt = connection.createStatement() )
      {
        stmt.execute( String.format( "DELETE FROM %s.%s",
                       config.schemaName().get(),
                       config.entityTableName().get() ) );
        connection.commit();
      }
    }
    finally
    {
      uow.discard();
      super.tearDown();
    }
  }
}

代码示例来源:origin: apache/attic-polygene-java

ServiceFinder serviceFinder = storageModule.serviceFinder();
UnitOfWork uow = uowf.newUnitOfWork(
  UsecaseBuilder.newUsecase( "Delete " + getClass().getSimpleName() + " test data" )

代码示例来源:origin: apache/attic-polygene-java

@Override
  public void tearDown()
    throws Exception
  {
    Module module = application.findModule( "Infrastructure Layer", "Storage Module" );
    ServiceReference<CanRemoveAll> cleaner = module.serviceFinder().findService( CanRemoveAll.class );
    if( cleaner.isActive() && cleaner.isAvailable() )
    {
      cleaner.get().removeAll();
    }
    else
    {
      throw new IllegalStateException( "Clean up operation of Cassandra database was not availeble." );
    }
    super.tearDown();
  }
}

代码示例来源:origin: apache/attic-polygene-java

@Override
public void setUp()
  throws Exception
{
  super.setUp();
  Module storageModule = application.findModule( "Infrastructure Layer", "Storage Module" );
  MongoDBEntityStoreService es = storageModule.serviceFinder().findService( MongoDBEntityStoreService.class ).get();
  mongo = es.mongoInstanceUsed();
  dbName = es.dbInstanceUsed().getName();
}

相关文章