KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > ejb > protocol > ProtocolContainer


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Scott Ferguson
28  */

29
30 package com.caucho.ejb.protocol;
31
32 import com.caucho.config.ConfigException;
33 import com.caucho.ejb.AbstractServer;
34 import com.caucho.ejb.EjbServerManager;
35 import com.caucho.util.L10N;
36 import com.caucho.vfs.Path;
37
38 /**
39  * Server containing all the EJBs for a given configuration.
40  *
41  * <p>Each protocol will extend the container to override Handle creation.
42  */

43 public class ProtocolContainer {
44   private static final L10N L = new L10N(ProtocolContainer.class);
45
46   protected EjbProtocolManager _manager;
47   protected String JavaDoc _urlPrefix;
48   private Path _workPath;
49
50   public void setServerManager(EjbServerManager manager)
51   {
52     _manager = manager.getProtocolManager();
53   }
54
55   public EjbProtocolManager getProtocolManager()
56   {
57     return _manager;
58   }
59
60   public void setProtocolManager(EjbProtocolManager manager)
61   {
62     _manager = manager;
63   }
64
65   public String JavaDoc getName()
66   {
67     return "jvm";
68   }
69
70   public void setURLPrefix(String JavaDoc urlPrefix)
71   {
72     if (urlPrefix.endsWith("/"))
73       urlPrefix = urlPrefix.substring(urlPrefix.length() - 1);
74
75     _urlPrefix = urlPrefix;
76   }
77
78   public String JavaDoc getURLPrefix()
79   {
80     return _urlPrefix;
81   }
82
83   public void setWorkPath(Path workPath)
84   {
85     _workPath = workPath;
86   }
87
88   public Path getWorkPath()
89   {
90     return _workPath;
91   }
92
93   /**
94    * Adds a server to the protocol.
95    */

96   public void addServer(AbstractServer server)
97   {
98   }
99
100   /**
101    * Removes a server from the protocol.
102    */

103   public void removeServer(AbstractServer server)
104   {
105   }
106
107   protected HandleEncoder createHandleEncoder(AbstractServer server,
108                                               Class JavaDoc primaryKeyClass)
109     throws ConfigException
110   {
111     if (_urlPrefix != null)
112       return new HandleEncoder(server, _urlPrefix + server.getProtocolId());
113     else
114       return new HandleEncoder(server, server.getProtocolId());
115   }
116
117   /**
118    * Returns the skeleton
119    */

120   public Skeleton getSkeleton(String JavaDoc uri, String JavaDoc queryString)
121     throws Exception JavaDoc
122   {
123     throw new UnsupportedOperationException JavaDoc();
124   }
125
126   /**
127    * Returns the error
128    */

129   public Skeleton getExceptionSkeleton()
130     throws Exception JavaDoc
131   {
132     throw new UnsupportedOperationException JavaDoc();
133   }
134 }
135
Popular Tags