-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial version to migrate generic adapters (#1289)
- Loading branch information
1 parent
fa595b3
commit 5a06318
Showing
14 changed files
with
684 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...in/java/org/apache/streampipes/service/core/migrations/v093/format/CsvFormatMigrator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.apache.streampipes.service.core.migrations.v093.format; | ||
|
||
import com.google.gson.JsonObject; | ||
|
||
public class CsvFormatMigrator implements FormatMigrator { | ||
|
||
|
||
public CsvFormatMigrator(String csvFormatId, | ||
JsonObject formatDescription) { | ||
} | ||
|
||
@Override | ||
public void migrate(JsonObject newFormatProperties) { | ||
|
||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
.../java/org/apache/streampipes/service/core/migrations/v093/format/EmptyFormatMigrator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.apache.streampipes.service.core.migrations.v093.format; | ||
|
||
import com.google.gson.JsonObject; | ||
|
||
public class EmptyFormatMigrator implements FormatMigrator { | ||
|
||
@Override | ||
public void migrate(JsonObject newFormatProperties) { | ||
|
||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
.../main/java/org/apache/streampipes/service/core/migrations/v093/format/FormatMigrator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.apache.streampipes.service.core.migrations.v093.format; | ||
|
||
import com.google.gson.JsonObject; | ||
|
||
public interface FormatMigrator { | ||
|
||
void migrate(JsonObject newFormatProperties); | ||
} |
51 changes: 51 additions & 0 deletions
51
...n/java/org/apache/streampipes/service/core/migrations/v093/format/JsonFormatMigrator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.apache.streampipes.service.core.migrations.v093.format; | ||
|
||
import org.apache.streampipes.service.core.migrations.v093.migrator.MigrationHelpers; | ||
|
||
import com.google.gson.JsonObject; | ||
import com.google.gson.JsonPrimitive; | ||
|
||
import static org.apache.streampipes.service.core.migrations.v093.utils.DocumentKeys.ALTERNATIVES; | ||
import static org.apache.streampipes.service.core.migrations.v093.utils.DocumentKeys.INTERNAL_NAME; | ||
|
||
public class JsonFormatMigrator implements FormatMigrator { | ||
|
||
private String jsonFormatId; | ||
|
||
public JsonFormatMigrator(String jsonFormatId, | ||
JsonObject existingFormat) { | ||
this.jsonFormatId = jsonFormatId; | ||
} | ||
|
||
@Override | ||
public void migrate(JsonObject newFormatProperties) { | ||
newFormatProperties.get(MigrationHelpers.PROPERTIES).getAsJsonObject() | ||
.get("staticProperties").getAsJsonArray() | ||
.get(0).getAsJsonObject() | ||
.get(MigrationHelpers.PROPERTIES).getAsJsonObject() | ||
.get(ALTERNATIVES).getAsJsonArray() | ||
.forEach(al -> { | ||
if (al.getAsJsonObject().get(INTERNAL_NAME).getAsString().equals(jsonFormatId)) { | ||
al.getAsJsonObject().add("selected", new JsonPrimitive(true)); | ||
} | ||
}); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...in/java/org/apache/streampipes/service/core/migrations/v093/format/XmlFormatMigrator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.apache.streampipes.service.core.migrations.v093.format; | ||
|
||
import com.google.gson.JsonObject; | ||
|
||
public class XmlFormatMigrator implements FormatMigrator { | ||
public XmlFormatMigrator(String xmlFormatId, | ||
JsonObject formatDescription) { | ||
} | ||
|
||
@Override | ||
public void migrate(JsonObject newFormatProperties) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.