javax.activation.UnsupportedDataTypeException Java Examples
The following examples show how to use
javax.activation.UnsupportedDataTypeException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CollectionValuePickerData.java From org.openntf.domino with Apache License 2.0 | 6 votes |
/** * Gets the Collection from the "collection" property, throwing an error if it is not a valid Collection * * @return Collection<String> of values to use in the picker * @since org.openntf.domino.xsp 4.5.0 */ @SuppressWarnings("unchecked") public Collection<String> getCollection() { if (collection != null) { return collection; } ValueBinding vb = getValueBinding("collection"); //$NON-NLS-1$ if (vb != null) { Object vbVal = vb.getValue(getFacesContext()); if (vbVal instanceof Collection) { return (Collection<String>) vbVal; } else { try { throw new UnsupportedDataTypeException("Value is not a Collection"); } catch (UnsupportedDataTypeException e) { e.printStackTrace(); } } } return null; }
Example #2
Source File: Node.java From aion-germany with GNU General Public License v3.0 | 6 votes |
@Override public Node clone() throws CloneNotSupportedException { Node node = new Node(name); node.collisionFlags = collisionFlags; for (Spatial spatial : children) { if (spatial instanceof Geometry) { Geometry geom = new Geometry(spatial.getName(), ((Geometry) spatial).getMesh()); node.attachChild(geom); } else if (spatial instanceof Node) { node.attachChild(((Node) (spatial)).clone()); } else { new UnsupportedDataTypeException(); } } return node; }
Example #3
Source File: SetupApplication.java From JAADAS with GNU General Public License v3.0 | 6 votes |
/** * Calculates the sets of sources, sinks, entry points, and callbacks methods for the given APK file. * * @param sourceSinkFile * The full path and file name of the file containing the sources and sinks * @throws IOException * Thrown if the given source/sink file could not be read. * @throws XmlPullParserException * Thrown if the Android manifest file could not be read. */ public void calculateSourcesSinksEntrypoints(String sourceSinkFile) throws IOException, XmlPullParserException { ISourceSinkDefinitionProvider parser = null; String fileExtension = sourceSinkFile.substring(sourceSinkFile.lastIndexOf(".")); fileExtension = fileExtension.toLowerCase(); if (fileExtension.equals(".xml")) parser = XMLSourceSinkParser.fromFile(sourceSinkFile); else if(fileExtension.equals(".txt")) parser = PermissionMethodParser.fromFile(sourceSinkFile); else throw new UnsupportedDataTypeException("The Inputfile isn't a .txt or .xml file."); calculateSourcesSinksEntrypoints(parser); }
Example #4
Source File: MapValuePickerData.java From org.openntf.domino with Apache License 2.0 | 6 votes |
/** * Gets the options for the Value Picker, from the "options" property * * @return Map<String, String> of values * @since org.openntf.domino.xsp 4.5.0 */ @SuppressWarnings("unchecked") public Map<String, String> getOptions() { if (options != null) { return options; } ValueBinding vb = getValueBinding("options"); //$NON-NLS-1$ if (vb != null) { Object vbVal = vb.getValue(getFacesContext()); if (vbVal instanceof Map) { return (Map<String, String>) vbVal; } else { try { throw new UnsupportedDataTypeException("Value is not a map"); } catch (UnsupportedDataTypeException e) { e.printStackTrace(); } } } return null; }
Example #5
Source File: ShapefileMappingGenerator.java From GeoTriples with Apache License 2.0 | 6 votes |
public static String TranslateDataTypeToXSD(String name) throws UnsupportedDataTypeException { if (name.contains(".")) { String[] tokens = name.split("[.]"); name = tokens[tokens.length - 1]; } if (name.equals("String")) { return "xsd:string"; } else if (name.equals("Int") || name.equals("Integer")) { return "xsd:integer"; } else if (name.equals("Bool")) { return "xsd:boolean"; } else if (name.equals("Long")) { return "xsd:long"; } else if (name.equals("Double")) { return "xsd:double"; } else if (name.equals("Date")) { // TODO to be checked !! date xsd?? return "xsd:datetime"; } else { throw new UnsupportedDataTypeException("Datatype '" + name + "' is not supported!"); } }
Example #6
Source File: CSVMappingGenerator.java From GeoTriples with Apache License 2.0 | 6 votes |
public static String TranslateDataTypeToXSD(String name) throws UnsupportedDataTypeException { if (name.contains(".")) { String[] tokens = name.split("[.]"); name = tokens[tokens.length - 1]; } if (name.equals("String")) { return "xsd:string"; } else if (name.equals("Int") || name.equals("Integer")) { return "xsd:integer"; } else if (name.equals("Bool")) { return "xsd:boolean"; } else if (name.equals("Long")) { return "xsd:long"; } else if (name.equals("Double")) { return "xsd:double"; } else if (name.equals("Date")) { // TODO to be checked !! date xsd?? return "xsd:datetime"; } else { throw new UnsupportedDataTypeException("Datatype '" + name + "' is not supported!"); } }
Example #7
Source File: EnumValuePickerData.java From org.openntf.domino with Apache License 2.0 | 6 votes |
/** * Loads the options, creating a LinkedHashMap where the key is the enum name and the value is the enum class + " " + the enum name * * @since org.openntf.domino.xsp 4.5.0 */ @SuppressWarnings("unchecked") public void setOptions() { Map<String, String> opts; if (sorted) { opts = new TreeMap<String, String>(); } else { opts = new LinkedHashMap<String, String>(); } try { Class<Enum> enumClass = (Class<Enum>) Class.forName(getEnumName()); if (enumClass.isEnum()) { Enum[] enums = enumClass.getEnumConstants(); for (Enum e : enums) { opts.put(e.name(), enumClass.getName() + " " + e.name()); } } else { throw new UnsupportedDataTypeException("Value is not an Enum"); } } catch (Throwable t) { DominoUtils.handleException(t); } super.setOptions(opts); }
Example #8
Source File: TableDefUtils.java From GeoTriples with Apache License 2.0 | 5 votes |
public static DataType TranslateDataTypeToSQLType(String name) throws UnsupportedDataTypeException { if (name.contains(".")) { String[] tokens = name.split("[.]"); name = tokens[tokens.length - 1]; } if (name.equals("String")) { return new SQLCharacterString("String", true); } else if (name.equals("Bool")) { return new SQLBoolean("String"); } else if (name.equals("Int") || name.equals("Integer")) { return new SQLExactNumeric("Int", Types.INTEGER, false); } else if (name.equals("Bool")) { return new SQLBoolean("Boolean"); } else if (name.equals("Geometry")) { return new SQLCharacterString("Geometry", true); }else if (name.equals("MultiPolygon")) { return new SQLCharacterString("Geometry", true); }else if (name.equals("MultiLineString")) { return new SQLCharacterString("Geometry", true); } else if (name.equals("Point")) { return new SQLCharacterString("Geometry", true); } else if (name.equals("Long")) { return new SQLExactNumeric("Int", Types.BIGINT, false); } else if (name.equals("Double")) { return new SQLApproximateNumeric("Double"); } else if (name.equals("Date")) { //TODO to be checked !! date xsd?? return new SQLDate("Date"); } else { throw new UnsupportedDataTypeException("Datatype '" + name + "' is not supported!"); } }
Example #9
Source File: ParamMarshaller.java From ob1k with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public static <T> T unmarshall(final Object value, final Class<T> type) throws UnsupportedDataTypeException { final Marshaller<?> marshaller = marshallers.get(type); if (marshaller == null) { throw new UnsupportedDataTypeException("can't unmarshall type " + type.getName()); } return (T) marshaller.unmarshall(value); }
Example #10
Source File: DeepSparkContext.java From deep-spark with Apache License 2.0 | 5 votes |
/** * Creates a JavaSchemaRDD from a DeepJobConfig and a JavaSQLContext. * @param config Specific Deep ExtractorConfig. * @return A JavaSchemaRDD built from Cells. * @throws UnsupportedDataTypeException */ public DataFrame createJavaSchemaRDD(ExtractorConfig<Cells> config) throws UnsupportedDataTypeException, UnsupportedOperationException { JavaRDD<Cells> cellsRDD = createJavaRDD(config); JavaRDD<Row> rowsRDD = DeepSparkContext.createJavaRowRDD(cellsRDD); try { Cells firstCells = cellsRDD.first(); StructType schema = CellsUtils.getStructTypeFromCells(firstCells); return sqlContext.applySchema(rowsRDD, schema); } catch(UnsupportedOperationException e) { throw new UnsupportedOperationException("Cannot infer schema from empty data RDD", e); } }
Example #11
Source File: DeepSparkContext.java From deep-spark with Apache License 2.0 | 5 votes |
/** * Creates a JavaRDD of SparkSQL rows * @param cellsRDD RDD of cells for transforming. * @return Java RDD of SparkSQL rows * @throws UnsupportedDataTypeException */ public static JavaRDD<Row> createJavaRowRDD(JavaRDD<Cells> cellsRDD) throws UnsupportedDataTypeException { JavaRDD<Row> result = cellsRDD.map(new Function<Cells, Row>() { @Override public Row call(Cells cells) throws Exception { return CellsUtils.getRowFromCells(cells); } }); return result; }
Example #12
Source File: KMLParser.java From GeoTriples with Apache License 2.0 | 5 votes |
private DataType TranslateDataTypeToSQLType(String name) throws UnsupportedDataTypeException { if (name.contains(".")) { String[] tokens = name.split("[.]"); name = tokens[tokens.length - 1]; } if (name.equalsIgnoreCase("String")) { return new SQLCharacterString("String", true); } else if (name.equalsIgnoreCase("Int") || name.equalsIgnoreCase("Integer")) { return new SQLExactNumeric("Int", Types.INTEGER, false); } else if (name.equalsIgnoreCase("Bool")) { return new SQLBoolean("Boolean"); } else if (name.equalsIgnoreCase("MultiPolygon")) { return new SQLCharacterString("Geometry", true); } else if (name.equalsIgnoreCase("Point")) { return new SQLCharacterString("Geometry", true); } else if (name.equalsIgnoreCase("LinearString")) { return new SQLCharacterString("Geometry", true); } else if (name.equalsIgnoreCase("MultiLineString")) { return new SQLCharacterString("Geometry", true); } else if (name.equalsIgnoreCase("Long")) { return new SQLExactNumeric("Int", Types.BIGINT, false); } else if (name.equalsIgnoreCase("Double")) { return new SQLApproximateNumeric("Double"); } else { throw new UnsupportedDataTypeException(name + " datatype is not supported"); } }
Example #13
Source File: TableDefUtils.java From GeoTriples with Apache License 2.0 | 5 votes |
public static TableDef generateVirtualGeometryTable(TableDef originalTable)throws UnsupportedDataTypeException { TableName tablename=TableName.create(null, null, Identifier.createDelimited(originalTable.getName().getTable().getName() + "_geometry")); //TableName tablename=TableName.create(null, null, Identifier.createDelimited(originalTable.getName().getTable().getName() )); List<ColumnDef> columns = new ArrayList<ColumnDef>(); //columns.add(originalTable.getColumnDef(Identifier.createDelimited("the_geom"))); columns.add(new ColumnDef(Identifier.createDelimited("the_geom"), TableDefUtils.TranslateDataTypeToSQLType("Geometry"), false)); Set<Key> primkeys=new HashSet<Key>(); /*DataType dType = new WKTLiteral("wktLiteral"); columns.add(new ColumnDef(Identifier.createDelimited("asWKT"), dType, false)); columns.add(new ColumnDef(Identifier.createDelimited("hasSerialization"), dType, false)); dType = new GMLLiteral("gmlLiteral"); columns.add(new ColumnDef(Identifier.createDelimited("asGML"), dType, false)); dType = new SQLBoolean("Bool"); columns.add(new ColumnDef(Identifier.createDelimited("isSimple"), dType, false)); columns.add(new ColumnDef(Identifier.createDelimited("isEmpty"), dType, false)); columns.add(new ColumnDef(Identifier.createDelimited("is3D"), dType, false)); dType = new SQLExactNumeric("Integer", Types.INTEGER, true); columns.add(new ColumnDef(Identifier.createDelimited("spatialDimension"), dType, false)); columns.add(new ColumnDef(Identifier.createDelimited("dimension"), dType, false)); columns.add(new ColumnDef(Identifier.createDelimited("coordinateDimension"), dType, false)); TableDef gTable = new TableDef(tablename, columns, null, primkeys, new HashSet<ForeignKey>()); return TableDefUtils.addPrimaryKeyDef(gTable);*/ TableDef gTable = new TableDef(tablename, columns, null, primkeys, new HashSet<ForeignKey>()); return TableDefUtils.addPrimaryKeyDef(gTable); }
Example #14
Source File: GeoTiffParser.java From GeoTriples with Apache License 2.0 | 5 votes |
private DataType TranslateDataTypeToSQLType(String name) throws UnsupportedDataTypeException { if (name.contains(".")) { String[] tokens = name.split("[.]"); name = tokens[tokens.length - 1]; } if (name.equalsIgnoreCase("String")) { return new SQLCharacterString("String", true); } else if (name.equalsIgnoreCase("Int") || name.equalsIgnoreCase("Integer")) { return new SQLExactNumeric("Int", Types.INTEGER, false); } else if (name.equalsIgnoreCase("Bool")) { return new SQLBoolean("Boolean"); } else if (name.equalsIgnoreCase("MultiPolygon")) { return new SQLCharacterString("Geometry", true); } else if (name.equalsIgnoreCase("Point")) { return new SQLCharacterString("Geometry", true); } else if (name.equalsIgnoreCase("LinearString")) { return new SQLCharacterString("Geometry", true); } else if (name.equalsIgnoreCase("MultiLineString")) { return new SQLCharacterString("Geometry", true); } else if (name.equalsIgnoreCase("Long")) { return new SQLExactNumeric("Int", Types.BIGINT, false); } else if (name.equalsIgnoreCase("Double")) { return new SQLApproximateNumeric("Double"); } else { throw new UnsupportedDataTypeException(name + " datatype is not supported"); } }
Example #15
Source File: SerializeUtils.java From incubator-iotdb with Apache License 2.0 | 5 votes |
public static TimeValuePair deserializeTVPair(ByteBuffer buffer) throws UnsupportedDataTypeException { if (buffer == null || (buffer.limit() - buffer.position() == 0)) { return null; } TSDataType dataType = TSDataType.values()[buffer.get()]; switch (dataType) { case DOUBLE: return new TimeValuePair(buffer.getLong(), TsPrimitiveType.getByType(dataType, buffer.getDouble())); case FLOAT: return new TimeValuePair(buffer.getLong(), TsPrimitiveType.getByType(dataType, buffer.getFloat())); case INT32: return new TimeValuePair(buffer.getLong(), TsPrimitiveType.getByType(dataType, buffer.getInt())); case INT64: return new TimeValuePair(buffer.getLong(), TsPrimitiveType.getByType(dataType, buffer.getLong())); case BOOLEAN: return new TimeValuePair(buffer.getLong(), TsPrimitiveType.getByType(dataType, buffer.get() == 1)); case TEXT: long time = buffer.getLong(); int bytesLen = buffer.getInt(); byte[] bytes = new byte[bytesLen]; buffer.get(bytes); TsPrimitiveType primitiveType = TsPrimitiveType.getByType(dataType, bytes); return new TimeValuePair(time, primitiveType); } throw new UnsupportedDataTypeException(dataType.toString()); }
Example #16
Source File: MimeMessageUtil.java From james-project with Apache License 2.0 | 4 votes |
/** * Write message body of given mimeessage to the given outputStream * * @param message * the MimeMessage used as input * @param bodyOs * the OutputStream to write the message body to * @throws IOException * @throws UnsupportedDataTypeException * @throws MessagingException */ public static void writeMessageBodyTo(MimeMessage message, OutputStream bodyOs) throws IOException, MessagingException { OutputStream bos; InputStream bis; try { // Get the message as a stream. This will encode // objects as necessary, and we have some input from // decoding an re-encoding the stream. I'd prefer the // raw stream, but see bos = MimeUtility.encode(bodyOs, message.getEncoding()); bis = message.getInputStream(); } catch (UnsupportedDataTypeException | MessagingException udte) { /* * If we get an UnsupportedDataTypeException try using the raw input * stream as a "best attempt" at rendering a message. * * WARNING: JavaMail v1.3 getRawInputStream() returns INVALID * (unchanged) content for a changed message. getInputStream() works * properly, but in this case has failed due to a missing * DataHandler. * * MimeMessage.getRawInputStream() may throw a "no content" * MessagingException. In JavaMail v1.3, when you initially create a * message using MimeMessage APIs, there is no raw content * available. getInputStream() works, but getRawInputStream() throws * an exception. If we catch that exception, throw the UDTE. It * should mean that someone has locally constructed a message part * for which JavaMail doesn't have a DataHandler. */ try { bis = message.getRawInputStream(); bos = bodyOs; } catch (javax.mail.MessagingException ignored) { throw udte; } } try (InputStream input = bis) { input.transferTo(bos); } }
Example #17
Source File: FillQueryExecutor.java From incubator-iotdb with Apache License 2.0 | 4 votes |
/** * execute fill. * * @param context query context */ public QueryDataSet execute(QueryContext context, FillQueryPlan fillQueryPlan) throws StorageEngineException, QueryProcessException, IOException { RowRecord record = new RowRecord(queryTime); for (int i = 0; i < selectedSeries.size(); i++) { Path path = selectedSeries.get(i); TSDataType dataType = dataTypes.get(i); IFill fill; long defaultFillInterval = IoTDBDescriptor.getInstance().getConfig().getDefaultFillInterval(); if (!typeIFillMap.containsKey(dataType)) { switch (dataType) { case INT32: case INT64: case FLOAT: case DOUBLE: case BOOLEAN: case TEXT: fill = new PreviousFill(dataType, queryTime, defaultFillInterval); break; default: throw new UnsupportedDataTypeException("do not support datatype " + dataType); } } else { fill = typeIFillMap.get(dataType).copy(); } fill = configureFill(fill, path, dataType, queryTime, fillQueryPlan.getAllMeasurementsInDevice(path.getDevice()), context); TimeValuePair timeValuePair = fill.getFillResult(); if (timeValuePair == null || timeValuePair.getValue() == null) { record.addField(null); } else { record.addField(timeValuePair.getValue().getValue(), dataType); } } SingleDataSet dataSet = new SingleDataSet(selectedSeries, dataTypes); dataSet.setRecord(record); return dataSet; }
Example #18
Source File: InfluxDbReporterFactory.java From dropwizard-metrics-influxdb with Apache License 2.0 | 4 votes |
@Override public ScheduledReporter build(MetricRegistry registry) { try { InfluxDbReporter.Builder builder = builder(registry); switch (senderType) { case HTTP: return builder.build( new InfluxDbHttpSender( protocol, host, port, database, auth, precision.getUnit(), connectTimeout, readTimeout, prefix ) ); case TCP: return builder.build( new InfluxDbTcpSender( host, port, readTimeout, database, prefix ) ); case UDP: return builder.build( new InfluxDbUdpSender( host, port, readTimeout, database, prefix ) ); case LOGGER: return builder.build( new InfluxDbLoggerSender( database, TimeUnit.MILLISECONDS, prefix ) ); case KAFKA: return builder.build( new InfluxDBKafkaSender( database, TimeUnit.MILLISECONDS, prefix ) ); default: throw new UnsupportedDataTypeException("The Sender Type is not supported. "); } } catch (Exception e) { throw new RuntimeException(e); } }