You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2016/10/26 12:15:48 UTC

[25/50] [abbrv] celix git commit: CELIX-282: Removes unused folders, updates release notes and adds missing license

http://git-wip-us.apache.org/repos/asf/celix/blob/5a8109d6/scr/scr/private/src/xml_parser.c
----------------------------------------------------------------------
diff --git a/scr/scr/private/src/xml_parser.c b/scr/scr/private/src/xml_parser.c
deleted file mode 100644
index b6ec3eb..0000000
--- a/scr/scr/private/src/xml_parser.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/**
- *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.
- */
-/*
- * xml_paser.c
- *
- *  \date       Nov 3, 2015
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdbool.h>
-
-#include <apr_general.h>
-
-#include <celix_errno.h>
-
-#include <libxml/xmlreader.h>
-
-#include "xml_parser_impl.h"
-#include "service_metadata.h"
-
-struct xml_parser {
-	apr_pool_t *pool;
-};
-
-celix_status_t xmlParser_create(apr_pool_t *pool, xml_parser_t *parser) {
-	*parser = apr_palloc(pool, sizeof(**parser));
-	(*parser)->pool = pool;
-	return CELIX_SUCCESS;
-}
-
-celix_status_t xmlParser_parseComponent(xml_parser_t parser, char *componentEntry, component_t *component) {
-	celix_status_t status = CELIX_SUCCESS;
-
-	xmlTextReaderPtr reader = xmlReaderForFile(componentEntry, NULL, 0);
-	if (reader != NULL) {
-		bool pendingProperty = false;
-		component_t currentComponent;
-		service_t currentService;
-		int read = xmlTextReaderRead(reader);
-		while (read == 1) {
-			int type = xmlTextReaderNodeType(reader);
-			if (type == 1) {
-				pendingProperty = false;
-				const char *localname = xmlTextReaderConstLocalName(reader);
-				if (strcmp(localname, "component") == 0) {
-					printf("Component:\n");
-
-					component_create(parser->pool, &currentComponent);
-
-					char *name = xmlTextReaderGetAttribute(reader, "name");
-					char *enabled = xmlTextReaderGetAttribute(reader, "enabled");
-					char *immediate = xmlTextReaderGetAttribute(reader, "immediate");
-					char *factory = xmlTextReaderGetAttribute(reader, "factory");
-					char *configurationPolicy = xmlTextReaderGetAttribute(reader, "configuration-policy");
-					char *activate = xmlTextReaderGetAttribute(reader, "activate");
-					char *deactivate = xmlTextReaderGetAttribute(reader, "deactivate");
-					char *modified = xmlTextReaderGetAttribute(reader, "modified");
-					if (name != NULL) {
-						printf("\tName: %s\n", name);
-						component_setName(currentComponent, name);
-					}
-					if (enabled != NULL) {
-						printf("\tEnabled: %s\n", enabled);
-						component_setEnabled(currentComponent, strcmp("true", enabled) == 0);
-					}
-					if (immediate != NULL) {
-						printf("\tImmediate: %s\n", immediate);
-						component_setEnabled(currentComponent, strcmp("true", enabled) == 0);
-					}
-					if (factory != NULL) {
-						printf("\tFactory: %s\n", factory);
-						component_setFactoryIdentifier(currentComponent, factory);
-					}
-					if (configurationPolicy != NULL) {
-						printf("\tConfiguration policy: %s\n", configurationPolicy);
-						component_setConfigurationPolicy(currentComponent, configurationPolicy);
-					}
-					if (activate != NULL) {
-						printf("\tActivate: %s\n", activate);
-						component_setActivate(currentComponent, activate);
-					}
-					if (deactivate != NULL) {
-						printf("\tDeactivate: %s\n", deactivate);
-						component_setDeactivate(currentComponent, deactivate);
-					}
-					if (modified != NULL) {
-						printf("\tModified: %s\n", modified);
-						component_setModified(currentComponent, modified);
-					}
-
-					// components.add(currentComponent);
-
-				} else if (strcmp(localname, "implementation") == 0) {
-					printf("Implementation:\n");
-					char *class = xmlTextReaderGetAttribute(reader, "class");
-					printf("\tClass: %s\n", class);
-					component_setImplementationClassName(currentComponent, class);
-				} else if (strcmp(localname, "property") == 0) {
-					printf("Property:\n");
-					char *name = xmlTextReaderGetAttribute(reader, "name");
-					char *value = xmlTextReaderGetAttribute(reader, "value");
-					printf("\tName: %s\n", name);
-					if (value != NULL) {
-						printf("\tValue: %s\n", value);
-					} else {
-						pendingProperty = true;
-					}
-				} else if (strcmp(localname, "properties") == 0) {
-					printf("Properties:\n");
-				} else if (strcmp(localname, "service") == 0) {
-					printf("Service:\n");
-
-					service_create(parser->pool, &currentService);
-
-					char *serviceFactory = xmlTextReaderGetAttribute(reader, "servicefactory");
-					if (serviceFactory != NULL) {
-						printf("\tService factory: %s\n", serviceFactory);
-						serviceMetadata_setServiceFactory(currentService, strcmp("true", serviceFactory) == 0);
-					}
-
-					componentMetadata_setService(currentComponent, currentService);
-				} else if (strcmp(localname, "provide") == 0) {
-					printf("Provide:\n");
-					char *interface = xmlTextReaderGetAttribute(reader, "interface");
-					printf("\tInterface: %s\n", interface);
-					serviceMetadata_addProvide(currentService, interface);
-				} else if (strcmp(localname, "reference") == 0) {
-					printf("Reference:\n");
-					reference_metadata_t reference;
-					referenceMetadata_create(parser->pool, &reference);
-
-					char *name = xmlTextReaderGetAttribute(reader, "name");
-					char *interface = xmlTextReaderGetAttribute(reader, "interface");
-					char *cardinality = xmlTextReaderGetAttribute(reader, "cardinality");
-					char *policy = xmlTextReaderGetAttribute(reader, "policy");
-					char *target = xmlTextReaderGetAttribute(reader, "target");
-					char *bind = xmlTextReaderGetAttribute(reader, "bind");
-					char *updated = xmlTextReaderGetAttribute(reader, "updated");
-					char *unbind = xmlTextReaderGetAttribute(reader, "unbind");
-
-					if (name != NULL) {
-						printf("\tName: %s\n", name);
-						referenceMetadata_setName(reference, name);
-					}
-					printf("\tInterface: %s\n", interface);
-					referenceMetadata_setInterface(reference, interface);
-					if (cardinality != NULL) {
-						printf("\tCardinality: %s\n", cardinality);
-						referenceMetadata_setCardinality(reference, cardinality);
-					}
-					if (policy != NULL) {
-						printf("\tPolicy: %s\n", policy);
-						referenceMetadata_setPolicy(reference, policy);
-					}
-					if (target != NULL) {
-						printf("\tCardinality: %s\n", target);
-						referenceMetadata_setCardinality(reference, cardinality);
-					}
-					if (bind != NULL) {
-						printf("\tBind: %s\n", bind);
-						referenceMetadata_setBind(reference, bind);
-					}
-					if (updated != NULL) {
-						printf("\tUpdated: %s\n", updated);
-						referenceMetadata_setUpdated(reference, updated);
-					}
-					if (unbind != NULL) {
-						printf("\tUnbind: %s\n", unbind);
-						referenceMetadata_setUnbind(reference, unbind);
-					}
-
-					componentMetadata_addDependency(currentComponent, reference);
-				} else {
-					printf("Unsupported element:\n");
-				}
-			} else if (type == 3) {
-				if (pendingProperty) {
-					const char *value = xmlTextReaderConstValue(reader);
-					if (value != NULL) {
-						printf("\tValue text: %s\n", value);
-						pendingProperty = false;
-					}
-				}
-			}
-
-			read = xmlTextReaderRead(reader);
-		}
-		if (currentComponent != NULL) {
-			reference_metadata_t *refs;
-			int size;
-			componentMetadata_getDependencies(currentComponent, &refs, &size);
-			int i;
-			for (i = 0; i < size; i++) {
-				reference_metadata_t ref = refs[i];
-				char *in = NULL;
-				referenceMetadata_getInterface(ref, &in);
-				printf("AS: %s\n", in);
-			}
-			printf("ASD\n");
-		}
-	}
-
-	return CELIX_SUCCESS;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/5a8109d6/scr/scr/scr.c
----------------------------------------------------------------------
diff --git a/scr/scr/scr.c b/scr/scr/scr.c
deleted file mode 100644
index ce27600..0000000
--- a/scr/scr/scr.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- *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.
- */
-/*
- * scr.c
- *
- *  \date       Nov 3, 2015
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdio.h>
-#include <dlfcn.h>
-
-#include <libxml/xmlreader.h>
-
-#include <bundle_activator.h>
-
-#include "xml_parser_impl.h"
-
-struct component {
-	char *name;
-};
-
-celix_status_t scr_bundleChanged(void *listener, bundle_event_t event);
-
-celix_status_t scrParser_processComponent(xmlTextReaderPtr reader) {
-
-
-	return CELIX_SUCCESS;
-}
-
-static void
-processNode(xmlTextReaderPtr reader) {
-    const xmlChar *name, *value;
-
-    name = xmlTextReaderConstLocalName(reader);
-
-    if (name == NULL)
-	name = BAD_CAST "--";
-
-    if (strcmp(name, "component") == 0) {
-    	char *att = xmlTextReaderGetAttribute(reader, "name");
-    	printf("Handle cmp: %s\n", att);
-    }
-
-    value = xmlTextReaderConstValue(reader);
-
-    printf("%d %d %s %d %d",
-	    xmlTextReaderDepth(reader),
-	    xmlTextReaderNodeType(reader),
-	    name,
-	    xmlTextReaderIsEmptyElement(reader),
-	    xmlTextReaderHasValue(reader));
-    if (value == NULL)
-	printf("\n");
-    else {
-        if (xmlStrlen(value) > 40)
-            printf(" %.40s...\n", value);
-        else
-	    printf(" %s\n", value);
-    }
-}
-
-celix_status_t bundleActivator_create(BUNDLE_CONTEXT context, void **userData) {
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT context) {
-	ARRAY_LIST bundles = NULL;
-	bundleContext_getBundles(context, &bundles);
-
-	apr_pool_t *pool = NULL;
-	bundleContext_getMemoryPool(context, &pool);
-
-	xml_parser_t parser = NULL;
-	xmlParser_create(pool, &parser);
-
-	int size;
-	size = arrayList_size(bundles);
-	int i;
-	for (i = 0; i < size; i++) {
-		MANIFEST man = NULL;
-		BUNDLE bundle = arrayList_get(bundles, i);
-		bundle_getManifest(bundle, &man);
-		if (man != NULL) {
-			char *sc = manifest_getValue(man, "Service-Component");
-			if (sc != NULL) {
-				printf("SC: %s\n", sc);
-				char *path = NULL;
-				bundle_getEntry(bundle, sc, pool, &path);
-
-
-				xmlParser_parseComponent(parser, path, NULL);
-
-//				xmlTextReaderPtr reader;
-//				    int ret;
-//
-//				    reader = xmlReaderForFile(path, NULL, 0);
-//				    if (reader != NULL) {
-//				        ret = xmlTextReaderRead(reader);
-//				        while (ret == 1) {
-//				            processNode(reader);
-//				            ret = xmlTextReaderRead(reader);
-//				        }
-//				        xmlFreeTextReader(reader);
-//				        if (ret != 0) {
-//				            fprintf(stderr, "%s : failed to parse\n", path);
-//				        }
-//				    } else {
-//				        fprintf(stderr, "Unable to open %s\n", path);
-//				    }
-//
-
-				void *handle = bundle_getHandle(bundle);
-
-				void (*start)(void * userData, BUNDLE_CONTEXT context);
-				start = dlsym(bundle_getHandle(bundle), "bundleActivator_start");
-
-				void (*activate)();
-				activate = dlsym(handle, "activate");
-				activate();
-
-				void *type;
-				type = dlsym(handle, "service_t");
-			}
-		}
-	}
-
-	bundle_listener_t listener = apr_palloc(pool, sizeof(*listener));
-	listener->pool = pool;
-	listener->bundleChanged = scr_bundleChanged;
-	listener->handle = parser;
-
-	bundleContext_addBundleListener(context, listener);
-
-	return CELIX_SUCCESS;
-}
-
-celix_status_t scr_bundleChanged(void *listener, bundle_event_t event) {
-	printf("BUNDLE CHANGED\n");
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_stop(void * userData, BUNDLE_CONTEXT context) {
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, BUNDLE_CONTEXT context) {
-	return CELIX_SUCCESS;
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/5a8109d6/scr/test/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/scr/test/CMakeLists.txt b/scr/test/CMakeLists.txt
deleted file mode 100644
index bcbcdb2..0000000
--- a/scr/test/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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.
-
-SET_HEADERS("Service-Component: test.xml")
-
-add_bundle(scr_test SOURCES
-	test.c 
-	FILES test.xml
-	)
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-target_link_libraries(scr_test celix_framework)
-
-

http://git-wip-us.apache.org/repos/asf/celix/blob/5a8109d6/scr/test/META-INF/MANIFEST.MF
----------------------------------------------------------------------
diff --git a/scr/test/META-INF/MANIFEST.MF b/scr/test/META-INF/MANIFEST.MF
deleted file mode 100644
index 17ba865..0000000
--- a/scr/test/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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.
-
-Bundle-SymbolicName: scr_test
-Bundle-Version: 1.0.0
-Service-Component: test.xml
-library: scr_test

http://git-wip-us.apache.org/repos/asf/celix/blob/5a8109d6/scr/test/test.c
----------------------------------------------------------------------
diff --git a/scr/test/test.c b/scr/test/test.c
deleted file mode 100644
index 48cc53f..0000000
--- a/scr/test/test.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- *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.
- */
-/*
- * test.c
- *
- *  \date       Nov 3, 2015
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \copyright	Apache License, Version 2.0
- */
-#include <stdio.h>
-
-#include <bundle_activator.h>
-
-struct service {
-	char *a;
-};
-
-typedef struct service *service_t;
-
-celix_status_t bundleActivator_create(BUNDLE_CONTEXT context, void **userData) {
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT context) {
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_stop(void * userData, BUNDLE_CONTEXT context) {
-	return CELIX_SUCCESS;
-}
-
-celix_status_t bundleActivator_destroy(void * userData, BUNDLE_CONTEXT context) {
-	return CELIX_SUCCESS;
-}
-
-void activate() {
-	printf("Activate!\n");
-}

http://git-wip-us.apache.org/repos/asf/celix/blob/5a8109d6/scr/test/test.xml
----------------------------------------------------------------------
diff --git a/scr/test/test.xml b/scr/test/test.xml
deleted file mode 100644
index 6006a74..0000000
--- a/scr/test/test.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- *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.
--->
-<scr:component enabled="true" name="example.activator" xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
-	<implementation class="{componentName}_{createName}">
-		<!-- 
-			class points to the constructor function of the component. 
-			It's signature has to be: celix_status_t {compontenName_create}(void **instance);
-			In this function {instance} is a return pointer to some data object representing the instance of the component.
-			This pointer will be supplied as first argument to all calls made to the component.
-		-->
-	</implementation>
-	<property name="{propName}">{textValue}</property>
-	<service>
-		<provide interface="{ServiceName1}" getter="{componentName}_{serviceGetter}"/>
-		<provide interface="{ServiceName2}" getter="{componentName}_{serviceGetter}"/>
-		<provide interface="{ServiceName3}" getter="{componentName}_{serviceGetter}"/>
-		<provide interface="{ServiceName4}" getter="{componentName}_{serviceGetter}"/>
-			<!-- 
-				This is where we have a problem. Within Celix a service isn't simply an interface that can be registered.
-				The user has to create a struct instance with function pointers.
-				A possible solution is to let the user implement a function which return this struct instance.
-			-->
-	</service>
-	<reference 
-		name="{ReferenceName}" 	
-		interface="{ServiceName1}" 
-		target="{someFilter}"
-		bind="{componentName}_{bindName}"
-		unbind="myComponent_{unbindName}"/>
-		<reference 
-		name="{ReferenceName}" 	
-		interface="{ServiceName2}" 
-		target="{someFilter}"
-		bind="{componentName}_{bindName}"
-		unbind="myComponent_{unbindName}"/>
-		<reference 
-		name="{ReferenceName}" 	
-		interface="{ServiceName3}" 
-		target="{someFilter}"
-		bind="{componentName}_{bindName}"
-		unbind="myComponent_{unbindName}"/>
-</scr:component>
-	
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/5a8109d6/shell/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/shell/CMakeLists.txt b/shell/CMakeLists.txt
index f1f7ab2..3ffb9e1 100644
--- a/shell/CMakeLists.txt
+++ b/shell/CMakeLists.txt
@@ -20,7 +20,7 @@ if (SHELL)
 
     add_bundle(shell
         SYMBOLIC_NAME "apache_celix_shell"
-        VERSION "1.0.0"
+        VERSION "2.0.0"
         NAME "Apache Celix Shell"
 
         SOURCES