VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "c_NmContextExtImplTie"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'Generated by IDL2VB v120. Copyright (c) 1999 Martin.Both
'Source File Name: ../naming/CosNaming.idl
'Target File Name: c_NmContextExtImplTie.cls

Option Explicit

'You can use this class as a tie to your servant or as a servant example.
'Using as a tie:
' Your servant has to implement c_NmContextExt
' To activate a servant via tie write following:
'  Dim oNmContextExtImplTie As c_NmContextExtImplTie
'  Set oNmContextExtImplTie = New c_NmContextExtImplTie
'  Call oNmContextExtImplTie.setDelegate(oServant)
'  Call oOrb.Connect(oNmContextExtImplTie)
'Using as a servant example:
' Rename class to c_NmContextExtImpl and save the file as c_NmContextExtImpl.cls.
' Remove delegate stuff and write your own servant operations.
' To activate a servant write following:
'  Dim oNmContextExtImpl As c_NmContextExtImpl
'  Set oNmContextExtImpl = New c_NmContextExtImpl
'  Call oOrb.Connect(oNmContextExtImpl)

Implements cOrbSkeleton
Implements c_NmContextExt

'interface ::CosNaming::NamingContextExt
Const sTypeId As String = "IDL:omg.org/CosNaming/NamingContextExt:1.0"
Private oObjRef As cOrbObjRef
Private oDelegate As c_NmContextExt

'Each tie contains a delegate object, to which all operations are forwarded.
'You can remove this if you use this class as an example for your servant.
Public Sub setDelegate(ByVal Delegate As c_NmContextExt)
    Set oDelegate = Delegate
End Sub

Public Function getDelegate() As c_NmContextExt
    Set getDelegate = oDelegate
End Function

Friend Property Get ObjRef() As cOrbObjRef
    Set ObjRef = oObjRef
End Property

Friend Property Get This() As c_NmContextExt
    Dim oObj As cOrbObject
    Set oObj = New c_NmContextExt
    If oObj.setObjRef(oObjRef, False) Then
        Set This = Nothing
    Else
        Set This = oObj
    End If
End Property

Private Property Get cOrbSkeleton_TypeId(ByVal Item As Integer) As String
    Select Case Item
    Case 0: cOrbSkeleton_TypeId = sTypeId
    Case 1: cOrbSkeleton_TypeId = "IDL:omg.org/CosNaming/NamingContext:1.0"
    Case 2: cOrbSkeleton_TypeId = "IDL:omg.org/CORBA/Object:1.0"
    End Select
End Property

Private Property Get cOrbSkeleton_ObjRef() As cOrbObjRef
    Set cOrbSkeleton_ObjRef = oObjRef
End Property

Private Property Set cOrbSkeleton_ObjRef(ByVal newObjRef As cOrbObjRef)
    Set oObjRef = newObjRef
End Property

'Helper
Private Function cOrbSkeleton_execute(ByVal sOperation As String, _
    ByVal oIn As cOrbStream, ByVal oOut As cOrbStream) As Long
    On Error GoTo ErrHandler
    Dim oImpl_ As c_NmContextExt
    Set oImpl_ = IIf(oDelegate Is Nothing, Me, oDelegate)
    Select Case sOperation
    Case "bind"
        Dim a1_n As c_NmNameComponentSeq
        Set a1_n = New c_NmNameComponentSeq
        Call a1_n.initByRead(oIn, 0)
        Dim a1_obj As cOrbObject
        Set a1_obj = oIn.readObject()
        Call oImpl_.bind(a1_n, a1_obj)
    Case "rebind"
        Dim a2_n As c_NmNameComponentSeq
        Set a2_n = New c_NmNameComponentSeq
        Call a2_n.initByRead(oIn, 0)
        Dim a2_obj As cOrbObject
        Set a2_obj = oIn.readObject()
        Call oImpl_.rebind(a2_n, a2_obj)
    Case "bind_context"
        Dim a3_n As c_NmNameComponentSeq
        Set a3_n = New c_NmNameComponentSeq
        Call a3_n.initByRead(oIn, 0)
        Dim a3_nc As c_NmContext
        Set a3_nc = m_NmContext.narrow(oIn.readObject())
        Call oImpl_.bindContext(a3_n, a3_nc)
    Case "rebind_context"
        Dim a4_n As c_NmNameComponentSeq
        Set a4_n = New c_NmNameComponentSeq
        Call a4_n.initByRead(oIn, 0)
        Dim a4_nc As c_NmContext
        Set a4_nc = m_NmContext.narrow(oIn.readObject())
        Call oImpl_.rebindContext(a4_n, a4_nc)
    Case "resolve"
        Dim a5_n As c_NmNameComponentSeq
        Set a5_n = New c_NmNameComponentSeq
        Call a5_n.initByRead(oIn, 0)
        Dim resolve As cOrbObject
        Set resolve = oImpl_.resolve(a5_n)
        Call oOut.writeObject(resolve)
    Case "unbind"
        Dim a6_n As c_NmNameComponentSeq
        Set a6_n = New c_NmNameComponentSeq
        Call a6_n.initByRead(oIn, 0)
        Call oImpl_.unbind(a6_n)
    Case "new_context"
        Dim newContext As c_NmContext
        Set newContext = oImpl_.newContext()
        Call oOut.writeObject(newContext)
    Case "bind_new_context"
        Dim a8_n As c_NmNameComponentSeq
        Set a8_n = New c_NmNameComponentSeq
        Call a8_n.initByRead(oIn, 0)
        Dim bindNewContext As c_NmContext
        Set bindNewContext = oImpl_.bindNewContext(a8_n)
        Call oOut.writeObject(bindNewContext)
    Case "destroy"
        Call oImpl_.destroy
    Case "list"
        Dim a10_how_many As Long
        a10_how_many = oIn.readUlong()
        Dim a10_bl As c_NmBindingSeq
        Dim a10_bi As c_NmBindingIterator
        Call oImpl_.list(a10_how_many, a10_bl, a10_bi)
        Call a10_bl.writeMe(oOut, 0)
        Call oOut.writeObject(a10_bi)
    Case "to_string"
        Dim a11_n As c_NmNameComponentSeq
        Set a11_n = New c_NmNameComponentSeq
        Call a11_n.initByRead(oIn, 0)
        Dim toString As String
        toString = oImpl_.toString(a11_n)
        Call oOut.writeString(toString)
    Case "to_name"
        Dim a12_sn As String
        a12_sn = oIn.readString()
        Dim toName As c_NmNameComponentSeq
        Set toName = oImpl_.toName(a12_sn)
        Call toName.writeMe(oOut, 0)
    Case "to_url"
        Dim a13_addr As String
        a13_addr = oIn.readString()
        Dim a13_sn As String
        a13_sn = oIn.readString()
        Dim toUrl As String
        toUrl = oImpl_.toUrl(a13_addr, a13_sn)
        Call oOut.writeString(toUrl)
    Case "resolve_str"
        Dim a14_sn As String
        a14_sn = oIn.readString()
        Dim resolveStr As cOrbObject
        Set resolveStr = oImpl_.resolveStr(a14_sn)
        Call oOut.writeObject(resolveStr)
    Case Else
        Call VBOrb.raiseBADOPERATION(1, VBOrb.CompletedNO, sOperation)
    End Select
    cOrbSkeleton_execute = 0 'NO_EXCEPTION
    Exit Function
UserExWriter:
    Call VBOrb.getException().writeMe(oOut)
    cOrbSkeleton_execute = 1 'USER_EXCEPTION
    Exit Function
ErrHandler:
    If VBOrb.ErrIsUserEx() Then Resume UserExWriter
    Call VBOrb.ErrReraise(Err, "NamingContextExt.execute(" & sOperation & ")")
End Function

'Implements c_NmContextExt

'bind() raises(c_NmNotFoundEx, c_NmCannotProceedEx, c_NmInvalidNameEx, _
    c_NmAlreadyBoundEx)
Private Sub c_NmContextExt_bind(ByVal n As c_NmNameComponentSeq, _
    ByVal obj As cOrbObject)
    On Error GoTo ErrHandler
    'Please write your own code here if using as servant example
    If oDelegate Is Nothing Then
        Call VBOrb.raiseNOIMPLEMENT(0, VBOrb.CompletedNO)
    Else
        Call oDelegate.bind(n, obj)
    End If
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "bind")
End Sub

'rebind() raises(c_NmNotFoundEx, c_NmCannotProceedEx, c_NmInvalidNameEx)
Private Sub c_NmContextExt_rebind(ByVal n As c_NmNameComponentSeq, _
    ByVal obj As cOrbObject)
    On Error GoTo ErrHandler
    'Please write your own code here if using as servant example
    If oDelegate Is Nothing Then
        Call VBOrb.raiseNOIMPLEMENT(0, VBOrb.CompletedNO)
    Else
        Call oDelegate.rebind(n, obj)
    End If
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "rebind")
End Sub

'bind_context() raises(c_NmNotFoundEx, c_NmCannotProceedEx, c_NmInvalidNameEx, _
    c_NmAlreadyBoundEx)
Private Sub c_NmContextExt_bindContext(ByVal n As c_NmNameComponentSeq, _
    ByVal nc As c_NmContext)
    On Error GoTo ErrHandler
    'Please write your own code here if using as servant example
    If oDelegate Is Nothing Then
        Call VBOrb.raiseNOIMPLEMENT(0, VBOrb.CompletedNO)
    Else
        Call oDelegate.bindContext(n, nc)
    End If
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "bindContext")
End Sub

'rebind_context() raises(c_NmNotFoundEx, c_NmCannotProceedEx, c_NmInvalidNameEx)
Private Sub c_NmContextExt_rebindContext(ByVal n As c_NmNameComponentSeq, _
    ByVal nc As c_NmContext)
    On Error GoTo ErrHandler
    'Please write your own code here if using as servant example
    If oDelegate Is Nothing Then
        Call VBOrb.raiseNOIMPLEMENT(0, VBOrb.CompletedNO)
    Else
        Call oDelegate.rebindContext(n, nc)
    End If
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "rebindContext")
End Sub

'resolve() raises(c_NmNotFoundEx, c_NmCannotProceedEx, c_NmInvalidNameEx)
Private Function c_NmContextExt_resolve(ByVal n As c_NmNameComponentSeq) _
    As cOrbObject
    On Error GoTo ErrHandler
    'Please write your own code here if using as servant example
    If oDelegate Is Nothing Then
        Call VBOrb.raiseNOIMPLEMENT(0, VBOrb.CompletedNO)
    Else
        Set c_NmContextExt_resolve = oDelegate.resolve(n)
    End If
    Exit Function
ErrHandler:
    Set c_NmContextExt_resolve = Nothing
    Call VBOrb.ErrReraise(Err, "resolve")
End Function

'unbind() raises(c_NmNotFoundEx, c_NmCannotProceedEx, c_NmInvalidNameEx)
Private Sub c_NmContextExt_unbind(ByVal n As c_NmNameComponentSeq)
    On Error GoTo ErrHandler
    'Please write your own code here if using as servant example
    If oDelegate Is Nothing Then
        Call VBOrb.raiseNOIMPLEMENT(0, VBOrb.CompletedNO)
    Else
        Call oDelegate.unbind(n)
    End If
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "unbind")
End Sub

'new_context()
Private Function c_NmContextExt_newContext() As c_NmContext
    On Error GoTo ErrHandler
    'Please write your own code here if using as servant example
    If oDelegate Is Nothing Then
        Call VBOrb.raiseNOIMPLEMENT(0, VBOrb.CompletedNO)
    Else
        Set c_NmContextExt_newContext = oDelegate.newContext()
    End If
    Exit Function
ErrHandler:
    Set c_NmContextExt_newContext = Nothing
    Call VBOrb.ErrReraise(Err, "newContext")
End Function

'bind_new_context() raises(c_NmNotFoundEx, c_NmAlreadyBoundEx, _
    c_NmCannotProceedEx, c_NmInvalidNameEx)
Private Function c_NmContextExt_bindNewContext(ByVal n As c_NmNameComponentSeq) _
    As c_NmContext
    On Error GoTo ErrHandler
    'Please write your own code here if using as servant example
    If oDelegate Is Nothing Then
        Call VBOrb.raiseNOIMPLEMENT(0, VBOrb.CompletedNO)
    Else
        Set c_NmContextExt_bindNewContext = oDelegate.bindNewContext(n)
    End If
    Exit Function
ErrHandler:
    Set c_NmContextExt_bindNewContext = Nothing
    Call VBOrb.ErrReraise(Err, "bindNewContext")
End Function

'destroy() raises(c_NmNotEmptyEx)
Private Sub c_NmContextExt_destroy()
    On Error GoTo ErrHandler
    'Please write your own code here if using as servant example
    If oDelegate Is Nothing Then
        Call VBOrb.raiseNOIMPLEMENT(0, VBOrb.CompletedNO)
    Else
        Call oDelegate.destroy
    End If
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "destroy")
End Sub

'list()
Private Sub c_NmContextExt_list(ByVal how_many As Long, _
    ByRef bl As c_NmBindingSeq, ByRef bi As c_NmBindingIterator)
    On Error GoTo ErrHandler
    'Please write your own code here if using as servant example
    If oDelegate Is Nothing Then
        Call VBOrb.raiseNOIMPLEMENT(0, VBOrb.CompletedNO)
    Else
        Call oDelegate.list(how_many, bl, bi)
    End If
    Exit Sub
ErrHandler:
    Call VBOrb.ErrReraise(Err, "list")
End Sub

'to_string() raises(c_NmInvalidNameEx)
Private Function c_NmContextExt_toString(ByVal n As c_NmNameComponentSeq) _
    As String
    On Error GoTo ErrHandler
    'Please write your own code here if using as servant example
    If oDelegate Is Nothing Then
        Call VBOrb.raiseNOIMPLEMENT(0, VBOrb.CompletedNO)
    Else
        c_NmContextExt_toString = oDelegate.toString(n)
    End If
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "toString")
End Function

'to_name() raises(c_NmInvalidNameEx)
Private Function c_NmContextExt_toName(ByVal sn As String) _
    As c_NmNameComponentSeq
    On Error GoTo ErrHandler
    'Please write your own code here if using as servant example
    If oDelegate Is Nothing Then
        Call VBOrb.raiseNOIMPLEMENT(0, VBOrb.CompletedNO)
    Else
        Set c_NmContextExt_toName = oDelegate.toName(sn)
    End If
    Exit Function
ErrHandler:
    Set c_NmContextExt_toName = Nothing
    Call VBOrb.ErrReraise(Err, "toName")
End Function

'to_url() raises(c_NmInvalidAddressEx, c_NmInvalidNameEx)
Private Function c_NmContextExt_toUrl(ByVal addr As String, ByVal sn As String) _
    As String
    On Error GoTo ErrHandler
    'Please write your own code here if using as servant example
    If oDelegate Is Nothing Then
        Call VBOrb.raiseNOIMPLEMENT(0, VBOrb.CompletedNO)
    Else
        c_NmContextExt_toUrl = oDelegate.toUrl(addr, sn)
    End If
    Exit Function
ErrHandler:
    Call VBOrb.ErrReraise(Err, "toUrl")
End Function

'resolve_str() raises(c_NmNotFoundEx, c_NmCannotProceedEx, c_NmInvalidNameEx)
Private Function c_NmContextExt_resolveStr(ByVal sn As String) As cOrbObject
    On Error GoTo ErrHandler
    'Please write your own code here if using as servant example
    If oDelegate Is Nothing Then
        Call VBOrb.raiseNOIMPLEMENT(0, VBOrb.CompletedNO)
    Else
        Set c_NmContextExt_resolveStr = oDelegate.resolveStr(sn)
    End If
    Exit Function
ErrHandler:
    Set c_NmContextExt_resolveStr = Nothing
    Call VBOrb.ErrReraise(Err, "resolveStr")
End Function
