arquillian/arquillian-graphene — pull request #102 by smiklosovic (2014-03-15 22:21:04+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) 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")
```

3) Note that in case of Droidium I need to register my custom URL handler (1) because I can not pass "and-activity" to URL in Java. However this is client code (Droidium code) and Droidium has to handle this on its own.

In case you agree with this, I will proceed to other part as you suggested in respective JIRA, that means there could be configuration option to set default scheme accross whole Graphene extension.

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