This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.distribution.api-0.1.0 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-api.git
commit 0dbbaaeef185d2523e9cbe835d449cbe0c2f11f5 Author: Tommaso Teofili <[email protected]> AuthorDate: Fri Dec 5 09:19:24 2014 +0000 SLING-4153 - fixed transport API to just expose the secret git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/distribution/api@1643201 13f79535-47bb-0310-9956-ffa450edef68 --- .../transport/DistributionTransportSecret.java | 56 ++++++++++++++++++++++ .../DistributionTransportSecretProvider.java | 44 +++++++++++++++++ .../sling/distribution/transport/package-info.java | 24 ++++++++++ 3 files changed, 124 insertions(+) diff --git a/src/main/java/org/apache/sling/distribution/transport/DistributionTransportSecret.java b/src/main/java/org/apache/sling/distribution/transport/DistributionTransportSecret.java new file mode 100644 index 0000000..1beceb3 --- /dev/null +++ b/src/main/java/org/apache/sling/distribution/transport/DistributionTransportSecret.java @@ -0,0 +1,56 @@ +/* + * 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. + */ +package org.apache.sling.distribution.transport; + +import javax.annotation.CheckForNull; +import java.io.InputStream; +import java.util.Map; + +import aQute.bnd.annotation.ConsumerType; + +/** + * The secret to be transported for authenticating transport layer connecting two instances. + * <p/> + * Secrets can take different forms, like e.g. username and password, tokens, public keys, etc. and are meant to be used + * by transport implementations lying under {@link org.apache.sling.distribution.packaging.DistributionPackageImporter importers} + * and / or {@link org.apache.sling.distribution.packaging.DistributionPackageExporter exporters}. + */ +@ConsumerType +public interface DistributionTransportSecret { + + /** + * Get the secret as a {@link java.util.Map} of credentials, this can contain, for example, entries holding information + * about username and password for HTTP authentication. + * + * @return the credentials as a {@link java.util.Map}, or {@code null} if {@code secret} cannot be represented in terms + * of a set of key -> value entries + */ + @CheckForNull + Map<String, String> asCredentialsMap(); + + /** + * Get the secrete as a raw {@link java.io.InputStream binary}. + * Note that each call to this method will create a new stream, so the caller will be responsible of closing it. + * + * @return the secret as an {@link java.io.InputStream}, or {@code null} if such a secret cannot represented as a stream. + */ + @CheckForNull + InputStream asStream(); + +} diff --git a/src/main/java/org/apache/sling/distribution/transport/DistributionTransportSecretProvider.java b/src/main/java/org/apache/sling/distribution/transport/DistributionTransportSecretProvider.java new file mode 100644 index 0000000..c709ad1 --- /dev/null +++ b/src/main/java/org/apache/sling/distribution/transport/DistributionTransportSecretProvider.java @@ -0,0 +1,44 @@ +/* + * 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. + */ +package org.apache.sling.distribution.transport; + +import javax.annotation.CheckForNull; + +import aQute.bnd.annotation.ConsumerType; + +/** + * A provider for {@link org.apache.sling.distribution.transport.DistributionTransportSecret}s + * <p/> + * Such providers can be used by {@link org.apache.sling.distribution.packaging.DistributionPackageExporter exporters} or + * {@link org.apache.sling.distribution.packaging.DistributionPackageImporter importers} implementations in order to plug + * in different types of {@link org.apache.sling.distribution.transport.DistributionTransportSecret secrets} to be used + * to authenticate the underlying Sling instances. + */ +@ConsumerType +public interface DistributionTransportSecretProvider { + + /** + * Get a {@link org.apache.sling.distribution.transport.DistributionTransportSecret} + * + * @return a {@link org.apache.sling.distribution.transport.DistributionTransportSecret secret}, or {@code null} if + * that cannot be obtained + */ + @CheckForNull + DistributionTransportSecret getSecret(); +} diff --git a/src/main/java/org/apache/sling/distribution/transport/package-info.java b/src/main/java/org/apache/sling/distribution/transport/package-info.java new file mode 100644 index 0000000..8005f31 --- /dev/null +++ b/src/main/java/org/apache/sling/distribution/transport/package-info.java @@ -0,0 +1,24 @@ +/* + * 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. + */ + +@Version("0.1.0") +package org.apache.sling.distribution.transport; + +import aQute.bnd.annotation.Version; + -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
