Package java.lang

Examples of java.lang.String$ConsolePrintStream


                      // (filechooser)

  private String apri() { // Metodo che apre un file attraverso un filechooser

    int risposta = jfc.showOpenDialog(this); // Apre la finestra di dialogo
    String txtArea;
    char c;
    txtArea = new String(""); // Stringa che conterra' il file aperto
    int chInt = 0; // carattere temporaneo
    if (risposta == JFileChooser.APPROVE_OPTION) // Se ho premuto il tasto salva...
    {
      File InFile = jfc.getSelectedFile(); // apro il file selezionato
      FileReader freader;
View Full Code Here


    private String genStaticNatRuleName(String publicIp, String privateIp) {
        return genObjectName(genIpIdentifier(publicIp), genIpIdentifier(privateIp));
    }

    private boolean manageStaticNatRule(SrxCommand command, String publicIp, String privateIp) throws ExecutionException {
        String ruleName = genStaticNatRuleName(publicIp, privateIp);
        String xml;

        switch (command) {

        case CHECK_IF_EXISTS:
            xml = SrxXml.STATIC_NAT_RULE_GETONE.getXml();
View Full Code Here

    }
   
    private List<String[]> getStaticNatRules(RuleMatchCondition condition, String privateGateway, Long privateCidrSize) throws ExecutionException {            
        List<String[]> staticNatRules = new ArrayList<String[]>();

        String xmlRequest = SrxXml.STATIC_NAT_RULE_GETALL.getXml();
        String xmlResponse = sendRequest(xmlRequest);      
        Document doc = getDocument(xmlResponse);
        NodeList rules = doc.getElementsByTagName("rule");
        for (int i = 0; i < rules.getLength(); i++) {
            NodeList ruleEntries = rules.item(i).getChildNodes();              
            for (int j = 0; j < ruleEntries.getLength(); j++) {
                Node ruleEntry = ruleEntries.item(j);
                if (ruleEntry.getNodeName().equals("name")) {
                    String name = ruleEntry.getFirstChild().getNodeValue();
                    String[] nameContents = name.split("-");

                    if (nameContents.length != 8) {
                        continue;
                    }

                    String rulePublicIp = nameContents[0] + "." + nameContents[1] + "." + nameContents[2] + "." + nameContents[3];
                    String rulePrivateIp = nameContents[4] + "." + nameContents[5] + "." + nameContents[6] + "." + nameContents[7];

                    boolean addToList = false;
                    if (condition.equals(RuleMatchCondition.ALL)) {
                        addToList = true;
                    } else if (condition.equals(RuleMatchCondition.PRIVATE_SUBNET)) {
View Full Code Here

    private String genDestinationNatPoolName(String privateIp, long destPort) {
        return genObjectName(genIpIdentifier(privateIp), String.valueOf(destPort));
    }

    private boolean manageDestinationNatPool(SrxCommand command, String privateIp, long destPort) throws ExecutionException {
        String poolName = genDestinationNatPoolName(privateIp, destPort);
        String xml;

        switch (command) {

        case CHECK_IF_EXISTS:
            xml = SrxXml.DEST_NAT_POOL_GETONE.getXml();
View Full Code Here

    private String genDestinationNatRuleName(String publicIp, String privateIp, long srcPort, long destPort) {
        return "destnatrule-" + String.valueOf(genObjectName(publicIp, privateIp, String.valueOf(srcPort), String.valueOf(destPort)).hashCode()).replaceAll("[^a-zA-Z0-9]", "");
    }

    private boolean manageDestinationNatRule(SrxCommand command, String publicIp, String privateIp, long srcPort, long destPort) throws ExecutionException {
        String ruleName = genDestinationNatRuleName(publicIp, privateIp, srcPort, destPort);
        String poolName = genDestinationNatPoolName(privateIp, destPort);
        String xml;

        switch (command) {

        case CHECK_IF_EXISTS:
            xml = SrxXml.DEST_NAT_RULE_GETONE.getXml();
View Full Code Here

    }
   
    private List<String[]> getDestNatRules(RuleMatchCondition condition, String publicIp, String privateIp, String privateGateway, Long privateCidrSize) throws ExecutionException {
        List<String[]> destNatRules = new ArrayList<String[]>();

        String xmlRequest = SrxXml.DEST_NAT_RULE_GETALL.getXml();
        xmlRequest = replaceXmlValue(xmlRequest, "rule-set", _publicZone);
        String xmlResponse = sendRequest(xmlRequest);
        Document doc = getDocument(xmlResponse);
        NodeList rules = doc.getElementsByTagName("rule");
        for (int ruleIndex = 0; ruleIndex < rules.getLength(); ruleIndex++) {
            String rulePublicIp = null;
            String rulePrivateIp = null;
            String ruleSrcPort = null;
            String ruleDestPort = null;
            NodeList ruleEntries = rules.item(ruleIndex).getChildNodes();
            for (int ruleEntryIndex = 0; ruleEntryIndex < ruleEntries.getLength(); ruleEntryIndex++) {
                Node ruleEntry = ruleEntries.item(ruleEntryIndex);
                if (ruleEntry.getNodeName().equals("dest-nat-rule-match")) {
                    NodeList ruleMatchEntries = ruleEntry.getChildNodes();
View Full Code Here

    private String genSourceNatPoolName(String publicIp) {
        return genObjectName(genIpIdentifier(publicIp));
    }

    private boolean manageSourceNatPool(SrxCommand command, String publicIp) throws ExecutionException {
        String poolName = genSourceNatPoolName(publicIp);
        String xml;

        switch (command) {

        case CHECK_IF_EXISTS:
            xml = SrxXml.SRC_NAT_POOL_GETONE.getXml();
View Full Code Here

    private String genSourceNatRuleName(String publicIp, String privateSubnet) {
        return genObjectName(genIpIdentifier(publicIp), genIpIdentifier(privateSubnet));
    }

    private boolean manageSourceNatRule(SrxCommand command, String publicIp, String privateSubnet) throws ExecutionException {
        String ruleName = genSourceNatRuleName(publicIp, privateSubnet);
        String poolName = genSourceNatPoolName(publicIp);
        String xml;

        switch (command) {

        case CHECK_IF_EXISTS:
            xml = SrxXml.SRC_NAT_RULE_GETONE.getXml();
View Full Code Here

        if (entryName == null) {
          entryName = genAddressBookEntryName(ip);
        }

        String xml;

        switch (command) {

        case CHECK_IF_EXISTS:
            xml = SrxXml.ADDRESS_BOOK_ENTRY_GETONE.getXml();
            xml = setDelete(xml, false);
            xml = replaceXmlValue(xml, "zone", zone);
            xml = replaceXmlValue(xml, "entry-name", entryName);
            return sendRequestAndCheckResponse(command, xml, "name", entryName);

        case CHECK_IF_IN_USE:
            // Check if any security policies refer to this address book entry
            xml = SrxXml.SECURITY_POLICY_GETALL.getXml();
            String fromZone = zone.equals(_publicZone) ? _privateZone : _publicZone;
            xml = replaceXmlValue(xml, "from-zone", fromZone);
            xml = replaceXmlValue(xml, "to-zone", zone);
            return sendRequestAndCheckResponse(command, xml, "destination-address", entryName);

        case ADD:
View Full Code Here

            }
        }
    }

    private Object[] parseApplicationName(SecurityPolicyType type, String applicationName) throws ExecutionException {
        String errorMsg = "Invalid application: " + applicationName;
        String[] applicationComponents = applicationName.split("-");

        Protocol protocol;
        Integer startPort;
        Integer endPort;
View Full Code Here

TOP

Related Classes of java.lang.String$ConsolePrintStream

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.