blob: c69771ec8c34369cc2a9aad42ed911a5c1754f24 [file] [log] [blame]
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
// This file automatically generated by:
// Apache Etch 1.1.0-incubating (LOCAL-0) / c 1.1.0-incubating (LOCAL-0)
// Fri Aug 28 15:58:20 CEST 2009
// This file is automatically created and should not be edited!
/*
* helloworld_server_stub.c
*/
#include "helloworld_server.h"
#include "helloworld_server_stub.h"
#include "helloworld_valufact.h"
#include "etch_url.h"
#include "etch_objecttypes.h"
#include "etch_svcobj_masks.h"
#include "etch_general.h"
#include "etch_exception.h"
#include "etch_log.h"
unsigned short CLASSID_HELLOWORLD_SERVER_STUB;
char* HELLOWORLD_HELLOWORLD_ETCHSTBI = "STBI";
int destroy_helloworld_server_stub(void*);
/* - - - - - - - - - - -
* stub helper methods
* - - - - - - - - - - -
*/
/**
* helloworld_stub_run_say_hello
*/
int helloworld_stub_run_server_say_hello(etch_stub* stub, i_delivery_service* dsvc, void* obj, etch_who* whofrom, etch_message* msg)
{
i_helloworld_server* server = (i_helloworld_server*)obj;
int returnCode = 0;
helloworld_valufact_impl* pvfi = NULL;
helloworld_valufact* pvf = NULL;
struct helloworld_server_impl* impl = NULL;
/* objects specific to helloworld_server.$name.name()() */
etch_field* key_to_whom = NULL;
helloworld_user* val_to_whom = NULL;
etch_string* resultobj = NULL;
etchstub_validate_args (stub, dsvc, msg, server, &pvf, (void**)&pvfi, (void**)&impl);
key_to_whom = helloworld_valufact_get_static()->_mf_helloworld_to_whom;
ETCH_ASSERT(key_to_whom);
val_to_whom = (helloworld_user*) message_remove(msg, key_to_whom);
/* execute the service method */
resultobj = server->say_hello (impl, val_to_whom);
returnCode = etchstub_send_reply (stub, dsvc, whofrom, msg, (void*) resultobj, resultobj != NULL);
if(!returnCode){
etch_object_destroy(msg);
}
return returnCode;
}
/* - - - - - - - - -
* constructors
* - - - - - - - - -
*/
/**
* new_helloworld_server_stub()
* @param p serv factory parameter bundle, caller retains.
*
* this constructor is called on the server via callback from the listener
* socket accept handler <transportfactory>_session_accepted, via the new_server
* function pointer to perf_helper.new_helper_accepted_server().
* java binding passes this constructor the delivery service, however we pass the
* etch_server_factory parameter bundle, (i_sessionlistener.server_params),
* i_sessionlistener being the set session interface of etch_tcp_server.
*/
helloworld_server_stub* new_helloworld_server_stub(etch_server_factory* p, etch_session* session)
{
i_delivery_service* ids = session->ds;
etch_threadpool *qp = p->qpool, *fp = p->fpool;
helloworld_server_stub* mystub = new_serverstub_init (session->server,
sizeof(helloworld_server_stub), destroy_helloworld_server_stub, ids, qp, fp, p);
((etch_object*)mystub)->class_id = get_dynamic_classid_unique(&CLASSID_HELLOWORLD_SERVER_STUB);
mystub->session_id = session->session_id;
/* initialize service-specific methods and data here. this facility may
* likely prove unecessary, as this is generated code, in which case we
* can remove any associated comments from code and headers. */
//mystub->my_example_obj = etch_malloc(128, 0); /* example custom alloc */
/* set stub "helper" methods (run() procedures for each message type) */
etchtype_set_type_stubhelper(helloworld_valufact_get_static()->_mt_helloworld_say_hello, helloworld_stub_run_server_say_hello);
return mystub;
}
/**
* is_helloworld_server_stub()
*/
int is_helloworld_server_stub(void* obj)
{
return obj && ((etch_object*)obj)->class_id == CLASSID_HELLOWORLD_SERVER_STUB;
}
/**
* destroy_def_helloworld_server_stub()
* helloworld_server_stub user-allocated memory destructor.
* called back from private object destructor destroy_stub_object().
* if you explicitly allocate memory in the client stub object, destroy it here.
*/
int destroy_helloworld_server_stub(void* data)
{
/*
helloworld_server_stub* mystub = (helloworld_server_stub*)data;
free custom memory allocations here */
//etch_free(mystub->my_example_obj); /* free example alloc */
return 0;
}