Search in sources :

Example 1 with TransportOutDescription

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;
}
Also used : QName(javax.xml.namespace.QName) Parameter(org.apache.axis2.description.Parameter) OMElement(org.apache.axiom.om.OMElement)

Example 2 with TransportOutDescription

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());
}
Also used : AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) ConfigurationContext(org.apache.axis2.context.ConfigurationContext) StandaloneSession(org.pentaho.platform.engine.core.system.StandaloneSession) StubTransportSender(org.pentaho.test.platform.plugin.services.webservices.StubTransportSender) SimpleOutputHandler(org.pentaho.platform.engine.core.output.SimpleOutputHandler) TransportInDescription(org.apache.axis2.description.TransportInDescription) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOutputHandler(org.pentaho.platform.api.engine.IOutputHandler) StubServiceSetup(org.pentaho.test.platform.plugin.services.webservices.StubServiceSetup) MimeTypeListener(org.pentaho.test.platform.plugin.services.webservices.MimeTypeListener) SimpleUrlFactory(org.pentaho.platform.util.web.SimpleUrlFactory) StubTransportListener(org.pentaho.test.platform.plugin.services.webservices.StubTransportListener) TransportOutDescription(org.apache.axis2.description.TransportOutDescription) Before(org.junit.Before)

Example 3 with TransportOutDescription

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);
    }
}
Also used : VFSParamDTO(org.apache.synapse.commons.vfs.VFSParamDTO) StandardFileSystemManager(org.apache.commons.vfs2.impl.StandardFileSystemManager) Parameter(org.apache.axis2.description.Parameter) IOException(java.io.IOException)

Example 4 with TransportOutDescription

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);
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) WorkerPool(org.apache.axis2.transport.base.threads.WorkerPool) NativeWorkerPool(org.apache.axis2.transport.base.threads.NativeWorkerPool) NativeWorkerPool(org.apache.axis2.transport.base.threads.NativeWorkerPool) TransportOutDescription(org.apache.axis2.description.TransportOutDescription) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 5 with 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;
}
Also used : TransportOutDescription(org.apache.axis2.description.TransportOutDescription)

Aggregations

TransportOutDescription (org.apache.axis2.description.TransportOutDescription)28 AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)20 Parameter (org.apache.axis2.description.Parameter)17 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)16 MessageContext (org.apache.axis2.context.MessageContext)11 AxisFault (org.apache.axis2.AxisFault)9 QName (javax.xml.namespace.QName)7 OMElement (org.apache.axiom.om.OMElement)6 AxisService (org.apache.axis2.description.AxisService)6 TransportInDescription (org.apache.axis2.description.TransportInDescription)6 IOException (java.io.IOException)4 Map (java.util.Map)4 ServiceContext (org.apache.axis2.context.ServiceContext)4 Test (org.junit.Test)4 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)4 HashMap (java.util.HashMap)3 OperationContext (org.apache.axis2.context.OperationContext)3 InOutAxisOperation (org.apache.axis2.description.InOutAxisOperation)3 OutTransportInfo (org.apache.axis2.transport.OutTransportInfo)3 VFSOutTransportInfo (org.apache.synapse.commons.vfs.VFSOutTransportInfo)3