01: /*
02: * Copyright 2005-2007 Noelios Consulting.
03: *
04: * The contents of this file are subject to the terms of the Common Development
05: * and Distribution License (the "License"). You may not use this file except in
06: * compliance with the License.
07: *
08: * You can obtain a copy of the license at
09: * http://www.opensource.org/licenses/cddl1.txt See the License for the specific
10: * language governing permissions and limitations under the License.
11: *
12: * When distributing Covered Code, include this CDDL HEADER in each file and
13: * include the License file at http://www.opensource.org/licenses/cddl1.txt If
14: * applicable, add the following below this CDDL HEADER, with the fields
15: * enclosed by brackets "[]" replaced with your own identifying information:
16: * Portions Copyright [yyyy] [name of copyright owner]
17: */
18:
19: package org.restlet;
20:
21: import java.util.ArrayList;
22: import java.util.List;
23:
24: import org.restlet.data.Protocol;
25:
26: /**
27: * Restlet enabling communication between Components. "A connector is an
28: * abstract mechanism that mediates communication, coordination, or cooperation
29: * among components. Connectors enable communication between components by
30: * transferring data elements from one interface to another without changing the
31: * data." Roy T. Fielding</br> <br/> "Encapsulate the activities of accessing
32: * resources and transferring resource representations. The connectors present
33: * an abstract interface for component communication, enhancing simplicity by
34: * providing a clean separation of concerns and hiding the underlying
35: * implementation of resources and communication mechanisms" Roy T. Fielding
36: *
37: * @see <a
38: * href="http://roy.gbiv.com/pubs/dissertation/software_arch.htm#sec_1_2_2">Source
39: * dissertation</a>
40: * @see <a
41: * href="http://roy.gbiv.com/pubs/dissertation/rest_arch_style.htm#sec_5_2_2">Source
42: * dissertation</a>
43: * @author Jerome Louvel (contact@noelios.com)
44: */
45: public abstract class Connector extends Restlet {
46: /** The list of protocols simultaneously supported. */
47: private List<Protocol> protocols;
48:
49: /**
50: * Constructor.
51: *
52: * @param context
53: * The context.
54: */
55: public Connector(Context context) {
56: this (context, null);
57: }
58:
59: /**
60: * Constructor.
61: *
62: * @param context
63: * The context.
64: * @param protocols
65: * The supported protocols.
66: */
67: public Connector(Context context, List<Protocol> protocols) {
68: super (context);
69: this .protocols = protocols;
70: }
71:
72: /**
73: * Returns the protocols simultaneously supported.
74: *
75: * @return The protocols simultaneously supported.
76: */
77: public List<Protocol> getProtocols() {
78: if (this .protocols == null)
79: this .protocols = new ArrayList<Protocol>();
80: return this.protocols;
81: }
82:
83: }
|