Examples of ConfigurationManager


Examples of org.jconfig.ConfigurationManager

    private void load(String resourceName,String configName) {       
      try {
            if ( configName == null ) {
                configName = "default";
            }
            ConfigurationManager myConfig = ConfigurationManager.getInstance();
            URL url = null;
            // If the string has a protocol on it, we'll assume it's an absolute
            // URL.  Otherwise, we'll assume it's a resource known to the
            // classloader.
            if (resourceName.indexOf("://") >= 0)
               {
               url = new URL(resourceName);
               } // end if
            else
               {
               ClassLoader cl = Thread.currentThread().getContextClassLoader();
               url = cl.getResource(resourceName);
               } // end else

            if (url != null) {
                File file = new File(url.getFile());
                XMLFileHandler handler = new XMLFileHandler(file.getAbsolutePath());
                myConfig.load(handler, configName);
            }
        }
        catch (Exception e) {
            e.printStackTrace();
        }
View Full Code Here

Examples of org.jconfig.ConfigurationManager

        // called when registration is done
        // here we have to get every Configuration object and add it to Va
       
        //log.debug("postRegister is called.");
       
        ConfigurationManager configMngr = ConfigurationManager.getInstance();
        String[] configNames = configMngr.getConfigurationNames();
        for (int i = 0; i < configNames.length; i++) {
            registerConfigurationMBean(configNames[i]);
        }
    }
View Full Code Here

Examples of org.jfx4ee.adm4ee.business.configuration.boundary.ConfigurationManager

    @Override
    public void init() throws Exception {
        super.init();

        // Read the preferences
        ConfigurationManager config = ConfigurationManager.getInstance();

        // Init logging
        LogManager.initLogging(config.getLogLevel());
        logger.log(Level.INFO, "--------------------------------------------");
        logger.log(Level.INFO, "Starting " + ApplicationInfo.APPLICATION_NAME);

        // Init Weld CDI
        weld = new Weld();
View Full Code Here

Examples of org.jmule.core.configmanager.ConfigurationManager

    FileHash fileHash = new FileHash(targetID.toByteArray());
    if (SharingManagerSingleton.getInstance().hasFile(fileHash)) {
      if (indexer == null) indexer = new Index(targetID);
      SharedFile file = SharingManagerSingleton.getInstance().getSharedFile(fileHash);
      InternalJKadManager _jkad_manager = (InternalJKadManager) JKadManagerSingleton.getInstance();
      ConfigurationManager config_manager = ConfigurationManagerSingleton.getInstance();
      TagList tagList = new TagList();
      tagList.addTag(new IntTag(JKadConstants.TAG_SOURCEIP, Convert.byteToInt(_jkad_manager.getIPAddress().getAddress())));
      try {
        tagList.addTag(new ShortTag(JKadConstants.TAG_SOURCEPORT, Convert.intToShort(config_manager.getTCP())));
      } catch (ConfigurationManagerException e) {
        e.printStackTrace();
        _jkad_manager.disconnect();
      }
      try {
        tagList.addTag(new ShortTag(JKadConstants.TAG_SOURCEUPORT, Convert.intToShort(config_manager.getUDP())));
      } catch (ConfigurationManagerException e) {
        e.printStackTrace();
        _jkad_manager.disconnect();
      }
      tagList.addTag(new IntTag(JKadConstants.TAG_FILESIZE, Convert.longToInt(file.length())));
View Full Code Here

Examples of org.jmule.core.configmanager.ConfigurationManager

      public void run() {
        if (getStatus() != JKadStatus.CONNECTED) return;
        SharingManager sharing_manager = SharingManagerSingleton
            .getInstance();
        Publisher publisher = Publisher.getInstance();
        ConfigurationManager config_manager = ConfigurationManagerSingleton
            .getInstance();
        Iterable<SharedFile> shared_files = sharing_manager
            .getSharedFiles();
        long filesToPublish = 0;
        for (SharedFile file : shared_files) {
          if (publisher.getPublishKeywordCount() > JKadConstants.MAX_CONCURRENT_PUBLISH_FILES) {
            break;
          }
          if (publishedFiles.contains(file.getFileHash()))
            continue;
          if (filesToPublish > JKadConstants.ITERATION_MAX_PUBLISH_FILES)
            break;
          if (file instanceof PartialFile) {
            PartialFile p_file = (PartialFile) file;
            if (p_file.getAvailablePartCount()==0) continue;
          }
          publishedFiles.add(file.getFileHash());

          byte[] hash = file.getFileHash().getHash().clone();
          Convert.updateSearchID(hash);
          Int128 id = new Int128(hash);

          if (!publisher.isPublishingSource(id)) {
            filesToPublish++;
            List<Tag> tagList = new LinkedList<Tag>();
            tagList.add(new StringTag(TAG_FILENAME, file
                .getSharingName()));
            tagList.add(new IntTag(TAG_FILESIZE, (int) file
                .length()));
            tagList
                .add(new IntTag(TAG_SOURCEIP,
                    org.jmule.core.utils.Convert
                        .byteToInt(getIPAddress()
                            .getAddress())));
            try {
              tagList.add(new IntTag(TAG_SOURCEPORT,
                  config_manager.getTCP()));
            } catch (ConfigurationManagerException e) {
              e.printStackTrace();
            }

            publisher.publishSource(id, tagList);
View Full Code Here

Examples of org.jmule.core.configmanager.ConfigurationManager

            Logger.getSingleton().logMessage(
                "New buddy : " + buddy.getAddress() + " TCP : "
                    + buddy.getTCPPort() + " UDP : "
                    + buddy.getUDPPort());

            ConfigurationManager configManager = ConfigurationManagerSingleton
                .getInstance();
            KadPacket response;
            try {
              response = PacketFactory.getBuddyResPacket(
                  new ClientID(sender_id), getClientID(),
                  (short) configManager.getTCP());
              _network_manager.sendKadPacket(response,
                  sender_address, sender_port);
            } catch (ConfigurationManagerException e) {
              e.printStackTrace();
            }
View Full Code Here

Examples of org.jmule.core.configmanager.ConfigurationManager

         
         (new JMThread( new JMRunnable() {  
       
        public void JMRun() {  
        
          ConfigurationManager _config = _core.getConfigurationManager();
          GeneralSettings gs = null;
            try {
            _config.setSharedFolders(((SharedFoldersChooser)stage2).getChosenFolders().getFoldersList());  
         
            gs = (GeneralSettings)stage3;
          
            _config.setNickName( gs.getNickName() );
            
            _config.setTCP( gs.getTCP() );
          
            _config.setUDP( gs.getUDP() );
          
            _config.setUDPEnabled( gs.isUDPEnabled() );
          
            NetworkBandwidthSelection nbs = (NetworkBandwidthSelection)stage4;
          
            _config.setDownloadBandwidth( nbs.getDownloadBandwidth() );
          
            _config.setUploadBandwidth( nbs.getUploadBandwidth() );
           
            _config.save();
            }catch( Throwable cause ) {
              cause.printStackTrace();
            }
          CommonUIPreferences.getSingleton().setUIType( ((UIChooser)stage5).getChosenUI() );
        
View Full Code Here

Examples of org.jmule.core.configmanager.ConfigurationManager

    KadPacket packet = new KadPacket(KADEMLIA2_BOOTSTRAP_RES, 16 + 2 + 1
        + 2 + contactList.size() * (16 + 4 + 2 + 2 + 1));

    packet.insertData(JKadManagerSingleton.getInstance().getClientID()
        .toByteArray());
    ConfigurationManager configManager = ConfigurationManagerSingleton
        .getInstance();
    packet.insertData(Convert.intToShort(configManager.getTCP()));
    packet.insertData(JKadConstants.KAD_VERSION);
    packet.insertData(intToShort(contactList.size()));
    for (KadContact contact : contactList) {
      insertContact(packet, contact);
    }
View Full Code Here

Examples of org.jmule.core.configmanager.ConfigurationManager

        + tags.capacity());

    packet.insertData(JKadManagerSingleton.getInstance().getClientID()
        .toByteArray());

    ConfigurationManager configManager = ConfigurationManagerSingleton
        .getInstance();

    packet.insertData(intToShort(configManager.getTCP()));
    packet.insertData(KAD_VERSION);
    packet.insertData(intToByte(tagList.size()));
    tags.position(0);
    packet.insertData(tags);
    return packet;
View Full Code Here

Examples of org.jmule.core.configmanager.ConfigurationManager

    ByteBuffer tag_list = tagsToByteBuffer(tagList);
    KadPacket packet = new KadPacket(KADEMLIA2_HELLO_RES, 16 + 2 + 1 + 1
        + tag_list.capacity());
    packet.insertData(JKadManagerSingleton.getInstance().getClientID()
        .toByteArray());
    ConfigurationManager configManager = ConfigurationManagerSingleton
        .getInstance();
    packet.insertData(intToShort(configManager.getTCP()));
    packet.insertData(KAD_VERSION);
    packet.insertData(intToByte(tag_list.capacity()));
    packet.insertData(tag_list);
    return packet;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.