Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from phantomjinx/teiid-8.x-upgrade
Teiid 8.x upgrade
- Loading branch information
Showing
6 changed files
with
317 additions
and
8 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
128 changes: 128 additions & 0 deletions
128
plugins/org.teiid.designer.vdb/src/org/teiid/designer/vdb/VdbImportVdbEntry.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,128 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* | ||
* See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing. | ||
* | ||
* See the AUTHORS.txt file distributed with this work for a full listing of individual contributors. | ||
*/ | ||
package org.teiid.designer.vdb; | ||
|
||
import java.util.concurrent.atomic.AtomicReference; | ||
|
||
import org.teiid.designer.vdb.Vdb.Event; | ||
import org.teiid.designer.vdb.manifest.ImportVdbElement; | ||
|
||
/** | ||
* | ||
* | ||
* @since 8.0 | ||
*/ | ||
public class VdbImportVdbEntry { | ||
|
||
private final Vdb vdb; | ||
|
||
private String name; | ||
|
||
final AtomicReference<Integer> version = new AtomicReference<Integer>(); | ||
|
||
final AtomicReference<Boolean> importDataPolicies = new AtomicReference<Boolean>(); | ||
|
||
/** | ||
* @param vdb | ||
* @param importVdbName | ||
*/ | ||
public VdbImportVdbEntry(Vdb vdb, String importVdbName) { | ||
this.vdb = vdb; | ||
this.name = importVdbName; | ||
} | ||
|
||
/** | ||
* @param vdb | ||
* @param element | ||
*/ | ||
VdbImportVdbEntry(Vdb vdb, ImportVdbElement element) { | ||
this(vdb, element.getName()); | ||
this.version.set(element.getVersion()); | ||
this.importDataPolicies.set(element.isImportDataPolicies()); | ||
} | ||
|
||
/** | ||
* @return return the name | ||
*/ | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
/** | ||
* @return return the version | ||
*/ | ||
public int getVersion() { | ||
return version.get(); | ||
} | ||
|
||
/** | ||
* Modify the version attribute | ||
* | ||
* @param version | ||
*/ | ||
public void setVersion(int version) { | ||
final int oldVersion = this.version.get(); | ||
if (version == oldVersion) return; | ||
this.version.set(version); | ||
vdb.setModified(this, Event.IMPORT_VDB_ENTRY_VERSION, oldVersion, version); | ||
} | ||
|
||
/** | ||
* @return the import data policies flag | ||
*/ | ||
public boolean isImportDataPolicies() { | ||
return importDataPolicies.get(); | ||
} | ||
|
||
/** | ||
* Modify the import data policies flag | ||
* | ||
* @param importDataPolicies | ||
*/ | ||
public void setImportDataPolicies(boolean importDataPolicies) { | ||
final boolean oldImportDataPolicies = this.importDataPolicies.get(); | ||
if (importDataPolicies == oldImportDataPolicies) return; | ||
this.importDataPolicies.set(importDataPolicies); | ||
vdb.setModified(this, Event.IMPORT_VDB_ENTRY_DATA_POLICY, oldImportDataPolicies, importDataPolicies); | ||
} | ||
|
||
@SuppressWarnings("javadoc") | ||
@Override | ||
public int hashCode() { | ||
final int prime = 31; | ||
int result = 1; | ||
result = prime * result | ||
+ ((this.name == null) ? 0 : this.name.hashCode()); | ||
result = prime * result | ||
+ ((this.vdb == null) ? 0 : this.vdb.hashCode()); | ||
return result; | ||
} | ||
|
||
@SuppressWarnings("javadoc") | ||
@Override | ||
public boolean equals(Object obj) { | ||
if (this == obj) | ||
return true; | ||
if (obj == null) | ||
return false; | ||
if (getClass() != obj.getClass()) | ||
return false; | ||
VdbImportVdbEntry other = (VdbImportVdbEntry) obj; | ||
if (this.name == null) { | ||
if (other.name != null) | ||
return false; | ||
} else if (!this.name.equals(other.name)) | ||
return false; | ||
if (this.vdb == null) { | ||
if (other.vdb != null) | ||
return false; | ||
} else if (!this.vdb.equals(other.vdb)) | ||
return false; | ||
return true; | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
plugins/org.teiid.designer.vdb/src/org/teiid/designer/vdb/manifest/ImportVdbElement.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,74 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* | ||
* See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing. | ||
* | ||
* See the AUTHORS.txt file distributed with this work for a full listing of individual contributors. | ||
*/ | ||
package org.teiid.designer.vdb.manifest; | ||
|
||
import java.io.Serializable; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlAttribute; | ||
import javax.xml.bind.annotation.XmlType; | ||
|
||
import org.teiid.designer.vdb.VdbImportVdbEntry; | ||
|
||
/** | ||
* @since 8.0 | ||
*/ | ||
@XmlAccessorType( XmlAccessType.NONE ) | ||
@XmlType( name = "" ) | ||
public class ImportVdbElement implements Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@XmlAttribute( name = "name", required = true ) | ||
private String name; | ||
|
||
@XmlAttribute( name = "version", required = true ) | ||
private int version = 1; | ||
|
||
@XmlAttribute( name = "import-data-policies" ) | ||
private boolean importDataPolicies = true; | ||
|
||
/** | ||
* Used by JAXB | ||
*/ | ||
public ImportVdbElement() { | ||
} | ||
|
||
/** | ||
* Used to save a model entry | ||
* | ||
* @param entry | ||
*/ | ||
ImportVdbElement( final VdbImportVdbEntry entry ) { | ||
name = entry.getName(); | ||
version = entry.getVersion(); | ||
importDataPolicies = entry.isImportDataPolicies(); | ||
} | ||
|
||
/** | ||
* @return name | ||
*/ | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
/** | ||
* @return version | ||
*/ | ||
public int getVersion() { | ||
return version; | ||
} | ||
|
||
/** | ||
* @return importDataPolicies | ||
*/ | ||
public boolean isImportDataPolicies() { | ||
return importDataPolicies; | ||
} | ||
} |
Oops, something went wrong.