| 571 | | /* |
|---|
| 572 | | * Verify that a BaseDomain was selected |
|---|
| | 545 | |
|---|
| | 546 | protected void checkInput() |
|---|
| | 547 | { |
|---|
| | 548 | StructuredSelection sel = (StructuredSelection)m_combo.getSelection (); |
|---|
| | 549 | Rdef networkType = (Rdef)sel.getFirstElement (); |
|---|
| | 550 | |
|---|
| | 551 | if (networkType != null && |
|---|
| | 552 | (networkType.GetSysResourceState (SystemResourceTypes.ipsec) == SysResourceState.Yes || networkType.GetSysResourceState (SystemResourceTypes.ipsec) == SysResourceState.Optional)) |
|---|
| | 553 | { |
|---|
| | 554 | // required value |
|---|
| | 555 | if ( localIPAddress.length () == 0 ) |
|---|
| | 556 | { |
|---|
| | 557 | updateStatus ("Enter valid local IP address", false); |
|---|
| | 558 | return; |
|---|
| | 559 | } |
|---|
| | 560 | |
|---|
| | 561 | // this is optional value check only if it has any valid characters. |
|---|
| | 562 | if( localIPPorts.trim ().length () > 0 && |
|---|
| | 563 | (!Pattern.matches (NetworkResourceShape.NetworkResource_ip_ports_pattern, localIPPorts.trim ())) |
|---|
| | 564 | ) |
|---|
| | 565 | { |
|---|
| | 566 | updateStatus("Enter valid local port, multiple ports seperated by space", false); |
|---|
| | 567 | return; |
|---|
| | 568 | } |
|---|
| | 569 | |
|---|
| | 570 | { |
|---|
| | 571 | // all the required value check is complete |
|---|
| | 572 | // lets make sure that the value matches the requirement |
|---|
| | 573 | boolean match = Pattern.matches(NetworkResourceShape.NetworkResource_ip_address_pattern, localIPAddress.trim ()); |
|---|
| | 574 | boolean ip4 = Pattern.matches (NetworkResourceShape.NetworkResource_ipv4_address_pattern, localIPAddress.trim ()); |
|---|
| | 575 | boolean ip6 = Pattern.matches(NetworkResourceShape.NetworkResource_ipv6_address_pattern, localIPAddress.trim ()); |
|---|
| | 576 | |
|---|
| | 577 | if( ! (ip4 || ip6 || match) ) |
|---|
| | 578 | { |
|---|
| | 579 | updateStatus ("Enter valid local IP address", false); |
|---|
| | 580 | return; |
|---|
| | 581 | } |
|---|
| | 582 | } |
|---|
| | 583 | } |
|---|
| | 584 | else if (networkType != null && |
|---|
| | 585 | (networkType.GetSysResourceState (SystemResourceTypes.secmark) == SysResourceState.Yes || networkType.GetSysResourceState (SystemResourceTypes.secmark) == SysResourceState.Optional)) |
|---|
| | 586 | { |
|---|
| | 587 | |
|---|
| | 588 | if( localDevice.trim ().length () == 0 ) |
|---|
| | 589 | { |
|---|
| | 590 | updateStatus ("Enter valid local Device", false); |
|---|
| | 591 | return; |
|---|
| | 592 | } |
|---|
| | 593 | // local information |
|---|
| | 594 | if ( localIPAddress.trim ().length () == 0 ) |
|---|
| | 595 | { |
|---|
| | 596 | updateStatus ("Enter valid local IP address", false); |
|---|
| | 597 | return; |
|---|
| | 598 | } |
|---|
| | 599 | if ( localMask.trim ().length () > 0 |
|---|
| | 600 | && !Pattern.matches (NetworkResourceShape.NetworkResource_ipv4_address_pattern, localMask.trim ()) |
|---|
| | 601 | && !Pattern.matches(NetworkResourceShape.NetworkResource_ipv6_address_pattern, localMask.trim ()) |
|---|
| | 602 | ) |
|---|
| | 603 | { |
|---|
| | 604 | updateStatus ("Enter valid local Mask value", false); |
|---|
| | 605 | return; |
|---|
| | 606 | } |
|---|
| | 607 | if( localIPPorts.trim ().length () > 0 && |
|---|
| | 608 | (!Pattern.matches (NetworkResourceShape.NetworkResource_ip_ports_pattern, localIPPorts.trim ())) |
|---|
| | 609 | ) |
|---|
| | 610 | { |
|---|
| | 611 | updateStatus("Enter valid local ports, multiple ports seperated by space", false); |
|---|
| | 612 | return; |
|---|
| | 613 | } |
|---|
| | 614 | |
|---|
| | 615 | { |
|---|
| | 616 | boolean match = Pattern.matches(NetworkResourceShape.NetworkResource_ip_address_pattern, localIPAddress.trim ()); |
|---|
| | 617 | boolean ip4 = Pattern.matches (NetworkResourceShape.NetworkResource_ipv4_address_pattern, localIPAddress.trim ()); |
|---|
| | 618 | boolean ip6 = Pattern.matches(NetworkResourceShape.NetworkResource_ipv6_address_pattern, localIPAddress.trim ()); |
|---|
| | 619 | |
|---|
| | 620 | if( ! (ip4 || ip6 || match) ) |
|---|
| | 621 | { |
|---|
| | 622 | updateStatus ("Enter valid local IP address", false); |
|---|
| | 623 | return; |
|---|
| | 624 | } |
|---|
| | 625 | } |
|---|
| | 626 | |
|---|
| | 627 | |
|---|
| | 628 | // remote infomration all of them are optional |
|---|
| | 629 | if( remoteDevice.trim ().length () > 0 && remoteIPAddress.trim ().length () == 0) |
|---|
| | 630 | { |
|---|
| | 631 | updateStatus ("Enter valid remote IP Address", false); |
|---|
| | 632 | return; |
|---|
| | 633 | } |
|---|
| | 634 | if ( remoteIPAddress.trim ().length () > 0 && remoteDevice.trim ().length () == 0 ) |
|---|
| | 635 | { |
|---|
| | 636 | updateStatus ("Enter valid remote Device", false); |
|---|
| | 637 | return; |
|---|
| | 638 | } |
|---|
| | 639 | if ( remoteIPAddress.trim ().length () > 0 ) |
|---|
| | 640 | { |
|---|
| | 641 | boolean match = Pattern.matches(NetworkResourceShape.NetworkResource_ip_address_pattern, remoteIPAddress.trim ()); |
|---|
| | 642 | boolean ip4 = Pattern.matches (NetworkResourceShape.NetworkResource_ipv4_address_pattern, remoteIPAddress.trim ()); |
|---|
| | 643 | boolean ip6 = Pattern.matches(NetworkResourceShape.NetworkResource_ipv6_address_pattern, remoteIPAddress.trim ()); |
|---|
| | 644 | |
|---|
| | 645 | if( ! (ip4 || ip6 || match) ) |
|---|
| | 646 | { |
|---|
| | 647 | updateStatus ("Enter Valid remote IP address", false); |
|---|
| | 648 | return; |
|---|
| | 649 | } |
|---|
| | 650 | } |
|---|
| | 651 | if ( remoteMask.trim ().length () > 0 |
|---|
| | 652 | && !Pattern.matches (NetworkResourceShape.NetworkResource_ipv4_address_pattern, remoteMask.trim ()) |
|---|
| | 653 | && !Pattern.matches(NetworkResourceShape.NetworkResource_ipv6_address_pattern, remoteMask.trim ()) |
|---|
| | 654 | ) |
|---|
| | 655 | { |
|---|
| | 656 | updateStatus ("Enter valid remote Mask value", false); |
|---|
| | 657 | return; |
|---|
| | 658 | } |
|---|
| | 659 | if( remoteIPPorts.trim ().length () > 0 && |
|---|
| | 660 | (!Pattern.matches (NetworkResourceShape.NetworkResource_ip_ports_pattern, remoteIPPorts.trim ())) |
|---|
| | 661 | ) |
|---|
| | 662 | { |
|---|
| | 663 | updateStatus("Enter valid remote ports, multiple ports seperated by space", false); |
|---|
| | 664 | return; |
|---|
| | 665 | } |
|---|
| | 666 | |
|---|
| | 667 | } |
|---|
| | 668 | |
|---|
| | 669 | // no error go ahead and allow user to complete |
|---|
| | 670 | updateStatus (null, true); |
|---|
| | 671 | } |
|---|
| | 672 | |
|---|
| | 673 | /** |
|---|
| | 674 | * I had to copy stuff from the parent. |
|---|
| | 675 | * Never call super.DialogChanged(). That is not appropriate for this |
|---|
| | 676 | * wizard. |
|---|
| 576 | | updateStatus(); |
|---|
| 577 | | } |
|---|
| 578 | | |
|---|
| 579 | | protected void updateStatus() |
|---|
| 580 | | { |
|---|
| 581 | | super.DialogChanged (); |
|---|
| 582 | | |
|---|
| 583 | | if (this.getErrorMessage () == null) |
|---|
| 584 | | { |
|---|
| 585 | | if ((getNetworkType().GetSysResourceState (SystemResourceTypes.ipsec) == SysResourceState.Yes || getNetworkType().GetSysResourceState (SystemResourceTypes.ipsec) == SysResourceState.Optional)) |
|---|
| 586 | | { |
|---|
| 587 | | if (localIPAddress.trim ().length () == 0) |
|---|
| 588 | | super.updateStatus (Messages.NetworkResourcePropertyPage_bad_local_ip_address, false); |
|---|
| 589 | | } |
|---|
| 590 | | |
|---|
| 591 | | else if ((getNetworkType().GetSysResourceState (SystemResourceTypes.secmark) == SysResourceState.Yes || getNetworkType().GetSysResourceState (SystemResourceTypes.secmark) == SysResourceState.Optional)) |
|---|
| 592 | | { |
|---|
| 593 | | if (localDevice.trim ().length () == 0 && localIPAddress.trim ().length () == 0) |
|---|
| 594 | | super.updateStatus (Messages.NetworkResourcePropertyPage_err_local_device_or_ip, false); |
|---|
| 595 | | } |
|---|
| 596 | | } |
|---|
| | 680 | String name = getShapeName(); |
|---|
| | 681 | |
|---|
| | 682 | if (name == null || name.length() == 0) |
|---|
| | 683 | { |
|---|
| | 684 | m_errorMessage = NLS.bind (Messages.ShapePropertyPage_err1, getShape ().getType()); |
|---|
| | 685 | updateStatus(m_errorMessage, false); |
|---|
| | 686 | return; |
|---|
| | 687 | } |
|---|
| | 688 | |
|---|
| | 689 | //Need to test if name is valid |
|---|
| | 690 | m_errorMessage = getShape ().testValidity(name); |
|---|
| | 691 | |
|---|
| | 692 | if (m_errorMessage != null) |
|---|
| | 693 | { |
|---|
| | 694 | updateStatus(m_errorMessage, false); |
|---|
| | 695 | return; |
|---|
| | 696 | } |
|---|
| | 697 | |
|---|
| | 698 | // check all the fields. |
|---|
| | 699 | checkInput (); |
|---|