Package com.microsoft.windowsazure.management.network.models

Examples of com.microsoft.windowsazure.management.network.models.NetworkListResponse$Connection


    }

    @Test
    public void testWithGanymede() throws Exception {
        // begin client config
        final Connection conn = new Connection("localhost", port);
        conn.connect(null, 5000, 0);
        conn.authenticateWithPassword("sshd", "sshd");
        final SCPClient scp_client = new SCPClient(conn);
        final Properties props = new Properties();
        props.setProperty("test", "test-passed");
        File f = new File("target/scp/gan");
        Utils.deleteRecursive(f);
        f.mkdirs();
        assertTrue(f.exists());

        String name = "test.properties";
        scp_client.put(toBytes(props, ""), name, "target/scp/gan");
        assertTrue(new File(f, name).exists());
        assertTrue(new File(f, name).delete());

        name = "test2.properties";
        scp_client.put(toBytes(props, ""), name, "target/scp/gan");
        assertTrue(new File(f, name).exists());
        assertTrue(new File(f, name).delete());

        assertTrue(f.delete());
        conn.close();
    }
View Full Code Here


    }

    @Test
    public void testWithGanymede() throws Exception {
        // begin client config
        final Connection conn = new Connection("localhost", port);
        conn.connect(null, 5000, 0);
        conn.authenticateWithPassword("sshd", "sshd");
        final SCPClient scp_client = new SCPClient(conn);
        final Properties props = new Properties();
        props.setProperty("test", "test-passed");
        File f = new File("target/scp/gan");
        Utils.deleteRecursive(f);
        f.mkdirs();
        assertTrue(f.exists());

        String name = "test.properties";
        scp_client.put(toBytes(props, ""), name, "target/scp/gan");
        assertTrue(new File(f, name).exists());
        assertTrue(new File(f, name).delete());

        name = "test2.properties";
        scp_client.put(toBytes(props, ""), name, "target/scp/gan");
        assertTrue(new File(f, name).exists());
        assertTrue(new File(f, name).delete());

        assertTrue(f.delete());
        conn.close();
    }
View Full Code Here

    /** {@inheritDoc} */
    public void open()
        throws AuthenticationException, CommandAbortedException
    {
        connection = new Connection( host, port );

        /* TODO: add proxy support
        ProxyData proxy = new HTTPProxyData( proxyHost, proxyPort, proxyUserName, proxyPassword );

        connection.setProxyData( proxy );
View Full Code Here

    }

    @Test
    public void testWithGanymede() throws Exception {
        // begin client config
        final Connection conn = new Connection("localhost", port);
        conn.connect(null, 5000, 0);
        conn.authenticateWithPassword("sshd", "sshd");
        final SCPClient scp_client = new SCPClient(conn);
        final Properties props = new Properties();
        props.setProperty("test", "test-passed");
        File f = new File("target/scp/gan");
        scp_client.put(toBytes(props, ""), "test.properties", "target/scp/gan");
        assertTrue(f.exists());
        scp_client.put(toBytes(props, ""), "test2.properties", "target/scp/gan");
        assertTrue(f.exists());
        f.delete();
        conn.close();
    }
View Full Code Here

    this.username = ini.getProperty("sshuser");
    this.password = ini.getProperty("sshpass");

    try {
      /* Create a connection instance */
      conn = new Connection(hostname);

      /* Now connect */
      conn.connect();
      boolean isAuthenticated = conn.authenticateWithPassword(username,
          password);
View Full Code Here

    this.username = username;
    this.password = password;
    try {
      /* Create a connection instance */

      conn = new Connection(hostname);

      /* Now connect */

      conn.connect();

 
View Full Code Here

                }
                throw ex;
            }
           
            // Create Result
            NetworkListResponse result = null;
            // Deserialize Response
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new NetworkListResponse();
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
           
            Element virtualNetworkSitesSequenceElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "VirtualNetworkSites");
            if (virtualNetworkSitesSequenceElement != null) {
                for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(virtualNetworkSitesSequenceElement, "http://schemas.microsoft.com/windowsazure", "VirtualNetworkSite").size(); i1 = i1 + 1) {
                    org.w3c.dom.Element virtualNetworkSitesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(virtualNetworkSitesSequenceElement, "http://schemas.microsoft.com/windowsazure", "VirtualNetworkSite").get(i1));
                    NetworkListResponse.VirtualNetworkSite virtualNetworkSiteInstance = new NetworkListResponse.VirtualNetworkSite();
                    result.getVirtualNetworkSites().add(virtualNetworkSiteInstance);
                   
                    Element nameElement = XmlUtility.getElementByTagNameNS(virtualNetworkSitesElement, "http://schemas.microsoft.com/windowsazure", "Name");
                    if (nameElement != null) {
                        String nameInstance;
                        nameInstance = nameElement.getTextContent();
                        virtualNetworkSiteInstance.setName(nameInstance);
                    }
                   
                    Element labelElement = XmlUtility.getElementByTagNameNS(virtualNetworkSitesElement, "http://schemas.microsoft.com/windowsazure", "Label");
                    if (labelElement != null) {
                        String labelInstance;
                        labelInstance = labelElement.getTextContent();
                        virtualNetworkSiteInstance.setLabel(labelInstance);
                    }
                   
                    Element idElement = XmlUtility.getElementByTagNameNS(virtualNetworkSitesElement, "http://schemas.microsoft.com/windowsazure", "Id");
                    if (idElement != null) {
                        String idInstance;
                        idInstance = idElement.getTextContent();
                        virtualNetworkSiteInstance.setId(idInstance);
                    }
                   
                    Element affinityGroupElement = XmlUtility.getElementByTagNameNS(virtualNetworkSitesElement, "http://schemas.microsoft.com/windowsazure", "AffinityGroup");
                    if (affinityGroupElement != null) {
                        String affinityGroupInstance;
                        affinityGroupInstance = affinityGroupElement.getTextContent();
                        virtualNetworkSiteInstance.setAffinityGroup(affinityGroupInstance);
                    }
                   
                    Element stateElement = XmlUtility.getElementByTagNameNS(virtualNetworkSitesElement, "http://schemas.microsoft.com/windowsazure", "State");
                    if (stateElement != null) {
                        String stateInstance;
                        stateInstance = stateElement.getTextContent();
                        virtualNetworkSiteInstance.setState(stateInstance);
                    }
                   
                    Element addressSpaceElement = XmlUtility.getElementByTagNameNS(virtualNetworkSitesElement, "http://schemas.microsoft.com/windowsazure", "AddressSpace");
                    if (addressSpaceElement != null) {
                        NetworkListResponse.AddressSpace addressSpaceInstance = new NetworkListResponse.AddressSpace();
                        virtualNetworkSiteInstance.setAddressSpace(addressSpaceInstance);
                       
                        Element addressPrefixesSequenceElement = XmlUtility.getElementByTagNameNS(addressSpaceElement, "http://schemas.microsoft.com/windowsazure", "AddressPrefixes");
                        if (addressPrefixesSequenceElement != null) {
                            for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(addressPrefixesSequenceElement, "http://schemas.microsoft.com/windowsazure", "AddressPrefix").size(); i2 = i2 + 1) {
                                org.w3c.dom.Element addressPrefixesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(addressPrefixesSequenceElement, "http://schemas.microsoft.com/windowsazure", "AddressPrefix").get(i2));
                                addressSpaceInstance.getAddressPrefixes().add(addressPrefixesElement.getTextContent());
                            }
                        }
                    }
                   
                    Element subnetsSequenceElement = XmlUtility.getElementByTagNameNS(virtualNetworkSitesElement, "http://schemas.microsoft.com/windowsazure", "Subnets");
                    if (subnetsSequenceElement != null) {
                        for (int i3 = 0; i3 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "Subnet").size(); i3 = i3 + 1) {
                            org.w3c.dom.Element subnetsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(subnetsSequenceElement, "http://schemas.microsoft.com/windowsazure", "Subnet").get(i3));
                            NetworkListResponse.Subnet subnetInstance = new NetworkListResponse.Subnet();
                            virtualNetworkSiteInstance.getSubnets().add(subnetInstance);
                           
                            Element nameElement2 = XmlUtility.getElementByTagNameNS(subnetsElement, "http://schemas.microsoft.com/windowsazure", "Name");
                            if (nameElement2 != null) {
                                String nameInstance2;
                                nameInstance2 = nameElement2.getTextContent();
                                subnetInstance.setName(nameInstance2);
                            }
                           
                            Element addressPrefixElement = XmlUtility.getElementByTagNameNS(subnetsElement, "http://schemas.microsoft.com/windowsazure", "AddressPrefix");
                            if (addressPrefixElement != null) {
                                String addressPrefixInstance;
                                addressPrefixInstance = addressPrefixElement.getTextContent();
                                subnetInstance.setAddressPrefix(addressPrefixInstance);
                            }
                        }
                    }
                   
                    Element dnsElement = XmlUtility.getElementByTagNameNS(virtualNetworkSitesElement, "http://schemas.microsoft.com/windowsazure", "Dns");
                    if (dnsElement != null) {
                        Element dnsServersSequenceElement = XmlUtility.getElementByTagNameNS(dnsElement, "http://schemas.microsoft.com/windowsazure", "DnsServers");
                        if (dnsServersSequenceElement != null) {
                            for (int i4 = 0; i4 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(dnsServersSequenceElement, "http://schemas.microsoft.com/windowsazure", "DnsServer").size(); i4 = i4 + 1) {
                                org.w3c.dom.Element dnsServersElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(dnsServersSequenceElement, "http://schemas.microsoft.com/windowsazure", "DnsServer").get(i4));
                                NetworkListResponse.DnsServer dnsServerInstance = new NetworkListResponse.DnsServer();
                                virtualNetworkSiteInstance.getDnsServers().add(dnsServerInstance);
                               
                                Element nameElement3 = XmlUtility.getElementByTagNameNS(dnsServersElement, "http://schemas.microsoft.com/windowsazure", "Name");
                                if (nameElement3 != null) {
                                    String nameInstance3;
                                    nameInstance3 = nameElement3.getTextContent();
                                    dnsServerInstance.setName(nameInstance3);
                                }
                               
                                Element addressElement = XmlUtility.getElementByTagNameNS(dnsServersElement, "http://schemas.microsoft.com/windowsazure", "Address");
                                if (addressElement != null) {
                                    InetAddress addressInstance;
                                    addressInstance = InetAddress.getByName(addressElement.getTextContent());
                                    dnsServerInstance.setAddress(addressInstance);
                                }
                            }
                        }
                    }
                   
                    Element gatewayElement = XmlUtility.getElementByTagNameNS(virtualNetworkSitesElement, "http://schemas.microsoft.com/windowsazure", "Gateway");
                    if (gatewayElement != null) {
                        NetworkListResponse.Gateway gatewayInstance = new NetworkListResponse.Gateway();
                        virtualNetworkSiteInstance.setGateway(gatewayInstance);
                       
                        Element profileElement = XmlUtility.getElementByTagNameNS(gatewayElement, "http://schemas.microsoft.com/windowsazure", "Profile");
                        if (profileElement != null) {
                            GatewayProfile profileInstance;
                            profileInstance = GatewayProfile.valueOf(profileElement.getTextContent());
                            gatewayInstance.setProfile(profileInstance);
                        }
                       
                        Element sitesSequenceElement = XmlUtility.getElementByTagNameNS(gatewayElement, "http://schemas.microsoft.com/windowsazure", "Sites");
                        if (sitesSequenceElement != null) {
                            for (int i5 = 0; i5 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(sitesSequenceElement, "http://schemas.microsoft.com/windowsazure", "LocalNetworkSite").size(); i5 = i5 + 1) {
                                org.w3c.dom.Element sitesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(sitesSequenceElement, "http://schemas.microsoft.com/windowsazure", "LocalNetworkSite").get(i5));
                                NetworkListResponse.LocalNetworkSite localNetworkSiteInstance = new NetworkListResponse.LocalNetworkSite();
                                gatewayInstance.getSites().add(localNetworkSiteInstance);
                               
                                Element nameElement4 = XmlUtility.getElementByTagNameNS(sitesElement, "http://schemas.microsoft.com/windowsazure", "Name");
                                if (nameElement4 != null) {
                                    String nameInstance4;
                                    nameInstance4 = nameElement4.getTextContent();
                                    localNetworkSiteInstance.setName(nameInstance4);
                                }
                               
                                Element vpnGatewayAddressElement = XmlUtility.getElementByTagNameNS(sitesElement, "http://schemas.microsoft.com/windowsazure", "VpnGatewayAddress");
                                if (vpnGatewayAddressElement != null) {
                                    InetAddress vpnGatewayAddressInstance;
                                    vpnGatewayAddressInstance = InetAddress.getByName(vpnGatewayAddressElement.getTextContent());
                                    localNetworkSiteInstance.setVpnGatewayAddress(vpnGatewayAddressInstance);
                                }
                               
                                Element addressSpaceElement2 = XmlUtility.getElementByTagNameNS(sitesElement, "http://schemas.microsoft.com/windowsazure", "AddressSpace");
                                if (addressSpaceElement2 != null) {
                                    NetworkListResponse.AddressSpace addressSpaceInstance2 = new NetworkListResponse.AddressSpace();
                                    localNetworkSiteInstance.setAddressSpace(addressSpaceInstance2);
                                   
                                    Element addressPrefixesSequenceElement2 = XmlUtility.getElementByTagNameNS(addressSpaceElement2, "http://schemas.microsoft.com/windowsazure", "AddressPrefixes");
                                    if (addressPrefixesSequenceElement2 != null) {
                                        for (int i6 = 0; i6 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(addressPrefixesSequenceElement2, "http://schemas.microsoft.com/windowsazure", "AddressPrefix").size(); i6 = i6 + 1) {
                                            org.w3c.dom.Element addressPrefixesElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(addressPrefixesSequenceElement2, "http://schemas.microsoft.com/windowsazure", "AddressPrefix").get(i6));
                                            addressSpaceInstance2.getAddressPrefixes().add(addressPrefixesElement2.getTextContent());
                                        }
                                    }
                                }
                               
                                Element connectionsSequenceElement = XmlUtility.getElementByTagNameNS(sitesElement, "http://schemas.microsoft.com/windowsazure", "Connections");
                                if (connectionsSequenceElement != null) {
                                    for (int i7 = 0; i7 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(connectionsSequenceElement, "http://schemas.microsoft.com/windowsazure", "Connection").size(); i7 = i7 + 1) {
                                        org.w3c.dom.Element connectionsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(connectionsSequenceElement, "http://schemas.microsoft.com/windowsazure", "Connection").get(i7));
                                        NetworkListResponse.Connection connectionInstance = new NetworkListResponse.Connection();
                                        localNetworkSiteInstance.getConnections().add(connectionInstance);
                                       
                                        Element typeElement = XmlUtility.getElementByTagNameNS(connectionsElement, "http://schemas.microsoft.com/windowsazure", "Type");
                                        if (typeElement != null) {
                                            LocalNetworkConnectionType typeInstance;
                                            typeInstance = NetworkManagementClientImpl.parseLocalNetworkConnectionType(typeElement.getTextContent());
                                            connectionInstance.setType(typeInstance);
                                        }
                                    }
                                }
                            }
                        }
                       
                        Element vPNClientAddressPoolElement = XmlUtility.getElementByTagNameNS(gatewayElement, "http://schemas.microsoft.com/windowsazure", "VPNClientAddressPool");
                        if (vPNClientAddressPoolElement != null) {
                            NetworkListResponse.VPNClientAddressPool vPNClientAddressPoolInstance = new NetworkListResponse.VPNClientAddressPool();
                            gatewayInstance.setVPNClientAddressPool(vPNClientAddressPoolInstance);
                           
                            Element addressPrefixesSequenceElement3 = XmlUtility.getElementByTagNameNS(vPNClientAddressPoolElement, "http://schemas.microsoft.com/windowsazure", "AddressPrefixes");
                            if (addressPrefixesSequenceElement3 != null) {
                                for (int i8 = 0; i8 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(addressPrefixesSequenceElement3, "http://schemas.microsoft.com/windowsazure", "AddressPrefix").size(); i8 = i8 + 1) {
                                    org.w3c.dom.Element addressPrefixesElement3 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(addressPrefixesSequenceElement3, "http://schemas.microsoft.com/windowsazure", "AddressPrefix").get(i8));
                                    vPNClientAddressPoolInstance.getAddressPrefixes().add(addressPrefixesElement3.getTextContent());
                                }
                            }
                        }
                    }
                }
            }
           
            result.setStatusCode(statusCode);
            if (httpResponse.getHeaders("x-ms-request-id").length > 0) {
                result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue());
            }
           
            if (shouldTrace) {
                CloudTracing.exit(invocationId, result);
            }
View Full Code Here

   */
  protected Connection getBaseAuthentication() throws Exception {

    try { // to connect and authenticate
      boolean isAuthenticated = false;
      this.setSshConnection(new Connection(this.host, this.port));

      if (proxyHost != null && this.proxyHost.length() > 0) {
        if (this.proxyUser != null && this.proxyUser.length() > 0) {
          this.getSshConnection().setProxyData(new HTTPProxyData(this.proxyHost, this.proxyPort));
        }
View Full Code Here

    @SuppressWarnings("unused")
    final String conMethodName = conClassName + "::Connect";

    try {
      isConnected = false;
      this.setSshConnection(new Connection(pstrHostName, pintPortNumber));

    }
    catch (Exception e) {
      if (this.getSshConnection() != null)
        try {
View Full Code Here

    try {
      isConnected = false;
      String strHostName = objCO.getHost().Value();
      int intPortNo = objCO.getPort().value();
      this.setSshConnection(new Connection(strHostName, intPortNo));

      if (objCO.getProxy_host().IsNotEmpty()) {
        HTTPProxyData objProxy = null;
        if (objCO.getProxy_user().IsEmpty()) {
          objProxy = new HTTPProxyData(objCO.getProxy_host().Value(), objCO.getProxy_port().value());
View Full Code Here

TOP

Related Classes of com.microsoft.windowsazure.management.network.models.NetworkListResponse$Connection

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.