Package com.sun.enterprise.admin.common

Examples of com.sun.enterprise.admin.common.JMXFileTransfer


    {

        AdminService aService = AdminService.getAdminService();
        if ( aService != null && aService.isDas() ) {
            try {
                jmxFileTrans = new JMXFileTransfer (InstanceRegistry.
                            getInstanceConnection(instanceName));

                // since initializing with a connection already
                isConnectNeeded = false;
                jmxFileTrans.setTargetServer(instanceName);
            } catch (InstanceException ie) {
                throw new SynchronizationException(
                   _strMgr.getString("synchronization.api.conn_reg_get_failed",
                            instanceName),ie);
            } catch (IOException ioe) {
                throw new SynchronizationException(
                    _strMgr.getString("synchronization.api.jmx_ctor_failed",
                            instanceName),ioe);
            }
        } else { // A server connecting to DAS or another server.           
            String url =null;

            String user = IdentityManager.getUser();
            if (user == null ) {
                String msg =_localStrMgr.getString("ClientUserNotFound",
                    instanceName);
                throw new RuntimeException(msg);
            }
                   
            String password = IdentityManager.getPassword();
            if (password == null) {
                String msg =_localStrMgr.getString("PassWordNotFound",
                    instanceName);
                throw new RuntimeException(msg);
            }                       
           
            // connecting to DAS. Using DAS property reader
            if ( SystemPropertyConstants.DEFAULT_SERVER_INSTANCE_NAME.compareTo(
                    instanceName) == 0 ) {
               DASPropertyReader dpr = new DASPropertyReader(
                            new InstanceConfig());

                try {
                    dpr.read();
                } catch (IOException ioe) {
                    String msg = _localStrMgr.getString("DASPropReadNotFound");
                    throw new SynchronizationException(msg);
                }
                url = dpr.getJMXURL();               
            }
            else {
                try {
                    ConfigContext cfgCtx = ApplicationServer.getServerContext().
                                                getConfigContext();
                    assert(cfgCtx != null);
                    JMXConnectorConfig jmxConfig = ServerHelper.
                        getJMXConnectorInfo(cfgCtx, instanceName);
                    if ( jmxConfig == null ) {
                        String msg = _localStrMgr.getString("JMXInfoNotFound",
                            instanceName);
                        throw new RuntimeException(msg);
                    }                                      


        /* Need a better way of handling connector configuration */
                    final JMXServiceURL theUrl =
                    JmxServiceUrlFactory.forRmiWithJndiInAppserver(
                        jmxConfig.getHost(),
                        Integer.parseInt(jmxConfig.getPort()));
                    url = theUrl.toString();
                } catch (ConfigException ce) {
                    throw new SynchronizationException(
                    _strMgr.getString(
                        "synchronization.api.jmx_config_ctor_failed",
                      instanceName),ce);
                }
            }
            try {
                JMXServiceURL jmxurl = new JMXServiceURL(url);
                jmxFileTrans=new JMXFileTransfer(jmxurl, user, password, false);
                isConnectNeeded = true;
                assert(jmxFileTrans != null);
                jmxFileTrans.setTargetServer(instanceName);
            } catch (IOException ie) {
               throw new SynchronizationException(
View Full Code Here


     */
    private String uploadFileToServer(MBeanServerConnection mbsc)
                        throws CommandException, IOException
    {
        String ruleLocation = getOption(RULE_LOCATION_OPTION);
        return new JMXFileTransfer(mbsc).uploadFile(ruleLocation);
    }
View Full Code Here

  throws CommandException
    {
  try
  {

      final String fileName = new JMXFileTransfer(mbsc).downloadClientStubs(
               appName,
               downloadDir);
      CLILogger.getInstance().printDebugMessage("Downloaded client stubs to: " + fileName);
        return fileName;
  }
View Full Code Here

                                       String sDownloadPath, String sFileName)
        throws CommandException
    {
        try
        {
            final String fileName = new JMXFileTransfer(mbsc).downloadFile(sFileDownload,
                                                                           sDownloadPath,
                                                                           sFileName);
            CLILogger.getInstance().printDebugMessage("downloaded from  : " + sFileDownload + " to : " + sDownloadPath);
        }
        catch (Exception e)
View Full Code Here

  // Create the tmpFile
  String tmpFilePath = null;
  InputStream tmpFile = null;
  try {
      tmpFilePath = new JMXFileTransfer(JMXUtil.getMBeanServer())
    .downloadClientStubs(
      appName,
      System.getProperty("java.io.tmpdir"))// NOI18N
      tmpFile = new FileInputStream(tmpFilePath);
  } catch (Exception ex) {
View Full Code Here

   
    private void synchronizeClass(final String c, final ConfigContext rcc) throws Exception {
        final MBeanServerConnection mbsc    = InstanceRegistry.getDASConnection(rcc);
        final String remLoc                 = getAbsoluteDASMBeanClassLocation(mbsc, c);
        final String locLoc                 = getAbsoluteLocalClassFolder(c);
        final JMXFileTransfer ftp           = new JMXFileTransfer(mbsc);
       
        final File destPath = new File(locLoc);
        if (!destPath.exists()) {
            final boolean touched = destPath.mkdirs();
            String msg;
           if(touched)
               msg = CMBStrings.get("cmb.ee.mkdirGood", destPath);
           else
               msg = CMBStrings.get("cmb.ee.mkdirBad", destPath);
           
            logger.info(msg);
        }
        ftp.downloadFile(remLoc, locLoc);
        logger.info(CMBStrings.get("cmb.ee.downloadClass", locLoc));
        //now synchronize possible standard mbean interface
        final String sbiRemLoc = remLoc.substring(0, remLoc.lastIndexOf(".class")) + "MBean.class";
        try {
            ftp.downloadFile(sbiRemLoc, locLoc);
            logger.info(CMBStrings.get("cmb.ee.downloadInterfaceGood", sbiRemLoc));
        } catch(final Exception e) {
            logger.info(CMBStrings.get("cmb.ee.downloadInterfaceBad"));
        }
    }
View Full Code Here

        try {
            JMXConnector jmxC = getJMXConnector(
                    new JMXServiceURL(dasReader.getJMXURL()));
            MBeanServerConnection mbsc = jmxC.getMBeanServerConnection();
            // upload zip file using JMXFileTransfer
            JMXFileTransfer jmxFileTfr = new JMXFileTransfer(mbsc);
            jmxFileTfr.uploadFile(zipFileName, UPLOAD_DIRECTORY);
        } catch (java.net.MalformedURLException mfue) {
            _logger.log(Level.WARNING,
                    "nodeAgentDiagnostic.incorrect_jmx_service_url", mfue);
        } catch (java.io.IOException ioe) {
            _logger.log(Level.WARNING,
View Full Code Here

        } catch (CommandException e) {
            String msg = getLocalizedString("InvalidDcrDTDCheck");
            throw new CommandException(msg + " " + e.getMessage());
        }

        return new JMXFileTransfer(mbsc).uploadFile(dcrFileLocation, "config");
    }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.admin.common.JMXFileTransfer

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.