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

How to use
getComponent
method
in
net.roboconf.core.model.beans.Instance

Best Java code snippets using net.roboconf.core.model.beans.Instance.getComponent (Showing top 20 results out of 315)

origin: roboconf/roboconf-platform

/**
 * Determines whether an instances is associated with the "target" installer or not.
 * @param instance an instance (not null)
 * @return true if it is associated with the "target" installer, false otherwise
 */
public static boolean isTarget( Instance instance ) {
  return instance.getComponent() != null
      && ComponentHelpers.isTarget( instance.getComponent());
}
origin: roboconf/roboconf-platform

/**
 * Finds the resource directory for an instance.
 * @param applicationFilesDirectory the application's directory
 * @param instance an instance
 * @return a non-null file (that may not exist)
 */
public static File findInstanceResourcesDirectory( File applicationFilesDirectory, Instance instance ) {
  return findInstanceResourcesDirectory( applicationFilesDirectory, instance.getComponent());
}
origin: roboconf/roboconf-platform

/**
 * Finds the directory where an agent stores the files for a given instance.
 * @param instance an instance (not null)
 * @return a file (not null, but may not exist)
 */
public static File findInstanceDirectoryOnAgent( Instance instance ) {
  String path = InstanceHelpers.computeInstancePath( instance );
  path = path.substring( 1 ).replace( '/', '_' ).replace( ' ', '_' );
  String installerName = ComponentHelpers.findComponentInstaller( instance.getComponent());
  return new File( Constants.WORK_DIRECTORY_AGENT, installerName + "/" + path );
}
origin: roboconf/roboconf-platform

/**
 * Constructor.
 * @param instance
 */
public Import( Instance instance ) {
  this(
      InstanceHelpers.computeInstancePath( instance ),
      instance.getComponent() == null ? null : instance.getComponent().getName(),
      InstanceHelpers.findAllExportedVariables( instance ));
}
origin: roboconf/roboconf-platform

/**
 * Finds instances by component name.
 * @param application an application (not null)
 * @param componentName a component name (not null)
 * @return a non-null list of instances
 */
public static List<Instance> findInstancesByComponentName( AbstractApplication application, String componentName ) {
  List<Instance> result = new ArrayList<> ();
  for( Instance inst : getAllInstances( application )) {
    if( componentName.equals( inst.getComponent().getName()))
      result.add( inst );
  }
  return result;
}
origin: roboconf/roboconf-platform

/**
 * Finds the component and facet names that prefix the variables an instance imports.
 * @param instance an instance
 * @return a non-null set with all the component and facet names this instance imports
 */
public static Set<String> findPrefixesForImportedVariables( Instance instance ) {
  Set<String> result = new HashSet<> ();
  for( ImportedVariable var : ComponentHelpers.findAllImportedVariables( instance.getComponent()).values())
    result.add( VariableHelpers.parseVariableName( var.getName()).getKey());
  return result;
}
origin: net.roboconf/roboconf-messaging-api

/**
 * Constructor.
 * @param instance
 */
public MsgCmdAddInstance( Instance instance ) {
  this.parentInstancePath = instance.getParent() == null ? null : InstanceHelpers.computeInstancePath( instance.getParent());
  this.instanceName = instance.getName();
  this.componentName = instance.getComponent() != null ? instance.getComponent().getName() : null;
  this.channels = instance.channels;
  this.data = instance.data;
  this.overridenExports = instance.overriddenExports;
}
origin: roboconf/roboconf-platform

/**
 * Builds a map with the variables defined by this class.
 * @param instance a non-null instance
 * @return a non-null map where all the properties here are mapped to their values for this instance
 */
public static Map<String,String> buildReferenceMap( Instance instance ) {
  Map<String,String> result = new HashMap<> ();
  String instancePath = InstanceHelpers.computeInstancePath( instance );
  result.put( ROBOCONF_INSTANCE_NAME, instance.getName());
  result.put( ROBOCONF_INSTANCE_PATH, instancePath );
  result.put( ROBOCONF_COMPONENT_NAME, instance.getComponent().getName());
  result.put( ROBOCONF_CLEAN_INSTANCE_PATH, cleanInstancePath( instancePath ));
  result.put( ROBOCONF_CLEAN_REVERSED_INSTANCE_PATH, cleanReversedInstancePath( instancePath ));
  return result;
}
origin: roboconf/roboconf-platform

/**
 * Constructor.
 * @param app
 * @param commandFile
 */
public Context( AbstractApplication app, File commandFile ) {
  this.app = app;
  this.commandFile = commandFile;
  for( Instance instance : InstanceHelpers.getAllInstances( app ))
    this.instancePathToComponentName.put( InstanceHelpers.computeInstancePath( instance ), instance.getComponent().getName());
}
origin: roboconf/roboconf-platform

/**
 * Constructor.
 * @param instance
 */
public MsgCmdAddInstance( Instance instance ) {
  this.parentInstancePath = instance.getParent() == null ? null : InstanceHelpers.computeInstancePath( instance.getParent());
  this.instanceName = instance.getName();
  this.componentName = instance.getComponent() != null ? instance.getComponent().getName() : null;
  this.channels = instance.channels;
  this.data = instance.data;
  this.overridenExports = instance.overriddenExports;
}
origin: roboconf/roboconf-platform

/**
 * Finds the component and facet names that prefix the variables an instance requires.
 * <p>
 * Only the mandatory variables are returned. Optional imports are not considered by this method.
 * </p>
 *
 * @param instance an instance
 * @return a non-null set with all the component and facet names this instance imports
 */
public static Set<String> findPrefixesForMandatoryImportedVariables( Instance instance ) {
  Set<String> result = new HashSet<> ();
  for( ImportedVariable var : ComponentHelpers.findAllImportedVariables( instance.getComponent()).values()) {
    if( ! var.isOptional())
      result.add( VariableHelpers.parseVariableName( var.getName()).getKey());
  }
  return result;
}
origin: net.roboconf/roboconf-dm

@Override
public synchronized void generateRandomValues( Application application, Instance instance ) {
  // Exported variables that are random will be set a value
  for( ExportedVariable var : instance.getComponent().exportedVariables.values()) {
    // Not random?
    if( ! var.isRandom())
      continue;
    // Port
    if( var.getRandomKind() == RandomKind.PORT ) {
      // Acknowledge: verify a random value was not already set on it.
      // Otherwise, generate a random port and associate it.
      if( ! acknowledgePort( application, instance, var.getName()))
        generateRandomPort( application, instance, var.getName());
    }
  }
  // Save the updated model
  ConfigurationUtils.saveInstances( application );
}
origin: roboconf/roboconf-platform

@Test
public void testFindAllChildren_testApp() {
  TestApplicationTemplate app = new TestApplicationTemplate();
  Collection<Component> children = ComponentHelpers.findAllChildren( app.getTomcat().getComponent());
  Assert.assertEquals( 1, children.size());
  Assert.assertTrue( children.contains( app.getWar().getComponent()));
  children = ComponentHelpers.findAllChildren( app.getTomcatVm().getComponent());
  Assert.assertEquals( 2, children.size());
  Assert.assertTrue( children.contains( app.getTomcat().getComponent()));
  Assert.assertTrue( children.contains( app.getMySql().getComponent()));
  children = ComponentHelpers.findAllChildren( app.getMySqlVm().getComponent());
  Assert.assertEquals( 2, children.size());
  Assert.assertTrue( children.contains( app.getTomcat().getComponent()));
  Assert.assertTrue( children.contains( app.getMySql().getComponent()));
  Assert.assertEquals( 0, ComponentHelpers.findAllChildren( app.getMySql().getComponent()).size());
  Assert.assertEquals( 0, ComponentHelpers.findAllChildren( app.getWar().getComponent()).size());
}
origin: roboconf/roboconf-platform

@Test
public void testConstructor() {
  List<Instance> instances = InstanceHelpers.getAllInstances( this.app );
  Assert.assertEquals( instances.size(), this.context.instancePathToComponentName.size());
  for( Instance instance : instances ) {
    String path = InstanceHelpers.computeInstancePath( instance );
    Assert.assertEquals( instance.getComponent().getName(), this.context.instancePathToComponentName.get( path ));
  }
}
origin: roboconf/roboconf-platform

@Test
public void testFindPrefixesForExternalImports() {
  TestApplication app = new TestApplication();
  ImportedVariable var1 = new ImportedVariable( "something.else", true, true );
  ImportedVariable var2 = new ImportedVariable( "other.stuff", true, true );
  app.getWar().getComponent().importedVariables.put( var1.getName(),  var1 );
  app.getWar().getComponent().importedVariables.put( var2.getName(),  var2 );
  Set<String> prefixes = VariableHelpers.findPrefixesForExternalImports( app );
  Assert.assertEquals( 2, prefixes.size());
  Assert.assertTrue( prefixes.contains( "other" ));
  Assert.assertTrue( prefixes.contains( "something" ));
}
origin: roboconf/roboconf-platform

  @Test
  public void testFindScopedInstancesDirectories() throws Exception {

    final File appDir = this.folder.newFolder();
    TestApplication app = new TestApplication();
    app.setDirectory( appDir );

    Assert.assertEquals( 0, ResourceUtils.findScopedInstancesDirectories( app ).size());

    File vmDir = new File( appDir, Constants.PROJECT_DIR_GRAPH + "/" + app.getMySqlVm().getComponent().getName());
    Assert.assertTrue( vmDir.mkdirs());

    Map<Component,File> map = ResourceUtils.findScopedInstancesDirectories( app );
    Assert.assertEquals( 1, map.size());
    Assert.assertEquals( vmDir, map.get( app.getMySqlVm().getComponent()));
  }
}
origin: roboconf/roboconf-platform

@Test
public void testResolveInstance() {
  Assert.assertEquals( "vm", this.context.resolveInstance( "/tomcat-vm" ).getComponent().getName());
  Assert.assertEquals( "tomcat", this.context.resolveInstance( "/tomcat-vm/tomcat-server" ).getComponent().getName());
  Assert.assertNull( this.context.resolveInstance( "/tomcat-vm/invalid" ));
  this.context.instancePathToComponentName.put( "not a path", "whatever" );
  Assert.assertNull( this.context.resolveInstance( "not a path" ));
  Assert.assertNull( this.context.resolveInstance( "" ));
  this.context.instancePathToComponentName.put( "", "vm" );
  Assert.assertNull( this.context.resolveInstance( "" ));
}
origin: roboconf/roboconf-platform

@Test
public void testFindComponentFrom() {
  TestApplicationTemplate app = new TestApplicationTemplate();
  Component comp = app.getTomcatVm().getComponent();
  Assert.assertNull( ComponentHelpers.findComponentFrom( comp, "inexisting" ));
  Assert.assertNull( ComponentHelpers.findComponentFrom( null, "inexisting" ));
  Assert.assertEquals( comp, ComponentHelpers.findComponentFrom( comp, comp.getName()));
  Component targetComp = app.getTomcat().getComponent();
  Assert.assertEquals( targetComp, ComponentHelpers.findComponentFrom( comp, targetComp.getName()));
  targetComp = app.getWar().getComponent();
  Assert.assertEquals( targetComp, ComponentHelpers.findComponentFrom( comp, targetComp.getName()));
}
origin: roboconf/roboconf-platform

@Test
public void testChain() {
  Instance inst = new Instance().name( "ins" ).status( InstanceStatus.DEPLOYING ).component( null ).parent( null );
  Assert.assertEquals( 0, inst.channels.size());
  Assert.assertEquals( "ins", inst.getName());
  Assert.assertEquals( InstanceStatus.DEPLOYING, inst.getStatus());
  Assert.assertNull( inst.getComponent());
  Assert.assertNull( inst.getParent());
  Assert.assertEquals( 1, inst.channel( "woo" ).channels.size());
  Assert.assertEquals( 2, inst.channel( "yeah" ).channels.size());
  Assert.assertEquals( 2, inst.channel( "woo" ).channels.size());
}
origin: roboconf/roboconf-platform

@Test
public void testIsTarget() {
  Instance inst = new Instance( "i" );
  Assert.assertFalse( InstanceHelpers.isTarget( inst ));
  inst.setComponent( new Component( "comp" ).installerName( "whatever" ));
  Assert.assertFalse( InstanceHelpers.isTarget( inst ));
  inst.getComponent().setInstallerName( Constants.TARGET_INSTALLER );
  Assert.assertTrue( InstanceHelpers.isTarget( inst ));
}
net.roboconf.core.model.beansInstancegetComponent

Popular methods of Instance

  • getName
  • getStatus
  • <init>
  • getImports
  • setStatus
  • component
  • getParent
  • getChildren
  • setName
  • setComponent
  • channel
    Adds a channel in a chain approach.
  • name
    Sets the name in a chain approach.
  • channel,
  • name,
  • setParent,
  • status,
  • equals,
  • parent,
  • toString

Popular in Java

  • Start an intent from android
  • findViewById (Activity)
  • setRequestProperty (URLConnection)
  • setScale (BigDecimal)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JButton (javax.swing)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top plugins for Android Studio
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