Skip to content

Commit

Permalink
Merge pull request #171 from scottslewis/sslcontextfactoryexample
Browse files Browse the repository at this point in the history
Added javadocs links for SSLContextFactory interface
  • Loading branch information
scottslewis authored Feb 26, 2025
2 parents 0d75cdf + 5458bf5 commit 209f3d1
Show file tree
Hide file tree
Showing 12 changed files with 141 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.ecf.examples.sslcontextfactory</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=windows-1252
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
eclipse.preferences.version=1
pluginProject.extensions=false
resolve.requirebundle=false
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Sslcontextfactory
Bundle-SymbolicName: org.eclipse.ecf.examples.sslcontextfactory
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: org.eclipse.ecf.examples.sslcontextfactory
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-17
Import-Package: org.eclipse.ecf.core.security;version="[3.2.0,4.0.0)",
org.osgi.service.component.annotations;version="[1.3.0,2.0.0)";resolution:=optional
Service-Component: OSGI-INF/org.eclipse.ecf.examples.sslcontextfactory.ContextFactoryConsumer.xml,
OSGI-INF/org.eclipse.ecf.examples.sslcontextfactory.ExampleProvider.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.eclipse.ecf.examples.sslcontextfactory.ContextFactoryConsumer">
<reference bind="bindSSLContextFactory" cardinality="1..1" interface="org.eclipse.ecf.core.security.SSLContextFactory" name="SSLContextFactory" unbind="unbindSSLContextFactory"/>
<implementation class="org.eclipse.ecf.examples.sslcontextfactory.ContextFactoryConsumer"/>
</scr:component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.eclipse.ecf.examples.sslcontextfactory.ExampleProvider">
<service>
<provide interface="java.security.Provider"/>
</service>
<implementation class="org.eclipse.ecf.examples.sslcontextfactory.ExampleProvider"/>
</scr:component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
OSGI-INF/org.eclipse.ecf.examples.sslcontextfactory.ContextFactoryConsumer.xml,\
OSGI-INF/org.eclipse.ecf.examples.sslcontextfactory.ExampleProvider.xml,\
OSGI-INF/
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.eclipse.ecf.examples.sslcontextfactory;

import org.eclipse.ecf.core.security.SSLContextFactory;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferenceCardinality;

@Component(immediate=true)
public class ContextFactoryConsumer {

private static SSLContextFactory factory;

@Reference(cardinality = ReferenceCardinality.MANDATORY)
void bindSSLContextFactory(SSLContextFactory sslContextFactory) {
factory = sslContextFactory;
}

void unbindSSLContextFactory(SSLContextFactory sslContextFactory) {
factory = null;
}

public static SSLContextFactory getSSLContextFactory() {
return factory;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.eclipse.ecf.examples.sslcontextfactory;

import java.security.Provider;

import org.osgi.service.component.annotations.Component;

@Component(service=Provider.class,immediate=true)
public class ExampleProvider extends Provider {

private static final long serialVersionUID = 4387195962639458953L;

public ExampleProvider() {
super("PKIJoe", "1.0", null);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,29 @@
import javax.net.ssl.SSLContext;

/**
* This class exposes three legacy static methods from the {@link SSLContext} class as
* methods on an implementing instance. Implementing instances should be registered
* as OSGi services.
*
* @since 3.12
*/
public interface SSLContextFactory {

/**
* See javadocs for {@link <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/javax/net/ssl/SSLContext.html#getDefault()">SSLContext.getDefault()</a>}<br>
* NOTE: Rather than the using the {@link #SSLContext.setDefault SSLContext.setDefault(SSLContext)}
* to set the default SSLContext as described in the SSLContext.getDefault() javadocs, the default for the implementer is set upon construction of the service instance.
*/
SSLContext getDefault() throws NoSuchAlgorithmException, NoSuchProviderException;

/**
* See javadocs for {@link <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/javax/net/ssl/SSLContext.html#getInstance(java.lang.String)">SSLContext.getInstance(String protocol)</a>}<br>
*/
SSLContext getInstance(String protocol) throws NoSuchAlgorithmException, NoSuchProviderException;

/**
* See javadocs for {@link <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/javax/net/ssl/SSLContext.html#getInstance(java.lang.String,java.security.Provider)">SSLContext.getInstance(String protocol, String provider)</a>}<br>
*/
SSLContext getInstance(String protocol, String providerName) throws NoSuchAlgorithmException, NoSuchProviderException;

}

0 comments on commit 209f3d1

Please sign in to comment.