public static VirtualServer getVirtualServerByName(HttpService target, String name) { for (VirtualServer v : target.getVirtualServer()) { if (v.getId().equals(name)) { return v; } } return null; }
private VirtualServer createAdminVirtualServer( final Transaction t, final Config config_w) throws TransactionFailure, PropertyVetoException { final HttpService hs_w = t.enroll(config_w.getHttpService()); final VirtualServer vs_w = hs_w.createChild(VirtualServer.class); hs_w.getVirtualServer().add(vs_w); vs_w.setId(ASADMIN_VS_NAME); vs_w.setNetworkListeners(ADMIN_LISTENER_NAME); return vs_w; }
@Override public Object run(HttpService param) { final List<Property> propertyList = new ArrayList<Property>(param.getProperty()); final Iterator<Property> it = propertyList.iterator(); while (it.hasNext()) { final Property property = it.next(); if ("accessLoggingEnabled".equals(property.getName())) { param.setAccessLoggingEnabled(property.getValue()); it.remove(); } else if ("accessLogBufferSize".equals(property.getName())) { param.getAccessLog().setBufferSizeBytes(property.getValue()); it.remove(); } else if ("accessLogWriterInterval".equals(property.getName())) { param.getAccessLog().setWriteIntervalSeconds(property.getValue()); it.remove(); } else if ("sso-enabled".equals(property.getName())) { param.setSsoEnabled(property.getValue()); it.remove(); } } param.getProperty().clear(); param.getProperty().addAll(propertyList); return null; } }, service);
@Override public Object run(HttpService param) { param.getHttpListener().remove(param.getHttpListenerById(listener.getId())); return null; } }, currentConfig.getHttpService());
public Object run(Config config) throws PropertyVetoException, TransactionFailure { HttpService httpService = config.createChild(HttpService.class); config.setHttpService(httpService); AccessLog al = httpService.createChild(AccessLog.class); httpService.setAccessLog(al); createVirtualServer(httpService); return config; } }
@Override public Object run(Config param) throws PropertyVetoException, TransactionFailure { HttpService httpService = param.createChild(HttpService.class); AccessLog accessLog = httpService.createChild(AccessLog.class); List<VirtualServer> vsList = httpService.getVirtualServer(); httpService.setAccessLog(accessLog); VirtualServer vs = httpService.createChild(VirtualServer.class); vs.setId("server"); vs.setNetworkListeners("http-listener-1,http-listener-2"); VirtualServer vs1 = httpService.createChild(VirtualServer.class); vs1.setId("__asadmin"); vs1.setNetworkListeners("admin-listener"); vsList.add(vs); vsList.add(vs1); param.getContainers().add(httpService); return httpService; } }, param);
httpService.getAccessLoggingEnabled()) || ConfigBeansUtilities.toBoolean( httpService.getSsoEnabled())) { return true; List<Property> props = httpService.getProperty(); if (props != null) { for (Property prop : props) { List<VirtualServer> hosts = httpService.getVirtualServer(); if (hosts != null) { for (VirtualServer host : hosts) {
/** * Processes an update to the http-service element */ public void updateHttpService(HttpService httpService) throws LifecycleException { if (httpService == null) { return; } /* * Update each virtual server with the sso-enabled and * access logging related properties of the updated http-service */ globalSSOEnabled = ConfigBeansUtilities.toBoolean(httpService.getSsoEnabled()); globalAccessLogWriteInterval = httpService.getAccessLog().getWriteIntervalSeconds(); globalAccessLogBufferSize = httpService.getAccessLog().getBufferSizeBytes(); globalAccessLoggingEnabled = ConfigBeansUtilities.toBoolean(httpService.getAccessLoggingEnabled()); // for availability-service.web-container-availability webContainerFeatureFactory = getWebContainerFeatureFactory(); List<com.sun.enterprise.config.serverbeans.VirtualServer> virtualServers = httpService.getVirtualServer(); for (com.sun.enterprise.config.serverbeans.VirtualServer virtualServer : virtualServers) { final VirtualServer vs = (VirtualServer) getEngine().findChild(virtualServer.getId()); if (vs != null) { vs.configureSingleSignOn(globalSSOEnabled, webContainerFeatureFactory, isSsoFailoverEnabled()); vs.reconfigureAccessLog(globalAccessLogBufferSize, globalAccessLogWriteInterval, habitat, domain, globalAccessLoggingEnabled); updateHost(virtualServer); } } }
PECoyoteConnector connector) { List<Property> httpServiceProps = httpService.getProperty(); globalSSOEnabled = ConfigBeansUtilities.toBoolean(httpService.getSsoEnabled()); globalAccessLoggingEnabled = ConfigBeansUtilities.toBoolean(httpService.getAccessLoggingEnabled()); globalAccessLogWriteInterval = httpService.getAccessLog().getWriteIntervalSeconds(); globalAccessLogBufferSize = httpService.getAccessLog().getBufferSizeBytes(); if (httpServiceProps != null) { for (Property httpServiceProp : httpServiceProps) {
List<HttpListener> httpListeners = httpSvc.getHttpListener(); checkDuplicate(httpListeners); List<VirtualServer> virtualServers = httpSvc.getVirtualServer(); checkDuplicate(virtualServers);
private HostAndPort getHostAndPort(HttpService httpService, VirtualServer vs, boolean securityEnabled) { List<VirtualServer> virtualServerList = httpService.getVirtualServer(); List<NetworkListener> httpListenerList = httpService.getParent(Config.class).getNetworkConfig().getNetworkListeners().getNetworkListener();
public void execute(AdminCommandContext context) { for (Config config : configs.getConfig()) { HttpService service = config.getHttpService(); if(service == null) continue; boolean done = false; try { final List<Property> properties = service.getProperty(); final Iterator<Property> iterator = properties.iterator(); while (!done && iterator.hasNext()) { final Property property = iterator.next(); String name = property.getName(); if ("accessLoggingEnabled".equals(name) || "accessLogBufferSize".equals(name) || "accessLogWriteInterval".equals(name) || "sso-enabled".equals(name)) { done = true; upgrade(context, property, service); } } } catch (TransactionFailure tf) { Logger.getAnonymousLogger().log(Level.SEVERE, "Failure while upgrading http-service properties." + " Please check logs for errors", tf); throw new RuntimeException(tf); } } }
private void upgrade(final AdminCommandContext context, final Property property, final HttpService service) throws TransactionFailure { if ("accessLoggingEnabled".equals(property.getName())) { updatePropertyToAttribute(context, service, "accessLoggingEnabled", "accessLoggingEnabled"); } else if ("accessLogBufferSize".equals(property.getName())) { ConfigSupport.apply(new SingleConfigCode<AccessLog>() { @Override public Object run(AccessLog param) { param.setBufferSizeBytes(property.getValue()); return param; } }, service.getAccessLog()); removeProperty(service, "accessLogBufferSize"); report(context, "Moved http-service.property.accessLogBufferSize to http-service.access-log.buffer-size-bytes"); } else if ("accessLogWriteInterval".equals(property.getName())) { ConfigSupport.apply(new SingleConfigCode<AccessLog>() { @Override public Object run(AccessLog param) { param.setWriteIntervalSeconds(property.getValue()); return param; } }, service.getAccessLog()); removeProperty(service, "accessLogWriteInterval"); report(context, "Moved http-service.property.accessLogWriteInterval to http-service.access-log.write-interval-seconds"); } else if ("sso-enabled".equals(property.getName())) { updatePropertyToAttribute(context, service, "sso-enabled", "ssoEnabled"); } }
@Deprecated public static HttpListener getHttpListenerById(HttpService target, String id) { for (HttpListener v : target.getHttpListener()) { if (v.getId().equals(id)) { return v; } } return null; } }
public Object run(Config config) throws PropertyVetoException, TransactionFailure { HttpService httpService = config.createChild(HttpService.class); config.setHttpService(httpService); AccessLog al = httpService.createChild(AccessLog.class); httpService.setAccessLog(al); createVirtualServer(httpService); return config; } }
public void execute(AdminCommandContext context) { for (Config config : configs.getConfig()) { HttpService service = config.getHttpService(); if(service == null) continue; boolean done = false; try { final List<Property> properties = service.getProperty(); final Iterator<Property> iterator = properties.iterator(); while (!done && iterator.hasNext()) { final Property property = iterator.next(); String name = property.getName(); if ("accessLoggingEnabled".equals(name) || "accessLogBufferSize".equals(name) || "accessLogWriteInterval".equals(name) || "sso-enabled".equals(name)) { done = true; upgrade(context, property, service); } } } catch (TransactionFailure tf) { ConfigApiLoggerInfo.getLogger().log(Level.SEVERE, ConfigApiLoggerInfo.ERR_UPGRADE_HTTP_SVC_PROPS, tf); throw new RuntimeException(tf); } } }
private void upgrade(final AdminCommandContext context, final Property property, final HttpService service) throws TransactionFailure { if ("accessLoggingEnabled".equals(property.getName())) { updatePropertyToAttribute(context, service, "accessLoggingEnabled", "accessLoggingEnabled"); } else if ("accessLogBufferSize".equals(property.getName())) { ConfigSupport.apply(new SingleConfigCode<AccessLog>() { @Override public Object run(AccessLog param) { param.setBufferSizeBytes(property.getValue()); return param; } }, service.getAccessLog()); removeProperty(service, "accessLogBufferSize"); report(context, "Moved http-service.property.accessLogBufferSize to http-service.access-log.buffer-size-bytes"); } else if ("accessLogWriteInterval".equals(property.getName())) { ConfigSupport.apply(new SingleConfigCode<AccessLog>() { @Override public Object run(AccessLog param) { param.setWriteIntervalSeconds(property.getValue()); return param; } }, service.getAccessLog()); removeProperty(service, "accessLogWriteInterval"); report(context, "Moved http-service.property.accessLogWriteInterval to http-service.access-log.write-interval-seconds"); } else if ("sso-enabled".equals(property.getName())) { updatePropertyToAttribute(context, service, "sso-enabled", "ssoEnabled"); } }
private void processHttpListeners() throws TransactionFailure { if (!currentConfig.getHttpService().getHttpListener().isEmpty()) { // all changes in this method must be in their own transactions migrateSettings(); } }
public static VirtualServer getVirtualServerByName(HttpService target, String name) { for (VirtualServer v : target.getVirtualServer()) { if (v.getId().equals(name)) { return v; } } return null; }
private VirtualServer createAdminVirtualServer( final Transaction t, final Config config_w) throws TransactionFailure, PropertyVetoException { final HttpService hs_w = t.enroll(config_w.getHttpService()); final VirtualServer vs_w = hs_w.createChild(VirtualServer.class); hs_w.getVirtualServer().add(vs_w); vs_w.setId(ASADMIN_VS_NAME); vs_w.setNetworkListeners(ADMIN_LISTENER_NAME); return vs_w; }