Search in sources :

Example 6 with ResourceProperty

use of com.sun.enterprise.repository.ResourceProperty in project Payara by payara.

the class CustomResourceDeployer method toCustomJavaEEResource.

/**
 * Returns a new instance of j2ee custom resource from the given
 * config bean.
 * <p/>
 * This method gets called from the custom resource deployer
 * to convert custom-resource config bean into custom j2ee resource.
 *
 * @param rbean custom-resource config bean
 * @param resourceInfo the definition of the resources to create
 * @return new instance of j2ee custom resource
 */
public static JavaEEResource toCustomJavaEEResource(CustomResource rbean, ResourceInfo resourceInfo) {
    org.glassfish.resources.beans.CustomResource jr = new org.glassfish.resources.beans.CustomResource(resourceInfo);
    // jr.setDescription(rbean.getDescription()); // FIXME: getting error
    // sets the enable flag
    jr.setEnabled(Boolean.valueOf(rbean.getEnabled()));
    // sets the resource type
    jr.setResType(rbean.getResType());
    // sets the factory class name
    jr.setFactoryClass(rbean.getFactoryClass());
    // sets the properties
    List<Property> properties = rbean.getProperty();
    if (properties != null) {
        for (Property property : properties) {
            ResourceProperty rp = new ResourcePropertyImpl(property.getName(), property.getValue());
            jr.addProperty(rp);
        }
    }
    return jr;
}
Also used : ResourceProperty(com.sun.enterprise.repository.ResourceProperty) CustomResource(org.glassfish.resources.config.CustomResource) ResourceProperty(com.sun.enterprise.repository.ResourceProperty) Property(org.jvnet.hk2.config.types.Property)

Example 7 with ResourceProperty

use of com.sun.enterprise.repository.ResourceProperty in project Payara by payara.

the class MailResourceDeployer method toMailBean.

/**
 * Returns a new instance of j2ee mail resource from the given config bean.
 * <p/>
 * This method gets called from the mail resource deployer to convert mail
 * config bean into mail j2ee resource.
 *
 * @param mailResourceConfig mail-resource config bean
 * @param resourceInfo
 * @return a new instance of j2ee mail resource
 */
public static MailBean toMailBean(MailResource mailResourceConfig, ResourceInfo resourceInfo) {
    MailBean mailResource = new MailBean(resourceInfo);
    // jr.setDescription(rbean.getDescription()); // FIXME: getting error
    mailResource.setEnabled(Boolean.valueOf(mailResourceConfig.getEnabled()));
    mailResource.setStoreProtocol(mailResourceConfig.getStoreProtocol());
    mailResource.setStoreProtocolClass(mailResourceConfig.getStoreProtocolClass());
    mailResource.setTransportProtocol(mailResourceConfig.getTransportProtocol());
    mailResource.setTransportProtocolClass(mailResourceConfig.getTransportProtocolClass());
    mailResource.setMailHost((String) TranslatedConfigView.getTranslatedValue(mailResourceConfig.getHost()));
    mailResource.setUsername((String) TranslatedConfigView.getTranslatedValue(mailResourceConfig.getUser()));
    mailResource.setPassword((String) TranslatedConfigView.getTranslatedValue(mailResourceConfig.getPassword()));
    mailResource.setAuth(Boolean.valueOf(mailResourceConfig.getAuth()));
    mailResource.setMailFrom((String) TranslatedConfigView.getTranslatedValue(mailResourceConfig.getFrom()));
    mailResource.setDebug(Boolean.valueOf(mailResourceConfig.getDebug()));
    // sets the properties
    List<Property> properties = mailResourceConfig.getProperty();
    if (properties != null) {
        for (Property property : properties) {
            ResourceProperty rp = new org.glassfish.resources.api.ResourcePropertyImpl(property.getName(), property.getValue());
            mailResource.addProperty(rp);
        }
    }
    return mailResource;
}
Also used : ResourceProperty(com.sun.enterprise.repository.ResourceProperty) MailBean(org.glassfish.resources.javamail.beans.MailBean) ResourceProperty(com.sun.enterprise.repository.ResourceProperty) Property(org.jvnet.hk2.config.types.Property)

Example 8 with ResourceProperty

use of com.sun.enterprise.repository.ResourceProperty in project Payara by payara.

the class ResourcePropertyImpl method equals.

public boolean equals(Object other) {
    boolean equal = false;
    if (other instanceof ResourceProperty) {
        ResourceProperty otherProp = (ResourceProperty) other;
        equal = this.name_.equals(otherProp.getName());
    }
    return equal;
}
Also used : ResourceProperty(com.sun.enterprise.repository.ResourceProperty)

Example 9 with ResourceProperty

use of com.sun.enterprise.repository.ResourceProperty in project Payara by payara.

the class JavaEEResourceBase method getProperties.

@Override
public Set getProperties() {
    Set shallowCopy = new HashSet();
    Collection collection = properties_.values();
    for (Iterator iter = collection.iterator(); iter.hasNext(); ) {
        ResourceProperty next = (ResourceProperty) iter.next();
        shallowCopy.add(next);
    }
    return shallowCopy;
}
Also used : ResourceProperty(com.sun.enterprise.repository.ResourceProperty)

Example 10 with ResourceProperty

use of com.sun.enterprise.repository.ResourceProperty in project Payara by payara.

the class ExternalJndiResourceDeployer method toExternalJndiJavaEEResource.

/**
 * Returns a new instance of j2ee external jndi resource from the given
 * config bean.
 * <p/>
 * This method gets called from the external resource
 * deployer to convert external-jndi-resource config bean into
 * external-jndi  j2ee resource.
 *
 * @param rbean external-jndi-resource config bean
 * @param resourceInfo
 * @return a new instance of j2ee external jndi resource
 */
public static org.glassfish.resources.api.JavaEEResource toExternalJndiJavaEEResource(ExternalJndiResource rbean, ResourceInfo resourceInfo) {
    org.glassfish.resources.beans.ExternalJndiResource jr = new org.glassfish.resources.beans.ExternalJndiResource(resourceInfo);
    // jr.setDescription( rbean.getDescription() ); // FIXME: getting error
    // sets the enable flag
    jr.setEnabled(Boolean.valueOf(rbean.getEnabled()));
    // sets the jndi look up name
    jr.setJndiLookupName(rbean.getJndiLookupName());
    // sets the resource type
    jr.setResType(rbean.getResType());
    // sets the factory class name
    jr.setFactoryClass(rbean.getFactoryClass());
    // sets the properties
    List<Property> properties = rbean.getProperty();
    if (properties != null) {
        for (Property property : properties) {
            ResourceProperty rp = new ResourcePropertyImpl(property.getName(), property.getValue());
            jr.addProperty(rp);
        }
    }
    return jr;
}
Also used : ResourceProperty(com.sun.enterprise.repository.ResourceProperty) ExternalJndiResource(org.glassfish.resources.config.ExternalJndiResource) ResourceProperty(com.sun.enterprise.repository.ResourceProperty) Property(org.jvnet.hk2.config.types.Property)

Aggregations

ResourceProperty (com.sun.enterprise.repository.ResourceProperty)10 Iterator (java.util.Iterator)3 Property (org.jvnet.hk2.config.types.Property)3 NamingException (javax.naming.NamingException)2 Reference (javax.naming.Reference)2 StringRefAddr (javax.naming.StringRefAddr)2 ResourceConflictException (org.glassfish.resourcebase.resources.api.ResourceConflictException)2 Hashtable (java.util.Hashtable)1 Set (java.util.Set)1 Context (javax.naming.Context)1 InitialContextFactory (javax.naming.spi.InitialContextFactory)1 CustomResource (org.glassfish.resources.config.CustomResource)1 ExternalJndiResource (org.glassfish.resources.config.ExternalJndiResource)1 MailBean (org.glassfish.resources.javamail.beans.MailBean)1 ProxyRefAddr (org.glassfish.resources.naming.ProxyRefAddr)1 SerializableObjectRefAddr (org.glassfish.resources.naming.SerializableObjectRefAddr)1