org.restlet.Connector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.apache.servicemix.bundles.restlet
Show all versions of org.apache.servicemix.bundles.restlet
This OSGi bundle wraps org.restlet, and com.noelios.restlet ${pkgVersion} jar files.
The newest version!
/**
* Copyright 2005-2008 Noelios Technologies.
*
* The contents of this file are subject to the terms of the following open
* source licenses: LGPL 3.0 or LGPL 2.1 or CDDL 1.0 (the "Licenses"). You can
* select the license that you prefer but you may not use this file except in
* compliance with one of these Licenses.
*
* You can obtain a copy of the LGPL 3.0 license at
* http://www.gnu.org/licenses/lgpl-3.0.html
*
* You can obtain a copy of the LGPL 2.1 license at
* http://www.gnu.org/licenses/lgpl-2.1.html
*
* You can obtain a copy of the CDDL 1.0 license at
* http://www.sun.com/cddl/cddl.html
*
* See the Licenses for the specific language governing permissions and
* limitations under the Licenses.
*
* Alternatively, you can obtain a royaltee free commercial license with less
* limitations, transferable or non-transferable, directly at
* http://www.noelios.com/products/restlet-engine
*
* Restlet is a registered trademark of Noelios Technologies.
*/
package org.restlet;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import org.restlet.data.Protocol;
/**
* Restlet enabling communication between Components. "A connector is an
* abstract mechanism that mediates communication, coordination, or cooperation
* among components. Connectors enable communication between components by
* transferring data elements from one interface to another without changing the
* data." Roy T. Fielding
*
* "Encapsulate the activities of accessing resources and transferring resource
* representations. The connectors present an abstract interface for component
* communication, enhancing simplicity by providing a clean separation of
* concerns and hiding the underlying implementation of resources and
* communication mechanisms" Roy T. Fielding
*
* Concurrency note: instances of this class or its subclasses can be invoked by
* several threads at the same time and therefore must be thread-safe. You
* should be especially careful when storing state in member variables.
*
* @see Source
* dissertation
* @see Source
* dissertation
* @author Jerome Louvel
*/
public abstract class Connector extends Restlet {
/** The list of protocols simultaneously supported. */
private final List protocols;
/**
* Constructor.
*
* @param context
* The context.
*/
public Connector(Context context) {
this(context, null);
}
/**
* Constructor.
*
* @param context
* The context.
* @param protocols
* The supported protocols.
*/
public Connector(Context context, List protocols) {
super(context);
if (protocols == null) {
this.protocols = new CopyOnWriteArrayList();
getLogger()
.fine(
"The connector has been instantiated without any protocol.");
} else {
this.protocols = new CopyOnWriteArrayList(protocols);
}
}
/**
* Returns the modifiable list of protocols simultaneously supported.
*
* @return The protocols simultaneously supported.
*/
public List getProtocols() {
return this.protocols;
}
/**
* Sets the protocols simultaneously supported. Method synchronized to make
* compound action (clear, addAll) atomic, not for visibility.
*
* @param protocols
* The protocols simultaneously supported.
*/
public synchronized void setProtocols(List protocols) {
this.protocols.clear();
if (protocols != null) {
this.protocols.addAll(protocols);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy