diff options
Diffstat (limited to 'branches/sca-java-0.91/modules/core-spi/src/main/java/org/apache/tuscany/sca/core')
5 files changed, 0 insertions, 308 deletions
diff --git a/branches/sca-java-0.91/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java b/branches/sca-java-0.91/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java deleted file mode 100644 index 7a42300098..0000000000 --- a/branches/sca-java-0.91/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java +++ /dev/null @@ -1,69 +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. - */ - -package org.apache.tuscany.sca.core; - -import java.util.HashMap; -import java.util.Map; - - -/** - * Default implementation of a registry to hold all the Tuscany core extension - * points. As the point of contact for all extension artifacts this registry - * allows loaded extensions to find all other parts of the system and - * register themselves appropriately. - * - * @version $Rev$ $Date$ - */ -public class DefaultExtensionPointRegistry implements ExtensionPointRegistry { - private Map<Class<?>, Object> extensionPoints = new HashMap<Class<?>, Object>(); - - /** - * Add an extension point to the registry. This default implementation - * stores extensions against the interfaces that they implement. - * @param extensionPoint The instance of the extension point - */ - public void addExtensionPoint(Object extensionPoint) { - Class[] interfaces = extensionPoint.getClass().getInterfaces(); - for (int i = 0; i < interfaces.length; i++) { - extensionPoints.put(interfaces[i], extensionPoint); - } - } - - /** - * Get the extension point by the interface that it implements - * @param extensionPointType The lookup key (extension point interface) - * @return The instance of the extension point - */ - public <T> T getExtensionPoint(Class<T> extensionPointType) { - return extensionPointType.cast(extensionPoints.get(extensionPointType)); - } - - /** - * Remove an extension point based on the interface that it implements - * @param extensionPoint The extension point to remove - */ - public void removeExtensionPoint(Object extensionPoint) { - Class[] interfaces = extensionPoint.getClass().getInterfaces(); - for (int i = 0; i < interfaces.length; i++) { - extensionPoints.remove(interfaces[i]); - } - } - -} diff --git a/branches/sca-java-0.91/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultModelFactoryExtensionPoint.java b/branches/sca-java-0.91/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultModelFactoryExtensionPoint.java deleted file mode 100644 index 6765a6c8f1..0000000000 --- a/branches/sca-java-0.91/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultModelFactoryExtensionPoint.java +++ /dev/null @@ -1,67 +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. - */ - -package org.apache.tuscany.sca.core; - -import java.util.HashMap; - -/** - * Default implementation of a model factory extension point. - * - * @version $Rev$ $Date$ - */ -public class DefaultModelFactoryExtensionPoint implements ModelFactoryExtensionPoint { - - private HashMap<Class<?>, Object> factories = new HashMap<Class<?>, Object>(); - - /** - * Add a model factory extension. - * - * @param factory The factory to add - */ - public void addFactory(Object factory) { - Class[] interfaces = factory.getClass().getInterfaces(); - for (int i = 0; i<interfaces.length; i++) { - factories.put(interfaces[i], factory); - } - } - - /** - * Remove a model factory extension. - * - * @param factory The factory to remove - */ - public void removeFactory(Object factory) { - Class[] interfaces = factory.getClass().getInterfaces(); - for (int i = 0; i<interfaces.length; i++) { - factories.remove(interfaces[i]); - } - } - - /** - * Get a factory implementing the given interface. - * @param factoryInterface The lookup key (factory interface) - * @return The factory - */ - public <T> T getFactory(Class<T> factoryInterface) { - Object factory = factories.get(factoryInterface); - return factoryInterface.cast(factory); - } - -} diff --git a/branches/sca-java-0.91/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java b/branches/sca-java-0.91/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java deleted file mode 100644 index 9609487080..0000000000 --- a/branches/sca-java-0.91/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java +++ /dev/null @@ -1,50 +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. - */ - -package org.apache.tuscany.sca.core; - - -/** - * The registry for the Tuscany core extension points. As the point of contact - * for all extension artifacts this registry allows loaded extensions to find - * all other parts of the system and register themselves appropriately. - * - * @version $Rev$ $Date$ - */ -public interface ExtensionPointRegistry { - - /** - * Add an extension point to the registry - * @param extensionPoint The instance of the extension point - */ - void addExtensionPoint(Object extensionPoint); - - /** - * Get the extension point by the interface - * @param extensionPointType The lookup key (extension point interface) - * @return The instance of the extension point - */ - <T> T getExtensionPoint(Class<T> extensionPointType); - - /** - * Remove an extension point - * @param extensionPoint The extension point to remove - */ - void removeExtensionPoint(Object extensionPoint); -} diff --git a/branches/sca-java-0.91/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModelFactoryExtensionPoint.java b/branches/sca-java-0.91/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModelFactoryExtensionPoint.java deleted file mode 100644 index 64706c6efc..0000000000 --- a/branches/sca-java-0.91/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModelFactoryExtensionPoint.java +++ /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. - */ - -package org.apache.tuscany.sca.core; - -/** - * An extension point for model factories. Model factories are provided to - * abstract the classes that represent artifacts in the assembly model away - * from their creation mechanism. When the runtime needs to extend the model - * as it reads in contributed artifacts it looks up the factory for the - * artifact required in this registry - * - * @version $Rev$ $Date$ - */ -public interface ModelFactoryExtensionPoint { - - /** - * Add a model factory extension. - * - * @param factory The factory to add - */ - void addFactory(Object factory); - - /** - * Remove a model factory extension. - * - * @param factory The factory to remove - */ - void removeFactory(Object factory); - - /** - * Get a factory implementing the given interface. - * @param factoryInterface the lookup key (factory interface) - * @return The factory - */ - <T> T getFactory(Class<T> factoryInterface); - -} diff --git a/branches/sca-java-0.91/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java b/branches/sca-java-0.91/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java deleted file mode 100644 index 0244862309..0000000000 --- a/branches/sca-java-0.91/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java +++ /dev/null @@ -1,68 +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. - */ - -package org.apache.tuscany.sca.core; - - -/** - * ModuleActivator represents a module that plugs into the Tuscany system. Each - * module should provide an implementation of this interface and register the - * ModuleActivator implementation class by defining a file named - * - * "META-INF/services/org.apache.tuscany.spi.bootstrp.ModuleActivator" - * - * The content of the file is the class name of the ModuleActivator implementation. - * The implementation class must have a no-arg constructor. The same instance - * will be used to invoke all the methods during different phases of the module - * activation. Note that the start and stop methods defined by this interface - * take a reference to the Tuscany SCA runtime ExtensionPointRegistry. This - * gives the ModuleActivator the oppotunity to add extension points to the - * registry as it is requested to start up and remove them when it is requested - * to shut down. - * - * @version $Rev$ $Date$ - */ -public interface ModuleActivator { - /** - * Get a map of the extension points defined by this module. The key is the - * java interface to represent the extension point and the the value is the - * instance of the implementation of the interface. - * - * @return All the extension points defined by this module - */ - Object[] getExtensionPoints(); - - /** - * This method is invoked when the module is started by the Tuscany system. - * It can be used by this module to registr extensions against extension - * points. - * - * @param registry The extension point registry - */ - void start(ExtensionPointRegistry registry); - - /** - * This method is invoked when the module is stopped by the Tuscany system. - * It can be used by this module to unregister extensions against the - * extension points. - * - * @param registry The extension point registry - */ - void stop(ExtensionPointRegistry registry); -} |