summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Liebig2008-03-31 03:16:50 (EDT)
committerStefan Liebig2008-03-31 03:16:50 (EDT)
commit09af3f878ece3d4ada265532781d21b18b93bece (patch)
tree3d3405ddcd9a7aed08c1d9e02b8491d07e89e189
parent03ff9c4c23bb8e6734490fec3bdc933b2331d15b (diff)
downloadorg.eclipse.riena-09af3f878ece3d4ada265532781d21b18b93bece.zip
org.eclipse.riena-09af3f878ece3d4ada265532781d21b18b93bece.tar.gz
org.eclipse.riena-09af3f878ece3d4ada265532781d21b18b93bece.tar.bz2
refactoring of Service/Extension-Injector
-rw-r--r--org.eclipse.riena.communication.console/src/org/eclipse/riena/internal/communication/console/Activator.java12
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/RemoteServiceFactory.java6
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/Activator.java12
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/factory/CallHooksProxy.java4
-rw-r--r--org.eclipse.riena.communication.factory.hessian/src/org/eclipse/riena/internal/communication/factory/hessian/Activator.java4
-rw-r--r--org.eclipse.riena.communication.publisher.hessian/src/org/eclipse/riena/internal/communication/publisher/hessian/Activator.java4
-rw-r--r--org.eclipse.riena.communication.publisher/src/org/eclipse/riena/internal/communication/publisher/Activator.java11
-rw-r--r--org.eclipse.riena.communication.publisher/src/org/eclipse/riena/internal/communication/publisher/ServiceHooksProxy.java4
-rw-r--r--org.eclipse.riena.core/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.riena.core/src/org/eclipse/riena/core/extension/ExtensionDescriptor.java (renamed from org.eclipse.riena.core/src/org/eclipse/riena/core/extension/ExtensionId.java)27
-rw-r--r--org.eclipse.riena.core/src/org/eclipse/riena/core/extension/ExtensionInjector.java6
-rw-r--r--org.eclipse.riena.core/src/org/eclipse/riena/core/injector/Inject.java41
-rw-r--r--org.eclipse.riena.core/src/org/eclipse/riena/core/logging/LogUtil.java6
-rw-r--r--org.eclipse.riena.core/src/org/eclipse/riena/core/service/FilterInjector.java12
-rw-r--r--org.eclipse.riena.core/src/org/eclipse/riena/core/service/RankingInjector.java12
-rw-r--r--org.eclipse.riena.core/src/org/eclipse/riena/core/service/ServiceDescriptor.java (renamed from org.eclipse.riena.core/src/org/eclipse/riena/core/service/ServiceId.java)60
-rw-r--r--org.eclipse.riena.core/src/org/eclipse/riena/core/service/ServiceInjector.java (renamed from org.eclipse.riena.core/src/org/eclipse/riena/core/service/Injector.java)39
-rw-r--r--org.eclipse.riena.core/src/org/eclipse/riena/internal/core/config/ConfigFromExtensions.java4
-rw-r--r--org.eclipse.riena.security.common/src/org/eclipse/riena/internal/security/common/SecurityCallHook.java4
-rw-r--r--org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authentication/ClientLogin.java6
-rw-r--r--org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authorization/RienaPolicy.java4
-rw-r--r--org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authorization/Sentinel.java6
-rw-r--r--org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authorization/internal/PermissionCache.java4
-rw-r--r--org.eclipse.riena.security.server/src/org/eclipse/riena/internal/security/server/SecurityServiceHook.java10
-rw-r--r--org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/authenticationservice/AuthenticationService.java31
-rw-r--r--org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/authorizationservice/AuthorizationService.java4
-rw-r--r--org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/services/Activator.java10
-rw-r--r--org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/sessionservice/SessionService.java6
-rw-r--r--org.eclipse.riena.security.simpleservices/src/org/eclipse/riena/internal/security/simpleservices/Activator.java6
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/core/AllTests.java4
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/ExtensionInjectorTest.java39
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/core/service/ServiceInjectorTest.java (renamed from org.eclipse.riena.tests/src/org/eclipse/riena/core/service/InjectorTest.java)29
32 files changed, 239 insertions, 189 deletions
diff --git a/org.eclipse.riena.communication.console/src/org/eclipse/riena/internal/communication/console/Activator.java b/org.eclipse.riena.communication.console/src/org/eclipse/riena/internal/communication/console/Activator.java
index f0f2f41..47a3ec0 100644
--- a/org.eclipse.riena.communication.console/src/org/eclipse/riena/internal/communication/console/Activator.java
+++ b/org.eclipse.riena.communication.console/src/org/eclipse/riena/internal/communication/console/Activator.java
@@ -17,9 +17,9 @@ import org.eclipse.osgi.framework.console.CommandProvider;
import org.eclipse.riena.communication.core.IRemoteServiceRegistry;
import org.eclipse.riena.communication.core.publisher.IServicePublishEventDispatcher;
import org.eclipse.riena.communication.core.publisher.RSDPublisherProperties;
+import org.eclipse.riena.core.injector.Inject;
import org.eclipse.riena.core.logging.LogUtil;
-import org.eclipse.riena.core.service.Injector;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.service.ServiceInjector;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
@@ -27,8 +27,8 @@ import org.osgi.framework.ServiceRegistration;
public class Activator implements BundleActivator {
private ServiceRegistration consoleReg;
- private Injector publisherInjector;
- private Injector registryInjector;
+ private ServiceInjector publisherInjector;
+ private ServiceInjector registryInjector;
private LogUtil logUtil;
private static BundleContext CONTEXT;
private static Activator plugin;
@@ -46,9 +46,9 @@ public class Activator implements BundleActivator {
// the filter applies only if the service is living in this container
// e.g. server.
String filter = "(" + RSDPublisherProperties.PROP_IS_REMOTE + "=true)";
- publisherInjector = new ServiceId(IServicePublishEventDispatcher.ID).useRanking().useFilter(filter).injectInto(
+ publisherInjector = Inject.service(IServicePublishEventDispatcher.ID).useRanking().useFilter(filter).into(
console).andStart(context);
- registryInjector = new ServiceId(IRemoteServiceRegistry.ID).useRanking().injectInto(console).andStart(context);
+ registryInjector = Inject.service(IRemoteServiceRegistry.ID).useRanking().into(console).andStart(context);
consoleReg = context.registerService(CommandProvider.class.getName(), console, new Hashtable<String, String>());
}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/RemoteServiceFactory.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/RemoteServiceFactory.java
index c4421a5..9644cfc 100644
--- a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/RemoteServiceFactory.java
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/RemoteServiceFactory.java
@@ -22,7 +22,7 @@ import org.eclipse.riena.communication.core.IRemoteServiceRegistry;
import org.eclipse.riena.communication.core.RemoteServiceDescription;
import org.eclipse.riena.communication.core.publisher.RSDPublisherProperties;
import org.eclipse.riena.core.RienaStartupStatus;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.injector.Inject;
import org.eclipse.riena.internal.communication.core.Activator;
import org.eclipse.riena.internal.communication.core.factory.CallHooksProxy;
import org.osgi.framework.BundleContext;
@@ -78,7 +78,7 @@ public class RemoteServiceFactory {
*/
public RemoteServiceFactory() {
this(Activator.getContext());
- new ServiceId(IRemoteServiceRegistry.ID).injectInto(this).andStart(Activator.getContext());
+ Inject.service(IRemoteServiceRegistry.ID).into(this).andStart(Activator.getContext());
}
public void bind(IRemoteServiceRegistry registry) {
@@ -320,7 +320,7 @@ public class RemoteServiceFactory {
LazyProxyBuilder proxyBuilder = new LazyProxyBuilder(rsd, ref, lazyProxyHandler);
String filter = "(" + IRemoteServiceFactory.PROP_PROTOCOL + "=" + rsd.getProtocol() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- new ServiceId(IRemoteServiceFactory.class.getName()).useFilter(filter).injectInto(proxyBuilder).andStart(
+ Inject.service(IRemoteServiceFactory.class.getName()).useFilter(filter).into(proxyBuilder).andStart(
Activator.getContext());
return ref;
} catch (ClassNotFoundException e) {
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/Activator.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/Activator.java
index 2a56076..4ad5fdc 100644
--- a/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/Activator.java
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/Activator.java
@@ -21,9 +21,9 @@ import org.eclipse.riena.communication.core.hooks.ICallHook;
import org.eclipse.riena.communication.core.ssl.ISSLProperties;
import org.eclipse.riena.communication.core.ssl.SSLConfiguration;
import org.eclipse.riena.core.RienaActivator;
-import org.eclipse.riena.core.extension.ExtensionId;
import org.eclipse.riena.core.extension.ExtensionInjector;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.injector.Inject;
+import org.eclipse.riena.core.service.ServiceDescriptor;
import org.eclipse.riena.internal.communication.core.registry.RemoteServiceRegistry;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -56,7 +56,7 @@ public class Activator extends RienaActivator {
serviceRegistry = new RemoteServiceRegistry();
serviceRegistry.start();
- Hashtable<String, Object> properties = ServiceId.newDefaultServiceProperties();
+ Hashtable<String, Object> properties = ServiceDescriptor.newDefaultServiceProperties();
regServiceRegistry = context.registerService(IRemoteServiceRegistry.ID, serviceRegistry, properties);
final Logger logger = getLogger(Activator.class.getName());
@@ -83,13 +83,13 @@ public class Activator extends RienaActivator {
// SymbolConfigPlugin(), null);
// SSL configuration
- context.registerService(SSLConfiguration.class.getName(), new SSLConfiguration(), ServiceId
+ context.registerService(SSLConfiguration.class.getName(), new SSLConfiguration(), ServiceDescriptor
.newDefaultServiceProperties());
sslConfigServiceReference = context.getServiceReference(SSLConfiguration.class.getName());
SSLConfiguration config = (SSLConfiguration) context.getService(sslConfigServiceReference);
if (config != null) {
- sslInjector = new ExtensionId(ISSLProperties.EXTENSION_POINT_ID).expectingMinMax(0, 1).injectInto(config)
- .bind("configure");
+ sslInjector = Inject.extension(ISSLProperties.EXTENSION_POINT_ID).expectingMinMax(0, 1).into(config).bind(
+ "configure");
sslInjector.andStart();
}
}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/factory/CallHooksProxy.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/factory/CallHooksProxy.java
index 392077a..5d3df58 100644
--- a/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/factory/CallHooksProxy.java
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/factory/CallHooksProxy.java
@@ -22,7 +22,7 @@ import org.eclipse.riena.communication.core.hooks.CallContext;
import org.eclipse.riena.communication.core.hooks.ICallHook;
import org.eclipse.riena.communication.core.hooks.ICallMessageContext;
import org.eclipse.riena.communication.core.hooks.ICallMessageContextAccessor;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.injector.Inject;
import org.eclipse.riena.internal.communication.core.Activator;
public class CallHooksProxy extends AbstractHooksProxy {
@@ -33,7 +33,7 @@ public class CallHooksProxy extends AbstractHooksProxy {
public CallHooksProxy(Object proxiedInstance) {
super(proxiedInstance);
- new ServiceId(ICallHook.ID).injectInto(this).andStart(Activator.getContext());
+ Inject.service(ICallHook.ID).into(this).andStart(Activator.getContext());
}
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
diff --git a/org.eclipse.riena.communication.factory.hessian/src/org/eclipse/riena/internal/communication/factory/hessian/Activator.java b/org.eclipse.riena.communication.factory.hessian/src/org/eclipse/riena/internal/communication/factory/hessian/Activator.java
index 995a66c..b960f6d 100644
--- a/org.eclipse.riena.communication.factory.hessian/src/org/eclipse/riena/internal/communication/factory/hessian/Activator.java
+++ b/org.eclipse.riena.communication.factory.hessian/src/org/eclipse/riena/internal/communication/factory/hessian/Activator.java
@@ -15,7 +15,7 @@ import java.util.Hashtable;
import org.eclipse.equinox.log.Logger;
import org.eclipse.riena.communication.core.factory.IRemoteServiceFactory;
import org.eclipse.riena.core.RienaActivator;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.service.ServiceDescriptor;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.log.LogService;
@@ -37,7 +37,7 @@ public class Activator extends RienaActivator {
logger = getLogger(this.getClass().getName());
logger.log(LogService.LOG_INFO, "start hessian support on client");
factory = new RemoteServiceFactoryHessian();
- Hashtable<String, Object> properties = ServiceId.newDefaultServiceProperties();
+ Hashtable<String, Object> properties = ServiceDescriptor.newDefaultServiceProperties();
properties.put(IRemoteServiceFactory.PROP_PROTOCOL, factory.getProtocol());
regFactory = context.registerService(IRemoteServiceFactory.ID, factory, properties);
diff --git a/org.eclipse.riena.communication.publisher.hessian/src/org/eclipse/riena/internal/communication/publisher/hessian/Activator.java b/org.eclipse.riena.communication.publisher.hessian/src/org/eclipse/riena/internal/communication/publisher/hessian/Activator.java
index 67868e6..e938360 100644
--- a/org.eclipse.riena.communication.publisher.hessian/src/org/eclipse/riena/internal/communication/publisher/hessian/Activator.java
+++ b/org.eclipse.riena.communication.publisher.hessian/src/org/eclipse/riena/internal/communication/publisher/hessian/Activator.java
@@ -15,7 +15,7 @@ import java.util.Hashtable;
import org.eclipse.equinox.log.Logger;
import org.eclipse.riena.communication.core.publisher.IServicePublisher;
import org.eclipse.riena.core.RienaActivator;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.service.ServiceDescriptor;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.log.LogService;
@@ -42,7 +42,7 @@ public class Activator extends RienaActivator {
logger.log(LogService.LOG_INFO, "start hessian support on server");
publisher = new HessianRemoteServicePublisher();
- Hashtable<String, Object> properties = ServiceId.newDefaultServiceProperties();
+ Hashtable<String, Object> properties = ServiceDescriptor.newDefaultServiceProperties();
properties.put(IServicePublisher.PROP_PROTOCOL, publisher.getProtocol());
publisherReg = context.registerService(IServicePublisher.ID, publisher, properties);
}
diff --git a/org.eclipse.riena.communication.publisher/src/org/eclipse/riena/internal/communication/publisher/Activator.java b/org.eclipse.riena.communication.publisher/src/org/eclipse/riena/internal/communication/publisher/Activator.java
index 470d0a1..90911ee 100644
--- a/org.eclipse.riena.communication.publisher/src/org/eclipse/riena/internal/communication/publisher/Activator.java
+++ b/org.eclipse.riena.communication.publisher/src/org/eclipse/riena/internal/communication/publisher/Activator.java
@@ -22,8 +22,9 @@ import org.eclipse.riena.communication.core.publisher.IServicePublisher;
import org.eclipse.riena.communication.core.publisher.RSDPublisherProperties;
import org.eclipse.riena.communication.core.util.CommunicationUtil;
import org.eclipse.riena.core.RienaActivator;
-import org.eclipse.riena.core.service.Injector;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.injector.Inject;
+import org.eclipse.riena.core.service.ServiceDescriptor;
+import org.eclipse.riena.core.service.ServiceInjector;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceListener;
@@ -33,7 +34,7 @@ import org.osgi.service.log.LogService;
public class Activator extends RienaActivator {
private ServicePublishEventDispatcher dispatcher;
- private Injector publisherInjector;
+ private ServiceInjector publisherInjector;
private UpdateNotifierRemoteService updateNotifierRemoteService;
private static Activator plugin;
private static Logger logger;
@@ -47,11 +48,11 @@ public class Activator extends RienaActivator {
logger = getLogger(Activator.class.getName());
dispatcher = new ServicePublishEventDispatcher(context);
- publisherInjector = new ServiceId(IServicePublisher.ID).useRanking().injectInto(dispatcher).andStart(context);
+ publisherInjector = Inject.service(IServicePublisher.ID).useRanking().into(dispatcher).andStart(context);
// register as OSGi service, the start will pick up the OSGi service and
// publish it
- Dictionary<String, Object> properties = ServiceId.newDefaultServiceProperties();
+ Dictionary<String, Object> properties = ServiceDescriptor.newDefaultServiceProperties();
properties.put(RSDPublisherProperties.PROP_IS_REMOTE, Boolean.TRUE.toString());
properties.put(RSDPublisherProperties.PROP_REMOTE_PROTOCOL, "hessian");
properties.put(RSDPublisherProperties.PROP_REMOTE_PATH, "/ServicePublisherWS");
diff --git a/org.eclipse.riena.communication.publisher/src/org/eclipse/riena/internal/communication/publisher/ServiceHooksProxy.java b/org.eclipse.riena.communication.publisher/src/org/eclipse/riena/internal/communication/publisher/ServiceHooksProxy.java
index 0b66ec5..14b451d 100644
--- a/org.eclipse.riena.communication.publisher/src/org/eclipse/riena/internal/communication/publisher/ServiceHooksProxy.java
+++ b/org.eclipse.riena.communication.publisher/src/org/eclipse/riena/internal/communication/publisher/ServiceHooksProxy.java
@@ -23,7 +23,7 @@ import org.eclipse.riena.communication.core.hooks.IServiceHook;
import org.eclipse.riena.communication.core.hooks.IServiceMessageContext;
import org.eclipse.riena.communication.core.hooks.IServiceMessageContextAccessor;
import org.eclipse.riena.communication.core.hooks.ServiceContext;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.injector.Inject;
public class ServiceHooksProxy extends AbstractHooksProxy implements InvocationHandler {
@@ -34,7 +34,7 @@ public class ServiceHooksProxy extends AbstractHooksProxy implements InvocationH
public ServiceHooksProxy(Object serviceInstance) {
super(serviceInstance);
- new ServiceId(IServiceHook.ID).injectInto(this).andStart(Activator.getContext());
+ Inject.service(IServiceHook.ID).into(this).andStart(Activator.getContext());
}
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
diff --git a/org.eclipse.riena.core/META-INF/MANIFEST.MF b/org.eclipse.riena.core/META-INF/MANIFEST.MF
index 6eb9b65..c72ae80 100644
--- a/org.eclipse.riena.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.riena.core/META-INF/MANIFEST.MF
@@ -15,6 +15,7 @@ Export-Package: org.eclipse.riena.core,
org.eclipse.riena.core.exception,
org.eclipse.riena.core.extension,
org.eclipse.riena.core.extension.util,
+ org.eclipse.riena.core.injector,
org.eclipse.riena.core.logging,
org.eclipse.riena.core.marker,
org.eclipse.riena.core.service,
diff --git a/org.eclipse.riena.core/src/org/eclipse/riena/core/extension/ExtensionId.java b/org.eclipse.riena.core/src/org/eclipse/riena/core/extension/ExtensionDescriptor.java
index 75598b4..263da57 100644
--- a/org.eclipse.riena.core/src/org/eclipse/riena/core/extension/ExtensionId.java
+++ b/org.eclipse.riena.core/src/org/eclipse/riena/core/extension/ExtensionDescriptor.java
@@ -14,7 +14,7 @@ import org.eclipse.core.runtime.Assert;
import org.osgi.framework.BundleContext;
/**
- * ExtnesionId and ExtensionInjector simplify locating configuration
+ * ExtensionDescriptor and ExtensionInjector simplify locating configuration
* (extensions) and injects them into a target object. To do so the
* ExtensionInjector can (but must not) track the extension registry for changes
* of appearing and disappearing extensions and injects them into the target. A
@@ -31,13 +31,12 @@ import org.osgi.framework.BundleContext;
* If {@link #start(BundleContext)} is used configuration modifications as
* defined by <code>ConfigurationPlugin</code> will be applied applied.
* <p>
- * The ExtensionId and ExtensionInjector are implemented as a ´fluent interface´
- * allowing constructs like:
+ * The ExtensionDescriptor and ExtensionInjector are implemented as a ´fluent
+ * interface´ allowing constructs like:
* <ol>
- * <li>new ExtensionId("id1").injectInto(target).andStart(context)</li>
- * <li>new
- * ExtensionId("id2").useType(interface).injectInto(target).bind("configure").andStart(context)</li>
- * <li>new ExtensionId("id3").expectExactly(1).injectInto(target).andStart()</li>
+ * <li>Inject.extension("id1").into(target).andStart(context)</li>
+ * <li>Inject.extension("id2").useType(interface).into(target).bind("configure").andStart(context)</li>
+ * <li>Inject.extension("id3").expectExactly(1).into(target).andStart()</li>
* <li>..</li>
* </ol>
* <p>
@@ -49,7 +48,7 @@ import org.osgi.framework.BundleContext;
* The expected cardinality of extensions (min/max occurrences) can be specified
* with <code>expectingMinMax()</code> or with <code>expectingExactly()</code>.
*/
-public class ExtensionId {
+public class ExtensionDescriptor {
private String extensionPointId;
private Class<?> interfaceType;
@@ -59,11 +58,11 @@ public class ExtensionId {
public static final int UNBOUNDED = Integer.MAX_VALUE;
/**
- * Create an extension id for the given extension point id.
+ * Create an extension descriptor for the given extension point id.
*
* @param extensionPointId
*/
- public ExtensionId(String extensionPointId) {
+ public ExtensionDescriptor(String extensionPointId) {
Assert.isNotNull(extensionPointId, "The extension id must not be null."); //$NON-NLS-1$
this.extensionPointId = extensionPointId;
}
@@ -76,7 +75,7 @@ public class ExtensionId {
* @param interfaceType
* @return
*/
- public ExtensionId useType(Class<?> interfaceType) {
+ public ExtensionDescriptor useType(Class<?> interfaceType) {
Assert.isNotNull(interfaceType, "Interface type must not be null."); //$NON-NLS-1$
Assert.isTrue(interfaceType.isInterface(), "Interface type must be an interface."); //$NON-NLS-1$
Assert.isTrue(this.interfaceType == null, "Interface type has already been set."); //$NON-NLS-1$
@@ -89,7 +88,7 @@ public class ExtensionId {
*
* @param target
*/
- public ExtensionInjector injectInto(Object target) {
+ public ExtensionInjector into(Object target) {
Assert.isNotNull(target, "The target must not be null."); //$NON-NLS-1$
return new ExtensionInjector(this, target);
}
@@ -104,7 +103,7 @@ public class ExtensionId {
* @param max
* @return
*/
- public ExtensionId expectingMinMax(int min, int max) {
+ public ExtensionDescriptor expectingMinMax(int min, int max) {
Assert.isLegal(max >= min, "min must not be greater than max."); //$NON-NLS-1$
Assert.isLegal(min >= 0, "min must be greater or equal than zero."); //$NON-NLS-1$
Assert.isLegal(max > 0, "max must be greater than zero."); //$NON-NLS-1$
@@ -120,7 +119,7 @@ public class ExtensionId {
* @param exactly
* @return
*/
- public ExtensionId expectingExactly(int exactly) {
+ public ExtensionDescriptor expectingExactly(int exactly) {
return expectingMinMax(exactly, exactly);
}
diff --git a/org.eclipse.riena.core/src/org/eclipse/riena/core/extension/ExtensionInjector.java b/org.eclipse.riena.core/src/org/eclipse/riena/core/extension/ExtensionInjector.java
index d3b0d9a..93e5889 100644
--- a/org.eclipse.riena.core/src/org/eclipse/riena/core/extension/ExtensionInjector.java
+++ b/org.eclipse.riena.core/src/org/eclipse/riena/core/extension/ExtensionInjector.java
@@ -29,14 +29,14 @@ import org.osgi.service.log.LogService;
/**
* This is the extension injectors.<br>
- * See {@link ExtensionId} for explanation and usage.
+ * See {@link ExtensionDescriptor} for explanation and usage.
*/
public class ExtensionInjector {
// TODO When 3.4 is released we switch to IRegistryEventListener. This is
// the code in comments! PLEASE, DO NOT REMOVE IT!
- private ExtensionId extensionId;
+ private ExtensionDescriptor extensionId;
private Object target;
private BundleContext context;
private boolean started;
@@ -55,7 +55,7 @@ public class ExtensionInjector {
* @param extensionId
* @param target
*/
- ExtensionInjector(ExtensionId extensionId, Object target) {
+ ExtensionInjector(ExtensionDescriptor extensionId, Object target) {
this.extensionId = extensionId;
this.target = target;
}
diff --git a/org.eclipse.riena.core/src/org/eclipse/riena/core/injector/Inject.java b/org.eclipse.riena.core/src/org/eclipse/riena/core/injector/Inject.java
new file mode 100644
index 0000000..9f64ca0
--- /dev/null
+++ b/org.eclipse.riena.core/src/org/eclipse/riena/core/injector/Inject.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.core.injector;
+
+import org.eclipse.riena.core.extension.ExtensionDescriptor;
+import org.eclipse.riena.core.service.ServiceDescriptor;
+
+/**
+ * This <i>helper</i> class is the entry point to the injector <i>micro
+ * framework</i> of riena.
+ */
+public final class Inject {
+
+ /**
+ * @see ServiceDescriptor
+ *
+ * @param clazz
+ * @return
+ */
+ public static ServiceDescriptor service(String clazz) {
+ return new ServiceDescriptor(clazz);
+ }
+
+ /**
+ * @see ExtensionDescriptor
+ *
+ * @param extensionId
+ * @return
+ */
+ public static ExtensionDescriptor extension(String extensionId) {
+ return new ExtensionDescriptor(extensionId);
+ }
+}
diff --git a/org.eclipse.riena.core/src/org/eclipse/riena/core/logging/LogUtil.java b/org.eclipse.riena.core/src/org/eclipse/riena/core/logging/LogUtil.java
index 728b745..692e0d4 100644
--- a/org.eclipse.riena.core/src/org/eclipse/riena/core/logging/LogUtil.java
+++ b/org.eclipse.riena.core/src/org/eclipse/riena/core/logging/LogUtil.java
@@ -17,7 +17,7 @@ import org.eclipse.equinox.log.ExtendedLogReaderService;
import org.eclipse.equinox.log.ExtendedLogService;
import org.eclipse.equinox.log.LogFilter;
import org.eclipse.equinox.log.Logger;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.injector.Inject;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.service.log.LogListener;
@@ -104,8 +104,8 @@ public class LogUtil {
// with log4j
// logListeners.add(new Log4jLogListener());
- new ServiceId(ExtendedLogService.class.getName()).useRanking().injectInto(this).andStart(context);
- new ServiceId(ExtendedLogReaderService.class.getName()).useRanking().injectInto(this).andStart(context);
+ Inject.service(ExtendedLogService.class.getName()).useRanking().into(this).andStart(context);
+ Inject.service(ExtendedLogReaderService.class.getName()).useRanking().into(this).andStart(context);
initialized = true;
}
}
diff --git a/org.eclipse.riena.core/src/org/eclipse/riena/core/service/FilterInjector.java b/org.eclipse.riena.core/src/org/eclipse/riena/core/service/FilterInjector.java
index aab7dbf..b4d1fe0 100644
--- a/org.eclipse.riena.core/src/org/eclipse/riena/core/service/FilterInjector.java
+++ b/org.eclipse.riena.core/src/org/eclipse/riena/core/service/FilterInjector.java
@@ -18,7 +18,7 @@ import org.osgi.framework.ServiceReference;
/**
* The specialized filter injector implementation.
*/
-public class FilterInjector extends Injector {
+public class FilterInjector extends ServiceInjector {
private List<ServiceReference> trackedServiceRefs = null;
@@ -26,12 +26,12 @@ public class FilterInjector extends Injector {
* @param serviceId
* @param target
*/
- FilterInjector(ServiceId serviceId, Object target) {
+ FilterInjector(ServiceDescriptor serviceId, Object target) {
super(serviceId, target);
}
/*
- * @see org.eclipse.riena.core.service.Injector#doStart()
+ * @see org.eclipse.riena.core.service.ServiceInjector#doStart()
*/
@Override
protected void doStart() {
@@ -48,7 +48,7 @@ public class FilterInjector extends Injector {
}
/*
- * @see org.eclipse.riena.core.service.Injector#doStop()
+ * @see org.eclipse.riena.core.service.ServiceInjector#doStop()
*/
@Override
protected void doStop() {
@@ -64,7 +64,7 @@ public class FilterInjector extends Injector {
}
/*
- * @see org.eclipse.riena.core.service.Injector#doBind(org.osgi.framework.ServiceReference)
+ * @see org.eclipse.riena.core.service.ServiceInjector#doBind(org.osgi.framework.ServiceReference)
*/
@Override
protected void doBind(ServiceReference serviceRef) {
@@ -77,7 +77,7 @@ public class FilterInjector extends Injector {
}
/*
- * @see org.eclipse.riena.core.service.Injector#doUnbind(org.osgi.framework.ServiceReference)
+ * @see org.eclipse.riena.core.service.ServiceInjector#doUnbind(org.osgi.framework.ServiceReference)
*/
@Override
protected void doUnbind(ServiceReference serviceRef) {
diff --git a/org.eclipse.riena.core/src/org/eclipse/riena/core/service/RankingInjector.java b/org.eclipse.riena.core/src/org/eclipse/riena/core/service/RankingInjector.java
index e50d77e..b697671 100644
--- a/org.eclipse.riena.core/src/org/eclipse/riena/core/service/RankingInjector.java
+++ b/org.eclipse.riena.core/src/org/eclipse/riena/core/service/RankingInjector.java
@@ -18,7 +18,7 @@ import org.osgi.framework.ServiceReference;
/**
* The specialized ranking implementation.
*/
-public class RankingInjector extends Injector {
+public class RankingInjector extends ServiceInjector {
private ServiceReference trackedServiceRef = null;
@@ -26,12 +26,12 @@ public class RankingInjector extends Injector {
* @param serviceId
* @param target
*/
- RankingInjector(ServiceId serviceId, Object target) {
+ RankingInjector(ServiceDescriptor serviceId, Object target) {
super(serviceId, target);
}
/*
- * @see org.eclipse.riena.core.service.Injector#doStart()
+ * @see org.eclipse.riena.core.service.ServiceInjector#doStart()
*/
@Override
protected void doStart() {
@@ -41,7 +41,7 @@ public class RankingInjector extends Injector {
}
/*
- * @see org.eclipse.riena.core.service.Injector#doStop()
+ * @see org.eclipse.riena.core.service.ServiceInjector#doStop()
*/
@Override
protected void doStop() {
@@ -50,7 +50,7 @@ public class RankingInjector extends Injector {
}
/*
- * @see org.eclipse.riena.core.service.Injector#bind(org.osgi.framework.ServiceReference)
+ * @see org.eclipse.riena.core.service.ServiceInjector#bind(org.osgi.framework.ServiceReference)
*/
@Override
protected void doBind(ServiceReference serviceRef) {
@@ -65,7 +65,7 @@ public class RankingInjector extends Injector {
}
/*
- * @see org.eclipse.riena.core.service.Injector#unbind(org.osgi.framework.ServiceReference)
+ * @see org.eclipse.riena.core.service.ServiceInjector#unbind(org.osgi.framework.ServiceReference)
*/
@Override
protected void doUnbind(ServiceReference serviceRef) {
diff --git a/org.eclipse.riena.core/src/org/eclipse/riena/core/service/ServiceId.java b/org.eclipse.riena.core/src/org/eclipse/riena/core/service/ServiceDescriptor.java
index 3dd2e69..00c3d08 100644
--- a/org.eclipse.riena.core/src/org/eclipse/riena/core/service/ServiceId.java
+++ b/org.eclipse.riena.core/src/org/eclipse/riena/core/service/ServiceDescriptor.java
@@ -16,25 +16,23 @@ import org.eclipse.core.runtime.Assert;
import org.osgi.framework.Constants;
/**
- * ServiceId and Injector simplify finding of OSGi Services and injects them
- * into a target object. To do so the Injector contains a service tracker
- * listening to appearing and disappearing services and injects them into the
- * target. A target object defines named and typed bind and unbind methods. The
- * Injector calls the bind method when the specified service was registered or
- * modified. Injector calls the unbind method when the specified service becomes
- * unregistered.
+ * ServiceDescriptor and ServiceInjector simplify finding of OSGi Services and
+ * injects them into a target object. To do so the ServiceInjector contains a
+ * service tracker listening to appearing and disappearing services and injects
+ * them into the target. A target object defines named and typed bind and unbind
+ * methods. The ServiceInjector calls the bind method when the specified service
+ * was registered or modified. ServiceInjector calls the unbind method when the
+ * specified service becomes unregistered.
* <p>
* The service injector tracks the specified OSGi Service with {@link #start()}
* and stops tracking with {@link #stop()}.
* <p>
- * The ServiceId and Injector are implemented as a ´fluent interface´ allowing
- * constructs like:
+ * The ServiceDescriptor and ServiceInjector are implemented as a ´fluent
+ * interface´ allowing constructs like:
* <ol>
- * <li>new ServiceId("id1").injectInto(target).andStart(context)</li>
- * <li>new
- * ServiceId("id2").useFilter(filter).injectInto(target).bind("register").unbind("unregister").andStart(context)</li>
- * <li>new
- * ServiceId("id3").useRanking().injectInto(target).bind("register").unbind("unregister").andStart(context)</li>
+ * <li>Inject.service("id1").into(target).andStart(context)</li>
+ * <li>Inject.service("id2").useFilter(filter).into(target).bind("register").unbind("unregister").andStart(context)</li>
+ * <li>Inject.service("id3").useRanking().into(target).bind("register").unbind("unregister").andStart(context)</li>
* <li>..</li>
* </ol>
* <p>
@@ -52,27 +50,27 @@ import org.osgi.framework.Constants;
* same name but with different signatures. The injector takes responsibility
* for choosing the appropriate bind/unbind methods.
*/
-public class ServiceId {
+public class ServiceDescriptor {
/**
* Default service ranking for all riena services.
*/
public final static Integer DEFAULT_RANKING = -100;
- private String serviceId;
+ private String clazz;
private boolean ranking;
private String filter;
/**
- * Create a service id.
+ * Create a service descriptor.
*
* @throws some_kind_of_unchecked_exception
- * if service id is null.
- * @param serviceId
+ * if service descriptor is null.
+ * @param clazz
*/
- public ServiceId(String serviceId) {
- Assert.isNotNull(serviceId, "Service id must not be null.");
- this.serviceId = serviceId;
+ public ServiceDescriptor(String clazz) {
+ Assert.isNotNull(clazz, "Service clazz must not be null.");
+ this.clazz = clazz;
}
/**
@@ -81,9 +79,9 @@ public class ServiceId {
*
* @throws some_kind_of_unchecked_exception
* if a filter has already been set.
- * @return this service id
+ * @return this service descriptor
*/
- public ServiceId useFilter(String filter) {
+ public ServiceDescriptor useFilter(String filter) {
Assert.isTrue(this.filter == null, "Filter has already been set!");
Assert.isNotNull(filter, "Filter must not be null.");
this.filter = filter;
@@ -96,23 +94,23 @@ public class ServiceId {
*
* @throws some_kind_of_unchecked_exception
* if ranking has already been activated
- * @return this service id
+ * @return this service descriptor
*/
- public ServiceId useRanking() {
+ public ServiceDescriptor useRanking() {
Assert.isTrue(!ranking, "Ranking has already been set!");
ranking = true;
return this;
}
/**
- * Inject this service id into the specified target.
+ * Inject this service descriptor into the specified target.
*
* @param target
* @throws some_kind_of_unchecked_exception
* on target == null
- * @return the injector responsible for tracking this service id
+ * @return the injector responsible for tracking this service descriptor
*/
- public Injector injectInto(Object target) {
+ public ServiceInjector into(Object target) {
Assert.isNotNull(target, "Target must not be null.");
return ranking ? new RankingInjector(this, target) : new FilterInjector(this, target);
}
@@ -134,8 +132,8 @@ public class ServiceId {
/**
* @return
*/
- String getServiceId() {
- return serviceId;
+ String getServiceClazz() {
+ return clazz;
}
/**
diff --git a/org.eclipse.riena.core/src/org/eclipse/riena/core/service/Injector.java b/org.eclipse.riena.core/src/org/eclipse/riena/core/service/ServiceInjector.java
index f8e699c..f9b2ba0 100644
--- a/org.eclipse.riena.core/src/org/eclipse/riena/core/service/Injector.java
+++ b/org.eclipse.riena.core/src/org/eclipse/riena/core/service/ServiceInjector.java
@@ -28,10 +28,10 @@ import org.osgi.service.log.LogService;
/**
* The is the abstract base class for the specialized service injectors. See
- * {@link ServiceId} for explanation and usage. It provides common functionality
- * for the ranking injector and the filtering injector.
+ * {@link ServiceDescriptor} for explanation and usage. It provides common
+ * functionality for the ranking injector and the filtering injector.
*/
-public abstract class Injector {
+public abstract class ServiceInjector {
/**
* Default ´bind´ method name.
@@ -43,7 +43,7 @@ public abstract class Injector {
*/
public static final String DEFAULT_UNBIND_METHOD_NAME = "unbind"; //$NON-NLS-1$
- private ServiceId serviceId;
+ private ServiceDescriptor serviceDesc;
private BundleContext context = null;
private String filter;
private Object target;
@@ -54,22 +54,23 @@ public abstract class Injector {
private boolean started = false;
private ServiceListener serviceListener;
- private final static Logger LOGGER = new ConsoleLogger(Injector.class.getName());
+ private final static Logger LOGGER = new ConsoleLogger(ServiceInjector.class.getName());
/**
- * Constructor for the <code>injectInto()</code> of <code>ServiceId</code>.
+ * Constructor for the <code>injectInto()</code> of
+ * <code>ServiceDescriptor</code>.
*
- * @param serviceId
+ * @param serviceDesc
* @param target
*/
- Injector(ServiceId serviceId, Object target) {
- this.serviceId = serviceId;
+ ServiceInjector(ServiceDescriptor serviceDesc, Object target) {
+ this.serviceDesc = serviceDesc;
this.target = target;
StringBuilder bob = new StringBuilder().append("(").append(Constants.OBJECTCLASS).append("=").append( //$NON-NLS-1$ //$NON-NLS-2$
- serviceId.getServiceId()).append(")"); //$NON-NLS-1$
- if (serviceId.getFilter() != null) {
+ serviceDesc.getServiceClazz()).append(")"); //$NON-NLS-1$
+ if (serviceDesc.getFilter() != null) {
bob.insert(0, "(&"); //$NON-NLS-1$
- bob.append(serviceId.getFilter());
+ bob.append(serviceDesc.getFilter());
bob.append(')');
}
this.filter = bob.toString();
@@ -85,9 +86,9 @@ public abstract class Injector {
* @param context
* @return this injector
*/
- public Injector andStart(BundleContext context) {
+ public ServiceInjector andStart(BundleContext context) {
Assert.isNotNull(context, "Bundle context must be not null.");
- Assert.isTrue(!started, "Injector already started!");
+ Assert.isTrue(!started, "ServiceInjector already started!");
started = true;
this.context = context;
if (bindMethodName == null)
@@ -131,8 +132,8 @@ public abstract class Injector {
* @param bindMethodName
* @return this injector
*/
- public Injector bind(String bindMethodName) {
- Assert.isTrue(!started, "Injector already started!");
+ public ServiceInjector bind(String bindMethodName) {
+ Assert.isTrue(!started, "ServiceInjector already started!");
this.bindMethodName = bindMethodName;
return this;
}
@@ -146,8 +147,8 @@ public abstract class Injector {
* @param unbindMethodName
* @return this injector
*/
- public synchronized Injector unbind(String unbindMethodName) {
- Assert.isTrue(!started, "Injector already started!");
+ public synchronized ServiceInjector unbind(String unbindMethodName) {
+ Assert.isTrue(!started, "ServiceInjector already started!");
this.unbindMethodName = unbindMethodName;
return this;
}
@@ -214,7 +215,7 @@ public abstract class Injector {
*/
protected ServiceReference[] getServiceReferences() {
try {
- return context.getServiceReferences(serviceId.getServiceId(), filter);
+ return context.getServiceReferences(serviceDesc.getServiceClazz(), filter);
} catch (InvalidSyntaxException e) {
throw new IllegalArgumentException("The specified filter has syntax errors.", e);
}
diff --git a/org.eclipse.riena.core/src/org/eclipse/riena/internal/core/config/ConfigFromExtensions.java b/org.eclipse.riena.core/src/org/eclipse/riena/internal/core/config/ConfigFromExtensions.java
index b4d2605..6cae051 100644
--- a/org.eclipse.riena.core/src/org/eclipse/riena/internal/core/config/ConfigFromExtensions.java
+++ b/org.eclipse.riena.core/src/org/eclipse/riena/internal/core/config/ConfigFromExtensions.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.riena.internal.core.config;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.injector.Inject;
import org.osgi.framework.BundleContext;
import org.osgi.service.cm.ConfigurationAdmin;
@@ -40,6 +40,6 @@ public class ConfigFromExtensions {
* described in the classes javadoc.
*/
public void doConfig() {
- new ServiceId(ConfigurationAdmin.class.getName()).injectInto(new ConfigAdminHandler(context)).andStart(context);
+ Inject.service(ConfigurationAdmin.class.getName()).into(new ConfigAdminHandler(context)).andStart(context);
}
} \ No newline at end of file
diff --git a/org.eclipse.riena.security.common/src/org/eclipse/riena/internal/security/common/SecurityCallHook.java b/org.eclipse.riena.security.common/src/org/eclipse/riena/internal/security/common/SecurityCallHook.java
index 8bd43ce..3208c55 100644
--- a/org.eclipse.riena.security.common/src/org/eclipse/riena/internal/security/common/SecurityCallHook.java
+++ b/org.eclipse.riena.security.common/src/org/eclipse/riena/internal/security/common/SecurityCallHook.java
@@ -14,7 +14,7 @@ import java.util.Map;
import org.eclipse.riena.communication.core.hooks.CallContext;
import org.eclipse.riena.communication.core.hooks.ICallHook;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.injector.Inject;
import org.eclipse.riena.security.common.session.ISessionHolder;
import org.eclipse.riena.security.common.session.ISessionHolderService;
import org.eclipse.riena.security.common.session.Session;
@@ -32,7 +32,7 @@ public class SecurityCallHook implements ICallHook {
public SecurityCallHook() {
super();
- new ServiceId(ISessionHolderService.ID).useRanking().injectInto(this).andStart(Activator.getContext());
+ Inject.service(ISessionHolderService.ID).useRanking().into(this).andStart(Activator.getContext());
}
public void bind(ISessionHolderService shService) {
diff --git a/org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authentication/ClientLogin.java b/org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authentication/ClientLogin.java
index a8fc21f..4251f44 100644
--- a/org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authentication/ClientLogin.java
+++ b/org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authentication/ClientLogin.java
@@ -17,7 +17,7 @@ import javax.security.auth.Subject;
import javax.security.auth.callback.Callback;
import javax.security.auth.login.LoginException;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.injector.Inject;
import org.eclipse.riena.internal.security.common.Activator;
import org.eclipse.riena.security.common.ISubjectHolderService;
import org.eclipse.riena.security.common.authentication.credentials.AbstractCredential;
@@ -37,8 +37,8 @@ public class ClientLogin {
super();
this.loginContext = loginContext;
this.subject = subject;
- new ServiceId(IAuthenticationService.ID).useRanking().injectInto(this).andStart(Activator.getContext());
- new ServiceId(ISubjectHolderService.ID).useRanking().injectInto(this).andStart(Activator.getContext());
+ Inject.service(IAuthenticationService.ID).useRanking().into(this).andStart(Activator.getContext());
+ Inject.service(ISubjectHolderService.ID).useRanking().into(this).andStart(Activator.getContext());
}
public void bind(IAuthenticationService authenticationService) {
diff --git a/org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authorization/RienaPolicy.java b/org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authorization/RienaPolicy.java
index 8168d55..87077a7 100644
--- a/org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authorization/RienaPolicy.java
+++ b/org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authorization/RienaPolicy.java
@@ -21,7 +21,7 @@ import java.security.Principal;
import java.security.ProtectionDomain;
import org.eclipse.equinox.log.Logger;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.injector.Inject;
import org.eclipse.riena.internal.security.common.Activator;
import org.osgi.service.log.LogService;
@@ -38,7 +38,7 @@ public class RienaPolicy extends Policy {
public RienaPolicy() {
super();
- new ServiceId(IPermissionCache.ID).useRanking().injectInto(this).andStart(Activator.getContext());
+ Inject.service(IPermissionCache.ID).useRanking().into(this).andStart(Activator.getContext());
}
public void bind(IPermissionCache permCache) {
diff --git a/org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authorization/Sentinel.java b/org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authorization/Sentinel.java
index 9ff2bf1..29b7150 100644
--- a/org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authorization/Sentinel.java
+++ b/org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authorization/Sentinel.java
@@ -15,7 +15,7 @@ import java.security.Permissions;
import javax.security.auth.Subject;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.injector.Inject;
import org.eclipse.riena.internal.security.common.Activator;
import org.eclipse.riena.security.common.ISubjectHolder;
import org.eclipse.riena.security.common.ISubjectHolderService;
@@ -34,8 +34,8 @@ public class Sentinel {
private Sentinel() {
super();
- new ServiceId(IPermissionCache.ID).useRanking().injectInto(this).andStart(Activator.getContext());
- new ServiceId(ISubjectHolderService.ID).useRanking().injectInto(this).andStart(Activator.getContext());
+ Inject.service(IPermissionCache.ID).useRanking().into(this).andStart(Activator.getContext());
+ Inject.service(ISubjectHolderService.ID).useRanking().into(this).andStart(Activator.getContext());
}
public void bind(IPermissionCache permCache) {
diff --git a/org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authorization/internal/PermissionCache.java b/org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authorization/internal/PermissionCache.java
index 76bd930..3597d08 100644
--- a/org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authorization/internal/PermissionCache.java
+++ b/org.eclipse.riena.security.common/src/org/eclipse/riena/security/common/authorization/internal/PermissionCache.java
@@ -22,7 +22,7 @@ import javax.security.auth.Subject;
import org.eclipse.equinox.log.Logger;
import org.eclipse.riena.core.cache.GenericObjectCache;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.injector.Inject;
import org.eclipse.riena.core.util.ContainerModel;
import org.eclipse.riena.internal.security.common.Activator;
import org.eclipse.riena.security.common.authorization.IAuthorizationService;
@@ -48,7 +48,7 @@ public class PermissionCache implements IPermissionCache {
permCache.setMinimumSize(100);
permCache.setTimeout(360000);
}
- new ServiceId(IAuthorizationService.ID).useRanking().injectInto(this).andStart(Activator.getContext());
+ Inject.service(IAuthorizationService.ID).useRanking().into(this).andStart(Activator.getContext());
}
public void bind(IAuthorizationService authService) {
diff --git a/org.eclipse.riena.security.server/src/org/eclipse/riena/internal/security/server/SecurityServiceHook.java b/org.eclipse.riena.security.server/src/org/eclipse/riena/internal/security/server/SecurityServiceHook.java
index 28c2c9e..f85564a 100644
--- a/org.eclipse.riena.security.server/src/org/eclipse/riena/internal/security/server/SecurityServiceHook.java
+++ b/org.eclipse.riena.security.server/src/org/eclipse/riena/internal/security/server/SecurityServiceHook.java
@@ -20,7 +20,7 @@ import org.eclipse.equinox.log.Logger;
import org.eclipse.riena.communication.core.hooks.IServiceHook;
import org.eclipse.riena.communication.core.hooks.ServiceContext;
import org.eclipse.riena.core.cache.IGenericObjectCache;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.injector.Inject;
import org.eclipse.riena.security.common.ISubjectHolderService;
import org.eclipse.riena.security.common.NotAuthorizedFailure;
import org.eclipse.riena.security.common.session.ISessionHolderService;
@@ -68,11 +68,11 @@ public class SecurityServiceHook implements IServiceHook {
*/
public SecurityServiceHook() {
super();
- new ServiceId(IGenericObjectCache.ID).useFilter("(cache.type=PrincipalCache)").injectInto(this).andStart(
+ Inject.service(IGenericObjectCache.ID).useFilter("(cache.type=PrincipalCache)").into(this).andStart(
Activator.getContext());
- new ServiceId(ISessionService.ID).useRanking().injectInto(this).andStart(Activator.getContext());
- new ServiceId(ISubjectHolderService.ID).useRanking().injectInto(this).andStart(Activator.getContext());
- new ServiceId(ISessionHolderService.ID).useRanking().injectInto(this).andStart(Activator.getContext());
+ Inject.service(ISessionService.ID).useRanking().into(this).andStart(Activator.getContext());
+ Inject.service(ISubjectHolderService.ID).useRanking().into(this).andStart(Activator.getContext());
+ Inject.service(ISessionHolderService.ID).useRanking().into(this).andStart(Activator.getContext());
// List<UnsecureWebservice> tempList =
// RegistryAccessor.fetchRegistry().getConfiguration(UNSECURE_WEBSERVICES_ID);
diff --git a/org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/authenticationservice/AuthenticationService.java b/org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/authenticationservice/AuthenticationService.java
index eb23153..5653837 100644
--- a/org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/authenticationservice/AuthenticationService.java
+++ b/org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/authenticationservice/AuthenticationService.java
@@ -28,7 +28,7 @@ import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import org.eclipse.equinox.log.Logger;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.injector.Inject;
import org.eclipse.riena.internal.security.services.Activator;
import org.eclipse.riena.security.common.ISubjectHolderService;
import org.eclipse.riena.security.common.authentication.AuthenticationFailure;
@@ -72,11 +72,11 @@ public class AuthenticationService implements IAuthenticationService {
*/
public AuthenticationService() {
super();
- new ServiceId(ISessionService.ID).useRanking().injectInto(this).andStart(Activator.getContext());
- new ServiceId(ISubjectHolderService.ID).useRanking().injectInto(this).andStart(Activator.getContext());
+ Inject.service(ISessionService.ID).useRanking().into(this).andStart(Activator.getContext());
+ Inject.service(ISubjectHolderService.ID).useRanking().into(this).andStart(Activator.getContext());
// new
- // ServiceId(IAuthenticationModule.ID).injectInto(this).start(Activator.getContext());
- new ServiceId(ISessionHolderService.ID).useRanking().injectInto(this).andStart(Activator.getContext());
+ // ServiceDescriptor(IAuthenticationModule.ID).injectInto(this).start(Activator.getContext());
+ Inject.service(ISessionHolderService.ID).useRanking().into(this).andStart(Activator.getContext());
}
public void bind(ISessionService sessionService) {
@@ -125,7 +125,8 @@ public class AuthenticationService implements IAuthenticationService {
* @see org.eclipse.riena.security.common.authentication.IAuthenticationService#login(java.lang.String,
* org.eclipse.riena.security.common.authentication.credentials.AbstractCredential[])
*/
- public AuthenticationTicket login(String loginContext, AbstractCredential[] credentials) throws AuthenticationFailure {
+ public AuthenticationTicket login(String loginContext, AbstractCredential[] credentials)
+ throws AuthenticationFailure {
try {
Callback[] callbacks = Callback2CredentialConverter.credentials2Callbacks(credentials);
// create login context and login
@@ -187,13 +188,16 @@ class MyCallbackHandler implements CallbackHandler {
}
} else {
if (cb instanceof ConfirmationCallback) {
- if (((ConfirmationCallback) cb).getPrompt().equals(((ConfirmationCallback) rcb).getPrompt())) {
- ((ConfirmationCallback) cb).setSelectedIndex(((ConfirmationCallback) rcb).getSelectedIndex());
+ if (((ConfirmationCallback) cb).getPrompt().equals(
+ ((ConfirmationCallback) rcb).getPrompt())) {
+ ((ConfirmationCallback) cb).setSelectedIndex(((ConfirmationCallback) rcb)
+ .getSelectedIndex());
break;
}
} else {
if (cb instanceof TextInputCallback) {
- if (((TextInputCallback) cb).getPrompt().equals(((TextInputCallback) rcb).getPrompt())) {
+ if (((TextInputCallback) cb).getPrompt().equals(
+ ((TextInputCallback) rcb).getPrompt())) {
((TextInputCallback) cb).setText(((TextInputCallback) rcb).getText());
}
} else {
@@ -206,11 +210,14 @@ class MyCallbackHandler implements CallbackHandler {
break;
} else {
if (cb instanceof ChoiceCallback) {
- if (((ChoiceCallback) cb).getPrompt().equals(((ChoiceCallback) rcb).getPrompt())) {
- ((ChoiceCallback) cb).setSelectedIndexes(((ChoiceCallback) rcb).getSelectedIndexes());
+ if (((ChoiceCallback) cb).getPrompt().equals(
+ ((ChoiceCallback) rcb).getPrompt())) {
+ ((ChoiceCallback) cb).setSelectedIndexes(((ChoiceCallback) rcb)
+ .getSelectedIndexes());
} else {
- throw new UnsupportedOperationException("unsupported authentication callback type");
+ throw new UnsupportedOperationException(
+ "unsupported authentication callback type");
}
}
}
diff --git a/org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/authorizationservice/AuthorizationService.java b/org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/authorizationservice/AuthorizationService.java
index 1d75054..d9da881 100644
--- a/org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/authorizationservice/AuthorizationService.java
+++ b/org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/authorizationservice/AuthorizationService.java
@@ -13,7 +13,7 @@ package org.eclipse.riena.internal.security.authorizationservice;
import java.security.Permissions;
import java.security.Principal;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.injector.Inject;
import org.eclipse.riena.internal.security.services.Activator;
import org.eclipse.riena.security.authorizationservice.IPermissionStore;
import org.eclipse.riena.security.common.authorization.IAuthorizationService;
@@ -24,7 +24,7 @@ public class AuthorizationService implements IAuthorizationService {
public AuthorizationService() {
super();
- new ServiceId(IPermissionStore.ID).useRanking().injectInto(this).andStart(Activator.getContext());
+ Inject.service(IPermissionStore.ID).useRanking().into(this).andStart(Activator.getContext());
}
public void bind(IPermissionStore permStore) {
diff --git a/org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/services/Activator.java b/org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/services/Activator.java
index bcb4f62..48ac075 100644
--- a/org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/services/Activator.java
+++ b/org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/services/Activator.java
@@ -3,7 +3,7 @@ package org.eclipse.riena.internal.security.services;
import java.util.Hashtable;
import org.eclipse.riena.core.RienaActivator;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.service.ServiceDescriptor;
import org.eclipse.riena.internal.security.authenticationservice.AuthenticationService;
import org.eclipse.riena.internal.security.authorizationservice.AuthorizationService;
import org.eclipse.riena.internal.security.sessionservice.SessionService;
@@ -47,28 +47,28 @@ public class Activator extends RienaActivator {
plugin = this;
// register AuthenticationService
- Hashtable<String, Object> properties = ServiceId.newDefaultServiceProperties();
+ Hashtable<String, Object> properties = ServiceDescriptor.newDefaultServiceProperties();
properties.put("riena.remote", Boolean.TRUE.toString());
properties.put("riena.remote.protocol", "hessian");
properties.put("riena.remote.path", IAuthenticationService.WS_ID);
authenticationService = getContext().registerService(IAuthenticationService.ID, new AuthenticationService(), properties);
// register SessionService
- properties = ServiceId.newDefaultServiceProperties();
+ properties = ServiceDescriptor.newDefaultServiceProperties();
properties.put("riena.remote", Boolean.TRUE.toString());
properties.put("riena.remote.protocol", "hessian");
properties.put("riena.remote.path", ISessionService.WS_ID);
sessionService = getContext().registerService(ISessionService.ID, new SessionService(), properties);
// register AuthorizationService
- properties = ServiceId.newDefaultServiceProperties();
+ properties = ServiceDescriptor.newDefaultServiceProperties();
properties.put("riena.remote", Boolean.TRUE.toString());
properties.put("riena.remote.protocol", "hessian");
properties.put("riena.remote.path", IAuthorizationService.WS_ID);
authorizationService = getContext().registerService(IAuthorizationService.ID, new AuthorizationService(), properties);
// register SessionProvider
- sessionProvider = getContext().registerService(ISessionProvider.ID, new SessionProvider(), ServiceId.newDefaultServiceProperties());
+ sessionProvider = getContext().registerService(ISessionProvider.ID, new SessionProvider(), ServiceDescriptor.newDefaultServiceProperties());
}
diff --git a/org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/sessionservice/SessionService.java b/org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/sessionservice/SessionService.java
index 0503b96..a994e12 100644
--- a/org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/sessionservice/SessionService.java
+++ b/org.eclipse.riena.security.services/src/org/eclipse/riena/internal/security/sessionservice/SessionService.java
@@ -12,7 +12,7 @@ package org.eclipse.riena.internal.security.sessionservice;
import java.security.Principal;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.injector.Inject;
import org.eclipse.riena.internal.security.services.Activator;
import org.eclipse.riena.security.common.session.Session;
import org.eclipse.riena.security.server.session.ISessionService;
@@ -36,8 +36,8 @@ public class SessionService implements ISessionService {
*/
public SessionService() {
super();
- new ServiceId(ISessionStore.ID).injectInto(this).andStart(Activator.getContext());
- new ServiceId(ISessionProvider.ID).injectInto(this).andStart(Activator.getContext());
+ Inject.service(ISessionStore.ID).into(this).andStart(Activator.getContext());
+ Inject.service(ISessionProvider.ID).into(this).andStart(Activator.getContext());
}
public void bind(ISessionStore store) {
diff --git a/org.eclipse.riena.security.simpleservices/src/org/eclipse/riena/internal/security/simpleservices/Activator.java b/org.eclipse.riena.security.simpleservices/src/org/eclipse/riena/internal/security/simpleservices/Activator.java
index 168ea7e..be11a1e 100644
--- a/org.eclipse.riena.security.simpleservices/src/org/eclipse/riena/internal/security/simpleservices/Activator.java
+++ b/org.eclipse.riena.security.simpleservices/src/org/eclipse/riena/internal/security/simpleservices/Activator.java
@@ -3,7 +3,7 @@ package org.eclipse.riena.internal.security.simpleservices;
import java.io.InputStream;
import org.eclipse.riena.core.RienaActivator;
-import org.eclipse.riena.core.service.ServiceId;
+import org.eclipse.riena.core.service.ServiceDescriptor;
import org.eclipse.riena.security.authorizationservice.IPermissionStore;
import org.eclipse.riena.security.sessionservice.ISessionStore;
import org.eclipse.riena.security.simpleservices.authorizationservice.store.FilePermissionStore;
@@ -39,12 +39,12 @@ public class Activator extends RienaActivator {
super.start(context);
plugin = this;
// bring up a simple in memory session store
- memoryStore = getContext().registerService(ISessionStore.ID, new MemoryStore(), ServiceId.newDefaultServiceProperties());
+ memoryStore = getContext().registerService(ISessionStore.ID, new MemoryStore(), ServiceDescriptor.newDefaultServiceProperties());
// bring up a simple authorization store for permissions
InputStream inputStream = this.getClass().getResourceAsStream("policy-def.xml");
FilePermissionStore store = new FilePermissionStore(inputStream);
- filepermissionstore = context.registerService(IPermissionStore.ID, store, ServiceId.newDefaultServiceProperties());
+ filepermissionstore = context.registerService(IPermissionStore.ID, store, ServiceDescriptor.newDefaultServiceProperties());
}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/core/AllTests.java b/org.eclipse.riena.tests/src/org/eclipse/riena/core/AllTests.java
index 7caaec2..9723c86 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/core/AllTests.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/core/AllTests.java
@@ -18,7 +18,7 @@ import org.eclipse.riena.core.config.ConfigTest;
import org.eclipse.riena.core.exception.ExceptionHandlerManagerTest;
import org.eclipse.riena.core.extension.ExtensionInjectorTest;
import org.eclipse.riena.core.extension.util.ExtensionUtilTest;
-import org.eclipse.riena.core.service.InjectorTest;
+import org.eclipse.riena.core.service.ServiceInjectorTest;
/**
* Tests all test cases within package:
@@ -32,7 +32,7 @@ public class AllTests extends TestCase {
suite.addTestSuite(ConfigTest.class);
suite.addTestSuite(ExceptionHandlerManagerTest.class);
suite.addTestSuite(ExtensionUtilTest.class);
- suite.addTestSuite(InjectorTest.class);
+ suite.addTestSuite(ServiceInjectorTest.class);
suite.addTestSuite(ExtensionInjectorTest.class);
return suite;
}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/ExtensionInjectorTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/ExtensionInjectorTest.java
index bcecd22..39c2e15 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/ExtensionInjectorTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/core/extension/ExtensionInjectorTest.java
@@ -15,6 +15,7 @@ import java.util.Dictionary;
import java.util.HashMap;
import java.util.Hashtable;
+import org.eclipse.riena.core.injector.Inject;
import org.eclipse.riena.internal.core.config.ConfigSymbolReplace;
import org.eclipse.riena.tests.RienaTestCase;
import org.osgi.framework.BundleContext;
@@ -34,14 +35,14 @@ public class ExtensionInjectorTest extends RienaTestCase {
public void scribble() {
BundleContext context = null;
- new ExtensionId("").useType(Object.class).expectingMinMax(0, 1).injectInto(this).andStart();
- new ExtensionId("").useType(Object.class).expectingExactly(1).injectInto(this).bind("update").andStart();
- new ExtensionId("").injectInto(this).doNotTrack().andStart().stop();
+ Inject.extension("").useType(Object.class).expectingMinMax(0, 1).into(this).andStart();
+ Inject.extension("").useType(Object.class).expectingExactly(1).into(this).bind("update").andStart();
+ Inject.extension("").into(this).doNotTrack().andStart().stop();
}
public void testConstructorConstraints() {
try {
- new ExtensionId(null);
+ Inject.extension(null);
fail("That should not happen!");
} catch (RuntimeException e) {
// ok
@@ -50,19 +51,19 @@ public class ExtensionInjectorTest extends RienaTestCase {
public void testUseTypeConstraints() {
try {
- new ExtensionId("id").useType(null);
+ Inject.extension("id").useType(null);
fail("That should not happen!");
} catch (RuntimeException e) {
// ok
}
try {
- new ExtensionId("id").useType(IData.class).useType(IData.class);
+ Inject.extension("id").useType(IData.class).useType(IData.class);
fail("That should not happen!");
} catch (RuntimeException e) {
// ok
}
try {
- new ExtensionId("id").useType(String.class);
+ Inject.extension("id").useType(String.class);
fail("That should not happen!");
} catch (RuntimeException e) {
// ok
@@ -71,19 +72,19 @@ public class ExtensionInjectorTest extends RienaTestCase {
public void testExpectingConstraints() {
try {
- new ExtensionId("id").expectingMinMax(2, 1);
+ Inject.extension("id").expectingMinMax(2, 1);
fail("That should not happen!");
} catch (RuntimeException e) {
// ok
}
try {
- new ExtensionId("id").expectingMinMax(-1, 0);
+ Inject.extension("id").expectingMinMax(-1, 0);
fail("That should not happen!");
} catch (RuntimeException e) {
// ok
}
try {
- new ExtensionId("id").expectingMinMax(0, 0);
+ Inject.extension("id").expectingMinMax(0, 0);
fail("That should not happen!");
} catch (RuntimeException e) {
// ok
@@ -92,7 +93,7 @@ public class ExtensionInjectorTest extends RienaTestCase {
public void testInjectIntoConstraints() {
try {
- new ExtensionId("id").injectInto(null);
+ Inject.extension("id").into(null);
fail("That should not happen!");
} catch (RuntimeException e) {
// ok
@@ -106,7 +107,7 @@ public class ExtensionInjectorTest extends RienaTestCase {
addPluginXml(ExtensionInjectorTest.class, "plugin_ext2.xml");
addPluginXml(ExtensionInjectorTest.class, "plugin_ext3.xml");
ConfigurableThingMultipleData target = new ConfigurableThingMultipleData();
- ExtensionInjector injector = new ExtensionId("core.test.extpoint").useType(IData.class).injectInto(target)
+ ExtensionInjector injector = Inject.extension("core.test.extpoint").useType(IData.class).into(target)
.andStart();
assertEquals(3, target.getData().length);
removeExtension("core.test.extpoint.id1");
@@ -123,7 +124,7 @@ public class ExtensionInjectorTest extends RienaTestCase {
addPluginXml(ExtensionInjectorTest.class, "plugin_ext2.xml");
addPluginXml(ExtensionInjectorTest.class, "plugin_ext3.xml");
ConfigurableThingMultipleData target = new ConfigurableThingMultipleData();
- ExtensionInjector injector = new ExtensionId("core.test.extpoint").injectInto(target).andStart();
+ ExtensionInjector injector = Inject.extension("core.test.extpoint").into(target).andStart();
assertEquals(3, target.getData().length);
removeExtension("core.test.extpoint.id1");
removeExtension("core.test.extpoint.id2");
@@ -137,8 +138,8 @@ public class ExtensionInjectorTest extends RienaTestCase {
addPluginXml(ExtensionInjectorTest.class, "plugin.xml");
addPluginXml(ExtensionInjectorTest.class, "plugin_ext1.xml");
ConfigurableThingSingleData target = new ConfigurableThingSingleData();
- ExtensionInjector injector = new ExtensionId("core.test.extpoint").useType(IData.class).expectingExactly(1)
- .injectInto(target).bind("configure").andStart();
+ ExtensionInjector injector = Inject.extension("core.test.extpoint").useType(IData.class).expectingExactly(1)
+ .into(target).bind("configure").andStart();
assertNotNull(target.getData());
assertTrue(target.getData().getBoolean());
assertTrue(target.getData().isBoolean());
@@ -154,7 +155,7 @@ public class ExtensionInjectorTest extends RienaTestCase {
addPluginXml(ExtensionInjectorTest.class, "plugin.xml");
addPluginXml(ExtensionInjectorTest.class, "plugin_ext2.xml");
ConfigurableThingSingleData target = new ConfigurableThingSingleData();
- ExtensionInjector injector = new ExtensionId("core.test.extpoint").expectingExactly(1).injectInto(target).bind(
+ ExtensionInjector injector = Inject.extension("core.test.extpoint").expectingExactly(1).into(target).bind(
"configure").andStart();
assertNotNull(target.getData());
assertFalse(target.getData().getBoolean());
@@ -171,7 +172,7 @@ public class ExtensionInjectorTest extends RienaTestCase {
addPluginXml(ExtensionInjectorTest.class, "plugin.xml");
addPluginXml(ExtensionInjectorTest.class, "plugin_ext4.xml");
ConfigurableThingSingleData target = new ConfigurableThingSingleData();
- ExtensionInjector injector = new ExtensionId("core.test.extpoint").expectingExactly(1).injectInto(target).bind(
+ ExtensionInjector injector = Inject.extension("core.test.extpoint").expectingExactly(1).into(target).bind(
"configure").andStart();
assertNotNull(target.getData());
assertTrue(target.getData().getBoolean());
@@ -199,7 +200,7 @@ public class ExtensionInjectorTest extends RienaTestCase {
printTestName();
addPluginXml(ExtensionInjectorTest.class, "plugin.xml");
ConfigurableThingMultipleData target = new ConfigurableThingMultipleData();
- ExtensionInjector injector = new ExtensionId("core.test.extpoint").useType(IData.class).injectInto(target)
+ ExtensionInjector injector = Inject.extension("core.test.extpoint").useType(IData.class).into(target)
.andStart();
assertEquals(0, target.getData().length);
addPluginXml(ExtensionInjectorTest.class, "plugin_ext1.xml");
@@ -237,7 +238,7 @@ public class ExtensionInjectorTest extends RienaTestCase {
addPluginXml(ExtensionInjectorTest.class, "plugin.xml");
addPluginXml(ExtensionInjectorTest.class, "plugin_ext5.xml");
ConfigurableThingSingleData target = new ConfigurableThingSingleData();
- ExtensionInjector injector = new ExtensionId("core.test.extpoint").expectingExactly(1).injectInto(target).bind(
+ ExtensionInjector injector = Inject.extension("core.test.extpoint").expectingExactly(1).into(target).bind(
"configure").andStart(getContext());
assertNotNull(target.getData());
assertTrue(target.getData().getBoolean());
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/core/service/InjectorTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/core/service/ServiceInjectorTest.java
index 79e0d53..8c726f5 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/core/service/InjectorTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/core/service/ServiceInjectorTest.java
@@ -13,6 +13,7 @@ package org.eclipse.riena.core.service;
import java.util.Dictionary;
import java.util.Hashtable;
+import org.eclipse.riena.core.injector.Inject;
import org.eclipse.riena.tests.RienaTestCase;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceRegistration;
@@ -20,7 +21,7 @@ import org.osgi.framework.ServiceRegistration;
/**
*
*/
-public class InjectorTest extends RienaTestCase {
+public class ServiceInjectorTest extends RienaTestCase {
@Override
protected void setUp() throws Exception {
@@ -35,9 +36,9 @@ public class InjectorTest extends RienaTestCase {
public void scribble() {
Object target = null;
- new ServiceId("serviceId").injectInto(target).andStart(getContext());
- new ServiceId("serviceId").injectInto(target).bind("bind").unbind("unbind").andStart(getContext());
- new ServiceId("serviceId").useFilter("").injectInto(target).bind("bind").unbind("unbind")
+ Inject.service("serviceId").into(target).andStart(getContext());
+ Inject.service("serviceId").into(target).bind("bind").unbind("unbind").andStart(getContext());
+ Inject.service("serviceId").useFilter("").into(target).bind("bind").unbind("unbind")
.andStart(getContext());
}
@@ -49,7 +50,7 @@ public class InjectorTest extends RienaTestCase {
ServiceRegistration reg = getContext().registerService(DepOne.class.getName(), depOne, null);
try {
- new ServiceId(DepOne.class.getName()).injectInto(target).bind("baind").andStart(getContext());
+ Inject.service(DepOne.class.getName()).into(target).bind("baind").andStart(getContext());
fail("Well, that should not have happended");
} catch (IllegalArgumentException e) {
assertTrue(true);
@@ -66,7 +67,7 @@ public class InjectorTest extends RienaTestCase {
ServiceRegistration reg = getContext().registerService(DepTwo.class.getName(), depTwo, null);
try {
- new ServiceId(DepOne.class.getName()).injectInto(target).bind("binde").unbind("entbinde").andStart(
+ Inject.service(DepOne.class.getName()).into(target).bind("binde").unbind("entbinde").andStart(
getContext());
} catch (IllegalArgumentException e) {
assertTrue(true);
@@ -82,7 +83,7 @@ public class InjectorTest extends RienaTestCase {
DepOne depOne = new DepOne();
ServiceRegistration reg = getContext().registerService(DepOne.class.getName(), depOne, null);
- Injector shot = new ServiceId(DepOne.class.getName()).injectInto(target).andStart(getContext());
+ ServiceInjector shot = Inject.service(DepOne.class.getName()).into(target).andStart(getContext());
assertEquals(1, target.count("bind", DepOne.class));
shot.stop();
@@ -98,10 +99,10 @@ public class InjectorTest extends RienaTestCase {
DepOne depOne = new DepOne();
ServiceRegistration reg1 = getContext().registerService(DepOne.class.getName(), depOne, null);
- Injector shot1 = new ServiceId(DepOne.class.getName()).injectInto(target).andStart(getContext());
+ ServiceInjector shot1 = Inject.service(DepOne.class.getName()).into(target).andStart(getContext());
assertEquals(1, target.count("bind", DepOne.class));
- Injector shot2 = new ServiceId(DepTwo.class.getName()).injectInto(target).andStart(getContext());
+ ServiceInjector shot2 = Inject.service(DepTwo.class.getName()).into(target).andStart(getContext());
DepTwo depTwo = new DepTwo();
ServiceRegistration reg2 = getContext().registerService(DepTwo.class.getName(), depTwo, null);
@@ -125,7 +126,7 @@ public class InjectorTest extends RienaTestCase {
DepOne depOne = new DepOne();
ServiceRegistration reg = getContext().registerService(DepOne.class.getName(), depOne, null);
- Injector shot = new ServiceId(DepOne.class.getName()).injectInto(target).bind("binde").unbind("entbinde")
+ ServiceInjector shot = Inject.service(DepOne.class.getName()).into(target).bind("binde").unbind("entbinde")
.andStart(getContext());
assertEquals(1, target.count("binde", DepOne.class));
@@ -147,7 +148,7 @@ public class InjectorTest extends RienaTestCase {
dict.put(Constants.SERVICE_RANKING, Integer.valueOf(100));
ServiceRegistration reg2 = getContext().registerService(IRanking.class.getName(), rank2, dict);
- Injector shot = new ServiceId(IRanking.class.getName()).useRanking().injectInto(target).andStart(getContext());
+ ServiceInjector shot = Inject.service(IRanking.class.getName()).useRanking().into(target).andStart(getContext());
assertEquals(1, target.count("bind", IRanking.class));
assertEquals(100, target.getDepRanking());
@@ -166,7 +167,7 @@ public class InjectorTest extends RienaTestCase {
IRanking rank1 = new RankingOne(0);
ServiceRegistration reg1 = getContext().registerService(IRanking.class.getName(), rank1, null);
- Injector shot = new ServiceId(IRanking.class.getName()).useRanking().injectInto(target).andStart(getContext());
+ ServiceInjector shot = Inject.service(IRanking.class.getName()).useRanking().into(target).andStart(getContext());
assertEquals(1, target.count("bind", IRanking.class));
assertEquals(0, target.getDepRanking());
@@ -205,7 +206,7 @@ public class InjectorTest extends RienaTestCase {
DepOne depOne = new DepOneOne();
ServiceRegistration reg = getContext().registerService(DepOne.class.getName(), depOne, null);
- Injector shot = new ServiceId(DepOne.class.getName()).injectInto(target).andStart(getContext());
+ ServiceInjector shot = Inject.service(DepOne.class.getName()).into(target).andStart(getContext());
assertEquals(1, target.count("bind", DepOneOne.class));
assertEquals(0, target.count("bind", DepOne.class));
@@ -224,7 +225,7 @@ public class InjectorTest extends RienaTestCase {
props.put("x", "y");
ServiceRegistration reg = getContext().registerService(DepOne.class.getName(), depOne, props);
- Injector shot = new ServiceId(DepOne.class.getName()).useFilter("(x=y)").injectInto(target).andStart(
+ ServiceInjector shot = Inject.service(DepOne.class.getName()).useFilter("(x=y)").into(target).andStart(
getContext());
assertEquals(1, target.count("bind", DepOneOne.class));