You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pa...@apache.org on 2020/01/23 20:25:11 UTC
svn commit: r1873075 - in /felix/sandbox/pauls/connect/src/main:
java/org/osgi/framework/connect/ resources/META-INF/services/
Author: pauls
Date: Thu Jan 23 20:25:11 2020
New Revision: 1873075
URL: http://svn.apache.org/viewvc?rev=1873075&view=rev
Log:
Update to latest connect interfaces
Added:
felix/sandbox/pauls/connect/src/main/java/org/osgi/framework/connect/ConnectFramework.java
felix/sandbox/pauls/connect/src/main/java/org/osgi/framework/connect/ConnectFrameworkFactory.java
felix/sandbox/pauls/connect/src/main/java/org/osgi/framework/connect/package-info.java
felix/sandbox/pauls/connect/src/main/resources/META-INF/services/org.osgi.framework.connect.ConnectFrameworkFactory
Removed:
felix/sandbox/pauls/connect/src/main/java/org/osgi/framework/connect/ConnectFactory.java
Added: felix/sandbox/pauls/connect/src/main/java/org/osgi/framework/connect/ConnectFramework.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pauls/connect/src/main/java/org/osgi/framework/connect/ConnectFramework.java?rev=1873075&view=auto
==============================================================================
--- felix/sandbox/pauls/connect/src/main/java/org/osgi/framework/connect/ConnectFramework.java (added)
+++ felix/sandbox/pauls/connect/src/main/java/org/osgi/framework/connect/ConnectFramework.java Thu Jan 23 20:25:11 2020
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) OSGi Alliance (2019). All Rights Reserved.
+ *
+ * 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.
+ */
+package org.osgi.framework.connect;
+
+import java.io.File;
+import java.util.Map;
+import java.util.Optional;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * A connect framework provides access to instances of {@link ConnectModule}
+ * that are used by a {@link Framework} instance to provide content and classes
+ * for a bundle installed in the Framework. A connect framework is provided when
+ * {@link ConnectFrameworkFactory#newFramework(java.util.Map, ConnectFramework)
+ * creating} a framework instance. Because a connect framework instance can
+ * participate in the initialization of the framework and the life cycle of a
+ * framework instance the connect framework instance should only be used with a
+ * single framework instance.
+ *
+ * @ThreadSafe
+ * @author $Id: c01477fd91e5a4f084d178476ff57a58315155f6 $
+ */
+public interface ConnectFramework {
+
+ /**
+ * Initializes the connect framework with the
+ * {@link Constants#FRAMEWORK_STORAGE framework persistent storage} file and
+ * framework properties configured for a {@link Framework} instance. This
+ * method is called once by a {@link Framework} instance and is called
+ * before any other methods on this connect framework are called.
+ *
+ * @param configuration The framework properties to used configure the new
+ * framework instance. An unmodifiable map of framework
+ * configuration properties that were used to create a new
+ * framework instance.
+ * @param storage the persistent storage area used by the {@link Framework}
+ * or {@code null} if the if the platform does not have file
+ * system support.
+ * @return a reference to this object
+ */
+ ConnectFramework initialize(File storage, Map<String,String> configuration);
+
+ /**
+ * Returns the connect module for the specified bundle location. If an
+ * {@link Optional#empty() empty} optional is returned the the framework
+ * must handle reading the content of the bundle itself. If a value is
+ * {@link Optional#isPresent() present} in the returned optional then the
+ * {@link Optional#get() value} from the optional must be used to access the
+ * content of the bundle.
+ *
+ * @param location the bundle location used to install a bundle
+ * @return the connect module for the specified bundle location
+ * @throws BundleException if the location cannot be handled
+ */
+ Optional<ConnectModule> getModule(String location) throws BundleException;
+
+ /**
+ * Creates a new activator for this connect framework. A new activator is
+ * created by the framework each time the framework is
+ * {@link Framework#init() initialized}. An activator allows the connect
+ * framework to participate in the framework life cyle. When the framework
+ * is {@link Framework#init() initialized} the activator
+ * {@link BundleActivator#start(org.osgi.framework.BundleContext) start}
+ * method is called. When the framework is {@link Framework#stop() stopped}
+ * the activator
+ * {@link BundleActivator#stop(org.osgi.framework.BundleContext) stop}
+ * method is called
+ *
+ * @return a new activator for this connect framework or
+ * {@link Optional#empty() empty} if no activator is available
+ */
+ Optional<BundleActivator> createBundleActivator();
+}
Added: felix/sandbox/pauls/connect/src/main/java/org/osgi/framework/connect/ConnectFrameworkFactory.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pauls/connect/src/main/java/org/osgi/framework/connect/ConnectFrameworkFactory.java?rev=1873075&view=auto
==============================================================================
--- felix/sandbox/pauls/connect/src/main/java/org/osgi/framework/connect/ConnectFrameworkFactory.java (added)
+++ felix/sandbox/pauls/connect/src/main/java/org/osgi/framework/connect/ConnectFrameworkFactory.java Thu Jan 23 20:25:11 2020
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) OSGi Alliance (2019). All Rights Reserved.
+ *
+ * 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.
+ */
+package org.osgi.framework.connect;
+
+import java.util.Map;
+
+import org.osgi.annotation.versioning.ProviderType;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * A factory for creating {@link Framework} instances.
+ * <p>
+ * If a framework supports {@link ConnectFramework} then the implementation jar
+ * must contain the following resource:
+ *
+ * <pre>
+ * /META-INF/services/org.osgi.framework.connect.ConnectFrameworkFactory
+ * </pre>
+ *
+ * This UTF-8 encoded resource must contain the name of the framework
+ * implementation's ConnectFrameworkFactory implementation class. Space and tab
+ * characters, including blank lines, in the resource must be ignored. The
+ * number sign ({@code '#'} \u0023) and all characters following it on each
+ * line are a comment and must be ignored.
+ * <p>
+ * Launchers can find the name of the ConnectFrameworkFactory implementation
+ * class in the resource and then load and construct a ConnectFrameworkFactory
+ * object for the framework implementation. The ConnectFrameworkFactory
+ * implementation class must have a public, no-argument constructor. Java™
+ * SE 6 introduced the {@code ServiceLoader} class which can create a
+ * ConnectFrameworkFactory instance from the resource.
+ *
+ * @ThreadSafe
+ * @author $Id: cb596326be33a0782240ce47d5212a797c1724ba $
+ */
+@ProviderType
+public interface ConnectFrameworkFactory {
+ /**
+ * Create a new {@link Framework} instance using the specified
+ * {@link ConnectFramework connect framework}.
+ *
+ * @param configuration The framework properties to configure the new
+ * framework instance. If framework properties are not provided
+ * by the configuration argument, the created framework instance
+ * must use some reasonable default configuration appropriate for
+ * the current VM. For example, the system packages for the
+ * current execution environment should be properly exported. The
+ * specified configuration argument may be {@code null}. The
+ * created framework instance must copy any information needed
+ * from the specified configuration argument since the
+ * configuration argument can be changed after the framework
+ * instance has been created.
+ * @param connectFramework The connect framework that the new framework
+ * instance will use. The specified connect framework argument
+ * may be {@code null}.
+ * @return A new, configured {@link Framework} instance. The framework
+ * instance must be in the {@link Bundle#INSTALLED} state.
+ * @throws SecurityException If the caller does not have
+ * {@code AllPermission}, and the Java Runtime Environment
+ * supports permissions.
+ * @see ConnectFramework
+ * @since 1.3
+ */
+ Framework newFramework(Map<String,String> configuration,
+ ConnectFramework connectFramework);
+}
Added: felix/sandbox/pauls/connect/src/main/java/org/osgi/framework/connect/package-info.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pauls/connect/src/main/java/org/osgi/framework/connect/package-info.java?rev=1873075&view=auto
==============================================================================
--- felix/sandbox/pauls/connect/src/main/java/org/osgi/framework/connect/package-info.java (added)
+++ felix/sandbox/pauls/connect/src/main/java/org/osgi/framework/connect/package-info.java Thu Jan 23 20:25:11 2020
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) OSGi Alliance (2010, 2019). All Rights Reserved.
+ *
+ * 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.
+ */
+
+/**
+ * Framework Connect Package Version 1.0.
+ * <p>
+ * Bundles wishing to use this package must list the package in the
+ * Import-Package header of the bundle's manifest.
+ * <p>
+ * Example import for consumers using the API in this package:
+ * <p>
+ * {@code Import-Package: org.osgi.framework.connect; version="[1.0,2.0)"}
+ *
+ * @author $Id: a196dc76c5b8d5acb472bd10a4ab382ed58d92d1 $
+ */
+
+@Version("1.0")
+package org.osgi.framework.connect;
+
+import org.osgi.annotation.versioning.Version;
+
Added: felix/sandbox/pauls/connect/src/main/resources/META-INF/services/org.osgi.framework.connect.ConnectFrameworkFactory
URL: http://svn.apache.org/viewvc/felix/sandbox/pauls/connect/src/main/resources/META-INF/services/org.osgi.framework.connect.ConnectFrameworkFactory?rev=1873075&view=auto
==============================================================================
--- felix/sandbox/pauls/connect/src/main/resources/META-INF/services/org.osgi.framework.connect.ConnectFrameworkFactory (added)
+++ felix/sandbox/pauls/connect/src/main/resources/META-INF/services/org.osgi.framework.connect.ConnectFrameworkFactory Thu Jan 23 20:25:11 2020
@@ -0,0 +1 @@
+org.apache.felix.framework.FrameworkFactory
\ No newline at end of file