01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.openejb.config;
17:
18: import javax.enterprise.deploy.spi.DeploymentManager;
19: import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
20: import javax.enterprise.deploy.spi.factories.DeploymentFactory;
21: import java.net.URI;
22: import java.net.URISyntaxException;
23:
24: /**
25: * @version $Rev: 602704 $ $Date: 2007-12-09 09:58:22 -0800 $
26: */
27: public class VmDeploymentFactory implements DeploymentFactory {
28: public static final String URI_SCHEME = "openejb";
29:
30: public String getDisplayName() {
31: return "OpenEJB - VM";
32: }
33:
34: public String getProductVersion() {
35: return "3.0";
36: }
37:
38: public boolean handlesURI(String uri) {
39: try {
40: URI fullUri = new URI(uri);
41: return URI_SCHEME.equals(fullUri.getScheme());
42: } catch (URISyntaxException e) {
43: return false;
44: }
45: }
46:
47: public DeploymentManager getDisconnectedDeploymentManager(String uri)
48: throws DeploymentManagerCreationException {
49: if (!handlesURI(uri)) {
50: throw new DeploymentManagerCreationException(
51: "Invalid URI: " + uri);
52: }
53:
54: VmDeploymentManager deploymentManager = new VmDeploymentManager();
55: deploymentManager.release();
56: return deploymentManager;
57: }
58:
59: public DeploymentManager getDeploymentManager(String uri,
60: String username, String password)
61: throws DeploymentManagerCreationException {
62: return new VmDeploymentManager();
63: }
64: }
|