arquillian/arquillian-graphene — pull request #103 by smiklosovic (2014-03-16 01:28:46+00:00)
Title: ARQGRA-408 Introduced SPI for custom location schemes

@lfryc

Changes in SPI module

1) Scheme class is in SPI as you wanted
2) LocationDecider interface is in SPI as well

Changes in IMPL module

1) Implementations of LocationDecider are in org.jboss.arquillian.graphene.location.decider
2) Deleted LocationDeciderInitializer class -> used ServiceLoader in LocationEnricher as you wanted
3) Deleted LocationDeciderRegister as you wanted
4) Only deciders are added to GrapheneExtension as previously.

Usage:

```java
@Location("http://www.google.com")
```
Full specification
```java
@Location(scheme = Scheme.HTTP.class, value = "http://www.google.com")
```

I can not do it via enumeration since it would not be extensible. I can use only primitive types / class in Location annotation so no interfaces as well. I chose class-based approach.

*How do I implement my own Scheme?*

1) I extend Scheme class like this

````
public DroidiumScheme extends Scheme
{
@Override
public String toString()
{
return "and-activity://";
}
}
````

2) I implement my own DroidiumLocationDecider which implements interface which is in Graphene SPI as well.

*I depend only by SPI module from Graphene as you wanted when implementing custom scheme.*

3) I use it like

```java
@Location(scheme = DroidiumScheme.class, value = "this.is.my.activity")
```

_Default scheme_

will be set in configuration like this

```xml

org.arquillian.droidium.native.spi.DroidiumScheme

```

I added there stripped SecurityActions to instantiate that custom scheme from String.

(1) http://mjremijan.blogspot.cz/2012/02/create-your-own-java-url-handlers.html