Search in sources :

Example 26 with Method

use of org.glassfish.hk2.external.org.objectweb.asm.commons.Method in project Payara by payara.

the class ActiveJmsResourceAdapter method setMasterBroker.

public void setMasterBroker(String newMasterBroker) {
    try {
        Class c = resourceadapter_.getClass();
        Method m = c.getMethod("setMasterBroker", String.class);
        m.invoke(resourceadapter_, newMasterBroker);
        if (_logger.isLoggable(Level.INFO)) {
            _logger.log(Level.INFO, JMSLoggerInfo.MASTER_BROKER_SUCCESS, new Object[] { newMasterBroker });
        }
    } catch (Exception ex) {
        // throw new RuntimeException ("Error invoking PortMapperClientHandler.handleRequest. Cause - " + ex.getMessage(), ex);
        if (_logger.isLoggable(Level.INFO)) {
            _logger.log(Level.INFO, JMSLoggerInfo.MASTER_BROKER_FAILURE, new Object[] { newMasterBroker, ex.getMessage() });
        }
    }
}
Also used : Method(java.lang.reflect.Method) MultiException(org.glassfish.hk2.api.MultiException) PrivilegedActionException(java.security.PrivilegedActionException) ExecutionException(java.util.concurrent.ExecutionException) ResourceAdapterInternalException(javax.resource.spi.ResourceAdapterInternalException) URISyntaxException(java.net.URISyntaxException) ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)

Example 27 with Method

use of org.glassfish.hk2.external.org.objectweb.asm.commons.Method in project Payara by payara.

the class ActiveJmsResourceAdapter method postRAConfiguration.

/*
     * Gets all the other [apart from serverlist] DataSource properties from
     * the HADB JDBC connection pool.
     *
    private Properties getDSPropertiesFromThePool(JdbcConnectionPool jdbcConPool) {
        Properties p = new Properties();
        List elemProp = jdbcConPool.getProperty();
        Set<String> excludeList = new HashSet<String>();
        excludeList.add(DUSERNAME);
        excludeList.add(DPASSWORD);
        excludeList.add(DSERVERLIST);

        for(Property e: elemProp) {
            String propName = e.getAttributeValue("name");
            if (!excludeList.contains(propName)) {
                p.setProperty(propName, e.getAttributeValue("value"));
            }
        }
        logFine("Additional DataSource properties from pool "
                        + jdbcConPool.getName() + " are " + p);
        return p;
    }*/
/**
 * Method to perform any post RA configuration action by derivative subclasses.
 * For example, this method is used by <code>ActiveJMSResourceAdapter</code>
 * to set unsupported javabean property types on its RA JavaBean runtime
 * instance.
 * @throws ConnectorRuntimeException
 */
protected void postRAConfiguration() throws ConnectorRuntimeException {
    // Set all non-supported javabean property types in the JavaBean
    try {
        if (dbProps == null)
            dbProps = new Properties();
        dbProps.setProperty("imq.cluster.dynamicChangeMasterBrokerEnabled", "true");
        Method mthds = this.resourceadapter_.getClass().getMethod("setBrokerProps", Properties.class);
        if (_logger.isLoggable(Level.FINE))
            logFine("Setting property:" + DB_HADB_PROPS + "=" + dbProps.toString());
        mthds.invoke(this.resourceadapter_, new Object[] { dbProps });
    } catch (Exception e) {
        ConnectorRuntimeException crex = new ConnectorRuntimeException(e.getMessage());
        throw (ConnectorRuntimeException) crex.initCause(e);
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) Method(java.lang.reflect.Method) Properties(java.util.Properties) MultiException(org.glassfish.hk2.api.MultiException) PrivilegedActionException(java.security.PrivilegedActionException) ExecutionException(java.util.concurrent.ExecutionException) ResourceAdapterInternalException(javax.resource.spi.ResourceAdapterInternalException) URISyntaxException(java.net.URISyntaxException) ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)

Example 28 with Method

use of org.glassfish.hk2.external.org.objectweb.asm.commons.Method in project Payara by payara.

the class PluginHandlers method getPluginService.

/**
 *	<p> Find and return the <code>ConsolePluginService</code>.  This method
 *	    uses the HK2 <code>Habitat</code> to locate the
 *	    <code>ConsolePluginService</code>.</p>
 *
 *	@param	ctx The <code>FacesContext</code>.
 *
 *	@returns The <code>ConsolePluginService</code>.
 */
public static ConsolePluginService getPluginService(FacesContext ctx) {
    // We need to get the ServletContext to find the Habitat
    ServletContext servletCtx = (ServletContext) (ctx.getExternalContext()).getContext();
    // Get the Habitat from the ServletContext
    ServiceLocator habitat = (ServiceLocator) servletCtx.getAttribute(org.glassfish.admingui.common.plugin.ConsoleClassLoader.HABITAT_ATTRIBUTE);
    return habitat.getService(ConsolePluginService.class);
}
Also used : ServiceLocator(org.glassfish.hk2.api.ServiceLocator) ServletContext(javax.servlet.ServletContext)

Example 29 with Method

use of org.glassfish.hk2.external.org.objectweb.asm.commons.Method in project Payara by payara.

the class EjbOptionalIntfGenerator method generateInterfaceMethod.

private static void generateInterfaceMethod(ClassVisitor cv, java.lang.reflect.Method m) throws Exception {
    String methodName = m.getName();
    Type returnType = Type.getReturnType(m);
    Type[] argTypes = Type.getArgumentTypes(m);
    Method asmMethod = new Method(methodName, returnType, argTypes);
    GeneratorAdapter cg = new GeneratorAdapter(ACC_PUBLIC + ACC_ABSTRACT, asmMethod, null, getExceptionTypes(m), cv);
    cg.endMethod();
}
Also used : GeneratorAdapter(org.glassfish.hk2.external.org.objectweb.asm.commons.GeneratorAdapter) Method(org.glassfish.hk2.external.org.objectweb.asm.commons.Method)

Example 30 with Method

use of org.glassfish.hk2.external.org.objectweb.asm.commons.Method in project Payara by payara.

the class EjbOptionalIntfGenerator method generateSetDelegateMethod.

private static void generateSetDelegateMethod(ClassVisitor cv, Class delegateClass, String subClassName) throws Exception {
    Class optProxyClass = OptionalLocalInterfaceProvider.class;
    java.lang.reflect.Method proxyMethod = optProxyClass.getMethod("setOptionalLocalIntfProxy", java.lang.reflect.Proxy.class);
    String methodName = proxyMethod.getName();
    Type returnType = Type.getReturnType(proxyMethod);
    Type[] argTypes = Type.getArgumentTypes(proxyMethod);
    Type[] eTypes = getExceptionTypes(proxyMethod);
    Method asmMethod = new Method(methodName, returnType, argTypes);
    GeneratorAdapter mg2 = new GeneratorAdapter(ACC_PUBLIC, asmMethod, null, eTypes, cv);
    mg2.visitVarInsn(ALOAD, 0);
    mg2.visitVarInsn(ALOAD, 1);
    mg2.visitTypeInsn(CHECKCAST, delegateClass.getName().replace('.', '/'));
    String delIntClassDesc = Type.getType(delegateClass).getDescriptor();
    mg2.visitFieldInsn(PUTFIELD, subClassName.replace('.', '/'), DELEGATE_FIELD_NAME, delIntClassDesc);
    mg2.returnValue();
    mg2.endMethod();
}
Also used : GeneratorAdapter(org.glassfish.hk2.external.org.objectweb.asm.commons.GeneratorAdapter) Method(org.glassfish.hk2.external.org.objectweb.asm.commons.Method) OptionalLocalInterfaceProvider(com.sun.ejb.spi.container.OptionalLocalInterfaceProvider)

Aggregations

MultiException (org.glassfish.hk2.api.MultiException)18 Method (java.lang.reflect.Method)16 ServiceLocator (org.glassfish.hk2.api.ServiceLocator)12 GeneratorAdapter (org.glassfish.hk2.external.org.objectweb.asm.commons.GeneratorAdapter)8 Method (org.glassfish.hk2.external.org.objectweb.asm.commons.Method)8 PrivilegedActionException (java.security.PrivilegedActionException)7 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)6 URISyntaxException (java.net.URISyntaxException)6 ExecutionException (java.util.concurrent.ExecutionException)6 ResourceAdapterInternalException (javax.resource.spi.ResourceAdapterInternalException)6 ConfigBeanProxy (org.jvnet.hk2.config.ConfigBeanProxy)6 File (java.io.File)5 HashMap (java.util.HashMap)5 ConfigModel (org.jvnet.hk2.config.ConfigModel)5 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 Attribute (org.jvnet.hk2.config.Attribute)4 PropertyVetoException (java.beans.PropertyVetoException)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 HashSet (java.util.HashSet)3