本文整理汇总了Java中javax.enterprise.inject.New类的典型用法代码示例。如果您正苦于以下问题:Java New类的具体用法?Java New怎么用?Java New使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
New类属于javax.enterprise.inject包,在下文中一共展示了New类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces
@Singleton
public CuratorFramework create(@ServiceName("ZOOKEEPER") String url, @New CuratorConfig config) throws IOException, InterruptedException {
LOG.info("Connecting to ZooKeeper URL: {}", url);
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder()
.connectString(url)
.connectionTimeoutMs(config.getConnectionTimeOut())
.sessionTimeoutMs(config.getSessionTimeout())
.retryPolicy(new RetryNTimes(config.getRetryMax(), config.getRetryInterval()));
if (!Strings.isNullOrBlank(config.getPassword())) {
byte[] auth = (DEFAULT_AUTH_USER + ":" + PasswordEncoder.decode(config.getPassword())).getBytes();
builder = builder.authorization(DEFAULT_AUTH_SCHEME, auth);
}
CuratorFramework curatorFramework = builder.build();
curatorFramework.start();
return curatorFramework;
}
示例2: provideStorage
import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces
@ApplicationScoped
public static IStorage provideStorage(ManagerApiMicroServiceConfig config, @New JpaStorage jpaStorage,
@New EsStorage esStorage, IPluginRegistry pluginRegistry) {
IStorage storage;
if ("jpa".equals(config.getStorageType())) { //$NON-NLS-1$
storage = initJpaStorage(config, jpaStorage);
} else if ("es".equals(config.getStorageType())) { //$NON-NLS-1$
storage = initES(config, esStorage);
} else {
try {
storage = createCustomComponent(IStorage.class, config.getStorageType(),
config.getStorageProperties(), pluginRegistry);
} catch (Throwable t) {
throw new RuntimeException("Error or unknown storage type: " + config.getStorageType(), t); //$NON-NLS-1$
}
}
return storage;
}
示例3: provideStorageQuery
import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces @ApplicationScoped
public static IStorageQuery provideStorageQuery(ManagerApiMicroServiceConfig config, @New JpaStorage jpaStorage,
@New EsStorage esStorage, IPluginRegistry pluginRegistry) {
if ("jpa".equals(config.getStorageQueryType())) { //$NON-NLS-1$
return initJpaStorage(config, jpaStorage);
} else if ("es".equals(config.getStorageQueryType())) { //$NON-NLS-1$
return initES(config, esStorage);
} else {
try {
return createCustomComponent(IStorageQuery.class, config.getStorageQueryType(),
config.getStorageQueryProperties(), pluginRegistry);
} catch (Throwable t) {
throw new RuntimeException("Error or unknown storage query type: " + config.getStorageType(), t); //$NON-NLS-1$
}
}
}
示例4: provideMetricsAccessor
import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces @ApplicationScoped
public static IMetricsAccessor provideMetricsAccessor(ManagerApiMicroServiceConfig config,
@New NoOpMetricsAccessor noopMetrics, @New ESMetricsAccessor esMetrics, IPluginRegistry pluginRegistry) {
IMetricsAccessor metrics;
if ("es".equals(config.getMetricsType())) { //$NON-NLS-1$
metrics = esMetrics;
} else {
try {
metrics = createCustomComponent(IMetricsAccessor.class, config.getMetricsType(),
config.getMetricsProperties(), pluginRegistry);
} catch (Throwable t) {
System.err.println("Unknown apiman metrics accessor type: " + config.getMetricsType()); //$NON-NLS-1$
metrics = noopMetrics;
}
}
return metrics;
}
示例5: provideApiKeyGenerator
import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces @ApplicationScoped
public static IApiKeyGenerator provideApiKeyGenerator(ManagerApiMicroServiceConfig config,
IPluginRegistry pluginRegistry, @New UuidApiKeyGenerator uuidApiKeyGen) {
IApiKeyGenerator apiKeyGenerator;
String type = config.getApiKeyGeneratorType();
if ("uuid".equals(type)) { //$NON-NLS-1$
apiKeyGenerator = uuidApiKeyGen;
} else {
try {
apiKeyGenerator = createCustomComponent(IApiKeyGenerator.class, type,
config.getApiKeyGeneratorProperties(), pluginRegistry);
} catch (Exception e) {
System.err.println("Unknown apiman API key generator type: " + type); //$NON-NLS-1$
System.err.println("Automatically falling back to UUID style API Keys."); //$NON-NLS-1$
apiKeyGenerator = uuidApiKeyGen;
}
}
return apiKeyGenerator;
}
示例6: provideStorage
import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces @ApplicationScoped
public static IStorage provideStorage(WarApiManagerConfig config, @New JpaStorage jpaStorage,
@New EsStorage esStorage, IPluginRegistry pluginRegistry) {
IStorage storage;
if ("jpa".equals(config.getStorageType())) { //$NON-NLS-1$
storage = initJpaStorage(config, jpaStorage);
} else if ("es".equals(config.getStorageType())) { //$NON-NLS-1$
storage = initEsStorage(config, esStorage);
} else {
try {
storage = createCustomComponent(IStorage.class, config.getStorageType(),
config.getStorageProperties(), pluginRegistry);
} catch (Throwable t) {
throw new RuntimeException("Error or unknown storage type: " + config.getStorageType(), t); //$NON-NLS-1$
}
}
return storage;
}
示例7: provideStorageQuery
import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces @ApplicationScoped
public static IStorageQuery provideStorageQuery(WarApiManagerConfig config, @New JpaStorage jpaStorage,
@New EsStorage esStorage, IStorage storage, IPluginRegistry pluginRegistry) {
if ("jpa".equals(config.getStorageType())) { //$NON-NLS-1$
return initJpaStorage(config, jpaStorage);
} else if ("es".equals(config.getStorageType())) { //$NON-NLS-1$
return initEsStorage(config, esStorage);
} else if (storage != null && storage instanceof IStorageQuery) {
return (IStorageQuery) storage;
} else {
try {
return createCustomComponent(IStorageQuery.class, config.getStorageQueryType(),
config.getStorageQueryProperties(), pluginRegistry);
} catch (Throwable t) {
throw new RuntimeException("Error or unknown storage query type: " + config.getStorageType(), t); //$NON-NLS-1$
}
}
}
示例8: provideMetricsAccessor
import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces @ApplicationScoped
public static IMetricsAccessor provideMetricsAccessor(WarApiManagerConfig config,
@New NoOpMetricsAccessor noopMetrics, @New ESMetricsAccessor esMetrics, IPluginRegistry pluginRegistry) {
IMetricsAccessor metrics;
if ("es".equals(config.getMetricsType())) { //$NON-NLS-1$
metrics = esMetrics;
} else if (config.getMetricsType().equals(ESMetricsAccessor.class.getName())) {
metrics = esMetrics;
} else if ("noop".equals(config.getMetricsType())) { //$NON-NLS-1$
metrics = noopMetrics;
} else if (config.getMetricsType().equals(NoOpMetricsAccessor.class.getName())) {
metrics = noopMetrics;
} else {
try {
metrics = createCustomComponent(IMetricsAccessor.class, config.getMetricsType(),
config.getMetricsProperties(), pluginRegistry);
} catch (Throwable t) {
System.err.println("Unknown apiman metrics accessor type: " + config.getMetricsType()); //$NON-NLS-1$
metrics = noopMetrics;
}
}
return metrics;
}
示例9: provideApiKeyGenerator
import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces @ApplicationScoped
public static IApiKeyGenerator provideApiKeyGenerator(WarApiManagerConfig config,
@New UuidApiKeyGenerator uuidApiKeyGen, IPluginRegistry pluginRegistry) {
IApiKeyGenerator apiKeyGenerator;
String type = config.getApiKeyGeneratorType();
if ("uuid".equals(type)) { //$NON-NLS-1$
apiKeyGenerator = uuidApiKeyGen;
} else {
try {
apiKeyGenerator = createCustomComponent(IApiKeyGenerator.class, type,
config.getApiKeyGeneratorProperties(), pluginRegistry);
} catch (Exception e) {
System.err.println("Unknown apiman API key generator type: " + type); //$NON-NLS-1$
System.err.println("Automatically falling back to UUID style API Keys."); //$NON-NLS-1$
apiKeyGenerator = uuidApiKeyGen;
}
}
return apiKeyGenerator;
}
示例10: produceDaoWithIntegerId
import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces
@Dependent
@DAO
@SuppressWarnings("unchecked")
public <T> IDAO<T> produceDaoWithIntegerId(@TransientReference InjectionPoint ip,
@TransientReference BeanManager bm,
@New @TransientReference IDAOFactory f) {
return buildDaoWithOneGenericType(ip, bm, (IDAOFactory<T>) f);
}
示例11: produceDaoWithLongId
import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces
@Dependent
@DAO
@SuppressWarnings("unchecked")
public <T> LDAO<T> produceDaoWithLongId(@TransientReference InjectionPoint ip,
@TransientReference BeanManager bm,
@New @TransientReference LDAOFactory f) {
return buildDaoWithOneGenericType(ip, bm, (LDAOFactory<T>) f);
}
示例12: produceUnqualifiedDaoWithIntegerId
import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces
@Dependent
@Default
@SuppressWarnings("unchecked")
public <T> IDAO<T> produceUnqualifiedDaoWithIntegerId(@TransientReference InjectionPoint ip,
@TransientReference BeanManager bm,
@New @TransientReference IDAOFactory f) {
return buildDaoWithOneGenericType(ip, bm, (IDAOFactory<T>) f);
}
示例13: produceUnqualifiedDaoWithLongId
import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces
@Dependent
@Default
@SuppressWarnings("unchecked")
public <T> LDAO<T> produceUnqualifiedDaoWithLongId(@TransientReference InjectionPoint ip,
@TransientReference BeanManager bm,
@New @TransientReference LDAOFactory f) {
return buildDaoWithOneGenericType(ip, bm, (LDAOFactory<T>) f);
}
示例14: produceDaoWithoutId
import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces
@Dependent
@DAO
@SuppressWarnings("unchecked")
public <T> DaoWithoutId<T> produceDaoWithoutId(@TransientReference InjectionPoint ip,
@TransientReference BeanManager bm,
@New @TransientReference DAOFactory f) {
return buildDaoWithOneGenericType(ip, bm, (DAOFactory<T>) f);
}
示例15: produceUnqualifiedDaoWithoutId
import javax.enterprise.inject.New; //导入依赖的package包/类
@Produces
@Dependent
@Default
@SuppressWarnings("unchecked")
public <T> DaoWithoutId<T> produceUnqualifiedDaoWithoutId(@TransientReference InjectionPoint ip,
@TransientReference BeanManager bm,
@New @TransientReference DAOFactory f) {
return buildDaoWithOneGenericType(ip, bm, (DAOFactory<T>) f);
}