| 658 | == Custom development == |
| 659 | |
| 660 | Custom code development for this proof of concept has been added to the following location: /srv/grouper_custom. |
| 661 | |
| 662 | Note that this should all probably get added to a UA source control repository. |
| 663 | |
| 664 | 1. The file conf/ua_buildings.properties contains the building information with the fields short name, long name, and campus name. There is one building per line and the fields are pipe separated. |
| 665 | |
| 666 | 2. The class src/edu/ua/iam/grouper/BuildingLoaderHelper.java contains logic to convert an officeLocation attribute value to a group name. The algorithm is: |
| 667 | |
| 668 | a) Check to see if the officeLocation value entirely matches a building short name. |
| 669 | |
| 670 | b) If a match is not found, remove the first word in the officeLocation value and check again. |
| 671 | |
| 672 | c) Repeat (b) until a match is found or there is nothing left to check. |
| 673 | |
| 674 | d) If no match is found, return "UNKNOWN" as the group name. |
| 675 | |
| 676 | e) If a match is found, return the campus name followed by the short name of the building (separated by a hyphen). |
| 677 | |
| 678 | 3. So for instance, all of the following officeLocation values translate to the Grouper group "ua:inst:buildings:groups:UAF Main Campus - BUTRO": |
| 679 | |
| 680 | {{{ |
| 681 | officeLocation: 211 BUTRO |
| 682 | officeLocation: 211 BUTRO BUTRO |
| 683 | officeLocation: BUTRO |
| 684 | officeLocation: Suite 001 BUTRO |
| 685 | }}} |
| 686 | |
| 687 | 4. The custom code can be deployed by simply running 'ant'. This will copy both the properties file and the code into the Grouper API installation. |
| 688 | |
| 689 | {{{ |
| 690 | [root@grinnell grouper_custom]# cd /srv/grouper_custom/ |
| 691 | [root@grinnell grouper_custom]# ant |
| 692 | Buildfile: build.xml |
| 693 | |
| 694 | init: |
| 695 | |
| 696 | clean: |
| 697 | [delete] Deleting directory /srv/grouper_custom/build |
| 698 | [delete] Deleting: /srv/grouper_custom/dist/lib/grouper_custom.jar |
| 699 | |
| 700 | prepare: |
| 701 | [mkdir] Created dir: /srv/grouper_custom/build |
| 702 | |
| 703 | prepare-src: |
| 704 | [mkdir] Created dir: /srv/grouper_custom/build/src |
| 705 | [mkdir] Created dir: /srv/grouper_custom/build/classes |
| 706 | [copy] Copying 1 file to /srv/grouper_custom/build/src |
| 707 | |
| 708 | build: |
| 709 | [javac] Compiling 1 source file to /srv/grouper_custom/build/classes |
| 710 | |
| 711 | jar: |
| 712 | [jar] Building jar: /srv/grouper_custom/dist/lib/grouper_custom.jar |
| 713 | |
| 714 | all: |
| 715 | [copy] Copying 1 file to /srv/grouper/grouper.api-2.1.4/lib/custom |
| 716 | |
| 717 | BUILD SUCCESSFUL |
| 718 | Total time: 1 second |
| 719 | [root@grinnell grouper_custom]# |
| 720 | }}} |
| 721 | |