Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//Sun Microsystems Inc.//DTD Application Server 9.0 Domain//EN" "*<install directory>/lib/dtds/sun-resources_1_3.dtd*">


    Copyright (c) 2004-2010 Oracle and/or its affiliates. All rights reserved.

    The contents of this file are subject to the terms of either the GNU
    General Public License Version 2 only ("GPL") or the Common Development
    and Distribution License("CDDL") (collectively, the "License").  You
    may not use this file except in compliance with the License.  You can
    obtain a copy of the License at
    or packager/legal/LICENSE.txt.  See the License for the specific
    language governing permissions and limitations under the License.

    When distributing the software, include this License Header Notice in each
    file and include the License file at packager/legal/LICENSE.txt.

    GPL Classpath Exception:
    Oracle designates this particular file as subject to the "Classpath"
    exception as provided by Oracle in the GPL Version 2 section of the License
    file that accompanied this code.

    If applicable, add the following below the License Header, with the fields
    enclosed by brackets [] replaced by your own identifying information:
    "Portions Copyright [year] [name of copyright owner]"

    If you wish your version of this file to be governed by only the CDDL or
    only the GPL Version 2, indicate your decision by adding "[Contributor]
    elects to include this software in this distribution under the [CDDL or GPL
    Version 2] license."  If you don't indicate a single choice of license, a
    recipient has the option to distribute your version of this file under
    either the CDDL, the GPL Version 2 or to extend the choice of license to
    its licensees as provided above.  However, if you add GPL Version 2 code
    and therefore, elected the GPL Version 2 license, then the option applies
    only if the new code is made subject to such option by the copyright



    Template file to create JavaBean custom resources.
    By specifying the "factory-class-name" for creating java-bean
    and the values for the bean-properties using "properties" of the
    custom-resource, applications can lookup java-bean via JNDI.

    To learn more on custom resources,refer : 

    For detailed explanation of attributes and elements of this resources xml
    pl. refer to sun-resources_1_3.dtd


    In the sample configuration below, 
    JavaBean org.glassfish.resource.custom.test.Customer
    has attributes (along with getters and setters)

    To initialize the JavaBean with values, set the property name and the value.
    Applications can do  :


    to get the bean instance that is populated with customerId, customerLocation, customerSince attributes

    Following command will create a resource using this template :


        <custom-resource res-type="org.glassfish.resource.custom.test.Customer" jndi-name="custom/my-java-bean" 
          <property name="customerId" value="cu-101" />
          <property name="customerLocation" value="San Francisco" />
          <property name="customerSince" value="1990" />



    <custom-resource res-type="<FULLY_QUALIFIED_CLASS_NAME_OF_JAVABEAN>" jndi-name="<RESOURCE_NAME>" 
      <property name="ATTRIBUTE_1" value="VALUE_1" />
      <property name="ATTRIBUTE_2" value="VALUE_2" />

New to GrepCode? Check out our FAQ X