<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>

<!-- $Id: oracle-listener-service.xml,v 1.8 2005/12/28 13:25:09 joost Exp $

  The contents of this file are subject to the terms of the
  Common Development and Distribution License, Version 1.0 only
  (the "License").  You may not use this file except in compliance
  with the License.

  You can obtain a copy of the license at
   http://www.opensource.org/licenses/cddl1.php
  See the License for the specific language governing permissions and
  limitations under the License.

  Copyright 2005, Joost Mulders.

  This document contains a service definition for Oracle listeners.

  It defines properties and depedencies for listeners under smf control.
  This manifest DOES NOT define any instances. Instances of this service
  are defined in the oracle-listener-instance.xml manifest.

  Instances can be created by:
  * running $MTHPATH/ora-smf autoimport, or by
  * by modifying and importing
    $MFTPATH/oracle-listener-instance.xml

  SMF instances created contain Oracle-instance specific variables
  like LISTENER_NAME and inherit generic properties from this service.
-->

<service_bundle type='manifest' name='oracle-listener-service'>
 <service
  name='application/oracle/listener'
  type='service'
  version='1'>
 
  <!--
   grouping='require_all'
    The multi-user milestone must actually be ONLINE (or degraded) before we
    start: No multi-user, no listener.

    A less tight relation could be defined by optional_all, meaning something
    like: "we want to be started after the attempt to start the multi-user
    milestone."

   restart_on='error'
    If multi-user goes away due to an error, we will go with it. If it comes up,
    again, we will go with it. Change to 'none' if you don't want to go down
    with the milestone.
  -->
  <dependency
   name='multi-user'
   grouping='require_all'
   restart_on='error'
   type='service'>
   <service_fmri 
    value='svc:/milestone/multi-user:default' />
  </dependency>
  
  <!-- The milestone multi-user-server depends on us -->
  <dependent
   name='oracle-listener_multi-user-server'
   grouping='optional_all'
   restart_on='none'>
   <service_fmri
    value='svc:/milestone/multi-user-server:default' />
  </dependent>

  <exec_method
   type='method'
   name='start'
   exec='$MTHPATH/ora-smf %m listener %i'
   timeout_seconds='0'>
  </exec_method>

  <exec_method
   type='method'
   name='stop'
   exec='$MTHPATH/ora-smf %m listener %i'
   timeout_seconds='0'>
  </exec_method>

  <!--
    Tell svc.startd to run this service under contract, which is the default.
    This means that startd will restart this service automatically when it is
    stopped. The *ONLY* way valid ways to stop the listener are

     svcadm mark maintenance FMRI, or
     svcadm disable FMRI

    DBA's with a habit of doing "lsnrctl stop LISTENER" will find that
    the listener immediately gets started again. 

    If the restart behaviour is not desired, change the duration property to
    transient.
   -->
  <property_group name='startd' type='framework'>
   <propval name='duration' type='astring' value='contract' />

   <propval name='modify_authorization' type='astring'
    value='solaris.smf.manage.oracle.listener' />
  </property_group>

  <!--
   Authorized accounts may
    - add, change and delete properties in this property group
    - change the status (stop/start) of instances
  -->
  <property_group name='general' type='framework'>
   <propval name='modify_authorization' type='astring'
    value='solaris.smf.manage.oracle.listener' />

   <propval name='action_authorization' type='astring'
    value='solaris.smf.manage.oracle.listener' />
  </property_group>

  <property_group name='multi-user' type='dependency'>
    <propval name='modify_authorization' type='astring'
     value='solaris.smf.manage.oracle.listener' />
  </property_group>

  <stability value='External' />
  
  <template>
   <common_name>
    <loctext xml:lang='C'>
     Oracle listener
    </loctext>
   </common_name>
   <documentation>
    <manpage title='ora-smf' section='5'
     manpath='/usr/share/man' />
   </documentation>
  </template>
 </service>
</service_bundle>
