/** * Method addInstallation. * * @param installation */ public void addInstallation( Installation installation ) { getInstallations().add( installation ); } //-- void addInstallation( Installation )
/** * Method addProfile. * * @param profile */ public void addProfile( Profile profile ) { getProfiles().add( profile ); } //-- void addProfile( Profile )
/** * Method removeProjectGroup. * * @param projectGroup */ public void removeProjectGroup( ProjectGroup projectGroup ) { getProjectGroups().remove( projectGroup ); } //-- void removeProjectGroup( ProjectGroup )
ContinuumDatabase continuumDatabase = new ContinuumDatabase(); java.util.Set parsed = new java.util.HashSet(); continuumDatabase.setModelEncoding( encoding ); boolean foundRoot = false; while ( xmlStreamReader.hasNext() ) continuumDatabase.setProjectGroups( projectGroups ); while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT ) continuumDatabase.addProjectGroup( parseProjectGroup( "projectGroup", xmlStreamReader, strict, encoding ) ); continuumDatabase.setSystemConfiguration( parseSystemConfiguration( "systemConfiguration", xmlStreamReader, strict, encoding ) ); continuumDatabase.setInstallations( installations ); while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT ) continuumDatabase.addInstallation( parseInstallation( "installation", xmlStreamReader, strict, encoding ) ); continuumDatabase.setSchedules( schedules ); while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT ) continuumDatabase.addSchedule( parseSchedule( "schedule", xmlStreamReader, strict, encoding ) ); continuumDatabase.setProfiles( profiles ); while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT ) continuumDatabase.addProfile( parseProfile( "profile", xmlStreamReader, strict, encoding ) ); continuumDatabase.setLocalRepositories( localRepositories );
ContinuumDatabase database = new ContinuumDatabase(); try database.setSystemConfiguration( systemConfigurationDao.getSystemConfiguration() ); database.setProjectGroups( new ArrayList( projectGroups ) ); try database.setInstallations( installationDao.getAllInstallations() ); database.setBuildDefinitionTemplates( buildDefinitionTemplateDao.getAllBuildDefinitionTemplate() ); database.setBuildQueues( buildQueueDao.getAllBuildQueues() ); database.setBuildDefinitions( buildDefinitionDao.getAllTemplates() ); database.setSchedules( scheduleDao.getAllSchedulesByName() ); database.setProfiles( profileDao.getAllProfilesByName() ); database.setLocalRepositories( localRepositoryDao.getAllLocalRepositories() ); database.setRepositoryPurgeConfigurations( repositoryPurgeConfigurationDao.getAllRepositoryPurgeConfigurations() ); database.setDirectoryPurgeConfigurations( directoryPurgeConfigurationDao.getAllDirectoryPurgeConfigurations() ); database.setDistributedDirectoryPurgeConfigurations( distributedDirectoryPurgeConfigurationDao.getAllDistributedDirectoryPurgeConfigurations() ); database.setProjectScmRoots( projectScmRootDao.getAllProjectScmRoots() ); database.setContinuumReleaseResults( releaseResultDao.getAllContinuumReleaseResults() ); Writer fileWriter = new OutputStreamWriter( out, Charset.forName( database.getModelEncoding() ) );
if ( ( continuumDatabase.getProjectGroups() != null ) && ( continuumDatabase.getProjectGroups().size() > 0 ) ) for ( Iterator iter = continuumDatabase.getProjectGroups().iterator(); iter.hasNext(); ) if ( continuumDatabase.getSystemConfiguration() != null ) writeSystemConfiguration( (SystemConfiguration) continuumDatabase.getSystemConfiguration(), "systemConfiguration", serializer ); if ( ( continuumDatabase.getInstallations() != null ) && ( continuumDatabase.getInstallations().size() > 0 ) ) for ( Iterator iter = continuumDatabase.getInstallations().iterator(); iter.hasNext(); ) if ( ( continuumDatabase.getSchedules() != null ) && ( continuumDatabase.getSchedules().size() > 0 ) ) for ( Iterator iter = continuumDatabase.getSchedules().iterator(); iter.hasNext(); ) if ( ( continuumDatabase.getProfiles() != null ) && ( continuumDatabase.getProfiles().size() > 0 ) ) for ( Iterator iter = continuumDatabase.getProfiles().iterator(); iter.hasNext(); ) if ( ( continuumDatabase.getLocalRepositories() != null ) && ( continuumDatabase.getLocalRepositories().size() > 0 ) ) for ( Iterator iter = continuumDatabase.getLocalRepositories().iterator(); iter.hasNext(); ) if ( ( continuumDatabase.getRepositoryPurgeConfigurations() != null ) && ( continuumDatabase.getRepositoryPurgeConfigurations().size() > 0 ) ) for ( Iterator iter = continuumDatabase.getRepositoryPurgeConfigurations().iterator(); iter.hasNext(); ) if ( ( continuumDatabase.getDirectoryPurgeConfigurations() != null ) && ( continuumDatabase.getDirectoryPurgeConfigurations().size() > 0 ) )
throws IOException, XMLStreamException ContinuumDatabase continuumDatabase = new ContinuumDatabase(); continuumDatabase.setModelEncoding( encoding ); java.util.Set parsed = new java.util.HashSet(); boolean foundRoot = false; continuumDatabase.setProjectGroups( projectGroups ); while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT ) continuumDatabase.addProjectGroup( parseProjectGroup( "projectGroup", xmlStreamReader, strict, encoding ) ); continuumDatabase.setSystemConfiguration( parseSystemConfiguration( "systemConfiguration", xmlStreamReader, strict, encoding ) ); continuumDatabase.setInstallations( installations ); while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT ) continuumDatabase.addInstallation( parseInstallation( "installation", xmlStreamReader, strict, encoding ) ); continuumDatabase.setSchedules( schedules ); while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT ) continuumDatabase.addSchedule( parseSchedule( "schedule", xmlStreamReader, strict, encoding ) ); continuumDatabase.setProfiles( profiles ); while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT ) continuumDatabase.addProfile( parseProfile( "profile", xmlStreamReader, strict, encoding ) );
PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory( properties ); PlexusJdoUtils.addObject( pmf.getPersistenceManager(), database.getSystemConfiguration() ); for ( BuildQueue buildQueue : (List<BuildQueue>) database.getBuildQueues() ) for ( Iterator i = database.getSchedules().iterator(); i.hasNext(); ) for ( Iterator i = database.getInstallations().iterator(); i.hasNext(); ) for ( Iterator i = database.getProfiles().iterator(); i.hasNext(); ) for ( BuildDefinition buildDefinition : (List<BuildDefinition>) database.getBuildDefinitions() ) for ( LocalRepository localRepository : (List<LocalRepository>) database.getLocalRepositories() ) for ( Iterator i = database.getProjectGroups().iterator(); i.hasNext(); ) for ( DirectoryPurgeConfiguration dirPurge : (List<DirectoryPurgeConfiguration>) database.getDirectoryPurgeConfigurations() ) for ( ContinuumReleaseResult releaseResult : (List<ContinuumReleaseResult>) database.getContinuumReleaseResults() ) for ( BuildDefinitionTemplate template : (List<BuildDefinitionTemplate>) database.getBuildDefinitionTemplates() )
public void backupDatabase( File backupDirectory ) throws IOException ContinuumDatabase database = new ContinuumDatabase(); try database.setSystemConfiguration( store.getSystemConfiguration() ); database.setProjectGroups( new ArrayList( projectGroups ) ); try database.setInstallations( store.getAllInstallations() ); database.setSchedules( store.getAllSchedulesByName() ); database.setProfiles( store.getAllProfilesByName() ); Writer fileWriter = new OutputStreamWriter( out, Charset.forName( database.getModelEncoding() ) );
for ( java.util.Iterator i = value.getProjectGroups().iterator(); i.hasNext(); ) for ( java.util.Iterator i = value.getSchedules().iterator(); i.hasNext(); ) for ( java.util.Iterator i = value.getProfiles().iterator(); i.hasNext(); ) for ( java.util.Iterator i = value.getRepositoryPurgeConfigurations().iterator(); i.hasNext(); ) for ( java.util.Iterator i = value.getDirectoryPurgeConfigurations().iterator(); i.hasNext(); ) for ( java.util.Iterator i = value.getDistributedDirectoryPurgeConfigurations().iterator(); i.hasNext(); ) for ( java.util.Iterator i = value.getProjectScmRoots().iterator(); i.hasNext(); ) for ( java.util.Iterator i = value.getContinuumReleaseResults().iterator(); i.hasNext(); ) for ( java.util.Iterator i = value.getBuildDefinitionTemplates().iterator(); i.hasNext(); ) for ( java.util.Iterator i = value.getBuildDefinitions().iterator(); i.hasNext(); )
if ( continuumDatabase.getProjectGroups() != null && continuumDatabase.getProjectGroups().size() > 0 ) for ( Iterator iter = continuumDatabase.getProjectGroups().iterator(); iter.hasNext(); ) if ( continuumDatabase.getSystemConfiguration() != null ) writeSystemConfiguration( (SystemConfiguration) continuumDatabase.getSystemConfiguration(), "systemConfiguration", serializer ); if ( continuumDatabase.getInstallations() != null && continuumDatabase.getInstallations().size() > 0 ) for ( Iterator iter = continuumDatabase.getInstallations().iterator(); iter.hasNext(); ) if ( continuumDatabase.getSchedules() != null && continuumDatabase.getSchedules().size() > 0 ) for ( Iterator iter = continuumDatabase.getSchedules().iterator(); iter.hasNext(); ) if ( continuumDatabase.getProfiles() != null && continuumDatabase.getProfiles().size() > 0 ) for ( Iterator iter = continuumDatabase.getProfiles().iterator(); iter.hasNext(); )
/** * Method resolveReferences * * @param value */ private void resolveReferences(ContinuumDatabase value) { java.util.Map refs; for ( java.util.Iterator i = value.getProjectGroups().iterator(); i.hasNext(); ) { resolveReferences( (ProjectGroup) i.next() ); } for ( java.util.Iterator i = value.getProfiles().iterator(); i.hasNext(); ) { resolveReferences( (Profile) i.next() ); } } //-- void resolveReferences(ContinuumDatabase)
/** * Method removeSchedule. * * @param schedule */ public void removeSchedule( Schedule schedule ) { getSchedules().remove( schedule ); } //-- void removeSchedule( Schedule )
/** * Method write * * @param writer * @param continuumDatabase */ public void write(Writer writer, ContinuumDatabase continuumDatabase) throws java.io.IOException, XMLStreamException { XMLOutputFactory factory = XMLOutputFactory.newInstance(); boolean supportWindowsLineEndings = false; if ( factory.isPropertySupported( "com.ctc.wstx.outputEscapeCr" ) ) { factory.setProperty( "com.ctc.wstx.outputEscapeCr", Boolean.FALSE ); supportWindowsLineEndings = true; } if ( factory.isPropertySupported( "org.codehaus.stax2.automaticEmptyElements" ) ) { factory.setProperty( "org.codehaus.stax2.automaticEmptyElements", Boolean.FALSE ); } IndentingXMLStreamWriter serializer = new IndentingXMLStreamWriter( factory.createXMLStreamWriter( writer ) ); if ( supportWindowsLineEndings ) { serializer.setNewLine( serializer.getLineSeparator() ); } serializer.writeStartDocument( continuumDatabase.getModelEncoding(), "1.0" ); writeContinuumDatabase( continuumDatabase, "continuumDatabase", serializer ); serializer.writeEndDocument(); } //-- void write(Writer, ContinuumDatabase)
PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory( properties ); PlexusJdoUtils.addObject( pmf.getPersistenceManager(), database.getSystemConfiguration() ); for ( Iterator i = database.getSchedules().iterator(); i.hasNext(); ) for ( Iterator i = database.getInstallations().iterator(); i.hasNext(); ) for ( Iterator i = database.getProfiles().iterator(); i.hasNext(); ) for ( Iterator i = database.getProjectGroups().iterator(); i.hasNext(); )
/** * Method addSchedule. * * @param schedule */ public void addSchedule( Schedule schedule ) { getSchedules().add( schedule ); } //-- void addSchedule( Schedule )
serializer.writeStartDocument( continuumDatabase.getModelEncoding(), "1.0" ); writeContinuumDatabase( continuumDatabase, "continuumDatabase", serializer ); serializer.writeEndDocument();
/** * Method removeProfile. * * @param profile */ public void removeProfile( Profile profile ) { getProfiles().remove( profile ); } //-- void removeProfile( Profile )
/** * Method removeInstallation. * * @param installation */ public void removeInstallation( Installation installation ) { getInstallations().remove( installation ); } //-- void removeInstallation( Installation )
/** * Method addSchedule * * @param schedule */ public void addSchedule(Schedule schedule) { if ( !(schedule instanceof Schedule) ) { throw new ClassCastException( "ContinuumDatabase.addSchedules(schedule) parameter must be instanceof " + Schedule.class.getName() ); } getSchedules().add( schedule ); } //-- void addSchedule(Schedule)