Package org.apache.ivy.ant

Examples of org.apache.ivy.ant.IvyConfigure$Credentials


    /**
     *
     */
    private void configureProjectIvyinstance(String projectIvyInstanceName) {
        IvyConfigure projectIvyInstance = new IvyConfigure();
        projectIvyInstance.setSettingsId(projectIvyInstanceName);
        boolean ivysettingsConfigured = false;
        // project ivy settings can be specified by properties
        if (getProject().getProperty(EasyAntMagicNames.PROJECT_IVY_SETTING_FILE) != null) {
            File projectIvyFile = new File(getProject().getProperty(EasyAntMagicNames.PROJECT_IVY_SETTING_FILE));

            if (projectIvyFile.exists()) {
                projectIvyInstance.setFile(projectIvyFile);
                ivysettingsConfigured = true;
            }

        }
        if (getProject().getProperty(EasyAntMagicNames.PROJECT_IVY_SETTING_URL) != null) {
            String url = getProject().getProperty(EasyAntMagicNames.PROJECT_IVY_SETTING_URL);
            try {
                projectIvyInstance.setUrl(url);
                ivysettingsConfigured = true;
            } catch (MalformedURLException malformedUrl) {
                throw new BuildException("Unable to parse project ivysettings from the following url : " + url,
                        malformedUrl);
            }
        }
        // if no property is set check the default user location
        if (null == null) {
            File userProjectIvyFile = new File(getProject().replaceProperties(
                    EasyAntConstants.DEFAULT_USER_PROJECT_IVYSETTINGS));
            if (userProjectIvyFile.exists()) {
                projectIvyInstance.setFile(userProjectIvyFile);
                ivysettingsConfigured = true;
            }
        }
        // set default project ivy settings location accessible through properties,
        // then users can import it if they don't want to use it directly
        String defaultUrl = this.getClass().getResource("/org/apache/easyant/core/default-project-ivysettings.xml")
                .toExternalForm();
        getProject().setNewProperty(EasyAntMagicNames.PROJECT_DEFAULT_IVYSETTINGS, defaultUrl);
        if (!ivysettingsConfigured) {
            File localSettings = new File(buildModule.getParent(), "ivysettings.xml");
            if (localSettings.exists()) {
                getProject().log("loading local project settings file...", Project.MSG_VERBOSE);
                projectIvyInstance.setFile(localSettings);
                getProject()
                        .setNewProperty(EasyAntMagicNames.PROJECT_IVY_SETTING_FILE, localSettings.getAbsolutePath());

            } else {
                getProject().log("no settings file found, using default...", Project.MSG_VERBOSE);
                getProject().setNewProperty(EasyAntMagicNames.PROJECT_IVY_SETTING_URL, defaultUrl.toString());
                try {
                    projectIvyInstance.setUrl(defaultUrl);
                } catch (MalformedURLException e) {
                    throw new BuildException("Unable to parse project ivysettings from the following url : "
                            + defaultUrl, e);
                }
            }
View Full Code Here


     * @param project
     *            project instance
     * @return a configured {@link IvyAntSettings} instance
     */
    public IvyAntSettings configureEasyAntIvyInstance(Project project) {
        IvyConfigure easyantIvyConfigure = new IvyConfigure();
        easyantIvyConfigure.setSettingsId(EasyAntMagicNames.EASYANT_IVY_INSTANCE);

        project.setNewProperty(EasyAntMagicNames.EASYANT_DEFAULT_IVYSETTINGS,
                this.getClass().getResource("/org/apache/easyant/core/default-easyant-ivysettings.xml")
                        .toExternalForm());

        project.setNewProperty(EasyAntMagicNames.EASYANT_CORE_JAR_URL, guessEasyantCoreJarUrl().toExternalForm());

        try {
            File userSettings = getUserEasyAntIvySettings(project);
            URL globalSettings = getGlobalEasyAntIvySettings(project);
            boolean isIgnoringUserIvysettings = Project.toBoolean(project
                    .getProperty(EasyAntMagicNames.IGNORE_USER_IVYSETTINGS));

            if (userSettings.exists() && !isIgnoringUserIvysettings) {
                project.log("loading user's easyant ivysettings file from " + userSettings.getAbsolutePath(),
                        Project.MSG_DEBUG);
                easyantIvyConfigure.setFile(userSettings);
            } else if (globalSettings != null) {
                project.log("loading global easyant ivysettings file from " + globalSettings.toExternalForm(),
                        Project.MSG_DEBUG);
                easyantIvyConfigure.setUrl(globalSettings);

            } else {
                project.log("using easyant default ivy settings file", Project.MSG_VERBOSE);
                String url = project.getProperty(EasyAntMagicNames.EASYANT_DEFAULT_IVYSETTINGS);
                easyantIvyConfigure.setUrl(url);
            }
        } catch (MalformedURLException malformedUrl) {
            throw new BuildException("Unable to parse easyant ivysettings from given url", malformedUrl);
        }

View Full Code Here

      return;
   
    String serviceName = "host/" + remoteHost.getHost();
    if (LOG.isDebugEnabled())
      LOG.debug("Fetching service ticket for host at: " + serviceName);
    Credentials serviceCred = null;
    try {
      PrincipalName principal = new PrincipalName(serviceName,
          PrincipalName.KRB_NT_SRV_HST);
      serviceCred = Credentials.acquireServiceCreds(principal
          .toString(), Krb5Util.ticketToCreds(getTgtFromSubject()));
View Full Code Here

      return;
   
    String serviceName = "host/" + remoteHost.getHost();
    if (LOG.isDebugEnabled())
      LOG.debug("Fetching service ticket for host at: " + serviceName);
    Credentials serviceCred = null;
    try {
      PrincipalName principal = new PrincipalName(serviceName,
          PrincipalName.KRB_NT_SRV_HST);
      serviceCred = Credentials.acquireServiceCreds(principal
          .toString(), Krb5Util.ticketToCreds(getTgtFromSubject()));
View Full Code Here

  return true;
    }

    private Credentials renewCredentials(Credentials creds)
    {
  Credentials lcreds;
  try {
      if (!creds.isRenewable())
    throw new RefreshFailedException("This ticket" +
        " is not renewable");
      if (System.currentTimeMillis() > cred.getRenewTill().getTime())
View Full Code Here

      return;
   
    String serviceName = "host/" + remoteHost.getHost();
    if (LOG.isDebugEnabled())
      LOG.debug("Fetching service ticket for host at: " + serviceName);
    Credentials serviceCred = null;
    try {
      PrincipalName principal = new PrincipalName(serviceName,
          PrincipalName.KRB_NT_SRV_HST);
      serviceCred = Credentials.acquireServiceCreds(principal
          .toString(), Krb5Util.ticketToCreds(getTgtFromSubject()));
View Full Code Here

      return;
   
    String serviceName = "host/" + remoteHost.getHost();
    if (LOG.isDebugEnabled())
      LOG.debug("Fetching service ticket for host at: " + serviceName);
    Credentials serviceCred = null;
    try {
      PrincipalName principal = new PrincipalName(serviceName,
          PrincipalName.KRB_NT_SRV_HST);
      serviceCred = Credentials.acquireServiceCreds(principal
          .toString(), Krb5Util.ticketToCreds(getTgtFromSubject()));
View Full Code Here

        return true;
    }

    private Credentials renewCredentials(Credentials creds)
    {
        Credentials lcreds;
        try {
            if (!creds.isRenewable())
                throw new RefreshFailedException("This ticket" +
                                " is not renewable");
            if (System.currentTimeMillis() > cred.getRenewTill().getTime())
View Full Code Here

        return true;
    }

    private Credentials renewCredentials(Credentials creds)
    {
        Credentials lcreds;
        try {
            if (!creds.isRenewable())
                throw new RefreshFailedException("This ticket" +
                                " is not renewable");
            if (System.currentTimeMillis() > cred.getRenewTill().getTime())
View Full Code Here

            fromAcc = true;
        }

        // 5. Try to get service ticket using TGT
        if (tgt != null) {
            Credentials tgtCreds = ticketToCreds(tgt);
            Credentials serviceCreds = Credentials.acquireServiceCreds(
                        serverPrincipal, tgtCreds);
            if (serviceCreds != null) {
                ticket = credsToTicket(serviceCreds);

                // Store service ticket in acc's Subject
View Full Code Here

TOP

Related Classes of org.apache.ivy.ant.IvyConfigure$Credentials

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.