1 <?xml version='1.0' encoding='UTF-8'?>
   2 <!--   
   3    Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
   4    
   5    DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   6    
   7    The contents of this file are subject to the terms of either the Universal Permissive License 
   8    v 1.0 as shown at http://oss.oracle.com/licenses/upl
   9    
  10    or the following license:
  11    
  12    Redistribution and use in source and binary forms, with or without modification, are permitted
  13    provided that the following conditions are met:
  14    
  15    1. Redistributions of source code must retain the above copyright notice, this list of conditions
  16    and the following disclaimer.
  17    
  18    2. Redistributions in binary form must reproduce the above copyright notice, this list of
  19    conditions and the following disclaimer in the documentation and/or other materials provided with
  20    the distribution.
  21    
  22    3. Neither the name of the copyright holder nor the names of its contributors may be used to
  23    endorse or promote products derived from this software without specific prior written permission.
  24    
  25    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  26    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  27    FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
  28    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  30    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  31    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
  32    WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33 -->
  34 <schema targetNamespace="org.openjdk.jmc.rjmx" xmlns="http://www.w3.org/2001/XMLSchema">
  35 <annotation>
  36       <appinfo>
  37          <meta.schema plugin="org.openjdk.jmc.rjmx" id="triggerActions" name="Trigger Actions"/>
  38       </appinfo>
  39       <documentation>
  40          This extension point is used to add new trigger actions to the JMX Console.
  41       </documentation>
  42    </annotation>
  43 
  44    <element name="extension">
  45       <annotation>
  46          <appinfo>
  47             <meta.element />
  48          </appinfo>
  49          <documentation>
  50             A trigger action must have an id, name, description and a class that extends &lt;code&gt;org.openjdk.jmc.rjmx.triggers.TriggerAction &lt;/code&gt;. 
  51 
  52 It may also define settings of various types(string, file, boolean, integer, date or time) that can be configured in the JMX Console user interface.
  53          </documentation>
  54       </annotation>
  55       <complexType>
  56          <sequence>
  57             <element ref="triggerAction" minOccurs="1" maxOccurs="unbounded"/>
  58          </sequence>
  59          <attribute name="point" type="string" use="required">
  60             <annotation>
  61                <documentation>
  62                   
  63                </documentation>
  64             </annotation>
  65          </attribute>
  66          <attribute name="id" type="string">
  67             <annotation>
  68                <documentation>
  69                   
  70                </documentation>
  71             </annotation>
  72          </attribute>
  73          <attribute name="name" type="string">
  74             <annotation>
  75                <documentation>
  76                   
  77                </documentation>
  78             </annotation>
  79          </attribute>
  80       </complexType>
  81    </element>
  82 
  83    <element name="triggerAction">
  84       <annotation>
  85          <appinfo>
  86             <meta.element labelAttribute="name" icon="icon"/>
  87          </appinfo>
  88       </annotation>
  89       <complexType>
  90          <sequence>
  91             <element ref="string" minOccurs="0" maxOccurs="unbounded"/>
  92             <element ref="file" minOccurs="0" maxOccurs="unbounded"/>
  93             <element ref="boolean" minOccurs="0" maxOccurs="unbounded"/>
  94             <element ref="integer" minOccurs="0" maxOccurs="unbounded"/>
  95             <element ref="date" minOccurs="0" maxOccurs="unbounded"/>
  96             <element ref="time" minOccurs="0" maxOccurs="unbounded"/>
  97             <element ref="float" minOccurs="0" maxOccurs="unbounded"/>
  98             <element ref="timerange" minOccurs="0" maxOccurs="unbounded"/>
  99             <element ref="password" minOccurs="0" maxOccurs="unbounded"/>
 100          </sequence>
 101          <attribute name="id" type="string" use="required">
 102             <annotation>
 103                <documentation>
 104                   a unique identifier for this action.
 105                </documentation>
 106             </annotation>
 107          </attribute>
 108          <attribute name="name" type="string" use="required">
 109             <annotation>
 110                <documentation>
 111                   the name of the action
 112                </documentation>
 113                <appinfo>
 114                   <meta.attribute translatable="true"/>
 115                </appinfo>
 116             </annotation>
 117          </attribute>
 118          <attribute name="description" type="string" use="required">
 119             <annotation>
 120                <documentation>
 121                   the description of the action
 122                </documentation>
 123                <appinfo>
 124                   <meta.attribute translatable="true"/>
 125                </appinfo>
 126             </annotation>
 127          </attribute>
 128          <attribute name="icon" type="string">
 129             <annotation>
 130                <documentation>
 131                   the icon for the action
 132                </documentation>
 133                <appinfo>
 134                   <meta.attribute kind="resource"/>
 135                </appinfo>
 136             </annotation>
 137          </attribute>
 138          <attribute name="class" type="string" use="required">
 139             <annotation>
 140                <documentation>
 141                   class that extends &lt;code&gt;org.openjdk.jmc.rjmx.triggers.TriggerAction&lt;/code&gt; and that implements the method &lt;code&gt;handleNotificationEvent(NotificationEvent e)&lt;/code&gt; that will execute when a trigger is triggered.
 142                </documentation>
 143                <appinfo>
 144                   <meta.attribute kind="java" basedOn="org.openjdk.jmc.rjmx.triggers.TriggerAction"/>
 145                </appinfo>
 146             </annotation>
 147          </attribute>
 148       </complexType>
 149    </element>
 150 
 151    <element name="date">
 152       <annotation>
 153          <documentation>
 154             Date setting for a trigger action.
 155          </documentation>
 156       </annotation>
 157       <complexType>
 158          <attribute name="id" type="string" use="required">
 159             <annotation>
 160                <documentation>
 161                   a unique identifier for this setting
 162                </documentation>
 163             </annotation>
 164          </attribute>
 165          <attribute name="name" type="string" use="required">
 166             <annotation>
 167                <documentation>
 168                   the name of the setting
 169                </documentation>
 170                <appinfo>
 171                   <meta.attribute translatable="true"/>
 172                </appinfo>
 173             </annotation>
 174          </attribute>
 175          <attribute name="description" type="string">
 176             <annotation>
 177                <documentation>
 178                   the description of the setting
 179                </documentation>
 180                <appinfo>
 181                   <meta.attribute translatable="true"/>
 182                </appinfo>
 183             </annotation>
 184          </attribute>
 185          <attribute name="value" type="string">
 186             <annotation>
 187                <documentation>
 188                   the default value
 189                </documentation>
 190             </annotation>
 191          </attribute>
 192          <attribute name="preference" type="boolean">
 193             <annotation>
 194                <documentation>
 195                   set to true if the default value should be fetched from the preference store for the RJMXPlugin using the id as a key.
 196                </documentation>
 197             </annotation>
 198          </attribute>
 199       </complexType>
 200    </element>
 201 
 202    <element name="time">
 203       <annotation>
 204          <documentation>
 205             Time setting for a trigger action.
 206          </documentation>
 207       </annotation>
 208       <complexType>
 209          <attribute name="id" type="string" use="required">
 210             <annotation>
 211                <documentation>
 212                   a unique identifier for this setting
 213                </documentation>
 214             </annotation>
 215          </attribute>
 216          <attribute name="name" type="string" use="required">
 217             <annotation>
 218                <documentation>
 219                   the name of the setting
 220                </documentation>
 221                <appinfo>
 222                   <meta.attribute translatable="true"/>
 223                </appinfo>
 224             </annotation>
 225          </attribute>
 226          <attribute name="description" type="string">
 227             <annotation>
 228                <documentation>
 229                   the description of the setting
 230                </documentation>
 231                <appinfo>
 232                   <meta.attribute translatable="true"/>
 233                </appinfo>
 234             </annotation>
 235          </attribute>
 236          <attribute name="value" type="string">
 237             <annotation>
 238                <documentation>
 239                   the default value
 240                </documentation>
 241             </annotation>
 242          </attribute>
 243          <attribute name="preference" type="boolean">
 244             <annotation>
 245                <documentation>
 246                   set to true if the default value should be fetched from the preference store for the RJMXPlugin using the id as a key.
 247                </documentation>
 248             </annotation>
 249          </attribute>
 250       </complexType>
 251    </element>
 252 
 253    <element name="timerange">
 254       <annotation>
 255          <documentation>
 256             Time range setting for a trigger action.
 257          </documentation>
 258       </annotation>
 259       <complexType>
 260          <attribute name="id" type="string" use="required">
 261             <annotation>
 262                <documentation>
 263                   a unique identifier for this setting
 264                </documentation>
 265             </annotation>
 266          </attribute>
 267          <attribute name="name" type="string" use="required">
 268             <annotation>
 269                <documentation>
 270                   the name of the setting
 271                </documentation>
 272                <appinfo>
 273                   <meta.attribute translatable="true"/>
 274                </appinfo>
 275             </annotation>
 276          </attribute>
 277          <attribute name="description" type="string">
 278             <annotation>
 279                <documentation>
 280                   the description of the setting
 281                </documentation>
 282                <appinfo>
 283                   <meta.attribute translatable="true"/>
 284                </appinfo>
 285             </annotation>
 286          </attribute>
 287          <attribute name="value" type="string">
 288             <annotation>
 289                <documentation>
 290                   the default value for this time range. If no unit is set, seconds will be assumed.
 291                </documentation>
 292             </annotation>
 293          </attribute>
 294          <attribute name="preference" type="boolean">
 295             <annotation>
 296                <documentation>
 297                   set to true if the default value should be fetched from the preference store for the RJMXPlugin using the id as a key.
 298                </documentation>
 299             </annotation>
 300          </attribute>
 301       </complexType>
 302    </element>
 303 
 304    <element name="string">
 305       <annotation>
 306          <documentation>
 307             String setting for a trigger action.
 308          </documentation>
 309       </annotation>
 310       <complexType>
 311          <attribute name="id" type="string" use="required">
 312             <annotation>
 313                <documentation>
 314                   a unique identifier for this setting
 315                </documentation>
 316             </annotation>
 317          </attribute>
 318          <attribute name="name" type="string" use="required">
 319             <annotation>
 320                <documentation>
 321                   the name of the setting
 322                </documentation>
 323                <appinfo>
 324                   <meta.attribute translatable="true"/>
 325                </appinfo>
 326             </annotation>
 327          </attribute>
 328          <attribute name="description" type="string">
 329             <annotation>
 330                <documentation>
 331                   the description of the setting
 332                </documentation>
 333                <appinfo>
 334                   <meta.attribute translatable="true"/>
 335                </appinfo>
 336             </annotation>
 337          </attribute>
 338          <attribute name="value" type="string">
 339             <annotation>
 340                <documentation>
 341                   the default value
 342                </documentation>
 343             </annotation>
 344          </attribute>
 345          <attribute name="preference" type="boolean">
 346             <annotation>
 347                <documentation>
 348                   set to true if the default value should be fetched from the preference store for the RJMXPlugin using the id as a key.
 349                </documentation>
 350             </annotation>
 351          </attribute>
 352       </complexType>
 353    </element>
 354 
 355    <element name="file">
 356       <annotation>
 357          <documentation>
 358             File setting for a trigger action.
 359          </documentation>
 360       </annotation>
 361       <complexType>
 362          <attribute name="id" type="string" use="required">
 363             <annotation>
 364                <documentation>
 365                   a unique identifier for this setting
 366                </documentation>
 367             </annotation>
 368          </attribute>
 369          <attribute name="name" type="string" use="required">
 370             <annotation>
 371                <documentation>
 372                   the name of the setting
 373                </documentation>
 374                <appinfo>
 375                   <meta.attribute translatable="true"/>
 376                </appinfo>
 377             </annotation>
 378          </attribute>
 379          <attribute name="description" type="string">
 380             <annotation>
 381                <documentation>
 382                   the description of the setting
 383                </documentation>
 384                <appinfo>
 385                   <meta.attribute translatable="true"/>
 386                </appinfo>
 387             </annotation>
 388          </attribute>
 389          <attribute name="value" type="string">
 390             <annotation>
 391                <documentation>
 392                   the default value
 393                </documentation>
 394             </annotation>
 395          </attribute>
 396          <attribute name="preference" type="boolean">
 397             <annotation>
 398                <documentation>
 399                   set to true if the default value should be fetched from the preference store for the RJMXPlugin using the id as a key.
 400                </documentation>
 401             </annotation>
 402          </attribute>
 403       </complexType>
 404    </element>
 405 
 406    <element name="boolean">
 407       <annotation>
 408          <documentation>
 409             Boolean setting for a trigger action.
 410          </documentation>
 411       </annotation>
 412       <complexType>
 413          <attribute name="id" type="string" use="required">
 414             <annotation>
 415                <documentation>
 416                   a unique identifier for this setting
 417                </documentation>
 418             </annotation>
 419          </attribute>
 420          <attribute name="name" type="string" use="required">
 421             <annotation>
 422                <documentation>
 423                   the name of the setting
 424                </documentation>
 425                <appinfo>
 426                   <meta.attribute translatable="true"/>
 427                </appinfo>
 428             </annotation>
 429          </attribute>
 430          <attribute name="description" type="string">
 431             <annotation>
 432                <documentation>
 433                   the description of the setting
 434                </documentation>
 435                <appinfo>
 436                   <meta.attribute translatable="true"/>
 437                </appinfo>
 438             </annotation>
 439          </attribute>
 440          <attribute name="value" type="boolean">
 441             <annotation>
 442                <documentation>
 443                   the default value
 444                </documentation>
 445             </annotation>
 446          </attribute>
 447          <attribute name="preference" type="boolean">
 448             <annotation>
 449                <documentation>
 450                   set to true if the default value should be fetched from the preference store for the RJMXPlugin using the id as a key.
 451                </documentation>
 452             </annotation>
 453          </attribute>
 454       </complexType>
 455    </element>
 456 
 457    <element name="integer">
 458       <annotation>
 459          <documentation>
 460             Integer setting for a trigger action.
 461          </documentation>
 462       </annotation>
 463       <complexType>
 464          <attribute name="id" type="string" use="required">
 465             <annotation>
 466                <documentation>
 467                   a unique identifier for this setting
 468                </documentation>
 469             </annotation>
 470          </attribute>
 471          <attribute name="name" type="string" use="required">
 472             <annotation>
 473                <documentation>
 474                   the name of the setting
 475                </documentation>
 476                <appinfo>
 477                   <meta.attribute translatable="true"/>
 478                </appinfo>
 479             </annotation>
 480          </attribute>
 481          <attribute name="description" type="string">
 482             <annotation>
 483                <documentation>
 484                   the description of the setting
 485                </documentation>
 486                <appinfo>
 487                   <meta.attribute translatable="true"/>
 488                </appinfo>
 489             </annotation>
 490          </attribute>
 491          <attribute name="value" type="string">
 492             <annotation>
 493                <documentation>
 494                   the default value
 495                </documentation>
 496             </annotation>
 497          </attribute>
 498          <attribute name="preference" type="boolean">
 499             <annotation>
 500                <documentation>
 501                   set to true if the default value should be fetched from the preference store for the RJMXPlugin using the id as a key.
 502                </documentation>
 503             </annotation>
 504          </attribute>
 505          <attribute name="min" type="string">
 506             <annotation>
 507                <documentation>
 508                   the minimum allowed integer value for this setting
 509                </documentation>
 510             </annotation>
 511          </attribute>
 512          <attribute name="max" type="string">
 513             <annotation>
 514                <documentation>
 515                   the maximum allowed integer value for this setting
 516                </documentation>
 517             </annotation>
 518          </attribute>
 519       </complexType>
 520    </element>
 521 
 522    <element name="float">
 523       <annotation>
 524          <documentation>
 525             Float setting for a trigger action.
 526          </documentation>
 527       </annotation>
 528       <complexType>
 529          <attribute name="id" type="string" use="required">
 530             <annotation>
 531                <documentation>
 532                   a unique identifier for this setting
 533                </documentation>
 534             </annotation>
 535          </attribute>
 536          <attribute name="name" type="string" use="required">
 537             <annotation>
 538                <documentation>
 539                   the name of the setting
 540                </documentation>
 541                <appinfo>
 542                   <meta.attribute translatable="true"/>
 543                </appinfo>
 544             </annotation>
 545          </attribute>
 546          <attribute name="description" type="string">
 547             <annotation>
 548                <documentation>
 549                   the description of the setting
 550                </documentation>
 551                <appinfo>
 552                   <meta.attribute translatable="true"/>
 553                </appinfo>
 554             </annotation>
 555          </attribute>
 556          <attribute name="value" type="string">
 557             <annotation>
 558                <documentation>
 559                   the default value
 560                </documentation>
 561             </annotation>
 562          </attribute>
 563          <attribute name="preference" type="boolean">
 564             <annotation>
 565                <documentation>
 566                   set to true if the default value should be fetched from the preference store for the RJMXPlugin using the id as a key.
 567                </documentation>
 568             </annotation>
 569          </attribute>
 570          <attribute name="min" type="string">
 571             <annotation>
 572                <documentation>
 573                   the minimum allowed float value for this setting
 574                </documentation>
 575             </annotation>
 576          </attribute>
 577          <attribute name="max" type="string">
 578             <annotation>
 579                <documentation>
 580                   the maximum allowed float value for this setting
 581                </documentation>
 582             </annotation>
 583          </attribute>
 584       </complexType>
 585    </element>
 586 
 587    <element name="password">
 588       <annotation>
 589          <documentation>
 590             Password setting for a trigger action.
 591          </documentation>
 592       </annotation>
 593       <complexType>
 594          <attribute name="id" type="string" use="required">
 595             <annotation>
 596                <documentation>
 597                   a unique identifier for this setting
 598                </documentation>
 599             </annotation>
 600          </attribute>
 601          <attribute name="name" type="string" use="required">
 602             <annotation>
 603                <documentation>
 604                   the name of the setting
 605                </documentation>
 606                <appinfo>
 607                   <meta.attribute translatable="true"/>
 608                </appinfo>
 609             </annotation>
 610          </attribute>
 611          <attribute name="description" type="string">
 612             <annotation>
 613                <documentation>
 614                   the description of the setting
 615                </documentation>
 616                <appinfo>
 617                   <meta.attribute translatable="true"/>
 618                </appinfo>
 619             </annotation>
 620          </attribute>
 621          <attribute name="value" type="string">
 622             <annotation>
 623                <documentation>
 624                   the default value
 625                </documentation>
 626             </annotation>
 627          </attribute>
 628          <attribute name="preference" type="boolean">
 629             <annotation>
 630                <documentation>
 631                   set to true if the default value should be fetched from the preference store for the RJMXPlugin using the id as a key.
 632                </documentation>
 633             </annotation>
 634          </attribute>
 635       </complexType>
 636    </element>
 637 
 638    <annotation>
 639       <appinfo>
 640          <meta.section type="since"/>
 641       </appinfo>
 642       <documentation>
 643          5.2.0
 644       </documentation>
 645    </annotation>
 646 
 647    <annotation>
 648       <appinfo>
 649          <meta.section type="examples"/>
 650       </appinfo>
 651       <documentation>
 652          &lt;extension point=&quot;org.openjdk.jmc.rjmx.triggerActions&quot;&gt;
 653       &lt;triggerAction
 654             class=&quot;com.example.triggers.actions.HelloAction&quot;
 655             description=&quot;Hello World Action&quot;
 656             icon=&quot;icons/console_view.png&quot;
 657             id=&quot;com.example.triggers.HelloWorld&quot;
 658             name=&quot;Hello World&quot;&gt;
 659             &lt;string
 660                   id=&quot;com.example.triggers.actions.username&quot;
 661                   name=&quot;Your Name&quot;
 662                   value=&quot;Mr X&quot;&gt;
 663             &lt;/string&gt;         
 664      &lt;/triggerAction&gt;
 665 &lt;/extension&gt;
 666 
 667 
 668 package com.example.triggers.actions;
 669 
 670 import org.openjdk.jmc.rjmx.triggers.TriggerAction;
 671 import org.openjdk.jmc.rjmx.triggers.TriggerEvent;
 672 
 673 public class HelloAction extends TriggerAction 
 674 {
 675  public void handleNotificationEvent(TriggerEvent e) 
 676  {
 677   System.out.println(&quot;Hello &quot; + getSetting(&quot;com.example.triggers.actions.username&quot;).getString() +&quot;! Trigger value is &quot; + e.getTriggerValue());
 678  }
 679 }
 680       </documentation>
 681    </annotation>
 682 
 683 
 684 
 685    <annotation>
 686       <appinfo>
 687          <meta.section type="copyright"/>
 688       </appinfo>
 689       <documentation>
 690          Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
 691       </documentation>
 692    </annotation>
 693 
 694 </schema>