KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > providers > dq > DQEndpointBuilder


1 /*
2  * $Id: DQEndpointBuilder.java 3982 2006-11-22 14:28:01Z lajos $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.providers.dq;
12
13 import java.net.URI JavaDoc;
14 import java.util.Properties JavaDoc;
15
16 import org.mule.impl.endpoint.ResourceNameEndpointBuilder;
17 import org.mule.umo.endpoint.MalformedEndpointException;
18
19 /**
20  * <code>DQEndpointBuilder</code> constructs an endpoint used by AS400 data queues
21  */

22 public class DQEndpointBuilder extends ResourceNameEndpointBuilder
23 {
24
25     protected void setEndpoint(URI JavaDoc uri, Properties JavaDoc props) throws MalformedEndpointException
26     {
27         String JavaDoc lib = (String JavaDoc)props.get("lib");
28         if (uri.getPath().length() > 0)
29         {
30             lib = uri.getHost();
31             props.setProperty("lib", lib);
32             address = "/" + lib + uri.getPath();
33         }
34         else if (lib == null)
35         {
36             throw new MalformedEndpointException("Could not extract Lib name: " + uri);
37         }
38         else
39         {
40             if (!lib.startsWith("/"))
41             {
42                 lib = "/" + lib;
43             }
44             if (!lib.endsWith("/"))
45             {
46                 lib += "/";
47             }
48             address = lib + uri.getHost();
49         }
50
51         // Resource info
52
// int x = address.indexOf(":");
53
// if(x > -1) {
54
// String resourceInfo = address.substring(0, x);
55
// props.setProperty("resourceInfo", resourceInfo);
56
// address = address.substring(x+1);
57
// }
58
}
59 }
60
Popular Tags