use of org.apache.axis2.description.TransportOutDescription in project wso2-synapse by wso2.
the class DynamicProfileReloader method extractSleepInterval.
/**
* Set SSL Profile configuration loading interval from Axis2 config
*
* @param transportOut TransportOutDescription of the configuration
* @return Long value of the interval in milliseconds
*/
protected long extractSleepInterval(ParameterInclude transportOut) {
long fileReadInterval = -1;
Parameter profileParam = transportOut.getParameter(PROFILE_CONFIG_NAME);
// No Separate configuration file configured. Therefore using Axis2 Configuration
if (profileParam != null) {
OMElement profileParamElem = profileParam.getParameterElement();
String interval = profileParamElem.getFirstChildWithName(new QName(INTERVAL_CONFIG_NAME)).getText();
if (interval != null) {
fileReadInterval = Long.parseLong(interval);
}
}
return fileReadInterval;
}
use of org.apache.axis2.description.TransportOutDescription in project pentaho-platform by pentaho.
the class AxisServiceExecutorTest method setUp.
@Before
public void setUp() throws Exception {
StandaloneSession session = new StandaloneSession("test");
StubServiceSetup serviceSetup = new StubServiceSetup();
serviceSetup.setSession(session);
AxisConfiguration axisCfg = serviceSetup.getAxisConfiguration();
ConfigurationContext configContext = new ConfigurationContext(axisCfg);
serviceSetup.loadServices();
TransportInDescription tIn = new TransportInDescription(DEAFULT_TRANSPOT_PROTOCOL);
StubTransportListener receiver = new StubTransportListener();
tIn.setReceiver(receiver);
axisCfg.addTransportIn(tIn);
TransportOutDescription tOut = new TransportOutDescription(DEAFULT_TRANSPOT_PROTOCOL);
StubTransportSender sender = new StubTransportSender();
tOut.setSender(sender);
axisCfg.addTransportOut(tOut);
AxisWebServiceManager.currentAxisConfiguration = axisCfg;
AxisWebServiceManager.currentAxisConfigContext = configContext;
out = new ByteArrayOutputStream();
IOutputHandler outputHandler = new SimpleOutputHandler(out, false);
outputHandler.setMimeTypeListener(new MimeTypeListener());
contentGenerator = new AxisServiceExecutor();
contentGenerator.setOutputHandler(outputHandler);
contentGenerator.setMessagesList(new ArrayList<String>());
contentGenerator.setSession(session);
contentGenerator.setUrlFactory(new SimpleUrlFactory(BASE_URL + "?"));
assertNotNull("contentGenerator is null", contentGenerator);
assertNotNull("Logger is null", contentGenerator.getLogger());
}
use of org.apache.axis2.description.TransportOutDescription in project wso2-synapse by wso2.
the class VFSTransportSender method init.
/**
* Initialize the VFS file system manager and be ready to send messages
* @param cfgCtx the axis2 configuration context
* @param transportOut the transport-out description
* @throws AxisFault on error
*/
public void init(ConfigurationContext cfgCtx, TransportOutDescription transportOut) throws AxisFault {
super.init(cfgCtx, transportOut);
try {
StandardFileSystemManager fsm = new StandardFileSystemManager();
fsm.setConfiguration(getClass().getClassLoader().getResource("providers.xml"));
fsm.init();
fsManager = fsm;
Parameter lckFlagParam = transportOut.getParameter(VFSConstants.TRANSPORT_FILE_LOCKING);
if (lckFlagParam != null) {
String strLockingFlag = lckFlagParam.getValue().toString();
// by-default enabled, if explicitly specified as "disable" make it disable
if (VFSConstants.TRANSPORT_FILE_LOCKING_DISABLED.equals(strLockingFlag)) {
globalFileLockingFlag = false;
}
}
Parameter strAutoLock = transportOut.getParameter(VFSConstants.TRANSPORT_AUTO_LOCK_RELEASE);
boolean autoLockRelease = false;
boolean autoLockReleaseSameNode = true;
Long autoLockReleaseInterval = null;
if (strAutoLock != null && strAutoLock.getValue() != null && !strAutoLock.getValue().toString().isEmpty()) {
try {
autoLockRelease = Boolean.parseBoolean(strAutoLock.getValue().toString());
} catch (Exception e) {
autoLockRelease = false;
log.warn("VFS Auto lock removal not set properly. Given value is : " + strAutoLock + ", defaults to - " + autoLockRelease, e);
}
if (autoLockRelease) {
Parameter strAutoLockInterval = transportOut.getParameter(VFSConstants.TRANSPORT_AUTO_LOCK_RELEASE_INTERVAL);
if (strAutoLockInterval != null && strAutoLockInterval.getValue() != null && !strAutoLockInterval.getValue().toString().isEmpty()) {
try {
autoLockReleaseInterval = Long.parseLong(strAutoLockInterval.getValue().toString());
} catch (Exception e) {
autoLockReleaseInterval = null;
log.warn("VFS Auto lock release interval is not set properly. Given value is : " + strAutoLockInterval + ", defaults to - null", e);
}
}
Parameter strAutoLockReleaseSameNode = transportOut.getParameter(VFSConstants.TRANSPORT_AUTO_LOCK_RELEASE_SAME_NODE);
if (strAutoLockReleaseSameNode != null && strAutoLockReleaseSameNode.getValue() != null && !strAutoLockReleaseSameNode.getValue().toString().isEmpty()) {
try {
autoLockReleaseSameNode = Boolean.parseBoolean(strAutoLockReleaseSameNode.getValue().toString());
} catch (Exception e) {
autoLockReleaseSameNode = true;
log.warn("VFS Auto lock removal same node property not set properly. Given value is : " + autoLockReleaseSameNode + ", defaults to - " + autoLockReleaseSameNode, e);
}
}
}
}
vfsParamDTO = new VFSParamDTO();
vfsParamDTO.setAutoLockRelease(autoLockRelease);
vfsParamDTO.setAutoLockReleaseInterval(autoLockReleaseInterval);
vfsParamDTO.setAutoLockReleaseSameNode(autoLockReleaseSameNode);
} catch (FileSystemException e) {
handleException("Error initializing the file transport : " + e.getMessage(), e);
}
}
use of org.apache.axis2.description.TransportOutDescription in project wso2-synapse by wso2.
the class PassThroughHttpSenderTest method testInit.
/**
* This method tests the initialization of PassThroughHttpSender
* @throws Exception
*/
@Test
public void testInit() throws Exception {
ConfigurationContext configurationContext = new ConfigurationContext(new AxisConfiguration());
WorkerPool workerPool = new NativeWorkerPool(3, 4, 5, 5, "name", "id");
configurationContext.setProperty(PassThroughConstants.PASS_THROUGH_TRANSPORT_WORKER_POOL, workerPool);
TransportOutDescription transportOutDescription = new TransportOutDescription("passthru");
PassThroughHttpSender passThroughHttpSender = new PassThroughHttpSender();
passThroughHttpSender.init(configurationContext, transportOutDescription);
}
use of org.apache.axis2.description.TransportOutDescription in project wso2-synapse by wso2.
the class HttpTransportDescriptionFactory method createTransportOutDescription.
public TransportOutDescription createTransportOutDescription() throws Exception {
TransportOutDescription desc = new TransportOutDescription("http");
desc.setSender(new HttpCoreNIOSender());
return desc;
}
Aggregations