/** * * @return Whether or not REST is enabled. */ private boolean isRestEnabled() { assert cfg != null; return cfg.getClientConnectionConfiguration() != null; }
/** * @return Client configuration. */ protected GridClientConnectionConfiguration config() { return ctx.config().getClientConnectionConfiguration(); }
/** * @return Client configuration. */ private GridClientConnectionConfiguration config() { return ctx.config().getClientConnectionConfiguration(); }
/** * @param ctx Context. */ @SuppressWarnings({"OverriddenMethodCallDuringObjectConstruction"}) protected GridRestProtocolAdapter(GridKernalContext ctx) { assert ctx != null; assert ctx.config().getClientConnectionConfiguration() != null; this.ctx = ctx; log = ctx.log(getClass()); secretKey = ctx.config().getClientConnectionConfiguration().getRestSecretKey(); }
/** @param ctx Context. */ public GridLogCommandHandler(GridKernalContext ctx) { super(ctx); assert ctx.config().getClientConnectionConfiguration() != null; String[] accessiblePaths = ctx.config().getClientConnectionConfiguration().getRestAccessibleFolders(); if (accessiblePaths == null) { String ggHome = U.getGridGainHome(); if (ggHome != null) accessiblePaths = new String[] {ggHome}; } if (accessiblePaths != null) { accessibleFolders = new ArrayList<>(); for (String accessiblePath : accessiblePaths) accessibleFolders.add(new File(accessiblePath)); } else if (log.isDebugEnabled()) log.debug("Neither restAccessibleFolders nor GRIDGAIN_HOME properties are not set, will not restrict " + "log files access"); }
/** * * @return Whether or not REST is enabled. */ private boolean isRestEnabled() { return !ctx.config().isDaemon() && ctx.config().getClientConnectionConfiguration() != null; }
/** * Resolves host for REST TCP server using grid configuration. * * @param cfg Grid configuration. * @return REST host. * @throws IOException If failed to resolve REST host. */ private InetAddress resolveRestTcpHost(GridConfiguration cfg) throws IOException { String host = cfg.getClientConnectionConfiguration().getRestTcpHost(); if (host == null) host = cfg.getLocalHost(); return U.resolveLocalHost(host); }
/** * @param cfg Grid configuration. * @return Components provided in configuration which can implement {@link GridLifecycleAware} interface. */ private Iterable<Object> lifecycleAwares(GridConfiguration cfg) { Collection<Object> objs = new ArrayList<>(); if (!F.isEmpty(cfg.getLifecycleBeans())) F.copy(objs, cfg.getLifecycleBeans()); if (!F.isEmpty(cfg.getSegmentationResolvers())) F.copy(objs, cfg.getSegmentationResolvers()); if (cfg.getClientConnectionConfiguration() != null) F.copy(objs, cfg.getClientConnectionConfiguration().getClientMessageInterceptor(), cfg.getClientConnectionConfiguration().getRestTcpSslContextFactory()); F.copy(objs, cfg.getMarshaller(), cfg.getGridLogger(), cfg.getMBeanServer()); return objs; }
if (cfg.getClientConnectionConfiguration() != null) add(attrs, ATTR_REST_PORT_RANGE, cfg.getClientConnectionConfiguration().getRestPortRange());
/** @throws GridException If registration failed. */ private void registerExecutorMBeans() throws GridException { pubExecSvcMBean = registerExecutorMBean(cfg.getExecutorService(), "GridExecutionExecutor"); sysExecSvcMBean = registerExecutorMBean(cfg.getSystemExecutorService(), "GridSystemExecutor"); mgmtExecSvcMBean = registerExecutorMBean(cfg.getManagementExecutorService(), "GridManagementExecutor"); p2PExecSvcMBean = registerExecutorMBean(cfg.getPeerClassLoadingExecutorService(), "GridClassLoadingExecutor"); drExecSvcMBean = registerExecutorMBean(cfg.getDrExecutorService(), "GridDrExecutor"); GridClientConnectionConfiguration clientCfg = cfg.getClientConnectionConfiguration(); if (clientCfg != null) { restExecSvcMBean = clientCfg.getRestExecutorService() != null ? registerExecutorMBean(clientCfg.getRestExecutorService(), "GridRestExecutor") : null; } }
/** * @param c Grid configuration. * @return Create data transfer object for node REST configuration properties. */ public static VisorRestConfig from(GridConfiguration c) { VisorRestConfig cfg = new VisorRestConfig(); GridClientConnectionConfiguration clnCfg = c.getClientConnectionConfiguration(); boolean restEnabled = clnCfg != null; cfg.restEnabled(restEnabled); if (restEnabled) { cfg.tcpSslEnabled(clnCfg.isRestTcpSslEnabled()); cfg.accessibleFolders(clnCfg.getRestAccessibleFolders()); cfg.jettyPath(clnCfg.getRestJettyPath()); cfg.jettyHost(getProperty(GG_JETTY_HOST)); cfg.jettyPort(intValue(GG_JETTY_PORT, null)); cfg.tcpHost(clnCfg.getRestTcpHost()); cfg.tcpPort(clnCfg.getRestTcpPort()); cfg.tcpSslContextFactory(compactClass(clnCfg.getRestTcpSslContextFactory())); } return cfg; }
assert hnd != null; GridClientConnectionConfiguration cfg = ctx.config().getClientConnectionConfiguration();
/** * @param c Grid configuration. * @return Data transfer object for node executors configuration properties. */ public static VisorExecutorServiceConfig from(GridConfiguration c) { VisorExecutorServiceConfig cfg = new VisorExecutorServiceConfig(); cfg.executeService(compactClass(c.getExecutorService())); cfg.executeServiceShutdown(c.getExecutorServiceShutdown()); cfg.systemExecutorService(compactClass(c.getSystemExecutorService())); cfg.systemExecutorServiceShutdown(c.getSystemExecutorServiceShutdown()); cfg.p2pExecutorService(compactClass(c.getPeerClassLoadingExecutorService())); cfg.p2pExecutorServiceShutdown(c.getSystemExecutorServiceShutdown()); GridClientConnectionConfiguration cc = c.getClientConnectionConfiguration(); if (cc != null) { cfg.restExecutorService(compactClass(cc.getRestExecutorService())); cfg.restExecutorServiceShutdown(cc.isRestExecutorServiceShutdown()); } return cfg; }
myCfg.setTimeServerPortRange(cfg.getTimeServerPortRange()); GridClientConnectionConfiguration clientCfg = cfg.getClientConnectionConfiguration();
cacheCfg = cfg.getCacheConfiguration(); cacheSanityCheckEnabled = cfg.isCacheSanityCheckEnabled(); clientCfg = cfg.getClientConnectionConfiguration(); clientMsgInterceptor = cfg.getClientMessageInterceptor(); clockSyncFreq = cfg.getClockSyncFrequency();