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: *
17: * $Header:$
18: */
19:
20: package org.apache.beehive.controls.system.jndi;
21:
22: import java.lang.annotation.Retention;
23: import java.lang.annotation.RetentionPolicy;
24: import java.lang.annotation.Target;
25: import java.lang.annotation.ElementType;
26: import javax.naming.InitialContext;
27:
28: import org.apache.beehive.controls.api.ControlException;
29: import org.apache.beehive.controls.api.bean.ControlInterface;
30: import org.apache.beehive.controls.api.bean.AnnotationMemberTypes;
31: import org.apache.beehive.controls.api.packaging.FeatureInfo;
32: import org.apache.beehive.controls.api.properties.PropertySet;
33:
34: /**
35: * The Jndi Control encapsulates access to the JNDI context. It
36: * provides annotation for setting the factory and provider URL.
37: */
38: @ControlInterface(defaultBinding="org.apache.beehive.controls.system.jndi.impl.JndiControlImpl")
39: public interface JndiControl {
40: /**
41: * Get a JNDI based resource.
42: * @param resource the resource name.
43: * @param resourceClass the resource class.
44: * @return the resource object.
45: * @throws ControlException
46: */
47: public Object getResource(String resource, Class resourceClass)
48: throws ControlException;
49:
50: /**
51: * Get the JNDI initial context.
52: * @return the initial context.
53: *
54: * @throws ControlException
55: */
56: public InitialContext getInitialContext() throws ControlException;
57:
58: @PropertySet
59: @Retention(RetentionPolicy.RUNTIME)
60: @Target({ElementType.TYPE,ElementType.FIELD})
61: public @interface Properties {
62: /**
63: * The JNDI context factory class name.
64: */
65: @FeatureInfo(shortDescription="JNDI context factory")
66: @AnnotationMemberTypes.Optional
67: String factory();
68:
69: /**
70: * The JNDI provider URL.
71: */
72: @FeatureInfo(shortDescription="JNDI provider URL")
73: @AnnotationMemberTypes.Optional
74: @AnnotationMemberTypes.URI
75: String url();
76:
77: /**
78: * The JNDI security principal.
79: */
80: @FeatureInfo(shortDescription="JNDI security principal")
81: @AnnotationMemberTypes.Optional
82: public String jndiSecurityPrincipal() default "";
83:
84: /**
85: * The JNDI security credentials.
86: */
87: @FeatureInfo(shortDescription="JNDI security credentials")
88: @AnnotationMemberTypes.Optional
89: public String jndiSecurityCredentials() default "";
90: }
91: }
|