Exemplo n.º 1
0
 /**
  * Get Tab with ID
  *
  * @param AD_Tab_ID
  * @return tab or null
  */
 public UITab getTab(int AD_Tab_ID) {
   Integer tabKey = Integer.valueOf(AD_Tab_ID);
   UITab tab = m_tabs.get(tabKey);
   if (tab == null) {
     // Check added for referenced tabs
     if (m_referencetabs.get(tabKey) != null) return m_referencetabs.get(tabKey);
     throw new CompiereStateException("No such tab:" + AD_Tab_ID);
   } // find in window
   return tab;
 } // getTab
Exemplo n.º 2
0
  void isReadable(SelectionKey k) {
    EventableChannel ec = (EventableChannel) k.attachment();
    long b = ec.getBinding();

    if (ec.isWatchOnly()) {
      if (ec.isNotifyReadable()) eventCallback(b, EM_CONNECTION_NOTIFY_READABLE, null);
    } else {
      myReadBuffer.clear();

      try {
        ec.readInboundData(myReadBuffer);
        myReadBuffer.flip();
        if (myReadBuffer.limit() > 0) {
          if (ProxyConnections != null) {
            EventableChannel target = ProxyConnections.get(b);
            if (target != null) {
              ByteBuffer myWriteBuffer = ByteBuffer.allocate(myReadBuffer.limit());
              myWriteBuffer.put(myReadBuffer);
              myWriteBuffer.flip();
              target.scheduleOutboundData(myWriteBuffer);
            } else {
              eventCallback(b, EM_CONNECTION_READ, myReadBuffer);
            }
          } else {
            eventCallback(b, EM_CONNECTION_READ, myReadBuffer);
          }
        }
      } catch (IOException e) {
        UnboundConnections.add(b);
      }
    }
  }
Exemplo n.º 3
0
 public SocketChannel detachChannel(long sig) {
   EventableSocketChannel ec = (EventableSocketChannel) Connections.get(sig);
   if (ec != null) {
     UnboundConnections.add(sig);
     return ec.getChannel();
   } else {
     return null;
   }
 }
Exemplo n.º 4
0
 public boolean startProxy(long from, long to) {
   // lazy init for proxy support check quickly in isReadable
   if (ProxyConnections == null) {
     ProxyConnections = new HashMap<Long, EventableChannel>();
   }
   EventableChannel target = Connections.get(to);
   if (target != null) {
     ProxyConnections.put(from, target);
     return true;
   } else {
     return false;
   }
 }
Exemplo n.º 5
0
 /**
  * Get Field
  *
  * @param AD_Field_ID id
  * @param windowNo relative windowNo
  * @return field or null
  */
 public UIField getField(int AD_Field_ID, int windowNo) {
   Integer key = Integer.valueOf(AD_Field_ID);
   UIField field = m_fields.get(key);
   if (field == null) {
     UIFieldVOFactory fieldFactory = new UIFieldVOFactory();
     UIFieldVO vo = fieldFactory.get(m_context, AD_Field_ID);
     // m_context.setSOTrx(windowNo, isSOTrx);
     if (vo != null) {
       field = new UIField(vo);
       field.initialize(m_context, windowNo);
       log.warning("Loaded directly: " + field); // SOTrx may not
       // be correct
       m_fields.put(key, field); // save in cache
     }
   } // create new
   return field;
 } // getField
Exemplo n.º 6
0
  void addNewConnections() {
    ListIterator<EventableSocketChannel> iter = DetachedConnections.listIterator(0);
    while (iter.hasNext()) {
      EventableSocketChannel ec = iter.next();
      ec.cleanup();
    }
    DetachedConnections.clear();

    ListIterator<Long> iter2 = NewConnections.listIterator(0);
    while (iter2.hasNext()) {
      long b = iter2.next();

      EventableChannel ec = Connections.get(b);
      if (ec != null) {
        try {
          ec.register();
        } catch (ClosedChannelException e) {
          UnboundConnections.add(ec.getBinding());
        }
      }
    }
    NewConnections.clear();
  }
Exemplo n.º 7
0
 public boolean isNotifyWritable(long sig) {
   return Connections.get(sig).isNotifyWritable();
 }
Exemplo n.º 8
0
 public void setNotifyWritable(long sig, boolean mode) {
   ((EventableSocketChannel) Connections.get(sig)).setNotifyWritable(mode);
 }
Exemplo n.º 9
0
 public Object[] getPeerName(long sig) {
   return Connections.get(sig).getPeerName();
 }
Exemplo n.º 10
0
 public void startTls(long sig) throws NoSuchAlgorithmException, KeyManagementException {
   Connections.get(sig).startTls();
 }
Exemplo n.º 11
0
 public void closeConnection(long sig, boolean afterWriting) {
   EventableChannel ec = Connections.get(sig);
   if (ec != null) if (ec.scheduleClose(afterWriting)) UnboundConnections.add(sig);
 }
Exemplo n.º 12
0
 public void sendDatagram(long sig, ByteBuffer bb, String recipAddress, int recipPort) {
   (Connections.get(sig)).scheduleOutboundDatagram(bb, recipAddress, recipPort);
 }
Exemplo n.º 13
0
 public void setCommInactivityTimeout(long sig, long mills) {
   Connections.get(sig).setCommInactivityTimeout(mills);
 }
Exemplo n.º 14
0
 public void sendData(long sig, ByteBuffer bb) throws IOException {
   EventableChannel channel = Connections.get(sig);
   if (channel != null) {
     channel.scheduleOutboundData(bb);
   }
 }
Exemplo n.º 15
0
 public NodeVO getNode(String key) {
   return m_nodes.get(key);
 }
Exemplo n.º 16
0
 public void sendData(long sig, ByteBuffer bb) throws IOException {
   Connections.get(sig).scheduleOutboundData(bb);
 }