2 Replies Latest reply on Sep 19, 2012 8:04 PM by David Beaudet

    Only a type can be imported. org.apache.felix.scr.annotations.Component resolves to a package

    ravindrareddydr Level 1

      I copied the example code exactly, but it won't compile. I receive errors on all the annotations, like:

      "Only a type can be imported. org.apache.felix.scr.annotations.Component resolves to a package"

      and

      "Component cannot be resolved to a type"


      -------------------------------------------------------------------------

      package com.day.cq.wcm.apps.geometrixx.impl;


      import com.day.cq.workflow.WorkflowException;

      import com.day.cq.workflow.WorkflowSession;

      import com.day.cq.workflow.exec.WorkItem;

      import com.day.cq.workflow.exec.WorkflowData;

      import com.day.cq.workflow.exec.WorkflowProcess;

      import com.day.cq.workflow.metadata.MetaDataMap;

      import org.apache.felix.scr.annotations.Component;

      import org.apache.felix.scr.annotations.Properties;

      import org.apache.felix.scr.annotations.Property;

      import org.apache.felix.scr.annotations.Service;

      import org.osgi.framework.Constants;

      import org.slf4j.Logger;

      import org.slf4j.LoggerFactory;


      import javax.jcr.Node;

      import javax.jcr.RepositoryException;


      /**

      * Sample workflow process

      */

      @Component

      @Service

      @Properties({

      @Property(name = Constants.SERVICE_DESCRIPTION, value = "A sample workflow process implementation."),

      @Property(name = "process.label", value = "Sample Workflow Process")})


      public class CustomWorkflow implements WorkflowProcess {


      private static final String TYPE_JCR_PATH = "JCR_PATH";

      private static final Logger log = LoggerFactory.getLogger(CustomWorkflow.class);


      public void execute(WorkItem item, WorkflowSession session, MetaDataMap args) throws WorkflowException {

      WorkflowData workflowData = item.getWorkflowData();

      if (workflowData.getPayloadType().equals(TYPE_JCR_PATH)) {

      String path = workflowData.getPayload().toString();

      // More code here

      }

      }


      }

       

      Errors :

       

      DescriptionResourcePath
      Component cannot be resolved to a type.java/li
      Only a type can be imported. org.apache.felix.scr.annotations.Component resolves to a package.java/li
      Properties cannot be resolved to a type.java/l
      Service cannot be resolved to a type.java