Skip to content

Commit

Permalink
ManualRebase of Seeburger master to origin/master + secure serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Todor Neykov authored and MrEasy committed Feb 26, 2025
1 parent 1bb3f5b commit f520641
Show file tree
Hide file tree
Showing 285 changed files with 9,478 additions and 7,181 deletions.
6 changes: 2 additions & 4 deletions discovery/command/Readme.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# Discovery Gogo Commands


## endpoints

Lists all discovered endpoints

endpoints
endpoints

## endpoint

Shows the properties of an endpoint identified by its id


endpoint <id>
endpoint <id>
5 changes: 0 additions & 5 deletions discovery/command/bnd.bnd

This file was deleted.

36 changes: 22 additions & 14 deletions discovery/command/pom.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
<?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. -->
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.aries.rsa</groupId>
<artifactId>org.apache.aries.rsa.parent</artifactId>
<version>1.10.0.SEE13-SNAPSHOT</version>
<version>1.17.1.SEE1-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>

<groupId>org.apache.aries.rsa.discovery</groupId>
<artifactId>org.apache.aries.rsa.discovery.command</artifactId>
<packaging>bundle</packaging>
<packaging>jar</packaging>
<name>Aries Remote Service Admin Discovery Gogo Commands</name>

<properties>
Expand All @@ -37,8 +45,8 @@
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.table</artifactId>
<version>4.0.5</version>
<artifactId>org.apache.karaf.shell.core</artifactId>
<version>4.4.6</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,31 @@
import java.util.HashSet;
import java.util.Set;

import org.apache.karaf.shell.table.ShellTable;
import org.apache.karaf.shell.support.table.ShellTable;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.remoteserviceadmin.EndpointDescription;
import org.osgi.service.remoteserviceadmin.EndpointListener;
import org.osgi.service.remoteserviceadmin.EndpointEvent;
import org.osgi.service.remoteserviceadmin.EndpointEventListener;

@Component(//
property = {
"osgi.command.scope=rsa", //
"osgi.command.function=endpoints",
"osgi.command.function=endpoint",
"endpoint.listener.scope=(endpoint.framework.uuid=*)"

})
public class EndpointsCommand implements EndpointListener {
public class EndpointsCommand implements EndpointEventListener {
Set<EndpointDescription> endpoints = new HashSet<>();
private String frameworkId;

@Activate
public void activate(BundleContext context) {
this.frameworkId = context.getProperty(Constants.FRAMEWORK_UUID);
}

public void endpoint(String id) {
EndpointDescription epd = getEndpoint(id);
ShellTable table = new ShellTable();
Expand Down Expand Up @@ -103,13 +103,23 @@ private String getProp(EndpointDescription ep, String key) {
}

@Override
public void endpointAdded(EndpointDescription endpoint, String matchedFilter) {
endpoints.add(endpoint);
}
public void endpointChanged(EndpointEvent event, String matchedFilter) {
EndpointDescription endpoint = event.getEndpoint();
switch (event.getType()) {
case EndpointEvent.ADDED:
endpoints.add(endpoint);
break;

@Override
public void endpointRemoved(EndpointDescription endpoint, String matchedFilter) {
endpoints.remove(endpoint);
case EndpointEvent.REMOVED:
case EndpointEvent.MODIFIED_ENDMATCH:
endpoints.remove(endpoint);
break;

case EndpointEvent.MODIFIED:
endpoints.remove(endpoint);
endpoints.add(endpoint);
break;
}
}

}
1 change: 1 addition & 0 deletions discovery/config/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ the remote endpoints.
Configuration properties in org.apache.aries.rsa.discovery.config-test.cfg file

```
endpoint.id = fooservice
service.imported = true
service.imported.configs = org.apache.cxf.rs
objectClass = org.acme.foo.rest.api.FooService
Expand Down
4 changes: 0 additions & 4 deletions discovery/config/bnd.bnd

This file was deleted.

41 changes: 20 additions & 21 deletions discovery/config/pom.xml
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<?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.
-->
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.aries.rsa</groupId>
<artifactId>org.apache.aries.rsa.discovery</artifactId>
<version>1.10.0.SEE13-SNAPSHOT</version>
<version>1.17.1.SEE1-SNAPSHOT</version>
</parent>

<groupId>org.apache.aries.rsa.discovery</groupId>
<artifactId>org.apache.aries.rsa.discovery.config</artifactId>
<packaging>bundle</packaging>
<packaging>jar</packaging>
<name>Aries Remote Service Admin Discovery Config</name>

<properties>
Expand All @@ -55,4 +54,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,31 @@
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.aries.rsa.discovery.config;

import org.osgi.framework.*;
import java.util.Hashtable;

import org.osgi.annotation.bundle.Header;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.cm.ManagedServiceFactory;
import org.osgi.service.remoteserviceadmin.EndpointListener;
import org.osgi.service.remoteserviceadmin.EndpointEventListener;
import org.osgi.util.tracker.ServiceTracker;

import java.util.Hashtable;

@Header(name = Constants.BUNDLE_ACTIVATOR, value = "${@class}")
@org.osgi.annotation.bundle.Capability( //
namespace = "osgi.remoteserviceadmin.discovery", //
attribute = {"configs:List<String>=config"}, //
version = "1.1.0"
)
public class Activator implements BundleActivator {
private static final String FACTORY_PID = "org.apache.aries.rsa.discovery.config";

private ServiceTracker<EndpointListener, EndpointListener> listenerTracker;
private ServiceTracker<EndpointEventListener, EndpointEventListener> listenerTracker;
private ServiceRegistration<ManagedServiceFactory> registration;

public void start(BundleContext context) {
Expand All @@ -46,23 +57,23 @@ public void stop(BundleContext context) {
listenerTracker.close();
}

private final class EPListenerTracker extends ServiceTracker<EndpointListener, EndpointListener> {
private final class EPListenerTracker extends ServiceTracker<EndpointEventListener, EndpointEventListener> {
private final ConfigDiscovery configDiscovery;

private EPListenerTracker(BundleContext context, ConfigDiscovery configDiscovery) {
super(context, EndpointListener.class, null);
super(context, EndpointEventListener.class, null);
this.configDiscovery = configDiscovery;
}

@Override
public EndpointListener addingService(ServiceReference<EndpointListener> reference) {
EndpointListener service = super.addingService(reference);
public EndpointEventListener addingService(ServiceReference<EndpointEventListener> reference) {
EndpointEventListener service = super.addingService(reference);
configDiscovery.addListener(reference, service);
return service;
}

@Override
public void modifiedService(ServiceReference<EndpointListener> reference, EndpointListener service) {
public void modifiedService(ServiceReference<EndpointEventListener> reference, EndpointEventListener service) {
super.modifiedService(reference, service);
configDiscovery.removeListener(service);

Expand All @@ -73,7 +84,7 @@ public void modifiedService(ServiceReference<EndpointListener> reference, Endpoi
}

@Override
public void removedService(ServiceReference<EndpointListener> reference, EndpointListener service) {
public void removedService(ServiceReference<EndpointEventListener> reference, EndpointEventListener service) {
super.removedService(reference, service);
configDiscovery.removeListener(service);
}
Expand Down
Loading

0 comments on commit f520641

Please # to comment.