Examples of Native


Examples of com.esri.gpt.framework.resource.api.Native

*/
private Native queryNative(Connection con) throws SQLException {
  final String content = queryContent(con);
  final String sourceUri = querySourceUri(con);
  final Date updateDate = queryUpdateDate(con);
  return new Native() {

      @Override
      public SourceUri getSourceUri() {
        return new StringUri(sourceUri);
      }
View Full Code Here

Examples of com.esri.gpt.framework.resource.api.Native

    };
    // create new query builder specific for the repository
    QueryBuilder queryBuilder = repository.newQueryBuilder(iterationContext);
    // get native resource; this may throw exception(s) stored later in the
    // placeholder
    Native nativeResource = queryBuilder.getNativeResource();
    // assure there are no exceptions; if there are any, throw the first one
    if (exceptions.size() > 0) {
      throw exceptions.get(0);
    }
    return nativeResource;
View Full Code Here

Examples of com.esri.gpt.framework.resource.api.Native

      HrAssertUrlRequest assertUrlRequest = new HrAssertUrlRequest(context, record.getHostUrl());
      assertUrlRequest.executeAssert();
    }

    // create native resource
    Native nativeResource = null;

    // check if either host URL or title has changed
    if (hostUrlChanged || titleChanged || (findableChanged && record.getFindable())) {
      record.setUpdateDate(new Date());
      // if hot URL or title has changed than proceed with generation of the
      // native resource
      String title = "";
      // First, try to create native resource from the response
      nativeResource = createNativeResource(record);
      if (nativeResource == null) {
        // if no native resource available, create an artificial one based on
        //the information (host URL & title) from the repository.
        nativeResource = record.generateNativeResource();
        // get title
        title = record.getName();
        ProtocolInvoker.setLockTitle(record.getProtocol(), false);
      } else {
        // if the native resource is available, make sure it's a valid metadata resource
        // prepare record for publication; it will validate schema
        PublicationRequest pubReq = new PublicationRequest(context, user, nativeResource.getContent());
        Schema schema = pubReq.prepareForPublication();
        boolean lockTitle = false;
        if (record.getName().length() == 0) {
          title = schema.getMeaning().getTitle();
        } else {
View Full Code Here

Examples of net.openhft.lang.values.IntValue$$Native

        final SharedHashMap<IntValue, CharSequence> map = new SharedHashMapBuilder()
                .entries(1000)
                .entries(20000).file(getPersistenceFile()).kClass(IntValue.class).vClass(CharSequence.class).create();

        IntValue$$Native value = new IntValue$$Native();
        value.bytes(new ByteBufferBytes(ByteBuffer.allocateDirect(4)), 0);

        value.setValue(1);
        final String expected = "test";
        map.put(value, expected);

        final CharSequence actual = map.get(value);
        assertEquals(expected, actual);
View Full Code Here

Examples of net.openhft.lang.values.IntValue$$Native

    private SharedHashMap<IntValue, CharSequence> map2;
    private IntValue$$Native value;

    @Before
    public void setup() throws IOException {
        value = new IntValue$$Native();
        value.bytes(new ByteBufferBytes(ByteBuffer.allocateDirect(4)), 0);
        map1 = newTcpSocketShmIntValueString((byte) 1, 8076, new InetSocketAddress("localhost", 8077));
        map2 = newTcpSocketShmIntValueString((byte) 2, 8077);
    }
View Full Code Here

Examples of net.openhft.lang.values.LongValue$$Native

    }

    @Test
    public void testAcquireWithNullContainer() throws Exception {
        SharedHashMap<CharSequence, LongValue> map = getSharedMap(10 * 1000, 128, 24);
        map.acquireUsing("key", new LongValue$$Native());
        assertEquals(0, map.acquireUsing("key", null).getValue());

        map.close();
    }
View Full Code Here

Examples of net.openhft.lang.values.LongValue$$Native

    }

    @Test
    public void testGetWithNullContainer() throws Exception {
        SharedHashMap<CharSequence, LongValue> map = getSharedMap(10 * 1000, 128, 24);
        map.acquireUsing("key", new LongValue$$Native());
        assertEquals(0, map.getUsing("key", null).getValue());

        map.close();
    }
View Full Code Here

Examples of net.openhft.lang.values.LongValue$$Native

    }

    @Test
    public void testGetWithoutAcquireFirst() throws Exception {
        SharedHashMap<CharSequence, LongValue> map = getSharedMap(10 * 1000, 128, 24);
        assertNull(map.getUsing("key", new LongValue$$Native()));

        map.close();
    }
View Full Code Here

Examples of net.openhft.lang.values.LongValue$$Native

    }

    public void testAcquireAndGet(SharedHashMap<CharSequence, LongValue> map, int entries)
            throws IOException, ClassNotFoundException, IllegalAccessException,
            InstantiationException {
        LongValue value = new LongValue$$Native();
        LongValue value2 = new LongValue$$Native();
        LongValue value3 = new LongValue$$Native();

        for (int j = 1; j <= 3; j++) {
            for (int i = 0; i < entries; i++) {
                CharSequence userCS = getUserCharSequence(i);

                if (j > 1) {
                    assertNotNull(map.getUsing(userCS, value));
                } else {
                    map.acquireUsing(userCS, value);
                }
                assertEquals(j - 1, value.getValue());

                value.addAtomicValue(1);

                assertEquals(value2, map.acquireUsing(userCS, value2));
                assertEquals(j, value2.getValue());

                assertEquals(value3, map.getUsing(userCS, value3));
                assertEquals(j, value3.getValue());
            }
        }

        map.close();
    }
View Full Code Here

Examples of net.openhft.lang.values.LongValue$$Native

    public void testAcquireFromMultipleThreads(SharedHashMap<CharSequence, LongValue> map)
            throws Exception {

        CharSequence key = getUserCharSequence(0);
        map.acquireUsing(key, new LongValue$$Native());

        int iterations = 1000;
        int noOfThreads = 10;
        CyclicBarrier barrier = new CyclicBarrier(noOfThreads);

        Thread[] threads = new Thread[noOfThreads];
        for (int t = 0; t < noOfThreads; t++) {
            threads[t] = new Thread(new IncrementRunnable(map, key, iterations, barrier));
            threads[t].start();
        }
        for (int t = 0; t < noOfThreads; t++) {
            threads[t].join();
        }

        assertEquals(noOfThreads * iterations, map.acquireUsing(key, new LongValue$$Native()).getValue());

        map.close();
    }
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.