Package smilehouse.opensyncro.pipes.component

Examples of smilehouse.opensyncro.pipes.component.PipeComponentIF


                labels.getLabel(COMPONENT_ID),
                labels.getLabel(DESCRIPTION),
                Entities.NBSP}));
        Locale locale = labels.getLocale();
        for(Iterator iter = components.iterator(); iter.hasNext();) {
            PipeComponentIF impl = (PipeComponentIF) iter.next();
            TR row = tt.getRow();
            row.addElement(new TD().addElement(impl.getName()))
                .addElement(
                    new TD().addElement(labels.getLabel("component_type"
                        + impl.getType())))
                        .addElement(new TD().addElement(impl.getID()))
                        .addElement(new TD().addElement(impl.getDescription(locale)));
            if(pers.isDynamicComponent(impl)) {
                row.setClass("dynamicComponent");
            }
            componentTable.addElement(row);
        }
View Full Code Here


    }
    public List loadComponentImplementations(int componentType){
        List filtered=new LinkedList();
        List components = loadComponentImplementations();
        for(Iterator iter = components.iterator(); iter.hasNext();) {
            PipeComponentIF component = (PipeComponentIF) iter.next();
            if(component.getType()==componentType)
                filtered.add(component);
        }
        return filtered;
    }
View Full Code Here

                                ParameterManager parameters,
                                Persister pers,
                                LabelResource labels,
                                int requestType) {

        PipeComponentIF component = null;
        PipeComponentData componentData = null;
       
        //component = pers.loadPipeComponent(new Long(parameters.getLong(COMPONENT_ID)));
        String componentId = parameters.getString(COMPONENT_ID);
        Long dataId = new Long(parameters.getLong(DATA_ID));

        //System.out.println("Servlet called with PipeComponentDataId " + dataId);
       
        // Query PipeComponentData from database
        componentData = pers.loadPipeComponentData(dataId);
       
        // Initialize a new PipeComponentData if database query returned null result
        if(componentData == null) {
            /*
            componentData = new PipeComponentData();
            componentData.setAttributes(new HashMap());
            pers.save(componentData);
            dataId = componentData.getId();
           
            //parameters.setParameter(DATA_ID, dataId.longValue());
           
            System.out.println("Retrieved Id " + dataId + " from saved new PipeComponentData");
            */
            return "<h3>Fatal: PipeComponentData ID " + dataId + " not found</h3>";
           
        }
       
        try {
          
            //System.out.println("EditComponent: " + componentId + ", Loaded pcdataId: " + componentData.getId());
           
            //component = pers.loadPipeComponent(componentId, dataId);
            component = Persister.getInstance(componentId, componentData);
        } catch(ComponentClassNotFoundException cnfe) {
            return "<br><b><font color=\"red\">"
                    + labels.getLabel("edited_component_class_not_found") + "</font></b><br>";
        }

        ElementContainer content = new ElementContainer().addElement(new BR()).addElement(
            new H1()
                .addElement(component.getName()));

        content.addElement(new HR());
       
        if( component instanceof GUIConfigurationIF) {
           
            GUIContext guiContext = ((GUIConfigurationIF) component).getGUIContext();

            if(guiContext != null) {

            // Component might have it's own labels...
               
            LabelResource customLabelResource = PipeComponentUtils.getCustomLabelResource(new Locale(
                environment.getLanguage(session)), labels, component.getClass());

            Map fields = guiContext.makeFields(component, customLabelResource, req);

            // -----------
            // Handle post
View Full Code Here

                    if(className != null) {
                        // Load the implementation description, create component instance and put it
                        // into it's place in the pipe
                        //PipeComponentImplementation impl = pers.loadComponentImplementation(className);

                        PipeComponentIF impl = Persister.getInstance(className);
                        if(impl != null) {
                            //PipeComponentIF newComponent = impl.getInstance();
                            PipeComponentIF newComponent = Persister.getInstance(className);
                            PipeComponentData pcdata;
                            pcdata = new PipeComponentData();
                            pcdata.setAttributes(new HashMap());
                            //Long dataId;

                            switch(componentType) {
                            case PipeComponentIF.TYPE_SOURCE:
                                pipe.setSource((SourceIF) newComponent);
                                pipe.setSourceID(newComponent.getID());

                                pcdata = new PipeComponentData();
                                pipe.setSourceData(pcdata);
                                newComponent.setData(pcdata);

                                pers.save(pcdata);

                                //dataId = pcdata.getId();
                                break;
                            case PipeComponentIF.TYPE_DESTINATION:
                                pipe.setDestination((DestinationIF) newComponent);
                                pipe.setDestinationID(newComponent.getID());

                                pcdata = new PipeComponentData();
                                pipe.setDestinationData(pcdata);
                                newComponent.setData(pcdata);

                                pers.save(pcdata);

                                //dataId = pcdata.getId();
                                break;
                            case PipeComponentIF.TYPE_CONVERTER:
                                pcdata = new PipeComponentData();
                                ConverterListItem cl = pipe.addConverter(
                                    (ConverterIF) newComponent,
                                    pcdata);
                                pers.save(cl);

                                pers.save(pipe);

                                //dataId = pcdata.getId();

                                /*System.out.println("Created new Converter (" + newComponent.getID() + ", " +
                                 className + "), dataId: " + dataId);*/

                                converterField = converterFieldInfo.getField(pipe, labels, req);
                                break;
                            }
                        }
                    }
                }

                // ------
                // Delete
                // ------
                if(parameters.wasGiven(DELETE_COMPONENT_OF_TYPE)
                        && parameters.getInt(DELETE_COMPONENT_OF_TYPE) != -1) {
                    switch(parameters.getInt(DELETE_COMPONENT_OF_TYPE)) {
                    case PipeComponentIF.TYPE_SOURCE:
                        PipeComponentIF source = pipe.getCurrentSource();
                        String sourceID = pipe.getSourceID();
                        if(sourceID != null) {
                            PipeComponentData sourceData = this.pipe.getSourceData();

                            // We need to remove references to Source component's PipeComponentData before deleting it
                            if(source != null) {
                                source.setData(null);
                            }
                            pipe.setSourceData(null);

                            // Delete the Source component's PipeComponentData
                            pers.delete(sourceData);

                            // Clear Source component instance and ID
                            pipe.setSource(null);
                            pipe.setSourceID(null);

                        }
                        break;
                    case PipeComponentIF.TYPE_DESTINATION:
                        PipeComponentIF destination = pipe.getCurrentDestination();
                        String destinationID = pipe.getDestinationID();
                        if(destinationID != null) {
                            PipeComponentData destinationData = this.pipe.getDestinationData();

                            // We need to remove references to Destination component's PipeComponentData before deleting it
                            if(destination != null) {
                               destination.setData(null);   
                            }
                           
                            pipe.setDestinationData(null);

                            // Delete the Destination component's PipeComponentData
View Full Code Here

                return componentName1.compareTo(componentName2);
            }
        });
       
        for(Iterator i = componentImplChoices.iterator(); i.hasNext();) {
            PipeComponentIF impl = (PipeComponentIF) i.next();
            implSelect.addElement(new Option(impl.getID()).addElement(impl.getName()));
        }

        Input createButton = new Input(Input.BUTTON, "cb", createButtonText);
        createButton.setOnClick("document.forms[0]." + CREATE_COMPONENT_OF_TYPE + ".value="
                + componentType + ";document.forms[0].action.value=" + ACTION_OK
View Full Code Here

     */
    public List loadComponents() {
        List list = new LinkedList();
        for(Iterator iter = resourceMap.keySet().iterator(); iter.hasNext();) {
            String className = (String) iter.next();
            PipeComponentIF pcimpl = getInstance(className);
            list.add(pcimpl);
        }

        return list;
    }
View Full Code Here

            Class[] paramTypes = {Object.class};
            Constructor cons = implClass.getConstructor(paramTypes);

            // Call the constructor to instantiate a new component
            Object[] params = {data};
            PipeComponentIF component = (PipeComponentIF) cons.newInstance(params);
            return component;

        } catch(ComponentClassNotFoundException cle) {
            throw new PipeComponentCreationException("Implementation class for Pipe Component "
                    + componentID + " not found.", cle);
View Full Code Here

TOP

Related Classes of smilehouse.opensyncro.pipes.component.PipeComponentIF

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.