Search in sources :

Example 91 with Service

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.Service in project bgpcep by opendaylight.

the class SenderTspecObjectParser method localParseObject.

@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
    final TspecObjectBuilder builder = new TspecObjectBuilder();
    // skip version number, reserved, Overall length
    byteBuf.skipBytes(ByteBufWriteUtil.INT_BYTES_LENGTH);
    // skip Service header, reserved, Length of service
    byteBuf.skipBytes(ByteBufWriteUtil.INT_BYTES_LENGTH);
    // skip Parameter ID, Parameter 127 flags, Parameter 127 length
    byteBuf.skipBytes(ByteBufWriteUtil.INT_BYTES_LENGTH);
    builder.setTokenBucketRate(new Float32(ByteArray.readBytes(byteBuf, METRIC_VALUE_F_LENGTH)));
    builder.setTokenBucketSize(new Float32(ByteArray.readBytes(byteBuf, METRIC_VALUE_F_LENGTH)));
    builder.setPeakDataRate(new Float32(ByteArray.readBytes(byteBuf, METRIC_VALUE_F_LENGTH)));
    builder.setMinimumPolicedUnit(byteBuf.readUnsignedInt());
    builder.setMaximumPacketSize(byteBuf.readUnsignedInt());
    return builder.build();
}
Also used : Float32(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32) ByteBufWriteUtil.writeFloat32(org.opendaylight.protocol.util.ByteBufWriteUtil.writeFloat32) TspecObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.tspec.object.TspecObjectBuilder)

Example 92 with Service

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.Service in project bgpcep by opendaylight.

the class ProgrammingServiceImpl method instantiateServiceInstance.

@Override
public synchronized void instantiateServiceInstance() {
    LOG.info("Instruction Queue service {} instantiated", this.sgi.getValue());
    this.reg = this.rpcProviderRegistry.addRpcImplementation(ProgrammingService.class, this);
    final WriteTransaction wt = this.dataProvider.newWriteOnlyTransaction();
    wt.put(LogicalDatastoreType.OPERATIONAL, this.qid, new InstructionsQueueBuilder().setKey(new InstructionsQueueKey(this.instructionId)).setInstruction(Collections.emptyList()).build());
    Futures.addCallback(wt.submit(), new FutureCallback<Void>() {

        @Override
        public void onSuccess(final Void result) {
            LOG.debug("Instruction Queue {} added", ProgrammingServiceImpl.this.qid);
        }

        @Override
        public void onFailure(final Throwable trw) {
            LOG.error("Failed to add Instruction Queue {}", ProgrammingServiceImpl.this.qid, trw);
        }
    }, MoreExecutors.directExecutor());
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) InstructionsQueueKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.InstructionsQueueKey) ProgrammingService(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.ProgrammingService) InstructionsQueueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.InstructionsQueueBuilder)

Example 93 with Service

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.Service in project bgpcep by opendaylight.

the class TopologyStatsProviderImpl method close.

@Override
public synchronized void close() throws Exception {
    LOG.info("Closing TopologyStatsProvider service.", this);
    this.scheduleTask.cancel(true);
    final WriteTransaction wTx = this.transactionChain.newWriteOnlyTransaction();
    for (final KeyedInstanceIdentifier<Node, NodeKey> statId : this.statsMap.keySet()) {
        wTx.delete(LogicalDatastoreType.OPERATIONAL, statId);
    }
    wTx.submit().get();
    this.statsMap.clear();
    this.transactionChain.close();
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) NodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)

Example 94 with Service

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.Service in project webtools.servertools by eclipse.

the class Tomcat40Configuration method modifyServerPort.

/**
 * Modify the port with the given id.
 *
 * @param id java.lang.String
 * @param port int
 */
public void modifyServerPort(String id, int port) {
    try {
        if ("server".equals(id)) {
            server.setPort(port + "");
            isServerDirty = true;
            firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
            return;
        }
        int i = id.indexOf("/");
        // If a connector in the instance Service
        if (i < 0) {
            int connNum = Integer.parseInt(id);
            Connector connector = serverInstance.getConnector(connNum);
            if (connector != null) {
                connector.setPort(port + "");
                isServerDirty = true;
                firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
            }
        } else // Else a connector in another Service
        {
            int servNum = Integer.parseInt(id.substring(0, i));
            int connNum = Integer.parseInt(id.substring(i + 1));
            Service service = server.getService(servNum);
            Connector connector = service.getConnector(connNum);
            connector.setPort(port + "");
            isServerDirty = true;
            firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
        }
    } catch (Exception e) {
        Trace.trace(Trace.SEVERE, "Error modifying server port " + id, e);
    }
}
Also used : Connector(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector) Service(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service) CoreException(org.eclipse.core.runtime.CoreException)

Example 95 with Service

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.Service in project webtools.servertools by eclipse.

the class Tomcat41Configuration method getServerPorts.

/**
 * Returns a list of ServerPorts that this configuration uses.
 *
 * @return java.util.List
 */
public List getServerPorts() {
    List<ServerPort> ports = new ArrayList<ServerPort>();
    // first add server port
    try {
        int port = Integer.parseInt(server.getPort());
        ports.add(new ServerPort("server", Messages.portServer, port, "TCPIP"));
    } catch (Exception e) {
    // ignore
    }
    // add connectors
    try {
        String instanceServiceName = serverInstance.getService().getName();
        int size = server.getServiceCount();
        for (int i = 0; i < size; i++) {
            Service service = server.getService(i);
            int size2 = service.getConnectorCount();
            for (int j = 0; j < size2; j++) {
                Connector connector = service.getConnector(j);
                String className = connector.getClassName();
                String name = className;
                String protocol = "TCPIP";
                boolean advanced = true;
                String[] contentTypes = null;
                int port = -1;
                try {
                    port = Integer.parseInt(connector.getPort());
                } catch (Exception e) {
                // ignore
                }
                if (HTTP_CONNECTOR.equals(className)) {
                    name = "HTTP Connector";
                    protocol = "HTTP";
                    contentTypes = new String[] { "web", "webservices" };
                    // check for AJP/1.3 Coyote connector
                    String protocolHandler = connector.getProtocolHandlerClassName();
                    if (JK_PROTOCOL_HANDLER.equals(protocolHandler)) {
                        name = "AJP/1.3 Connector";
                        protocol = "AJP/1.3";
                    } else {
                        // assume HTTP, check for HTTP SSL connector
                        try {
                            Element element = connector.getSubElement("Factory");
                            if (SSL_SOCKET_FACTORY.equals(element.getAttribute("className"))) {
                                name = "SSL Connector";
                                protocol = "SSL";
                            }
                        } catch (Exception e) {
                        // ignore
                        }
                    }
                    if ("HTTP".equals(protocol))
                        advanced = false;
                } else if (APACHE_CONNECTOR.equals(className))
                    name = "Apache Connector";
                String portId;
                if (instanceServiceName != null && instanceServiceName.equals(service.getName()))
                    portId = Integer.toString(j);
                else
                    portId = i + "/" + j;
                if (className != null && className.length() > 0)
                    ports.add(new ServerPort(portId, name, port, protocol, contentTypes, advanced));
            }
        }
    } catch (Exception e) {
        Trace.trace(Trace.SEVERE, "Error getting server ports", e);
    }
    return ports;
}
Also used : Connector(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector) Element(org.w3c.dom.Element) ArrayList(java.util.ArrayList) Service(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service) ServerPort(org.eclipse.wst.server.core.ServerPort) CoreException(org.eclipse.core.runtime.CoreException)

Aggregations

ArrayList (java.util.ArrayList)36 BigInteger (java.math.BigInteger)33 Connector (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector)22 Service (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service)22 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)21 ExecutionException (java.util.concurrent.ExecutionException)19 CoreException (org.eclipse.core.runtime.CoreException)18 List (java.util.List)15 Test (org.junit.Test)15 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)15 Logger (org.slf4j.Logger)14 LoggerFactory (org.slf4j.LoggerFactory)14 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)13 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)12 BoundServices (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices)12 NwConstants (org.opendaylight.genius.mdsalutil.NwConstants)10 ServerPort (org.eclipse.wst.server.core.ServerPort)9 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)9 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)9 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)9