congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ConfigFileInfo
Code IndexAdd Tabnine to your IDE (free)

How to use
ConfigFileInfo
in
org.apache.karaf.features

Best Java code snippets using org.apache.karaf.features.ConfigFileInfo (Showing top 11 results out of 315)

origin: org.opendaylight.controller/config-persister-feature-adapter

protected Optional<FeatureConfigSnapshotHolder> getFeatureConfigSnapshotHolder(final ConfigFileInfo c) {
  try {
    return Optional.of(new FeatureConfigSnapshotHolder(c, this));
  } catch (final JAXBException e) {
    LOG.warn("Unable to parse configuration snapshot. Config from '{}' will be IGNORED. " +
        "Note that subsequent config files may fail due to this problem. " +
        "Xml markup in this file needs to be fixed, for detailed information see enclosed exception.",
        c.getFinalname(), e);
  } catch (final XMLStreamException e) {
    // Files that cannot be loaded are ignored as non config subsystem files e.g. jetty.xml
    LOG.debug("Unable to read configuration file '{}'. Not a configuration snapshot",
        c.getFinalname(), e);
  }
  return Optional.absent();
}
origin: apache/karaf

installConfigurationFile(configFile.getLocation(), configFile.getFinalname(),
             configFile.isOverride());
origin: apache/karaf

private void copyFeatureToJar(JarOutputStream jos, Feature feature, Map<URI, Integer> locationMap)
  throws URISyntaxException {
  // add bundles
  for (BundleInfo bundleInfo : feature.getBundles()) {
    URI location = new URI(bundleInfo.getLocation().trim());
    copyResourceToJar(jos, location, locationMap);
  }
  // add config files
  for (ConfigFileInfo configFileInfo : feature.getConfigurationFiles()) {
    URI location = new URI(configFileInfo.getLocation().trim());
    copyResourceToJar(jos, location, locationMap);
  }
  // add bundles and config files in conditionals
  for (Conditional conditional : feature.getConditional()) {
    for (BundleInfo bundleInfo : conditional.getBundles()) {
      URI location = new URI(bundleInfo.getLocation().trim());
      copyResourceToJar(jos, location, locationMap);
    }
    for (ConfigFileInfo configFileInfo : conditional.getConfigurationFiles()) {
      URI location = new URI(configFileInfo.getLocation().trim());
      copyResourceToJar(jos, location, locationMap);
    }
  }
}
origin: org.apache.karaf.tooling/karaf-maven-plugin

/**
 * Read bundles and configuration files in the features file.
 *
 * @return
 * @throws MojoExecutionException
 */
private List<Artifact> readResources(File featuresFile) throws MojoExecutionException {
  List<Artifact> resources = new ArrayList<>();
  try {
    Features features = JaxbUtil.unmarshal(featuresFile.toURI().toASCIIString(), false);
    for (Feature feature : features.getFeature()) {
      for (BundleInfo bundle : feature.getBundles()) {
        if (ignoreDependencyFlag || (!ignoreDependencyFlag && !bundle.isDependency())) {
          resources.add(resourceToArtifact(bundle.getLocation(), false));
        }
      }
      for (ConfigFileInfo configFile : feature.getConfigurationFiles()) {
        resources.add(resourceToArtifact(configFile.getLocation(), false));
      }
    }
    return resources;
  } catch (MojoExecutionException e) {
    throw e;
  } catch (Exception e) {
    throw new MojoExecutionException("Could not interpret features.xml", e);
  }
}
origin: org.apache.karaf.features/org.apache.karaf.features.command

private void displayConfigFileInformation(Feature feature, String contentType) {
  List<ConfigFileInfo> configurationFiles = feature.getConfigurationFiles();
  if (configurationFiles.isEmpty()) {
    System.out.println(contentType + " has no configuration files");
  } else {
    System.out.println(contentType + " configuration files: ");
    for (ConfigFileInfo configFileInfo : configurationFiles) {
      System.out.println(INDENT + configFileInfo.getFinalname());
    }
  }        
}
origin: apache/karaf

/**
 * Read bundles and configuration files in the features file.
 *
 * @return
 * @throws MojoExecutionException
 */
private List<Artifact> readResources(File featuresFile) throws MojoExecutionException {
  List<Artifact> resources = new ArrayList<>();
  try {
    Features features = JaxbUtil.unmarshal(featuresFile.toURI().toASCIIString(), false);
    for (Feature feature : features.getFeature()) {
      for (BundleInfo bundle : feature.getBundles()) {
        if (ignoreDependencyFlag || (!ignoreDependencyFlag && !bundle.isDependency())) {
          resources.add(resourceToArtifact(bundle.getLocation(), false));
        }
      }
      for (ConfigFileInfo configFile : feature.getConfigurationFiles()) {
        resources.add(resourceToArtifact(configFile.getLocation(), false));
      }
    }
    return resources;
  } catch (MojoExecutionException e) {
    throw e;
  } catch (Exception e) {
    throw new MojoExecutionException("Could not interpret features.xml", e);
  }
}
origin: apache/karaf

private void displayConfigFileInformation(Feature feature, String contentType) {
  List<ConfigFileInfo> configurationFiles = feature.getConfigurationFiles();
  if (configurationFiles.isEmpty()) {
    System.out.println(contentType + " has no configuration files");
  } else {
    System.out.println(contentType + " configuration files: ");
    for (ConfigFileInfo configFileInfo : configurationFiles) {
      System.out.println(INDENT + configFileInfo.getFinalname());
    }
  }        
}
origin: org.opendaylight.controller/config-persister-feature-adapter

public FeatureConfigSnapshotHolder(final ConfigFileInfo fileInfo, final Feature feature) throws JAXBException, XMLStreamException {
  Preconditions.checkNotNull(fileInfo);
  Preconditions.checkNotNull(fileInfo.getFinalname());
  Preconditions.checkNotNull(feature);
  this.fileInfo = fileInfo;
  this.featureChain.add(feature);
  // TODO extract utility method for umarshalling config snapshots
  JAXBContext jaxbContext = JAXBContext.newInstance(ConfigSnapshot.class);
  Unmarshaller um = jaxbContext.createUnmarshaller();
  XMLInputFactory xif = XMLInputFactory.newFactory();
  xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
  xif.setProperty(XMLInputFactory.SUPPORT_DTD, false);
  XMLStreamReader xsr = xif.createXMLStreamReader(new StreamSource(new File(fileInfo.getFinalname())));
  unmarshalled = ((ConfigSnapshot) um.unmarshal(xsr));
}
/*
origin: org.opendaylight.controller/config-persister-feature-adapter

@Override
public String toString() {
  StringBuilder b = new StringBuilder();
  Path p = Paths.get(fileInfo.getFinalname());
  b.append(p.getFileName())
    .append("(")
    .append(getCauseFeature())
    .append(",")
    .append(getFeature())
    .append(")");
  return b.toString();
}
origin: apache/karaf

static TabularData getConfigFileList(List<ConfigFileInfo> configFiles) throws OpenDataException {
  TabularDataSupport table = new TabularDataSupport(FEATURE_CONFIG_FILES_TABLE);
  for (ConfigFileInfo configFile : configFiles) {
    String[] itemNames = FeaturesServiceMBean.FEATURE_CONFIG_FILES;
    Object[] itemValues = {configFile.getFinalname()};
    CompositeData config = new CompositeDataSupport(FEATURE_CONFIG_FILES, itemNames, itemValues);
    table.put(config);
  }
  return table;
}
origin: org.opendaylight.controller/config-persister-feature-adapter

public LinkedHashSet<FeatureConfigSnapshotHolder> getFeatureConfigSnapshotHolders() throws Exception {
  final LinkedHashSet <FeatureConfigSnapshotHolder> snapShotHolders = new LinkedHashSet<>();
  for(final ConfigFileInfo c: getConfigurationFiles()) {
    // Skip non config snapshot XML files
    if(isConfigSnapshot(c.getFinalname())) {
      final Optional<FeatureConfigSnapshotHolder> featureConfigSnapshotHolder = getFeatureConfigSnapshotHolder(c);
      if(featureConfigSnapshotHolder.isPresent()) {
        snapShotHolders.add(featureConfigSnapshotHolder.get());
      }
    }
  }
  return snapShotHolders;
}
org.apache.karaf.featuresConfigFileInfo

Most used methods

  • getFinalname
  • getLocation
  • isOverride

Popular in Java

  • Reactive rest calls using spring rest template
  • getContentResolver (Context)
  • putExtra (Intent)
  • getSystemService (Context)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Option (scala)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now