Package org.mc4j.ems.connection

Examples of org.mc4j.ems.connection.EmsException


            ObjectName objName = new ObjectName(objectName);
            ObjectInstance instance = connectionProvider.getMBeanServer().createMBean(className, objName);
            return mapBean(connectionProvider, instance.getObjectName(), false);
        } catch (MBeanException e) {
            e.printStackTrace();
            throw new EmsException("Couldn't create MBean", e);
        } catch (OperationsException e) {
            throw new EmsException("Couldn't create MBean", e);
        } catch (ReflectionException e) {
            throw new EmsException("Couldn't create MBean", e);
        }
    }
View Full Code Here


            ObjectName objName = new ObjectName(objectName);
            ObjectInstance instance = connectionProvider.getMBeanServer().createMBean(className, objName, params, signature);
            return mapBean(connectionProvider, instance.getObjectName(), false);
        } catch (MBeanException e) {
            e.printStackTrace();
            throw new EmsException("Couldn't create MBean", e);
        } catch (OperationsException e) {
            throw new EmsException("Couldn't create MBean", e);
        } catch (ReflectionException e) {
            throw new EmsException("Couldn't create MBean", e);
        }
    }
View Full Code Here

            }

            InputStream is = ClassLoaderFactory.class.getClassLoader().getResourceAsStream(archiveResource);

            if (is == null) {
                throw new EmsException("Unable to find resource to store [" + archiveResource + "]");
            }

            // String tmpPath = System.getProperty("java.io.tmpdir");

            File tmpFile = copyFileToTemp(archiveResource, is, tempDir);

            jarCache.put(archiveResource, tmpFile);

            return tmpFile.toURI().toURL();

        } catch (FileNotFoundException e) {
            throw new EmsException("Unable to store jar [" + archiveResource + "] to temp dir [" + tempDir + "].", e);
        } catch (IOException e) {
            throw new EmsException("Unable to store jar [" + archiveResource + "] to temp dir [" + tempDir + "].", e);
        }
    }
View Full Code Here

        try {
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            XMLEncoder e = new XMLEncoder(new BufferedOutputStream(os));
            e.setExceptionListener(new ExceptionListener() {
                public void exceptionThrown(Exception e) {
                    throw new EmsException("Could not encode connection settings",e);
                }
            });
            e.setPersistenceDelegate(File.class,new PersistenceDelegate() {
                protected Expression instantiate(Object oldInstance, Encoder out) {
                    File f = (File) oldInstance;
View Full Code Here

            }

            InputStream is = ClassLoaderFactory.class.getClassLoader().getResourceAsStream(archiveResource);

            if (is == null) {
                throw new EmsException("Unable to find resource to store [" + archiveResource + "]");
            }

            // String tmpPath = System.getProperty("java.io.tmpdir");

            String jarName = new File(archiveResource).getName();
            jarName = jarName.substring(0, jarName.length() - 4);

            File tmpFile = File.createTempFile(jarName, ".jar");
            tmpFile.deleteOnExit();

            FileOutputStream fos = new FileOutputStream(tmpFile);
            byte[] buffer = new byte[4096];
            int size = is.read(buffer);
            while (size != -1) {
                fos.write(buffer, 0, size);
                size = is.read(buffer);
            }
            fos.close();
            is.close();

            jarCache.put(archiveResource, tmpFile);

            return tmpFile.toURI().toURL();

        } catch (FileNotFoundException e) {
            throw new EmsException("Unable to make temporary file store",e);
        } catch (IOException e) {
            throw new EmsException("Unable to make temporary file store",e);
        }
    }
View Full Code Here

            Class clazz = Class.forName("org.mc4j.ems.impl.jmx.connection.support.providers.LocalVMProvider",false,cl);
            Method m = clazz.getMethod("getManageableVirtualMachines",(Class[])null);
            Object o = m.invoke(null, new Object[0]);
            return (Map<Integer, LocalVirtualMachine>) o;
        } catch (Exception e) {
           throw new EmsException("Unable to run LocalVMFinder",e);
        }
    }
View Full Code Here

            Object managementHome = PortableRemoteObject.narrow(objref, managementHomeClass);
            Method m = managementHomeClass.getMethod("create",new Class[] {});
            Object managementEjb = m.invoke(managementHome);
            return managementEjb;
        } catch (NamingException ne) {
            throw new EmsException("",ne);
        }catch (Exception ce) {
            throw new EmsException("",ce);
        }
    }
View Full Code Here

        try {
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            XMLEncoder e = new XMLEncoder(new BufferedOutputStream(os));
            e.setExceptionListener(new ExceptionListener() {
                public void exceptionThrown(Exception e) {
                    throw new EmsException("Could not encode connection settings",e);
                }
            });
            e.setPersistenceDelegate(File.class,new PersistenceDelegate() {
                protected Expression instantiate(Object oldInstance, Encoder out) {
                    File f = (File) oldInstance;
View Full Code Here

            }

            InputStream is = ClassLoaderFactory.class.getClassLoader().getResourceAsStream(archiveResource);

            if (is == null) {
                throw new EmsException("Unable to find resource to store [" + archiveResource + "]");
            }

            // String tmpPath = System.getProperty("java.io.tmpdir");

            File tmpFile = copyFileToTemp(archiveResource, is, tempDir);

            jarCache.put(archiveResource, tmpFile);

            return tmpFile.toURI().toURL();

        } catch (FileNotFoundException e) {
            throw new EmsException("Unable to store jar [" + archiveResource + "] to temp dir [" + tempDir + "].", e);
        } catch (IOException e) {
            throw new EmsException("Unable to store jar [" + archiveResource + "] to temp dir [" + tempDir + "].", e);
        }
    }
View Full Code Here

        try {
            on = new ObjectName(objectName);

            connectionProvider.getMBeanServer().createMBean(className, on);
        } catch (Exception e) {
            throw new EmsException("Could not create MBean", e);
        }
        // TODO: Shouldn't we add the MBean to our map too?
    }
View Full Code Here

TOP

Related Classes of org.mc4j.ems.connection.EmsException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.