Repository: aries-jax-rs-whiteboard Updated Branches: refs/heads/master 29a02c704 -> 1cb665bd0
Add osgi spec classes Project: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/repo Commit: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/commit/1cb665bd Tree: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/tree/1cb665bd Diff: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/diff/1cb665bd Branch: refs/heads/master Commit: 1cb665bd0e3d2b689f71e984450401ea8820911f Parents: 29a02c7 Author: Carlos Sierra <[email protected]> Authored: Thu Dec 1 15:40:23 2016 +0100 Committer: Carlos Sierra <[email protected]> Committed: Thu Dec 1 15:40:23 2016 +0100 ---------------------------------------------------------------------- org.osgi.service.jaxrs.whiteboard/bnd.bnd | 7 ++ org.osgi.service.jaxrs.whiteboard/pom.xml | 46 ++++++++ .../jaxrs/runtime/JaxRSServiceRuntime.java | 56 +++++++++ .../runtime/JaxRSServiceRuntimeConstants.java | 52 +++++++++ .../service/jaxrs/runtime/dto/DTOConstants.java | 55 +++++++++ .../jaxrs/runtime/dto/FailedFilterDTO.java | 40 +++++++ .../jaxrs/runtime/dto/FailedInterceptorDTO.java | 40 +++++++ .../jaxrs/runtime/dto/FailedResourceDTO.java | 39 +++++++ .../service/jaxrs/runtime/dto/FilterDTO.java | 51 ++++++++ .../jaxrs/runtime/dto/InterceptorDTO.java | 52 +++++++++ .../jaxrs/runtime/dto/RequestInfoDTO.java | 55 +++++++++ .../service/jaxrs/runtime/dto/ResourceDTO.java | 51 ++++++++ .../runtime/dto/ResourceMethodInfoDTO.java | 33 ++++++ .../service/jaxrs/runtime/dto/RuntimeDTO.java | 92 +++++++++++++++ .../service/jaxrs/runtime/dto/package-info.java | 42 +++++++ .../service/jaxrs/runtime/package-info.java | 42 +++++++ .../whiteboard/JaxRSWhiteboardConstants.java | 115 +++++++++++++++++++ .../service/jaxrs/whiteboard/package-info.java | 42 +++++++ pom.xml | 1 + 19 files changed, 911 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/bnd.bnd ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/bnd.bnd b/org.osgi.service.jaxrs.whiteboard/bnd.bnd new file mode 100644 index 0000000..384fb41 --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/bnd.bnd @@ -0,0 +1,7 @@ +# Since the packages don't start with the project name, we need to tell javadoc the packages +org.osgi.service.jaxrs.whiteboard.specs = org.osgi.service.jaxrs.* + +Export-Package: \ + org.osgi.service.jaxrs.* + +-contract: JavaJAXRS \ No newline at end of file http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/pom.xml ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/pom.xml b/org.osgi.service.jaxrs.whiteboard/pom.xml new file mode 100644 index 0000000..5092571 --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/pom.xml @@ -0,0 +1,46 @@ +<?xml version='1.0' encoding='UTF-8' ?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<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>org.apache.aries.jax.rs</groupId> + <artifactId>org.apache.aries.jax.rs</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + <artifactId>org.apache.aries.jax.rs.api</artifactId> + <description>Apache Aries JAX-RS API</description> + <name>Apache Aries JAX-RS API</name> + + <dependencies> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.core</artifactId> + <version>6.0.0</version> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.annotation</artifactId> + <version>6.0.0</version> + </dependency> + </dependencies> +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/JaxRSServiceRuntime.java ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/JaxRSServiceRuntime.java b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/JaxRSServiceRuntime.java new file mode 100644 index 0000000..a93a57d --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/JaxRSServiceRuntime.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2015). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.service.jaxrs.runtime; + +import org.osgi.annotation.versioning.ProviderType; +import org.osgi.service.jaxrs.runtime.dto.RequestInfoDTO; +import org.osgi.service.jaxrs.runtime.dto.RuntimeDTO; + +/** + * The HttpServiceRuntime service represents the runtime information of an Http + * Whiteboard implementation. + * + * <p> + * It provides access to DTOs representing the current state of the service. + * <p> + * The HttpServiceRuntime service must be registered with the + * {@link JaxRSServiceRuntimeConstants#JAX_RS_SERVICE_ENDPOINT} service + * property. + * + * @ThreadSafe + * @author $Id: 358252f603be05c7ac7bf0600eee24ff090fa7a9 $ + */ +@ProviderType +public interface JaxRSServiceRuntime { + + /** + * Return the runtime DTO representing the current state. + * + * @return The runtime DTO. + */ + public RuntimeDTO getRuntimeDTO(); + + /** + * Return a request info DTO containing the services involved with + * processing a request for the specified path. + * + * @param path The request path, relative to the root of the JAX-RS + * Whiteboard implementation. + * @return The request info DTO for the specified path. + */ + public RequestInfoDTO calculateRequestInfoDTO(String path); +} http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/JaxRSServiceRuntimeConstants.java ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/JaxRSServiceRuntimeConstants.java b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/JaxRSServiceRuntimeConstants.java new file mode 100644 index 0000000..d3e2a1f --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/JaxRSServiceRuntimeConstants.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2015). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.service.jaxrs.runtime; + +/** + * Defines standard names for Http Runtime Service constants. + * + * @author $Id: f1505ce89e8f90e78700c36abbe591df11991a1f $ + */ +public final class JaxRSServiceRuntimeConstants { + private JaxRSServiceRuntimeConstants() { + // non-instantiable + } + + /** + * JAX-RS Runtime Service service property specifying the endpoints upon + * which the JAX-RS implementation is available. + * + * <p> + * An endpoint value is a URL or a relative path, to which the JAX-RS + * Whiteboard implementation is listening. For example, + * {@code http://192.168.1.10:8080/} or {@code /myapp/}. A relative path may + * be used if the scheme and authority parts of the URL are not known, e.g. + * if a bridged Http Whiteboard implementation is used. If the JAX-RS + * Whiteboard implementation is serving the root context and neither scheme + * nor authority is known, the value of the property is "/". Both, a URL and + * a relative path, must end with a slash. + * <p> + * A JAX-RS Whiteboard implementation can be listening on multiple + * endpoints. + * + * <p> + * The value of this service property must be of type {@code String}, + * {@code String[]}, or {@code Collection<String>}. + */ + public static final String JAX_RS_SERVICE_ENDPOINT = "osgi.jaxrs.endpoint"; + +} http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/DTOConstants.java ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/DTOConstants.java b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/DTOConstants.java new file mode 100644 index 0000000..c8ca9d9 --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/DTOConstants.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2015). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.service.jaxrs.runtime.dto; + +/** + * Defines standard constants for the DTOs. + * + * The error codes are defined to take the same values as used by the Http + * Service Whiteboard + */ +public final class DTOConstants { + private DTOConstants() { + // non-instantiable + } + + /** + * Failure reason is unknown. + */ + public static final int FAILURE_REASON_UNKNOWN = 0; + + /** + * Service is shadowed by another service. + * <p> + * For example, a service with the same service properties but a higher + * service ranking. + */ + public static final int FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE = 3; + + /** + * The service is registered in the service registry but getting the service + * fails as it returns {@code null}. + */ + public static final int FAILURE_REASON_SERVICE_NOT_GETTABLE = 5; + + /** + * The service is registered in the service registry but the service + * properties are invalid. + */ + public static final int FAILURE_REASON_VALIDATION_FAILED = 6; + +} http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/FailedFilterDTO.java ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/FailedFilterDTO.java b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/FailedFilterDTO.java new file mode 100644 index 0000000..fc57e65 --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/FailedFilterDTO.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.service.jaxrs.runtime.dto; + +/** + * Represents a JAX-RS Filter service which is currently not being used due to a + * problem. + * <p> + * As the service represented by this DTO is not used due to a failure, the + * field {@link FilterDTO#filteredByName} always returns {null}. + * + * @NotThreadSafe + * @author $Id: 9f4ff6dfd5199d5b2289230a45b3f70940ac36d3 $ + */ +public class FailedFilterDTO extends FilterDTO { + + /** + * The reason why the servlet filter represented by this DTO is not used. + * + * @see DTOConstants#FAILURE_REASON_UNKNOWN + * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE + * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE + */ + public int failureReason; + +} http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/FailedInterceptorDTO.java ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/FailedInterceptorDTO.java b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/FailedInterceptorDTO.java new file mode 100644 index 0000000..21ee39b --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/FailedInterceptorDTO.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.service.jaxrs.runtime.dto; + +/** + * Represents a JAX-RS Interceptor service that is currently not being used by a + * servlet context due to a problem. + * <p> + * As the service represented by this DTO is not used due to a failure, the + * field {@link InterceptorDTO#interceptedByName} always returns {null}. + * + * @NotThreadSafe + * @author $Id: a1a4b7a90435d18de2ad441e3767aff9159928ac $ + */ +public class FailedInterceptorDTO extends InterceptorDTO { + + /** + * The reason why the servlet represented by this DTO is not used. + * + * @see DTOConstants#FAILURE_REASON_UNKNOWN + * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE + * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE + */ + public int failureReason; + +} http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/FailedResourceDTO.java ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/FailedResourceDTO.java b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/FailedResourceDTO.java new file mode 100644 index 0000000..d8aa74d --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/FailedResourceDTO.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.service.jaxrs.runtime.dto; + +/** + * Represents a JAX-RS service which is currently not being used due to a + * problem. + * <p> + * As the service represented by this DTO is not used due to a failure, the + * field {@link ResourceDTO#resourceMethods} always returns null. + * + * @NotThreadSafe + * @author $Id: 592fcbc590483a05dd9afe72c061b07dbe87a9bd $ + */ +public class FailedResourceDTO extends ResourceDTO { + + /** + * The reason why the servlet represented by this DTO is not used. + * + * @see DTOConstants#FAILURE_REASON_UNKNOWN + * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE + * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE + */ + public int failureReason; +} http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/FilterDTO.java ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/FilterDTO.java b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/FilterDTO.java new file mode 100644 index 0000000..67e81a1 --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/FilterDTO.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.service.jaxrs.runtime.dto; + +import org.osgi.dto.DTO; +import org.osgi.service.jaxrs.runtime.JaxRSServiceRuntime; +import org.osgi.service.jaxrs.whiteboard.JaxRSWhiteboardConstants; + +/** + * Represents a JAX-RS Filter service currently being hosted by the + * {@link JaxRSServiceRuntime} + * + * @NotThreadSafe + * @author $Id: b77350dc50279a655618cb40497fee9bc33ebd20 $ + */ +public class FilterDTO extends DTO { + + /** + * The request mappings for the filter, as declared in + * {@link JaxRSWhiteboardConstants#JAX_RS_FILTER_BASE} + * + * <p> + * The specified patterns are used to determine whether a request is mapped + * to the JAX-RS filter. This array might be empty. + */ + public String[] baseUris; + + /** + * The resourceDTOs that are mapped to this Filter using a named annotation + */ + public ResourceDTO[] filteredByName; + + /** + * Service property identifying the JAX-RS filter service. + */ + public long serviceId; +} http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/InterceptorDTO.java ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/InterceptorDTO.java b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/InterceptorDTO.java new file mode 100644 index 0000000..5d09244 --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/InterceptorDTO.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.service.jaxrs.runtime.dto; + +import org.osgi.dto.DTO; +import org.osgi.service.jaxrs.runtime.JaxRSServiceRuntime; +import org.osgi.service.jaxrs.whiteboard.JaxRSWhiteboardConstants; + +/** + * Represents a JAX-RS Interceptor service currently being hosted by the + * {@link JaxRSServiceRuntime} + * + * @NotThreadSafe + * @author $Id: 1439e80cb16c3884d2d7df675dda5c28f875f11a $ + */ +public class InterceptorDTO extends DTO { + + /** + * The request mappings for the interceptor, as declared in + * {@link JaxRSWhiteboardConstants#JAX_RS_INTERCEPTOR_BASE} + * + * <p> + * The specified patterns are used to determine whether a request is mapped + * to the interceptor. This array might be empty. + */ + public String[] baseUris; + + /** + * The resourceDTOs that are mapped to this interceptor using a named + * annotation + */ + public ResourceDTO[] interceptedByName; + + /** + * Service property identifying the JAX-RS interceptor service. + */ + public long serviceId; +} http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/RequestInfoDTO.java ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/RequestInfoDTO.java b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/RequestInfoDTO.java new file mode 100644 index 0000000..7f07458 --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/RequestInfoDTO.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.service.jaxrs.runtime.dto; + +import org.osgi.dto.DTO; + +/** + * Represents the services used to process a specific request. + * + * @NotThreadSafe + * @author $Id: f4057465a154262be95874eda521be22f20626ff $ + */ +public class RequestInfoDTO extends DTO { + /** + * The path of the request relative to the root. + */ + public String path; + + /** + * The service id of the servlet context processing the request represented + * by this DTO. + */ + public long servletContextId; + + /** + * The JAX-RS filters processing this request. If no filters are called for + * processing this request, an empty array is returned. + */ + public FilterDTO[] filterDTOs; + + /** + * The JAX-RS interceptors processing this request. If no interceptors are + * called for processing this request, an empty array is returned. + */ + public InterceptorDTO[] interceptorDTOs; + + /** + * The resource processing this request. + */ + public ResourceDTO servletDTO; +} http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/ResourceDTO.java ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/ResourceDTO.java b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/ResourceDTO.java new file mode 100644 index 0000000..f4f096b --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/ResourceDTO.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.service.jaxrs.runtime.dto; + +import org.osgi.dto.DTO; +import org.osgi.service.jaxrs.whiteboard.JaxRSWhiteboardConstants; + +/** + * Represents common information about a JAX-RS resource service. + * + * @NotThreadSafe + * @author $Id: 4fa63e56e3b12dba342cb8172ad13cb219b3c5d0 $ + */ +public abstract class ResourceDTO extends DTO { + /** + * The name of the resource if it set one using + * {@link JaxRSWhiteboardConstants#JAX_RS_RESOURCE_NAME}, {@code null} + * otherwise. + */ + public String name; + + /** + * The base URI of the resource defined by + * {@link JaxRSWhiteboardConstants#JAX_RS_RESOURCE_BASE}. + */ + public String base; + + /** + * The RequestPaths handled by this resource + */ + public ResourceMethodInfoDTO[] resourceMethods; + + /** + * Service property identifying the JAX-RS resource service + */ + public long serviceId; +} http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/ResourceMethodInfoDTO.java ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/ResourceMethodInfoDTO.java b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/ResourceMethodInfoDTO.java new file mode 100644 index 0000000..63772b8 --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/ResourceMethodInfoDTO.java @@ -0,0 +1,33 @@ +package org.osgi.service.jaxrs.runtime.dto; + +import org.osgi.dto.DTO; + +/** + * Represents information about a JAX-RS resource method. + * + * @NotThreadSafe + * @author $Id: 55683e4bb50d121a46c8c94d315d9ab0a051195f $ + */ +public class ResourceMethodInfoDTO extends DTO { + + /** + * The HTTP verb being handled, for example GET, DELETE, PUT, POST, HEAD, + * OPTIONS + */ + String method; + + /** + * The mime-type(s) consumed by this resource method, null if not defined + */ + String[] consumingMimeType; + + /** + * The mime-type(s) produced by this resource method, null if not defined + */ + String[] producingMimeType; + + /** + * The URI of this sub-resource, null if this is not a sub-resource method + */ + String uri; +} http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/RuntimeDTO.java ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/RuntimeDTO.java b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/RuntimeDTO.java new file mode 100644 index 0000000..c941055 --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/RuntimeDTO.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2015). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.service.jaxrs.runtime.dto; + +import org.osgi.dto.DTO; +import org.osgi.framework.dto.ServiceReferenceDTO; +import org.osgi.resource.dto.ResourceDTO; +import org.osgi.service.jaxrs.runtime.JaxRSServiceRuntime; + +/** + * Represents the state of a Http Service Runtime. + * + * @NotThreadSafe + * @author $Id: 482544b936babd00c55476277dc5bcb569428e97 $ + */ +public class RuntimeDTO extends DTO { + + /** + * The DTO for the corresponding {@code JaxRSServiceRuntime}. This value is + * never {@code null}. + */ + public ServiceReferenceDTO serviceDTO; + + /** + * The root context path. This path may be "/", or it may be a sub path if + * this {@link JaxRSServiceRuntime} is running within an external Http + * container. + */ + public String contextPath; + + /** + * Returns the representations of the JAX-RS resource services associated + * with this Runtime. + * + * The returned array may be empty if this context is currently not + * associated with any JAX-RS Resource services. + */ + public ResourceDTO[] resourceDTOs; + + /** + * Returns the representations of the JAX-RS Filter services associated with + * this Runtime. + * + * The returned array may be empty if this context is currently not + * associated with any JAX-RS Filter services. + */ + public FilterDTO[] filterDTOs; + + /** + * Returns the representations of the JAX-RS Interceptor services associated + * with this Runtime. + * + * The returned array may be empty if this context is currently not + * associated with any JAX-RS Filter services. + */ + public InterceptorDTO[] interceptorDTOs; + + /** + * Returns the representations of the JAX-RS resource services associated + * with this runtime but currently not used due to some problem. The + * returned array may be empty. + */ + public FailedResourceDTO[] failedServletDTOs; + + /** + * Returns the representations of the JAX-RS Filter services associated with + * this runtime but currently not used due to some problem. The returned + * array may be empty. + */ + public FailedFilterDTO[] failedFilterDTOs; + + /** + * Returns the representations of the JAX-RS Interceptor services associated + * with this runtime but currently not used due to some problem. The + * returned array may be empty. + */ + public FailedInterceptorDTO[] failedErrorPageDTOs; +} http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/package-info.java ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/package-info.java b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/package-info.java new file mode 100644 index 0000000..94312e8 --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/dto/package-info.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) OSGi Alliance (2010, 2015). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Http Runtime DTO Package Version 1.0. + * + * <p> + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + * <p> + * Example import for consumers using the API in this package: + * <p> + * {@code Import-Package: org.osgi.service.http.runtime.dto; version="[1.0,2.0)"} + * <p> + * Example import for providers implementing the API in this package: + * <p> + * {@code Import-Package: org.osgi.service.http.runtime.dto; version="[1.0,1.1)"} + * + * @author $Id: eca6f4e9f419fbd23ffed23f9f3c399fe8b45fb7 $ + */ + +@Version("1.0") +package org.osgi.service.jaxrs.runtime.dto; + +import org.osgi.annotation.versioning.Version; + http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/package-info.java ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/package-info.java b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/package-info.java new file mode 100644 index 0000000..9c2f120 --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/runtime/package-info.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) OSGi Alliance (2010, 2015). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Http Runtime Package Version 1.0. + * + * <p> + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + * <p> + * Example import for consumers using the API in this package: + * <p> + * {@code Import-Package: org.osgi.service.http.runtime; version="[1.0,2.0)"} + * <p> + * Example import for providers implementing the API in this package: + * <p> + * {@code Import-Package: org.osgi.service.http.runtime; version="[1.0,1.1)"} + * + * @author $Id: 1663285382a67fde3f51780882716d9f064b8ed2 $ + */ + +@Version("1.0") +package org.osgi.service.jaxrs.runtime; + +import org.osgi.annotation.versioning.Version; + http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/whiteboard/JaxRSWhiteboardConstants.java ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/whiteboard/JaxRSWhiteboardConstants.java b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/whiteboard/JaxRSWhiteboardConstants.java new file mode 100644 index 0000000..07cbd6d --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/whiteboard/JaxRSWhiteboardConstants.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2015). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.osgi.service.jaxrs.whiteboard; + +import java.nio.file.DirectoryStream.Filter; +import org.osgi.service.jaxrs.runtime.JaxRSServiceRuntimeConstants; + +/** + * Defines standard constants for the JAX-RS Whiteboard services. + * + * @author $Id: e94aefad35bbbaf2b3918b0af9361742ad2c9a7b $ + */ +public final class JaxRSWhiteboardConstants { + private JaxRSWhiteboardConstants() { + // non-instantiable + } + + /** + * Service property specifying the name of a JAX-RS resource. + * + * <p> + * This name is provided as a property on the registered Endpoint service so + * that the URI for a particular JAX-RS service can be identified. If this + * service property is not specified, then no Endpoint information will be + * registered for this resource. + * + * <p> + * Resource names should be unique among all resource service associated + * with a single Whiteboard implementation. + * + * <p> + * The value of this service property must be of type {@code String}. + */ + public static final String JAX_RS_RESOURCE_NAME = "osgi.jaxrs.name"; + + /** + * Service property specifying the base URI mapping for a JAX-RS resource + * service. + * + * <p> + * The specified uri is used to determine whether a request should be mapped + * to the resource. Services without this service property are ignored. + * + * <p> + * The value of this service property must be of type {@code String}, and + * will have a "/" prepended if no "/" exists. + */ + public static final String JAX_RS_RESOURCE_BASE = "osgi.jaxrs.resource.base"; + + /** + * Service property specifying the request mappings for a JAX-RS filter + * service. + * + * <p> + * The specified patterns are used to determine whether a request should be + * mapped to the filter. Filter services without this service property are + * ignored. + * + * <p> + * The value of this service property must be of type {@code String}, + * {@code String[]}, or {@code Collection<String>}. + */ + public static final String JAX_RS_FILTER_BASE = "osgi.jaxrs.filter.base"; + + /** + * Service property specifying the request mappings for a JAX-RS interceptor + * service. + * + * <p> + * The specified patterns are used to determine whether a request should be + * mapped to the interceptor. Interceptor services without this service + * property are ignored. + * + * <p> + * The value of this service property must be of type {@code String}, + * {@code String[]}, or {@code Collection<String>}. + */ + public static final String JAX_RS_INTERCEPTOR_BASE = "osgi.jaxrs.interceptor.base"; + + /** + * Service property specifying the target filter to select the JAX-RS + * Whiteboard implementation to process the service. + * + * <p> + * A JAX-RS Whiteboard implementation can define any number of service + * properties which can be referenced by the target filter. The service + * properties should always include the + * {@link JaxRSServiceRuntimeConstants#JAX_RS_SERVICE_ENDPOINT + * osgi.http.endpoint} service property if the endpoint information is + * known. + * + * <p> + * If this service property is not specified, then all JAX-RS Whiteboard + * implementations can process the service. + * + * <p> + * The value of this service property must be of type {@code String} and be + * a valid {@link Filter filter string}. + */ + public static final String JAX_RS_WHITEBOARD_TARGET = "osgi.jaxrs.whiteboard.target"; +} http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/whiteboard/package-info.java ---------------------------------------------------------------------- diff --git a/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/whiteboard/package-info.java b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/whiteboard/package-info.java new file mode 100644 index 0000000..f4cf6e5 --- /dev/null +++ b/org.osgi.service.jaxrs.whiteboard/src/main/java/org/osgi/service/jaxrs/whiteboard/package-info.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) OSGi Alliance (2010, 2015). All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Http Whiteboard Package Version 1.0. + * + * <p> + * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + * <p> + * Example import for consumers using the API in this package: + * <p> + * {@code Import-Package: org.osgi.service.http.whiteboard; version="[1.0,2.0)"} + * <p> + * Example import for providers implementing the API in this package: + * <p> + * {@code Import-Package: org.osgi.service.http.whiteboard; version="[1.0,1.1)"} + * + * @author $Id: 161afdd2706c206890d3361d6dc4030ac4a449e9 $ + */ + +@Version("1.0") +package org.osgi.service.jaxrs.whiteboard; + +import org.osgi.annotation.versioning.Version; + http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/1cb665bd/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index bf34c51..4fd8d60 100644 --- a/pom.xml +++ b/pom.xml @@ -72,6 +72,7 @@ <module>jax-rs.itests-run</module> <module>jax-rs.example</module> <module>jax-rs.example-run</module> + <module>org.osgi.service.jaxrs.whiteboard</module> </modules> <dependencies> <dependency>
