-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add binding to service provider for use in Groovy script
Add an additional binding for the Service Provider to Groovy scripts. ING-4265
- Loading branch information
1 parent
97b0df6
commit 0b84ee3
Showing
7 changed files
with
202 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...ale.common.core/src/eu/esdihumboldt/hale/common/core/service/DelegateServiceProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (c) 2024 wetransform GmbH | ||
* | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation, either version 3 of the License, | ||
* or (at your option) any later version. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this distribution. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Contributors: | ||
* wetransform GmbH <http://www.wetransform.to> | ||
*/ | ||
|
||
package eu.esdihumboldt.hale.common.core.service; | ||
|
||
/** | ||
* A DelegateServiceProvider delegates service requests to an underlying | ||
* ServiceProvider. It implements the ServiceProvider interface and forwards | ||
* getService calls to the specified underlying ServiceProvider. | ||
* | ||
* @author EmanuelaEpure | ||
*/ | ||
public class DelegateServiceProvider implements ServiceProvider { | ||
|
||
private final ServiceProvider serviceProvider; | ||
|
||
/** | ||
* Constructs a new DelegateServiceProvider with the specified | ||
* ServiceProvider. | ||
* | ||
* @param serviceProvider the underlying ServiceProvider to delegate to | ||
*/ | ||
public DelegateServiceProvider(ServiceProvider serviceProvider) { | ||
this.serviceProvider = serviceProvider; | ||
} | ||
|
||
@Override | ||
public <T> T getService(Class<T> serviceInterface) { | ||
return serviceProvider.getService(serviceInterface); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
...dihumboldt.util.groovy.sandbox/schema/eu.esdihumboldt.util.service.provider.delegate.exsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<!-- Schema file written by PDE --> | ||
<schema targetNamespace="eu.esdihumboldt.util.groovy.sandbox" xmlns="http://www.w3.org/2001/XMLSchema"> | ||
<annotation> | ||
<appinfo> | ||
<meta.schema plugin="eu.esdihumboldt.util.groovy.sandbox" id="eu.esdihumboldt.util.service.provider.delegate" name="Service Provider Delegate"/> | ||
</appinfo> | ||
<documentation> | ||
[Enter description of this extension point.] | ||
</documentation> | ||
</annotation> | ||
|
||
<element name="extension"> | ||
<annotation> | ||
<appinfo> | ||
<meta.element /> | ||
</appinfo> | ||
</annotation> | ||
<complexType> | ||
<choice minOccurs="1" maxOccurs="unbounded"> | ||
<element ref="delegate"/> | ||
</choice> | ||
<attribute name="point" type="string" use="required"> | ||
<annotation> | ||
<documentation> | ||
|
||
</documentation> | ||
</annotation> | ||
</attribute> | ||
<attribute name="id" type="string"> | ||
<annotation> | ||
<documentation> | ||
|
||
</documentation> | ||
</annotation> | ||
</attribute> | ||
<attribute name="name" type="string"> | ||
<annotation> | ||
<documentation> | ||
|
||
</documentation> | ||
<appinfo> | ||
<meta.attribute translatable="true"/> | ||
</appinfo> | ||
</annotation> | ||
</attribute> | ||
</complexType> | ||
</element> | ||
|
||
<element name="delegate"> | ||
<complexType> | ||
<attribute name="class" type="string" use="required"> | ||
<annotation> | ||
<documentation> | ||
|
||
</documentation> | ||
<appinfo> | ||
<meta.attribute kind="java" basedOn="eu.esdihumboldt.hale.common.core.service.DelegateServiceProvider:"/> | ||
</appinfo> | ||
</annotation> | ||
</attribute> | ||
</complexType> | ||
</element> | ||
|
||
<annotation> | ||
<appinfo> | ||
<meta.section type="since"/> | ||
</appinfo> | ||
<documentation> | ||
[Enter the first release in which this extension point appears.] | ||
</documentation> | ||
</annotation> | ||
|
||
<annotation> | ||
<appinfo> | ||
<meta.section type="examples"/> | ||
</appinfo> | ||
<documentation> | ||
[Enter extension point usage example here.] | ||
</documentation> | ||
</annotation> | ||
|
||
<annotation> | ||
<appinfo> | ||
<meta.section type="apiinfo"/> | ||
</appinfo> | ||
<documentation> | ||
[Enter API information here.] | ||
</documentation> | ||
</annotation> | ||
|
||
<annotation> | ||
<appinfo> | ||
<meta.section type="implementation"/> | ||
</appinfo> | ||
<documentation> | ||
[Enter information about supplied implementation of this extension point.] | ||
</documentation> | ||
</annotation> | ||
|
||
|
||
</schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters