You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by da...@apache.org on 2005/12/28 11:13:18 UTC
svn commit: r359467 - in /webservices/axis2/trunk/c: include/
modules/core/deployment/src/ test/server/calculator/
Author: damitha
Date: Wed Dec 28 02:13:06 2005
New Revision: 359467
URL: http://svn.apache.org/viewcvs?rev=359467&view=rev
Log:
Merged the two files calc_svc.c and calc_skeleton.c(Now all code in
calc_skeleton.c. Added license info
Removed:
webservices/axis2/trunk/c/test/server/calculator/calc_svc.c
Modified:
webservices/axis2/trunk/c/include/axis2_svc_skeleton.h
webservices/axis2/trunk/c/modules/core/deployment/src/arch_file_data.c
webservices/axis2/trunk/c/test/server/calculator/calc.c
webservices/axis2/trunk/c/test/server/calculator/calc.h
webservices/axis2/trunk/c/test/server/calculator/calc_skeleton.c
Modified: webservices/axis2/trunk/c/include/axis2_svc_skeleton.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_svc_skeleton.h?rev=359467&r1=359466&r2=359467&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_svc_skeleton.h (original)
+++ webservices/axis2/trunk/c/include/axis2_svc_skeleton.h Wed Dec 28 02:13:06 2005
@@ -58,15 +58,13 @@
axis2_env_t **env,
axis2_om_node_t *node);
- struct axis2_array_list *(AXIS2_CALL*
- get_function_list)(axis2_svc_skeleton_t *svc_skeli,
- axis2_env_t **env);
} ;
AXIS2_DECLARE_DATA struct axis2_svc_skeleton
{
axis2_svc_skeleton_ops_t *ops;
+ axis2_array_list_t *func_array;
};
/**
@@ -89,9 +87,6 @@
#define AXIS2_SVC_SKELETON_ON_FAULT(svc_skeleton, env, node) \
((svc_skeleton->ops)->on_fault (svc_skeleton, env, node))
-
-#define AXIS2_SVC_SKELETON_GET_FUNCTION_LIST(svc_skeleton, env) \
- ((svc_skeleton->ops)->get_function_list (svc_skeleton, env))
/** @} */
Modified: webservices/axis2/trunk/c/modules/core/deployment/src/arch_file_data.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/deployment/src/arch_file_data.c?rev=359467&r1=359466&r2=359467&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/deployment/src/arch_file_data.c (original)
+++ webservices/axis2/trunk/c/modules/core/deployment/src/arch_file_data.c Wed Dec 28 02:13:06 2005
@@ -95,3 +95,183 @@
return AXIS2_SUCCESS;
}
+
+/**
+ * ArchiveFileData = Hot Deployment File Item , to store infromation of the
+ * module or servise item to be deploy
+ */
+public class ArchiveFileData {
+
+ private ClassLoader classLoader;
+ private File file = null;
+ private int type;
+ private String messgeReceiver;
+ private String moduleClass;
+ private String name;
+
+
+ //To store services in a serviceGroup , if there are wsdl for those servics ,
+ //so wsdl service will be created for each wsdl an those will be temeororaly store
+ //in this table
+ private HashMap service = new HashMap();
+
+ private ArrayList deploybleServices = new ArrayList();
+
+ public ArchiveFileData(int type, String name) {
+ this.type = type;
+ this.name = name;
+ }
+
+ public String getMessgeReceiver() {
+ return messgeReceiver;
+ }
+
+ public void setMessgeReceiver(String messgeReceiver) {
+ this.messgeReceiver = messgeReceiver;
+ }
+
+ public ArchiveFileData(File file, int type) {
+ this.file = file;
+ this.type = type;
+ }
+
+ public String getName() {
+ return file.getName();
+ }
+
+ public String getServiceName() {
+ if (file != null) {
+ return file.getName();
+ } else
+ return name;
+ }
+
+ public String getAbsolutePath() {
+ return file.getAbsolutePath();
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ public ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ public void setClassLoader(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ }
+
+ public String getModuleClass() {
+ return moduleClass;
+ }
+
+ public void setModuleClass(String moduleClass) {
+ this.moduleClass = moduleClass;
+ }
+
+ public void setClassLoader(boolean extarctArichive) throws AxisFault {
+ ClassLoader parent = Thread.currentThread().getContextClassLoader();
+ if (! extarctArichive) {
+ // has to be craeted taking that file to the account
+ if (file != null) {
+ URL[] urlsToLoadFrom;
+ try {
+ if (!file.exists()) {
+ throw new AxisFault(Messages.getMessage(DeploymentErrorMsgs.FNF));
+ }
+ urlsToLoadFrom = new URL[]{file.toURL()};
+ classLoader =
+ new DeploymentClassLoader(urlsToLoadFrom, parent);
+ // classLoader = new URLClassLoader(urlsToLoadFrom, parent);
+ } catch (Exception e) {
+ throw new AxisFault(e);
+ }
+ }
+ } else {
+ if (file != null) {
+ try {
+ ArrayList urls = new ArrayList();
+ urls.add(file.toURL());
+
+ //if lib is simple
+ File libfiles = new File(file, "lib");
+ if(libfiles.exists()){
+ urls.add(libfiles.toURL());
+ File jarfiles [] = libfiles.listFiles();
+ for (int i = 0; i < jarfiles.length; i++) {
+ File jarfile = jarfiles[i];
+ if(jarfile.getName().endsWith(".jar")){
+ urls.add(jarfile.toURL());
+ }
+ }
+ }
+
+ //if lib is capital
+ libfiles = new File(file, "Lib");
+ if(libfiles.exists()){
+ urls.add(libfiles.toURL());
+ File jarfiles [] = libfiles.listFiles();
+ for (int i = 0; i < jarfiles.length; i++) {
+ File jarfile = jarfiles[i];
+ if(jarfile.getName().endsWith(".jar")){
+ urls.add(jarfile.toURL());
+ }
+ }
+ }
+
+ URL urllist [] = new URL[urls.size()];
+ for (int i = 0; i < urls.size(); i++) {
+ urllist[i] = (URL) urls.get(i);
+ }
+ classLoader = new URLClassLoader(urllist,parent);
+
+
+ } catch (MalformedURLException e) {
+ throw new AxisFault(e);
+ }
+
+ }
+ }
+
+ }
+
+ /**
+ * to check whthere a given file is a jar file
+ *
+ * @param filename
+ * @return boolean
+ */
+ public static boolean isServiceArchiveFile(String filename) {
+ return ((filename.endsWith(".jar")) | (filename.endsWith(".aar")));
+ }
+
+ public static boolean isModuleArchiveFile(String filename) {
+ return ((filename.endsWith(".jar")) || (filename.endsWith(".mar")));
+ }
+
+
+ public void addService(AxisService servicedesc){
+ service.put(servicedesc.getName().getLocalPart(),servicedesc);
+ }
+
+ public AxisService getService(String serviceName){
+ return (AxisService)service.get(serviceName);
+ }
+
+ public HashMap getService() {
+ return service;
+ }
+
+ public ArrayList getDeploybleServices() {
+ return deploybleServices;
+ }
+
+ public void setDeploybleServices(ArrayList deploybleServices) {
+ this.deploybleServices = deploybleServices;
+ }
+}
Modified: webservices/axis2/trunk/c/test/server/calculator/calc.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/server/calculator/calc.c?rev=359467&r1=359466&r2=359467&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/server/calculator/calc.c (original)
+++ webservices/axis2/trunk/c/test/server/calculator/calc.c Wed Dec 28 02:13:06 2005
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
#include "calc.h"
axis2_om_node_t *
Modified: webservices/axis2/trunk/c/test/server/calculator/calc.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/server/calculator/calc.h?rev=359467&r1=359466&r2=359467&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/server/calculator/calc.h (original)
+++ webservices/axis2/trunk/c/test/server/calculator/calc.h Wed Dec 28 02:13:06 2005
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
#ifndef CALC_H
#define CALC_H
Modified: webservices/axis2/trunk/c/test/server/calculator/calc_skeleton.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/server/calculator/calc_skeleton.c?rev=359467&r1=359466&r2=359467&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/server/calculator/calc_skeleton.c (original)
+++ webservices/axis2/trunk/c/test/server/calculator/calc_skeleton.c Wed Dec 28 02:13:06 2005
@@ -1,72 +1,68 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
#include "axis2_svc_skeleton.h"
-typedef struct axis2_svc_skeleton_impl
-{
- axis2_svc_skeleton_t svc_skeleton;
- axis2_array_list_t *func_array;
-
-} axis2_svc_skeleton_impl_t;
-
-#define AXIS2_INTF_TO_IMPL(axis2_svc_skeleton) \
- ((axis2_svc_skeleton_impl_t *) axis2_svc_skeleton)
-
axis2_svc_skeleton *
axis2_svc_skeleton_create(axis2_env_t **env)
{
- axis2_svc_skeleton_impl_t *skeleton_impl = NULL;
- skeleton_impl = AXIS2_MALLOC((*env)->allocator,
- sizeof(axis2_svc_skeleton_impl_t));
+ axis2_svc_skeleton_t *skeleton = NULL;
+ skeleton = AXIS2_MALLOC((*env)->allocator,
+ sizeof(axis2_svc_skeleton_t));
- skeleton_impl->svc_skeleton.ops = AXIS2_MALLOC(
+ svc_skeleton->ops = AXIS2_MALLOC(
(*env)->allocator, sizeof(axis2_skeleton_ops_t));
- skeleton_impl->svc_skeleton.ops->free = calc_free;
- skeleton_impl->svc_skeleton.ops->invoke = calc_invoke;
- skeleton_impl->svc_skeleton.ops->on_fault = calc_on_fault;
- skeleton_impl->svc_skeleton.ops->get_function_liste = calc_get_function_list;
+ svc_skeleton->ops->free = calc_free;
+ svc_skeleton->ops->invoke = calc_invoke;
+ svc_skeleton->ops->on_fault = calc_on_fault;
- return (&(skeleton_impl->svc_skeleton));
+ return svc_skeleton;
}
int axis2_svc_skeleton_init(axis2_svc_skeleton_t *svc_skeleton,
axis2_env_t **env)
{
- axis2_svc_skeleton_impl_t *skeleton_impl = NULL;
-
- skeleton_impl = AXIS2_INTF_TO_IMPL(svc_skeleton);
-
- skeleton_impl->func_array = axis2_array_create(env, 0);
- AXIS2_ARRAY_ADD(skeleton_impl->func_array, env, "add");
- AXIS2_ARRAY_ADD(skeleton_impl->func_array, env, "multiply");
+ svc_skeleton->func_array = axis2_array_create(env, 0);
+ AXIS2_ARRAY_ADD(svc_skeleton->func_array, env, "add");
+ AXIS2_ARRAY_ADD(svc_skeleton->func_array, env, "multiply");
/* Any initialization stuff of calculator goes here */
- return AXIS2_FAILURE;
+ return AXIS2_SUCCESS;
}
int
calc_free(axis2_svc_skeleton_t *svc_skeleton)
{
- axis2_svc_skeleton_impl_t *skeleton_impl = NULL;
-
- skeleton_impl = AXIS2_INTF_TO_IMPL(svc_skeleton);
-
if(svc_skeleton->ops)
{
AXIS2_FREE((*env)->allocator, svc_skeleton->ops);
svc_skeleton->ops = NULL;
}
- if(skeleton_impl->func_array)
+ if(svc_skeleton->func_array)
{
- AXIS2_ARRAY_LIST_FREE(skeleton_impl->func_array, env);
- skeleton_impl->func_array = NULL;
+ AXIS2_ARRAY_LIST_FREE(svc_skeleton->func_array, env);
+ svc_skeleton->func_array = NULL;
}
- if(skeleton_impl)
+ if(svc_skeleton)
{
- AXIS2_FREE((*env)->allocator, skeleton_impl);
- skeleton_impl = NULL;
+ AXIS2_FREE((*env)->allocator, svc_skeleton);
+ svc_skeleton = NULL;
}
}
@@ -92,8 +88,32 @@
{
}
-axis2_array_list_t *calc_get_function_list(axis2_svc_skeleton_t *svc_skeleton,
- axis2_env_t **env)
+/**
+ * Following block distinguish the exposed part of the dll.
+ */
+extern "C" {
+
+int axis2_get_instance(struct axis2_svc_skeleton **inst)
+{
+ axis2_status_t status = AXIS2_FAILURE;
+
+ *inst = axis2_svc_skeleton_create();
+ if(NULL != *inst)
+ {
+ status = *inst->init();
+ }
+
+ return status;
+}
+
+int axis2_remove_instance(axis2_svc_skeleton *inst)
{
- return AXIS2_INTF_TO_IMPL(svc_skeleton)->func_array;
+ axis2_status_t status = AXIS2_FAILURE;
+ if (inst)
+ {
+ status = AXIS2_SVC_SKELETON_FREE(inst);
+ }
+ return status;
+}
+
}