Examples of Instance


Examples of org.apache.falcon.resource.InstancesResult.Instance

                        CoordinatorAction action = client.getCoordActionInfo(wf
                                .getParentId());
                        String nominalTimeStr = SchemaHelper
                                .formatDateUTC(action.getNominalTime());
                        Instance instance = new Instance(cluster,
                                nominalTimeStr, WorkflowStatus.RUNNING);
                        instance.startTime = wf.getStartTime();
                        if (entity.getEntityType() == EntityType.FEED) {
                            instance.sourceCluster = getSourceCluster(cluster,
                                    action, entity);
View Full Code Here

Examples of org.apache.felix.ipojo.api.composite.Instance

       PrimitiveComponentType cons = createAConsumer();

       CompositeComponentType type = new CompositeComponentType()
           .setBundleContext(context)
           .setComponentTypeName("comp1")
           .addInstance(new Instance(prov.getFactory().getName()))
           .addInstance(new Instance(cons.getFactory().getName()));

       ComponentInstance ci = type.createInstance();

       assertThat("ci is valid", ci.getState(), is(ComponentInstance.VALID));
View Full Code Here

Examples of org.apache.felix.ipojo.configuration.Instance

            // Collect fields
            Map<Field, Instance> fields =
                    fields().ofType(Instance.class).in(configuration).map();
            for (Map.Entry<Field, Instance> entry : fields.entrySet()) {
                Instance instance = entry.getValue();
                instance.nameIfUnnamed(entry.getKey().getName());
                instances.add(instance);
            }

            // Collect methods with Bundle Context as argument
            Map<Method, InvocationResult<Instance>> methods =
                    methods().in(configuration).ofReturnType(Instance.class).withParameter(BundleContext.class)
                            .map(bundle.getBundleContext());

            // Collect methods without arguments
            methods.putAll(methods().in(configuration).ofReturnType(Instance.class).map());

            for (Map.Entry<Method, InvocationResult<Instance>> entry : methods.entrySet()) {
                Instance instance = entry.getValue().get();
                if (instance == null) {
                    m_logger.log(Log.ERROR, "The Instance declaration creation failed because the method " + entry
                            .getKey().getName() + " of class " + entry.getKey().getDeclaringClass() + " threw an " +
                            "exception", entry.getValue().error());
                } else {
                    instance.nameIfUnnamed(entry.getKey().getName());
                    instances.add(instance);
                }
            }

        } catch (ClassNotFoundException e) {
            m_logger.log(Log.ERROR, "Cannot load class " + classname + " despite it was considered as a " +
                    "configuration", e);
            return;
        } catch (InstantiationException e) {
            m_logger.log(Log.ERROR, "Cannot instantiate class " + classname + " despite it was considered as a " +
                    "configuration", e);
            return;
        } catch (IllegalAccessException e) {
            m_logger.log(Log.ERROR, "Cannot instantiate class " + classname + " despite it was considered as a " +
                    "configuration", e);
            return;
        }

        m_logger.log(Log.WARNING, instances.size() + " instances found in class " + classname);
        //Build and enqueue declaration
        for (Instance instance : instances) {
            DefaultInstanceDeclaration declaration = new DefaultInstanceDeclaration(bundle.getBundleContext(),
                    instance.factory(), instance.configuration());
            declaration.start();
            getComponentsAndInstances(bundle).m_instances.add(declaration);
        }
    }
View Full Code Here

Examples of org.apache.felix.karaf.admin.Instance

            chmod(new File(karafBase, "bin/stop"), "a+x");
        }
       
        handleFeatures(new File(karafBase, FEATURES_CFG), settings);
       
        Instance instance = new InstanceImpl(this, name, karafBase.toString());
        instances.put(name, instance);
        saveState();
        return instance;
    }
View Full Code Here

Examples of org.apache.felix.servicebinder.architecture.Instance

                {
                    tempArray.add(ref);
                }
            }

            Instance instances[]= new Instance[tempArray.size()];
            instances = (Instance [])tempArray.toArray(instances);

            return instances;

View Full Code Here

Examples of org.apache.flink.runtime.instance.Instance

      final ExecutionVertex targetVertex = edge.getSource().getProducer();
      final ExecutionState executionState = targetVertex.getExecutionState();
     
      // common case - found task running
      if (executionState == ExecutionState.RUNNING) {
        Instance location = targetVertex.getCurrentAssignedResource().getInstance();
       
        if (location.getInstanceConnectionInfo().equals(caller)) {
          // Receiver runs on the same task manager
          return ConnectionInfoLookupResponse.createReceiverFoundAndReady(edge.getOutputChannelId());
        }
        else {
          // Receiver runs on a different task manager
          final InstanceConnectionInfo ici = location.getInstanceConnectionInfo();
          final InetSocketAddress isa = new InetSocketAddress(ici.address(), ici.dataPort());

          int connectionIdx = edge.getSource().getIntermediateResult().getConnectionIndex();
          return ConnectionInfoLookupResponse.createReceiverFoundAndReady(new RemoteReceiver(isa, connectionIdx));
        }
      }
      else if (executionState == ExecutionState.FINISHED) {
        // that should not happen. if there is data pending, the sender cannot yet be done
        // we need to fail the whole affair
        LOG.error("Receiver " + targetVertex + " set to FINISHED even though data is pending");
        fail(new Exception("Channels are not correctly registered"));
        return ConnectionInfoLookupResponse.createReceiverNotFound();
      }
      else if (executionState == ExecutionState.FAILED || executionState == ExecutionState.CANCELED ||
          executionState == ExecutionState.CANCELING)
      {
        return ConnectionInfoLookupResponse.createJobIsAborting();
      }
      else {
        // all other states should not be, because the sender cannot be in CREATED, SCHEDULED, or DEPLOYING
        // state when the receiver is already running
        LOG.error("Channel lookup (backwards) - sender " + targetVertex + " found in inconsistent state " + executionState);
        fail(new Exception("Channels are not correctly registered"));
        return ConnectionInfoLookupResponse.createReceiverNotFound();
      }
    }
   
    //  ----- Request was sent from an output channel (sender side), requesting the input channel (receiver side) ------
    //  -----                                 This is the case for forward data                                   ------
   
    final ExecutionVertex targetVertex = edge.getTarget();
    final ExecutionState executionState = targetVertex.getExecutionState();

    if (executionState == ExecutionState.RUNNING) {
     
      // already online
      Instance location = targetVertex.getCurrentAssignedResource().getInstance();
     
      if (location.getInstanceConnectionInfo().equals(caller)) {
        // Receiver runs on the same task manager
        return ConnectionInfoLookupResponse.createReceiverFoundAndReady(edge.getInputChannelId());
      }
      else {
        // Receiver runs on a different task manager
        final InstanceConnectionInfo ici = location.getInstanceConnectionInfo();
        final InetSocketAddress isa = new InetSocketAddress(ici.address(), ici.dataPort());

        final int connectionIdx = edge.getSource().getIntermediateResult().getConnectionIndex();
        return ConnectionInfoLookupResponse.createReceiverFoundAndReady(new RemoteReceiver(isa, connectionIdx));
      }
View Full Code Here

Examples of org.apache.isis.core.metamodel.spec.Instance

        final Object newValuePojo = newValue.getObject();
        proposedHolder.setProposed(newValuePojo);
    }

    private MutableProposedHolder getProposedHolder(final ObjectAdapter owner) {
        final Instance instance = getInstance(owner);
        if (!(instance instanceof MutableProposedHolder)) {
            throw new IllegalArgumentException("Instance should implement MutableProposedHolder");
        }
        final MutableProposedHolder proposedHolder = (MutableProposedHolder) instance;
        return proposedHolder;
View Full Code Here

Examples of org.apache.ivory.resource.InstancesResult.Instance

                        CoordinatorAction action = client.getCoordActionInfo(wf
                                .getParentId());
                        String nominalTimeStr = SchemaHelper
                                .formatDateUTC(action.getNominalTime());
                        Instance instance = new Instance(cluster,
                                nominalTimeStr, WorkflowStatus.RUNNING);
                        instance.startTime = wf.getStartTime();
                        if (entity.getEntityType() == EntityType.FEED) {
                            instance.sourceCluster = getSourceCluster(cluster,
                                    action, entity);
View Full Code Here

Examples of org.apache.karaf.admin.Instance

        TabularType tt = JmxInstance.INSTANCE_TABLE;
        Assert.assertEquals("Instances", tt.getTypeName());
    }

    public void testJMXInstance() throws Exception {
        Instance i = EasyMock.createMock(Instance.class);
        EasyMock.expect(i.getPid()).andReturn(1712);
        EasyMock.expect(i.getName()).andReturn("MyInstance");
        EasyMock.expect(i.isRoot()).andReturn(false);
        EasyMock.expect(i.getSshPort()).andReturn(0);
        EasyMock.expect(i.getRmiRegistryPort()).andReturn(0);
        EasyMock.expect(i.getState()).andThrow(new Exception("gotcha"));
        EasyMock.expect(i.getLocation()).andReturn("somewhere");
        EasyMock.expect(i.getJavaOpts()).andReturn("someopts");
        EasyMock.replay(i);
       
        JmxInstance ji = new JmxInstance(i);
        TabularData td = JmxInstance.tableFrom(Collections.singletonList(ji));       
        Collection<?> keys = (Collection<?>) td.keySet().iterator().next();
View Full Code Here

Examples of org.apache.karaf.instance.core.Instance

        return false;
    }

    private boolean destroyInstance(String name) {
        try {
            Instance instance = instanceService.getInstance(name);
            if (instance != null) {
                instance.destroy();
                return true;
            }
        } catch (Exception ex) {
            Logger.getLogger(InstancePlugin.class.getName()).log(Level.SEVERE, null, ex);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.