OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
IteratorImpl.java
Go to the documentation of this file.
1 /*
2  * Vortex OpenSplice
3  *
4  * This software and documentation are Copyright 2006 to 2021 ADLINK
5  * Technology Limited, its affiliated companies and licensors. All rights
6  * reserved.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 package org.opensplice.dds.sub;
22 
23 import java.lang.reflect.Field;
24 
28 
29 import DDS.SampleInfoSeqHolder;
30 
31 public class IteratorImpl<TYPE> extends AbstractIterator<TYPE> {
32  private TYPE[] data;
33 
36  Field dataSeqHolderValue, SampleInfoSeqHolder infoSeqHolder) {
37  super(environment, reader, sampleSeqHolder, dataSeqHolderValue,
38  infoSeqHolder);
39  }
40 
41  @SuppressWarnings("unchecked")
42  @Override
44  try {
45  this.data = (TYPE[]) dataSeqHolderValue.get(sampleSeqHolder);
46 
47  } catch (SecurityException e) {
49  "Not allowed to access field "
50  + dataSeqHolderValue.getName() + " in "
51  + dataSeqHolderValue.getClass().getName() + "("
52  + e.getMessage() + ").");
53  } catch (IllegalArgumentException e) {
54  throw new DDSExceptionImpl(environment, "Cannot find "
55  + dataSeqHolderValue.getName() + " in "
56  + dataSeqHolderValue.getClass().getName() + "("
57  + e.getMessage() + ").");
58  } catch (IllegalAccessException e) {
59  throw new DDSExceptionImpl(environment, "No access to field "
60  + dataSeqHolderValue.getName() + " in "
61  + dataSeqHolderValue.getClass().getName() + "("
62  + e.getMessage() + ").");
63  }
64  return new SampleImpl[this.data.length];
65  }
66 
67  @Override
68  protected TYPE getData(int index) {
69  return this.data[index];
70  }
71 }
final OsplServiceEnvironment environment
IteratorImpl(OsplServiceEnvironment environment, DataReaderImpl< TYPE > reader, Object sampleSeqHolder, Field dataSeqHolderValue, SampleInfoSeqHolder infoSeqHolder)
final AbstractDataReader< TYPE > reader
SampleImpl< TYPE > [] setupSampleList()