home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / som30tk.zip / som30os2.zip / include / somdserv.idl < prev    next >
Text File  |  1996-12-24  |  7KB  |  184 lines

  1. //
  2. //   COMPONENT_NAME: somd
  3. //
  4. //   ORIGINS: 27
  5. //
  6. //
  7. //    25H7912  (C)  COPYRIGHT International Business Machines Corp. 1992,1995,1996 
  8. //   All Rights Reserved
  9. //   Licensed Materials - Property of IBM
  10. //   US Government Users Restricted Rights - Use, duplication or
  11. //   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  12. //
  13. //#  @(#) 2.31 src/somd/somdserv.idl, somd, som3.0 9/26/96 14:02:21 [12/24/96 07:39:39]
  14.  
  15. //#  SOMDServer is a PUBLIC class derived from SOMObject.
  16. //
  17. //  Each DSOM server process is defined to have a (single instance)
  18. //  SOMDServer object.  The SOMDServer object performs the following
  19. //  functions:
  20. //
  21. //      1) creation of SOMObject factories
  22. //      2) mapping between SOMObjects and SOMDObjects
  23. //      3) method dispatching
  24. //      4) any application-specific server methods
  25. //
  26. //  A particular SOMDServer subclass is specified in the ImplementationDef
  27. //  for each server process.  SOMOA will instantiate one instance of the
  28. //  specified SOMDServer subclass during server process initialization
  29. //  (in SOMOA::impl_is_ready).
  30.  
  31.  
  32. #ifndef somdserver_idl
  33. #define somdserver_idl
  34.  
  35. #include <somobj.idl>
  36. #include <somdtype.idl>
  37. #include <snglicls.idl>
  38. #include <xnaming.idl>
  39.  
  40. interface SOMDObject;
  41.  
  42. interface SOMDServer : SOMObject
  43. {
  44.  
  45.   //### -- Methods called locally on server ONLY! -- ###//
  46.  
  47.   SOMDObject somdRefFromSOMObj(in SOMObject somobj);
  48.   
  49.   // This method returns a DSOM object reference for a SOM object in this server
  50.   // process.  SOMOA will call this method whenever it returns a result from a
  51.   // method call which includes a pointer to a SOMObject (versus a pointer to a
  52.   // SOMDObject).  OWNERSHIP of the returned object reference is passed to the
  53.   // caller EXCEPT when the somdObjReferencesCached method returns TRUE.  When the
  54.   // input (somobj) is already an object reference, the default implementation
  55.   // simply returns somobj, rather than creating a new reference.  (Subclasses
  56.   // might override this method to duplicate the input reference, however.)
  57.   // Hence, callers should note when the returned value is the same as
  58.   // the input (somobj) when determining whether or not to free the result.
  59.  
  60.   SOMObject somdSOMObjFromRef(in SOMDObject objref);
  61.   
  62.   // This method maps a DSOM object reference into a SOM object.
  63.   // This can be done in whatever way is appropriate for the application.
  64.   // This method is called by SOMOA in order to translate any method call
  65.   // parameters which are object references (created from somdRefFromSOMObj
  66.   // above) into SOM objects.
  67.  
  68.   void somdDispatchMethod(in SOMObject somobj, out somToken retValue,
  69.                           in somId methodId, in va_list ap);
  70.   
  71.   // This method is called by SOMOA to dispatch a method on a SOM object.
  72.   // The intention is to give the Server object an opportunity to intercept
  73.   // method calls, if desired.  The parameters to this method are the same
  74.   // as the parameters passed to SOMObject::somDispatch.
  75.   //
  76.   // The default implementation invokes SOMObject::somDispatch on the
  77.   // specified target object, "somobj", with the supplied arguments.
  78.  
  79.  
  80.   //### -- Methods called remotely from clients -- ###//
  81.  
  82.   SOMObject somdCreateObj(in Identifier objclass, in string hints);
  83.   
  84.   // Creates an object of the specified class.  This method (if overridden)
  85.   // may optionally define creation "hints" which the client may specify in 
  86.   // this call. 
  87.   //
  88.   // Called indirectly by SOMDObjectMgr::somdNewObject.
  89.   //
  90.   // The default implementation calls somdGetClassObj to get the specified
  91.   // SOMClass object, and invokes "somNew".  The "hints" argument is ignored.
  92.  
  93.   void somdDeleteObj(in SOMObject somobj);
  94.   
  95.   // Deletes a SOM object.  By default, simply calls somFree on the object.
  96.   //
  97.   // Called indirectly by SOMDObjectMgr::somdDestroyObject.
  98.  
  99.   SOMClass  somdGetClassObj(in Identifier objclass);
  100.   
  101.   // Creates/returns a class object for the specified class.  May result in
  102.   // loading of a DLL for the class.  This method can be used by a client to
  103.   // get a proxy to a class object on the server so that methods introduced
  104.   // in the metaclass (e.g., class-specific constructors, etc.) may be invoked
  105.   // directly.
  106.  
  107.   boolean   somdObjReferencesCached();
  108.  
  109.   // Whether the server retains ownership of the object references
  110.   // it creates via the somdRefFromSOMObj method.
  111.  
  112.   SOMObject somdCreateFactory(in string className,
  113.                            in ExtendedNaming::PropertyList props);
  114.   // To be called from DSOM Factory Finder Service, a FactoryENC object.
  115.   // Will return a factory specified in idl by the idl modifier "factory",
  116.   // or if this doesn't exist will return a SOMClass for the object to be
  117.   // used as the generic factory.  PropertyList is not used.
  118.  
  119.  
  120. #ifdef __SOMIDL__
  121.  
  122.   implementation
  123.   {
  124.     releaseorder: somdSOMObjFromRef, somdRefFromSOMObj,
  125.           somdCreateObj, somdDeleteObj, somdGetClassObj,
  126.                   somdDispatchMethod, somdObjReferencesCached,
  127.                   private1, private2,
  128.                   somdCreateFactory;
  129.   
  130.     //# class modifiers
  131.     callstyle = idl;
  132.     metaclass = SOMMSingleInstance;
  133.     dllname = "somd.dll";
  134.     majorversion = 2;
  135.     minorversion = 2;
  136.     functionprefix = "SOMDSvr_";
  137.  
  138.     //# method modifiers
  139.     somDefaultInit: override;
  140.     somDestruct: override;
  141.  
  142.  
  143.     //# passthrus
  144.     passthru C_h = "#include <naming.h>"
  145.                    "#include <xnaming.h>";
  146.     passthru C_xh = "#include <naming.xh>"
  147.                    "#include <xnaming.xh>";
  148.     passthru C_h_after  = ""
  149.       "#include <somdtype.h>"
  150.         "#ifndef SOM_IMPORTEXPORT_somd"
  151.         "#if defined(_WIN32) && !defined(SOM_DLL_somd)"
  152.             "#define SOM_IMPORTEXPORT_somd SOMDLLIMPORT"
  153.         "#else"
  154.             "#define SOM_IMPORTEXPORT_somd"
  155.         "#endif"
  156.         "#endif"
  157.       "#ifdef SOM_STRICT_IDL"
  158.       "SOMEXTERN SOM_IMPORTEXPORT_somd SOMDServer  SOMDLINK SOMD_ServerObject;"
  159.       "#else"
  160.       "SOMEXTERN SOM_IMPORTEXPORT_somd SOMDServer * SOMDLINK SOMD_ServerObject;"
  161.       "#endif /* SOM_STRICT_IDL */"
  162.       "";
  163.  
  164.     passthru C_xh_after = ""
  165.       "class SOMDServer;"
  166.       "#include <somdtype.xh>"
  167.         "#ifndef SOM_IMPORTEXPORT_somd"
  168.         "#if defined(_WIN32) && !defined(SOM_DLL_somd)"
  169.             "#define SOM_IMPORTEXPORT_somd SOMDLLIMPORT"
  170.         "#else"
  171.             "#define SOM_IMPORTEXPORT_somd"
  172.         "#endif"
  173.         "#endif"
  174.       "SOMEXTERN SOM_IMPORTEXPORT_somd SOMDServer * SOMDLINK SOMD_ServerObject;"
  175.       "";
  176.  
  177.   };
  178.  
  179. #endif /* __SOMIDL__ */
  180.  
  181. };
  182.  
  183. #endif  /* somdserver_idl */
  184.