/** * Get all transports in AxisConfig * * @return list of all transports */ public List<String> getAllTransports() { List<String> allTransports = new ArrayList<>(); for (Iterator iter = axisConfig.getTransportsIn().keySet().iterator(); iter.hasNext(); ) { String transport = (String) iter.next(); allTransports.add(transport); } return allTransports; }
/** * Get all transports in AxisConfig * * @return list of all transports */ public List<String> getAllTransports() { List<String> allTransports = new ArrayList<>(); for (Iterator iter = axisConfig.getTransportsIn().keySet().iterator(); iter.hasNext(); ) { String transport = (String) iter.next(); allTransports.add(transport); } return allTransports; }
/** * Get all transports in AxisConfig * * @return list of all transports */ public List<String> getAllTransports() { List<String> allTransports = new ArrayList<>(); for (Iterator iter = axisConfig.getTransportsIn().keySet().iterator(); iter.hasNext(); ) { String transport = (String) iter.next(); allTransports.add(transport); } return allTransports; }
/** * Get "https" transports in the AxisConfig * * @return list */ public List<String> getHttpsTransports() { List<String> httpsTransports = new ArrayList<>(); for (Iterator iter = axisConfig.getTransportsIn().keySet().iterator(); iter.hasNext(); ) { String transport = (String) iter.next(); if (transport.toLowerCase().indexOf(SecurityConstants.HTTPS_TRANSPORT) != -1) { httpsTransports.add(transport); } } return httpsTransports; }
/** * Get "https" transports in the AxisConfig * * @return list */ public List<String> getHttpsTransports() { List<String> httpsTransports = new ArrayList<>(); for (Iterator iter = axisConfig.getTransportsIn().keySet().iterator(); iter.hasNext(); ) { String transport = (String) iter.next(); if (transport.toLowerCase().indexOf(SecurityConstants.HTTPS_TRANSPORT) != -1) { httpsTransports.add(transport); } } return httpsTransports; }
/** * Get "https" transports in the AxisConfig * * @return list */ public List<String> getHttpsTransports() { List<String> httpsTransports = new ArrayList<>(); for (Iterator iter = axisConfig.getTransportsIn().keySet().iterator(); iter.hasNext(); ) { String transport = (String) iter.next(); if (transport.toLowerCase().indexOf(SecurityConstants.HTTPS_TRANSPORT) != -1) { httpsTransports.add(transport); } } return httpsTransports; }
public boolean isActive() { if (transportInDescName != null && parent != null) { AxisConfiguration axisConfiguration = getAxisConfiguration(); if (axisConfiguration != null) { AxisService service = (AxisService)parent; if (service.isEnableAllTransports()) { return axisConfiguration.getTransportsIn().containsKey(transportInDescName); } else { return service.getExposedTransports().contains(transportInDescName); } } } return false; }
public boolean isActive() { if (transportInDescName != null && parent != null) { AxisConfiguration axisConfiguration = getAxisConfiguration(); if (axisConfiguration != null) { AxisService service = (AxisService)parent; if (service.isEnableAllTransports()) { return axisConfiguration.getTransportsIn().containsKey(transportInDescName); } else { return service.getExposedTransports().contains(transportInDescName); } } } return false; }
/** * Pauses all Axis2 listeners which support this operation. */ public void pauseListeners() { if ((configurationContext != null) && (configurationContext.getAxisConfiguration() != null)) { Map<String, TransportInDescription> trpIns = configurationContext.getAxisConfiguration().getTransportsIn(); for (TransportInDescription trpIn : trpIns.values()) { TransportListener trpLst = trpIn.getReceiver(); if (trpLst instanceof ManagementSupport) { try { ((ManagementSupport) trpLst).pause(); } catch (AxisFault axisFault) { log.error(new StringBuilder("Error putting transport listener for: ") .append(trpIn.getName()).append(" into maintenence").toString()); } } } } }
/** * Resumes all paused Axis2 listeners. */ public void resumeListeners() { if ((configurationContext != null) && (configurationContext.getAxisConfiguration() != null)) { Map<String, TransportInDescription> trpIns = configurationContext.getAxisConfiguration().getTransportsIn(); for (TransportInDescription trpIn : trpIns.values()) { TransportListener trpLst = trpIn.getReceiver(); if (trpLst instanceof ManagementSupport) { try { ((ManagementSupport) trpLst).resume(); } catch (AxisFault axisFault) { log.error(new StringBuilder("Error resuming transport listener for: ") .append(trpIn.getName()).append(" from maintenence").toString()); } } } } }
public int getActiveConnectionsCount() { Map<String, TransportInDescription> trpIns = configurationContext.getAxisConfiguration().getTransportsIn(); for (TransportInDescription trpIn : trpIns.values()) { if (trpIn.getReceiver() instanceof HttpCoreNIOListener) { return ((HttpCoreNIOListener) trpIn.getReceiver()).getActiveConnectionsSize(); } } return 0; }
public String[] getExposedTransports(String serviceId) throws AxisFault { AxisService axisService = getAxisConfig().getService(serviceId); if (!axisService.isEnableAllTransports()) { List exposedTransports = axisService.getExposedTransports(); return (String[]) exposedTransports.toArray(new String[exposedTransports.size()]); } else { HashMap transportsIn = getConfigContext().getAxisConfiguration() .getTransportsIn(); String[] transports = new String[transportsIn.size()]; int i = 0; for (Iterator transportsIter = transportsIn.values().iterator(); transportsIter.hasNext();) { TransportInDescription tiDesc = (TransportInDescription) transportsIter.next(); transports[i++] = tiDesc.getName(); } return transports; } }
public int getActiveConnectionsCount() { Map<String, TransportInDescription> trpIns = configurationContext.getAxisConfiguration().getTransportsIn(); for (TransportInDescription trpIn : trpIns.values()) { if (trpIn.getReceiver() instanceof HttpCoreNIOListener) { return ((HttpCoreNIOListener) trpIn.getReceiver()).getActiveConnectionsSize(); } } return 0; }
public void destroy() throws AxisFault { stop(); this.configctx.setTransportManager(null); // need to destory all the transports not only the started ones // most of the transports create the worker pool at the init method. TransportInDescription transportInDescription; for (Object o : configctx.getAxisConfiguration().getAxisConfiguration().getTransportsIn().values()) { transportInDescription = (TransportInDescription) o; TransportListener transportListener = transportInDescription.getReceiver(); transportListener.destroy(); } this.startedTransports.clear(); this.configctx = null; }
public void destroy() throws AxisFault { stop(); this.configctx.setTransportManager(null); // need to destory all the transports not only the started ones // most of the transports create the worker pool at the init method. TransportInDescription transportInDescription; for (Object o : configctx.getAxisConfiguration().getAxisConfiguration().getTransportsIn().values()) { transportInDescription = (TransportInDescription) o; TransportListener transportListener = transportInDescription.getReceiver(); transportListener.destroy(); } this.startedTransports.clear(); this.configctx = null; }
public void disableTransportForService(AxisService service) { log.warn("Disabling the " + getTransportName() + " transport for the service " + service.getName() + ", because it is not configured properly for the service"); if (service.isEnableAllTransports()) { ArrayList<String> exposedTransports = new ArrayList<String>(); for(Object obj: cfgCtx.getAxisConfiguration().getTransportsIn().values()) { String transportName = ((TransportInDescription) obj).getName(); if (!transportName.equals(getTransportName())) { exposedTransports.add(transportName); } } service.setEnableAllTransports(false); service.setExposedTransports(exposedTransports); } else { service.removeExposedTransport(getTransportName()); } }
public void disableTransportForService(AxisService service) { log.warn("Disabling the " + getTransportName() + " transport for the service " + service.getName() + ", because it is not configured properly for the service"); if (service.isEnableAllTransports()) { ArrayList<String> exposedTransports = new ArrayList<String>(); for(Object obj: cfgCtx.getAxisConfiguration().getTransportsIn().values()) { String transportName = ((TransportInDescription) obj).getName(); if (!transportName.equals(getTransportName())) { exposedTransports.add(transportName); } } service.setEnableAllTransports(false); service.setExposedTransports(exposedTransports); } else { service.removeExposedTransport(getTransportName()); } }
/** To start all the transports */ public synchronized void start() { if (!stopped) { log.error("Couldn't start ListenerManager, it seems to be already started!"); return; } if (configctx == null) { log.error("Can't start uninitialized ListenerManager!"); return; } for (Object o : configctx.getAxisConfiguration().getTransportsIn().values()) { try { TransportInDescription transportIn = (TransportInDescription)o; TransportListener listener = transportIn.getReceiver(); if (listener != null && startedTransports.get(transportIn.getName()) == null) { listener.start(); startedTransports.put(transportIn.getName(), listener); } } catch (Exception e) { log.info(e.getMessage(), e); } } if (shutdownHookThread == null && isShutdownHookRequired()) { shutdownHookThread = new ListenerManagerShutdownThread(this); Runtime.getRuntime().addShutdownHook(shutdownHookThread); } stopped = false; }
private void startServer(ConfigurationContext configctx) throws AxisFault { ListenerManager listenerManager = configctx.getListenerManager(); if (listenerManager == null) { listenerManager = new ListenerManager(); listenerManager.init(configctx); } Iterator iter = configctx.getAxisConfiguration(). getTransportsIn().keySet().iterator(); while (iter.hasNext()) { String trp = (String) iter.next(); TransportInDescription trsIn = configctx.getAxisConfiguration().getTransportsIn().get(trp); listenerManager.addListener(trsIn, false); } }
private void addServerIPAndHostEntries() { String hostName = serverConfigurationInformation.getHostName(); String ipAddress = serverConfigurationInformation.getIpAddress(); if (hostName != null && !"".equals(hostName)) { Entry entry = new Entry(SynapseConstants.SERVER_HOST); entry.setValue(hostName); synapseConfiguration.addEntry(SynapseConstants.SERVER_HOST, entry); } if (ipAddress != null && !"".equals(ipAddress)) { Entry entry = new Entry(SynapseConstants.SERVER_IP); entry.setValue(ipAddress); if (synapseConfiguration.getAxisConfiguration().getTransportsIn() != null) { Map<String, TransportInDescription> transportInConfigMap = synapseConfiguration.getAxisConfiguration().getTransportsIn(); if (transportInConfigMap != null) { TransportInDescription transportInDescription = transportInConfigMap.get("http"); if (transportInDescription != null) { Parameter bindAddressParam = transportInDescription.getParameter("bind-address"); if (bindAddressParam != null) { entry.setValue(bindAddressParam.getValue()); } } } } synapseConfiguration.addEntry(SynapseConstants.SERVER_IP, entry); } }