Skip to content

Commit

Permalink
Merge pull request #6 from sling-incubator/rename-to-okapi
Browse files Browse the repository at this point in the history
Rename sling to okapi within repository
  • Loading branch information
nielserik committed Jan 14, 2016
2 parents 2582aeb + 0ae910b commit 7923c10
Show file tree
Hide file tree
Showing 38 changed files with 127 additions and 127 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# sling
Sling core and modules
# okapi
Okapi core and modules

Java 8 and Apache Maven 3 are required for compilation.
The test suite must be able to bind to ports 9130 thru 9134 to succeed.
Expand Down
6 changes: 3 additions & 3 deletions auth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.indexdata.sling</groupId>
<artifactId>sling</artifactId>
<groupId>com.indexdata.okapi</groupId>
<artifactId>okapi</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>auth</artifactId>
Expand Down Expand Up @@ -41,7 +41,7 @@
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>io.vertx.core.Starter</Main-Class>
<Main-Verticle>com.indexdata.sling.auth.MainVerticle</Main-Verticle>
<Main-Verticle>com.indexdata.okapi.auth.MainVerticle</Main-Verticle>
</manifestEntries>
</transformer>
</transformers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.auth;
package com.indexdata.okapi.auth;

import io.vertx.core.json.DecodeException;
import io.vertx.core.json.Json;
Expand All @@ -18,12 +18,12 @@
* Provides a minimal authentication mechanism.
* @author heikki
*
* TODO: Check the X-Sling-Tenant header matches the tenant parameter, or use
* TODO: Check the X-Okapi-Tenant header matches the tenant parameter, or use
* that one instead of the parameter.
* TODO: Separate the headers so that
* - X-Sling-Tenant is the tenant
* - X-Sling-User is the user
* - X-Sling-token is the crypto token
* - X-Okapi-Tenant is the tenant
* - X-Okapi-User is the user
* - X-Okapi-token is the crypto token
* OKAPI needs to get hold of the tenant already before a login, so it should
* be separate.
Expand All @@ -35,7 +35,7 @@

public class Auth {

static final String SLINGTOKENHEADER = "X-Sling-Token";
static final String OKAPITOKENHEADER = "X-Okapi-Token";

/**
* Calculate a token from tenant and username.
Expand Down Expand Up @@ -100,18 +100,18 @@ public void login(RoutingContext ctx) {
}
System.out.println("Ok login for " + u + ": " + tok);
ctx.response()
.headers().add(SLINGTOKENHEADER,tok);
.headers().add(OKAPITOKENHEADER,tok);
ctx.response().setStatusCode(200);
ctx.response().end(json);
}

public void check (RoutingContext ctx) {
String tok = ctx.request().getHeader(SLINGTOKENHEADER);
String tok = ctx.request().getHeader(OKAPITOKENHEADER);
if ( tok == null || tok.isEmpty() ) {
System.out.println("Auth.check called without " + SLINGTOKENHEADER);
System.out.println("Auth.check called without " + OKAPITOKENHEADER);
ctx.response()
.setStatusCode(401) // Check symbolic name for "forbidden"
.end("Auth.check called without " + SLINGTOKENHEADER );
.end("Auth.check called without " + OKAPITOKENHEADER );
return;
}
//System.out.println("Auth.check called with " + tok);
Expand All @@ -133,7 +133,7 @@ public void check (RoutingContext ctx) {
Logger.getLogger(Auth.class.getName()).log(Level.SEVERE, null, ex);
}
ctx.response()
.headers().add(SLINGTOKENHEADER,tok);
.headers().add(OKAPITOKENHEADER,tok);
ctx.response().setStatusCode(202); // 202 = Accepted
echo(ctx);
// signal to the conduit that we want to continue the module chain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.auth;
package com.indexdata.okapi.auth;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.auth;
package com.indexdata.okapi.auth;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Future;
Expand Down
6 changes: 3 additions & 3 deletions auth/testdata/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ echo The following checks should fail:
echo
curl -D - http://localhost:9020/anything.at.all
echo
curl -D - -H X-Sling-Token:t1:peter:10 -w'\n' http://localhost:9020/anything.at.all
curl -D - -H X-Okapi-Token:t1:peter:10 -w'\n' http://localhost:9020/anything.at.all
echo
curl -D - -H X-Sling-Token:foo -w'\n' http://localhost:9020/anything.at.all
curl -D - -H X-Okapi-Token:foo -w'\n' http://localhost:9020/anything.at.all
echo

echo
echo The following check should succeed:
curl -D - -H X-Sling-Token:t1:peter:10058b75cb0b719d5a9efb39e97416bc -w'\n' http://localhost:9020/anything.at.all
curl -D - -H X-Okapi-Token:t1:peter:10058b75cb0b719d5a9efb39e97416bc -w'\n' http://localhost:9020/anything.at.all
echo
4 changes: 2 additions & 2 deletions auth/testdata/login.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
echo The following login should fail
curl -D - -H X-Sling-Token:t1:peter:10058b75cb0b719d5a9efb39e97416bc -w'\n' -X POST -d @login-bad.json http://localhost:9020/login
curl -D - -H X-Okapi-Token:t1:peter:10058b75cb0b719d5a9efb39e97416bc -w'\n' -X POST -d @login-bad.json http://localhost:9020/login
echo

echo The following login should succeed
curl -D - -H X-Sling-Token:t1:peter:10058b75cb0b719d5a9efb39e97416bc -w'\n' -X POST -d @login1.json http://localhost:9020/login
curl -D - -H X-Okapi-Token:t1:peter:10058b75cb0b719d5a9efb39e97416bc -w'\n' -X POST -d @login1.json http://localhost:9020/login
echo
6 changes: 3 additions & 3 deletions sling-core/Dockerfile → okapi-core/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
###
# vert.x docker example using a Java verticle packaged as a fatjar
# To build:
# docker build -t indexdata/sling-core .
# docker build -t indexdata/okapi-core .
# To run:
# docker run -t -i -p 8080:8080 indexdata/sling-core
# docker run -t -i -p 8080:8080 indexdata/okapi-core
###

FROM java:8

ENV VERTICLE_FILE sling-core-fat.jar
ENV VERTICLE_FILE okapi-core-fat.jar

# Set the location of the verticles
ENV VERTICLE_HOME /usr/verticles
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions sling-core/nbactions.xml → okapi-core/nbactions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:java</goal>
</goals>
<properties>
<exec.args>run com.indexdata.sling.MainVerticle</exec.args>
<exec.args>run com.indexdata.okapi.MainVerticle</exec.args>
<exec.mainClass>io.vertx.core.Starter</exec.mainClass>
</properties>
</action>
Expand All @@ -24,7 +24,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath io.vertx.core.Starter run com.indexdata.sling.MainVerticle</exec.args>
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath io.vertx.core.Starter run com.indexdata.okapi.MainVerticle</exec.args>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
Expand All @@ -39,7 +39,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
</goals>
<properties>
<exec.args>-classpath %classpath io.vertx.core.Starter run com.indexdata.sling.MainVerticle</exec.args>
<exec.args>-classpath %classpath io.vertx.core.Starter run com.indexdata.okapi.MainVerticle</exec.args>
<exec.executable>java</exec.executable>
</properties>
</action>
Expand Down
8 changes: 4 additions & 4 deletions sling-core/pom.xml → okapi-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.indexdata.sling</groupId>
<artifactId>sling</artifactId>
<groupId>com.indexdata.okapi</groupId>
<artifactId>okapi</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>sling-core</artifactId>
<artifactId>okapi-core</artifactId>

<dependencies>
<dependency>
Expand Down Expand Up @@ -54,7 +54,7 @@
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>io.vertx.core.Starter</Main-Class>
<Main-Verticle>com.indexdata.sling.MainVerticle</Main-Verticle>
<Main-Verticle>com.indexdata.okapi.MainVerticle</Main-Verticle>
</manifestEntries>
</transformer>
</transformers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling;
package com.indexdata.okapi;

import com.indexdata.sling.conduit.service.ModuleService;
import com.indexdata.sling.conduit.service.TenantService;
import com.indexdata.okapi.conduit.service.ModuleService;
import com.indexdata.okapi.conduit.service.TenantService;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Context;
import io.vertx.core.Future;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.conduit;
package com.indexdata.okapi.conduit;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.conduit;
package com.indexdata.okapi.conduit;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.conduit;
package com.indexdata.okapi.conduit;

public class ModuleInstance {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.conduit;
package com.indexdata.okapi.conduit;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.conduit;
package com.indexdata.okapi.conduit;

import io.vertx.core.http.HttpServerRequest;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.conduit;
package com.indexdata.okapi.conduit;

public class Ports {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.conduit;
package com.indexdata.okapi.conduit;

public class ProcessDeploymentDescriptor {
private String cmdlineStart;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.conduit;
package com.indexdata.okapi.conduit;

import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.conduit;
package com.indexdata.okapi.conduit;

public class RoutingEntry {
private String[] methods;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.conduit;
package com.indexdata.okapi.conduit;

import com.indexdata.sling.conduit.TenantDescriptor;
import com.indexdata.okapi.conduit.TenantDescriptor;
import java.util.HashMap;

public class Tenant {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.conduit;
package com.indexdata.okapi.conduit;

public class TenantDescriptor {
private String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.conduit;
package com.indexdata.okapi.conduit;

public class TenantModuleDescriptor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.conduit.service;
package com.indexdata.okapi.conduit.service;

import com.indexdata.sling.conduit.ModuleDescriptor;
import com.indexdata.sling.conduit.ModuleInstance;
import com.indexdata.sling.conduit.Modules;
import com.indexdata.sling.conduit.Ports;
import com.indexdata.sling.conduit.ProcessModuleHandle;
import com.indexdata.sling.conduit.Tenant;
import com.indexdata.okapi.conduit.ModuleDescriptor;
import com.indexdata.okapi.conduit.ModuleInstance;
import com.indexdata.okapi.conduit.Modules;
import com.indexdata.okapi.conduit.Ports;
import com.indexdata.okapi.conduit.ProcessModuleHandle;
import com.indexdata.okapi.conduit.Tenant;
import io.vertx.core.Vertx;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.HttpClient;
Expand Down Expand Up @@ -118,7 +118,7 @@ public void delete(RoutingContext ctx) {
*/
private void addTraceHeaders(RoutingContext ctx, List<String> traceHeaders) {
for ( String th : traceHeaders ) {
ctx.response().headers().add("X-Sling-Trace", th);
ctx.response().headers().add("X-Okapi-Trace", th);
}
}

Expand All @@ -132,7 +132,7 @@ private void makeTraceHeader(RoutingContext ctx, ModuleInstance mi, int statusCo


public void proxy(RoutingContext ctx) {
String tenant_id = ctx.request().getHeader("X-Sling-Tenant");
String tenant_id = ctx.request().getHeader("X-Okapi-Tenant");
if (tenant_id == null) {
ctx.response().setStatusCode(403).end("Missing Tenant");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.conduit.service;
package com.indexdata.okapi.conduit.service;

import com.indexdata.sling.conduit.Tenant;
import com.indexdata.sling.conduit.TenantDescriptor;
import com.indexdata.sling.conduit.TenantModuleDescriptor;
import com.indexdata.okapi.conduit.Tenant;
import com.indexdata.okapi.conduit.TenantDescriptor;
import com.indexdata.okapi.conduit.TenantModuleDescriptor;
import io.vertx.core.Vertx;
import io.vertx.core.json.DecodeException;
import io.vertx.core.json.Json;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All rights reserved.
* See the file LICENSE for details.
*/
package com.indexdata.sling.util;
package com.indexdata.okapi.util;

public class Box<T> {
private T item;
Expand Down
Loading

0 comments on commit 7923c10

Please sign in to comment.