You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by tj...@apache.org on 2021/02/23 14:47:12 UTC
[felix-atomos] branch master updated: Update to Felix SCR 2.1.26
release
This is an automated email from the ASF dual-hosted git repository.
tjwatson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-atomos.git
The following commit(s) were added to refs/heads/master by this push:
new 987492e Update to Felix SCR 2.1.26 release
987492e is described below
commit 987492ecde0493e3e048ea30974e657b11d875ad
Author: Thomas Watson <tj...@us.ibm.com>
AuthorDate: Tue Feb 23 08:36:45 2021 -0600
Update to Felix SCR 2.1.26 release
---
atomos-parent/pom.xml | 2 +-
atomos.examples/atomos.examples.jlink/pom.xml | 28 +-
.../felix/atomos/utils/core/LauncherImpl.java | 26 +-
.../utils/core/scr/mock/EmptyBundeLogger.java | 438 +--------------------
.../atomos/utils/core/scr/mock/EmptySCRLogger.java | 49 ---
5 files changed, 24 insertions(+), 519 deletions(-)
diff --git a/atomos-parent/pom.xml b/atomos-parent/pom.xml
index 87b6e44..77b447d 100644
--- a/atomos-parent/pom.xml
+++ b/atomos-parent/pom.xml
@@ -216,7 +216,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr</artifactId>
- <version>2.1.16</version>
+ <version>2.1.26</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
diff --git a/atomos.examples/atomos.examples.jlink/pom.xml b/atomos.examples/atomos.examples.jlink/pom.xml
index 0fbba62..aefd57c 100644
--- a/atomos.examples/atomos.examples.jlink/pom.xml
+++ b/atomos.examples/atomos.examples.jlink/pom.xml
@@ -369,36 +369,18 @@
module org.apache.felix.scr {
requires java.logging;
requires java.management;
+ requires java.xml;
requires transitive org.apache.felix.gogo.runtime;
requires transitive osgi.core;
- requires transitive
- osgi.promise;
+ requires transitive osgi.promise;
- exports
- org.apache.felix.scr.component;
- exports org.apache.felix.scr.impl;
- exports org.apache.felix.scr.impl.config;
- exports org.apache.felix.scr.impl.helper;
- exports org.apache.felix.scr.impl.inject;
- exports
- org.apache.felix.scr.impl.inject.field;
- exports org.apache.felix.scr.impl.inject.methods;
- exports org.apache.felix.scr.impl.logger;
- exports org.apache.felix.scr.impl.manager;
- exports
- org.apache.felix.scr.impl.metadata;
- exports
- org.apache.felix.scr.impl.parser;
- exports org.apache.felix.scr.impl.runtime;
- exports org.apache.felix.scr.impl.xml;
+ exports org.apache.felix.scr.component;
exports org.apache.felix.scr.info;
- exports org.kxml2.io;
exports org.osgi.service.component;
- exports
- org.osgi.service.component.runtime;
+ exports org.osgi.service.component.runtime;
exports org.osgi.service.component.runtime.dto;
- exports org.xmlpull.v1;
+ opens org.apache.felix.scr.impl;
}
</moduleInfoSource>
</module>
diff --git a/atomos.utils/atomos.utils.core/src/main/java/org/apache/felix/atomos/utils/core/LauncherImpl.java b/atomos.utils/atomos.utils.core/src/main/java/org/apache/felix/atomos/utils/core/LauncherImpl.java
index ad2b2d7..00f7c86 100644
--- a/atomos.utils/atomos.utils.core/src/main/java/org/apache/felix/atomos/utils/core/LauncherImpl.java
+++ b/atomos.utils/atomos.utils.core/src/main/java/org/apache/felix/atomos/utils/core/LauncherImpl.java
@@ -33,6 +33,9 @@ import java.util.jar.JarFile;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
import org.apache.felix.atomos.utils.api.Context;
import org.apache.felix.atomos.utils.api.FileType;
import org.apache.felix.atomos.utils.api.Launcher;
@@ -52,7 +55,6 @@ import org.apache.felix.atomos.utils.core.scr.mock.EmptyBundeLogger;
import org.apache.felix.atomos.utils.core.scr.mock.PathBundle;
import org.apache.felix.scr.impl.logger.BundleLogger;
import org.apache.felix.scr.impl.metadata.ComponentMetadata;
-import org.apache.felix.scr.impl.parser.KXml2SAXParser;
import org.apache.felix.scr.impl.xml.XmlHandler;
import org.osgi.framework.Constants;
@@ -110,27 +112,15 @@ public class LauncherImpl implements Launcher
XmlHandler handler = new XmlHandler(new PathBundle(jar), logger, true,
true);
- KXml2SAXParser parser = new KXml2SAXParser(in);
- parser.parseXML(handler);
+ final SAXParserFactory factory = SAXParserFactory.newInstance();
+ factory.setNamespaceAware(true);
+ final SAXParser parser = factory.newSAXParser();
+
+ parser.parse(stream, handler);
list.addAll(handler.getComponentMetadataList());
}
}
-
- // //Felix SCR Version-> 2.1.17-SNAPSHOT
- // //https://github.com/apache/felix-dev/commit/2d035e21d69c2bb8892d5d5d3e1027befcc3c50b#diff-dad1c7cc45e5c46bca969c95ac501546
- // while (st.hasMoreTokens())
- // {
- // String descriptorLocation = st.nextToken();
- // InputStream stream = jar.getInputStream(jar.getEntry(descriptorLocation));
- // XmlHandler handler = new XmlHandler(new PathBundle(jar), logger, true, true);
- //
- // final SAXParserFactory factory = SAXParserFactory.newInstance();
- // factory.setNamespaceAware(true);
- // final SAXParser parser = factory.newSAXParser();
- // parser.parse( stream, handler );
- // list.addAll(handler.getComponentMetadataList());
- // }
}
List<ComponentDescription> cds = list.stream().map(cmd -> {
diff --git a/atomos.utils/atomos.utils.core/src/main/java/org/apache/felix/atomos/utils/core/scr/mock/EmptyBundeLogger.java b/atomos.utils/atomos.utils.core/src/main/java/org/apache/felix/atomos/utils/core/scr/mock/EmptyBundeLogger.java
index e9af209..e352f2d 100644
--- a/atomos.utils/atomos.utils.core/src/main/java/org/apache/felix/atomos/utils/core/scr/mock/EmptyBundeLogger.java
+++ b/atomos.utils/atomos.utils.core/src/main/java/org/apache/felix/atomos/utils/core/scr/mock/EmptyBundeLogger.java
@@ -13,456 +13,38 @@
*/
package org.apache.felix.atomos.utils.core.scr.mock;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.security.cert.X509Certificate;
-import java.util.Collection;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Map;
-
import org.apache.felix.scr.impl.logger.BundleLogger;
-import org.apache.felix.scr.impl.logger.ScrLogger;
-import org.apache.felix.scr.impl.manager.ScrConfiguration;
+import org.apache.felix.scr.impl.logger.ComponentLogger;
import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.BundleListener;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkListener;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceObjects;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.framework.Version;
-public class EmptyBundeLogger extends BundleLogger
+public class EmptyBundeLogger implements BundleLogger, ComponentLogger
{
- static Bundle b = new Bundle()
- {
- @Override
- public <A> A adapt(Class<A> type)
- {
- return null;
- }
-
- @Override
- public int compareTo(Bundle o)
- {
- return 0;
- }
-
- @Override
- public Enumeration<URL> findEntries(String path, String filePattern,
- boolean recurse)
- {
- return null;
- }
-
- @Override
- public BundleContext getBundleContext()
- {
- return null;
- }
-
- @Override
- public long getBundleId()
- {
- return 0;
- }
-
- @Override
- public File getDataFile(String filename)
- {
- return null;
- }
-
- @Override
- public URL getEntry(String path)
- {
- return null;
- }
-
- @Override
- public Enumeration<String> getEntryPaths(String path)
- {
- return null;
- }
-
- @Override
- public Dictionary<String, String> getHeaders()
- {
- return null;
- }
-
- @Override
- public Dictionary<String, String> getHeaders(String locale)
- {
- return null;
- }
-
- @Override
- public long getLastModified()
- {
- return 0;
- }
-
- @Override
- public String getLocation()
- {
- return null;
- }
-
- @Override
- public ServiceReference<?>[] getRegisteredServices()
- {
- return null;
- }
-
- @Override
- public URL getResource(String name)
- {
- return null;
- }
-
- @Override
- public Enumeration<URL> getResources(String name) throws IOException
- {
- return null;
- }
-
- @Override
- public ServiceReference<?>[] getServicesInUse()
- {
- return null;
- }
-
- @Override
- public Map<X509Certificate, List<X509Certificate>> getSignerCertificates(
- int signersType)
- {
- return null;
- }
-
- @Override
- public int getState()
- {
- return 0;
- }
-
- @Override
- public String getSymbolicName()
- {
- return null;
- }
-
- @Override
- public Version getVersion()
- {
- return null;
- }
-
- @Override
- public boolean hasPermission(Object permission)
- {
- return false;
- }
-
- @Override
- public Class<?> loadClass(String name) throws ClassNotFoundException
- {
- return null;
- }
-
- @Override
- public void start() throws BundleException
- {
- }
-
- @Override
- public void start(int options) throws BundleException
- {
- }
-
- @Override
- public void stop() throws BundleException
- {
- }
-
- @Override
- public void stop(int options) throws BundleException
- {
- }
-
- @Override
- public void uninstall() throws BundleException
- {
- }
-
- @Override
- public void update() throws BundleException
- {
- }
-
- @Override
- public void update(InputStream input) throws BundleException
- {
- }
- };
- static BundleContext bc = new BundleContext()
- {
- @Override
- public void addBundleListener(BundleListener listener)
- {
- }
-
- @Override
- public void addFrameworkListener(FrameworkListener listener)
- {
- }
-
- @Override
- public void addServiceListener(ServiceListener listener)
- {
- }
-
- @Override
- public void addServiceListener(ServiceListener listener, String filter)
- throws InvalidSyntaxException
- {
- }
- @Override
- public Filter createFilter(String filter) throws InvalidSyntaxException
- {
- return null;
- }
-
- @Override
- public ServiceReference<?>[] getAllServiceReferences(String clazz, String filter)
- throws InvalidSyntaxException
- {
- return null;
- }
-
- @Override
- public Bundle getBundle()
- {
- return b;
- }
-
- @Override
- public Bundle getBundle(long id)
- {
- return null;
- }
-
- @Override
- public Bundle getBundle(String location)
- {
- return null;
- }
-
- @Override
- public Bundle[] getBundles()
- {
- return null;
- }
-
- @Override
- public File getDataFile(String filename)
- {
- return null;
- }
-
- @Override
- public String getProperty(String key)
- {
- return null;
- }
-
- @Override
- public <S> S getService(ServiceReference<S> reference)
- {
- return null;
- }
-
- @Override
- public <S> ServiceObjects<S> getServiceObjects(ServiceReference<S> reference)
- {
- return null;
- }
-
- @Override
- public <S> ServiceReference<S> getServiceReference(Class<S> clazz)
- {
- return null;
- }
-
- @Override
- public ServiceReference<?> getServiceReference(String clazz)
- {
- return null;
- }
-
- @Override
- public <S> Collection<ServiceReference<S>> getServiceReferences(Class<S> clazz,
- String filter) throws InvalidSyntaxException
- {
- return null;
- }
-
- @Override
- public ServiceReference<?>[] getServiceReferences(String clazz, String filter)
- throws InvalidSyntaxException
- {
- return null;
- }
-
- @Override
- public Bundle installBundle(String location) throws BundleException
- {
- return null;
- }
-
- @Override
- public Bundle installBundle(String location, InputStream input)
- throws BundleException
- {
- return null;
- }
-
- @Override
- public <S> ServiceRegistration<S> registerService(Class<S> clazz, S service,
- Dictionary<String, ?> properties)
- {
- return null;
- }
-
- @Override
- public <S> ServiceRegistration<S> registerService(Class<S> clazz,
- ServiceFactory<S> factory, Dictionary<String, ?> properties)
- {
- return null;
- }
-
- @Override
- public ServiceRegistration<?> registerService(String clazz, Object service,
- Dictionary<String, ?> properties)
- {
- return null;
- }
-
- @Override
- public ServiceRegistration<?> registerService(String[] clazzes, Object service,
- Dictionary<String, ?> properties)
- {
- return null;
- }
-
- @Override
- public void removeBundleListener(BundleListener listener)
- {
- }
-
- @Override
- public void removeFrameworkListener(FrameworkListener listener)
- {
- }
-
- @Override
- public void removeServiceListener(ServiceListener listener)
- {
- }
-
- @Override
- public boolean ungetService(ServiceReference<?> reference)
- {
- return false;
- }
- };
- static ScrConfiguration conf = new ScrConfiguration()
- {
- @Override
- public int getLogLevel()
- {
- return 0;
- }
-
- @Override
- public boolean globalExtender()
- {
- return false;
- }
-
- @Override
- public boolean infoAsService()
- {
- return false;
- }
-
- @Override
- public boolean isFactoryEnabled()
- {
- return false;
- }
-
- @Override
- public boolean keepInstances()
- {
- return false;
- }
-
- @Override
- public long lockTimeout()
- {
- return 0;
- }
-
- @Override
- public long serviceChangecountTimeout()
- {
- return 0;
- }
-
- @Override
- public long stopTimeout()
- {
- return 0;
- }
- };
- static ScrLogger scrLogger = new EmptySCRLogger(conf, bc);
-
- public EmptyBundeLogger()
+ @Override
+ public void log(Level level, String message, Throwable ex)
{
- super(bc, scrLogger);
}
@Override
- public void close()
+ public void log(Level level, String message, Throwable ex, Object... args)
{
}
@Override
- public boolean isLogEnabled(int level)
+ public boolean isLogEnabled(Level level)
{
return false;
}
@Override
- public boolean log(int level, String message, Throwable ex)
+ public ComponentLogger component(Bundle m_bundle, String implementationClassName,
+ String name)
{
- return true;
+ return this;
}
@Override
- public boolean log(int level, String pattern, Throwable ex, Object... arguments)
+ public void setComponentId(long m_componentId)
{
- return true;
}
}
diff --git a/atomos.utils/atomos.utils.core/src/main/java/org/apache/felix/atomos/utils/core/scr/mock/EmptySCRLogger.java b/atomos.utils/atomos.utils.core/src/main/java/org/apache/felix/atomos/utils/core/scr/mock/EmptySCRLogger.java
deleted file mode 100644
index 1900755..0000000
--- a/atomos.utils/atomos.utils.core/src/main/java/org/apache/felix/atomos/utils/core/scr/mock/EmptySCRLogger.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.apache.felix.atomos.utils.core.scr.mock;
-
-import org.apache.felix.scr.impl.logger.ScrLogger;
-import org.apache.felix.scr.impl.manager.ScrConfiguration;
-import org.osgi.framework.BundleContext;
-
-public class EmptySCRLogger extends ScrLogger
-{
- public EmptySCRLogger(ScrConfiguration config, BundleContext bundleContext)
- {
- super(config, bundleContext);
- }
-
- @Override
- public void close()
- {
- }
-
- @Override
- public boolean isLogEnabled(int level)
- {
- return false;
- }
-
- @Override
- public boolean log(int level, String message, Throwable ex)
- {
- return true;
- }
-
- @Override
- public boolean log(int level, String pattern, Throwable ex, Object... arguments)
- {
- return true;
- }
-}