use of com.centurylink.mdw.plugin.project.model.VcsRepository in project mdw-designer by CenturyLinkCloud.
the class ProjectPersist method saveProjectPrefs.
/**
* Preferences may be local to a particular user, so save with workspace
* prefs
*/
public void saveProjectPrefs(IProject project) {
ServerSettings serverSettings = workflowProject.getServerSettings();
try {
setPersistentProperty(project, MDW_SERVER_HOME, serverSettings.getHome());
setPersistentProperty(project, MDW_SERVER_JDK_HOME, serverSettings.getJdkHome());
setPersistentProperty(project, MDW_SERVER_LOCATION, serverSettings.getServerLoc());
int cmdPort = serverSettings.getCommandPort();
if (cmdPort != 0)
setPersistentProperty(project, MDW_SERVER_CMD_PORT, String.valueOf(cmdPort));
String user = serverSettings.getUser();
setPersistentProperty(project, MDW_SERVER_USER, user);
if (user != null) {
String password = serverSettings.getPassword();
if (password != null) {
try {
setPersistentProperty(project, MDW_SERVER_PASSWORD, CryptUtil.encrypt(password));
} catch (GeneralSecurityException ex) {
PluginMessages.log(ex);
}
}
}
if (!workflowProject.isRemote()) {
// default prefs for server type
setPersistentProperty(MDW_SERVER_TYPE, serverSettings.getContainerType().toString());
setPersistentProperty(serverSettings.getContainerType() + "-" + MDW_SERVER_HOME, serverSettings.getHome());
setPersistentProperty(serverSettings.getContainerType() + "-" + MDW_SERVER_JDK_HOME, serverSettings.getJdkHome());
setPersistentProperty(serverSettings.getContainerType() + "-" + MDW_SERVER_HOST, serverSettings.getHost());
setPersistentProperty(serverSettings.getContainerType() + "-" + MDW_SERVER_PORT, String.valueOf(serverSettings.getPort() == 0 ? "" : serverSettings.getPort()));
setPersistentProperty(serverSettings.getContainerType() + "-" + MDW_SERVER_CMD_PORT, String.valueOf(serverSettings.getCommandPort() == 0 ? "" : serverSettings.getCommandPort()));
setPersistentProperty(serverSettings.getContainerType() + "-" + MDW_SERVER_USER, serverSettings.getUser());
setPersistentProperty(serverSettings.getContainerType() + "-" + MDW_SERVER_VERSION, serverSettings.getContainerVersion());
if (workflowProject.getPersistType() == PersistType.Git) {
VcsRepository vcsRepo = workflowProject.getMdwVcsRepository();
setPersistentProperty("MDW" + workflowProject.getMdwVersion() + "-" + MDW_VCS_GIT, vcsRepo.getProvider());
setPersistentProperty("MDW" + workflowProject.getMdwVersion() + "-" + MDW_VCS_REPO_URL, vcsRepo.getRepositoryUrl());
setPersistentProperty("MDW" + workflowProject.getMdwVersion() + "-" + MDW_VCS_USER, vcsRepo.getUser());
}
JdbcDataSource dataSource = workflowProject.getMdwDataSource();
setPersistentProperty("MDW" + workflowProject.getMdwVersion() + "-" + MDW_DB_DRIVER, dataSource.getDriver());
setPersistentProperty("MDW" + workflowProject.getMdwVersion() + "-" + MDW_DB_URL, dataSource.getJdbcUrl());
setPersistentProperty("MDW" + workflowProject.getMdwVersion() + "-" + MDW_DB_USER, dataSource.getDbUser());
setPersistentProperty(serverSettings.getContainerType() + "-" + MDW_SERVER_JAVA_OPTS, serverSettings.getJavaOptions());
}
if (serverSettings.isDebug()) {
setPersistentProperty(project, MDW_SERVER_DEBUG, "true");
setPersistentProperty(project, MDW_SERVER_DEBUG_PORT, String.valueOf(serverSettings.getDebugPort()));
setPersistentProperty(project, MDW_SERVER_SUSPEND, String.valueOf(serverSettings.isSuspend()));
} else {
setPersistentProperty(project, MDW_SERVER_DEBUG, null);
}
setPersistentProperty(project, LOG_WATCHER_PORT, String.valueOf(serverSettings.getLogWatcherPort()));
setPersistentProperty(project, LOG_WATCHER_TIMEOUT, String.valueOf(serverSettings.getLogWatcherTimeout()));
setPersistentProperty(project, STUB_SERVER_PORT, String.valueOf(serverSettings.getStubServerPort()));
setPersistentProperty(project, STUB_SERVER_TIMEOUT, String.valueOf(serverSettings.getStubServerTimeout()));
if (workflowProject.getPersistType() == PersistType.Git) {
setPersistentProperty(project, MDW_VCS_SYNC_ARCHIVE, String.valueOf(workflowProject.getMdwVcsRepository().isSyncAssetArchive()));
}
setPersistentProperty(project, MDW_UPDATE_SERVER_CACHE, String.valueOf(workflowProject.isUpdateServerCache()));
} catch (CoreException ex) {
PluginMessages.log(ex);
}
}
use of com.centurylink.mdw.plugin.project.model.VcsRepository in project mdw-designer by CenturyLinkCloud.
the class ProjectInflator method createGitRepository.
public void createGitRepository(IProgressMonitor monitor) {
try {
File localDir = new File(ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile() + "/" + workflowProject.getName());
Repository newRepo = null;
if (workflowProject.getMdwVcsRepository().hasRemoteRepository()) {
monitor.subTask("Cloning Git repository");
VcsRepository gitRepo = workflowProject.getMdwVcsRepository();
Git.cloneRepository().setURI(gitRepo.getRepositoryUrlWithCredentials()).setDirectory(localDir).call();
} else {
newRepo = new FileRepository(new File(localDir + "/.git"));
newRepo.create();
}
// .gitignore
Generator generator = new Generator(shell);
JetAccess jet = getJet("source/.ignorejet", getProject().getSourceProject(), ".gitignore", null);
generator.createFile(jet, monitor);
} catch (Exception ex) {
PluginMessages.uiError(ex, "Create Cloud Project", workflowProject);
}
}
Aggregations