public EPackage[] loadPackages(CDOPackageUnit packageUnit) { if (packageUnit.getOriginalType().isGenerated()) { if (!options().isGeneratedPackageEmulationEnabled()) { throw new CDOException(MessageFormat.format(Messages.getString("CDOSessionImpl.0"), packageUnit)); //$NON-NLS-1$ } } return getSessionProtocol().loadPackages(packageUnit); }
Type type = CDOPackageUnit.Type.valueOf(attributes.getValue(PACKAGE_UNIT_TYPE)); long time = Long.parseLong(attributes.getValue(PACKAGE_UNIT_TIME)); String data = attributes.getValue(PACKAGE_UNIT_DATA);
public boolean handle(int row, final Object... values) { int index = DBUtil.asInt(values[1]); long timestamp = DBUtil.asLong(values[2]); InternalCDOPackageUnit packageUnit = createPackageUnit(); packageUnit.setOriginalType(CDOPackageUnit.Type.values()[index]); packageUnit.setTimeStamp(timestamp); packageUnits.put((String)values[0], packageUnit); return true; } };
stmt.setInt(2, packageUnit.getOriginalType().ordinal()); stmt.setLong(3, packageUnit.getTimeStamp()); stmt.setBytes(4, getEPackageBytes(packageUnit));
private DBObject[] marshallUnits(InternalCDOPackageUnit[] packageUnits) { DBObject[] result = new DBObject[packageUnits.length]; InternalCDOPackageRegistry packageRegistry = store.getRepository().getPackageRegistry(); for (int i = 0; i < packageUnits.length; i++) { InternalCDOPackageUnit packageUnit = packageUnits[i]; EPackage ePackage = packageUnit.getTopLevelPackageInfo().getEPackage(); byte[] bytes = EMFUtil.getEPackageBytes(ePackage, ZIP_PACKAGE_BYTES, packageRegistry); DBObject[] packages = marshallPackages(packageUnit.getPackageInfos()); DBObject doc = new BasicDBObject(); doc.put(UNITS_ID, packageUnit.getID()); doc.put(UNITS_TYPE, packageUnit.getOriginalType().toString()); doc.put(UNITS_DATA, bytes); doc.put(PACKAGES, packages); result[i] = doc; } return result; }
@Override protected Object handleEmbedded(DBObject doc, DBObject embedded) { long time = (Long)doc.get(COMMITS_ID); CDOPackageUnit.Type type = CDOPackageUnit.Type.valueOf((String)embedded.get(UNITS_TYPE)); InternalCDOPackageInfo[] infos = readPackageInfos(embedded); InternalCDOPackageUnit packageUnit = createPackageUnit(); packageUnit.setOriginalType(type); packageUnit.setTimeStamp(time); packageUnit.setPackageInfos(infos); packageUnits.add(packageUnit); return null; }
public CDOPackageUnit.Type readCDOPackageUnitType() throws IOException { return CDOPackageUnit.Type.values()[readByte()]; }
public EPackage[] loadPackages(CDOPackageUnit packageUnit) { if (packageUnit.getOriginalType().isGenerated()) { if (!options().isGeneratedPackageEmulationEnabled()) { throw new CDOException(MessageFormat.format(Messages.getString("CDOSessionImpl.0"), packageUnit)); //$NON-NLS-1$ } } return getSessionProtocol().loadPackages(packageUnit); }
public void writeCDOPackageUnitType(CDOPackageUnit.Type type) throws IOException { writeByte(type.ordinal()); }
/** * Returns <code>true</code> if this type is either {@link #NATIVE} or {@link #LEGACY}, <code>false</code> * otherwise. */ public boolean isGenerated() { checkNotUnknown(); return this == NATIVE || this == LEGACY; }