Ejemplo n.º 1
0
  @Override
  public int doStartTag() throws JspException {

    int ret = super.doStartTag();
    try {

      if (site == null || "".equals(site)) {
        site = context.getSiteID();
      } else {
        // Site st = CMSUtil.getSiteCacheManager().getSiteByEname(site);
        // site = String.valueOf(st.getSiteId());
      }

      Site site_ = context.getSite();

      if (site_ == null) return ret;

      if (property == null) property = "name";
      Object v = ValueObjectUtil.getValue(site_, property);
      String value = v == null ? null : String.valueOf(v);
      if (value == null) value = "站点属性[" + property + "]未指定";

      out.print(value);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return ret;
  }
Ejemplo n.º 2
0
  @Test
  public void beanstoxml() throws Exception {
    FileBean fbean = new FileBean();

    fbean.setFile(ValueObjectUtil.getClassPathFile("org/frameworkset/soa/datasource-sql.xml"));
    ArrayBean bean = new ArrayBean();
    String content =
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
            + "<esb>"
            + "<call>"
            + "<!-- 调度中心需要的数据开始 -->"
            + "<property name=\"soamethodcall\" "
            + "class=\"org.frameworkset.soa.SOAMethodCall\" "
            + "f:requestor=\"requestor\" "
            + "f:requestid=\"1000000\" "
            + "f:password=\"requestpassword\" "
            + "f:encypt=\"encrypt\" "
            + "f:encyptalgorithem=\"algorithm\" "
            + "f:serviceid=\"hilaryserviceid\" "
            + "f:issynchronized=\"true\" >"
            + "<!-- 调度中心需要的数据结束 -->"
            + "<!-- 调度中心提交给服务提供方的服务方法信息 -->"
            + "<property name=\"soamethodinfo\" class=\"org.frameworkset.soa.SOAMethodInfo\" "
            + "f:methodName=\"methodname\">"
            + "<property name=\"paramTypes\">"
            + "<array componentType=\"Class\">"
            + "<property >String</property>"
            + "<property >String</property>"
            + "<property >String[]</property>"
            + "</array>"
            + "</property>"
            + "<property name=\"params\">"
            + "<array componentType=\"object\">"
            + "<property name=\"condition\">1=1</property>"
            + "<property name=\"orderby\">order by ${A}</property>"
            + "<property>"
            + "	<array componentType=\"String\">"
            + "<property>A</property>"
            + "<property>B</property>"
            + "</array>"
            + "</property>"
            + "</array>"
            + "</property>"
            + "</property>"
            + "</property>"
            + "</call>"
            + "</esb>";
    bean.setArrays(content.getBytes());
    List beans = new ArrayList();
    beans.add(fbean);
    beans.add(bean);

    String xmlcontent = ObjectSerializable.convertBeanObjectToXML("listObject", beans, List.class);
    System.out.println(xmlcontent);

    List copybeans =
        ObjectSerializable.convertXMLToBeanObject("listObject", xmlcontent, List.class);
    System.out.println(copybeans.size());
  }
Ejemplo n.º 3
0
	protected boolean match() {
//		if(actualValue == null)
//			return false;
		if(ValueObjectUtil.typecompare(actualValue,getValue()) > 0)
			return true;
		else
			return false;
	}
Ejemplo n.º 4
0
  @Test
  public void filebeantoxml() throws Exception {
    FileBean bean = new FileBean();

    bean.setFile(ValueObjectUtil.getClassPathFile("org/frameworkset/soa/datasource-sql.xml"));
    String xmlcontent =
        ObjectSerializable.convertBeanObjectToXML("beanfile", bean, bean.getClass());
    System.out.println(xmlcontent);
    FileBean bean1 =
        ObjectSerializable.convertXMLToBeanObject("beanfile", xmlcontent, FileBean.class);
    //		System.out.println(ValueObjectUtil.getFileContent(bean1.getFile(),"UTF-8"));
  }
Ejemplo n.º 5
0
	public Object getComponentArray(CallContext callcontext) {
		if (this.getComponentType() == null)
			return this;

		if (componentArray == null) {
			synchronized (lock) {
				if (componentArray == null) {
//					if (this.size() > 0) 
					{
						if (this.componentType.equalsIgnoreCase(Pro.COMPONENT_BEAN)) {
							Class enumType = this.pros[0].getBeanClass();

							// componentArray = new ArrayList(this.size());
							componentArray = Array.newInstance(enumType, this
									.size());
							int i = 0;
							if(pros != null)
							{
								Context currentLoopContext = callcontext != null?callcontext.getLoopContext():null;
								for (Pro v : this.pros) {
									try{
										Array.set(componentArray, i, v.getBean(callcontext));
									}
									finally
		    						{
		    							if(callcontext != null)
		    								callcontext.setLoopContext(currentLoopContext);
		    						}
									i++;
								}
							}
						} else if (this.componentType
								.equalsIgnoreCase(Pro.COMPONENT_STRING_SHORTNAME) || this.componentType
								.equalsIgnoreCase(Pro.COMPONENT_STRING)) {

							// componentArray = new ArrayList(this.size());
							componentArray = Array.newInstance(String.class,
									this.size());
							int i = 0;
							if(pros != null)
							{
								for (Pro v : this.pros) {
								Array.set(componentArray, i, v.getString());
								i++;
								}
							}
						}
						else if (this.componentType.equalsIgnoreCase(Pro.COMPONENT_OBJECT_SHORTNAME) || this.componentType.equalsIgnoreCase(Pro.COMPONENT_OBJECT)) {
							
							// componentArray = new ArrayList(this.size());
							componentArray = Array.newInstance(Object.class, this
									.size());
							int i = 0;
							if(pros != null)
							{
								Context currentLoopContext = callcontext != null?callcontext.getLoopContext():null;
								for (Pro v : this.pros) {
									try{
										Array.set(componentArray, i, v.getBean(callcontext));
									}
									finally
		    						{
		    							if(callcontext != null)
		    								callcontext.setLoopContext(currentLoopContext);
		    						}
									i++;
								}
							}
						}
						else if (this.componentType.equalsIgnoreCase(Pro.COMPONENT_CLASS) ) {
							
							// componentArray = new ArrayList(this.size());
							componentArray = Array.newInstance(Class.class, this
									.size());
							int i = 0;
							if(pros != null)
							{
								Context currentLoopContext = callcontext != null?callcontext.getLoopContext():null;
								for (Pro v : this.pros) {
								try{
									Object value = v.getBean(callcontext);
									Array.set(componentArray, i, ValueObjectUtil.typeCast(value, Class.class));
								}
								finally
	    						{
	    							if(callcontext != null)
	    								callcontext.setLoopContext(currentLoopContext);
	    						}
								i++;
								}
							}
						}						
						else {
							try {
								componentArray = Array.newInstance(ValueObjectUtil.getClass(componentType), this
										.size());
								int i = 0;
								if(pros != null)
								{
									Context currentLoopContext = callcontext != null?callcontext.getLoopContext():null;
									for (Pro v : this.pros) {
										try{
											Array.set(componentArray, i, v.getBean(callcontext));
										}
										finally
										{
											if(callcontext != null)
			    								callcontext.setLoopContext(currentLoopContext);
										}
									i++;
									}
								}
							} catch (NegativeArraySizeException e) {
								log.error(e.getMessage(),e);
								componentArray = this;
							} catch (ClassNotFoundException e) {
								log.error(e.getMessage(),e);
								componentArray = this;
							}
							catch (Exception e) {
								log.error(e.getMessage(),e);
								componentArray = this;
							}
							
							
						}
					}
//					else {
//						componentArray = this;
//					}
				}
			}
		}

		return componentArray;
	}