Package org.apache.oodt.cas.catalog.util

Examples of org.apache.oodt.cas.catalog.util.Serializer


         Validate.notNull(catalogRepositoryId, "Must specify catalogRepositoryId");
         Validate.notNull(beanRepo, "Must specify beanRepo");

         FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(
               new String[] { this.beanRepo }, false);
         appContext.setClassLoader(new Serializer().getClassLoader());
         appContext.refresh();
         CatalogRepositoryFactory factory = (CatalogRepositoryFactory) appContext
               .getBean(this.catalogRepositoryId, CatalogRepositoryFactory.class);
         CatalogRepository catalogRepository = factory.createRepository();
         Set<Catalog> catalogs = catalogRepository.deserializeAllCatalogs();
View Full Code Here


         Validate.notNull(beanRepo, "Must specify beanRepo");

         FileSystemXmlApplicationContext repoAppContext =
            new FileSystemXmlApplicationContext(
               new String[] { this.beanRepo }, false);
         repoAppContext.setClassLoader(new Serializer().getClassLoader());
         repoAppContext.refresh();
         @SuppressWarnings("unchecked")
         Map<String, Catalog> catalogs = repoAppContext
               .getBeansOfType(Catalog.class);
         for (Catalog catalog : catalogs.values()) {
View Full Code Here

 
  public Set<Catalog> deserializeAllCatalogs()
      throws CatalogRepositoryException {
    try {
          FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(new String[] { this.beanRepo }, false);
          appContext.setClassLoader(new Serializer().getClassLoader());
          appContext.refresh();
          return new HashSet<Catalog>(appContext.getBeansOfType(Catalog.class).values());
    } catch (Exception e) {
      throw new CatalogRepositoryException(e.getMessage(), e);
    }
View Full Code Here

  public Catalog deserializeCatalog(String catalogUrn)
      throws CatalogRepositoryException {
    LOG.log(Level.INFO, "Deserializing Catalog: " + catalogUrn);
    FileInputStream catalogIn = null;
    try {
      return new Serializer().deserializeObject(Catalog.class, catalogIn = new FileInputStream(this.getCatalogFile(catalogUrn)));
    }catch (Exception e) {
      throw new CatalogRepositoryException("Failed to Deserialized Catalogs from '" + this.storageDir + "' : " + e.getMessage(), e);
    }finally {
      try {
        catalogIn.close();
View Full Code Here

      throws CatalogRepositoryException {
    LOG.log(Level.INFO, "Serializing Catalog: " + catalog.getId());
    FileOutputStream catalogOut = null;
    try {
      //serialize Catalog
      new Serializer().serializeObject(catalog, (catalogOut = new FileOutputStream(this.getCatalogFileWorker(catalog.getId()))));
      if (this.getCatalogFile(catalog.getId()).exists())
        FileUtils.copyFile(this.getCatalogFile(catalog.getId()), this.getCatalogFileBkup(catalog.getId()), true);
      FileUtils.copyFile(this.getCatalogFileWorker(catalog.getId()), this.getCatalogFile(catalog.getId()), true);
      this.getCatalogFileWorker(catalog.getId()).delete();
      this.getCatalogFileBkup(catalog.getId()).delete();
View Full Code Here

  public void serializePluginURLs(List<PluginURL> urls)
      throws CatalogRepositoryException {
    FileOutputStream urlsOut = null;
    try {
      //serialize URLs
      new Serializer().serializeObject(urls, (urlsOut = new FileOutputStream(this.getClassLoaderUrlsFileWorker())));
      if (this.getClassLoaderUrlsFile().exists())
        FileUtils.copyFile(this.getClassLoaderUrlsFile(), this.getClassLoaderUrlsFileBkup(), true);
      FileUtils.copyFile(this.getClassLoaderUrlsFileWorker(), this.getClassLoaderUrlsFile(), true);
      this.getClassLoaderUrlsFileWorker().delete();
      this.getClassLoaderUrlsFileBkup().delete();
View Full Code Here

  public List<PluginURL> deserializePluginURLs() throws CatalogRepositoryException {
    FileInputStream urlsIn = null;
    try {
      if (this.getClassLoaderUrlsFile().exists())
        return new Serializer().deserializeObject(List.class, (urlsIn = new FileInputStream(this.getClassLoaderUrlsFile())));
      else
        return Collections.emptyList();
    }catch (Exception e) {
      throw new CatalogRepositoryException("Failed to Deserialized All ClassLoader URLs from '" + this.storageDir + "' : " + e.getMessage(), e);
    }finally {
View Full Code Here

    String propertiesFile = System.getProperty("org.apache.oodt.cas.catalog.properties.file");
    if (propertiesFile != null)
      System.getProperties().load(new FileInputStream(propertiesFile));
    String configFile = PathUtils.doDynamicReplacement(System.getProperty("org.apache.oodt.cas.catalog.server.config.file", "classpath:/org/apache/oodt/cas/catalog/config/catserv-server-config.xml"));
    FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(new String[] { configFile }, false);
    appContext.setClassLoader(new Serializer().getClassLoader());
    appContext.refresh();
        List<CmdLineOptionInstance> optionInstances = CmdLineOptionUtils.loadValidateAndHandleInstances(appContext, args);
        CmdLineOptionInstance instance = CmdLineOptionUtils.getOptionInstanceByName("serverFactoryBeanId", optionInstances);
        CommunicationChannelServerFactory serverFactory = (CommunicationChannelServerFactory) appContext.getBean(instance.getValues().get(0), CommunicationChannelServerFactory.class);
        CommunicationChannelServer communicationChannelServer = serverFactory.createCommunicationChannelServer();
View Full Code Here

  }

  @Override
  public void handleOption(CmdLineOption option, List<String> values) {
    FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext(new String[] { this.beanRepo }, false);
    appContext.setClassLoader(new Serializer().getClassLoader());
    appContext.refresh();
    PrintStream ps = new PrintStream(System.out);
        ps.println("ServerFactories:");
        for (String serverId : appContext.getBeanNamesForType(CommunicationChannelServerFactory.class)) {
          CommunicationChannelServerFactory serverFactory = (CommunicationChannelServerFactory) appContext.getBean(serverId, CommunicationChannelServerFactory.class);
View Full Code Here

  protected CatalogService catalogService;
  protected int port;
  protected Serializer serializer;
 
  public AbstractCommunicationChannelServer() {
    this.serializer = new Serializer();
  }
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.catalog.util.Serializer

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.