protected static Environment createEnvironment(final String name) { final Validator validator = Validation .byProvider(HibernateValidator.class) .configure() .addValidatedValueHandler(new OptionalValidatedValueUnwrapper()) .buildValidatorFactory() .getValidator(); return new Environment(name, Jackson.newObjectMapper(), validator, new MetricRegistry(), Thread.currentThread().getContextClassLoader()); }
@Override protected void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws Exception { final Environment environment = new Environment(bootstrap.getApplication().getName(), bootstrap.getObjectMapper(), bootstrap.getValidatorFactory(), bootstrap.getMetricRegistry(), bootstrap.getClassLoader(), bootstrap.getHealthCheckRegistry()); configuration.getMetricsFactory().configure(environment.lifecycle(), bootstrap.getMetricRegistry()); configuration.getServerFactory().configure(environment); bootstrap.run(configuration, environment); application.run(configuration, environment); run(environment, namespace, configuration); }
while(resultSet.next()) { int iC = 0; environment = new Environment(); environment.setAppName(resultSet.getString( iC++ )); environment.setHostName(resultSet.getString( iC++ )); environment.setSoftwareComponent(resultSet.getString( iC++ )); environment.setVersion(resultSet.getString( iC++ )); environment.setInstallPath(resultSet.getString( iC++ )); environment.setRemarks(resultSet.getString( iC++ )); environment.setEnvironmental(resultSet.getString( iC++ )); environments.add(environment); }
var Environment = gameName.environment; var A = new Environment();
new Environment().getClass().getGenericSuperclass()
@Override protected void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws Exception { final Environment environment = new Environment(bootstrap.getApplication().getName(), bootstrap.getObjectMapper(), bootstrap.getValidatorFactory().getValidator(), bootstrap.getMetricRegistry(), bootstrap.getClassLoader(), bootstrap.getHealthCheckRegistry()); configuration.getMetricsFactory().configure(environment.lifecycle(), bootstrap.getMetricRegistry()); configuration.getServerFactory().configure(environment); bootstrap.run(configuration, environment); application.run(configuration, environment); run(environment, namespace, configuration); }
Environment env = new Environment(new ClassResourceLocator(ClassUtils.getDefaultClassLoader()), System.getProperty("env"));
public class FetchConfig { Environment environment; public FetchConfig() { environment = new Environment(null); } public void buildConfig() { environment.setenvName("Steve"); }
public static Environment fabricateEnvironment(String name, Configuration configuration) { return new Environment(name, Jackson.newObjectMapper(), Validation.buildDefaultValidatorFactory().getValidator(), new MetricRegistry(),ClassLoader.getSystemClassLoader()); }
public class MyPropertySources implements PropertySources{ private List<PropertySource<?>> sources = new ArrayList<>(); public EnvironmentPropertySources() { Environment env = new Environment(new ClassResourceLocator(ClassUtils.getDefaultClassLoader()), System.getProperty("env")); PropertySource<?> source = ...; // create class that extends PropertySource<String> and get property values from Environment sources.add(source); } @Override public Iterator<PropertySource<?>> iterator() { return sources.iterator(); } @Override public boolean contains(String name) { return true; } @Override public PropertySource<?> get(String name) { return sources.get(0); } }
Environment env = new Environment(); env.interact();
Environment en = new Environment(); en.setvalue1("s1"); en.setValue2("s2"); e.add(en);
protected static Environment createEnvironment(final String name) { final Validator validator = Validation .byProvider(HibernateValidator.class) .configure() .addValidatedValueHandler(new OptionalValidatedValueUnwrapper()) .buildValidatorFactory() .getValidator(); return new Environment(name, Jackson.newObjectMapper(), validator, new MetricRegistry(), Thread.currentThread().getContextClassLoader()); }
List<ApplicationWithEnvironments > AppWithEnvlist = new ArrayList<ApplicationWithEnvironments >(); for(ApplicationDTO d: allApplication) { ApplicationWithEnvironments appWithEnv = new ApplicationWithEnvironments(); Application a = new Application(); a.set... appWithEnv.setApplication(a); for(EnvironmentDTO en: d.getEnvironment()) { Environment e = new Environment(); e.set... appWithEnv.addEnvironment(e); } AppWithEnvList.add(appWithEnv); } ArrayList<MyModel> obj= new ArrayList<MyModel>(); MyModel mm = new MyModel(); mm.setAppWithEnvList(AppWithEnvList); obj.add(mm); return obj;
public static void main(String args[]) { Environment clips; clips = new Environment(); clips.build("(deffacts happyFacts " + " (happy Peter)" + " (happy Alex)" + " (happy Mary))"); clips.reset(); clips.eval("(facts)"); MultifieldValue mv = (MultifieldValue) clips.eval("(find-all-facts ((?f happy)) TRUE)"); FactAddressValue fact = (FactAddressValue) mv.multifieldValue().get(0); try { System.out.println("Slot value is " + fact.getFactSlot(null)); } catch (Exception e) { e.printStackTrace(); } }
Environment env = new Environment(); env.setInitialContextFactory(Environment.DEFAULT_INITIAL_CONTEXT_FACTORY); // env.setSecurityPrincipal("user"); // env.setSecurityCredentials("pass"); env.setProviderUrl("t3s://localhost:7002"); InputStream key = new PEMInputStream(new FileInputStream(CERT_KEYFILE)); InputStream cert = new PEMInputStream(new FileInputStream(CERT_CERTFILE)); env.setSSLClientCertificate(new InputStream[] {key, cert}); env.setSSLClientKeyPassword(CERT_KEYPASSWORD);
private final Environment environment = new Environment(new SynchronousDispatcherConfigReader()); private final String host; private final int port;
@Before public void setUp() throws Exception { ObjectMapper objectMapper = Jackson.newObjectMapper(); environment = new Environment("test env", objectMapper, null, new MetricRegistry(), null); guiceBundle = GuiceBundle.defaultBuilder(Configuration.class) .modules(new TestModule()) .build(); Bootstrap bootstrap = mock(Bootstrap.class); when(bootstrap.getObjectMapper()).thenReturn(objectMapper); guiceBundle.initialize(bootstrap); guiceBundle.run(new Configuration(), environment); }
@Before public void setup() throws Exception { ObjectMapper objectMapper = Jackson.newObjectMapper(); Environment environment = new Environment("test env", objectMapper, null, new MetricRegistry(), null); GuiceBundle guiceBundle = GuiceBundle.defaultBuilder(Configuration.class) .modules(new TestModule()) .build(); Bootstrap bootstrap = mock(Bootstrap.class); when(bootstrap.getObjectMapper()).thenReturn(objectMapper); guiceBundle.initialize(bootstrap); guiceBundle.run(new Configuration(), environment); injector = guiceBundle.getInjector(); serviceLocator = injector.getInstance(ServiceLocator.class); }
@Before public void setUp() { //given environment = new Environment("test env", Jackson.newObjectMapper(), null, new MetricRegistry(), null); guiceBundle = GuiceBundle.newBuilder() .addModule(new TestModule()) .build(); Bootstrap bootstrap = mock(Bootstrap.class); guiceBundle.initialize(bootstrap); guiceBundle.run(new Configuration(), environment); }