Java Code Examples for org.jboss.forge.furnace.util.OperatingSystemUtils

The following examples show how to use org.jboss.forge.furnace.util.OperatingSystemUtils. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: fabric8-forge   Source File: NewComponentInstanceTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testSomething() throws Exception {
    File tempDir = OperatingSystemUtils.createTempDir();
    try {
        Project project = projectFactory.createTempProject();
        Assert.assertNotNull("Should have created a project", project);

        CommandController command = testHarness.createCommandController(CamelSetupCommand.class, project.getRoot());
        command.initialize();
        command.setValueFor("kind", "camel-spring");

        Result result = command.execute();
        Assert.assertFalse("Should setup Camel in the project", result instanceof Failed);

        command = testHarness.createCommandController(CamelGetComponentsCommand.class, project.getRoot());
        command.initialize();

        result = command.execute();
        Assert.assertFalse("Should not fail", result instanceof Failed);

        String message = result.getMessage();
        System.out.println(message);
    } finally {
        tempDir.delete();
    }
}
 
Example 2
private MutableAddonRepository selectTargetRepository(RepositoryLocationAware<?> archive)
{
   MutableAddonRepository target = repository;
   if (archive instanceof RepositoryLocationAware<?>
            && ((RepositoryLocationAware<?>) archive).getAddonRepository() != null)
   {
      final String repositoryName = ((RepositoryLocationAware<?>) archive).getAddonRepository();
      if (deploymentRepositories.get(repositoryName) == null)
      {
         target = waitForConfigurationRescan(new Callable<MutableAddonRepository>()
         {
            @Override
            public MutableAddonRepository call() throws Exception
            {
               return (MutableAddonRepository) runnable.furnace.addRepository(AddonRepositoryMode.MUTABLE,
                        new File(addonDir, OperatingSystemUtils.getSafeFilename(repositoryName)));
            }
         });
         deploymentRepositories.put(repositoryName, target);
      }
      else
         target = deploymentRepositories.get(repositoryName);
   }
   return target;
}
 
Example 3
@Test
public void testContainerStartup() throws Exception
{
   Furnace furnace = FurnaceFactory.getInstance();
   TestLifecycleListener listener = new TestLifecycleListener();
   ListenerRegistration<ContainerLifecycleListener> registration = furnace.addContainerLifecycleListener(listener);
   File temp = OperatingSystemUtils.createTempDir();
   temp.deleteOnExit();
   furnace.addRepository(AddonRepositoryMode.IMMUTABLE, temp);

   furnace.startAsync();
   waitUntilStarted(furnace);
   Assert.assertEquals(1, listener.beforeStartTimesCalled);
   Assert.assertEquals(1, listener.afterStartTimesCalled);
   registration.removeListener();
   furnace.stop();
}
 
Example 4
Source Project: furnace   Source File: CORBALookupTest.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void testGetJDKProvidedCORBA()
{
   assumeTrue(OperatingSystemUtils.isJava8());
   try
   {
      getClass().getClassLoader().loadClass("javax.rmi.CORBA.Tie");
      getClass().getClassLoader().loadClass("javax.rmi.CORBA.ClassDesc");
      getClass().getClassLoader().loadClass("javax.rmi.CORBA.PortableRemoteObjectDelegate");
      getClass().getClassLoader().loadClass("org.omg.CORBA.Any");
   }
   catch (Exception e)
   {
      Assert.fail("Could not load required CORBA class." + e.getMessage());
   }
}
 
Example 5
Source Project: furnace   Source File: Files.java    License: Eclipse Public License 1.0 6 votes vote down vote up
public static boolean delete(File file, final boolean recursive)
{
   Assert.notNull(file, "File to delete must not be null.");

   boolean result = false;
   if (recursive)
   {
      result = _deleteRecursive(file, true);
   }
   else
   {
      if ((file.listFiles() != null) && (file.listFiles().length != 0))
      {
         throw new RuntimeException("directory not empty");
      }

      if (OperatingSystemUtils.isWindows())
      {
         System.gc(); // ensure no lingering handles that would prevent deletion
      }

      result = file.delete();
   }
   return result;
}
 
Example 6
@Override
public File getAddonBaseDir(final AddonId found)
{
   Assert.notNull(found, "Addon must be specified.");
   Assert.notNull(found.getVersion(), "Addon version must be specified.");
   Assert.notNull(found.getName(), "Addon name must be specified.");

   return lock.performLocked(LockMode.READ, new Callable<File>()
   {
      @Override
      public File call() throws Exception
      {
         File addonDir = new File(getRootDirectory(), OperatingSystemUtils.getSafeFilename(found.toCoordinates()));
         return addonDir;
      }
   });
}
 
Example 7
Source Project: furnace   Source File: AddonRepositoryImplTest.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void testPluggableStateRepository() throws Exception
{
   Furnace furnace = new FurnaceImpl();
   File temp = OperatingSystemUtils.createTempDir();
   MutableAddonRepositoryStorageStrategy storageRepository = new AddonRepositoryStorageStrategyImpl(furnace.getLockManager(), temp);

   MutableAddonRepositoryStateStrategy stateRepository = new TestInMemoryAddonRepositoryStateStrategy();
   MutableAddonRepository repository = new AddonRepositoryImpl(storageRepository, stateRepository, temp);

   AddonId addon = TestInMemoryAddonRepositoryStateStrategy.TEST_ADDON;

   repository.enable(addon);
   Assert.assertTrue(repository.isEnabled(addon));

   // Delete storage directory to demonstrate that filesystem is not used to store the state
   Files.delete(temp, true);

   // Addon still enabled state wasn't affected
   Assert.assertTrue(repository.isEnabled(addon));
}
 
Example 8
Source Project: windup   Source File: IssueCategoryRegistry.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Adds a {@link IssueCategory} to the registry and throws a {@link DuplicateIssueCategoryException} if the item already exists.
 */
public void addCategory(IssueCategory category) throws DuplicateIssueCategoryException
{
    IssueCategory original = this.issueCategories.get(category.getCategoryID());

    // Just overwrite it if it was a placeholder
    if (original != null && !original.isPlaceholder())
    {
        StringBuilder message = new StringBuilder("Issue category (ID: ").append(category.getCategoryID())
                    .append(") is defined at the following locations:");
        message.append(OperatingSystemUtils.getLineSeparator());
        message.append("\t1: " + original.getOrigin());
        message.append("\t2: " + category.getOrigin());

        throw new DuplicateIssueCategoryException(message.toString());
    }

    this.issueCategories.put(category.getCategoryID(), category);
}
 
Example 9
Source Project: windup   Source File: TagsRulesTest.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void testTagsLoading() throws Exception
{

    final Path folder = OperatingSystemUtils.createTempDir().toPath();
    try (final GraphContext context = factory.create(folder, true))
    {

        GraphRewrite event = new GraphRewrite(context);
        final DefaultEvaluationContext evaluationContext = new DefaultEvaluationContext();
        final DefaultParameterValueStore values = new DefaultParameterValueStore();
        evaluationContext.put(ParameterValueStore.class, values);

        RuleSubset.create(getNoOpRule(context)).perform(event, evaluationContext);

        //Assert.assertEquals();
    }
}
 
Example 10
Source Project: windup   Source File: QueryConditionTest.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void testTypeTransition() throws Exception
{
    // build the initial graph
    final Path folder = OperatingSystemUtils.createTempDir().toPath();
    try (final GraphContext context = factory.create(folder, true))
    {

        fillData(context);
        context.commit();

        // setup the context for the rules
        GraphRewrite event = new GraphRewrite(context);
        DefaultEvaluationContext evaluationContext = createEvalContext(event);

        // build a configuration, and make sure it matches what we expect (4 items)
        TestMavenExampleRuleProvider provider = new TestMavenExampleRuleProvider();
        Configuration configuration = provider.getConfiguration(null);
        RuleSubset.create(configuration).perform(event, evaluationContext);

        Assert.assertEquals(4, provider.getSearchResults().size());
    }
}
 
Example 11
Source Project: windup   Source File: QueryConditionTest.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void testPropertyFilter() throws Exception
{
    // build the initial graph
    final Path folder = OperatingSystemUtils.createTempDir().toPath();
    try (final GraphContext context = factory.create(folder, true))
    {

        fillData(context);
        context.commit();

        // setup the context for the rules
        GraphRewrite event = new GraphRewrite(context);
        DefaultEvaluationContext evaluationContext = createEvalContext(event);

        // build a configuration, and make sure it matches what we expect (4 items)
        TestXmlExampleRuleProvider2 provider = new TestXmlExampleRuleProvider2();
        Configuration configuration = provider.getConfiguration(null);
        RuleSubset.create(configuration).perform(event, evaluationContext);

        Assert.assertEquals(1, provider.getTypeSearchResults().size());
        Assert.assertEquals("xmlTag3", provider.getTypeSearchResults().get(0).getRootTagName());
    }
}
 
Example 12
Source Project: windup   Source File: QueryConditionTest.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void testTypeAndPropertyFilter() throws Exception
{
    // build the initial graph
    final Path folder = OperatingSystemUtils.createTempDir().toPath();
    try (final GraphContext context = factory.create(folder, true))
    {
        fillData(context);
        context.commit();

        // setup the context for the rules
        GraphRewrite event = new GraphRewrite(context);
        DefaultEvaluationContext evaluationContext = createEvalContext(event);

        // build a configuration, and make sure it matches what we expect (4 items)
        TestXmlExampleRuleProvider3 provider = new TestXmlExampleRuleProvider3();
        Configuration configuration = provider.getConfiguration(null);
        RuleSubset.create(configuration).perform(event, evaluationContext);

        Assert.assertEquals(1, provider.getTypeSearchResults().size());
        TestXmlMetaFacetModel result1 = provider.getTypeSearchResults().get(0);
        Assert.assertEquals("xmlTag2", result1.getRootTagName());
    }
}
 
Example 13
Source Project: windup   Source File: IterationPayloadTest.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void testIterationVariableResolving() throws Exception
{
    final Path folder = OperatingSystemUtils.createTempDir().toPath();
    try (final GraphContext context = factory.create(folder, true))
    {

        GraphRewrite event = new GraphRewrite(context);
        final DefaultEvaluationContext evaluationContext = new DefaultEvaluationContext();
        final DefaultParameterValueStore values = new DefaultParameterValueStore();
        evaluationContext.put(ParameterValueStore.class, values);

        fillData(context);

        RuleSubset.create(provider.getConfiguration(null)).perform(event, evaluationContext);

        Assert.assertEquals(3, provider.getChildCount());
        Assert.assertEquals(2, provider.getParentCount());
        Assert.assertEquals(3, provider.getActualChildCount());
        Assert.assertEquals(3, provider.getActualParentCount());
    }
}
 
Example 14
Source Project: windup   Source File: IterationPayloadTest.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void testNestedIteration() throws Exception
{
    final Path folder = OperatingSystemUtils.createTempDir().toPath();
    try (final GraphContext context = factory.create(folder, true))
    {

        GraphRewrite event = new GraphRewrite(context);
        final DefaultEvaluationContext evaluationContext = new DefaultEvaluationContext();
        final DefaultParameterValueStore values = new DefaultParameterValueStore();
        evaluationContext.put(ParameterValueStore.class, values);

        fillData(context);

        RuleSubset.create(nestedIterationRuleProvider.getConfiguration(null)).perform(event, evaluationContext);

        Assert.assertEquals(2, nestedIterationRuleProvider.outerVertices.size());
        Assert.assertEquals(3, nestedIterationRuleProvider.innerVertices.size());
        Assert.assertEquals(6, nestedIterationRuleProvider.iterationCount);
    }
}
 
Example 15
Source Project: windup   Source File: VariablesTest.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void testUnTypedGet() throws Exception
{
    final Path folder = OperatingSystemUtils.createTempDir().toPath();
    try (final GraphContext context = factory.create(folder, true))
    {
        GraphRewrite event = new GraphRewrite(context);
        final DefaultEvaluationContext evaluationContext = new DefaultEvaluationContext();
        final DefaultParameterValueStore values = new DefaultParameterValueStore();
        evaluationContext.put(ParameterValueStore.class, values);

        JavaClassModel classModel1 = context.getFramed().addFramedVertex(JavaClassModel.class);
        classModel1.setQualifiedName("com.example.Class1NoToString");
        JavaClassModel classModel2 = context.getFramed().addFramedVertex(JavaClassModel.class);
        classModel2.setQualifiedName("com.example.Class2HasToString");

        Variables vars = Variables.instance(event);
        vars.push();
        vars.setSingletonVariable("classModel1", classModel1);
        WindupVertexFrame frame = vars.findSingletonVariable("classModel1");
        Assert.assertNotNull(frame);
    }
}
 
Example 16
Source Project: windup   Source File: IterationPayLoadPassTest.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void testPayloadPass() throws Exception
{
    final Path folder = OperatingSystemUtils.createTempDir().toPath();
    try (final GraphContext context = factory.create(folder, true))
    {
        context.getFramed().addFramedVertex(TestPayloadModel.class);
        context.getFramed().addFramedVertex(TestPayloadModel.class);
        context.getFramed().addFramedVertex(TestPayloadModel.class);

        GraphRewrite event = new GraphRewrite(context);
        DefaultEvaluationContext evaluationContext = createEvalContext(event);

        WindupConfigurationModel windupCfg = context.getFramed().addFramedVertex(WindupConfigurationModel.class);
        FileService fileModelService = new FileService(context);
        windupCfg.addInputPath(fileModelService.createByFilePath("/tmp/testpath"));

        TestIterationPayLoadPassProvider provider = new TestIterationPayLoadPassProvider();
        Configuration configuration = provider.getConfiguration(null);

        // this should call perform()
        RuleSubset.create(configuration).perform(event, evaluationContext);
        Assert.assertEquals(3, modelCounter);
        modelCounter = 0;
    }
}
 
Example 17
Source Project: windup   Source File: IterationPayLoadPassTest.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Test(expected = Exception.class)
public void testPayloadNotPass() throws Exception
{
    final Path folder = OperatingSystemUtils.createTempDir().toPath();
    try (final GraphContext context = factory.create(folder, true))
    {
        context.getFramed().addFramedVertex(TestSimple1Model.class);
        context.getFramed().addFramedVertex(TestSimple2Model.class);
        context.getFramed().addFramedVertex(TestSimple2Model.class);

        GraphRewrite event = new GraphRewrite(context);
        DefaultEvaluationContext evaluationContext = createEvalContext(event);

        WindupConfigurationModel windupCfg = context.getFramed().addFramedVertex(WindupConfigurationModel.class);
        FileService fileModelService = new FileService(context);
        windupCfg.addInputPath(fileModelService.createByFilePath("/tmp/testpath"));

        TestIterationPayLoadNotPassProvider provider = new TestIterationPayLoadNotPassProvider();
        Configuration configuration = provider.getConfiguration(null);

        // this should call perform()
        RuleSubset.create(configuration).perform(event, evaluationContext);
        Assert.assertEquals(3, modelCounter);
        modelCounter = 0;
    }
}
 
Example 18
Source Project: windup   Source File: RuleProviderDisabledTest.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void testDisabledFeature() throws Exception
{
    final Path folder = OperatingSystemUtils.createTempDir().toPath();
    try (final GraphContext context = factory.create(folder, true))
    {
        GraphRewrite event = new GraphRewrite(context);
        DefaultEvaluationContext evaluationContext = createEvalContext(event);

        WindupConfigurationModel windupCfg = context.getFramed().addFramedVertex(WindupConfigurationModel.class);
        FileService fileModelService = new FileService(context);
        windupCfg.addInputPath(fileModelService.createByFilePath(folder.toAbsolutePath().toString()));
        windupCfg.setOnlineMode(false);

        Predicate<RuleProvider> migrationPhase = (provider) -> provider.getMetadata().getPhase() == MigrationRulesPhase.class;

        RuleLoaderContext ruleLoaderContext = new RuleLoaderContext(Collections.emptyList(), migrationPhase);
        Configuration configuration = loader.loadConfiguration(ruleLoaderContext).getConfiguration();

        RuleSubset.create(configuration).perform(event, evaluationContext);

        Assert.assertTrue("Enabled should run", enabledProvider.executed);
        Assert.assertFalse("Disabled should not run", disabledProvider.executed);
    }
}
 
Example 19
Source Project: furnace   Source File: AddonManagerRealTest.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Before
public void setUp() throws IOException
{
   furnace = ServiceLoader.load(Furnace.class).iterator().next();
   resolver = new MavenAddonDependencyResolver();
   repository = OperatingSystemUtils.createTempDir();
   furnace.addRepository(AddonRepositoryMode.MUTABLE, repository);
   addonManager = new AddonManagerImpl(furnace, resolver);
}
 
Example 20
Source Project: furnace   Source File: AddonManagerInstallTest.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Before
public void setUp() throws IOException
{
   furnace = ServiceLoader.load(Furnace.class).iterator().next();
   resolver = new MavenAddonDependencyResolver();
   repository = OperatingSystemUtils.createTempDir();
   furnace.addRepository(AddonRepositoryMode.MUTABLE, repository);
   addonManager = new AddonManagerImpl(furnace, resolver);
}
 
Example 21
Source Project: furnace   Source File: BootstrapClassLoader.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
private List<URL> handleZipFile(File file) throws IOException
{
   File tempDir = OperatingSystemUtils.createTempDir();
   List<URL> result = new ArrayList<>();
   try
   {
      ZipFile zip = new ZipFile(file);
      Enumeration<? extends ZipEntry> entries = zip.entries();
      while (entries.hasMoreElements())
      {
         ZipEntry entry = entries.nextElement();
         String name = entry.getName();
         if (name.matches(path + "/.*\\.jar"))
         {
            log.log(Level.FINE, String.format("ZipEntry detected: %s len %d added %TD",
                     file.getAbsolutePath() + "/" + entry.getName(), entry.getSize(),
                     new Date(entry.getTime())));

            result.add(copy(tempDir, entry.getName(),
                     JarLocator.class.getClassLoader().getResource(name).openStream()
                     ).toURL());
         }
      }
      zip.close();
   }
   catch (ZipException e)
   {
      throw new RuntimeException("Error handling file " + file, e);
   }
   return result;
}
 
Example 22
@Before
public void init() throws IOException
{
   leftRepo = OperatingSystemUtils.createTempDir();
   leftRepo.deleteOnExit();
   rightRepo = OperatingSystemUtils.createTempDir();
   rightRepo.deleteOnExit();
}
 
Example 23
Source Project: furnace   Source File: XATransactionLookupTest.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testGetJDKProvidedXATypes()
{
   assumeTrue(OperatingSystemUtils.isJava8());
   try
   {
      getClass().getClassLoader().loadClass("javax.transaction.xa.XAResource");
      getClass().getClassLoader().loadClass("javax.transaction.TransactionRequiredException");
   }
   catch (Exception e)
   {
      Assert.fail("Could not load required transaction classes." + e.getMessage());
   }
}
 
Example 24
Source Project: furnace   Source File: XATransactionLookupTest.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testXATypeInstantiations() throws Exception
{
   assumeTrue(OperatingSystemUtils.isJava8());
   getClass().getClassLoader().loadClass("javax.transaction.xa.XAException").newInstance();
   getClass().getClassLoader().loadClass("javax.transaction.TransactionRequiredException").newInstance();
}
 
Example 25
Source Project: furnace   Source File: JAXBLookupTest.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testGetJDKProvidedJAXBImpl()
{
   assumeTrue(OperatingSystemUtils.isJava8());
   try
   {
      getClass().getClassLoader().loadClass("com.sun.xml.internal.bind.v2.ContextFactory");
   }
   catch (Exception e)
   {
      Assert.fail("Could not load required Factory class." + e.getMessage());
   }
}
 
Example 26
Source Project: furnace   Source File: JAXBLookupTest.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testJAXBLookup() throws Exception
{
   assumeTrue(OperatingSystemUtils.isJava8());
   Assert.assertNotNull(JAXBContext.newInstance(TestRoot.class).createUnmarshaller()
            .unmarshal(new ByteArrayInputStream("<testRoot/>".getBytes())));
}
 
Example 27
Source Project: furnace   Source File: Files.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private static boolean _deleteRecursive(final File file, final boolean collect)
{
   Assert.notNull(file, "File to delete must not be null.");

   boolean result = true;
   if (collect && OperatingSystemUtils.isWindows())
   {
      System.gc(); // ensure no lingering handles that would prevent deletion
   }

   File[] children = file.listFiles();
   if (children != null)
   {
      for (File sf : children)
      {
         if (sf.isDirectory())
         {
            if (!_deleteRecursive(sf, false))
               result = false;
         }
         else
         {
            if (!sf.delete())
               result = false;
         }
      }
   }

   return file.delete() && result;
}
 
Example 28
Source Project: furnace   Source File: Files.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Replace instances of internal tokens with actual file equivalents.
 */
public static String canonicalize(String target)
{
   if (target.startsWith(Files.HOME_ALIAS))
   {
      String homePath = OperatingSystemUtils.getUserHomePath();
      target = homePath + target.substring(1, target.length());
   }

   return target;
}
 
Example 29
Source Project: furnace   Source File: AddonRepositoryImplTest.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testSharedStorageRepository() throws Exception
{
   Furnace furnace = new FurnaceImpl();

   File temp = OperatingSystemUtils.createTempDir();
   MutableAddonRepositoryStorageStrategy storageRepository = new AddonRepositoryStorageStrategyImpl(furnace.getLockManager(), temp);

   AddonRepositoryStateStrategyImpl firstStateRepository = new AddonRepositoryStateStrategyImpl(furnace, OperatingSystemUtils.createTempDir());
   MutableAddonRepository firstRepo = new AddonRepositoryImpl(storageRepository, firstStateRepository, temp);

   AddonRepositoryStateStrategyImpl secondStateRepository = new AddonRepositoryStateStrategyImpl(furnace, OperatingSystemUtils.createTempDir());
   MutableAddonRepository secondRepo = new AddonRepositoryImpl(storageRepository, secondStateRepository, temp);

   AddonId addon = TestInMemoryAddonRepositoryStateStrategy.TEST_ADDON;

   Assert.assertFalse(firstRepo.isDeployed(addon));
   Assert.assertFalse(secondRepo.isDeployed(addon));

   // Since storage is shared, addon will be deployed to both repositories
   firstRepo.deploy(addon, Collections.emptyList(), Collections.emptyList());

   Assert.assertTrue(firstRepo.isDeployed(addon));
   Assert.assertTrue(secondRepo.isDeployed(addon));

   firstRepo.enable(addon);

   Assert.assertTrue(firstRepo.isEnabled(addon));
   Assert.assertFalse(secondRepo.isEnabled(addon));
}
 
Example 30
Source Project: furnace   Source File: AddonRepositoryImplTest.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private static AddonRepositoryImpl createTempRepository(Furnace furnace, MutableAddonRepositoryStateStrategy stateRepository)
{
   File temp = OperatingSystemUtils.createTempDir();
   MutableAddonRepositoryStorageStrategy storageRepository = new AddonRepositoryStorageStrategyImpl(furnace.getLockManager(), temp);

   return new AddonRepositoryImpl(storageRepository, stateRepository, temp);
}