Exemple #1
0
  public void init() throws Exception {
    super.init();

    int old_frag_size = frag_size;
    if (frag_size <= 0)
      throw new Exception(
          "frag_size="
              + old_frag_size
              + ", new frag_size="
              + frag_size
              + ": new frag_size is invalid");

    TP transport = getTransport();
    if (transport != null && transport.isEnableBundling()) {
      int max_bundle_size = transport.getMaxBundleSize();
      if (frag_size >= max_bundle_size)
        throw new IllegalArgumentException(
            "frag_size ("
                + frag_size
                + ") has to be < TP.max_bundle_size ("
                + max_bundle_size
                + ")");
    }

    Map<String, Object> info = new HashMap<String, Object>(1);
    info.put("frag_size", frag_size);
    up_prot.up(new Event(Event.CONFIG, info));
    down_prot.down(new Event(Event.CONFIG, info));
  }
  @BeforeMethod
  protected void setUp() throws Exception {
    a = Util.createRandomAddress("A");
    b = Util.createRandomAddress("B");
    c = Util.createRandomAddress("C");
    v1 = View.create(a, 1, a, b);
    v2 = View.create(a, 2, a, b, c);

    nak = new NAKACK2();
    d1 = new Digest(v1.getMembersRaw(), new long[] {11, 11, 30, 35});
    d2 = new Digest(v2.getMembersRaw(), new long[] {10, 10, 30, 30, 50, 50});

    TP transport =
        new TP() {
          public boolean supportsMulticasting() {
            return false;
          }

          public void sendMulticast(byte[] data, int offset, int length) throws Exception {}

          public void sendUnicast(PhysicalAddress dest, byte[] data, int offset, int length)
              throws Exception {}

          public String getInfo() {
            return null;
          }

          public Object down(Event evt) {
            return null;
          }

          protected PhysicalAddress getPhysicalAddress() {
            return null;
          }

          public TimeScheduler getTimer() {
            return new DefaultTimeScheduler(1);
          }
        };
    transport.setId(TP_ID);
    nak.setDownProtocol(transport);
    nak.start();
  }
Exemple #3
0
    public void init() throws Exception {
        super.init();

        if(!isSingleton() && bind_port <= 0) {
            Protocol dynamic_discovery_prot=stack.findProtocol("MPING");
            if(dynamic_discovery_prot == null)
                dynamic_discovery_prot=stack.findProtocol("TCPGOSSIP");

            if(dynamic_discovery_prot != null) {
                if(log.isDebugEnabled())
                    log.debug("dynamic discovery is present (" + dynamic_discovery_prot + "), so start_port=" + bind_port + " is okay");
            }
            else {
                throw new IllegalArgumentException("start_port cannot be set to " + bind_port +
                        ", as no dynamic discovery protocol (e.g. MPING or TCPGOSSIP) has been detected.");
            }
        }
        
    }
Exemple #4
0
 /** ConnectionMap.Receiver interface */
 public void receive(Address sender, byte[] data, int offset, int length) {
     super.receive(sender, data, offset, length);
 }
 @Override
 protected ServletRequestDataBinder createBinder(HttpServletRequest request, Object command)
     throws Exception {
   ServletRequestDataBinder servletRequestDataBinder = super.createBinder(request, command);
   AnagraficaObjectDTO commandDTO = (AnagraficaObjectDTO) command;
   for (String shortName : commandDTO.getAnagraficaProperties().keySet()) {
     TP tipologiaProprieta =
         applicationService.findPropertiesDefinitionByShortName(
             clazzTipologiaProprieta, shortName);
     PropertyEditor propertyEditor =
         tipologiaProprieta.getRendering().getPropertyEditor(applicationService);
     if (propertyEditor instanceof FilePropertyEditor) {
       ((FilePropertyEditor) propertyEditor)
           .setExternalAuthority(String.valueOf(commandDTO.getParentId()));
       ((FilePropertyEditor) propertyEditor)
           .setInternalAuthority(String.valueOf(tipologiaProprieta.getId()));
     }
     if (tipologiaProprieta.getRendering() instanceof WidgetCombo) {
       WidgetCombo<P, TP> combo = (WidgetCombo<P, TP>) tipologiaProprieta.getRendering();
       for (int i = 0; i < 100; i++) {
         for (TP subtp : combo.getSottoTipologie()) {
           PropertyEditor subPropertyEditor =
               subtp.getRendering().getPropertyEditor(applicationService);
           if (subPropertyEditor instanceof FilePropertyEditor) {
             ((FilePropertyEditor) subPropertyEditor)
                 .setExternalAuthority(String.valueOf(commandDTO.getParentId()));
             ((FilePropertyEditor) subPropertyEditor)
                 .setInternalAuthority(String.valueOf(subtp.getId()));
           }
           String path =
               "anagraficaProperties["
                   + shortName
                   + "]["
                   + i
                   + "].object.anagraficaProperties["
                   + subtp.getShortName()
                   + "]";
           servletRequestDataBinder.registerCustomEditor(
               ValoreDTO.class, path, new ValoreDTOPropertyEditor(subPropertyEditor));
           servletRequestDataBinder.registerCustomEditor(
               Object.class, path + ".object", subPropertyEditor);
           logger.debug(
               "Registrato Wrapper del property editor: "
                   + propertyEditor
                   + " per il path (combo): "
                   + path);
           logger.debug(
               "Registrato property editor: "
                   + propertyEditor
                   + " per il path (combo): "
                   + path
                   + ".object");
         }
       }
     } else {
       String path = "anagraficaProperties[" + shortName + "]";
       servletRequestDataBinder.registerCustomEditor(
           ValoreDTO.class, path, new ValoreDTOPropertyEditor(propertyEditor));
       // per le checkbox
       servletRequestDataBinder.registerCustomEditor(
           Object.class, path + ".object", propertyEditor);
       logger.debug(
           "Registrato Wrapper del property editor: " + propertyEditor + " per il path: " + path);
       logger.debug(
           "Registrato property editor: " + propertyEditor + " per il path: " + path + ".object");
     }
   }
   return servletRequestDataBinder;
 }