Java Code Examples for org.apache.axis2.description.Parameter#getValue()

The following examples show how to use org.apache.axis2.description.Parameter#getValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SynapseAppDeployer.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
/**
 * Acquires the lock
 *
 * @param axisConfig AxisConfiguration instance
 * @return Lock instance
 */
protected Lock getLock(AxisConfiguration axisConfig) {
    Parameter p = axisConfig.getParameter(ServiceBusConstants.SYNAPSE_CONFIG_LOCK);
    if (p != null) {
        return (Lock) p.getValue();
    } else {
        log.warn(ServiceBusConstants.SYNAPSE_CONFIG_LOCK + " is null, Recreating a new lock");
        Lock lock = new ReentrantLock();
        try {
            axisConfig.addParameter(ServiceBusConstants.SYNAPSE_CONFIG_LOCK, lock);
            return lock;
        } catch (AxisFault axisFault) {
            log.error("Error while setting " + ServiceBusConstants.SYNAPSE_CONFIG_LOCK);
        }
    }

    return null;
}
 
Example 2
Source File: MediationPersistenceManager.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
protected Lock getLock(AxisConfiguration axisConfig) {
    Parameter p = axisConfig.getParameter(ServiceBusConstants.SYNAPSE_CONFIG_LOCK);
    if (p != null) {
        return (Lock) p.getValue();
    } else {
        log.warn(ServiceBusConstants.SYNAPSE_CONFIG_LOCK + " is null, Recreating a new lock");
        Lock lock = new ReentrantLock();
        try {
            axisConfig.addParameter(ServiceBusConstants.SYNAPSE_CONFIG_LOCK, lock);
            return lock;
        } catch (AxisFault axisFault) {
            log.error("Error while setting " + ServiceBusConstants.SYNAPSE_CONFIG_LOCK);
        }
    }

    return null;
}
 
Example 3
Source File: MessageSender.java    From carbon-commons with Apache License 2.0 6 votes vote down vote up
private Config getDiscoveryConfig(AxisService service) {
    Parameter parameter = service.getParameter(DiscoveryConstants.WS_DISCOVERY_PARAMS);
    Config config;
    if (parameter != null) {
        OMElement element = parameter.getParameterElement();

        // For a ProxyService, the parameter defined as XML, is returned as a string value.
        // Until this problem is solved, we'll be adopting the approach below, to make an
        // attempt to construct the parameter element.
        if (element == null) {
            if (parameter.getValue() != null) {
                try {
                    String wrappedElementText = "<wrapper>" + parameter.getValue() + "</wrapper>";
                    element = AXIOMUtil.stringToOM(wrappedElementText);
                } catch (Exception ignored) { }
            } else {
                return getDefaultConfig();
            }
        }

        config = Config.fromOM(element);
    } else {
        return getDefaultConfig();
    }
    return config;
}
 
Example 4
Source File: TracerAdmin.java    From carbon-commons with Apache License 2.0 6 votes vote down vote up
private TracePersister getTracePersister(Parameter tracePersisterParam) throws AxisFault {
    TracePersister tracePersister = null;
    if (tracePersisterParam != null) {
        Object tracePersisterImplObj = tracePersisterParam.getValue();
        if (tracePersisterImplObj instanceof TracePersister) {
            tracePersister = (TracePersister) tracePersisterImplObj;
        } else if (tracePersisterImplObj instanceof String) {
            //This will need in TestSuite
            try {
                tracePersister =
                        (TracePersister) Loader
                                .loadClass(((String) tracePersisterImplObj).trim())
                                .newInstance();
            } catch (Exception e) {
                String message = "Cannot instatiate TracePersister ";
                log.error(message, e);
                throw new RuntimeException(message, e);
            }
        }
    } else {
        return new MemoryBasedTracePersister(); // The default is the MemoryBasedTRacePersister
    }
    return tracePersister;
}
 
Example 5
Source File: AbstractServiceBusAdmin.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
protected Lock getLock() {
    Parameter p = getAxisConfig().getParameter(ServiceBusConstants.SYNAPSE_CONFIG_LOCK);
    if (p != null) {
        return (Lock) p.getValue();
    } else {
        log.warn(ServiceBusConstants.SYNAPSE_CONFIG_LOCK + " is null, Recreating a new lock");
        Lock lock = new ReentrantLock();
        try {
            getAxisConfig().addParameter(ServiceBusConstants.SYNAPSE_CONFIG_LOCK, lock);
            return lock;
        } catch (AxisFault axisFault) {
            log.error("Error while setting " + ServiceBusConstants.SYNAPSE_CONFIG_LOCK);
        }
    }

    return null;
}
 
Example 6
Source File: DBDeployer.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private DataService getDataServiceByServicePath(String servicePath) throws Exception {
	Parameter tmpParam;
	DataService tmpDS;
	String canonicalServicePath = new File(servicePath).getCanonicalPath();
	for (AxisService axisService : this.axisConfig.getServices().values()) {
		tmpParam = axisService.getParameter(DBConstants.DATA_SERVICE_OBJECT);
		if (tmpParam != null) {
			tmpDS = (DataService) tmpParam.getValue();
			if (new File(tmpDS.getDsLocation()).getCanonicalPath().equals(
					canonicalServicePath)) {
		    	return tmpDS;
		    }
		}
	}
	//throw new DataServiceFault("Data service at '" + servicePath + "' cannot be found");
	return null;
}
 
Example 7
Source File: ServiceBusUtils.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
public static MediationPersistenceManager getMediationPersistenceManager(
        AxisConfiguration axisCfg) {
    
    Parameter p = axisCfg.getParameter(
            ServiceBusConstants.PERSISTENCE_MANAGER);
    if (p != null) {
        return (MediationPersistenceManager) p.getValue();
    }

    return null;
}
 
Example 8
Source File: SystemStatisticsUtil.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public long getMaxServiceResponseTime(AxisService axisService) throws AxisFault {
    long max = 0;
    Parameter parameter =
            axisService.getParameter(StatisticsConstants.SERVICE_RESPONSE_TIME_PROCESSOR);
    if (parameter != null) {
        ResponseTimeProcessor proc = (ResponseTimeProcessor) parameter.getValue();
        max = proc.getMaxResponseTime();
    }
    return max;
}
 
Example 9
Source File: SystemStatisticsUtil.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public long getMinSystemResponseTime(AxisConfiguration axisConfig) {
    Parameter processor =
            axisConfig.getParameter(StatisticsConstants.RESPONSE_TIME_PROCESSOR);
    if (processor != null) {
        Object value = processor.getValue();
        if (value instanceof ResponseTimeProcessor) {
            return ((ResponseTimeProcessor) value).getMinResponseTime();
        }
    }
    return 0;
}
 
Example 10
Source File: SystemStatisticsUtil.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public long getMaxSystemResponseTime(AxisConfiguration axisConfig) {
    Parameter processor =
            axisConfig.getParameter(StatisticsConstants.RESPONSE_TIME_PROCESSOR);
    if (processor != null) {
        Object value = processor.getValue();
        if (value instanceof ResponseTimeProcessor) {
            return ((ResponseTimeProcessor) value).getMaxResponseTime();
        }
    }
    return 0;
}
 
Example 11
Source File: SystemStatisticsUtil.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public double getAvgSystemResponseTime(AxisConfiguration axisConfig) {
    Parameter processor =
            axisConfig.getParameter(StatisticsConstants.RESPONSE_TIME_PROCESSOR);
    if (processor != null) {
        Object value = processor.getValue();
        if (value instanceof ResponseTimeProcessor) {
            return ((ResponseTimeProcessor) value).getAvgResponseTime();
        }
    }
    return 0;
}
 
Example 12
Source File: SystemStatisticsUtil.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
private long getResponseTime(AxisService axisService) {
    Parameter responseTimeParameter = axisService.getParameter(
            StatisticsConstants.SERVICE_RESPONSE_TIME);
    if (responseTimeParameter != null) {
        Object value = responseTimeParameter.getValue();
        if (value instanceof Long) {
            return (Long) value;
        }
    }
    return 0;
}
 
Example 13
Source File: JMSTaskManagerFactory.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
private static Map<String, String> getServiceStringParameters(List<Parameter> list) {

        Map<String, String> map = new HashMap<String, String>();
        for (Parameter p : list) {
            if (p.getValue() instanceof String) {
                map.put(p.getName(), (String) p.getValue());
            }
        }
        return map;
    }
 
Example 14
Source File: IheHttpFactory.java    From openxds with Apache License 2.0 5 votes vote down vote up
private String getStringParam(String name, String def) {
        Parameter param = httpConfiguration.getParameter(name);
        if (param != null) {
//            assert param.getParameterType() == Parameter.TEXT_PARAMETER;
            String config = (String) param.getValue();
            if (config != null) {
                return config;
            }
        }
        return def;
    }
 
Example 15
Source File: KubernetesMembershipScheme.java    From product-private-paas with Apache License 2.0 5 votes vote down vote up
protected String getParameterValue(String parameterName, String defaultValue) throws ClusteringFault {
    Parameter kubernetesServicesParam = getParameter(parameterName);
    if (kubernetesServicesParam == null) {
        if (defaultValue == null) {
            throw new ClusteringFault(parameterName + " parameter not found");
        } else {
            return defaultValue;
        }
    }
    return (String) kubernetesServicesParam.getValue();
}
 
Example 16
Source File: AbstractServiceBusAdmin.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
protected ServerConfigurationInformation getServerConfigurationInformation() {
    Parameter p = getAxisConfig().getParameter(SynapseConstants.SYNAPSE_SERVER_CONFIG_INFO);
    if (p != null) {
        return (ServerConfigurationInformation) p.getValue();
    }
    return null;
}
 
Example 17
Source File: SystemStatisticsUtil.java    From carbon-commons with Apache License 2.0 5 votes vote down vote up
public double getAvgServiceResponseTime(AxisService axisService) throws AxisFault {
    double avg = 0;
    Parameter parameter =
            axisService.getParameter(StatisticsConstants.SERVICE_RESPONSE_TIME_PROCESSOR);
    if (parameter != null) {
        ResponseTimeProcessor proc = (ResponseTimeProcessor) parameter.getValue();
        avg = proc.getAvgResponseTime();
    }
    return avg;
}
 
Example 18
Source File: TransportBuilderUtils.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
public static OMElement serializeParameter(Parameter p, OMFactory fac) {
    if (p.getParameterElement() != null) {
        return p.getParameterElement();
    } else {
        OMElement paramElement = fac.createOMElement(new QName(TAG_PARAMETER));
        paramElement.addAttribute(ATTRIBUTE_NAME, p.getName(), null);
        if (p.getValue() instanceof OMElement) {
            paramElement.addChild((OMElement) p.getValue());
        } else {
            paramElement.setText(p.getValue().toString());
        }
        return paramElement;
    }
}
 
Example 19
Source File: ServiceAdmin.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private String getServiceType(AxisService service) {

        Parameter serviceTypeParam = service.getParameter("serviceType");
        String serviceType;
        if (serviceTypeParam != null) {
            serviceType = (String) serviceTypeParam.getValue();
        } else {
            serviceType = "axis2";
        }

        return serviceType;
    }
 
Example 20
Source File: MicroIntegratorBaseUtils.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * Get Synapse Environment. This might throw NPE if called before SynapseEnvironment is initialized.
 *
 * @return SynapseEnvironment - SynapseEnvironment
 */
public static SynapseEnvironment getSynapseEnvironment() {

    Parameter synapseEnvironmentParatemer =
            CarbonCoreDataHolder.getInstance().getAxis2ConfigurationContextService().getServerConfigContext()
                    .getAxisConfiguration().getParameter(SynapseConstants.SYNAPSE_ENV);
    return (SynapseEnvironment) synapseEnvironmentParatemer.getValue();
}