Package org.mule.api.endpoint

Examples of org.mule.api.endpoint.EndpointURI


    protected void recursiveDelete(MuleClient muleClient,
                                   SftpClient sftpClient,
                                   String endpointName,
                                   String relativePath) throws IOException
    {
        EndpointURI endpointURI = getUriByEndpointName(muleClient, endpointName);
        String path = endpointURI.getPath() + relativePath;

        try
        {
            // Ensure that we can delete the current directory and the below
            // directories (if write is not permitted then delete is either)
View Full Code Here


    {
        SftpClient sftpClient = getSftpClient(muleClient, endpointName);

        try
        {
            EndpointURI endpointURI = getUriByEndpointName(muleClient, endpointName);
            sftpClient.changeWorkingDirectory(sftpClient.getAbsolutePath(endpointURI.getPath()));

            try
            {
                sftpClient.mkdir(directoryName);
            }
            catch (IOException e)
            {
                e.printStackTrace();
                // Expected if the directory didnt exist
            }

            try
            {
                sftpClient.changeWorkingDirectory(endpointURI.getPath() + "/" + directoryName);
            }
            catch (IOException e)
            {
                fail("The directory should have been created");
            }
View Full Code Here

     * @return the endpoint address in the form 'sftp://user:password@host/path'
     */
    protected String getAddressByEndpoint(MuleClient muleClient, String endpointName)
    {
        ImmutableEndpoint endpoint = (ImmutableEndpoint) muleClient.getProperty(endpointName);
        EndpointURI endpointURI = endpoint.getEndpointURI();

        return "sftp://" + endpointURI.getUser() + ":" + endpointURI.getPassword() + "@"
               + endpointURI.getHost() + endpointURI.getPath();
    }
View Full Code Here

    }

    protected String getPathByEndpoint(MuleClient muleClient, SftpClient sftpClient, String endpointName)
    {
        ImmutableEndpoint endpoint = (ImmutableEndpoint) muleClient.getProperty(endpointName);
        EndpointURI endpointURI = endpoint.getEndpointURI();

        return sftpClient.getAbsolutePath(endpointURI.getPath());
    }
View Full Code Here

     * @throws IOException
     */
    protected SftpClient getSftpClient(MuleClient muleClient, String endpointName) throws IOException
    {
        ImmutableEndpoint endpoint = getImmutableEndpoint(muleClient, endpointName);
        EndpointURI endpointURI = endpoint.getEndpointURI();
        SftpClient sftpClient = new SftpClient(endpointURI.getHost());

        SftpConnector sftpConnector = (SftpConnector) endpoint.getConnector();

        if (sftpConnector.getIdentityFile() != null)
        {
            try
            {
                sftpClient.login(endpointURI.getUser(), sftpConnector.getIdentityFile(),
                    sftpConnector.getPassphrase());
            }
            catch (Exception e)
            {
                fail("Login failed: " + e);
            }
        }
        else
        {
            try
            {
                sftpClient.login(endpointURI.getUser(), endpointURI.getPassword());
            }
            catch (Exception e)
            {
                fail("Login failed: " + e);
            }
View Full Code Here

                               int permissions) throws SftpException
    {
        ChannelSftp channelSftp = sftpClient.getChannelSftp();

        ImmutableEndpoint endpoint = (ImmutableEndpoint) muleClient.getProperty(endpointName);
        EndpointURI endpointURI = endpoint.getEndpointURI();

        // RW - so that we can do initial cleanup
        channelSftp.chmod(permissions, sftpClient.getAbsolutePath(endpointURI.getPath()));
    }
View Full Code Here

        String rmiPolicyPath = this.connector.getSecurityPolicy();

        System.setProperty("java.security.policy", rmiPolicyPath);

        EndpointURI endpointUri = endpoint.getEndpointURI();

        port = endpointUri.getPort();

        if (port < 1)
        {
            port = RmiConnector.DEFAULT_RMI_muleRegistry_PORT;
        }
View Full Code Here

    public void testGlobalEndpoint() throws Exception
    {
        ImmutableEndpoint endpoint = muleContext.getEndpointFactory().getInboundEndpoint("vmEndpoint");
        assertNotNull(endpoint);
        EndpointURI uri = endpoint.getEndpointURI();
        assertNotNull(uri);
        String address = uri.getAddress();
        assertEquals(address, "queue");
    }
View Full Code Here

     * @throws ClassNotFoundException
     */
    public Method getMethodObject(Remote remoteObject, MuleEvent event, OutboundEndpoint outboundEndpoint)
        throws MuleException, NoSuchMethodException, ClassNotFoundException
    {
        EndpointURI endpointUri = outboundEndpoint.getEndpointURI();
        String methodName = MapUtils.getString(endpointUri.getParams(), MuleProperties.MULE_METHOD_PROPERTY,
            null);

        if (null == methodName)
        {
            methodName = (String)event.getMessage().removeProperty(MuleProperties.MULE_METHOD_PROPERTY, PropertyScope.INVOCATION);
View Full Code Here

    protected Object getRemoteRef(ImmutableEndpoint endpoint)
        throws IOException, NotBoundException, NamingException, InitialisationException
    {

        EndpointURI endpointUri = endpoint.getEndpointURI();

        String serviceName = endpointUri.getPath();
        try
        {
            // Test if we can find the object locally
            return getJndiContext().lookup(serviceName);
        }
        catch (NamingException e)
        {
            // Strip path seperator
        }

        try
        {
            serviceName = serviceName.substring(1);
            return getJndiContext().lookup(serviceName);
        }
        catch (NamingException e)
        {
            // Try with full host and path
        }

        int port = endpointUri.getPort();
        if (port < 1)
        {
            if (logger.isWarnEnabled())
            {
                logger.warn("RMI port not set on URI: " + endpointUri + ". Using default port: "
                            + RmiConnector.DEFAULT_RMI_muleRegistry_PORT);
            }
            port = RmiConnector.DEFAULT_RMI_muleRegistry_PORT;
        }

        InetAddress inetAddress = InetAddress.getByName(endpointUri.getHost());

        return getJndiContext(inetAddress.getHostAddress() + ":" + port).lookup(serviceName);
    }
View Full Code Here

TOP

Related Classes of org.mule.api.endpoint.EndpointURI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.