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

x33g5p2x  于2022-01-16 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(93)

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

Application.name介绍

暂无

代码示例

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

private ApplicationPassivationThread( Application application, PrintStream output, Logger logger )
{
  super( new ApplicationPassivation( application, output, logger ),
      application.name() + " Passivation Thread" );
}

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

private ApplicationPassivationThread( Application application, PrintStream output, Logger logger )
{
  super( new ApplicationPassivation( application, output, logger ),
      application.name() + " Passivation Thread" );
}

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

@Override
public void activateService()
  throws IOException
{
  File tmp;
  if( fileConfig == null )
  {
    tmp = new File( "polygene", app.name() + "-" + app.version() );
  }
  else
  {
    tmp = fileConfig.temporaryDirectory();
  }
  workDir = new File( tmp, "uowfile-" + me.identity().get() );
  if( !workDir.exists() && !workDir.mkdirs() )
  {
    throw new IOException( "Unable to create temporary directory: " + workDir );
  }
}

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

@Override
protected void doGet( HttpServletRequest req, HttpServletResponse resp )
    throws ServletException, IOException
{
  // Output the assembled Application's name as an example
  resp.getWriter().println( application().name() );
}

代码示例来源:origin: org.apache.polygene.extensions/org.apache.polygene.extension.entitystore-preferences

private Preferences getApplicationRoot()
{
  PreferencesEntityStoreInfo storeInfo = descriptor.metaInfo( PreferencesEntityStoreInfo.class );
  Preferences preferences;
  if( storeInfo == null )
  {
    // Default to use system root + application name
    preferences = Preferences.systemRoot();
    String name = application.name();
    preferences = preferences.node( name );
  }
  else
  {
    preferences = storeInfo.rootNode();
  }
  return preferences;
}

代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.fileconfig

String application = System.getProperty( "application", app.name() );

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

private Preferences getApplicationRoot()
{
  PreferencesEntityStoreInfo storeInfo = descriptor.metaInfo( PreferencesEntityStoreInfo.class );
  Preferences preferences;
  if( storeInfo == null )
  {
    // Default to use system root + application name
    preferences = Preferences.systemRoot();
    String name = application.name();
    preferences = preferences.node( name );
  }
  else
  {
    preferences = storeInfo.rootNode();
  }
  return preferences;
}

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

ObjectName serviceName = PolygeneMBeans.findServiceName( server, application.name(), name.toString() );
if ( serviceName != null )

代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.circuitbreaker

ObjectName serviceName = PolygeneMBeans.findServiceName( server, application.name(), name.toString() );
if ( serviceName != null )

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

String application = System.getProperty( "application", app.name() );

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

@Override
  public long timerCount( String timerName )
  {
    return metricRegistry.timer( application.name() + '.' + timerName ).getCount();
  }
};

代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.sql

@Override
public void exportDataSources()
    throws MalformedObjectNameException, MBeanRegistrationException, InstanceAlreadyExistsException, NotCompliantMBeanException
{
  for ( ServiceReference<DataSource> dataSource : dataSources ) {
    ModuleDescriptor module = spi.moduleOf( dataSource );
    EntityDescriptor descriptor = module.entityDescriptor( DataSourceConfiguration.class.getName() );
    List<MBeanAttributeInfo> attributes = new ArrayList<>();
    Map<String, AccessibleObject> properties = new LinkedHashMap<>();
    descriptor.state().properties().forEach(persistentProperty -> {
      if ( !persistentProperty.isImmutable() ) {
        String propertyName = persistentProperty.qualifiedName().name();
        String type = persistentProperty.valueType().primaryType().getName();
        attributes.add( new MBeanAttributeInfo( propertyName, type, propertyName, true, true, type.equals( "java.lang.Boolean" ) ) );
        properties.put( propertyName, persistentProperty.accessor() );
      }
    } );
    List<MBeanOperationInfo> operations = new ArrayList<>();
    operations.add( new MBeanOperationInfo( "restart", "Restart DataSource", new MBeanParameterInfo[ 0 ], "void", MBeanOperationInfo.ACTION_INFO ) );
    String mbeanName = dataSource.identity().toString();
    MBeanInfo mbeanInfo = new MBeanInfo( DataSourceConfiguration.class.getName(), mbeanName, attributes.toArray( new MBeanAttributeInfo[ attributes.size() ] ), null, operations.toArray( new MBeanOperationInfo[ operations.size() ] ), null );
    Object mbean = new ConfigurableDataSource( dataSourceService, mbeanInfo, mbeanName, properties );
    ObjectName configurableDataSourceName = new ObjectName( "Polygene:application=" + application.name() + ",class=Datasource,name=" + mbeanName );
    server.registerMBean( mbean, configurableDataSourceName );
    configurationNames.add( configurableDataSourceName );
  }
}

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

@Override
public void exportDataSources()
    throws MalformedObjectNameException, MBeanRegistrationException, InstanceAlreadyExistsException, NotCompliantMBeanException
{
  for ( ServiceReference<DataSource> dataSource : dataSources ) {
    ModuleDescriptor module = spi.moduleOf( dataSource );
    EntityDescriptor descriptor = module.entityDescriptor( DataSourceConfiguration.class.getName() );
    List<MBeanAttributeInfo> attributes = new ArrayList<>();
    Map<String, AccessibleObject> properties = new LinkedHashMap<>();
    descriptor.state().properties().forEach(persistentProperty -> {
      if ( !persistentProperty.isImmutable() ) {
        String propertyName = persistentProperty.qualifiedName().name();
        String type = persistentProperty.valueType().primaryType().getName();
        attributes.add( new MBeanAttributeInfo( propertyName, type, propertyName, true, true, type.equals( "java.lang.Boolean" ) ) );
        properties.put( propertyName, persistentProperty.accessor() );
      }
    } );
    List<MBeanOperationInfo> operations = new ArrayList<>();
    operations.add( new MBeanOperationInfo( "restart", "Restart DataSource", new MBeanParameterInfo[ 0 ], "void", MBeanOperationInfo.ACTION_INFO ) );
    String mbeanName = dataSource.identity().toString();
    MBeanInfo mbeanInfo = new MBeanInfo( DataSourceConfiguration.class.getName(), mbeanName, attributes.toArray( new MBeanAttributeInfo[ attributes.size() ] ), null, operations.toArray( new MBeanOperationInfo[ operations.size() ] ), null );
    Object mbean = new ConfigurableDataSource( dataSourceService, mbeanInfo, mbeanName, properties );
    ObjectName configurableDataSourceName = new ObjectName( "Polygene:application=" + application.name() + ",class=Datasource,name=" + mbeanName );
    server.registerMBean( mbean, configurableDataSourceName );
    configurationNames.add( configurableDataSourceName );
  }
}

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

@Override
public void run()
{
  try
  {
    application.passivate();
  }
  catch( PassivationException ex )
  {
    String message = application.name() + " " + ex.getMessage();
    if( logger != null )
    {
      logger.log( Level.SEVERE, message, ex );
    }
    else if( output != null )
    {
      output.println( message );
      ex.printStackTrace( output );
    }
    else
    {
      ex.printStackTrace();
    }
  }
}

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

@Override
public void run()
{
  try
  {
    application.passivate();
  }
  catch( PassivationException ex )
  {
    String message = application.name() + " " + ex.getMessage();
    if( logger != null )
    {
      logger.log( Level.SEVERE, message, ex );
    }
    else if( output != null )
    {
      output.println( message );
      ex.printStackTrace( output );
    }
    else
    {
      ex.printStackTrace();
    }
  }
}

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

@Override
public synchronized void start()
  throws Exception
{
  setName( polygeneApplication.name() );
  Series<Parameter> parameters = getContext().getParameters();
  String mode = parameters.getFirstValue( "org.apache.polygene.runtime.mode" );
  super.start();
  getLogger().info( "RestApplication successfully started." );
}

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

@Override
public void activateService() {
  metricRegistry = new MetricRegistry();
  healthCheckRegistry = new HealthCheckRegistry();
  CodahaleMetricsDeclaration declaration = descriptor.metaInfo( CodahaleMetricsDeclaration.class );
  prefix = declaration.prefix() != null ? declaration.prefix() : app.name();
  fqcn = declaration.fqcn();
  if( declaration.jmx() )
  {
    JmxReporter jmxReporter = JmxReporter.forRegistry( metricRegistry ).build();
    jmxReporter.start();
    reporters.add( jmxReporter );
  }
  for( Function<MetricRegistry, Reporter> reporterFactory : declaration.reportersFactories())
  {
    reporters.add( reporterFactory.apply( metricRegistry ) );
  }
}

代码示例来源:origin: org.apache.polygene.libraries/org.apache.polygene.library.jmx

Object mbean = new ConfigurableService( configurableService, mbeanInfo, mbeanName, properties );
ObjectName configurableServiceName;
ObjectName serviceName = PolygeneMBeans.findServiceName( server, application.name(), mbeanName );
if( serviceName != null )

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

@Test
  public void validateThatAssemblerCreatesApplication()
    throws AssemblyException, ActivationException
  {
    TestApplication assembler = new TestApplication( "Test Application", "1.0.1", Application.Mode.test );
    assembler.initialize();
    assembler.start();

    assertThat( assembler.application().name(), equalTo("Test Application") );
    assertThat( assembler.application().version(), equalTo("1.0.1") );
  }
}

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

@Test
public void testBindings() {
  DomainType domain = transientBuilderFactory.newTransient( DomainType.class );
  Object _this = domain.whatIsThis();
  assertThat( _this, instanceOf(DomainType.class));
  assertThat( _this, instanceOf(TransientComposite.class ) );
  StateHolder state = domain.whatIsState( );
  assertThat( state.properties(), notNullValue());
  Application app  = domain.whatIsApplication( );
  assertThat( app.name(), equalTo("Script Test"));
  Layer layer = domain.whatIsLayer();
  assertThat( layer.name(), equalTo("Layer 1"));
  Module module = domain.whatIsModule();
  assertThat( module.name(), equalTo("Module 1"));
  ObjectFactory of = domain.whatIsObjectFactory( );
  assertThat( of, notNullValue());
  UnitOfWorkFactory uowf = domain.whatIsUnitOfWorkFactory( );
  assertThat( uowf, notNullValue());
  ValueBuilderFactory vbf = domain.whatIsValueBuilderFactory( );
  assertThat( vbf, notNullValue());
  TransientBuilderFactory tbf = domain.whatIsTransientBuilderFactory( );
  assertThat( tbf, notNullValue());
  ServiceFinder finder = domain.whatIsServiceFinder( );
  assertThat( finder, notNullValue());
  TypeLookup lookup = domain.whatIsTypeLookup( );
  assertThat( lookup, notNullValue());
}

相关文章