// **********************************************************************
//
// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
//
// Ice version 3.5.1
//
// <auto-generated>
//
// Generated from file `HelloWorld.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//

package firstHelloWorld;

public final class HelloWorldPrxHelper extends Ice.ObjectPrxHelperBase implements HelloWorldPrx
{
    private static final String __greeting_name = "greeting";

    public void greeting(String value)
    {
        greeting(value, null, false);
    }

    public void greeting(String value, java.util.Map<String, String> __ctx)
    {
        greeting(value, __ctx, true);
    }

    private void greeting(String value, java.util.Map<String, String> __ctx, boolean __explicitCtx)
    {
        if(__explicitCtx && __ctx == null)
        {
            __ctx = _emptyContext;
        }
        final Ice.Instrumentation.InvocationObserver __observer = IceInternal.ObserverHelper.get(this, "greeting", __ctx);
        int __cnt = 0;
        try
        {
            while(true)
            {
                Ice._ObjectDel __delBase = null;
                try
                {
                    __delBase = __getDelegate(false);
                    _HelloWorldDel __del = (_HelloWorldDel)__delBase;
                    __del.greeting(value, __ctx, __observer);
                    return;
                }
                catch(IceInternal.LocalExceptionWrapper __ex)
                {
                    __handleExceptionWrapper(__delBase, __ex, __observer);
                }
                catch(Ice.LocalException __ex)
                {
                    __cnt = __handleException(__delBase, __ex, null, __cnt, __observer);
                }
            }
        }
        finally
        {
            if(__observer != null)
            {
                __observer.detach();
            }
        }
    }

    public Ice.AsyncResult begin_greeting(String value)
    {
        return begin_greeting(value, null, false, null);
    }

    public Ice.AsyncResult begin_greeting(String value, java.util.Map<String, String> __ctx)
    {
        return begin_greeting(value, __ctx, true, null);
    }

    public Ice.AsyncResult begin_greeting(String value, Ice.Callback __cb)
    {
        return begin_greeting(value, null, false, __cb);
    }

    public Ice.AsyncResult begin_greeting(String value, java.util.Map<String, String> __ctx, Ice.Callback __cb)
    {
        return begin_greeting(value, __ctx, true, __cb);
    }

    public Ice.AsyncResult begin_greeting(String value, Callback_HelloWorld_greeting __cb)
    {
        return begin_greeting(value, null, false, __cb);
    }

    public Ice.AsyncResult begin_greeting(String value, java.util.Map<String, String> __ctx, Callback_HelloWorld_greeting __cb)
    {
        return begin_greeting(value, __ctx, true, __cb);
    }

    private Ice.AsyncResult begin_greeting(String value, java.util.Map<String, String> __ctx, boolean __explicitCtx, IceInternal.CallbackBase __cb)
    {
        IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __greeting_name, __cb);
        try
        {
            __result.__prepare(__greeting_name, Ice.OperationMode.Normal, __ctx, __explicitCtx);
            IceInternal.BasicStream __os = __result.__startWriteParams(Ice.FormatType.DefaultFormat);
            __os.writeString(value);
            __result.__endWriteParams();
            __result.__send(true);
        }
        catch(Ice.LocalException __ex)
        {
            __result.__exceptionAsync(__ex);
        }
        return __result;
    }

    public void end_greeting(Ice.AsyncResult __result)
    {
        __end(__result, __greeting_name);
    }

    private static final String __testAnotherOperation_name = "testAnotherOperation";

    public void testAnotherOperation(String value)
    {
        testAnotherOperation(value, null, false);
    }

    public void testAnotherOperation(String value, java.util.Map<String, String> __ctx)
    {
        testAnotherOperation(value, __ctx, true);
    }

    private void testAnotherOperation(String value, java.util.Map<String, String> __ctx, boolean __explicitCtx)
    {
        if(__explicitCtx && __ctx == null)
        {
            __ctx = _emptyContext;
        }
        final Ice.Instrumentation.InvocationObserver __observer = IceInternal.ObserverHelper.get(this, "testAnotherOperation", __ctx);
        int __cnt = 0;
        try
        {
            while(true)
            {
                Ice._ObjectDel __delBase = null;
                try
                {
                    __delBase = __getDelegate(false);
                    _HelloWorldDel __del = (_HelloWorldDel)__delBase;
                    __del.testAnotherOperation(value, __ctx, __observer);
                    return;
                }
                catch(IceInternal.LocalExceptionWrapper __ex)
                {
                    __handleExceptionWrapper(__delBase, __ex, __observer);
                }
                catch(Ice.LocalException __ex)
                {
                    __cnt = __handleException(__delBase, __ex, null, __cnt, __observer);
                }
            }
        }
        finally
        {
            if(__observer != null)
            {
                __observer.detach();
            }
        }
    }

    public Ice.AsyncResult begin_testAnotherOperation(String value)
    {
        return begin_testAnotherOperation(value, null, false, null);
    }

    public Ice.AsyncResult begin_testAnotherOperation(String value, java.util.Map<String, String> __ctx)
    {
        return begin_testAnotherOperation(value, __ctx, true, null);
    }

    public Ice.AsyncResult begin_testAnotherOperation(String value, Ice.Callback __cb)
    {
        return begin_testAnotherOperation(value, null, false, __cb);
    }

    public Ice.AsyncResult begin_testAnotherOperation(String value, java.util.Map<String, String> __ctx, Ice.Callback __cb)
    {
        return begin_testAnotherOperation(value, __ctx, true, __cb);
    }

    public Ice.AsyncResult begin_testAnotherOperation(String value, Callback_HelloWorld_testAnotherOperation __cb)
    {
        return begin_testAnotherOperation(value, null, false, __cb);
    }

    public Ice.AsyncResult begin_testAnotherOperation(String value, java.util.Map<String, String> __ctx, Callback_HelloWorld_testAnotherOperation __cb)
    {
        return begin_testAnotherOperation(value, __ctx, true, __cb);
    }

    private Ice.AsyncResult begin_testAnotherOperation(String value, java.util.Map<String, String> __ctx, boolean __explicitCtx, IceInternal.CallbackBase __cb)
    {
        IceInternal.OutgoingAsync __result = new IceInternal.OutgoingAsync(this, __testAnotherOperation_name, __cb);
        try
        {
            __result.__prepare(__testAnotherOperation_name, Ice.OperationMode.Normal, __ctx, __explicitCtx);
            IceInternal.BasicStream __os = __result.__startWriteParams(Ice.FormatType.DefaultFormat);
            __os.writeString(value);
            __result.__endWriteParams();
            __result.__send(true);
        }
        catch(Ice.LocalException __ex)
        {
            __result.__exceptionAsync(__ex);
        }
        return __result;
    }

    public void end_testAnotherOperation(Ice.AsyncResult __result)
    {
        __end(__result, __testAnotherOperation_name);
    }

    public static HelloWorldPrx checkedCast(Ice.ObjectPrx __obj)
    {
        HelloWorldPrx __d = null;
        if(__obj != null)
        {
            if(__obj instanceof HelloWorldPrx)
            {
                __d = (HelloWorldPrx)__obj;
            }
            else
            {
                if(__obj.ice_isA(ice_staticId()))
                {
                    HelloWorldPrxHelper __h = new HelloWorldPrxHelper();
                    __h.__copyFrom(__obj);
                    __d = __h;
                }
            }
        }
        return __d;
    }

    public static HelloWorldPrx checkedCast(Ice.ObjectPrx __obj, java.util.Map<String, String> __ctx)
    {
        HelloWorldPrx __d = null;
        if(__obj != null)
        {
            if(__obj instanceof HelloWorldPrx)
            {
                __d = (HelloWorldPrx)__obj;
            }
            else
            {
                if(__obj.ice_isA(ice_staticId(), __ctx))
                {
                    HelloWorldPrxHelper __h = new HelloWorldPrxHelper();
                    __h.__copyFrom(__obj);
                    __d = __h;
                }
            }
        }
        return __d;
    }

    public static HelloWorldPrx checkedCast(Ice.ObjectPrx __obj, String __facet)
    {
        HelloWorldPrx __d = null;
        if(__obj != null)
        {
            Ice.ObjectPrx __bb = __obj.ice_facet(__facet);
            try
            {
                if(__bb.ice_isA(ice_staticId()))
                {
                    HelloWorldPrxHelper __h = new HelloWorldPrxHelper();
                    __h.__copyFrom(__bb);
                    __d = __h;
                }
            }
            catch(Ice.FacetNotExistException ex)
            {
            }
        }
        return __d;
    }

    public static HelloWorldPrx checkedCast(Ice.ObjectPrx __obj, String __facet, java.util.Map<String, String> __ctx)
    {
        HelloWorldPrx __d = null;
        if(__obj != null)
        {
            Ice.ObjectPrx __bb = __obj.ice_facet(__facet);
            try
            {
                if(__bb.ice_isA(ice_staticId(), __ctx))
                {
                    HelloWorldPrxHelper __h = new HelloWorldPrxHelper();
                    __h.__copyFrom(__bb);
                    __d = __h;
                }
            }
            catch(Ice.FacetNotExistException ex)
            {
            }
        }
        return __d;
    }

    public static HelloWorldPrx uncheckedCast(Ice.ObjectPrx __obj)
    {
        HelloWorldPrx __d = null;
        if(__obj != null)
        {
            if(__obj instanceof HelloWorldPrx)
            {
                __d = (HelloWorldPrx)__obj;
            }
            else
            {
                HelloWorldPrxHelper __h = new HelloWorldPrxHelper();
                __h.__copyFrom(__obj);
                __d = __h;
            }
        }
        return __d;
    }

    public static HelloWorldPrx uncheckedCast(Ice.ObjectPrx __obj, String __facet)
    {
        HelloWorldPrx __d = null;
        if(__obj != null)
        {
            Ice.ObjectPrx __bb = __obj.ice_facet(__facet);
            HelloWorldPrxHelper __h = new HelloWorldPrxHelper();
            __h.__copyFrom(__bb);
            __d = __h;
        }
        return __d;
    }

    public static final String[] __ids =
    {
        "::Ice::Object",
        "::firstHelloWorld::HelloWorld"
    };

    public static String ice_staticId()
    {
        return __ids[1];
    }

    protected Ice._ObjectDelM __createDelegateM()
    {
        return new _HelloWorldDelM();
    }

    protected Ice._ObjectDelD __createDelegateD()
    {
        return new _HelloWorldDelD();
    }

    public static void __write(IceInternal.BasicStream __os, HelloWorldPrx v)
    {
        __os.writeProxy(v);
    }

    public static HelloWorldPrx __read(IceInternal.BasicStream __is)
    {
        Ice.ObjectPrx proxy = __is.readProxy();
        if(proxy != null)
        {
            HelloWorldPrxHelper result = new HelloWorldPrxHelper();
            result.__copyFrom(proxy);
            return result;
        }
        return null;
    }

    public static final long serialVersionUID = 0L;
}
