public static void setStaticValue(Resource resource, Object value) { setStaticValue(resource, null, value); }
public Object getObjectInstance(Object object, Name name, Context context, Hashtable environment) throws Exception { // ignore non resource-refs if (!(object instanceof ResourceRef)) { return null; } Reference ref = (Reference) object; Object value; if (getProperty(ref, JNDI_NAME) != null) { // lookup the value in JNDI value = super.getObjectInstance(object, name, context, environment); } else { // value is hard hard coded in the properties value = getStaticValue(ref); } return value; }
if (getProperty(ref, JNDI_NAME) != null) { String serviceClassName = getProperty(ref, WS_CLASS); Class<? extends Service> serviceClass = Service.class; if (serviceClassName != null) { serviceClass = loadClass(serviceClassName).asSubclass(Service.class); if (serviceClass == null) { throw new NamingException("Could not load service type class "+ serviceClassName); Class<?> referenceClass = loadClass(ref.getClassName()); String serviceId = getProperty(ref, WS_ID); if (getProperty(ref, WS_QNAME) != null) { serviceQName = QName.valueOf(getProperty(ref, WS_QNAME)); if (getProperty(ref, WSDL_URL) != null) { wsdlUrl = new URL(getProperty(ref, WSDL_URL)); if (getProperty(ref, WS_PORT_QNAME) != null) { portQName = QName.valueOf(getProperty(ref, WS_PORT_QNAME)); List<PortRefData> portRefs = getStaticValue(ref, "port-refs"); if (portRefs == null) portRefs = Collections.emptyList(); List<HandlerChainData> handlerChains = getStaticValue(ref, "handler-chains"); if (handlerChains == null) handlerChains = Collections.emptyList(); List<Injection> injections = getStaticValue(ref, "injections"); if (injections == null) injections = Collections.emptyList();
public Object getObjectInstance(Object object, Name name, Context context, Hashtable environment) throws Exception { Reference ref = (Reference) object; // load the component type class String className = getProperty(ref, COMPONENT_TYPE); Class<?> clazz = loadClass(className); if (clazz == null) return null; // lookup the value Object value = SystemInstance.get().getComponent(clazz); return value; } }
protected String buildJndiName(Reference reference) throws NamingException { // get and verify interface type String resourceId = getProperty(reference, RESOURCE_ID); if (resourceId == null) { resourceId = getProperty(reference, NAME); } if (resourceId == null) throw new NamingException("Resource reference id is null"); // build jndi name using the deploymentId and interface type String jndiName = "java:openejb/Resource/" + resourceId; return jndiName; }
@SuppressWarnings({"unchecked"}) public static<T> T getStaticValue(Reference ref) { return (T) getStaticValue(ref, null); }
public Object getObjectInstance(Object object, Name name, Context context, Hashtable environment) throws Exception { // ignore non ejb-refs if (!(object instanceof EjbRef)) { return null; } // lookup the value Object value = super.getObjectInstance(object, name, context, environment); // if this is an external reference, copy it into the local class loader if (isPropertyTrue((Reference) object, EXTERNAL)) { value = copy(value); } // done return value; }
@SuppressWarnings({"unchecked"}) public static <T> T getStaticValue(Reference ref, String name) { name = name != null ? "-" + name : ""; String token = getProperty(ref, "static-token" + name); if (token == null) { return null; } T object = (T) registry.get(token); return object; }
private void setResource(ContextResource resource, Object object) { setStaticValue(new Resource(resource), object); }
public Object getObjectInstance(Object object, Name name, Context context, Hashtable environment) throws Exception { // ignore non resource-refs if (!(object instanceof ResourceRef)) { return null; } Reference ref = (Reference) object; Object value; if (getProperty(ref, JNDI_NAME) != null) { // lookup the value in JNDI value = super.getObjectInstance(object, name, context, environment); } else { // value is hard hard coded in the properties value = getStaticValue(ref); } return value; }
protected String buildJndiName(Reference reference) throws NamingException { String jndiName;// get and verify deploymentId String deploymentId = getProperty(reference, DEPLOYMENT_ID); if (deploymentId == null) throw new NamingException("ejb-ref deploymentId is null"); // get and verify interface type InterfaceType type = InterfaceType.BUSINESS_REMOTE; String interfaceType = getProperty(reference, REMOTE); if (interfaceType == null) { type = InterfaceType.BUSINESS_LOCAL; interfaceType = getProperty(reference, LOCAL); } if (interfaceType == null) throw new NamingException("ejb-ref interface type is null"); // build jndi name using the deploymentId and interface type jndiName = "java:openejb/Deployment/" + JndiBuilder.format(deploymentId, interfaceType, type); return jndiName; }
private void setResource(ContextResource resource, String name, Object object) { setStaticValue(new Resource(resource), name, object); }
public Object getObjectInstance(Object object, Name name, Context context, Hashtable environment) throws Exception { Reference ref = (Reference) object; // the jndi context to use for the lookup (usually null which is the default context) String jndiProviderId = getProperty(ref, JNDI_PROVIDER_ID); // the jndi name String jndiName = getProperty(ref, JNDI_NAME); if (jndiName == null) { jndiName = buildJndiName(ref); } // look up the reference Object value = lookup(jndiProviderId, jndiName); return value; }
public Object getObjectInstance(Object object, Name name, Context context, Hashtable environment) throws Exception { Reference reference = ((Reference) object); if (reference.getClassName().equals("java.net.URL")) { String resourceId = getProperty(reference, RESOURCE_ID); return new URL(resourceId); } return super.getObjectInstance(object, name, context, environment); }