private void sendExecute(SimpleQuery query, Portal portal, int limit) throws IOException { // // Send Execute. // if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, " FE=> Execute(portal={0},limit={1})", new Object[]{portal, limit}); } byte[] encodedPortalName = (portal == null ? null : portal.getEncodedPortalName()); int encodedSize = (encodedPortalName == null ? 0 : encodedPortalName.length); // Total size = 4 (size field) + 1 + N (source portal) + 4 (max rows) pgStream.sendChar('E'); // Execute pgStream.sendInteger4(4 + 1 + encodedSize + 4); // message size if (encodedPortalName != null) { pgStream.send(encodedPortalName); // portal name } pgStream.sendChar(0); // portal name terminator pgStream.sendInteger4(limit); // row limit pendingExecuteQueue.add(new ExecuteRequest(query, portal, false)); }
private void registerOpenPortal(Portal portal) { if (portal == UNNAMED_PORTAL) { return; // Using the unnamed portal. } String portalName = portal.getPortalName(); PhantomReference<Portal> cleanupRef = new PhantomReference<Portal>(portal, openPortalCleanupQueue); openPortalMap.put(cleanupRef, portalName); portal.setCleanupRef(cleanupRef); }
public void handleCommandStatus(String status, int updateCount, long insertOID) { handleResultRows(portal.getQuery(), null, new ArrayList<byte[][]>(), null); } };
portal = new Portal(query, portalName);
protected Void doInBackground(Void... params) { Log.d("MyApp", "AppLoginTask"); Portal p = new Portal("https://www.arcgis.com", null); p.doOAuthAppAuthenticate(APP_SECRET, APP_ID, new CallbackListener<Portal>() { @Override public void onCallback(Portal portal) { Log.d("MyApp", "login callback"); mCreds = portal.getCredentials(); setMapDataMode(MapDataMode.ONLINE);
public static void main(String[] args) throws Exception { Portal portal = new Portal(); Object list = portal.getClass().getDeclaredMethod("getActionList", null).invoke(portal, null); Object action = list.getClass().getDeclaredMethod("get", new Class[] { int.class }).invoke(list, 0); action.getClass().getDeclaredMethod("action", null).invoke(action, null); }
public void handleCommandStatus(String status, int updateCount, long insertOID) { handleResultRows(portal.getQuery(), null, new Vector(), null); }
if (usePortal) { String portalName = "C_" + (nextUniqueID++); portal = new Portal(query, portalName);
private void registerOpenPortal(Portal portal) { if (portal == null) return ; // Using the unnamed portal. String portalName = portal.getPortalName(); PhantomReference cleanupRef = new PhantomReference(portal, openPortalCleanupQueue); openPortalMap.put(cleanupRef, portalName); portal.setCleanupRef(cleanupRef); }
private void sendDescribePortal(SimpleQuery query, Portal portal) throws IOException { // // Send Describe. // LOGGER.log(Level.FINEST, " FE=> Describe(portal={0})", portal); byte[] encodedPortalName = (portal == null ? null : portal.getEncodedPortalName()); // Total size = 4 (size field) + 1 (describe type, 'P') + N + 1 (portal name) int encodedSize = 4 + 1 + (encodedPortalName == null ? 0 : encodedPortalName.length) + 1; pgStream.sendChar('D'); // Describe pgStream.sendInteger4(encodedSize); // message size pgStream.sendChar('P'); // Describe (Portal) if (encodedPortalName != null) { pgStream.send(encodedPortalName); // portal name to close } pgStream.sendChar(0); // end of portal name pendingDescribePortalQueue.add(query); query.setPortalDescribed(true); }
public synchronized void fetch(ResultCursor cursor, ResultHandler handler, int fetchSize) throws SQLException { waitOnLock(); final Portal portal = (Portal) cursor; // Insert a ResultHandler that turns bare command statuses into empty datasets // (if the fetch returns no rows, we see just a CommandStatus..) final ResultHandler delegateHandler = handler; handler = new ResultHandlerDelegate(delegateHandler) { public void handleCommandStatus(String status, int updateCount, long insertOID) { handleResultRows(portal.getQuery(), null, new ArrayList<byte[][]>(), null); } }; // Now actually run it. try { processDeadParsedQueries(); processDeadPortals(); sendExecute(portal.getQuery(), portal, fetchSize); sendSync(); processResults(handler, 0); estimatedReceiveBufferBytes = 0; } catch (IOException e) { abort(); handler.handleError( new PSQLException(GT.tr("An I/O error occurred while sending to the backend."), PSQLState.CONNECTION_FAILURE, e)); } handler.handleCompletion(); }
public GameObject { List<Portal> whitePortals; List<Portal> blackPortals; public GameObject() { whitePortals = new ArrayList<Portal>(); blackPortals = new ArrayList<Portal>(); } public GameObject addWhitePortal(int m, int o) throws Exception { whitePortals.add(new Portal(m, o)); return this; } ... // You need to change other methods to follow a different data structure }
private void registerOpenPortal(Portal portal) { if (portal == null) return ; // Using the unnamed portal. String portalName = portal.getPortalName(); PhantomReference cleanupRef = new PhantomReference(portal, openPortalCleanupQueue); openPortalMap.put(cleanupRef, portalName); portal.setCleanupRef(cleanupRef); }
private void sendExecute(SimpleQuery query, Portal portal, int limit) throws IOException { // // Send Execute. // if (logger.logDebug()) { logger.debug(" FE=> Execute(portal=" + portal + ",limit=" + limit + ")"); } byte[] encodedPortalName = (portal == null ? null : portal.getEncodedPortalName()); int encodedSize = (encodedPortalName == null ? 0 : encodedPortalName.length); // Total size = 4 (size field) + 1 + N (source portal) + 4 (max rows) pgStream.SendChar('E'); // Execute pgStream.SendInteger4(4 + 1 + encodedSize + 4); // message size if (encodedPortalName != null) pgStream.Send(encodedPortalName); // portal name pgStream.SendChar(0); // portal name terminator pgStream.SendInteger4(limit); // row limit pendingExecuteQueue.add(new Object[] { query, portal }); }
processDeadPortals(); sendExecute(portal.getQuery(), portal, fetchSize); sendSync();
portal = new Portal(query, portalName);