You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ma...@apache.org on 2007/04/18 10:10:33 UTC

svn commit: r529909 [1/2] - in /webservices/axis2/scratch/c/neethi: include/ src/

Author: manjula
Date: Wed Apr 18 01:10:31 2007
New Revision: 529909

URL: http://svn.apache.org/viewvc?view=rev&rev=529909
Log:
Adding neethi code to scratch.

Added:
    webservices/axis2/scratch/c/neethi/include/
    webservices/axis2/scratch/c/neethi/include/policy.h
    webservices/axis2/scratch/c/neethi/include/policy_all.h
    webservices/axis2/scratch/c/neethi/include/policy_assertion.h
    webservices/axis2/scratch/c/neethi/include/policy_constants.h
    webservices/axis2/scratch/c/neethi/include/policy_engine.h
    webservices/axis2/scratch/c/neethi/include/policy_exactlyone.h
    webservices/axis2/scratch/c/neethi/include/policy_includes.h
    webservices/axis2/scratch/c/neethi/include/policy_operator.h
    webservices/axis2/scratch/c/neethi/include/policy_reference.h
    webservices/axis2/scratch/c/neethi/include/policy_registry.h
    webservices/axis2/scratch/c/neethi/include/rp_transport_binding_builder.h
    webservices/axis2/scratch/c/neethi/include/rp_transport_token_builder.h
    webservices/axis2/scratch/c/neethi/src/all.c
    webservices/axis2/scratch/c/neethi/src/assertion.c
    webservices/axis2/scratch/c/neethi/src/exactlyone.c
    webservices/axis2/scratch/c/neethi/src/policy.c
    webservices/axis2/scratch/c/neethi/src/policy_engine.c
    webservices/axis2/scratch/c/neethi/src/policy_operator.c
    webservices/axis2/scratch/c/neethi/src/reference.c
    webservices/axis2/scratch/c/neethi/src/registry.c
    webservices/axis2/scratch/c/neethi/src/test.c

Added: webservices/axis2/scratch/c/neethi/include/policy.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/include/policy.h?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/include/policy.h (added)
+++ webservices/axis2/scratch/c/neethi/include/policy.h Wed Apr 18 01:10:31 2007
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+
+#ifndef POLICY_H
+#define POLICY_H
+
+
+/**
+  * @file policy.h
+  * @struct for operator policy 
+  */
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <policy_operator.h>
+#include <policy_includes.h>
+#include <policy_exactlyone.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+        typedef struct policy_t policy_t; 
+
+        AXIS2_EXTERN policy_t *AXIS2_CALL
+        policy_create(const axutil_env_t *env);
+
+        AXIS2_EXTERN void AXIS2_CALL
+        policy_free(policy_t *policy,
+                const axutil_env_t *env);
+                
+        AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+        policy_get_policy_components(
+            policy_t *policy,
+            const axutil_env_t *env);
+
+        AXIS2_EXTERN axis2_status_t AXIS2_CALL
+        policy_add_policy_components(
+            policy_t *policy,
+            axutil_array_list_t *arraylist,
+            const axutil_env_t *env);
+        
+        AXIS2_EXTERN axis2_status_t AXIS2_CALL
+        policy_add_operator(policy_t *policy,
+            const axutil_env_t *env,
+            policy_operator_t *op);
+
+        AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+        policy_is_empty(policy_t *policy,
+            const axutil_env_t *env);
+
+        AXIS2_EXTERN policy_exactlyone_t *AXIS2_CALL
+        policy_get_exactlyone(
+        policy_t *normalized_policy,
+            const axutil_env_t *env);
+        
+        AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+        policy_get_alternatives(
+            policy_t *policy,
+            const axutil_env_t *env);
+        
+
+
+    /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif                          /* POLICY_H */

Added: webservices/axis2/scratch/c/neethi/include/policy_all.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/include/policy_all.h?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/include/policy_all.h (added)
+++ webservices/axis2/scratch/c/neethi/include/policy_all.h Wed Apr 18 01:10:31 2007
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+#ifndef POLICY_ALL_H
+#define POLICY_ALL_H
+
+
+/**
+  * @file policy_all.h
+  * @struct for operator all 
+  */
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <policy_operator.h>
+#include <policy_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+        typedef struct policy_all_t policy_all_t; 
+
+        AXIS2_EXTERN policy_all_t *AXIS2_CALL
+        policy_all_create(const axutil_env_t *env);
+
+        AXIS2_EXTERN void AXIS2_CALL
+        policy_all_free(policy_all_t *policy_all,
+                const axutil_env_t *env);
+                
+        AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+        policy_all_get_policy_components(
+            policy_all_t *policy_all,
+            const axutil_env_t *env);
+        
+        AXIS2_EXTERN axis2_status_t AXIS2_CALL
+        policy_all_add_policy_components(
+            policy_all_t *all,
+            axutil_array_list_t *arraylist,
+            const axutil_env_t *env);
+            
+        AXIS2_EXTERN axis2_status_t AXIS2_CALL
+        policy_all_add_operator(policy_all_t *policy_all,
+            const axutil_env_t *env,
+            policy_operator_t *op);
+
+        AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+        policy_all_is_empty(policy_all_t *all,
+            const axutil_env_t *env);
+
+
+    /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif                          /* POLICY_ALL_H */

Added: webservices/axis2/scratch/c/neethi/include/policy_assertion.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/include/policy_assertion.h?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/include/policy_assertion.h (added)
+++ webservices/axis2/scratch/c/neethi/include/policy_assertion.h Wed Apr 18 01:10:31 2007
@@ -0,0 +1,117 @@
+/*
+ * 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.
+ */
+
+#ifndef POLICY_ASSERTION_H
+#define POLICY_ASSERTION_H
+
+
+/**
+  * @file policy_assertion.h
+  * @common struct for policy assertions. 
+  */
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <policy_includes.h>
+#include <policy_operator.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+    typedef enum  {
+        ASSERTION_TYPE_TRANSPORT_BINDING = 0,
+        ASSERTION_TYPE_TRANSPORT_TOKEN,
+        ASSERTION_TYPE_ALGORITHM_SUITE,
+        ASSERTION_TYPE_INCLUDE_TIMESTAMP,
+        ASSERTION_TYPE_LAYOUT,
+        ASSERTION_TYPE_SIGNED_SUPPORTING_TOKENS,
+        ASSERTION_TYPE_SIGNED_ENDORSING_SUPPORTING_TOKENS,
+        ASSERTION_TYPE_HTTPS_TOKEN,
+        ASSERTION_TYPE_UNKNOWN
+    }policy_assertion_type_t;
+
+    typedef struct policy_assertion_t policy_assertion_t;
+
+    AXIS2_EXTERN policy_assertion_t *AXIS2_CALL
+    policy_assertion_create(const axutil_env_t *env);
+
+    AXIS2_EXTERN policy_assertion_type_t AXIS2_CALL
+    policy_assertion_get_type(policy_assertion_t *policy_assertion,
+            const axutil_env_t *env);
+
+    AXIS2_EXTERN void *AXIS2_CALL
+    policy_assertion_get_value(
+        policy_assertion_t *policy_assertion,
+        const axutil_env_t *env);
+
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    policy_assertion_set_value(policy_assertion_t *policy_assertion,
+        const axutil_env_t *env,
+        void *value,
+        policy_assertion_type_t type);
+
+    AXIS2_EXTERN axiom_element_t *AXIS2_CALL
+    policy_assertion_get_element(
+        policy_assertion_t *policy_assertion,
+        const axutil_env_t *env);
+
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    policy_assertion_set_element(policy_assertion_t *policy_assertion,
+        const axutil_env_t *env,
+        axiom_element_t *element);
+
+    AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+    policy_assertion_get_is_optional(
+        policy_assertion_t *policy_assertion,
+        const axutil_env_t *env);
+
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    policy_assertion_set_is_optional(policy_assertion_t *policy_assertion,
+        const axutil_env_t *env,
+        axis2_bool_t is_optional);
+        
+    AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+    policy_assertion_get_policy_components(
+        policy_assertion_t *policy_assertion,
+        const axutil_env_t *env);
+
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    policy_assertion_add_policy_components(
+        policy_assertion_t *policy_assertion,
+        axutil_array_list_t *arraylist,
+        const axutil_env_t *env);
+
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    policy_assertion_add_operator(policy_assertion_t *policy_assertion,
+        const axutil_env_t *env,
+        policy_operator_t *op);
+
+    AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+    policy_is_empty(policy_assertion_t *policy_assertion,
+            const axutil_env_t *env);
+
+
+
+    /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif                          /* POLICY_ASSERTION_H */

Added: webservices/axis2/scratch/c/neethi/include/policy_constants.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/include/policy_constants.h?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/include/policy_constants.h (added)
+++ webservices/axis2/scratch/c/neethi/include/policy_constants.h Wed Apr 18 01:10:31 2007
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+#ifndef POLICY_CONSTANTS_H
+#define POLICY_CONSTANTS_H
+
+
+#define POLICY_EXACTLYONE "ExactlyOne"
+#define POLICY_ALL "All"
+#define POLICY_POLICY "Policy"
+#define POLICY_REFERENCE "PolicyReference"
+#define POLICY_URI "URI"
+#define POLICY_NAMESPACE "http://schemas.xmlsoap.org/ws/2004/09/policy"
+#define POLICY_PREFIX "wsp"
+
+/**
+* @file policy_constants.h
+* @brief includes all the string constants 
+*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*POLICY_INCLUDES_H*/

Added: webservices/axis2/scratch/c/neethi/include/policy_engine.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/include/policy_engine.h?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/include/policy_engine.h (added)
+++ webservices/axis2/scratch/c/neethi/include/policy_engine.h Wed Apr 18 01:10:31 2007
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+#ifndef POLICY_ENGINE_H
+#define POLICY_ENGINE_H
+
+
+/**
+  * @file policy_engine.h
+  * @contains policy creation logic. 
+  */
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <policy_includes.h>
+#include <policy_operator.h>
+#include <policy.h>
+#include <policy_all.h>
+#include <policy_exactlyone.h>
+#include <policy_reference.h>
+#include <policy_registry.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    AXIS2_EXTERN policy_t *AXIS2_CALL
+    policy_engine_get_policy(
+            const axutil_env_t *env,
+            axiom_node_t *node,
+            axiom_element_t *element);
+
+    AXIS2_EXTERN policy_t *AXIS2_CALL
+    policy_engine_get_normalize(
+            policy_t *policy,
+            axis2_bool_t deep,
+            const axutil_env_t *env);
+    
+    AXIS2_EXTERN policy_t *AXIS2_CALL
+    policy_engine_normalize(
+            policy_t *policy,
+            policy_registry_t *registry,
+            axis2_bool_t deep,
+            const axutil_env_t *env);
+    
+    AXIS2_EXTERN policy_t *AXIS2_CALL
+    policy_engine_merge(
+            policy_t *policy1,
+            policy_t *policy2,
+            const axutil_env_t *env);
+        
+
+    /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif                          /* POLICY_ENGINE_H */

Added: webservices/axis2/scratch/c/neethi/include/policy_exactlyone.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/include/policy_exactlyone.h?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/include/policy_exactlyone.h (added)
+++ webservices/axis2/scratch/c/neethi/include/policy_exactlyone.h Wed Apr 18 01:10:31 2007
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+#ifndef POLICY_EXACTLYONE_H
+#define POLICY_EXACTLYONE_H
+
+
+/**
+  * @file policy_exactlyone.h
+  * @struct for operator exactlyone 
+  */
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <policy_operator.h>
+#include <policy_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+        typedef struct policy_exactlyone_t policy_exactlyone_t; 
+
+        AXIS2_EXTERN policy_exactlyone_t *AXIS2_CALL
+        policy_exactlyone_create(const axutil_env_t *env);
+
+        AXIS2_EXTERN void AXIS2_CALL
+        policy_exactlyone_free(policy_exactlyone_t *policy_exactlyone,
+                const axutil_env_t *env);
+                
+        AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+        policy_exactlyone_get_policy_components(
+            policy_exactlyone_t *policy_exactlyone,
+            const axutil_env_t *env);
+
+        AXIS2_EXTERN axis2_status_t AXIS2_CALL
+        policy_exactlyone_add_policy_components(
+                policy_exactlyone_t *exactlyone,
+                axutil_array_list_t *arraylist,
+                const axutil_env_t *env);
+
+        AXIS2_EXTERN axis2_status_t AXIS2_CALL
+        policy_exactlyone_add_operator(policy_exactlyone_t *policy_exactlyone,
+            const axutil_env_t *env,
+            policy_operator_t *op);
+
+        AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+        policy_exactlyone_is_empty(policy_exactlyone_t *exactlyone,
+            const axutil_env_t *env);
+
+
+    /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif                          /* POLICY_EXACTLYONE_H */

Added: webservices/axis2/scratch/c/neethi/include/policy_includes.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/include/policy_includes.h?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/include/policy_includes.h (added)
+++ webservices/axis2/scratch/c/neethi/include/policy_includes.h Wed Apr 18 01:10:31 2007
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+
+#ifndef POLICY_INCLUDES_H
+#define POLICY_INCLUDES_H
+
+#include <stdio.h>
+#include <axis2_util.h>
+#include <axutil_allocator.h>
+#include <axutil_string.h>
+#include <axutil_array_list.h>
+#include <axis2_const.h>
+#include <axutil_error.h>
+#include <axutil_utils_defines.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <axutil_env.h>
+#include <axiom.h>
+#include <axiom_soap.h>
+#include <axutil_qname.h>
+#include <axutil_hash.h>
+#include <policy_constants.h>
+#include <axutil_hash.h>
+
+/**
+* @file policy_includes.h
+* @brief includes most useful headers for policy 
+*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    /** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*POLICY_INCLUDES_H*/

Added: webservices/axis2/scratch/c/neethi/include/policy_operator.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/include/policy_operator.h?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/include/policy_operator.h (added)
+++ webservices/axis2/scratch/c/neethi/include/policy_operator.h Wed Apr 18 01:10:31 2007
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+#ifndef POLICY_OPERATOR_H
+#define POLICY_OPERATOR_H
+
+
+/**
+  * @file policy_operator.h
+  * @common struct for policy operators. 
+  */
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <policy_includes.h>
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+    typedef enum  {
+        OPERATOR_TYPE_POLICY = 0,
+        OPERATOR_TYPE_ALL,
+        OPERATOR_TYPE_EXACTLYONE,
+        OPERATOR_TYPE_REFERENCE,
+        OPERATOR_TYPE_ASSERTION,
+        OPERATOR_TYPE_UNKNOWN
+    }policy_operator_type_t;
+
+    typedef struct policy_operator_t policy_operator_t;
+
+
+    AXIS2_EXTERN policy_operator_t *AXIS2_CALL
+    policy_operator_create(const axutil_env_t *env);
+
+    AXIS2_EXTERN void AXIS2_CALL
+    policy_operator_free(policy_operator_t *policy_operator,
+            const axutil_env_t *env);
+
+    AXIS2_EXTERN policy_operator_type_t AXIS2_CALL
+    policy_operator_get_type(policy_operator_t *policy_operator,
+            const axutil_env_t *env);
+
+    AXIS2_EXTERN void *AXIS2_CALL
+    policy_operator_get_value(
+            policy_operator_t *policy_operator,
+            const axutil_env_t *env);
+
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    policy_operator_set_value(policy_operator_t *policy_operator,
+            const axutil_env_t *env,
+            void *value,
+            policy_operator_type_t type);
+
+
+    /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif                          /* POLICY_OPERATOR_H */

Added: webservices/axis2/scratch/c/neethi/include/policy_reference.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/include/policy_reference.h?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/include/policy_reference.h (added)
+++ webservices/axis2/scratch/c/neethi/include/policy_reference.h Wed Apr 18 01:10:31 2007
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+#ifndef POLICY_REFERENCE_H
+#define POLICY_REFERENCE_H
+
+
+/**
+  * @file policy_reference.h
+  * @struct for operator reference 
+  */
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <policy_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+        typedef struct policy_reference_t policy_reference_t; 
+
+        AXIS2_EXTERN policy_reference_t *AXIS2_CALL
+        policy_reference_create(const axutil_env_t *env);
+
+        AXIS2_EXTERN void AXIS2_CALL
+        policy_reference_free(policy_reference_t *policy_reference,
+                const axutil_env_t *env);
+
+        AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+        policy_reference_get_uri(
+            policy_reference_t *policy_reference,
+            const axutil_env_t *env);
+
+        AXIS2_EXTERN axis2_status_t AXIS2_CALL
+        policy_reference_set_uri(
+            policy_reference_t *policy_reference,
+            const axutil_env_t *env,
+            axis2_char_t *uri);
+                
+
+
+    /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif                          /* POLICY_REFERENCE_H */

Added: webservices/axis2/scratch/c/neethi/include/policy_registry.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/include/policy_registry.h?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/include/policy_registry.h (added)
+++ webservices/axis2/scratch/c/neethi/include/policy_registry.h Wed Apr 18 01:10:31 2007
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+#ifndef POLICY_REGISTRY_H
+#define POLICY_REGISTRY_H
+
+
+/**
+  * @file policy_registry.h
+  * @struct for operator registry 
+  */
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <policy_includes.h>
+#include <policy.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+        typedef struct policy_registry_t policy_registry_t; 
+
+        AXIS2_EXTERN policy_registry_t *AXIS2_CALL
+        policy_registry_create(const axutil_env_t *env);
+
+        AXIS2_EXTERN void AXIS2_CALL
+        policy_registry_free(policy_registry_t *policy_registry,
+                const axutil_env_t *env);
+                
+        AXIS2_EXTERN axis2_status_t AXIS2_CALL
+        policy_registry_register(
+            policy_registry_t *policy_registry,
+            const axutil_env_t *env,
+            axis2_char_t *key,
+            policy_t *value);
+
+        AXIS2_EXTERN policy_t *AXIS2_CALL
+        policy_registry_lookup(
+            policy_registry_t *policy_registry,
+            const axutil_env_t *env,
+            axis2_char_t *key);
+
+
+
+    /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif                          /* POLICY_REGISTRY_H*/

Added: webservices/axis2/scratch/c/neethi/include/rp_transport_binding_builder.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/include/rp_transport_binding_builder.h?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/include/rp_transport_binding_builder.h (added)
+++ webservices/axis2/scratch/c/neethi/include/rp_transport_binding_builder.h Wed Apr 18 01:10:31 2007
@@ -0,0 +1,46 @@
+/*
+ * 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 RP_TRANSPORT_BINDING_BUILDER_H
+#define RP_TRANSPORT_BINDING_BUILDER_H
+
+/** @defgroup rp_transport_binding_builder
+ * @ingroup rp_transport_binding_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_transport_binding.h>
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+    AXIS2_EXTERN rp_transport_binding_t *AXIS2_CALL
+    transport_binding_builder_build(
+        const axutil_env_t *env,
+        axiom_node_t *node,
+        axiom_element_t *element);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif

Added: webservices/axis2/scratch/c/neethi/include/rp_transport_token_builder.h
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/include/rp_transport_token_builder.h?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/include/rp_transport_token_builder.h (added)
+++ webservices/axis2/scratch/c/neethi/include/rp_transport_token_builder.h Wed Apr 18 01:10:31 2007
@@ -0,0 +1,44 @@
+/*
+ * 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 RP_TRANSPORT_TOKEN_BUILDER_H
+#define RP_TRANSPORT_TOKEN_BUILDER_H
+
+/** @defgroup rp_transport_token_builder
+ * @ingroup rp_transport_token_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_https_token.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+    AXIS2_EXTERN rp_property_t *AXIS2_CALL
+    transport_token_builder_build(
+        const axutil_env_t *env,
+        axiom_node_t *node,
+        axiom_element_t *element);
+ 
+
+#ifdef __cplusplus
+}
+#endif
+#endif

Added: webservices/axis2/scratch/c/neethi/src/all.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/src/all.c?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/src/all.c (added)
+++ webservices/axis2/scratch/c/neethi/src/all.c Wed Apr 18 01:10:31 2007
@@ -0,0 +1,141 @@
+/*
+ * 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.
+ */
+
+
+
+#include <policy_all.h>
+
+struct policy_all_t
+{
+    axutil_array_list_t *policy_components;
+};
+
+AXIS2_EXTERN policy_all_t *AXIS2_CALL 
+policy_all_create(const axutil_env_t *env)
+{
+    policy_all_t *policy_all = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    policy_all =  (policy_all_t *) AXIS2_MALLOC (env->allocator,
+    sizeof (policy_all_t));
+
+    if(policy_all == NULL)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    policy_all->policy_components = NULL;
+
+    policy_all->policy_components = axutil_array_list_create(env, 0);
+    if (!(policy_all->policy_components) )
+    {
+        policy_all_free(policy_all, env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    return policy_all;
+}
+
+AXIS2_EXTERN void AXIS2_CALL 
+policy_all_free(policy_all_t *policy_all,
+        const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    if(policy_all)
+    {
+        if(policy_all->policy_components)
+        {
+            int i = 0;
+            for (i = 0; i < axutil_array_list_size(policy_all->policy_components,
+                env); i++)
+            {
+                policy_operator_t *operator = NULL;
+                operator = (policy_operator_t *)
+                    axutil_array_list_get(policy_all->policy_components,env, i);
+                if (operator)
+                    policy_operator_free(operator, env);
+
+                operator = NULL;
+            }
+            axutil_array_list_free(policy_all->policy_components , env);
+            policy_all->policy_components = NULL;
+        }
+        AXIS2_FREE(env->allocator,policy_all);
+        policy_all = NULL;
+    }
+    return;
+}
+
+
+/* Implementations */
+
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+policy_all_get_policy_components(
+    policy_all_t *policy_all,
+    const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    return policy_all->policy_components;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL 
+policy_all_add_policy_components(
+        policy_all_t *all,
+        axutil_array_list_t *arraylist,
+        const axutil_env_t *env)
+{
+
+    int size = axutil_array_list_size(arraylist,env);
+    int i = 0;    
+
+    if (axutil_array_list_ensure_capacity(all->policy_components , env, size + 1) != AXIS2_SUCCESS)
+            return AXIS2_FAILURE;
+    
+    for(i=0; i<size; i++)
+    {
+        void *value = NULL;
+        value = axutil_array_list_get(arraylist ,env ,i);
+        axutil_array_list_add(all->policy_components,env,value);
+    }
+    return AXIS2_SUCCESS;
+}
+
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+policy_all_add_operator(policy_all_t *policy_all,
+            const axutil_env_t *env,
+            policy_operator_t *operator)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    axutil_array_list_add(policy_all->policy_components,env,operator);
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+policy_all_is_empty(policy_all_t *all,
+            const axutil_env_t *env)
+
+{
+    return axutil_array_list_is_empty(all->policy_components , env);
+}
+
+

Added: webservices/axis2/scratch/c/neethi/src/assertion.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/src/assertion.c?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/src/assertion.c (added)
+++ webservices/axis2/scratch/c/neethi/src/assertion.c Wed Apr 18 01:10:31 2007
@@ -0,0 +1,213 @@
+/*
+ * 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.
+ */
+
+
+
+#include <policy_assertion.h>
+
+struct policy_assertion_t
+{
+    void *value;
+    policy_assertion_type_t type;
+    axutil_array_list_t *policy_components;
+    axiom_element_t *element;
+    axis2_bool_t is_optional;
+};
+
+AXIS2_EXTERN policy_assertion_t *AXIS2_CALL 
+policy_assertion_create(const axutil_env_t *env)
+{
+    policy_assertion_t *policy_assertion = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    policy_assertion =  (policy_assertion_t *) AXIS2_MALLOC (env->allocator,
+    sizeof (policy_assertion_t));
+
+    if(policy_assertion == NULL)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    policy_assertion->policy_components = NULL;
+
+    policy_assertion->policy_components = axutil_array_list_create(env, 0);
+    if (!(policy_assertion->policy_components))
+    {
+/*      policy_free(policy, env);*/
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    policy_assertion->value = NULL;
+    policy_assertion->type = ASSERTION_TYPE_UNKNOWN;
+    policy_assertion->element = NULL;
+    policy_assertion->is_optional = AXIS2_FALSE;
+
+    return policy_assertion;
+}
+
+/*
+This will be implemented later. 
+
+AXIS2_EXTERN void AXIS2_CALL 
+policy_assertion_free(policy_assertion_t *policy_assertion,
+        const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    if(policy_assertion)
+    {
+        if(policy_assertion->value)
+        {
+            switch(policy_assertion->type)
+            {
+            }
+            AXIS2_FREE(env->allocator,policy_assertion->value);     
+        }            
+    }
+    return; 
+}
+*/
+
+/* Implementations */
+
+AXIS2_EXTERN policy_assertion_type_t AXIS2_CALL 
+policy_assertion_get_type(policy_assertion_t *policy_assertion,
+            const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+        
+    return policy_assertion->type;
+}
+
+AXIS2_EXTERN void *AXIS2_CALL
+policy_assertion_get_value(
+    policy_assertion_t *policy_assertion,
+    const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    return policy_assertion->value;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+policy_assertion_set_value(policy_assertion_t *policy_assertion,
+    const axutil_env_t *env,
+    void *value,
+    policy_assertion_type_t type)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    policy_assertion->type = type;
+    policy_assertion->value =(void *)value;
+
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axiom_element_t *AXIS2_CALL
+policy_assertion_get_element(
+    policy_assertion_t *policy_assertion,
+    const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    return policy_assertion->element;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+policy_assertion_set_element(policy_assertion_t *policy_assertion,
+    const axutil_env_t *env,
+    axiom_element_t *element)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    policy_assertion->element = element;
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+policy_assertion_get_is_optional(
+    policy_assertion_t *policy_assertion,
+    const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    return policy_assertion->is_optional;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+policy_assertion_set_is_optional(policy_assertion_t *policy_assertion,
+    const axutil_env_t *env,
+    axis2_bool_t is_optional)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    policy_assertion->is_optional = is_optional;
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+policy_assertion_get_policy_components(
+    policy_assertion_t *policy_assertion,
+    const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, NULL);
+
+    return policy_assertion->policy_components;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+policy_assertion_add_policy_components(
+        policy_assertion_t *policy_assertion,
+        axutil_array_list_t *arraylist,
+        const axutil_env_t *env)
+{
+
+    int size = axutil_array_list_size(arraylist,env);
+    int i = 0;
+
+    if (axutil_array_list_ensure_capacity(policy_assertion->policy_components , env, size + 1) != AXIS2_SUCCESS)
+            return AXIS2_FAILURE;
+
+    for(i=0; i<size; i++)
+    {
+        void *value = NULL;
+        value = axutil_array_list_get(arraylist ,env ,i);
+        axutil_array_list_add(policy_assertion->policy_components,env,value);
+    }
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+policy_assertion_add_operator(policy_assertion_t *policy_assertion,
+            const axutil_env_t *env,
+            policy_operator_t *operator)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    axutil_array_list_add(policy_assertion->policy_components,env,operator);
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+policy_is_empty(policy_assertion_t *policy_assertion,
+            const axutil_env_t *env)
+
+{
+    return axutil_array_list_is_empty(policy_assertion->policy_components , env);
+}
+

Added: webservices/axis2/scratch/c/neethi/src/exactlyone.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/src/exactlyone.c?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/src/exactlyone.c (added)
+++ webservices/axis2/scratch/c/neethi/src/exactlyone.c Wed Apr 18 01:10:31 2007
@@ -0,0 +1,140 @@
+/*
+ * 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.
+ */
+
+
+
+#include <policy_exactlyone.h>
+
+struct policy_exactlyone_t
+{
+    axutil_array_list_t *policy_components;
+};
+
+AXIS2_EXTERN policy_exactlyone_t *AXIS2_CALL 
+policy_exactlyone_create(const axutil_env_t *env)
+{
+    policy_exactlyone_t *policy_exactlyone = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    policy_exactlyone =  (policy_exactlyone_t *) AXIS2_MALLOC (env->allocator,
+    sizeof (policy_exactlyone_t));
+
+    if(policy_exactlyone == NULL)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    policy_exactlyone->policy_components = NULL;
+
+    policy_exactlyone->policy_components = axutil_array_list_create(env, 0);
+    if (!(policy_exactlyone->policy_components) )
+    {
+        policy_exactlyone_free(policy_exactlyone, env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    return policy_exactlyone;
+}
+
+AXIS2_EXTERN void AXIS2_CALL 
+policy_exactlyone_free(policy_exactlyone_t *policy_exactlyone,
+        const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    if(policy_exactlyone)
+    {
+        if(policy_exactlyone->policy_components)
+        {
+            int i = 0;
+            for (i = 0; i < axutil_array_list_size(policy_exactlyone->policy_components,
+                env); i++)
+            {
+                policy_operator_t *operator = NULL;
+                operator = (policy_operator_t *)
+                    axutil_array_list_get(policy_exactlyone->policy_components,env, i);
+                if (operator)
+                    policy_operator_free(operator, env);
+
+                operator = NULL;
+            }
+            axutil_array_list_free(policy_exactlyone->policy_components , env);
+            policy_exactlyone->policy_components = NULL;
+        }
+        AXIS2_FREE(env->allocator,policy_exactlyone);
+        policy_exactlyone = NULL;
+    }
+    return;
+}
+
+
+/* Implementations */
+
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+policy_exactlyone_get_policy_components(
+    policy_exactlyone_t *policy_exactlyone,
+    const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    return policy_exactlyone->policy_components;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+policy_exactlyone_add_policy_components(
+        policy_exactlyone_t *exactlyone,
+        axutil_array_list_t *arraylist,
+        const axutil_env_t *env)
+{
+
+    int size = axutil_array_list_size(arraylist,env);
+    int i = 0;
+
+    if (axutil_array_list_ensure_capacity(exactlyone->policy_components , env, size + 1) != AXIS2_SUCCESS)
+            return AXIS2_FAILURE;
+
+    for(i=0; i<size; i++)
+    {
+        void *value = NULL;
+        value = axutil_array_list_get(arraylist ,env ,i);
+        axutil_array_list_add(exactlyone->policy_components,env,value);
+    }
+    return AXIS2_SUCCESS;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+policy_exactlyone_add_operator(policy_exactlyone_t *policy_exactlyone,
+            const axutil_env_t *env,
+            policy_operator_t *operator)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    axutil_array_list_add(policy_exactlyone->policy_components,env,operator);
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+policy_exactlyone_is_empty(policy_exactlyone_t *exactlyone,
+            const axutil_env_t *env)
+
+{
+    return axutil_array_list_is_empty(exactlyone->policy_components , env);
+}
+

Added: webservices/axis2/scratch/c/neethi/src/policy.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/src/policy.c?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/src/policy.c (added)
+++ webservices/axis2/scratch/c/neethi/src/policy.c Wed Apr 18 01:10:31 2007
@@ -0,0 +1,197 @@
+/*
+ * 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.
+ */
+
+
+
+#include <policy.h>
+#include <policy_engine.h>
+
+struct policy_t
+{
+    axutil_array_list_t *policy_components;
+};
+
+AXIS2_EXTERN policy_t *AXIS2_CALL 
+policy_create(const axutil_env_t *env)
+{
+    policy_t *policy = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    policy =  (policy_t *) AXIS2_MALLOC (env->allocator,
+    sizeof (policy_t));
+
+    if(policy == NULL)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    policy->policy_components = NULL;
+
+    policy->policy_components = axutil_array_list_create(env, 0);
+    if (!(policy->policy_components) )
+    {
+        policy_free(policy, env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    return policy;
+}
+
+AXIS2_EXTERN void AXIS2_CALL 
+policy_free(policy_t *policy,
+        const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    if(policy)
+    {
+        if(policy->policy_components)
+        {
+            int i = 0;
+            for (i = 0; i < axutil_array_list_size(policy->policy_components,
+                env); i++)
+            {
+                policy_operator_t *operator = NULL;
+                operator = (policy_operator_t *)
+                    axutil_array_list_get(policy->policy_components,env, i);
+                if (operator)
+                    policy_operator_free(operator, env);
+
+                operator = NULL;
+            }
+            axutil_array_list_free(policy->policy_components , env);
+            policy->policy_components = NULL;
+        }
+        AXIS2_FREE(env->allocator,policy);
+        policy = NULL;
+    }
+    return;
+}
+
+
+/* Implementations */
+
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+policy_get_policy_components(
+    policy_t *policy,
+    const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, NULL);
+
+    return policy->policy_components;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+policy_add_policy_components(
+        policy_t *policy,
+        axutil_array_list_t *arraylist,
+        const axutil_env_t *env)
+{
+
+    int size = axutil_array_list_size(arraylist,env);
+    int i = 0;
+
+    if (axutil_array_list_ensure_capacity(policy->policy_components , env, size + 1) != AXIS2_SUCCESS)
+            return AXIS2_FAILURE;
+
+    for(i=0; i<size; i++)
+    {
+        void *value = NULL;
+        value = axutil_array_list_get(arraylist ,env ,i);
+        axutil_array_list_add(policy->policy_components,env,value);
+    }
+    return AXIS2_SUCCESS;
+}
+
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+policy_add_operator(policy_t *policy,
+            const axutil_env_t *env,
+            policy_operator_t *operator)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    axutil_array_list_add(policy->policy_components,env,operator);
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+policy_is_empty(policy_t *policy,
+            const axutil_env_t *env)
+            
+{
+    return axutil_array_list_is_empty(policy->policy_components , env);
+}
+
+AXIS2_EXTERN policy_exactlyone_t *AXIS2_CALL 
+policy_get_exactlyone(
+    policy_t *normalized_policy,
+    const axutil_env_t *env)
+{
+    policy_exactlyone_t *exactlyone = NULL;
+    axutil_array_list_t *list = NULL;
+
+    list = policy_get_policy_components(normalized_policy,env);
+    if(list)
+    {
+        if(axutil_array_list_size(list,env)==1)
+        {
+            policy_operator_t *op = NULL;
+            op = (policy_operator_t *)axutil_array_list_get(list,env,0);
+            if(!op)
+            {
+                printf("Error in normalized policy\n");
+                return NULL;
+            }               
+            if(policy_operator_get_type(op,env) != OPERATOR_TYPE_EXACTLYONE)
+            {
+                printf("Error in normalized policy\n");
+                return NULL;
+            }               
+            exactlyone = (policy_exactlyone_t *)policy_operator_get_value(op,env);
+            return exactlyone;
+        }            
+        else
+            return NULL;
+    }        
+    else
+        return NULL;
+}
+
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+policy_get_alternatives(
+    policy_t *policy,
+    const axutil_env_t *env)
+{
+
+    policy_t *normalized = NULL;
+    policy_exactlyone_t *exactlyone = NULL;
+
+    normalized = policy_engine_get_normalize(policy,AXIS2_FALSE,env);
+
+    if(!normalized)
+        return NULL;
+
+    exactlyone = policy_get_exactlyone(normalized, env);
+    if(!exactlyone)
+        return NULL;
+    
+   return policy_exactlyone_get_policy_components(exactlyone, env);
+
+}

Added: webservices/axis2/scratch/c/neethi/src/policy_engine.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/src/policy_engine.c?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/src/policy_engine.c (added)
+++ webservices/axis2/scratch/c/neethi/src/policy_engine.c Wed Apr 18 01:10:31 2007
@@ -0,0 +1,726 @@
+/*
+ * 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.
+ */
+
+
+
+#include <policy_engine.h>
+
+/*Private functions*/
+
+policy_all_t *AXIS2_CALL get_operator_all(
+        const axutil_env_t *env,
+        axiom_node_t *node,
+        axiom_element_t *element);
+
+policy_exactlyone_t *AXIS2_CALL get_operator_exactlyone(
+        const axutil_env_t *env,
+        axiom_node_t *node,
+        axiom_element_t *element);
+
+policy_reference_t *AXIS2_CALL get_operator_reference(
+        const axutil_env_t *env,
+        axiom_node_t *node,
+        axiom_element_t *element);
+
+policy_t *AXIS2_CALL get_operator_policy(
+        const axutil_env_t *env,
+        axiom_node_t *node,
+        axiom_element_t *element);
+
+axis2_status_t AXIS2_CALL process_operation_element(
+        const axutil_env_t *env,
+        policy_operator_t *policy_operator,
+        axiom_node_t *node,
+        axiom_element_t *element);
+
+axis2_status_t AXIS2_CALL policy_engine_add_policy_component(
+        const axutil_env_t *env,
+        policy_operator_t *container_operator,
+        policy_operator_t *component);
+
+axis2_bool_t AXIS2_CALL
+operator_is_empty(
+    policy_operator_t *operator,
+    const axutil_env_t *env);
+
+policy_exactlyone_t *AXIS2_CALL
+compute_resultant_component(
+    axutil_array_list_t *normalized_inner_components,
+    policy_operator_type_t type,
+    const axutil_env_t *env);
+
+axutil_array_list_t *AXIS2_CALL
+operator_get_components(
+    policy_operator_t *operator,
+    const axutil_env_t *env);
+
+policy_exactlyone_t *AXIS2_CALL
+normalize_operator(
+    policy_operator_t *operator,
+    policy_registry_t *registry,
+    axis2_bool_t deep,
+    const axutil_env_t *env);
+
+policy_exactlyone_t *AXIS2_CALL
+get_cross_product(
+    policy_exactlyone_t *exactlyone1,
+    policy_exactlyone_t *exactlyone2,
+    const axutil_env_t *env);
+
+
+
+/*Implementations*/
+
+
+AXIS2_EXTERN policy_t *AXIS2_CALL
+policy_engine_get_policy(
+    const axutil_env_t *env,
+    axiom_node_t *node,
+    axiom_element_t *element)
+{
+
+    return get_operator_policy(env,node,element);    
+
+}
+
+policy_all_t *AXIS2_CALL get_operator_all(
+        const axutil_env_t *env,
+        axiom_node_t *node,
+        axiom_element_t *element)
+{
+    policy_all_t *all = NULL;
+    policy_operator_t *policy_operator = NULL;
+
+    all = policy_all_create(env);
+
+    if(!all)
+    {
+        return NULL;
+    }
+    policy_operator = policy_operator_create(env);
+    if(!policy_operator)
+    {
+        return NULL;
+    }        
+    policy_operator_set_value(policy_operator,env,all,OPERATOR_TYPE_ALL);
+    process_operation_element(env,policy_operator,node,element);
+
+    return all;
+}   
+
+policy_exactlyone_t *AXIS2_CALL get_operator_exactlyone(
+        const axutil_env_t *env,
+        axiom_node_t *node,
+        axiom_element_t *element)
+{
+    policy_exactlyone_t *exactlyone = NULL;
+    policy_operator_t *policy_operator = NULL;
+
+    exactlyone = policy_exactlyone_create(env);
+
+    if(!exactlyone)
+    {
+        return NULL;
+    }
+    policy_operator = policy_operator_create(env);
+    if(!policy_operator)
+    {
+        return NULL;
+    }        
+    policy_operator_set_value(policy_operator,env,exactlyone,OPERATOR_TYPE_EXACTLYONE);
+    process_operation_element(env,policy_operator,node,element);
+
+    return exactlyone;
+}
+
+policy_reference_t *AXIS2_CALL get_operator_reference(
+        const axutil_env_t *env,
+        axiom_node_t *node,
+        axiom_element_t *element)
+{
+    policy_reference_t *reference = NULL;
+    axutil_qname_t *qname = NULL;
+    axis2_char_t * attribute_value = NULL;
+
+    reference = policy_reference_create(env);
+
+    if(!reference)
+    {
+        return NULL;
+    }
+    qname = axutil_qname_create(env,POLICY_URI,NULL,NULL);
+
+    if(!qname)
+    {
+        return NULL;
+    }
+
+    attribute_value = axiom_element_get_attribute_value(element,env,qname);
+    if(attribute_value)
+    {
+        policy_reference_set_uri(reference,env,attribute_value);
+    }    
+    return reference;
+}
+
+
+
+policy_t *AXIS2_CALL get_operator_policy(
+        const axutil_env_t *env,
+        axiom_node_t *node,
+        axiom_element_t *element)
+{
+    policy_t *policy = NULL;
+    policy_operator_t *policy_operator = NULL;
+
+    policy = policy_create(env);
+
+    if(!policy)
+    {
+        return NULL;
+    }
+    policy_operator = policy_operator_create(env);
+    if(!policy_operator)
+    {
+        return NULL;
+    }        
+    policy_operator_set_value(policy_operator,env,policy,OPERATOR_TYPE_POLICY);
+    process_operation_element(env,policy_operator,node,element);    
+
+    return policy;
+}
+
+
+axis2_status_t AXIS2_CALL process_operation_element(
+        const axutil_env_t *env,
+        policy_operator_t *policy_operator,
+        axiom_node_t *node,
+        axiom_element_t *element)
+{
+
+    policy_operator_type_t type;
+    axiom_element_t *child_element = NULL;
+    axiom_node_t *child_node = NULL;
+    axiom_children_iterator_t *children_iter = NULL;
+    void *value = NULL;
+
+    type = policy_operator_get_type(policy_operator,env);
+    value = policy_operator_get_value(policy_operator,env);
+    if(type == OPERATOR_TYPE_POLICY)
+    {
+        /*Adding attribute values to the hashmap logic
+         *comes here. */
+    }        
+    
+        
+    children_iter = axiom_element_get_children(element, env, node);
+    if(children_iter)
+    {
+        while(axiom_children_iterator_has_next(children_iter, env))
+        {
+            child_node = axiom_children_iterator_next(children_iter, env);
+            if(child_node)
+            {
+                if(axiom_node_get_node_type(child_node , env) == AXIOM_ELEMENT)
+                {    
+                    child_element = (axiom_element_t*)axiom_node_get_data_element(child_node, env);
+                    if(child_element)
+                    {
+                        axis2_char_t *local_name = NULL;
+                        policy_operator_t *operator = NULL;
+                        local_name = axiom_element_get_localname(child_element,env);
+
+                        if(axutil_strcmp(local_name,POLICY_POLICY)==0)
+                        {
+                            policy_t *policy = get_operator_policy(env,child_node,child_element);
+                            operator = policy_operator_create(env);
+                            policy_operator_set_value(operator,env,policy,OPERATOR_TYPE_POLICY);
+                            policy_engine_add_policy_component(env,policy_operator,operator);
+                        }
+
+                        else if(axutil_strcmp(local_name,POLICY_ALL)==0)
+                        {
+                            policy_all_t *all = get_operator_all(env,child_node,child_element);
+                            operator = policy_operator_create(env);
+                            policy_operator_set_value(operator,env,all,OPERATOR_TYPE_ALL);
+                            policy_engine_add_policy_component(env,policy_operator,operator);
+                        }
+
+                        else if(axutil_strcmp(local_name,POLICY_EXACTLYONE)==0)
+                        {
+                            policy_exactlyone_t *exactlyone = get_operator_exactlyone(env,child_node,child_element);
+                            operator = policy_operator_create(env);
+                            policy_operator_set_value(operator,env,exactlyone,OPERATOR_TYPE_EXACTLYONE);
+                            policy_engine_add_policy_component(env,policy_operator,operator);
+                        }
+                        else if(axutil_strcmp(local_name,POLICY_REFERENCE)==0)
+                        {
+                            policy_reference_t *reference = get_operator_reference(env,child_node,child_element);
+                            operator = policy_operator_create(env);
+                            policy_operator_set_value(operator,env,reference,OPERATOR_TYPE_REFERENCE);
+                            policy_engine_add_policy_component(env,policy_operator,operator);
+                        }                        
+                        else
+                            return AXIS2_FAILURE;
+                    }
+                }
+            }
+        }
+        return AXIS2_SUCCESS;
+    }        
+}
+
+
+axis2_status_t AXIS2_CALL policy_engine_add_policy_component(
+        const axutil_env_t *env,
+        policy_operator_t *container_operator,
+        policy_operator_t *component)
+{
+
+    policy_operator_type_t type;
+    void *value = NULL;
+    policy_t *policy = NULL;
+    policy_exactlyone_t *exactlyone = NULL;
+    policy_all_t *all = NULL;
+
+    type = policy_operator_get_type(container_operator,env);
+    value = policy_operator_get_value(container_operator,env);        
+    
+    if(value)
+    {
+        switch(type)
+        {
+            case OPERATOR_TYPE_POLICY:
+                policy = (policy_t *)value;
+                policy_add_operator(policy,env,component);   
+                printf("policy\n");
+                break;
+
+            case OPERATOR_TYPE_ALL:
+                all = (policy_all_t *)value;
+                policy_all_add_operator(all,env,component);
+                printf("all\n");
+                break;
+
+            case OPERATOR_TYPE_EXACTLYONE:
+                exactlyone = (policy_exactlyone_t *)value;
+                policy_exactlyone_add_operator(exactlyone,env,component);
+                printf("exactlyone\n");
+                break;
+
+            case OPERATOR_TYPE_UNKNOWN:
+                return AXIS2_FAILURE;
+                break;
+        }
+        return AXIS2_SUCCESS;
+    }
+    else return AXIS2_FAILURE;
+}
+
+/***************************************/
+/*This function is only for testing*
+ *Remove it later*/
+void check_policy(policy_t *policy , const axutil_env_t *env)
+{
+    axutil_array_list_t *list = NULL;
+    policy_operator_t *op = NULL;
+    policy_operator_type_t type;
+
+    list = policy_get_policy_components(policy,env);
+
+    if(axutil_array_list_size(list,env)>1)
+    {
+        printf("Error with Normalized policy\n");
+        return;
+    }        
+    op = (policy_operator_t *)axutil_array_list_get(list,env,0);
+    type = policy_operator_get_type(op,env);
+    if(type == OPERATOR_TYPE_EXACTLYONE)
+    {
+        void *value = policy_operator_get_value(op,env);
+        if(value)
+        {
+            printf("Check is ok\n");
+            return;
+        }          
+    }
+    else 
+    {
+        printf("Not properly normalized\n");
+        return;
+    }        
+}    
+
+/************************************************/
+
+AXIS2_EXTERN policy_t *AXIS2_CALL
+policy_engine_get_normalize(
+        policy_t *policy,
+        axis2_bool_t deep,
+        const axutil_env_t *env)
+{
+    return policy_engine_normalize(policy, NULL, deep, env);
+}
+
+
+AXIS2_EXTERN policy_t *AXIS2_CALL
+policy_engine_normalize(
+    policy_t *policy,
+    policy_registry_t *registry,
+    axis2_bool_t deep,
+    const axutil_env_t *env)
+{
+    policy_t *resultant_policy = NULL;
+    policy_operator_t *operator = NULL;
+    policy_operator_t *component = NULL;
+    policy_exactlyone_t *exactlyone = NULL;
+
+    resultant_policy = policy_create(env);
+    operator = policy_operator_create(env);
+    policy_operator_set_value(operator,env,policy,OPERATOR_TYPE_POLICY);
+
+    exactlyone = normalize_operator(operator,registry,deep,env);
+
+    if(exactlyone)
+    {
+        component = policy_operator_create(env);
+        policy_operator_set_value(component,env,exactlyone,OPERATOR_TYPE_EXACTLYONE);
+        policy_add_operator(resultant_policy,env,component);
+        
+        check_policy(resultant_policy,env);
+        return resultant_policy;
+    }        
+    else
+        return NULL;
+}
+
+AXIS2_EXTERN policy_t *AXIS2_CALL
+policy_engine_merge(
+    policy_t *policy1,
+    policy_t *policy2,
+    const axutil_env_t *env)
+{
+
+    policy_exactlyone_t *exactlyone1 = NULL;
+    policy_exactlyone_t *exactlyone2 = NULL;
+    policy_exactlyone_t *exactlyone = NULL;
+    policy_t *policy = NULL;
+    policy_operator_t *component = NULL;
+
+    exactlyone1 = policy_get_exactlyone(policy1,env);
+    exactlyone2 = policy_get_exactlyone(policy2,env);    
+
+    if(!exactlyone1 || !exactlyone2)
+    {
+        printf("Merged fail Input wrong \n");
+        return NULL;
+    }
+    exactlyone = get_cross_product(exactlyone1,exactlyone2,env);
+    
+    policy = policy_create(env);
+
+    component = policy_operator_create(env);
+    policy_operator_set_value(component,env,exactlyone,OPERATOR_TYPE_EXACTLYONE);
+    policy_add_operator(policy,env,component);
+
+    return policy;
+}
+
+
+
+axis2_bool_t AXIS2_CALL 
+operator_is_empty(
+    policy_operator_t *operator,
+    const axutil_env_t *env)
+{
+    
+    policy_operator_type_t type;
+    void *value = NULL;
+    policy_t *policy = NULL;
+    policy_exactlyone_t *exactlyone = NULL;
+    policy_all_t *all = NULL;
+
+    type = policy_operator_get_type(operator,env);
+    value = policy_operator_get_value(operator,env);
+
+    if(value)
+    {
+        switch(type)
+        {
+            case OPERATOR_TYPE_POLICY:
+                policy = (policy_t *)value;
+                return policy_is_empty(policy,env);
+                break;
+
+            case OPERATOR_TYPE_ALL:
+                all = (policy_all_t *)value;
+                return policy_all_is_empty(all,env);
+                break;
+
+            case OPERATOR_TYPE_EXACTLYONE:
+                exactlyone = (policy_exactlyone_t *)value;
+                return policy_exactlyone_is_empty(exactlyone,env);
+                break;
+
+            case OPERATOR_TYPE_UNKNOWN:
+                return AXIS2_FALSE;
+                break;
+        }
+        return AXIS2_FALSE;
+    }
+    else return AXIS2_FALSE;
+}
+
+axutil_array_list_t *AXIS2_CALL 
+operator_get_components(
+    policy_operator_t *operator,
+    const axutil_env_t *env)
+{
+    
+    policy_operator_type_t type;
+    void *value = NULL;
+    policy_t *policy = NULL;
+    policy_exactlyone_t *exactlyone = NULL;
+    policy_all_t *all = NULL;
+
+    type = policy_operator_get_type(operator,env);
+    value = policy_operator_get_value(operator,env);
+
+    if(value)
+    {
+        switch(type)
+        {
+            case OPERATOR_TYPE_POLICY:
+                policy = (policy_t *)value;
+                return policy_get_policy_components(policy,env);
+                break;
+
+            case OPERATOR_TYPE_ALL:
+                all = (policy_all_t *)value;
+                return policy_all_get_policy_components(all,env);
+                break;
+
+            case OPERATOR_TYPE_EXACTLYONE:
+                exactlyone = (policy_exactlyone_t *)value;
+                return policy_exactlyone_get_policy_components(exactlyone,env);
+                break;
+
+            case OPERATOR_TYPE_UNKNOWN:
+                return NULL;
+                break;
+        }
+    }
+    else return NULL;
+}
+
+
+
+policy_exactlyone_t *AXIS2_CALL
+normalize_operator(
+    policy_operator_t *operator,
+    policy_registry_t *registry,
+    axis2_bool_t deep,
+    const axutil_env_t *env)
+{
+    axutil_array_list_t *child_component_list = NULL;
+    policy_operator_t *child_component = NULL;
+    axutil_array_list_t *arraylist = NULL;
+    int i = 0;
+
+    policy_operator_type_t type = policy_operator_get_type(operator,env);
+    
+    if(operator_is_empty(operator,env))
+    {
+        policy_exactlyone_t *exactlyone = NULL;
+        exactlyone = policy_exactlyone_create(env);
+        if(type != OPERATOR_TYPE_EXACTLYONE)
+        {
+            policy_all_t *all = NULL;
+            policy_operator_t *component = NULL;
+            all = policy_all_create(env);
+            component = policy_operator_create(env);
+            policy_operator_set_value(component,env,all,OPERATOR_TYPE_ALL);
+            policy_exactlyone_add_operator(exactlyone,env,component);
+        }                        
+        return exactlyone;
+    }
+    
+    child_component_list = axutil_array_list_create(env,0);     
+    arraylist = operator_get_components(operator,env);
+
+    for (i = 0; i < axutil_array_list_size(arraylist,env); i++)
+    {
+        policy_operator_type_t component_type;
+        child_component = (policy_operator_t *)axutil_array_list_get(arraylist ,env ,i);
+        component_type = policy_operator_get_type(child_component,env);
+        
+        if(component_type == OPERATOR_TYPE_ASSERTION)
+        {
+            /*Assertion normalization part comes here*/
+        }
+        
+        else if(component_type == OPERATOR_TYPE_REFERENCE)
+        {
+            axis2_char_t *uri = NULL;
+            policy_reference_t *pol_ref = NULL;
+            policy_t *policy = NULL;
+
+            pol_ref = (policy_reference_t *)policy_operator_get_value(child_component,env);
+            uri = policy_reference_get_uri(pol_ref,env);
+            if(uri)
+            {
+                policy = policy_registry_lookup(registry,env,uri);
+                if(policy)
+                {
+                    policy_operator_set_value(child_component,env,policy,OPERATOR_TYPE_POLICY);
+                    component_type = OPERATOR_TYPE_POLICY;
+                }
+                else
+                {
+                    printf("Cannot Resolve the location\n");
+                    return NULL;
+                }    
+            }    
+        }
+        else if(component_type == OPERATOR_TYPE_POLICY)
+        {
+            policy_t *policy = NULL;
+            policy_all_t *all = NULL;
+            axutil_array_list_t *children = NULL;            
+            policy_operator_t *to_normalize = NULL;
+            policy_exactlyone_t *exactlyone = NULL;
+
+            all = policy_all_create(env);
+            policy = (policy_t *)policy_operator_get_value(child_component,env);
+            children =  policy_get_policy_components(policy,env);
+            policy_all_add_policy_components(all,children,env);
+            to_normalize = policy_operator_create(env);
+            policy_operator_set_value(to_normalize,env,all,OPERATOR_TYPE_ALL);
+            exactlyone = normalize_operator(to_normalize,registry,deep,env);
+            axutil_array_list_add(child_component_list,env,exactlyone);                    
+        }
+        else
+        {
+            policy_exactlyone_t *exactlyone = NULL;
+            exactlyone = normalize_operator(child_component,registry,deep,env);
+            axutil_array_list_add(child_component_list,env,exactlyone);
+        }
+    }
+    return compute_resultant_component(child_component_list,type,env);
+}
+
+
+policy_exactlyone_t *AXIS2_CALL
+compute_resultant_component(
+    axutil_array_list_t *normalized_inner_components,
+    policy_operator_type_t type,
+    const axutil_env_t *env)
+{
+    policy_exactlyone_t *exactlyone = NULL;
+    exactlyone = policy_exactlyone_create(env);
+
+    if(type == OPERATOR_TYPE_EXACTLYONE)
+    {
+        int i = 0;
+        policy_exactlyone_t *inner_exactlyone = NULL;
+        
+        for(i=0; i<axutil_array_list_size(normalized_inner_components,env); i++ )
+        {
+            inner_exactlyone = (policy_exactlyone_t *)axutil_array_list_get(normalized_inner_components,env,i);
+            policy_exactlyone_add_policy_components(exactlyone,
+                           policy_exactlyone_get_policy_components(inner_exactlyone,env),env);
+            
+        }
+    }
+    else if(type == OPERATOR_TYPE_POLICY ||
+                type == OPERATOR_TYPE_ALL)
+    {
+        if(axutil_array_list_size(normalized_inner_components,env)>1)
+        {
+            int i = 0;
+            exactlyone = (policy_exactlyone_t *)axutil_array_list_get(normalized_inner_components,env,0);
+            if(!policy_exactlyone_is_empty(exactlyone,env))
+            {
+                policy_exactlyone_t *current_exactlyone = NULL;
+                i = 1;
+                for(i=1; i<axutil_array_list_size(normalized_inner_components,env); i++)
+                {
+                    current_exactlyone = (policy_exactlyone_t *)axutil_array_list_get(normalized_inner_components,env,i);
+                    if(policy_exactlyone_is_empty(current_exactlyone,env)) 
+                    {
+                        exactlyone = current_exactlyone;
+                        break;    
+                    } 
+                    else
+                        exactlyone = get_cross_product(exactlyone,current_exactlyone,env);
+                }
+            }
+        }
+        else
+            exactlyone = (policy_exactlyone_t *)axutil_array_list_get(normalized_inner_components,env,0);    
+    }
+    return exactlyone;
+}
+
+
+policy_exactlyone_t *AXIS2_CALL
+get_cross_product(
+    policy_exactlyone_t *exactlyone1,
+    policy_exactlyone_t *exactlyone2,
+    const axutil_env_t *env)
+{
+    policy_exactlyone_t *cross_product = NULL;
+    policy_all_t *cross_product_all = NULL;
+    policy_all_t *current_all1 = NULL;
+    policy_all_t *current_all2 = NULL;
+    axutil_array_list_t *array_list1 = NULL;
+    axutil_array_list_t *array_list2 = NULL;
+    policy_operator_t *component = NULL;
+    int i = 0;
+    int j = 0;
+
+    cross_product = policy_exactlyone_create(env);
+    array_list1 = policy_exactlyone_get_policy_components(exactlyone1,env);
+    array_list2 = policy_exactlyone_get_policy_components(exactlyone2,env);
+
+    for(i=0; i<axutil_array_list_size(array_list1,env); i++)
+    {
+        current_all1 = (policy_all_t *)policy_operator_get_value(
+           (policy_operator_t *)axutil_array_list_get(array_list1,env,i), env );
+        
+        for(j=0; j<axutil_array_list_size(array_list2,env); j++ )
+        {
+            current_all2 = (policy_all_t *)policy_operator_get_value(
+                (policy_operator_t *)axutil_array_list_get(array_list2,env,j), env );
+            
+            cross_product_all = policy_all_create(env);
+            policy_all_add_policy_components(cross_product_all,
+                           policy_all_get_policy_components(current_all1,env),env);
+            
+            policy_all_add_policy_components(cross_product_all,
+                           policy_all_get_policy_components(current_all2,env),env);
+            
+            component = policy_operator_create(env);
+            policy_operator_set_value(component,env,cross_product_all,OPERATOR_TYPE_ALL);
+            policy_exactlyone_add_operator(cross_product,env,component);
+        }
+
+    }
+    return cross_product;
+}
+
+

Added: webservices/axis2/scratch/c/neethi/src/policy_operator.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/src/policy_operator.c?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/src/policy_operator.c (added)
+++ webservices/axis2/scratch/c/neethi/src/policy_operator.c Wed Apr 18 01:10:31 2007
@@ -0,0 +1,134 @@
+/*
+ * 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.
+ */
+
+
+
+#include <policy_operator.h>
+#include <policy.h>
+#include <policy_exactlyone.h>
+#include <policy_all.h>
+#include <policy_reference.h>
+
+
+struct policy_operator_t
+{
+    void *value;
+    policy_operator_type_t type;
+
+};
+
+AXIS2_EXTERN policy_operator_t *AXIS2_CALL 
+policy_operator_create(const axutil_env_t *env)
+{
+    policy_operator_t *policy_operator = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    policy_operator =  (policy_operator_t *) AXIS2_MALLOC (env->allocator,
+    sizeof (policy_operator_t));
+
+    if(policy_operator == NULL)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    policy_operator->value = NULL;
+    policy_operator->type = OPERATOR_TYPE_UNKNOWN;
+
+    return policy_operator;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL 
+policy_operator_free(policy_operator_t *policy_operator,
+        const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    if(policy_operator)
+    {
+        if(policy_operator->value)
+        {
+            switch(policy_operator->type)
+            {
+                case OPERATOR_TYPE_POLICY:
+                    policy_free((policy_t *)policy_operator->value,env);
+                    policy_operator->value = NULL;
+                    break;
+
+                case OPERATOR_TYPE_ALL:
+                    policy_all_free((policy_all_t *)policy_operator->value,env);
+                    policy_operator->value = NULL;
+                    break;
+
+                case OPERATOR_TYPE_EXACTLYONE:
+                    policy_exactlyone_free((policy_exactlyone_t *)policy_operator->value,env);
+                    policy_operator->value = NULL;
+                    break;
+                
+                case OPERATOR_TYPE_REFERENCE:
+                    policy_reference_free((policy_reference_t *)policy_operator->value,env);
+                    policy_operator->value = NULL;
+                    break;
+   
+                /*case OPERATOR_TYPE_ASSERTION:
+                    policy_assertion_free((policy_t *)policy_operator->value,env);
+                    policy_operator->value = NULL;
+                    break;
+                */
+            }
+            AXIS2_FREE(env->allocator,policy_operator->value);     
+        }            
+    }
+    return; 
+}
+
+
+/* Implementations */
+
+AXIS2_EXTERN policy_operator_type_t AXIS2_CALL 
+policy_operator_get_type(policy_operator_t *policy_operator,
+            const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+        
+    return policy_operator->type;
+}
+
+AXIS2_EXTERN void *AXIS2_CALL
+policy_operator_get_value(
+    policy_operator_t *policy_operator,
+    const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    return policy_operator->value;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+policy_operator_set_value(policy_operator_t *policy_operator,
+    const axutil_env_t *env,
+    void *value,
+    policy_operator_type_t type)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    policy_operator->type = type;
+    policy_operator->value =(void *)value;
+
+    return AXIS2_SUCCESS;
+}

Added: webservices/axis2/scratch/c/neethi/src/reference.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/src/reference.c?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/src/reference.c (added)
+++ webservices/axis2/scratch/c/neethi/src/reference.c Wed Apr 18 01:10:31 2007
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+
+
+#include <policy_reference.h>
+
+struct policy_reference_t
+{
+    axis2_char_t *uri;
+};
+
+AXIS2_EXTERN policy_reference_t *AXIS2_CALL 
+policy_reference_create(const axutil_env_t *env)
+{
+    policy_reference_t *policy_reference = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    policy_reference =  (policy_reference_t *) AXIS2_MALLOC (env->allocator,
+    sizeof (policy_reference_t));
+
+    if(policy_reference == NULL)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    policy_reference->uri = NULL;
+
+    return policy_reference;
+}
+
+AXIS2_EXTERN void AXIS2_CALL 
+policy_reference_free(policy_reference_t *policy_reference,
+        const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    if(policy_reference)
+    {        
+        AXIS2_FREE(env->allocator,policy_reference);
+        policy_reference = NULL;
+    }
+    return;
+}
+
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+policy_reference_get_uri(
+    policy_reference_t *policy_reference,
+    const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    return policy_reference->uri;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL 
+policy_reference_set_uri(
+        policy_reference_t *policy_reference,
+        const axutil_env_t *env,
+        axis2_char_t *uri)
+{
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    policy_reference->uri = uri;
+    return AXIS2_SUCCESS;
+}
+

Added: webservices/axis2/scratch/c/neethi/src/registry.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/src/registry.c?view=auto&rev=529909
==============================================================================
--- webservices/axis2/scratch/c/neethi/src/registry.c (added)
+++ webservices/axis2/scratch/c/neethi/src/registry.c Wed Apr 18 01:10:31 2007
@@ -0,0 +1,105 @@
+/*
+ * 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.
+ */
+
+
+
+#include <policy_registry.h>
+
+struct policy_registry_t
+{
+    axutil_hash_t *registry;
+};
+
+AXIS2_EXTERN policy_registry_t *AXIS2_CALL 
+policy_registry_create(const axutil_env_t *env)
+{
+    policy_registry_t *policy_registry = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    policy_registry =  (policy_registry_t *) AXIS2_MALLOC (env->allocator,
+    sizeof (policy_registry_t));
+
+    if(policy_registry == NULL)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    policy_registry->registry = NULL;
+
+    policy_registry->registry = axutil_hash_make(env);
+    if (!(policy_registry->registry))
+    {
+        policy_registry_free(policy_registry, env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    return policy_registry;
+}
+
+AXIS2_EXTERN void AXIS2_CALL 
+policy_registry_free(policy_registry_t *policy_registry,
+        const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    if (policy_registry->registry)
+    {
+        axutil_hash_index_t *hi = NULL;
+        void *val = NULL;
+        for (hi = axutil_hash_first(policy_registry->registry, env); hi;
+                hi = axutil_hash_next(env, hi))
+        {
+            policy_t *policy = NULL;
+            axutil_hash_this(hi, NULL, NULL, &val);
+            policy = (policy_t *) val;
+            if (policy)
+                 policy_free(policy, env);
+            val = NULL;
+            policy = NULL;
+
+        }
+        axutil_hash_free(policy_registry->registry , env);
+    }
+    AXIS2_FREE(env->allocator,policy_registry);
+}
+
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL 
+policy_registry_register(
+    policy_registry_t *policy_registry,
+    const axutil_env_t *env,
+    axis2_char_t *key,
+    policy_t *value)
+
+{
+    axutil_hash_set(policy_registry->registry, key , AXIS2_HASH_KEY_STRING, value);
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN policy_t *AXIS2_CALL 
+policy_registry_lookup(
+    policy_registry_t *policy_registry,
+    const axutil_env_t *env,
+    axis2_char_t *key)
+{
+    return (policy_t *)axutil_hash_get(policy_registry->registry,key ,
+        AXIS2_HASH_KEY_STRING);
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org