Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARQGRA-408 Introduced SPI for custom location schemes #102

Closed
wants to merge 1 commit into from
Closed

ARQGRA-408 Introduced SPI for custom location schemes #102

wants to merge 1 commit into from

Conversation

smiklosovic
Copy link
Member

@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:

@Location("http://www.google.com")

Full specification

@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://";
    }
}
  1. 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.

  1. I use it like
@Location(scheme = DroidiumScheme.class, value = "this.is.my.activity")
  1. 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

@buildhive
Copy link

@smiklosovic
Copy link
Member Author

I need to close this since I had to rework it due to this selendroid/selendroid#326

@smiklosovic smiklosovic deleted the ARQGRA-408 branch March 16, 2014 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants